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

Rename NotifyTransactionFinished to AnswerTransactionFinished as it's not a notification.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1489 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 0ffd912e
...@@ -186,7 +186,7 @@ class PrimaryAnswersHandler(AnswerBaseHandler): ...@@ -186,7 +186,7 @@ class PrimaryAnswersHandler(AnswerBaseHandler):
app.new_oid_list = oid_list app.new_oid_list = oid_list
app.new_oid_list.reverse() app.new_oid_list.reverse()
def notifyTransactionFinished(self, conn, packet, tid): def answerTransactionFinished(self, conn, packet, tid):
app = self.app app = self.app
if tid == app.getTID(): if tid == app.getTID():
app.setTransactionFinished() app.setTransactionFinished()
......
...@@ -222,7 +222,7 @@ class EventHandler(object): ...@@ -222,7 +222,7 @@ class EventHandler(object):
def finishTransaction(self, conn, packet, oid_list, tid): def finishTransaction(self, conn, packet, oid_list, tid):
raise UnexpectedPacketError raise UnexpectedPacketError
def notifyTransactionFinished(self, conn, packet, tid): def answerTransactionFinished(self, conn, packet, tid):
raise UnexpectedPacketError raise UnexpectedPacketError
def lockInformation(self, conn, packet, tid): def lockInformation(self, conn, packet, tid):
...@@ -398,7 +398,7 @@ class EventHandler(object): ...@@ -398,7 +398,7 @@ class EventHandler(object):
d[Packets.AskBeginTransaction] = self.askBeginTransaction d[Packets.AskBeginTransaction] = self.askBeginTransaction
d[Packets.AnswerBeginTransaction] = self.answerBeginTransaction d[Packets.AnswerBeginTransaction] = self.answerBeginTransaction
d[Packets.FinishTransaction] = self.finishTransaction d[Packets.FinishTransaction] = self.finishTransaction
d[Packets.NotifyTransactionFinished] = self.notifyTransactionFinished d[Packets.AnswerTransactionFinished] = self.answerTransactionFinished
d[Packets.LockInformation] = self.lockInformation d[Packets.LockInformation] = self.lockInformation
d[Packets.NotifyInformationLocked] = self.notifyInformationLocked d[Packets.NotifyInformationLocked] = self.notifyInformationLocked
d[Packets.InvalidateObjects] = self.invalidateObjects d[Packets.InvalidateObjects] = self.invalidateObjects
......
...@@ -140,7 +140,7 @@ class PacketLogger(EventHandler): ...@@ -140,7 +140,7 @@ class PacketLogger(EventHandler):
def finishTransaction(self, conn, packet, oid_list, tid): def finishTransaction(self, conn, packet, oid_list, tid):
pass pass
def notifyTransactionFinished(self, conn, packet, tid): def answerTransactionFinished(self, conn, packet, tid):
pass pass
def lockInformation(self, conn, packet, tid): def lockInformation(self, conn, packet, tid):
......
...@@ -80,7 +80,7 @@ class StorageServiceHandler(BaseServiceHandler): ...@@ -80,7 +80,7 @@ class StorageServiceHandler(BaseServiceHandler):
node = app.nm.getByUUID(uuid) node = app.nm.getByUUID(uuid)
if node.isClient(): if node.isClient():
if node is t.getNode(): if node is t.getNode():
p = Packets.NotifyTransactionFinished(tid) p = Packets.AnswerTransactionFinished(tid)
c.answer(p, t.getMessageId()) c.answer(p, t.getMessageId())
else: else:
c.notify(Packets.InvalidateObjects(t.getOIDList(), tid)) c.notify(Packets.InvalidateObjects(t.getOIDList(), tid))
......
...@@ -647,9 +647,9 @@ class FinishTransaction(Packet): ...@@ -647,9 +647,9 @@ class FinishTransaction(Packet):
oid_list.append(oid) oid_list.append(oid)
return (oid_list, tid) return (oid_list, tid)
class NotifyTransactionFinished(Packet): class AnswerTransactionFinished(Packet):
""" """
Notify a transaction finished. PM -> C. Answer when a transaction is finished. PM -> C.
""" """
def _encode(self, tid): def _encode(self, tid):
return _encodeTID(tid) return _encodeTID(tid)
...@@ -1293,7 +1293,7 @@ class PacketRegistry(dict): ...@@ -1293,7 +1293,7 @@ class PacketRegistry(dict):
AskBeginTransaction = register(0x0012, AskBeginTransaction) AskBeginTransaction = register(0x0012, AskBeginTransaction)
AnswerBeginTransaction = register(0x8012, AnswerBeginTransaction) AnswerBeginTransaction = register(0x8012, AnswerBeginTransaction)
FinishTransaction = register(0x0013, FinishTransaction) FinishTransaction = register(0x0013, FinishTransaction)
NotifyTransactionFinished = register(0x8013, NotifyTransactionFinished) AnswerTransactionFinished = register(0x8013, AnswerTransactionFinished)
LockInformation = register(0x0014, LockInformation) LockInformation = register(0x0014, LockInformation)
NotifyInformationLocked = register(0x8014, NotifyInformationLocked) NotifyInformationLocked = register(0x8014, NotifyInformationLocked)
InvalidateObjects = register(0x0015, InvalidateObjects) InvalidateObjects = register(0x0015, InvalidateObjects)
......
...@@ -265,8 +265,8 @@ class NeoTestBase(unittest.TestCase): ...@@ -265,8 +265,8 @@ class NeoTestBase(unittest.TestCase):
def checkInvalidateObjects(self, conn, **kw): def checkInvalidateObjects(self, conn, **kw):
return self.checkNotifyPacket(conn, Packets.InvalidateObjects, **kw) return self.checkNotifyPacket(conn, Packets.InvalidateObjects, **kw)
def checkNotifyTransactionFinished(self, conn, **kw): def checkAnswerTransactionFinished(self, conn, **kw):
return self.checkAnswerPacket(conn, Packets.NotifyTransactionFinished, **kw) return self.checkAnswerPacket(conn, Packets.AnswerTransactionFinished, **kw)
def checkNotifyInformationLocked(self, conn, **kw): def checkNotifyInformationLocked(self, conn, **kw):
return self.checkAnswerPacket(conn, Packets.NotifyInformationLocked, **kw) return self.checkAnswerPacket(conn, Packets.NotifyInformationLocked, **kw)
......
...@@ -133,7 +133,7 @@ class ClientApplicationTests(NeoTestBase): ...@@ -133,7 +133,7 @@ class ClientApplicationTests(NeoTestBase):
def finishTransaction(self, app): def finishTransaction(self, app):
txn = app.local_var.txn txn = app.local_var.txn
tid = app.local_var.tid tid = app.local_var.tid
packet = Packets.NotifyTransactionFinished(tid) packet = Packets.AnswerTransactionFinished(tid)
app.master_conn = Mock({ app.master_conn = Mock({
'getNextId': 1, 'getNextId': 1,
'getAddress': ('127.0.0.1', 10010), 'getAddress': ('127.0.0.1', 10010),
...@@ -624,7 +624,7 @@ class ClientApplicationTests(NeoTestBase): ...@@ -624,7 +624,7 @@ class ClientApplicationTests(NeoTestBase):
def hook(tid): def hook(tid):
self.f_called = True self.f_called = True
self.f_called_with_tid = tid self.f_called_with_tid = tid
packet = Packets.NotifyTransactionFinished(tid) packet = Packets.AnswerTransactionFinished(tid)
app.master_conn = Mock({ app.master_conn = Mock({
'getNextId': 1, 'getNextId': 1,
'getAddress': ('127.0.0.1', 10010), 'getAddress': ('127.0.0.1', 10010),
......
...@@ -691,13 +691,13 @@ class ClientHandlerTests(NeoTestBase): ...@@ -691,13 +691,13 @@ class ClientHandlerTests(NeoTestBase):
self.assertEquals(len(setTID_call_list), 1) self.assertEquals(len(setTID_call_list), 1)
self.assertEquals(setTID_call_list[0].getParam(0), test_tid) self.assertEquals(setTID_call_list[0].getParam(0), test_tid)
def test_NotifyTransactionFinished(self): def test_AnswerTransactionFinished(self):
test_tid = 1 test_tid = 1
app = Mock({'getTID': test_tid, 'setTransactionFinished': None}) app = Mock({'getTID': test_tid, 'setTransactionFinished': None})
dispatcher = self.getDispatcher() dispatcher = self.getDispatcher()
client_handler = PrimaryAnswersHandler(app) client_handler = PrimaryAnswersHandler(app)
conn = self.getConnection() conn = self.getConnection()
client_handler.notifyTransactionFinished(conn, None, test_tid) client_handler.answerTransactionFinished(conn, None, test_tid)
self.assertEquals(len(app.mockGetNamedCalls('setTransactionFinished')), 1) self.assertEquals(len(app.mockGetNamedCalls('setTransactionFinished')), 1)
# TODO: decide what to do when non-current transaction is notified as finished, and test that behaviour # TODO: decide what to do when non-current transaction is notified as finished, and test that behaviour
......
...@@ -121,7 +121,7 @@ class MasterStorageHandlerTests(NeoTestBase): ...@@ -121,7 +121,7 @@ class MasterStorageHandlerTests(NeoTestBase):
self.checkNoPacketSent(storage_conn_2) self.checkNoPacketSent(storage_conn_2)
# then the second # then the second
self.service.notifyInformationLocked(storage_conn_2, packet, tid) self.service.notifyInformationLocked(storage_conn_2, packet, tid)
self.checkNotifyTransactionFinished(client_conn_1) self.checkAnswerTransactionFinished(client_conn_1)
self.checkInvalidateObjects(client_conn_2) self.checkInvalidateObjects(client_conn_2)
self.checkUnlockInformation(storage_conn_1) self.checkUnlockInformation(storage_conn_1)
self.checkUnlockInformation(storage_conn_2) self.checkUnlockInformation(storage_conn_2)
......
...@@ -286,9 +286,9 @@ class ProtocolTests(NeoTestBase): ...@@ -286,9 +286,9 @@ class ProtocolTests(NeoTestBase):
self.assertEqual(ptid, tid) self.assertEqual(ptid, tid)
self.assertEqual(p_oid_list, oid_list) self.assertEqual(p_oid_list, oid_list)
def test_37_notifyTransactionFinished(self): def test_37_answerTransactionFinished(self):
tid = self.getNextTID() tid = self.getNextTID()
p = Packets.NotifyTransactionFinished(tid) p = Packets.AnswerTransactionFinished(tid)
ptid = p.decode()[0] ptid = p.decode()[0]
self.assertEqual(ptid, tid) self.assertEqual(ptid, tid)
......
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