def test_begin_and_rollback_transaction(self):
        transaction = self.client.new_transaction()
        transaction.begin()
        self.assertIsNotNone(transaction.id)
        self.assertEqual(transaction.state, hazelcast.transaction._STATE_ACTIVE)

        transaction.rollback()
        self.assertEqual(transaction.state, hazelcast.transaction._STATE_ROLLED_BACK)
    def test_begin_and_rollback_transaction(self):
        transaction = self.client.new_transaction()
        transaction.begin()
        self.assertIsNotNone(transaction.id)
        self.assertEqual(transaction.state, hazelcast.transaction._STATE_ACTIVE)

        transaction.rollback()
        self.assertEqual(transaction.state, hazelcast.transaction._STATE_ROLLED_BACK)
    def test_begin_and_commit_transaction(self):
        transaction = self.client.new_transaction()
        transaction.begin()
        self.assertIsNotNone(transaction.id)
        self.assertEqual(transaction.state, hazelcast.transaction._STATE_ACTIVE)

        transaction.commit()
        self.assertEqual(transaction.state, hazelcast.transaction._STATE_COMMITTED)
    def test_begin_and_commit_transaction(self):
        transaction = self.client.new_transaction()
        transaction.begin()
        self.assertIsNotNone(transaction.id)
        self.assertEqual(transaction.state, hazelcast.transaction._STATE_ACTIVE)

        transaction.commit()
        self.assertEqual(transaction.state, hazelcast.transaction._STATE_COMMITTED)
Esempio n. 5
0
    def test_nested_transactions_not_allowed(self):
        transaction = self.client.new_transaction()
        transaction.begin()

        nested_transaction = self.client.new_transaction()
        with self.assertRaises(TransactionError):
            nested_transaction.begin()

        transaction.rollback()
    def test_nested_transactions_not_allowed(self):
        transaction = self.client.new_transaction()
        transaction.begin()

        nested_transaction = self.client.new_transaction()
        with self.assertRaises(TransactionError):
            nested_transaction.begin()

        transaction.rollback()
Esempio n. 7
0
 def test_rollback_transaction_twice(self):
     transaction = self.client.new_transaction()
     transaction.begin()
     transaction.rollback()
     with self.assertRaises(TransactionError):
         transaction.rollback()
Esempio n. 8
0
 def test_commit_transaction_twice(self):
     transaction = self.client.new_transaction()
     transaction.begin()
     transaction.commit()
     with self.assertRaises(TransactionError):
         transaction.commit()
Esempio n. 9
0
 def test_timeout(self):
     transaction = self.client.new_transaction(timeout=0.001)
     transaction.begin()
     time.sleep(0.1)
     with self.assertRaises(TransactionError):
         transaction.commit()
 def test_rollback_transaction_twice(self):
     transaction = self.client.new_transaction()
     transaction.begin()
     transaction.rollback()
     with self.assertRaises(TransactionError):
         transaction.rollback()
 def test_commit_transaction_twice(self):
     transaction = self.client.new_transaction()
     transaction.begin()
     transaction.commit()
     with self.assertRaises(TransactionError):
         transaction.commit()
 def test_timeout(self):
     transaction = self.client.new_transaction(timeout=0.001)
     transaction.begin()
     time.sleep(0.1)
     with self.assertRaises(TransactionError):
         transaction.commit()