/* ****************************************************************************
*
* getAndSize - 
*/
TEST(ScopeVector, getAndSize)
{
  ScopeVector   sV;
  Scope         scope0("Type", "Value0");
  Scope         scope1("Type", "Value1");
  Scope         scope2("Type", "Value2");
  Scope*        scopeP;

  utInit();

  sV.push_back(&scope0);
  sV.push_back(&scope1);
  sV.push_back(&scope2);

  EXPECT_EQ(3, sV.size());

  scopeP = sV[0];
  EXPECT_STREQ("Value0", scopeP->value.c_str());

  scopeP = sV[1];
  EXPECT_STREQ("Value1", scopeP->value.c_str());

  scopeP = sV[2];
  EXPECT_STREQ("Value2", scopeP->value.c_str());

  utExit();
}
/* ****************************************************************************
*
* renderAndRelease -
*
*/
TEST(ScopeVector, renderAndRelease)
{
  Scope*         s = new Scope("Type", "Value");
  ScopeVector    sV;
  std::string    out;

  utInit();

  out = sV.toJsonV1(false);
  EXPECT_STREQ("", out.c_str());

  sV.push_back(s);

  out = sV.toJsonV1(false);

  EXPECT_EQ(sV.size(), 1);
  sV.release();
  EXPECT_EQ(sV.size(), 0);

  utExit();
}
/* ****************************************************************************
*
* renderAndRelease - 
*
* FIXME P5 #1862: _json counterpart?
*/
TEST(ScopeVector, DISABLED_renderAndRelease)
{
  Scope*         s = new Scope("Type", "Value");
  ScopeVector    sV;
  const char*    outfile = "ngsi.scopeVector.render.middle.xml";
  std::string    out;

  utInit();

  out = sV.render("", false);
  EXPECT_STREQ("", out.c_str());

  sV.push_back(s);

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

  EXPECT_EQ(sV.size(), 1);
  sV.release();
  EXPECT_EQ(sV.size(), 0);

  utExit();
}