def _writeSingleTest(self, key, data): t = Transaction() t.write(str(self._testTime) + key, data) # now try to read the data: self.assertEqual(t.read(str(self._testTime) + key), data) # commit the transaction and try to read the data with a new one: t.commit() t.close_connection() t = Transaction() self.assertEqual(t.read(str(self._testTime) + key), data) t.close_connection()
def testWriteString(self): key = "_testWriteString1_" t = Transaction() for i in xrange(len(_TEST_DATA)): t.write(str(self._testTime) + key + str(i), _TEST_DATA[i]) # now try to read the data: for i in xrange(len(_TEST_DATA)): actual = t.read(str(self._testTime) + key + str(i)) self.assertEqual(actual, _TEST_DATA[i]) # commit the transaction and try to read the data with a new one: t.commit() t.close_connection() t = Transaction() for i in xrange(len(_TEST_DATA)): actual = t.read(str(self._testTime) + key + str(i)) self.assertEqual(actual, _TEST_DATA[i]) t.close_connection()
def testCommit_Empty(self): t = Transaction() t.commit() t.close_connection()
def testCommit_NotConnected(self): t = Transaction() t.close_connection() #self.assertRaises(scalaris.ConnectionError, t.commit) t.commit() t.close_connection()