control.verify();
}
public void testDeadBeackup() throws Exception
{
NodeSpiMock root = new NodeSpiMock(Fqn.ROOT);
//add first dead child
IpAddress firstAddress = new IpAddress("127.0.0.1", 1234);
NodeSpiMock firstDeadNode = (NodeSpiMock) root.addChildDirect(fqnTransformer.getDeadBackupRoot(firstAddress));
firstDeadNode.addChildDirect(Fqn.fromElements(0));
firstDeadNode.addChildDirect(Fqn.fromElements(1));
firstDeadNode.addChildDirect(Fqn.fromElements(2));
//add second dead child
IpAddress secondAddress = new IpAddress("127.0.0.1", 4321);
NodeSpiMock secondDeadNode = (NodeSpiMock) root.addChildDirect(fqnTransformer.getDeadBackupRoot(secondAddress));
secondDeadNode.addChildDirect(Fqn.fromElements(0));
expect(spiMock.getNode(fqn)).andReturn(null);
NodeSPI buddyBackupRoot = (NodeSPI) root.getChild(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN);
expect(containerMock.peek(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN)).andReturn(buddyBackupRoot);
control.checkOrder(false);
expect(spiMock.getChildrenNames(firstDeadNode.getFqn())).andReturn(firstDeadNode.getChildrenNames());
Object fqnElement = fqn.getLastElement();//this is only composed from one element
expect(spiMock.peek(Fqn.fromRelativeElements(firstDeadNode.getFqn(), 0, fqnElement), false)).andReturn(null);
expect(spiMock.peek(Fqn.fromRelativeElements(firstDeadNode.getFqn(), 1, fqnElement), false)).andReturn(null);
expect(spiMock.peek(Fqn.fromRelativeElements(firstDeadNode.getFqn(), 2, fqnElement), false)).andReturn(null);
expect(spiMock.getChildrenNames(secondDeadNode.getFqn())).andReturn(secondDeadNode.getChildrenNames());
expect(spiMock.peek(Fqn.fromRelativeElements(secondDeadNode.getFqn(), 0, fqnElement), false)).andReturn(null);
control.checkOrder(true);
control.replay();
assert GravitateResult.noDataFound().equals(command.perform(ctx));
control.verify();