X-Git-Url: http://plrg.eecs.uci.edu/git/?p=iotcloud.git;a=blobdiff_plain;f=version2%2Fsrc%2FC%2FTest.C;h=0f6c96cd6df7e406bd9735d9f931812db89de81f;hp=14fec0d44d627a113e088561e5060815f1c1f7d0;hb=7095771b9769e87bdc5df84e306e3d95e6e4040b;hpb=15acb678f516190fbf7364a41a1f570e90dc09d0 diff --git a/version2/src/C/Test.C b/version2/src/C/Test.C index 14fec0d..0f6c96c 100644 --- a/version2/src/C/Test.C +++ b/version2/src/C/Test.C @@ -12,14 +12,18 @@ int main(int numargs, char ** args) { Vector * transStatusList = new Vector(); // Setup the 2 clients - Table * t1 = new Table(new IoTString("http://dc-6.calit2.uci.edu/test.iotcloud/"), new IoTString("reallysecret"), 321, -1); + IoTString *baseurl = new IoTString("http://dc-6.calit2.uci.edu/test.iotcloud/"); + IoTString * password = new IoTString("reallysecret"); + Table * t1 = new Table(baseurl, password, 321, -1); t1->initTable(); printf("T1 Ready\n"); - Table * t2 = new Table(new IoTString("http://dc-6.calit2.uci.edu/test.iotcloud/"), new IoTString("reallysecret"), 351, -1); + Table * t2 = new Table(baseurl, password, 351, -1); t2->update(); printf("T2 Ready\n"); + delete baseurl; delete password; + // Make the Keys printf("Setting up keys\n"); for (int i = 0; i < NUMBER_OF_TESTS; i++) { @@ -37,6 +41,10 @@ int main(int numargs, char ** args) { t1->createNewKey(ib, 351); t2->createNewKey(ic, 321); t2->createNewKey(id, 351); + delete ia; + delete ib; + delete ic; + delete id; } // Do Updates for the keys @@ -61,20 +69,26 @@ int main(int numargs, char ** args) { IoTString * iValueD = new IoTString(buffer); t1->startTransaction(); - t1->addKV(iKeyA, iValueA); + t1->put(iKeyA, iValueA); transStatusList->add(t1->commitTransaction()); + delete iKeyA; delete iValueA; + t1->startTransaction(); - t1->addKV(iKeyB, iValueB); + t1->put(iKeyB, iValueB); transStatusList->add(t1->commitTransaction()); + delete iKeyB; delete iValueB; t2->startTransaction(); - t2->addKV(iKeyC, iValueC); + t2->put(iKeyC, iValueC); transStatusList->add(t2->commitTransaction()); + delete iKeyC; delete iValueC; t2->startTransaction(); - t2->addKV(iKeyD, iValueD); + t2->put(iKeyD, iValueD); transStatusList->add(t2->commitTransaction()); + delete iKeyD; delete iValueD; } + printf("Updating Clients...\n"); t1->update(); t2->update(); @@ -147,6 +161,14 @@ int main(int numargs, char ** args) { printf("Key-Value t2 incorrect: keyD testValD2\n"); foundError = true; } + delete iKeyA; delete iValueA; + delete iKeyB; delete iValueB; + delete iKeyC; delete iValueC; + delete iKeyD; delete iValueD; + delete testValA1; delete testValA2; + delete testValB1; delete testValB2; + delete testValC1; delete testValC2; + delete testValD1; delete testValD2; } for (uint i = 0; i < transStatusList->size(); i++) { @@ -155,6 +177,7 @@ int main(int numargs, char ** args) { foundError = true; printf("Status error\n"); } + delete status; } if (foundError) { @@ -162,5 +185,9 @@ int main(int numargs, char ** args) { } else { printf("No Errors Found...\n"); } + + delete transStatusList; + delete t1; + delete t2; }