Beispiel #1
0
 def testWriteString_NotConnected(self):
     key = "_WriteString_NotConnected"
     t = Transaction()
     t.close_connection()
     #self.assertRaises(scalaris.ConnectionError, t.write, str(self._testTime) + key, _TEST_DATA[0])
     t.write(str(self._testTime) + key, _TEST_DATA[0])
     t.close_connection()
 def testWriteString_NotConnected(self):
     key = "_WriteString_NotConnected"
     t = Transaction()
     t.close_connection()
     #self.assertRaises(scalaris.ConnectionError, t.write, str(self._testTime) + key, _TEST_DATA[0])
     t.write(str(self._testTime) + key, _TEST_DATA[0])
     t.close_connection()
Beispiel #3
0
 def testReqTooLarge(self):
     conn = Transaction()
     data = '0' * _TOO_LARGE_REQUEST_SIZE
     key = "_ReqTooLarge"
     try:
         conn.write(str(self._testTime) + key, data)
         self.fail('The write should have failed unless yaws_max_post_data was set larger than ' + str(_TOO_LARGE_REQUEST_SIZE))
     except scalaris.ConnectionError:
         pass
     
     conn.close_connection()
Beispiel #4
0
 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()
Beispiel #5
0
 def testWriteString_NotFound(self):
     key = "_WriteString_notFound"
     t = Transaction()
     notFound = False
     try:
         t.read(str(self._testTime) + key)
     except scalaris.NotFoundError:
         notFound = True
     
     self.assertTrue(notFound)
     t.write(str(self._testTime) + key, _TEST_DATA[0])
     self.assertEqual(t.read(str(self._testTime) + key), _TEST_DATA[0])
     t.close_connection()
    def testReqTooLarge(self):
        conn = Transaction()
        data = '0' * _TOO_LARGE_REQUEST_SIZE
        key = "_ReqTooLarge"
        try:
            conn.write(str(self._testTime) + key, data)
            self.fail(
                'The write should have failed unless yaws_max_post_data was set larger than '
                + str(_TOO_LARGE_REQUEST_SIZE))
        except scalaris.ConnectionError:
            pass

        conn.close_connection()
    def testWriteString_NotFound(self):
        key = "_WriteString_notFound"
        t = Transaction()
        notFound = False
        try:
            t.read(str(self._testTime) + key)
        except scalaris.NotFoundError:
            notFound = True

        self.assertTrue(notFound)
        t.write(str(self._testTime) + key, _TEST_DATA[0])
        self.assertEqual(t.read(str(self._testTime) + key), _TEST_DATA[0])
        t.close_connection()
Beispiel #8
0
 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 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()