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

Update client tests.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@522 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent ed0cb88e
...@@ -19,6 +19,7 @@ import unittest ...@@ -19,6 +19,7 @@ import unittest
import logging import logging
from mock import Mock, ReturnValues, ReturnIterator from mock import Mock, ReturnValues, ReturnIterator
from ZODB.POSException import StorageTransactionError, UndoError, ConflictError from ZODB.POSException import StorageTransactionError, UndoError, ConflictError
from neo.tests.base import NeoTestBase
from neo.client.app import Application from neo.client.app import Application
from neo.client.exception import NEOStorageError, NEOStorageNotFoundError, \ from neo.client.exception import NEOStorageError, NEOStorageNotFoundError, \
NEOStorageConflictError NEOStorageConflictError
...@@ -75,7 +76,7 @@ class TestSocketConnector(object): ...@@ -75,7 +76,7 @@ class TestSocketConnector(object):
def send(self, msg): def send(self, msg):
raise NotImplementedError raise NotImplementedError
class ClientApplicationTest(unittest.TestCase): class ClientApplicationTest(NeoTestBase):
def setUp(self): def setUp(self):
logging.basicConfig(level = logging.WARNING) logging.basicConfig(level = logging.WARNING)
...@@ -90,13 +91,6 @@ class ClientApplicationTest(unittest.TestCase): ...@@ -90,13 +91,6 @@ class ClientApplicationTest(unittest.TestCase):
app.num_replicas = 2 app.num_replicas = 2
return app return app
def getUUID(self):
uuid = INVALID_UUID
while uuid == INVALID_UUID:
uuid = os.urandom(16)
self.uuid = uuid
return uuid
def makeOID(self, value=None): def makeOID(self, value=None):
from random import randint from random import randint
if value is None: if value is None:
...@@ -165,9 +159,6 @@ class ClientApplicationTest(unittest.TestCase): ...@@ -165,9 +159,6 @@ class ClientApplicationTest(unittest.TestCase):
self.assertTrue(isinstance(packet, Packet)) self.assertTrue(isinstance(packet, Packet))
self.assertEquals(packet._type, packet_type) self.assertEquals(packet._type, packet_type)
def checkAnswer(self, conn, packet_type):
self.checkPacketSent(conn, packet_type, 'answer')
def checkAsk(self, conn, packet_type): def checkAsk(self, conn, packet_type):
self.checkPacketSent(conn, packet_type, 'ask') self.checkPacketSent(conn, packet_type, 'ask')
...@@ -251,7 +242,7 @@ class ClientApplicationTest(unittest.TestCase): ...@@ -251,7 +242,7 @@ class ClientApplicationTest(unittest.TestCase):
app.cp = Mock({ 'getConnForNode' : conn}) app.cp = Mock({ 'getConnForNode' : conn})
app.local_var.asked_object = -1 app.local_var.asked_object = -1
self.assertRaises(NEOStorageNotFoundError, app.load, oid) self.assertRaises(NEOStorageNotFoundError, app.load, oid)
self.checkAsk(conn, ASK_OBJECT) self.checkAskObject(conn)
# object found on storage nodes and put in cache # object found on storage nodes and put in cache
packet = protocol.answerObject(*an_object[1:]) packet = protocol.answerObject(*an_object[1:])
conn = Mock({ conn = Mock({
...@@ -262,7 +253,7 @@ class ClientApplicationTest(unittest.TestCase): ...@@ -262,7 +253,7 @@ class ClientApplicationTest(unittest.TestCase):
app.local_var.asked_object = an_object app.local_var.asked_object = an_object
result = app.load(oid) result = app.load(oid)
self.assertEquals(result, ('', tid1)) self.assertEquals(result, ('', tid1))
self.checkAsk(conn, ASK_OBJECT) self.checkAskObject(conn)
self.assertTrue(oid in mq) self.assertTrue(oid in mq)
# object is now cached, try to reload it # object is now cached, try to reload it
conn = Mock({ conn = Mock({
...@@ -291,7 +282,7 @@ class ClientApplicationTest(unittest.TestCase): ...@@ -291,7 +282,7 @@ class ClientApplicationTest(unittest.TestCase):
app.cp = Mock({ 'getConnForNode' : conn}) app.cp = Mock({ 'getConnForNode' : conn})
app.local_var.asked_object = -1 app.local_var.asked_object = -1
self.assertRaises(NEOStorageNotFoundError, app.loadSerial, oid, tid2) self.assertRaises(NEOStorageNotFoundError, app.loadSerial, oid, tid2)
self.checkAsk(conn, ASK_OBJECT) self.checkAskObject(conn)
# object should not have been cached # object should not have been cached
self.assertFalse(oid in mq) self.assertFalse(oid in mq)
# now a cached version ewxists but should not be hit # now a cached version ewxists but should not be hit
...@@ -307,7 +298,7 @@ class ClientApplicationTest(unittest.TestCase): ...@@ -307,7 +298,7 @@ class ClientApplicationTest(unittest.TestCase):
app.local_var.asked_object = another_object app.local_var.asked_object = another_object
result = app.loadSerial(oid, tid1) result = app.loadSerial(oid, tid1)
self.assertEquals(result, 'RIGHT') self.assertEquals(result, 'RIGHT')
self.checkAsk(conn, ASK_OBJECT) self.checkAskObject(conn)
self.assertTrue(oid in mq) self.assertTrue(oid in mq)
def test_loadBefore(self): def test_loadBefore(self):
...@@ -328,7 +319,7 @@ class ClientApplicationTest(unittest.TestCase): ...@@ -328,7 +319,7 @@ class ClientApplicationTest(unittest.TestCase):
app.cp = Mock({ 'getConnForNode' : conn}) app.cp = Mock({ 'getConnForNode' : conn})
app.local_var.asked_object = -1 app.local_var.asked_object = -1
self.assertRaises(NEOStorageNotFoundError, app.loadBefore, oid, tid2) self.assertRaises(NEOStorageNotFoundError, app.loadBefore, oid, tid2)
self.checkAsk(conn, ASK_OBJECT) self.checkAskObject(conn)
# no previous versions -> return None # no previous versions -> return None
an_object = (1, oid, tid2, INVALID_SERIAL, 0, 0, '') an_object = (1, oid, tid2, INVALID_SERIAL, 0, 0, '')
packet = protocol.answerObject(*an_object[1:]) packet = protocol.answerObject(*an_object[1:])
...@@ -355,7 +346,7 @@ class ClientApplicationTest(unittest.TestCase): ...@@ -355,7 +346,7 @@ class ClientApplicationTest(unittest.TestCase):
app.local_var.asked_object = another_object app.local_var.asked_object = another_object
result = app.loadBefore(oid, tid1) result = app.loadBefore(oid, tid1)
self.assertEquals(result, ('RIGHT', tid1, tid2)) self.assertEquals(result, ('RIGHT', tid1, tid2))
self.checkAsk(conn, ASK_OBJECT) self.checkAskObject(conn)
self.assertTrue(oid in mq) self.assertTrue(oid in mq)
def test_tpc_begin(self): def test_tpc_begin(self):
...@@ -389,7 +380,7 @@ class ClientApplicationTest(unittest.TestCase): ...@@ -389,7 +380,7 @@ class ClientApplicationTest(unittest.TestCase):
app.dispatcher = Mock({ app.dispatcher = Mock({
}) })
app.tpc_begin(transaction=txn, tid=None) app.tpc_begin(transaction=txn, tid=None)
self.checkAsk(app.master_conn, ASK_NEW_TID) self.checkAskNewTid(app.master_conn)
self.checkDispatcherRegisterCalled(app, app.master_conn) self.checkDispatcherRegisterCalled(app, app.master_conn)
# check attributes # check attributes
self.assertTrue(app.local_var.txn is txn) self.assertTrue(app.local_var.txn is txn)
...@@ -441,7 +432,7 @@ class ClientApplicationTest(unittest.TestCase): ...@@ -441,7 +432,7 @@ class ClientApplicationTest(unittest.TestCase):
self.assertTrue(oid not in app.local_var.data_dict) self.assertTrue(oid not in app.local_var.data_dict)
self.assertEquals(app.conflict_serial, tid) self.assertEquals(app.conflict_serial, tid)
self.assertEquals(app.local_var.object_stored, (-1, tid)) self.assertEquals(app.local_var.object_stored, (-1, tid))
self.checkAsk(conn, ASK_STORE_OBJECT) self.checkAskStoreObject(conn)
self.checkDispatcherRegisterCalled(app, conn) self.checkDispatcherRegisterCalled(app, conn)
def test_store3(self): def test_store3(self):
...@@ -470,7 +461,7 @@ class ClientApplicationTest(unittest.TestCase): ...@@ -470,7 +461,7 @@ class ClientApplicationTest(unittest.TestCase):
self.assertEquals(app.local_var.object_stored, (oid, tid)) self.assertEquals(app.local_var.object_stored, (oid, tid))
self.assertEquals(app.local_var.data_dict.get(oid, None), 'DATA') self.assertEquals(app.local_var.data_dict.get(oid, None), 'DATA')
self.assertNotEquals(app.conflict_serial, tid) self.assertNotEquals(app.conflict_serial, tid)
self.checkAsk(conn, ASK_STORE_OBJECT) self.checkAskStoreObject(conn)
self.checkDispatcherRegisterCalled(app, conn) self.checkDispatcherRegisterCalled(app, conn)
def test_tpc_vote1(self): def test_tpc_vote1(self):
...@@ -534,7 +525,7 @@ class ClientApplicationTest(unittest.TestCase): ...@@ -534,7 +525,7 @@ class ClientApplicationTest(unittest.TestCase):
app.dispatcher = Mock() app.dispatcher = Mock()
app.tpc_begin(txn, tid) app.tpc_begin(txn, tid)
app.tpc_vote(txn) app.tpc_vote(txn)
self.checkAsk(conn, ASK_STORE_TRANSACTION) self.checkAskStoreTransaction(conn)
self.checkDispatcherRegisterCalled(app, conn) self.checkDispatcherRegisterCalled(app, conn)
def test_tpc_abort1(self): def test_tpc_abort1(self):
...@@ -627,7 +618,7 @@ class ClientApplicationTest(unittest.TestCase): ...@@ -627,7 +618,7 @@ class ClientApplicationTest(unittest.TestCase):
self.assertRaises(NEOStorageError, app.tpc_finish, txn, hook) self.assertRaises(NEOStorageError, app.tpc_finish, txn, hook)
self.assertTrue(self.f_called) self.assertTrue(self.f_called)
self.assertEquals(self.f_called_with_tid, tid) self.assertEquals(self.f_called_with_tid, tid)
self.checkAsk(app.master_conn, FINISH_TRANSACTION) self.checkFinishTransaction(app.master_conn)
self.checkDispatcherRegisterCalled(app, app.master_conn) self.checkDispatcherRegisterCalled(app, app.master_conn)
def test_tpc_finish3(self): def test_tpc_finish3(self):
...@@ -652,7 +643,7 @@ class ClientApplicationTest(unittest.TestCase): ...@@ -652,7 +643,7 @@ class ClientApplicationTest(unittest.TestCase):
app.tpc_finish(txn, hook) app.tpc_finish(txn, hook)
self.assertTrue(self.f_called) self.assertTrue(self.f_called)
self.assertEquals(self.f_called_with_tid, tid) self.assertEquals(self.f_called_with_tid, tid)
self.checkAsk(app.master_conn, FINISH_TRANSACTION) self.checkFinishTransaction(app.master_conn)
self.checkDispatcherRegisterCalled(app, app.master_conn) self.checkDispatcherRegisterCalled(app, app.master_conn)
self.assertEquals(app.local_var.tid, None) self.assertEquals(app.local_var.tid, None)
self.assertEquals(app.local_var.txn, None) self.assertEquals(app.local_var.txn, None)
...@@ -864,13 +855,13 @@ class ClientApplicationTest(unittest.TestCase): ...@@ -864,13 +855,13 @@ class ClientApplicationTest(unittest.TestCase):
self.test_ok = True self.test_ok = True
_waitMessage_old = Application._waitMessage _waitMessage_old = Application._waitMessage
Application._waitMessage = _waitMessage_hook Application._waitMessage = _waitMessage_hook
packet = protocol.askNewOIDs(10) packet = protocol.askNewTID()
try: try:
app._askStorage(conn, packet) app._askStorage(conn, packet)
finally: finally:
Application._waitMessage = _waitMessage_old Application._waitMessage = _waitMessage_old
# check packet sent, connection unlocked and dispatcher updated # check packet sent, connection unlocked and dispatcher updated
self.assertEquals(len(conn.mockGetNamedCalls('ask')), 1) self.checkAskNewTid(conn)
self.assertEquals(len(conn.mockGetNamedCalls('unlock')), 1) self.assertEquals(len(conn.mockGetNamedCalls('unlock')), 1)
self.assertEquals(len(app.dispatcher.mockGetNamedCalls('register')), 1) self.assertEquals(len(app.dispatcher.mockGetNamedCalls('register')), 1)
# and _waitMessage called # and _waitMessage called
...@@ -889,13 +880,13 @@ class ClientApplicationTest(unittest.TestCase): ...@@ -889,13 +880,13 @@ class ClientApplicationTest(unittest.TestCase):
self.test_ok = True self.test_ok = True
_waitMessage_old = Application._waitMessage _waitMessage_old = Application._waitMessage
Application._waitMessage = _waitMessage_hook Application._waitMessage = _waitMessage_hook
packet = protocol.askNewOIDs(10) packet = protocol.askNewTID()
try: try:
app._askPrimary(packet) app._askPrimary(packet)
finally: finally:
Application._waitMessage = _waitMessage_old Application._waitMessage = _waitMessage_old
# check packet sent, connection locked during process and dispatcher updated # check packet sent, connection locked during process and dispatcher updated
self.assertEquals(len(conn.mockGetNamedCalls('ask')), 1) self.checkAskNewTid(conn)
self.assertEquals(len(conn.mockGetNamedCalls('lock')), 1) self.assertEquals(len(conn.mockGetNamedCalls('lock')), 1)
self.assertEquals(len(conn.mockGetNamedCalls('unlock')), 1) self.assertEquals(len(conn.mockGetNamedCalls('unlock')), 1)
self.assertEquals(len(app.dispatcher.mockGetNamedCalls('register')), 1) self.assertEquals(len(app.dispatcher.mockGetNamedCalls('register')), 1)
......
...@@ -20,6 +20,7 @@ import unittest ...@@ -20,6 +20,7 @@ import unittest
import logging import logging
import threading import threading
from mock import Mock, ReturnValues from mock import Mock, ReturnValues
from neo.tests.base import NeoTestBase
from neo import protocol from neo import protocol
from neo.protocol import Packet, UnexpectedPacketError, INVALID_UUID from neo.protocol import Packet, UnexpectedPacketError, INVALID_UUID
from neo.protocol import ERROR, REQUEST_NODE_IDENTIFICATION, ACCEPT_NODE_IDENTIFICATION, \ from neo.protocol import ERROR, REQUEST_NODE_IDENTIFICATION, ACCEPT_NODE_IDENTIFICATION, \
...@@ -51,7 +52,7 @@ from neo.util import dump ...@@ -51,7 +52,7 @@ from neo.util import dump
MARKER = [] MARKER = []
class BaseClientEventHandlerTest(unittest.TestCase): class BaseClientEventHandlerTest(NeoTestBase):
def setUp(self): def setUp(self):
dispatcher = Mock({'getQueue': queue, 'connectToPrimaryMasterNode': None}) dispatcher = Mock({'getQueue': queue, 'connectToPrimaryMasterNode': None})
...@@ -59,7 +60,7 @@ class BaseClientEventHandlerTest(unittest.TestCase): ...@@ -59,7 +60,7 @@ class BaseClientEventHandlerTest(unittest.TestCase):
def getConnection(self, uuid=None, port=10010, next_id=None, ip='127.0.0.1'): def getConnection(self, uuid=None, port=10010, next_id=None, ip='127.0.0.1'):
if uuid is None: if uuid is None:
uuid = self.getUUID() uuid = self.getNewUUID()
return Mock({'_addPacket': None, return Mock({'_addPacket': None,
'getUUID': uuid, 'getUUID': uuid,
'getAddress': (ip, port), 'getAddress': (ip, port),
...@@ -68,7 +69,7 @@ class BaseClientEventHandlerTest(unittest.TestCase): ...@@ -68,7 +69,7 @@ class BaseClientEventHandlerTest(unittest.TestCase):
'unlock': None}) 'unlock': None})
class ClientEventHandlerTest(unittest.TestCase): class ClientEventHandlerTest(NeoTestBase):
def setUp(self): def setUp(self):
# Silence all log messages # Silence all log messages
...@@ -76,7 +77,7 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -76,7 +77,7 @@ class ClientEventHandlerTest(unittest.TestCase):
def getConnection(self, uuid=None, port=10010, next_id=None, ip='127.0.0.1'): def getConnection(self, uuid=None, port=10010, next_id=None, ip='127.0.0.1'):
if uuid is None: if uuid is None:
uuid = self.getUUID() uuid = self.getNewUUID()
return Mock({'_addPacket': None, return Mock({'_addPacket': None,
'getUUID': uuid, 'getUUID': uuid,
'getAddress': (ip, port), 'getAddress': (ip, port),
...@@ -84,13 +85,6 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -84,13 +85,6 @@ class ClientEventHandlerTest(unittest.TestCase):
'lock': None, 'lock': None,
'unlock': None}) 'unlock': None})
def getUUID(self):
uuid = INVALID_UUID
while uuid == INVALID_UUID:
uuid = os.urandom(16)
self.uuid = uuid
return uuid
def getDispatcher(self, queue=None): def getDispatcher(self, queue=None):
return Mock({'getQueue': queue, 'connectToPrimaryMasterNode': None}) return Mock({'getQueue': queue, 'connectToPrimaryMasterNode': None})
...@@ -103,9 +97,7 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -103,9 +97,7 @@ class ClientEventHandlerTest(unittest.TestCase):
client_handler = BaseClientEventHandler(None, dispatcher) client_handler = BaseClientEventHandler(None, dispatcher)
conn = self.getConnection() conn = self.getConnection()
client_handler.packetReceived(conn, protocol.ping()) client_handler.packetReceived(conn, protocol.ping())
pong = conn.mockGetNamedCalls('answer')[0].getParam(0) self.checkAnswerPacket(conn, protocol.PONG)
self.assertTrue(isinstance(pong, Packet))
self.assertEquals(pong.getType(), PONG)
def _testInitialMasterWithMethod(self, method): def _testInitialMasterWithMethod(self, method):
class App: class App:
...@@ -115,7 +107,7 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -115,7 +107,7 @@ class ClientEventHandlerTest(unittest.TestCase):
self.assertEqual(app.primary_master_node, -1) self.assertEqual(app.primary_master_node, -1)
def _testMasterWithMethod(self, method, handler_class): def _testMasterWithMethod(self, method, handler_class):
uuid = self.getUUID() uuid = self.getNewUUID()
app = Mock({'connectToPrimaryMasterNode': None}) app = Mock({'connectToPrimaryMasterNode': None})
app.primary_master_node = Mock({'getUUID': uuid}) app.primary_master_node = Mock({'getUUID': uuid})
app.master_conn = Mock({'close': None, 'getUUID': uuid}) app.master_conn = Mock({'close': None, 'getUUID': uuid})
...@@ -130,16 +122,16 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -130,16 +122,16 @@ class ClientEventHandlerTest(unittest.TestCase):
def _testStorageWithMethod(self, method, handler_class, state=TEMPORARILY_DOWN_STATE): def _testStorageWithMethod(self, method, handler_class, state=TEMPORARILY_DOWN_STATE):
storage_ip = '127.0.0.1' storage_ip = '127.0.0.1'
storage_port = 10011 storage_port = 10011
fake_storage_node_uuid = self.getUUID() fake_storage_node_uuid = self.getNewUUID()
fake_storage_node = Mock({'getUUID': fake_storage_node_uuid, 'getServer': (storage_ip, storage_port), 'getNodeType': STORAGE_NODE_TYPE}) fake_storage_node = Mock({'getUUID': fake_storage_node_uuid, 'getServer': (storage_ip, storage_port), 'getNodeType': STORAGE_NODE_TYPE})
master_node_next_packet_id = 1 master_node_next_packet_id = 1
class App: class App:
primary_master_node = Mock({'getUUID': self.getUUID()}) primary_master_node = Mock({'getUUID': self.getNewUUID()})
nm = Mock({'getNodeByServer': fake_storage_node}) nm = Mock({'getNodeByServer': fake_storage_node})
cp = Mock({'removeConnection': None}) cp = Mock({'removeConnection': None})
master_conn = Mock({ master_conn = Mock({
'_addPacket': None, '_addPacket': None,
'getUUID': self.getUUID(), 'getUUID': self.getNewUUID(),
'getAddress': ('127.0.0.1', 10010), 'getAddress': ('127.0.0.1', 10010),
'getNextId': master_node_next_packet_id, 'getNextId': master_node_next_packet_id,
'lock': None, 'lock': None,
...@@ -158,19 +150,11 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -158,19 +150,11 @@ class ClientEventHandlerTest(unittest.TestCase):
dispatcher = Dispatcher() dispatcher = Dispatcher()
method(dispatcher, app, handler_class, conn=conn) method(dispatcher, app, handler_class, conn=conn)
# Check that master was notified of the failure # Check that master was notified of the failure
addPacket_call_list = app.master_conn.mockGetNamedCalls('notify') (node_list, ) = self.checkNotifyNodeInformation(app.master_conn, decode=True)
# Test sanity check
self.assertEqual(len(addPacket_call_list), 1)
node_status_packet = addPacket_call_list[0].getParam(0)
self.assertTrue(isinstance(node_status_packet, Packet))
# Test sanity check # Test sanity check
# the test below is disabled because the msg_id is now set by the connection # the test below is disabled because the msg_id is now set by the connection
#self.assertEquals(node_status_packet.getId(), master_node_next_packet_id) expected_node_list = [(STORAGE_NODE_TYPE, storage_ip, storage_port, fake_storage_node_uuid, state), ]
self.assertEquals(node_status_packet.getType(), NOTIFY_NODE_INFORMATION) self.assertEquals(node_list, expected_node_list)
self.assertEquals(node_status_packet.decode()[0],
[(STORAGE_NODE_TYPE, storage_ip, storage_port,
fake_storage_node_uuid, state), ]
)
# Check that failed connection got removed from connection pool # Check that failed connection got removed from connection pool
removeConnection_call_list = app.cp.mockGetNamedCalls('removeConnection') removeConnection_call_list = app.cp.mockGetNamedCalls('removeConnection')
# Test sanity check # Test sanity check
...@@ -270,12 +254,12 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -270,12 +254,12 @@ class ClientEventHandlerTest(unittest.TestCase):
dispatcher = self.getDispatcher() dispatcher = self.getDispatcher()
client_handler = PrimaryBoostrapEventHandler(app, dispatcher) client_handler = PrimaryBoostrapEventHandler(app, dispatcher)
conn = self.getConnection() conn = self.getConnection()
uuid = self.getUUID() uuid = self.getNewUUID()
app.uuid = 'C' * 16 app.uuid = 'C' * 16
client_handler.handleAcceptNodeIdentification(conn, None, CLIENT_NODE_TYPE, client_handler.handleAcceptNodeIdentification(conn, None, CLIENT_NODE_TYPE,
uuid, '127.0.0.1', 10010, uuid, '127.0.0.1', 10010,
0, 0, INVALID_UUID) 0, 0, INVALID_UUID)
self.assertEquals(len(conn.mockGetNamedCalls('close')), 1) self.checkClosed(conn)
self.assertEquals(app.storage_node, None) self.assertEquals(app.storage_node, None)
self.assertEquals(app.pt, None) self.assertEquals(app.pt, None)
self.assertEquals(app.uuid, 'C' * 16) self.assertEquals(app.uuid, 'C' * 16)
...@@ -293,17 +277,14 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -293,17 +277,14 @@ class ClientEventHandlerTest(unittest.TestCase):
dispatcher = self.getDispatcher() dispatcher = self.getDispatcher()
client_handler = PrimaryBoostrapEventHandler(app, dispatcher) client_handler = PrimaryBoostrapEventHandler(app, dispatcher)
conn = self.getConnection() conn = self.getConnection()
uuid = self.getUUID() uuid = self.getNewUUID()
your_uuid = 'C' * 16 your_uuid = 'C' * 16
app.uuid = INVALID_UUID app.uuid = INVALID_UUID
client_handler.handleAcceptNodeIdentification(conn, None, MASTER_NODE_TYPE, client_handler.handleAcceptNodeIdentification(conn, None, MASTER_NODE_TYPE,
uuid, '127.0.0.1', 10010, uuid, '127.0.0.1', 10010,
10, 2, your_uuid) 10, 2, your_uuid)
self.assertEquals(len(conn.mockGetNamedCalls('close')), 0) self.checkNotClosed(conn)
self.assertEquals(len(conn.mockGetNamedCalls('setUUID')), 1) self.checkUUIDSet(conn, uuid)
setUUID_call_list = node.mockGetNamedCalls('setUUID')
self.assertEquals(len(setUUID_call_list), 1)
self.assertEquals(setUUID_call_list[0].getParam(0), uuid)
self.assertEquals(app.storage_node, None) self.assertEquals(app.storage_node, None)
self.assertTrue(app.pt is not None) self.assertTrue(app.pt is not None)
self.assertEquals(app.uuid, your_uuid) self.assertEquals(app.uuid, your_uuid)
...@@ -321,16 +302,13 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -321,16 +302,13 @@ class ClientEventHandlerTest(unittest.TestCase):
dispatcher = self.getDispatcher() dispatcher = self.getDispatcher()
client_handler = StorageBootstrapEventHandler(app, dispatcher) client_handler = StorageBootstrapEventHandler(app, dispatcher)
conn = self.getConnection() conn = self.getConnection()
uuid = self.getUUID() uuid = self.getNewUUID()
app.uuid = 'C' * 16 app.uuid = 'C' * 16
client_handler.handleAcceptNodeIdentification(conn, None, STORAGE_NODE_TYPE, client_handler.handleAcceptNodeIdentification(conn, None, STORAGE_NODE_TYPE,
uuid, '127.0.0.1', 10010, uuid, '127.0.0.1', 10010,
0, 0, INVALID_UUID) 0, 0, INVALID_UUID)
self.assertEquals(len(conn.mockGetNamedCalls('close')), 0) self.checkNotClosed(conn)
self.assertEquals(len(conn.mockGetNamedCalls('setUUID')), 1) self.checkUUIDSet(conn, uuid)
setUUID_call_list = node.mockGetNamedCalls('setUUID')
self.assertEquals(len(setUUID_call_list), 1)
self.assertEquals(setUUID_call_list[0].getParam(0), uuid)
self.assertEquals(app.pt, None) self.assertEquals(app.pt, None)
self.assertEquals(app.uuid, 'C' * 16) self.assertEquals(app.uuid, 'C' * 16)
...@@ -367,7 +345,7 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -367,7 +345,7 @@ class ClientEventHandlerTest(unittest.TestCase):
app = App() app = App()
client_handler = PrimaryBoostrapEventHandler(app, self.getDispatcher()) client_handler = PrimaryBoostrapEventHandler(app, self.getDispatcher())
conn = self.getConnection() conn = self.getConnection()
test_master_list = [('127.0.0.1', 10010, self.getUUID())] test_master_list = [('127.0.0.1', 10010, self.getNewUUID())]
client_handler.handleAnswerPrimaryMaster(conn, None, INVALID_UUID, test_master_list) client_handler.handleAnswerPrimaryMaster(conn, None, INVALID_UUID, test_master_list)
# Test sanity check # Test sanity check
getNodeByUUID_call_list = app.nm.mockGetNamedCalls('getNodeByUUID') getNodeByUUID_call_list = app.nm.mockGetNamedCalls('getNodeByUUID')
...@@ -396,7 +374,7 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -396,7 +374,7 @@ class ClientEventHandlerTest(unittest.TestCase):
app = App() app = App()
client_handler = PrimaryBoostrapEventHandler(app, self.getDispatcher()) client_handler = PrimaryBoostrapEventHandler(app, self.getDispatcher())
conn = self.getConnection() conn = self.getConnection()
test_node_uuid = self.getUUID() test_node_uuid = self.getNewUUID()
test_master_list = [('127.0.0.1', 10010, test_node_uuid)] test_master_list = [('127.0.0.1', 10010, test_node_uuid)]
client_handler.handleAnswerPrimaryMaster(conn, None, INVALID_UUID, test_master_list) client_handler.handleAnswerPrimaryMaster(conn, None, INVALID_UUID, test_master_list)
# Test sanity checks # Test sanity checks
...@@ -412,15 +390,13 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -412,15 +390,13 @@ class ClientEventHandlerTest(unittest.TestCase):
self.assertEqual(len(getNodeByServer_call_list), 1) self.assertEqual(len(getNodeByServer_call_list), 1)
self.assertEqual(len(add_call_list), 0) self.assertEqual(len(add_call_list), 0)
# Check that node UUID got updated # Check that node UUID got updated
setUUID_call_list = node.mockGetNamedCalls('setUUID') self.checkUUIDSet(node, test_node_uuid)
self.assertEqual(len(setUUID_call_list), 1)
self.assertEqual(setUUID_call_list[0].getParam(0), test_node_uuid)
# Check that primary master was not updated (it is not known yet, # Check that primary master was not updated (it is not known yet,
# hence INVALID_UUID in call). # hence INVALID_UUID in call).
self.assertEquals(app.primary_master_node, None) self.assertEquals(app.primary_master_node, None)
def test_knownNodeKnownUUIDNodeAnswerPrimaryMaster(self): def test_knownNodeKnownUUIDNodeAnswerPrimaryMaster(self):
test_node_uuid = self.getUUID() test_node_uuid = self.getNewUUID()
node = Mock({'getNodeType': MASTER_NODE_TYPE, 'getUUID': test_node_uuid, 'setUUID': None}) node = Mock({'getNodeType': MASTER_NODE_TYPE, 'getUUID': test_node_uuid, 'setUUID': None})
class App: class App:
nm = Mock({'getNodeByUUID': node, 'getNodeByServer': node, 'add': None}) nm = Mock({'getNodeByUUID': node, 'getNodeByServer': node, 'add': None})
...@@ -444,8 +420,7 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -444,8 +420,7 @@ class ClientEventHandlerTest(unittest.TestCase):
# XXX: should we just check that there was either no call or a call # XXX: should we just check that there was either no call or a call
# with same uuid, or enforce no call ? Here we enforce no call just # with same uuid, or enforce no call ? Here we enforce no call just
# because it's what implementation does. # because it's what implementation does.
setUUID_call_list = node.mockGetNamedCalls('setUUID') self.checkNoUUIDSet(node)
self.assertEqual(len(setUUID_call_list), 0)
# Check that primary master was not updated (it is not known yet, # Check that primary master was not updated (it is not known yet,
# hence INVALID_UUID in call). # hence INVALID_UUID in call).
self.assertEquals(app.primary_master_node, None) self.assertEquals(app.primary_master_node, None)
...@@ -454,10 +429,10 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -454,10 +429,10 @@ class ClientEventHandlerTest(unittest.TestCase):
# desired behaviour unknown) # desired behaviour unknown)
def test_alreadyDifferentPrimaryAnswerPrimaryMaster(self): def test_alreadyDifferentPrimaryAnswerPrimaryMaster(self):
test_node_uuid = self.getUUID() test_node_uuid = self.getNewUUID()
test_primary_node_uuid = test_node_uuid test_primary_node_uuid = test_node_uuid
while test_primary_node_uuid == test_node_uuid: while test_primary_node_uuid == test_node_uuid:
test_primary_node_uuid = self.getUUID() test_primary_node_uuid = self.getNewUUID()
test_primary_master_node = Mock({'getUUID': test_primary_node_uuid}) test_primary_master_node = Mock({'getUUID': test_primary_node_uuid})
node = Mock({'getNodeType': MASTER_NODE_TYPE, 'getUUID': test_node_uuid, 'setUUID': None}) node = Mock({'getNodeType': MASTER_NODE_TYPE, 'getUUID': test_node_uuid, 'setUUID': None})
class App: class App:
...@@ -479,7 +454,7 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -479,7 +454,7 @@ class ClientEventHandlerTest(unittest.TestCase):
self.assertEqual(len(getNodeByServer_call_list), 0) self.assertEqual(len(getNodeByServer_call_list), 0)
def test_alreadySamePrimaryAnswerPrimaryMaster(self): def test_alreadySamePrimaryAnswerPrimaryMaster(self):
test_node_uuid = self.getUUID() test_node_uuid = self.getNewUUID()
node = Mock({'getNodeType': MASTER_NODE_TYPE, 'getUUID': test_node_uuid, 'setUUID': None}) node = Mock({'getNodeType': MASTER_NODE_TYPE, 'getUUID': test_node_uuid, 'setUUID': None})
class App: class App:
nm = Mock({'getNodeByUUID': node, 'getNodeByServer': node, 'add': None}) nm = Mock({'getNodeByUUID': node, 'getNodeByServer': node, 'add': None})
...@@ -492,10 +467,10 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -492,10 +467,10 @@ class ClientEventHandlerTest(unittest.TestCase):
self.assertTrue(app.primary_master_node is node) self.assertTrue(app.primary_master_node is node)
def test_unknownNewPrimaryAnswerPrimaryMaster(self): def test_unknownNewPrimaryAnswerPrimaryMaster(self):
test_node_uuid = self.getUUID() test_node_uuid = self.getNewUUID()
test_primary_node_uuid = test_node_uuid test_primary_node_uuid = test_node_uuid
while test_primary_node_uuid == test_node_uuid: while test_primary_node_uuid == test_node_uuid:
test_primary_node_uuid = self.getUUID() test_primary_node_uuid = self.getNewUUID()
node = Mock({'getNodeType': MASTER_NODE_TYPE, 'getUUID': test_node_uuid, 'setUUID': None}) node = Mock({'getNodeType': MASTER_NODE_TYPE, 'getUUID': test_node_uuid, 'setUUID': None})
class App: class App:
nm = Mock({'getNodeByUUID': ReturnValues(node, None), 'getNodeByServer': node, 'add': None}) nm = Mock({'getNodeByUUID': ReturnValues(node, None), 'getNodeByServer': node, 'add': None})
...@@ -513,7 +488,7 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -513,7 +488,7 @@ class ClientEventHandlerTest(unittest.TestCase):
self.assertTrue(app.primary_master_node is None) self.assertTrue(app.primary_master_node is None)
def test_AnswerPrimaryMaster(self): def test_AnswerPrimaryMaster(self):
test_node_uuid = self.getUUID() test_node_uuid = self.getNewUUID()
node = Mock({'getNodeType': MASTER_NODE_TYPE, 'getUUID': test_node_uuid, 'setUUID': None}) node = Mock({'getNodeType': MASTER_NODE_TYPE, 'getUUID': test_node_uuid, 'setUUID': None})
class App: class App:
nm = Mock({'getNodeByUUID': node, 'getNodeByServer': node, 'add': None}) nm = Mock({'getNodeByUUID': node, 'getNodeByServer': node, 'add': None})
...@@ -576,7 +551,7 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -576,7 +551,7 @@ class ClientEventHandlerTest(unittest.TestCase):
nm = Mock({'getNodeByUUID': ReturnValues(test_node, None), 'add': None}) nm = Mock({'getNodeByUUID': ReturnValues(test_node, None), 'add': None})
pt = Mock({'setCell': None}) pt = Mock({'setCell': None})
ptid = test_ptid ptid = test_ptid
test_storage_uuid = self.getUUID() test_storage_uuid = self.getNewUUID()
app = App() app = App()
client_handler = PrimaryBoostrapEventHandler(app, self.getDispatcher()) client_handler = PrimaryBoostrapEventHandler(app, self.getDispatcher())
conn = self.getConnection() conn = self.getConnection()
...@@ -605,7 +580,7 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -605,7 +580,7 @@ class ClientEventHandlerTest(unittest.TestCase):
nm = Mock({'getNodeByUUID': test_node, 'add': None}) nm = Mock({'getNodeByUUID': test_node, 'add': None})
pt = Mock({'setCell': None}) pt = Mock({'setCell': None})
ptid = test_ptid ptid = test_ptid
test_storage_uuid = self.getUUID() test_storage_uuid = self.getNewUUID()
app = App() app = App()
client_handler = PrimaryBoostrapEventHandler(app, self.getDispatcher()) client_handler = PrimaryBoostrapEventHandler(app, self.getDispatcher())
conn = self.getConnection() conn = self.getConnection()
...@@ -633,7 +608,7 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -633,7 +608,7 @@ class ClientEventHandlerTest(unittest.TestCase):
def test_nonMasterNotifyNodeInformation(self): def test_nonMasterNotifyNodeInformation(self):
for node_type in (CLIENT_NODE_TYPE, STORAGE_NODE_TYPE): for node_type in (CLIENT_NODE_TYPE, STORAGE_NODE_TYPE):
test_master_uuid = self.getUUID() test_master_uuid = self.getNewUUID()
node = Mock({'getNodeType': node_type}) node = Mock({'getNodeType': node_type})
class App: class App:
nm = Mock({'getNodeByUUID': node}) nm = Mock({'getNodeByUUID': node})
...@@ -647,7 +622,7 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -647,7 +622,7 @@ class ClientEventHandlerTest(unittest.TestCase):
# assumption described in test_nonMasterNotifyNodeInformation # assumption described in test_nonMasterNotifyNodeInformation
# by making a valid call with a non-iterable parameter given as # by making a valid call with a non-iterable parameter given as
# node_list value. # node_list value.
test_master_uuid = self.getUUID() test_master_uuid = self.getNewUUID()
node = Mock({'getNodeType': MASTER_NODE_TYPE}) node = Mock({'getNodeType': MASTER_NODE_TYPE})
class App: class App:
nm = Mock({'getNodeByUUID': node}) nm = Mock({'getNodeByUUID': node})
...@@ -661,7 +636,7 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -661,7 +636,7 @@ class ClientEventHandlerTest(unittest.TestCase):
invalid_uid_test_node = (test_node[0], test_node[1], test_node[2] + 1, invalid_uid_test_node = (test_node[0], test_node[1], test_node[2] + 1,
INVALID_UUID, test_node[4]) INVALID_UUID, test_node[4])
test_node_list = [test_node, invalid_uid_test_node] test_node_list = [test_node, invalid_uid_test_node]
test_master_uuid = self.getUUID() test_master_uuid = self.getNewUUID()
node = Mock({'getNodeType': MASTER_NODE_TYPE}) node = Mock({'getNodeType': MASTER_NODE_TYPE})
if getNodeByUUID is not MARKER: if getNodeByUUID is not MARKER:
getNodeByUUID = ReturnValues(node, getNodeByUUID) getNodeByUUID = ReturnValues(node, getNodeByUUID)
...@@ -680,7 +655,7 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -680,7 +655,7 @@ class ClientEventHandlerTest(unittest.TestCase):
def test_unknownMasterNotifyNodeInformation(self): def test_unknownMasterNotifyNodeInformation(self):
# first notify unknown master nodes # first notify unknown master nodes
uuid = self.getUUID() uuid = self.getNewUUID()
test_node = (MASTER_NODE_TYPE, '127.0.0.1', 10010, uuid, test_node = (MASTER_NODE_TYPE, '127.0.0.1', 10010, uuid,
RUNNING_STATE) RUNNING_STATE)
nm = self._testNotifyNodeInformation(test_node, getNodeByUUID=None) nm = self._testNotifyNodeInformation(test_node, getNodeByUUID=None)
...@@ -694,7 +669,7 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -694,7 +669,7 @@ class ClientEventHandlerTest(unittest.TestCase):
def test_knownMasterNotifyNodeInformation(self): def test_knownMasterNotifyNodeInformation(self):
node = Mock({}) node = Mock({})
uuid = self.getUUID() uuid = self.getNewUUID()
test_node = (MASTER_NODE_TYPE, '127.0.0.1', 10010, uuid, test_node = (MASTER_NODE_TYPE, '127.0.0.1', 10010, uuid,
RUNNING_STATE) RUNNING_STATE)
nm = self._testNotifyNodeInformation(test_node, getNodeByServer=node, nm = self._testNotifyNodeInformation(test_node, getNodeByServer=node,
...@@ -704,7 +679,7 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -704,7 +679,7 @@ class ClientEventHandlerTest(unittest.TestCase):
add_call_list = node.mockGetNamedCalls('add') add_call_list = node.mockGetNamedCalls('add')
def test_unknownStorageNotifyNodeInformation(self): def test_unknownStorageNotifyNodeInformation(self):
test_node = (STORAGE_NODE_TYPE, '127.0.0.1', 10010, self.getUUID(), test_node = (STORAGE_NODE_TYPE, '127.0.0.1', 10010, self.getNewUUID(),
RUNNING_STATE) RUNNING_STATE)
nm = self._testNotifyNodeInformation(test_node, getNodeByUUID=None) nm = self._testNotifyNodeInformation(test_node, getNodeByUUID=None)
# Check that node got added # Check that node got added
...@@ -719,7 +694,7 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -719,7 +694,7 @@ class ClientEventHandlerTest(unittest.TestCase):
def test_knownStorageNotifyNodeInformation(self): def test_knownStorageNotifyNodeInformation(self):
node = Mock({'setState': None, 'setServer': None}) node = Mock({'setState': None, 'setServer': None})
test_node = (STORAGE_NODE_TYPE, '127.0.0.1', 10010, self.getUUID(), test_node = (STORAGE_NODE_TYPE, '127.0.0.1', 10010, self.getNewUUID(),
RUNNING_STATE) RUNNING_STATE)
nm = self._testNotifyNodeInformation(test_node, getNodeByUUID=node) nm = self._testNotifyNodeInformation(test_node, getNodeByUUID=node)
# Check that no node got added # Check that no node got added
...@@ -748,7 +723,7 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -748,7 +723,7 @@ class ClientEventHandlerTest(unittest.TestCase):
def test_nonMasterNotifyPartitionChanges(self): def test_nonMasterNotifyPartitionChanges(self):
for node_type in (CLIENT_NODE_TYPE, STORAGE_NODE_TYPE): for node_type in (CLIENT_NODE_TYPE, STORAGE_NODE_TYPE):
test_master_uuid = self.getUUID() test_master_uuid = self.getNewUUID()
node = Mock({'getNodeType': node_type, 'getUUID': test_master_uuid}) node = Mock({'getNodeType': node_type, 'getUUID': test_master_uuid})
class App: class App:
nm = Mock({'getNodeByUUID': node}) nm = Mock({'getNodeByUUID': node})
...@@ -777,10 +752,10 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -777,10 +752,10 @@ class ClientEventHandlerTest(unittest.TestCase):
self.assertTrue(app.pt is None) self.assertTrue(app.pt is None)
def test_nonPrimaryMasterNotifyPartitionChanges(self): def test_nonPrimaryMasterNotifyPartitionChanges(self):
test_master_uuid = self.getUUID() test_master_uuid = self.getNewUUID()
test_sender_uuid = test_master_uuid test_sender_uuid = test_master_uuid
while test_sender_uuid == test_master_uuid: while test_sender_uuid == test_master_uuid:
test_sender_uuid = self.getUUID() test_sender_uuid = self.getNewUUID()
node = Mock({'getNodeType': MASTER_NODE_TYPE}) node = Mock({'getNodeType': MASTER_NODE_TYPE})
test_master_node = Mock({'getUUID': test_master_uuid}) test_master_node = Mock({'getUUID': test_master_uuid})
class App: class App:
...@@ -796,7 +771,7 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -796,7 +771,7 @@ class ClientEventHandlerTest(unittest.TestCase):
self.assertTrue(app.pt is None) self.assertTrue(app.pt is None)
def test_ignoreOutdatedPTIDNotifyPartitionChanges(self): def test_ignoreOutdatedPTIDNotifyPartitionChanges(self):
test_master_uuid = self.getUUID() test_master_uuid = self.getNewUUID()
node = Mock({'getNodeType': MASTER_NODE_TYPE, 'getUUID': test_master_uuid}) node = Mock({'getNodeType': MASTER_NODE_TYPE, 'getUUID': test_master_uuid})
test_ptid = 1 test_ptid = 1
class App: class App:
...@@ -813,7 +788,7 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -813,7 +788,7 @@ class ClientEventHandlerTest(unittest.TestCase):
self.assertEquals(app.ptid, test_ptid) self.assertEquals(app.ptid, test_ptid)
def test_unknownNodeNotifyPartitionChanges(self): def test_unknownNodeNotifyPartitionChanges(self):
test_master_uuid = self.getUUID() test_master_uuid = self.getNewUUID()
test_node = Mock({'getNodeType': MASTER_NODE_TYPE, 'getUUID': test_master_uuid}) test_node = Mock({'getNodeType': MASTER_NODE_TYPE, 'getUUID': test_master_uuid})
test_ptid = 1 test_ptid = 1
class App: class App:
...@@ -825,7 +800,7 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -825,7 +800,7 @@ class ClientEventHandlerTest(unittest.TestCase):
app = App() app = App()
client_handler = PrimaryEventHandler(app, self.getDispatcher()) client_handler = PrimaryEventHandler(app, self.getDispatcher())
conn = self.getConnection(uuid=test_master_uuid) conn = self.getConnection(uuid=test_master_uuid)
test_storage_uuid = self.getUUID() test_storage_uuid = self.getNewUUID()
# TODO: use realistic values # TODO: use realistic values
test_cell_list = [(0, test_storage_uuid, UP_TO_DATE_STATE)] test_cell_list = [(0, test_storage_uuid, UP_TO_DATE_STATE)]
client_handler.handleNotifyPartitionChanges(conn, None, test_ptid + 1, test_cell_list) client_handler.handleNotifyPartitionChanges(conn, None, test_ptid + 1, test_cell_list)
...@@ -848,8 +823,8 @@ class ClientEventHandlerTest(unittest.TestCase): ...@@ -848,8 +823,8 @@ class ClientEventHandlerTest(unittest.TestCase):
def test_knownNodeNotifyPartitionChanges(self): def test_knownNodeNotifyPartitionChanges(self):
test_ptid = 1 test_ptid = 1
uuid1, uuid2 = self.getUUID(), self.getUUID() uuid1, uuid2 = self.getNewUUID(), self.getNewUUID()
uuid3, uuid4 = self.getUUID(), self.getUUID() uuid3, uuid4 = self.getNewUUID(), self.getNewUUID()
test_node = Mock({'getNodeType': MASTER_NODE_TYPE, 'getUUID': uuid1}) test_node = Mock({'getNodeType': MASTER_NODE_TYPE, 'getUUID': uuid1})
class App: class App:
nm = Mock({'getNodeByUUID': ReturnValues(test_node, None, None, None), 'add': None}) nm = Mock({'getNodeByUUID': ReturnValues(test_node, None, None, None), 'add': None})
......
...@@ -179,6 +179,21 @@ class NeoTestBase(unittest.TestCase): ...@@ -179,6 +179,21 @@ class NeoTestBase(unittest.TestCase):
def checkAskObjectPresent(self, conn, **kw): def checkAskObjectPresent(self, conn, **kw):
return self.checkAskPacket(conn, protocol.ASK_OBJECT_PRESENT, **kw) return self.checkAskPacket(conn, protocol.ASK_OBJECT_PRESENT, **kw)
def checkAskObject(self, conn, **kw):
return self.checkAskPacket(conn, protocol.ASK_OBJECT, **kw)
def checkAskStoreObject(self, conn, **kw):
return self.checkAskPacket(conn, protocol.ASK_STORE_OBJECT, **kw)
def checkAskStoreTransaction(self, conn, **kw):
return self.checkAskPacket(conn, protocol.ASK_STORE_TRANSACTION, **kw)
def checkFinishTransaction(self, conn, **kw):
return self.checkAskPacket(conn, protocol.FINISH_TRANSACTION, **kw)
def checkAskNewTid(self, conn, **kw):
return self.checkAskPacket(conn, protocol.ASK_NEW_TID, **kw)
def checkAcceptNodeIdentification(self, conn, **kw): def checkAcceptNodeIdentification(self, conn, **kw):
return self.checkAnswerPacket(conn, protocol.ACCEPT_NODE_IDENTIFICATION, **kw) return self.checkAnswerPacket(conn, protocol.ACCEPT_NODE_IDENTIFICATION, **kw)
......
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