/* ****************************************************************************
*
* response -
*/
TEST(UpdateContextAvailabilitySubscriptionRequest, response)
{
    UpdateContextAvailabilitySubscriptionResponse  ucas;
    StatusCode                                     ec(SccBadRequest, "Detail");
    UpdateContextAvailabilitySubscriptionResponse  ucas2(ec);
    std::string                                    out;
    const char*                                    outfile1 = "ngsi9.updateContextAvailabilitySubscriptionResponse.response1.valid.xml";
    const char*                                    outfile2 = "ngsi9.updateContextAvailabilitySubscriptionResponse.response2.valid.xml";
    const char*                                    outfile3 = "ngsi9.updateContextAvailabilitySubscriptionResponse.response3.valid.xml";
    const char*                                    outfile4 = "ngsi9.updateContextAvailabilitySubscriptionResponse.response4.valid.xml";

    utInit();

    EXPECT_EQ(ucas2.errorCode.code, SccBadRequest);

    ucas.subscriptionId.set("012345678901234567890123");

    out = ucas.check(UpdateContextAvailabilitySubscription, XML, "", "", 0);
    EXPECT_EQ("OK", out);

    out = ucas.render(UpdateContextAvailabilitySubscription, XML, "", 0);
    EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile1)) << "Error getting test data from '" << outfile1 << "'";
    EXPECT_STREQ(expectedBuf, out.c_str());

    ucas.errorCode.fill(SccBadRequest, "Detail");
    out = ucas.render(UpdateContextAvailabilitySubscription, XML, "", 0);
    EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile2)) << "Error getting test data from '" << outfile2 << "'";
    EXPECT_STREQ(expectedBuf, out.c_str());

    ucas.errorCode.fill(SccNone);
    ucas.duration.set("ddd");
    out = ucas.check(UpdateContextAvailabilitySubscription, XML, "", "", 0);
    EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile3)) << "Error getting test data from '" << outfile3 << "'";
    EXPECT_STREQ(expectedBuf, out.c_str());

    out = ucas.check(UpdateContextAvailabilitySubscription, XML, "", "predetected error", 0);
    EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile4)) << "Error getting test data from '" << outfile4 << "'";
    EXPECT_STREQ(expectedBuf, out.c_str());

    utExit();
}
/* ****************************************************************************
*
* response -
*
*/
TEST(UpdateContextAvailabilitySubscriptionRequest, response)
{
  UpdateContextAvailabilitySubscriptionResponse  ucas;
  StatusCode                                     ec(SccBadRequest, "Detail");
  UpdateContextAvailabilitySubscriptionResponse  ucas2(ec);
  std::string                                    out;

  utInit();

  EXPECT_EQ(ucas2.errorCode.code, SccBadRequest);

  ucas.subscriptionId.set("012345678901234567890123");

  out = ucas.check("");
  EXPECT_EQ("OK", out);

  utExit();
}