Commit d798a8ec authored by Grégory Wisniewski's avatar Grégory Wisniewski

Fixes after r1833.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1851 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 715bfd9d
...@@ -916,10 +916,10 @@ class AnswerTransactionInformation(Packet): ...@@ -916,10 +916,10 @@ class AnswerTransactionInformation(Packet):
return ''.join(body) return ''.join(body)
def _decode(self, body): def _decode(self, body):
r = unpack('!8sHHHBL', body[:18]) r = unpack('!8sHHHBL', body[:19])
tid, user_len, desc_len, ext_len, packed, oid_len = r tid, user_len, desc_len, ext_len, packed, oid_len = r
packed = bool(packed) packed = bool(packed)
body = body[18:] body = body[19:]
user = body[:user_len] user = body[:user_len]
body = body[user_len:] body = body[user_len:]
desc = body[:desc_len] desc = body[:desc_len]
......
...@@ -424,7 +424,7 @@ class MySQLDatabaseManager(DatabaseManager): ...@@ -424,7 +424,7 @@ class MySQLDatabaseManager(DatabaseManager):
% tid) % tid)
self.commit() self.commit()
if r: if r:
oids, user, desc, exti, packed = r[0] oids, user, desc, ext, packed = r[0]
if (len(oids) % 8) != 0 or len(oids) == 0: if (len(oids) % 8) != 0 or len(oids) == 0:
raise DatabaseFailure('invalid oids for tid %x' % tid) raise DatabaseFailure('invalid oids for tid %x' % tid)
oid_list = [] oid_list = []
......
...@@ -733,17 +733,21 @@ class ClientApplicationTests(NeoTestBase): ...@@ -733,17 +733,21 @@ class ClientApplicationTests(NeoTestBase):
self.voteTransaction(app) self.voteTransaction(app)
self.askFinishTransaction(app) self.askFinishTransaction(app)
# undo 1 -> no previous revision # undo 1 -> no previous revision
u1p1 = Packets.AnswerTransactionInformation(tid1, '', '', '', (oid1, )) u1p1 = Packets.AnswerTransactionInformation(tid1, '', '', '',
False, (oid1, ))
u1p2 = Errors.OidNotFound('oid not found') u1p2 = Errors.OidNotFound('oid not found')
# undo 2 -> not end tid # undo 2 -> not end tid
u2p1 = Packets.AnswerTransactionInformation(tid2, '', '', '', (oid2, )) u2p1 = Packets.AnswerTransactionInformation(tid2, '', '', '',
False, (oid2, ))
u2p2 = Packets.AnswerObject(oid2, tid2, tid3, 0, makeChecksum('O2V1'), 'O2V1') u2p2 = Packets.AnswerObject(oid2, tid2, tid3, 0, makeChecksum('O2V1'), 'O2V1')
# undo 3 -> conflict # undo 3 -> conflict
u3p1 = Packets.AnswerTransactionInformation(tid3, '', '', '', (oid2, )) u3p1 = Packets.AnswerTransactionInformation(tid3, '', '', '',
False, (oid2, ))
u3p2 = Packets.AnswerObject(oid2, tid3, tid3, 0, makeChecksum('O2V2'), 'O2V2') u3p2 = Packets.AnswerObject(oid2, tid3, tid3, 0, makeChecksum('O2V2'), 'O2V2')
u3p3 = Packets.AnswerStoreObject(conflicting=1, oid=oid2, serial=tid2) u3p3 = Packets.AnswerStoreObject(conflicting=1, oid=oid2, serial=tid2)
# undo 4 -> ok # undo 4 -> ok
u4p1 = Packets.AnswerTransactionInformation(tid3, '', '', '', (oid2, )) u4p1 = Packets.AnswerTransactionInformation(tid3, '', '', '',
False, (oid2, ))
u4p2 = Packets.AnswerObject(oid2, tid3, tid3, 0, makeChecksum('O2V2'), 'O2V2') u4p2 = Packets.AnswerObject(oid2, tid3, tid3, 0, makeChecksum('O2V2'), 'O2V2')
u4p3 = Packets.AnswerStoreObject(conflicting=0, oid=oid2, serial=tid2) u4p3 = Packets.AnswerStoreObject(conflicting=0, oid=oid2, serial=tid2)
# test logic # test logic
...@@ -801,8 +805,10 @@ class ClientApplicationTests(NeoTestBase): ...@@ -801,8 +805,10 @@ class ClientApplicationTests(NeoTestBase):
oid1, oid2 = self.makeOID(1), self.makeOID(2) oid1, oid2 = self.makeOID(1), self.makeOID(2)
# TIDs packets supplied by _waitMessage hook # TIDs packets supplied by _waitMessage hook
# TXN info packets # TXN info packets
p3 = Packets.AnswerTransactionInformation(tid1, '', '', '', (oid1, )) p3 = Packets.AnswerTransactionInformation(tid1, '', '', '',
p4 = Packets.AnswerTransactionInformation(tid2, '', '', '', (oid2, )) False, (oid1, ))
p4 = Packets.AnswerTransactionInformation(tid2, '', '', '',
False, (oid2, ))
p3.setId(0) p3.setId(0)
p4.setId(1) p4.setId(1)
conn = Mock({ conn = Mock({
...@@ -836,8 +842,10 @@ class ClientApplicationTests(NeoTestBase): ...@@ -836,8 +842,10 @@ class ClientApplicationTests(NeoTestBase):
# object history, first is a wrong oid, second is valid # object history, first is a wrong oid, second is valid
p2 = Packets.AnswerObjectHistory(oid, object_history) p2 = Packets.AnswerObjectHistory(oid, object_history)
# transaction history # transaction history
p3 = Packets.AnswerTransactionInformation(tid1, 'u', 'd', 'e', (oid, )) p3 = Packets.AnswerTransactionInformation(tid1, 'u', 'd', 'e',
p4 = Packets.AnswerTransactionInformation(tid2, 'u', 'd', 'e', (oid, )) False, (oid, ))
p4 = Packets.AnswerTransactionInformation(tid2, 'u', 'd', 'e',
False, (oid, ))
p2.setId(0) p2.setId(0)
p3.setId(1) p3.setId(1)
p4.setId(2) p4.setId(2)
......
...@@ -124,7 +124,7 @@ class StorageAnswerHandlerTests(NeoTestBase): ...@@ -124,7 +124,7 @@ class StorageAnswerHandlerTests(NeoTestBase):
oid_list = [self.getOID(0), self.getOID(1)] oid_list = [self.getOID(0), self.getOID(1)]
self.app.local_var.txn_info = None self.app.local_var.txn_info = None
self.handler.answerTransactionInformation(conn, tid, user, desc, ext, self.handler.answerTransactionInformation(conn, tid, user, desc, ext,
oid_list) False, oid_list)
txn_info = self.app.local_var.txn_info txn_info = self.app.local_var.txn_info
self.assertTrue(isinstance(txn_info, dict)) self.assertTrue(isinstance(txn_info, dict))
self.assertEqual(txn_info['user_name'], user) self.assertEqual(txn_info['user_name'], user)
......
...@@ -157,7 +157,7 @@ class MasterVerificationTests(NeoTestBase): ...@@ -157,7 +157,7 @@ class MasterVerificationTests(NeoTestBase):
oid = unpack('!Q', self.app.loid)[0] oid = unpack('!Q', self.app.loid)[0]
new_oid = pack('!Q', oid + 1) new_oid = pack('!Q', oid + 1)
verification.answerTransactionInformation(conn, new_tid, verification.answerTransactionInformation(conn, new_tid,
"user", "desc", "ext", [new_oid,]) "user", "desc", "ext", False, [new_oid,])
self.assertEquals(self.verification._oid_set, None) self.assertEquals(self.verification._oid_set, None)
# do nothing as asking_uuid_dict is True # do nothing as asking_uuid_dict is True
conn = self.getFakeConnection(uuid, self.storage_address) conn = self.getFakeConnection(uuid, self.storage_address)
...@@ -167,7 +167,7 @@ class MasterVerificationTests(NeoTestBase): ...@@ -167,7 +167,7 @@ class MasterVerificationTests(NeoTestBase):
self.assertTrue(self.verification._uuid_dict.has_key(uuid)) self.assertTrue(self.verification._uuid_dict.has_key(uuid))
self.assertEquals(len(self.verification._oid_set), 0) self.assertEquals(len(self.verification._oid_set), 0)
verification.answerTransactionInformation(conn, new_tid, verification.answerTransactionInformation(conn, new_tid,
"user", "desc", "ext", [new_oid,]) "user", "desc", "ext", False, [new_oid,])
self.assertEquals(len(self.verification._oid_set), 0) self.assertEquals(len(self.verification._oid_set), 0)
# do work # do work
conn = self.getFakeConnection(uuid, self.storage_address) conn = self.getFakeConnection(uuid, self.storage_address)
...@@ -176,7 +176,7 @@ class MasterVerificationTests(NeoTestBase): ...@@ -176,7 +176,7 @@ class MasterVerificationTests(NeoTestBase):
self.assertTrue(self.verification._uuid_dict.has_key(uuid)) self.assertTrue(self.verification._uuid_dict.has_key(uuid))
self.assertEquals(len(self.verification._oid_set), 0) self.assertEquals(len(self.verification._oid_set), 0)
verification.answerTransactionInformation(conn, new_tid, verification.answerTransactionInformation(conn, new_tid,
"user", "desc", "ext", [new_oid,]) "user", "desc", "ext", False, [new_oid,])
self.assertEquals(len(self.verification._oid_set), 1) self.assertEquals(len(self.verification._oid_set), 1)
self.assertTrue(new_oid in self.verification._oid_set) self.assertTrue(new_oid in self.verification._oid_set)
# do not work as oid is diff # do not work as oid is diff
...@@ -190,7 +190,7 @@ class MasterVerificationTests(NeoTestBase): ...@@ -190,7 +190,7 @@ class MasterVerificationTests(NeoTestBase):
new_oid = pack('!Q', oid + 1) new_oid = pack('!Q', oid + 1)
self.assertNotEqual(new_oid, old_oid) self.assertNotEqual(new_oid, old_oid)
verification.answerTransactionInformation(conn, new_tid, verification.answerTransactionInformation(conn, new_tid,
"user", "desc", "ext", [new_oid,]) "user", "desc", "ext", False, [new_oid,])
self.assertEquals(self.verification._oid_set, None) self.assertEquals(self.verification._oid_set, None)
def test_13_tidNotFound(self): def test_13_tidNotFound(self):
......
...@@ -93,7 +93,7 @@ class StorageClientHandlerTests(NeoTestBase): ...@@ -93,7 +93,7 @@ class StorageClientHandlerTests(NeoTestBase):
def test_18_askTransactionInformation2(self): def test_18_askTransactionInformation2(self):
# answer # answer
conn = Mock({ }) conn = Mock({ })
dm = Mock({ "getTransaction": (INVALID_TID, 'user', 'desc', '', ), }) dm = Mock({ "getTransaction": (INVALID_TID, 'user', 'desc', '', False), })
self.app.dm = dm self.app.dm = dm
self.operation.askTransactionInformation(conn, INVALID_TID) self.operation.askTransactionInformation(conn, INVALID_TID)
self.checkAnswerTransactionInformation(conn) self.checkAnswerTransactionInformation(conn)
......
...@@ -65,7 +65,7 @@ class StorageStorageHandlerTests(NeoTestBase): ...@@ -65,7 +65,7 @@ class StorageStorageHandlerTests(NeoTestBase):
def test_18_askTransactionInformation2(self): def test_18_askTransactionInformation2(self):
# answer # answer
conn = Mock({ }) conn = Mock({ })
dm = Mock({ "getTransaction": (INVALID_TID, 'user', 'desc', '', ), }) dm = Mock({"getTransaction": (INVALID_TID, 'user', 'desc', '', False), })
self.app.dm = dm self.app.dm = dm
self.operation.askTransactionInformation(conn, INVALID_TID) self.operation.askTransactionInformation(conn, INVALID_TID)
self.checkAnswerTransactionInformation(conn) self.checkAnswerTransactionInformation(conn)
......
...@@ -402,7 +402,7 @@ class StorageMySQSLdbTests(NeoTestBase): ...@@ -402,7 +402,7 @@ class StorageMySQSLdbTests(NeoTestBase):
tid = '\x00' * 7 + '\x01' tid = '\x00' * 7 + '\x01'
oid1, oid2 = '\x00' * 7 + '\x01', '\x00' * 7 + '\x02' oid1, oid2 = '\x00' * 7 + '\x01', '\x00' * 7 + '\x02'
object_list = ( (oid1, 0, 0, ''), (oid2, 0, 0, ''),) object_list = ( (oid1, 0, 0, ''), (oid2, 0, 0, ''),)
transaction = ((oid1, oid2), 'user', 'desc', 'ext') transaction = ((oid1, oid2), 'user', 'desc', 'ext', False)
# store objects in temporary table # store objects in temporary table
self.db.setup() self.db.setup()
self.db.storeTransaction(tid, object_list, transaction=None, temporary=True) self.db.storeTransaction(tid, object_list, transaction=None, temporary=True)
...@@ -443,7 +443,7 @@ class StorageMySQSLdbTests(NeoTestBase): ...@@ -443,7 +443,7 @@ class StorageMySQSLdbTests(NeoTestBase):
tid1, tid2 = '\x00' * 7 + '\x01', '\x00' * 7 + '\x02' tid1, tid2 = '\x00' * 7 + '\x01', '\x00' * 7 + '\x02'
oid1, oid2 = '\x00' * 7 + '\x01', '\x00' * 7 + '\x02' oid1, oid2 = '\x00' * 7 + '\x01', '\x00' * 7 + '\x02'
object_list = ( (oid1, 0, 0, ''), (oid2, 0, 0, ''),) object_list = ( (oid1, 0, 0, ''), (oid2, 0, 0, ''),)
transaction = ((oid1, oid2), 'u', 'd', 'e') transaction = ((oid1, oid2), 'u', 'd', 'e', False)
self.db.setup(reset=True) self.db.setup(reset=True)
# store two temporary transactions # store two temporary transactions
self.db.storeTransaction(tid1, object_list, transaction, temporary=True) self.db.storeTransaction(tid1, object_list, transaction, temporary=True)
...@@ -461,7 +461,7 @@ class StorageMySQSLdbTests(NeoTestBase): ...@@ -461,7 +461,7 @@ class StorageMySQSLdbTests(NeoTestBase):
self.assertEquals(result[1], (2L, 1L, 0, 0, '')) self.assertEquals(result[1], (2L, 1L, 0, 0, ''))
result = self.db.query('select * from trans') result = self.db.query('select * from trans')
self.assertEquals(len(result), 1) self.assertEquals(len(result), 1)
self.assertEquals(result[0], (1L, oid1 + oid2, 'u', 'd', 'e',)) self.assertEquals(result[0], (1L, 0, oid1 + oid2, 'u', 'd', 'e',))
# t2 should stay in temporary tables # t2 should stay in temporary tables
result = self.db.query('select * from tobj order by oid asc') result = self.db.query('select * from tobj order by oid asc')
self.assertEquals(len(result), 2) self.assertEquals(len(result), 2)
...@@ -469,14 +469,14 @@ class StorageMySQSLdbTests(NeoTestBase): ...@@ -469,14 +469,14 @@ class StorageMySQSLdbTests(NeoTestBase):
self.assertEquals(result[1], (2L, 2L, 0, 0, '')) self.assertEquals(result[1], (2L, 2L, 0, 0, ''))
result = self.db.query('select * from ttrans') result = self.db.query('select * from ttrans')
self.assertEquals(len(result), 1) self.assertEquals(len(result), 1)
self.assertEquals(result[0], (2L, oid1 + oid2, 'u', 'd', 'e',)) self.assertEquals(result[0], (2L, 0, oid1 + oid2, 'u', 'd', 'e',))
def test_26_deleteTransaction(self): def test_26_deleteTransaction(self):
# data set # data set
tid1, tid2 = '\x00' * 7 + '\x01', '\x00' * 7 + '\x02' tid1, tid2 = '\x00' * 7 + '\x01', '\x00' * 7 + '\x02'
oid1, oid2 = '\x00' * 7 + '\x01', '\x00' * 7 + '\x02' oid1, oid2 = '\x00' * 7 + '\x01', '\x00' * 7 + '\x02'
object_list = ( (oid1, 0, 0, ''), (oid2, 0, 0, ''),) object_list = ( (oid1, 0, 0, ''), (oid2, 0, 0, ''),)
transaction = ((oid1, oid2), 'u', 'd', 'e') transaction = ((oid1, oid2), 'u', 'd', 'e', False)
self.db.setup(reset=True) self.db.setup(reset=True)
# store two transactions in both state # store two transactions in both state
self.db.storeTransaction(tid1, object_list, transaction, temporary=True) self.db.storeTransaction(tid1, object_list, transaction, temporary=True)
...@@ -500,14 +500,14 @@ class StorageMySQSLdbTests(NeoTestBase): ...@@ -500,14 +500,14 @@ class StorageMySQSLdbTests(NeoTestBase):
self.assertEquals(result[1], (2L, 2L, 0, 0, '')) self.assertEquals(result[1], (2L, 2L, 0, 0, ''))
result = self.db.query('select * from ttrans') result = self.db.query('select * from ttrans')
self.assertEquals(len(result), 1) self.assertEquals(len(result), 1)
self.assertEquals(result[0], (2L, oid1 + oid2, 'u', 'd', 'e',)) self.assertEquals(result[0], (2L, 0, oid1 + oid2, 'u', 'd', 'e',))
result = self.db.query('select * from obj order by oid asc') result = self.db.query('select * from obj order by oid asc')
self.assertEquals(len(result), 2) self.assertEquals(len(result), 2)
self.assertEquals(result[0], (1L, 2L, 0, 0, '')) self.assertEquals(result[0], (1L, 2L, 0, 0, ''))
self.assertEquals(result[1], (2L, 2L, 0, 0, '')) self.assertEquals(result[1], (2L, 2L, 0, 0, ''))
result = self.db.query('select * from trans') result = self.db.query('select * from trans')
self.assertEquals(len(result), 1) self.assertEquals(len(result), 1)
self.assertEquals(result[0], (2L, oid1 + oid2, 'u', 'd', 'e',)) self.assertEquals(result[0], (2L, 0, oid1 + oid2, 'u', 'd', 'e',))
# store t1 again # store t1 again
self.db.storeTransaction(tid1, object_list, transaction, temporary=True) self.db.storeTransaction(tid1, object_list, transaction, temporary=True)
self.db.storeTransaction(tid1, object_list, transaction, temporary=False) self.db.storeTransaction(tid1, object_list, transaction, temporary=False)
...@@ -520,7 +520,7 @@ class StorageMySQSLdbTests(NeoTestBase): ...@@ -520,7 +520,7 @@ class StorageMySQSLdbTests(NeoTestBase):
self.assertEquals(result[1], (2L, 2L, 0, 0, '')) self.assertEquals(result[1], (2L, 2L, 0, 0, ''))
result = self.db.query('select * from ttrans') result = self.db.query('select * from ttrans')
self.assertEquals(len(result), 1) self.assertEquals(len(result), 1)
self.assertEquals(result[0], (2L, oid1 + oid2, 'u', 'd', 'e',)) self.assertEquals(result[0], (2L, 0, oid1 + oid2, 'u', 'd', 'e',))
result = self.db.query('select * from obj order by oid, serial asc') result = self.db.query('select * from obj order by oid, serial asc')
self.assertEquals(len(result), 4) self.assertEquals(len(result), 4)
self.assertEquals(result[0], (1L, 1L, 0, 0, '')) self.assertEquals(result[0], (1L, 1L, 0, 0, ''))
...@@ -529,30 +529,30 @@ class StorageMySQSLdbTests(NeoTestBase): ...@@ -529,30 +529,30 @@ class StorageMySQSLdbTests(NeoTestBase):
self.assertEquals(result[3], (2L, 2L, 0, 0, '')) self.assertEquals(result[3], (2L, 2L, 0, 0, ''))
result = self.db.query('select * from trans order by tid asc') result = self.db.query('select * from trans order by tid asc')
self.assertEquals(len(result), 2) self.assertEquals(len(result), 2)
self.assertEquals(result[0], (1L, oid1 + oid2, 'u', 'd', 'e',)) self.assertEquals(result[0], (1L, 0, oid1 + oid2, 'u', 'd', 'e',))
self.assertEquals(result[1], (2L, oid1 + oid2, 'u', 'd', 'e',)) self.assertEquals(result[1], (2L, 0, oid1 + oid2, 'u', 'd', 'e',))
def test_27_getTransaction(self): def test_27_getTransaction(self):
# data set # data set
tid1, tid2 = '\x00' * 7 + '\x01', '\x00' * 7 + '\x02' tid1, tid2 = '\x00' * 7 + '\x01', '\x00' * 7 + '\x02'
oid1, oid2 = '\x00' * 7 + '\x01', '\x00' * 7 + '\x02' oid1, oid2 = '\x00' * 7 + '\x01', '\x00' * 7 + '\x02'
oids = [oid1, oid2] oids = [oid1, oid2]
transaction = ((oid1, oid2), 'u', 'd', 'e') transaction = ((oid1, oid2), 'u', 'd', 'e', False)
self.db.setup(reset=True) self.db.setup(reset=True)
# store t1 in temporary and t2 in persistent tables # store t1 in temporary and t2 in persistent tables
self.db.storeTransaction(tid1, (), transaction, temporary=True) self.db.storeTransaction(tid1, (), transaction, temporary=True)
self.db.storeTransaction(tid2, (), transaction, temporary=False) self.db.storeTransaction(tid2, (), transaction, temporary=False)
# get t1 from all -> OK # get t1 from all -> OK
t = self.db.getTransaction(tid1, all=True) t = self.db.getTransaction(tid1, all=True)
self.assertEquals(t, (oids, 'u', 'd', 'e')) self.assertEquals(t, (oids, 'u', 'd', 'e', False))
# get t1 from no tmp only -> fail # get t1 from no tmp only -> fail
t = self.db.getTransaction(tid1, all=False) t = self.db.getTransaction(tid1, all=False)
self.assertEquals(t, None) self.assertEquals(t, None)
# get t2 from all or not -> always OK # get t2 from all or not -> always OK
t = self.db.getTransaction(tid2, all=True) t = self.db.getTransaction(tid2, all=True)
self.assertEquals(t, (oids, 'u', 'd', 'e')) self.assertEquals(t, (oids, 'u', 'd', 'e', False))
t = self.db.getTransaction(tid2, all=False) t = self.db.getTransaction(tid2, all=False)
self.assertEquals(t, (oids, 'u', 'd', 'e')) self.assertEquals(t, (oids, 'u', 'd', 'e', False))
# store wrong oids -> DatabaseFailure # store wrong oids -> DatabaseFailure
self.db.setup(reset=True) self.db.setup(reset=True)
self.db.query("""replace into trans (tid, oids, user, description, ext) self.db.query("""replace into trans (tid, oids, user, description, ext)
...@@ -616,8 +616,8 @@ class StorageMySQSLdbTests(NeoTestBase): ...@@ -616,8 +616,8 @@ class StorageMySQSLdbTests(NeoTestBase):
tids = ['\x00' * 7 + chr(i) for i in xrange(4)] tids = ['\x00' * 7 + chr(i) for i in xrange(4)]
tid1, tid2, tid3, tid4 = tids tid1, tid2, tid3, tid4 = tids
for tid in tids: for tid in tids:
self.db.query("replace into trans values (%d, '', 'u', 'd', 'e')" % self.db.query("""replace into trans values (%d, '', 'u', 'd', 'e',
(u64(tid))) False)""" % (u64(tid)))
# get all tids for all partitions # get all tids for all partitions
result = self.db.getTIDList(0, 4, 2, (0, 1)) result = self.db.getTIDList(0, 4, 2, (0, 1))
self.assertEquals(result, [tid1, tid2, tid3, tid4]) self.assertEquals(result, [tid1, tid2, tid3, tid4])
...@@ -643,8 +643,8 @@ class StorageMySQSLdbTests(NeoTestBase): ...@@ -643,8 +643,8 @@ class StorageMySQSLdbTests(NeoTestBase):
tid = '\x00' * 7 + '\x01' tid = '\x00' * 7 + '\x01'
tid1, tid2, tid3, tid4 = ['\x00' * 7 + chr(i) for i in xrange(4)] tid1, tid2, tid3, tid4 = ['\x00' * 7 + chr(i) for i in xrange(4)]
for tid in (tid1, tid2, tid3, tid4): for tid in (tid1, tid2, tid3, tid4):
self.db.query("replace into trans values (%d, '', 'u', 'd', 'e')" % self.db.query("""replace into trans values (%d, '', 'u', 'd', 'e',
(u64(tid))) False)""" % (u64(tid)))
# all match # all match
result = self.db.getTIDListPresent((tid1, tid2, tid3, tid4)) result = self.db.getTIDListPresent((tid1, tid2, tid3, tid4))
expected = [tid1, tid2, tid3, tid4] expected = [tid1, tid2, tid3, tid4]
...@@ -663,8 +663,8 @@ class StorageMySQSLdbTests(NeoTestBase): ...@@ -663,8 +663,8 @@ class StorageMySQSLdbTests(NeoTestBase):
tid1, tid2, tid3, tid4 = tids tid1, tid2, tid3, tid4 = tids
oid = '\x00' * 8 oid = '\x00' * 8
for tid in tids: for tid in tids:
self.db.query("replace into obj values (%d, %d, 0, 0, '')" % self.db.query("replace into obj values (%d, %d, 0, 0, '')" % (u64(oid),
(u64(oid), u64(tid))) u64(tid)))
# all match # all match
result = self.db.getSerialListPresent(oid, tids) result = self.db.getSerialListPresent(oid, tids)
expected = list(tids) expected = list(tids)
......
...@@ -45,7 +45,7 @@ class TransactionTests(NeoTestBase): ...@@ -45,7 +45,7 @@ class TransactionTests(NeoTestBase):
def testTransaction(self): def testTransaction(self):
txn = Transaction(self.getNewUUID(), self.getNextTID()) txn = Transaction(self.getNewUUID(), self.getNextTID())
oid_list = [self.getOID(1), self.getOID(2)] oid_list = [self.getOID(1), self.getOID(2)]
txn_info = (oid_list, 'USER', 'DESC', 'EXT') txn_info = (oid_list, 'USER', 'DESC', 'EXT', False)
txn.prepare(*txn_info) txn.prepare(*txn_info)
self.assertEqual(txn.getTransactionInformations(), txn_info) self.assertEqual(txn.getTransactionInformations(), txn_info)
...@@ -76,7 +76,7 @@ class TransactionManagerTests(NeoTestBase): ...@@ -76,7 +76,7 @@ class TransactionManagerTests(NeoTestBase):
def _getTransaction(self): def _getTransaction(self):
tid = self.getNextTID(self.ltid) tid = self.getNextTID(self.ltid)
oid_list = [self.getOID(1), self.getOID(2)] oid_list = [self.getOID(1), self.getOID(2)]
return (tid, (oid_list, 'USER', 'DESC', 'EXT')) return (tid, (oid_list, 'USER', 'DESC', 'EXT', False))
def _getObject(self, value): def _getObject(self, value):
oid = self.getOID(value) oid = self.getOID(value)
......
...@@ -244,7 +244,7 @@ class StorageVerificationHandlerTests(NeoTestBase): ...@@ -244,7 +244,7 @@ class StorageVerificationHandlerTests(NeoTestBase):
conn = Mock({ "getAddress" : ("127.0.0.1", self.master_port), conn = Mock({ "getAddress" : ("127.0.0.1", self.master_port),
'isServer': False }) 'isServer': False })
self.verification.askTransactionInformation(conn, p64(1)) self.verification.askTransactionInformation(conn, p64(1))
tid, user, desc, ext, oid_list = self.checkAnswerTransactionInformation(conn, decode=True) tid, user, desc, ext, packed, oid_list = self.checkAnswerTransactionInformation(conn, decode=True)
self.assertEqual(u64(tid), 1) self.assertEqual(u64(tid), 1)
self.assertEqual(user, 'u2') self.assertEqual(user, 'u2')
self.assertEqual(desc, 'd2') self.assertEqual(desc, 'd2')
...@@ -255,7 +255,7 @@ class StorageVerificationHandlerTests(NeoTestBase): ...@@ -255,7 +255,7 @@ class StorageVerificationHandlerTests(NeoTestBase):
conn = Mock({ "getAddress" : ("127.0.0.1", self.master_port), conn = Mock({ "getAddress" : ("127.0.0.1", self.master_port),
'isServer': False }) 'isServer': False })
self.verification.askTransactionInformation(conn, p64(3)) self.verification.askTransactionInformation(conn, p64(3))
tid, user, desc, ext, oid_list = self.checkAnswerTransactionInformation(conn, decode=True) tid, user, desc, ext, packed, oid_list = self.checkAnswerTransactionInformation(conn, decode=True)
self.assertEqual(u64(tid), 3) self.assertEqual(u64(tid), 3)
self.assertEqual(user, 'u1') self.assertEqual(user, 'u1')
self.assertEqual(desc, 'd1') self.assertEqual(desc, 'd1')
...@@ -268,7 +268,7 @@ class StorageVerificationHandlerTests(NeoTestBase): ...@@ -268,7 +268,7 @@ class StorageVerificationHandlerTests(NeoTestBase):
'isServer': True }) 'isServer': True })
# find the one in trans # find the one in trans
self.verification.askTransactionInformation(conn, p64(1)) self.verification.askTransactionInformation(conn, p64(1))
tid, user, desc, ext, oid_list = self.checkAnswerTransactionInformation(conn, decode=True) tid, user, desc, ext, packed, oid_list = self.checkAnswerTransactionInformation(conn, decode=True)
self.assertEqual(u64(tid), 1) self.assertEqual(u64(tid), 1)
self.assertEqual(user, 'u2') self.assertEqual(user, 'u2')
self.assertEqual(desc, 'd2') self.assertEqual(desc, 'd2')
......
...@@ -421,13 +421,14 @@ class ProtocolTests(NeoTestBase): ...@@ -421,13 +421,14 @@ class ProtocolTests(NeoTestBase):
oid4 = self.getNextTID() oid4 = self.getNextTID()
oid_list = [oid1, oid2, oid3, oid4] oid_list = [oid1, oid2, oid3, oid4]
p = Packets.AnswerTransactionInformation(tid, "moi", p = Packets.AnswerTransactionInformation(tid, "moi",
"transaction", "exti", oid_list) "transaction", "exti", False, oid_list)
ptid, user, desc, ext, p_oid_list = p.decode() ptid, user, desc, ext, packed, p_oid_list = p.decode()
self.assertEqual(ptid, tid) self.assertEqual(ptid, tid)
self.assertEqual(p_oid_list, oid_list) self.assertEqual(p_oid_list, oid_list)
self.assertEqual(user, "moi") self.assertEqual(user, "moi")
self.assertEqual(desc, "transaction") self.assertEqual(desc, "transaction")
self.assertEqual(ext, "exti") self.assertEqual(ext, "exti")
self.assertFalse(packed)
def test_53_askObjectHistory(self): def test_53_askObjectHistory(self):
oid = self.getNextTID() oid = self.getNextTID()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment