From e5443b0e763391e9c0c5b62797a097cfb2ced7bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Wed, 19 May 2010 19:27:58 +0200 Subject: [PATCH] feature #192: Tests fixed for new xml generation with CDATA --- src/common/test/single_attribute.cc | 4 +- src/common/test/vector_attribute.cc | 5 +- src/template/test/template.cc | 72 +++++++++++++++----------- src/template/test/template_sql.cc | 7 +-- src/vm/test/VirtualMachinePoolTest.cc | 10 ++-- src/vnm/test/VirtualNetworkPoolTest.cc | 24 +++++---- 6 files changed, 69 insertions(+), 53 deletions(-) diff --git a/src/common/test/single_attribute.cc b/src/common/test/single_attribute.cc index 4da4a0daed..cd9462e0d4 100644 --- a/src/common/test/single_attribute.cc +++ b/src/common/test/single_attribute.cc @@ -73,8 +73,8 @@ public: am = a->to_xml(); bm = b->to_xml(); - CPPUNIT_ASSERT(*am == ""); - CPPUNIT_ASSERT(*bm == "value_b"); + CPPUNIT_ASSERT(*am == ""); + CPPUNIT_ASSERT(*bm == ""); delete am; delete bm; diff --git a/src/common/test/vector_attribute.cc b/src/common/test/vector_attribute.cc index aa41b7c6c9..5c6b3d634d 100644 --- a/src/common/test/vector_attribute.cc +++ b/src/common/test/vector_attribute.cc @@ -92,8 +92,9 @@ public: bm = b->to_xml(); CPPUNIT_ASSERT(*am == ""); - CPPUNIT_ASSERT(*bm == "val1val2" - "val3"); + CPPUNIT_ASSERT(*bm == "" + "" + ""); delete am; delete bm; } diff --git a/src/template/test/template.cc b/src/template/test/template.cc index 15fdcf9574..bba056c88b 100644 --- a/src/template/test/template.cc +++ b/src/template/test/template.cc @@ -54,11 +54,14 @@ public: "GRAPHICS=PORT=12@^_^@VNC=127.0.0.1\nMEMORY=345\n" "REQUIREMENTS=HOSTNAME = \"host*.com\"\n"; - test_ok_xml=""; + test_ok_xml=""; test_ok_str= "\n\tCPU=4" @@ -161,14 +164,16 @@ public: tmp = attrs[0]->to_xml(); CPPUNIT_ASSERT( *tmp == - "disk attribute path1"); + "" + ""); delete tmp; CPPUNIT_ASSERT(attrs[1]->type() == Attribute::VECTOR); tmp = attrs[1]->to_xml(); CPPUNIT_ASSERT( *tmp == - "strpath2disk"); + "" + ""); delete tmp; CPPUNIT_ASSERT(t1->get("CPU",attrs) == 1 ); @@ -176,7 +181,7 @@ public: CPPUNIT_ASSERT(attrs[2]->type() == Attribute::SIMPLE); tmp = attrs[2]->to_xml(); - CPPUNIT_ASSERT( *tmp == "4"); + CPPUNIT_ASSERT( *tmp == ""); delete tmp; string sval; @@ -200,9 +205,11 @@ public: vector attrs; string t1_xml; - string rm_xml=""; + string rm_xml=""; t1->remove("DISK",attrs); t1->to_xml(t1_xml); @@ -218,12 +225,15 @@ public: void test_set() { - string t1_xml=""; + string t1_xml=""; string xml; string nattr = "XTRA"; @@ -239,13 +249,14 @@ public: nattr = "CPU"; vattr = "5"; - t1_xml=""; + t1_xml=""; SingleAttribute *b = new SingleAttribute(nattr,vattr); t1->set(b); @@ -253,16 +264,17 @@ public: CPPUNIT_ASSERT(t1_xml == xml); - string tr_xml=""; + string tr_xml=""; SingleAttribute *c = new SingleAttribute(nattr,vattr); tr->set(c); tr->to_xml(xml); - + CPPUNIT_ASSERT(tr_xml == xml); } diff --git a/src/template/test/template_sql.cc b/src/template/test/template_sql.cc index 36689745e4..4947360a7b 100644 --- a/src/template/test/template_sql.cc +++ b/src/template/test/template_sql.cc @@ -100,12 +100,7 @@ public: " ]\n"; template_xml = - ""; + ""; } ~TemplateSQLTest(){}; diff --git a/src/vm/test/VirtualMachinePoolTest.cc b/src/vm/test/VirtualMachinePoolTest.cc index 4544e02a32..f575b70fe6 100644 --- a/src/vm/test/VirtualMachinePoolTest.cc +++ b/src/vm/test/VirtualMachinePoolTest.cc @@ -48,14 +48,16 @@ const string xmls[] = "0123VM one010000000000000000", + ">0", "1261Second VM0" "1000000000000<" "/ETIME>0000", + "_TX>0", "0123VM one010000000000000123Net number one" - "1br1" + "1br1" "130.10.0.150:20:20:20:20:20" "0-1", "1261A virtual network" - "0br0" + "0br0" "", "0133Net number two" - "1br1" + "1br1" "130.10.2.1" "50:20:20:20:20:200-1" ""