/* ****************************************************************************
*
* constructorsAndRender - 
*/
TEST(UnsubscribeContextAvailabilityResponse, constructorsAndRender)
{
  UnsubscribeContextAvailabilityResponse  ucar1;
  SubscriptionId                          subscriptionId;

  utInit();

  subscriptionId.set("111122223333444455556666");

  UnsubscribeContextAvailabilityResponse  ucar2(subscriptionId);
  StatusCode                              ec(SccBadRequest, "D");
  UnsubscribeContextAvailabilityResponse  ucar3(ec);
  std::string                             out;
  const char*                             outfile = "ngsi9.unsubscribeContextAvailabilityResponse.constructorsAndRender.valid.xml";

  EXPECT_EQ(0,                    ucar1.statusCode.code);
  EXPECT_EQ(subscriptionId.get(), ucar2.subscriptionId.get());
  EXPECT_EQ(SccBadRequest,        ucar3.statusCode.code);

  out = ucar3.render(UnsubscribeContext, XML, "");
  EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile)) << "Error getting test data from '" << outfile << "'";
  EXPECT_STREQ(expectedBuf, out.c_str());

  utExit();
}
コード例 #2
0
/* ****************************************************************************
*
* setGetAndIsEmpty - 
*/
TEST(SubscriptionId, setGetAndIsEmpty)
{
  SubscriptionId  sId;
  std::string     out;

  utInit();

  sId.set("SUB_123");
  out = sId.get();
  EXPECT_STREQ("SUB_123", out.c_str());

  EXPECT_FALSE(sId.isEmpty());
  sId.set("");
  EXPECT_TRUE(sId.isEmpty());

  utExit();
}
/* ****************************************************************************
*
* constructorsAndRender - 
*
*/
TEST(UnsubscribeContextAvailabilityResponse, constructorsAndRender)
{
  UnsubscribeContextAvailabilityResponse  ucar1;
  SubscriptionId                          subscriptionId;

  utInit();

  subscriptionId.set("111122223333444455556666");

  UnsubscribeContextAvailabilityResponse  ucar2(subscriptionId);
  StatusCode                              ec(SccBadRequest, "D");
  UnsubscribeContextAvailabilityResponse  ucar3(ec);
  std::string                             out;

  EXPECT_EQ(0,                    ucar1.statusCode.code);
  EXPECT_EQ(subscriptionId.get(), ucar2.subscriptionId.get());
  EXPECT_EQ(SccBadRequest,        ucar3.statusCode.code);

  utExit();
}
/* ****************************************************************************
*
* UnsubscribeContextAvailabilityRequest::UnsubscribeContextAvailabilityRequest - 
*/
UnsubscribeContextAvailabilityRequest::UnsubscribeContextAvailabilityRequest(SubscriptionId& _subscriptionId)
{
   subscriptionId.set(_subscriptionId.get());
}