Commit 36555d9a authored by Grégory Wisniewski's avatar Grégory Wisniewski

As for previous commit, replace calls of getXXXNodeList() with getXXXList().


git-svn-id: https://svn.erp5.org/repos/neo/trunk@1319 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 57e5e7f8
......@@ -47,7 +47,7 @@ class AdminEventHandler(EventHandler):
logging.info("ask node list for %s" %(node_type))
def node_filter(n):
return n.getType() is node_type
node_list = self.app.nm.getNodeList(node_filter)
node_list = self.app.nm.getList(node_filter)
node_information_list = []
for node in node_list:
try:
......
......@@ -96,7 +96,7 @@ class BootstrapManager(EventHandler):
logging.info('connecting to a primary master node')
em, nm = self.app.em, self.app.nm
index = 0
self.current = nm.getMasterNodeList()[0]
self.current = nm.getMasterList()[0]
conn = None
# retry until identified to the primary
while self.primary is None or conn.getUUID() != self.primary.getUUID():
......@@ -104,7 +104,7 @@ class BootstrapManager(EventHandler):
# conn closed
conn = None
# select a master
master_list = nm.getMasterNodeList()
master_list = nm.getMasterList()
index = (index + 1) % len(master_list)
self.current = master_list[index]
if index == 0:
......
......@@ -396,7 +396,7 @@ class Application(object):
self.primary_master_node = None
else:
# Otherwise, check one by one.
master_list = nm.getMasterNodeList()
master_list = nm.getMasterList()
try:
self.trying_master_node = master_list[index]
except IndexError:
......
......@@ -148,7 +148,7 @@ class Application(object):
em = self.em
nm = self.nm
for node in nm.getMasterNodeList():
for node in nm.getMasterList():
# For now, believe that every node should be available,
# since down or broken nodes may be already repaired.
node.setState(RUNNING_STATE)
......@@ -158,7 +158,7 @@ class Application(object):
self.primary = None
self.primary_master_node = None
for node in nm.getMasterNodeList():
for node in nm.getMasterList():
if node.getState() == RUNNING_STATE:
self.unconnected_master_node_set.add(node.getServer())
......@@ -177,7 +177,7 @@ class Application(object):
current_time = time()
if current_time >= t + 1:
t = current_time
for node in nm.getMasterNodeList():
for node in nm.getMasterList():
if node.getState() == TEMPORARILY_DOWN_STATE \
and node.getLastStateChange() + expiration < current_time:
logging.info('%s is down' % (node, ))
......@@ -351,7 +351,7 @@ class Application(object):
def sendNodesInformations(self, conn):
""" Send informations on all nodes through the given connection """
node_list = []
for n in self.nm.getNodeList():
for n in self.nm.getList():
if not n.isAdmin():
try:
address = n.getServer()
......@@ -377,10 +377,10 @@ class Application(object):
nm, em, pt = self.nm, self.em, self.pt
logging.debug('creating a new partition table, wait for a storage node')
# wait for some empty storage nodes, their are accepted
while len(nm.getStorageNodeList()) < REQUIRED_NODE_NUMBER:
while len(nm.getStorageList()) < REQUIRED_NODE_NUMBER:
em.poll(1)
# take the first node available
node_list = nm.getStorageNodeList()[:REQUIRED_NODE_NUMBER]
node_list = nm.getStorageList()[:REQUIRED_NODE_NUMBER]
for node in node_list:
node.setState(protocol.RUNNING_STATE)
self.broadcastNodeInformation(node)
......@@ -418,7 +418,7 @@ class Application(object):
# collect node that are connected but not in the selected partition
# table and set them in pending state
allowed_node_set = set(self.pt.getNodeList())
refused_node_set = set(self.nm.getStorageNodeList()) - allowed_node_set
refused_node_set = set(self.nm.getStorageList()) - allowed_node_set
for node in refused_node_set:
node.setState(protocol.PENDING_STATE)
self.broadcastNodeInformation(node)
......@@ -624,7 +624,7 @@ class Application(object):
# If I know any storage node, make sure that they are not in the running state,
# because they are not connected at this stage.
for node in nm.getStorageNodeList():
for node in nm.getStorageList():
if node.getState() == RUNNING_STATE:
node.setState(TEMPORARILY_DOWN_STATE)
......
......@@ -43,7 +43,7 @@ class MasterHandler(EventHandler):
primary_uuid = None
known_master_list = [(app.server, app.uuid, )]
for n in app.nm.getMasterNodeList():
for n in app.nm.getMasterList():
if n.getState() == protocol.BROKEN_STATE:
continue
known_master_list.append((n.getServer(), n.getUUID(), ))
......
......@@ -100,7 +100,7 @@ class AdministrationHandler(MasterHandler):
cell_list = []
uuid_set = set()
# take all pending nodes
for node in nm.getStorageNodeList():
for node in nm.getStorageList():
if node.getState() == PENDING_STATE:
uuid_set.add(node.getUUID())
# keep only selected nodes
......
......@@ -325,9 +325,3 @@ class NodeManager(object):
)
logging.debug('nm: %s : %s/%s' % args)
# XXX: backward compatibility, to be removed
getNodeList = getList
getMasterNodeList = getMasterList
getStorageNodeList = getStorageList
getClientNodeList = getClientList
getAdminNodeList = getAdminList
......@@ -358,10 +358,10 @@ class NEOCluster(object):
return [x for x in self.neoctl.getNodeList(node_type)
if state is None or x[3] == state]
def getMasterNodeList(self, state=None):
def getMasterList(self, state=None):
return self.__getNodeList(protocol.MASTER_NODE_TYPE, state)
def getStorageNodeList(self, state=None):
def getStorageList(self, state=None):
return self.__getNodeList(protocol.STORAGE_NODE_TYPE, state)
def __getNodeState(self, node_type, uuid):
......@@ -400,7 +400,7 @@ class NEOCluster(object):
def expectAllMasters(self, node_count, state=None, timeout=0, delay=1):
def callback(last_try):
current_try = len(self.getMasterNodeList(state=state))
current_try = len(self.getMasterList(state=state))
if last_try is not None and current_try < last_try:
raise AssertionError, 'Regression: %s became %s' % \
(last_try, current_try)
......
......@@ -79,7 +79,7 @@ class MasterTests(NEOFunctionalTest):
# Test sanity checks.
self.assertEqual(len(killed_uuid_list), 1)
self.neo.expectMasterState(killed_uuid_list[0], None)
self.assertEqual(len(self.neo.getMasterNodeList()), 2)
self.assertEqual(len(self.neo.getMasterList()), 2)
killed_uuid_list = self.neo.killPrimaryMaster()
# Test sanity check.
......@@ -109,7 +109,7 @@ class MasterTests(NEOFunctionalTest):
# Check that the master node we started elected itself.
self.neo.expectPrimaryMaster(first_master_uuid, timeout=30)
# Check that no other node is known as running.
self.assertEqual(len(self.neo.getMasterNodeList(
self.assertEqual(len(self.neo.getMasterList(
state=protocol.RUNNING_STATE)), 1)
# Start a second master.
......
......@@ -96,7 +96,7 @@ class StorageTests(NEOFunctionalTest):
def __checkReplicationDone(self):
# wait for replication to finish
def expect_all_storages(last_try):
storage_number = len(self.neo.getStorageNodeList())
storage_number = len(self.neo.getStorageList())
return storage_number == len(self.neo.db_list), storage_number
self.neo.expectCondition(expect_all_storages, timeout=10)
self.neo.expectOudatedCells(number=0, timeout=10)
......@@ -105,7 +105,7 @@ class StorageTests(NEOFunctionalTest):
self.__checkDatabase(db_name)
# check storages state
storage_list = self.neo.getStorageNodeList(protocol.RUNNING_STATE)
storage_list = self.neo.getStorageList(protocol.RUNNING_STATE)
self.assertEqual(len(storage_list), 2)
def __expectRunning(self, process):
......@@ -120,7 +120,7 @@ class StorageTests(NEOFunctionalTest):
def __expectNotKnown(self, process):
def expected_storage_not_known(last_try):
storage_list = self.neo.getStorageNodeList()
storage_list = self.neo.getStorageList()
for storage in storage_list:
if storage[2] == process.getUUID():
return False, storage
......@@ -278,7 +278,7 @@ class StorageTests(NEOFunctionalTest):
# XXX: should wait for the storage rejection
# check that no node were added
storage_number = len(self.neo.getStorageNodeList())
storage_number = len(self.neo.getStorageList())
self.assertEqual(storage_number, 1)
def testPartitionTableReorganizedWithNewStorage(self):
......
......@@ -132,7 +132,7 @@ class MasterClientHandlerTests(NeoTestBase):
service.handleNotifyNodeInformation(conn, packet, node_list)
for call in conn.mockGetAllCalls():
self.assertEquals(call.getName(), "getUUID")
sn = self.app.nm.getStorageNodeList()[0]
sn = self.app.nm.getStorageList()[0]
self.assertEquals(sn.getState(), TEMPORARILY_DOWN_STATE)
self.assertEquals(ptid, self.app.pt.getID())
# notify node is broken, must be taken into account and partition must changed
......@@ -141,7 +141,7 @@ class MasterClientHandlerTests(NeoTestBase):
service.handleNotifyNodeInformation(conn, packet, node_list)
for call in conn.mockGetAllCalls():
self.assertEquals(call.getName(), "getUUID")
sn = self.app.nm.getStorageNodeList()[0]
sn = self.app.nm.getStorageList()[0]
self.assertEquals(sn.getState(), BROKEN_STATE)
self.failUnless(ptid < self.app.pt.getID())
......@@ -304,7 +304,7 @@ class MasterClientHandlerTests(NeoTestBase):
self.identifyToMasterNode(port = self.storage_port+2)
storage_uuid = self.identifyToMasterNode(port = self.storage_port+1)
# filled the pt
self.app.pt.make(self.app.nm.getStorageNodeList())
self.app.pt.make(self.app.nm.getStorageList())
self.assertTrue(self.app.pt.filled())
self.assertTrue(self.app.pt.operational())
conn = self.getFakeConnection(storage_uuid, ('127.0.0.1', self.storage_port+1))
......@@ -345,7 +345,7 @@ class MasterClientHandlerTests(NeoTestBase):
self.identifyToMasterNode(port = self.storage_port+2)
storage_uuid = self.identifyToMasterNode(port = self.storage_port+1)
# filled the pt
self.app.pt.make(self.app.nm.getStorageNodeList())
self.app.pt.make(self.app.nm.getStorageList())
self.assertTrue(self.app.pt.filled())
self.assertTrue(self.app.pt.operational())
conn = self.getFakeConnection(storage_uuid, ('127.0.0.1', self.storage_port+1))
......@@ -386,7 +386,7 @@ class MasterClientHandlerTests(NeoTestBase):
self.identifyToMasterNode(port = self.storage_port+2)
storage_uuid = self.identifyToMasterNode(port = self.storage_port+1)
# filled the pt
self.app.pt.make(self.app.nm.getStorageNodeList())
self.app.pt.make(self.app.nm.getStorageList())
self.assertTrue(self.app.pt.filled())
self.assertTrue(self.app.pt.operational())
conn = self.getFakeConnection(storage_uuid, ('127.0.0.1', self.storage_port+1))
......
......@@ -74,7 +74,7 @@ class MasterClientElectionTests(NeoTestBase):
self.election = ClientElectionHandler(self.app)
self.app.unconnected_master_node_set = set()
self.app.negotiating_master_node_set = set()
for node in self.app.nm.getMasterNodeList():
for node in self.app.nm.getMasterList():
self.app.unconnected_master_node_set.add(node.getServer())
node.setState(RUNNING_STATE)
# define some variable to simulate client and storage node
......@@ -143,7 +143,7 @@ class MasterClientElectionTests(NeoTestBase):
"isServer" : True,
"getConnector": Mock(),
"getAddress" : ("127.0.0.1", self.master_port)})
self.assertEqual(len(self.app.nm.getMasterNodeList()), 2)
self.assertEqual(len(self.app.nm.getMasterList()), 2)
election.handleAskPrimaryMaster(conn, packet)
self.assertEquals(len(conn.mockGetNamedCalls("answer")), 1)
self.assertEquals(len(conn.mockGetNamedCalls("abort")), 0)
......@@ -161,11 +161,11 @@ class MasterClientElectionTests(NeoTestBase):
self.assertEqual(len(self.app.unconnected_master_node_set), 0)
self.assertEqual(len(self.app.negotiating_master_node_set), 1)
self.assertEqual(len(conn.getConnector().mockGetNamedCalls("_addPacket")),1)
self.assertEqual(len(self.app.nm.getMasterNodeList()), 1)
self.assertEqual(len(self.app.nm.getMasterList()), 1)
self.election.handleAnswerPrimaryMaster(conn, p, INVALID_UUID, [])
self.assertEqual(len(conn.getConnector().mockGetNamedCalls("_addPacket")),1)
self.assertEqual(self.app.primary, False)
self.assertEqual(len(self.app.nm.getMasterNodeList()), 1)
self.assertEqual(len(self.app.nm.getMasterList()), 1)
self.assertEqual(len(self.app.unconnected_master_node_set), 0)
self.assertEqual(len(self.app.negotiating_master_node_set), 0)
......@@ -182,11 +182,11 @@ class MasterClientElectionTests(NeoTestBase):
self.assertEqual(len(self.app.unconnected_master_node_set), 0)
self.assertEqual(len(self.app.negotiating_master_node_set), 1)
self.assertEqual(len(conn.getConnector().mockGetNamedCalls("_addPacket")),1)
self.assertEqual(len(self.app.nm.getMasterNodeList()), 1)
self.assertEqual(len(self.app.nm.getMasterList()), 1)
self.election.handleAnswerPrimaryMaster(conn, p, INVALID_UUID, [])
self.assertEqual(len(conn.getConnector().mockGetNamedCalls("_addPacket")),1)
self.assertEqual(self.app.primary, None)
self.assertEqual(len(self.app.nm.getMasterNodeList()), 1)
self.assertEqual(len(self.app.nm.getMasterList()), 1)
self.assertEqual(len(self.app.unconnected_master_node_set), 0)
self.assertEqual(len(self.app.negotiating_master_node_set), 0)
......@@ -202,11 +202,11 @@ class MasterClientElectionTests(NeoTestBase):
self.assertEqual(len(self.app.unconnected_master_node_set), 0)
self.assertEqual(len(self.app.negotiating_master_node_set), 1)
self.assertEqual(len(conn.getConnector().mockGetNamedCalls("_addPacket")),1)
self.assertEqual(len(self.app.nm.getMasterNodeList()), 2)
self.assertEqual(len(self.app.nm.getMasterList()), 2)
self.assertEqual(self.app.primary_master_node, None)
self.election.handleAnswerPrimaryMaster(conn, p, uuid, [])
self.assertEqual(len(conn.getConnector().mockGetNamedCalls("_addPacket")),1)
self.assertEqual(len(self.app.nm.getMasterNodeList()), 2)
self.assertEqual(len(self.app.nm.getMasterList()), 2)
self.assertEqual(len(self.app.unconnected_master_node_set), 0)
self.assertEqual(len(self.app.negotiating_master_node_set), 0)
self.assertNotEqual(self.app.primary_master_node, None)
......@@ -223,11 +223,11 @@ class MasterClientElectionTests(NeoTestBase):
self.assertEqual(len(self.app.unconnected_master_node_set), 0)
self.assertEqual(len(self.app.negotiating_master_node_set), 1)
self.assertEqual(len(conn.getConnector().mockGetNamedCalls("_addPacket")),1)
self.assertEqual(len(self.app.nm.getMasterNodeList()), 1)
self.assertEqual(len(self.app.nm.getMasterList()), 1)
self.assertEqual(self.app.primary_master_node, None)
self.election.handleAnswerPrimaryMaster(conn, p, uuid, [])
self.assertEqual(len(conn.getConnector().mockGetNamedCalls("_addPacket")),1)
self.assertEqual(len(self.app.nm.getMasterNodeList()), 1)
self.assertEqual(len(self.app.nm.getMasterList()), 1)
self.assertEqual(len(self.app.unconnected_master_node_set), 0)
self.assertEqual(len(self.app.negotiating_master_node_set), 0)
self.assertEqual(self.app.primary_master_node, None)
......@@ -245,13 +245,13 @@ class MasterClientElectionTests(NeoTestBase):
self.assertEqual(len(self.app.unconnected_master_node_set), 0)
self.assertEqual(len(self.app.negotiating_master_node_set), 1)
self.assertEqual(len(conn.getConnector().mockGetNamedCalls("_addPacket")),1)
self.assertEqual(len(self.app.nm.getMasterNodeList()), 2)
self.assertEqual(len(self.app.nm.getMasterList()), 2)
self.assertEqual(self.app.primary_master_node, None)
master_uuid = self.getNewUUID()
self.election.handleAnswerPrimaryMaster(conn, p, master_uuid,
[(("127.0.0.1", self.master_port+1), master_uuid,)])
self.assertEqual(len(conn.getConnector().mockGetNamedCalls("_addPacket")),1)
self.assertEqual(len(self.app.nm.getMasterNodeList()), 3)
self.assertEqual(len(self.app.nm.getMasterList()), 3)
self.assertEqual(len(self.app.unconnected_master_node_set), 1)
self.assertEqual(len(self.app.negotiating_master_node_set), 0)
self.assertNotEqual(self.app.primary_master_node, None)
......@@ -275,7 +275,7 @@ class MasterServerElectionTests(NeoTestBase):
self.election = ServerElectionHandler(self.app)
self.app.unconnected_master_node_set = set()
self.app.negotiating_master_node_set = set()
for node in self.app.nm.getMasterNodeList():
for node in self.app.nm.getMasterList():
self.app.unconnected_master_node_set.add(node.getServer())
node.setState(RUNNING_STATE)
# define some variable to simulate client and storage node
......@@ -481,8 +481,8 @@ class MasterServerElectionTests(NeoTestBase):
# known node
conn = Mock({"_addPacket" : None, "abort" : None, "expectMessage" : None,
"isServer" : True})
self.assertEqual(len(self.app.nm.getMasterNodeList()), 1)
node = self.app.nm.getMasterNodeList()[0]
self.assertEqual(len(self.app.nm.getMasterList()), 1)
node = self.app.nm.getMasterList()[0]
self.assertEqual(node.getUUID(), None)
self.assertEqual(node.getState(), RUNNING_STATE)
election.handleRequestNodeIdentification(conn,
......@@ -491,7 +491,7 @@ class MasterServerElectionTests(NeoTestBase):
uuid=uuid,
address=('127.0.0.1', self.master_port),
name=self.app.name,)
self.assertEqual(len(self.app.nm.getMasterNodeList()), 1)
self.assertEqual(len(self.app.nm.getMasterList()), 1)
self.assertEqual(node.getUUID(), uuid)
self.assertEqual(node.getState(), RUNNING_STATE)
self.checkAcceptNodeIdentification(conn, answered_packet=packet)
......@@ -499,7 +499,7 @@ class MasterServerElectionTests(NeoTestBase):
conn = Mock({"_addPacket" : None, "abort" : None, "expectMessage" : None,
"isServer" : True})
new_uuid = self.getNewUUID()
self.assertEqual(len(self.app.nm.getMasterNodeList()), 1)
self.assertEqual(len(self.app.nm.getMasterList()), 1)
self.assertEqual(len(self.app.unconnected_master_node_set), 1)
self.assertEqual(len(self.app.negotiating_master_node_set), 0)
election.handleRequestNodeIdentification(conn,
......@@ -509,7 +509,7 @@ class MasterServerElectionTests(NeoTestBase):
address=('127.0.0.1',
self.master_port+1),
name=self.app.name,)
self.assertEqual(len(self.app.nm.getMasterNodeList()), 2)
self.assertEqual(len(self.app.nm.getMasterList()), 2)
self.checkAcceptNodeIdentification(conn, answered_packet=packet)
self.assertEqual(len(self.app.unconnected_master_node_set), 2)
self.assertEqual(len(self.app.negotiating_master_node_set), 0)
......@@ -541,7 +541,7 @@ class MasterServerElectionTests(NeoTestBase):
"getUUID" : None,
"isServer" : True,
"getAddress" : ("127.0.0.1", self.master_port)})
self.assertEqual(len(self.app.nm.getMasterNodeList()), 1)
self.assertEqual(len(self.app.nm.getMasterList()), 1)
self.checkIdenficationRequired(election.handleAnnouncePrimaryMaster, conn, packet)
# announce
conn = Mock({"_addPacket" : None,
......@@ -596,9 +596,9 @@ class MasterServerElectionTests(NeoTestBase):
conn = Mock({"getUUID" : uuid,
"getAddress" : ("127.0.0.1", self.master_port)})
node_list = [(STORAGE_NODE_TYPE, ('127.0.0.1', self.master_port - 1), self.getNewUUID(), DOWN_STATE),]
self.assertEqual(len(self.app.nm.getStorageNodeList()), 0)
self.assertEqual(len(self.app.nm.getStorageList()), 0)
election.handleNotifyNodeInformation(conn, packet, node_list)
self.assertEqual(len(self.app.nm.getStorageNodeList()), 0)
self.assertEqual(len(self.app.nm.getStorageList()), 0)
# tell about a client node, do nothing
conn = Mock({"getUUID" : uuid,
"getAddress" : ("127.0.0.1", self.master_port)})
......
......@@ -63,7 +63,7 @@ class MasterRecoveryTests(NeoTestBase):
self.recovery = RecoveryHandler(self.app)
self.app.unconnected_master_node_set = set()
self.app.negotiating_master_node_set = set()
for node in self.app.nm.getMasterNodeList():
for node in self.app.nm.getMasterList():
self.app.unconnected_master_node_set.add(node.getServer())
node.setState(RUNNING_STATE)
......@@ -140,9 +140,9 @@ class MasterRecoveryTests(NeoTestBase):
# tell about an unknown storage node, do nothing
conn = self.getFakeConnection(uuid, self.master_address)
node_list = [(STORAGE_NODE_TYPE, '127.0.0.1', self.master_port - 1, self.getNewUUID(), DOWN_STATE),]
self.assertEqual(len(self.app.nm.getStorageNodeList()), 0)
self.assertEqual(len(self.app.nm.getStorageList()), 0)
recovery.handleNotifyNodeInformation(conn, packet, node_list)
self.assertEqual(len(self.app.nm.getStorageNodeList()), 0)
self.assertEqual(len(self.app.nm.getStorageList()), 0)
# tell about a known node but different address
conn = self.getFakeConnection(uuid, self.master_address)
......
......@@ -122,7 +122,7 @@ class MasterStorageHandlerTests(NeoTestBase):
service.handleNotifyNodeInformation(conn, packet, node_list)
for call in conn.mockGetAllCalls():
self.assertEquals(call.getName(), "getUUID")
sn = self.app.nm.getStorageNodeList()[0]
sn = self.app.nm.getStorageList()[0]
self.assertEquals(sn.getState(), TEMPORARILY_DOWN_STATE)
self.assertEquals(ptid, self.app.pt.getID())
# notify node is broken, must be taken into account and partition must changed
......@@ -131,7 +131,7 @@ class MasterStorageHandlerTests(NeoTestBase):
service.handleNotifyNodeInformation(conn, packet, node_list)
for call in conn.mockGetAllCalls():
self.assertEquals(call.getName(), "getUUID")
sn = self.app.nm.getStorageNodeList()[0]
sn = self.app.nm.getStorageList()[0]
self.assertEquals(sn.getState(), BROKEN_STATE)
self.failUnless(ptid < self.app.pt.getID())
......@@ -313,7 +313,7 @@ class MasterStorageHandlerTests(NeoTestBase):
self.identifyToMasterNode(port = self.storage_port+2)
storage_uuid = self.identifyToMasterNode(port = self.storage_port+1)
# filled the pt
self.app.pt.make(self.app.nm.getStorageNodeList())
self.app.pt.make(self.app.nm.getStorageList())
self.assertTrue(self.app.pt.filled())
self.assertTrue(self.app.pt.operational())
conn = self.getFakeConnection(storage_uuid, ('127.0.0.1', self.storage_port+1))
......@@ -359,7 +359,7 @@ class MasterStorageHandlerTests(NeoTestBase):
self.identifyToMasterNode(port = self.storage_port+2)
storage_uuid = self.identifyToMasterNode(port = self.storage_port+1)
# filled the pt
self.app.pt.make(self.app.nm.getStorageNodeList())
self.app.pt.make(self.app.nm.getStorageList())
self.assertTrue(self.app.pt.filled())
self.assertTrue(self.app.pt.operational())
conn = self.getFakeConnection(storage_uuid, ('127.0.0.1', self.storage_port+1))
......@@ -405,7 +405,7 @@ class MasterStorageHandlerTests(NeoTestBase):
self.identifyToMasterNode(port = self.storage_port+2)
storage_uuid = self.identifyToMasterNode(port = self.storage_port+1)
# filled the pt
self.app.pt.make(self.app.nm.getStorageNodeList())
self.app.pt.make(self.app.nm.getStorageList())
self.assertTrue(self.app.pt.filled())
self.assertTrue(self.app.pt.operational())
conn = self.getFakeConnection(storage_uuid, ('127.0.0.1', self.storage_port+1))
......
......@@ -55,7 +55,7 @@ class MasterVerificationTests(NeoTestBase):
self.app.unfinished_tid_set = set()
self.app.loid = '\0' * 8
self.app.ltid = '\0' * 8
for node in self.app.nm.getMasterNodeList():
for node in self.app.nm.getMasterList():
self.app.unconnected_master_node_set.add(node.getServer())
node.setState(RUNNING_STATE)
......
......@@ -57,7 +57,7 @@ class StorageClientHandlerTests(NeoTestBase):
self.operation = ClientOperationHandler(self.app)
# set pmn
self.master_uuid = self.getNewUUID()
pmn = self.app.nm.getMasterNodeList()[0]
pmn = self.app.nm.getMasterList()[0]
pmn.setUUID(self.master_uuid)
self.app.primary_master_node = pmn
self.master_port = 10010
......
......@@ -56,7 +56,7 @@ class StorageMasterHandlerTests(NeoTestBase):
self.operation = MasterOperationHandler(self.app)
# set pmn
self.master_uuid = self.getNewUUID()
pmn = self.app.nm.getMasterNodeList()[0]
pmn = self.app.nm.getMasterList()[0]
pmn.setUUID(self.master_uuid)
self.app.primary_master_node = pmn
self.master_port = 10010
......@@ -102,10 +102,10 @@ class StorageMasterHandlerTests(NeoTestBase):
app.replicator = Mock({})
packet = Packet(msg_type=NOTIFY_PARTITION_CHANGES)
self.app.pt = Mock({'getID': 1})
count = len(self.app.nm.getNodeList())
count = len(self.app.nm.getList())
self.operation.handleNotifyPartitionChanges(conn, packet, 0, ())
self.assertEquals(self.app.pt.getID(), 1)
self.assertEquals(len(self.app.nm.getNodeList()), count)
self.assertEquals(len(self.app.nm.getList()), count)
calls = self.app.replicator.mockGetNamedCalls('removePartition')
self.assertEquals(len(calls), 0)
calls = self.app.replicator.mockGetNamedCalls('addPartition')
......@@ -135,7 +135,7 @@ class StorageMasterHandlerTests(NeoTestBase):
app.pt = PartitionTable(3, 1)
app.dm = Mock({ })
app.replicator = Mock({})
count = len(app.nm.getNodeList())
count = len(app.nm.getList())
self.operation.handleNotifyPartitionChanges(conn, packet, ptid2, cells)
# ptid set
self.assertEquals(app.pt.getID(), ptid2)
......
......@@ -54,7 +54,7 @@ class StorageStorageHandlerTests(NeoTestBase):
self.operation = StorageOperationHandler(self.app)
# set pmn
self.master_uuid = self.getNewUUID()
pmn = self.app.nm.getMasterNodeList()[0]
pmn = self.app.nm.getMasterList()[0]
pmn.setUUID(self.master_uuid)
self.app.primary_master_node = pmn
self.master_port = 10010
......
......@@ -135,19 +135,19 @@ class NodeManagerTests(NeoTestBase):
def checkNodes(self, node_list):
manager = self.manager
self.assertEqual(sorted(manager.getNodeList()), sorted(node_list))
self.assertEqual(sorted(manager.getList()), sorted(node_list))
def checkMasters(self, master_list):
manager = self.manager
self.assertEqual(manager.getMasterNodeList(), master_list)
self.assertEqual(manager.getMasterList(), master_list)
def checkStorages(self, storage_list):
manager = self.manager
self.assertEqual(manager.getStorageNodeList(), storage_list)
self.assertEqual(manager.getStorageList(), storage_list)
def checkClients(self, client_list):
manager = self.manager
self.assertEqual(manager.getClientNodeList(), client_list)
self.assertEqual(manager.getClientList(), client_list)
def checkByServer(self, node):
node_found = self.manager.getByAddress(node.getServer())
......@@ -264,9 +264,9 @@ class NodeManagerTests(NeoTestBase):
self.master.setServer(new_address)
self.checkByServer(self.master)
# a new storage replaced the old one
self.assertNotEqual(manager.getStorageNodeList(), [self.storage])
self.assertTrue(len(manager.getStorageNodeList()), 1)
new_storage = manager.getStorageNodeList()[0]
self.assertNotEqual(manager.getStorageList(), [self.storage])
self.assertTrue(len(manager.getStorageList()), 1)
new_storage = manager.getStorageList()[0]
self.assertEqual(new_storage.getState(), RUNNING_STATE)
self.assertNotEqual(new_storage, self.storage)
# admin is still here but in UNKNOWN_STATE
......
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