X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=version2%2Fsrc%2FC%2FUpdate.C;fp=version2%2Fsrc%2FC%2FUpdate.C;h=805cc8b104d0cbc907cfc75bdac5bb14f68a706d;hb=b687de99dbbbae04564b9fe4aad3e159782b8a26;hp=0000000000000000000000000000000000000000;hpb=87013fb48b87cea6f466327930acd099b8ee29b3;p=iotcloud.git diff --git a/version2/src/C/Update.C b/version2/src/C/Update.C new file mode 100644 index 0000000..805cc8b --- /dev/null +++ b/version2/src/C/Update.C @@ -0,0 +1,58 @@ +#include "Table.h" +#include "IoTString.h" +#include "TimingSingleton.h" +#include "TransactionStatus.h" + +#define NUMBER_OF_SENSORS 1 +#define MACHINE_ID 260 + +int main(int numargs, char ** args) { + TimingSingleton * timer = TimingSingleton_getInstance(); + + bool foundError = false; + Vector * transStatusList = new Vector(); + + // Setup the 2 clients + IoTString * baseurl = new IoTString("http://dc-6.calit2.uci.edu/test.iotcloud/"); + IoTString * password = new IoTString("reallysecret"); + Table * t1 = new Table(baseurl, password, MACHINE_ID, -1); + t1->rebuild(); + printf("T1 Ready\n"); + + baseurl->releaseRef(); + password->releaseRef(); + + /*char keyBuffer[80]; + char dataBuffer[80]; + + sprintf(keyBuffer, "sensor0"); + IoTString * iKeyA = new IoTString(keyBuffer); + sprintf(dataBuffer, "data1"); + IoTString * iValueA = new IoTString(dataBuffer); + t1->startTransaction(); + t1->put(iKeyA, iValueA); + transStatusList->add(t1->commitTransaction());*/ + t1->update(); + + //iKeyA->releaseRef(); + //iValueA->releaseRef(); + + for (uint i = 0; i < transStatusList->size(); i++) { + TransactionStatus * status = transStatusList->get(i); + if (status->getStatus() != TransactionStatus_StatusCommitted) { + foundError = true; + printf("Status error\n"); + } + delete status; + } + + if (foundError) { + printf("Found Errors...\n"); + } else { + printf("No Errors Found...\n"); + } + + delete transStatusList; + delete t1; +} +