Identity id = new IdentityImpl("first");
nodeMappingService.assignNode(NodeMappingService.class, id);
GetNodeTask task = new GetNodeTask(id);
txnScheduler.runTask(task, taskOwner);
Node firstNode = task.getNode();
long firstNodeId = task.getNodeId();
TestListener firstNodeListener = nodeListenerMap.get(firstNodeId);
TestRelocationListener idListener = moveMap.get(firstNodeId);
firstNodeListener.waitForNotification();
NodeMappingServerImpl server =
(NodeMappingServerImpl)serverImplField.get(nodeMappingService);
// clear out the listeners
for (TestListener lis : nodeListenerMap.values()) {
lis.clear();
}
for (TestRelocationListener lis : moveMap.values()) {
lis.clear();
}
// ... and invoke the method
moveMethod.invoke(server, id, null, firstNode, firstNodeId);
// Give the id relocation listener a chance to finish, and the
// actual node assignment to complete.
idListener.waitForNotification();
txnScheduler.runTask(task, taskOwner);
Node secondNode = task.getNode();
long secondNodeId = task.getNodeId();
TestListener secondNodeListener =
nodeListenerMap.get(secondNodeId);
secondNodeListener.waitForNotification();