Table *t1;
void setup() {
- Serial.begin();
+ // TODO: This test uses the Serial library
+ // Please install "screen" on your machine and run
+ // it on the serial port right after flashing the
+ // firmware onto the Particle board.
+ // e.g. sudo screen /dev/ttyACM0
+ Serial.begin();
timer = TimingSingleton_getInstance();
foundError = false;
transStatusList = new MyVector<TransactionStatus *>();
IoTString *baseurl = new IoTString("http://dc-6.calit2.uci.edu/test.iotcloud/");
- IoTString * password = new IoTString("reallysecret");
+ IoTString * password = new IoTString("reallysecret");
t1 = new Table(baseurl, password, 321, -1);
- t1->initTable();
-
+ t1->initTable();
+ Serial.println("Finished table init...");
baseurl->releaseRef();
password->releaseRef();
sprintf(buffer, "b%d", i);
IoTString *ib = new IoTString(buffer);
t1->createNewKey(ia, 321);
- t1->createNewKey(ib, 351);
+ t1->createNewKey(ib, 321);
ia->releaseRef();
ib->releaseRef();
}
+ Serial.println("Finished key generation...");
}
transStatusList->add(t1->commitTransaction());
iKeyB->releaseRef();
iValueB->releaseRef();
+
+ Serial.println("Added new transaction: ");
+ Serial.print("a");
+ Serial.println(i);
+ Serial.print("b");
+ Serial.println(i);
}
t1->update();
+ Serial.println("Updated table...");
for (int i = 0; i < NUMBER_OF_TESTS; i++) {
char buffer[80];
IoTString *testValB1 = t1->getCommitted(iKeyB);
if ((testValA1 == NULL) || (testValA1->equals(iValueA) == false)) {
- // printf("Key-Value t1 incorrect: keyA\n");
+ Serial.println("Key-Value t1 incorrect: keyA");
foundError = true;
}
if ((testValB1 == NULL) || (testValB1->equals(iValueB) == false)) {
- // printf("Key-Value t1 incorrect: keyB\n");
+ Serial.println("Key-Value t1 incorrect: keyB");
foundError = true;
}
TransactionStatus * status = transStatusList->get(i);
if (status->getStatus() != TransactionStatus_StatusCommitted) {
foundError = true;
-// printf("Status error\n");
+ Serial.println("Status error");
}
delete status;
}
if (foundError) {
-// printf("Found Errors...\n");
- } else {
+ Serial.println("Found Errors...");
}
delete transStatusList;
delete t1;
+
+ Serial.println("Process done... now waiting...");
+ while(true) { }
}