Source:
public void testRemoveInstance() throws InterruptedException { AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); Assert.assertNull( processor.scopedInstance ); processor.processMessage( new MsgCmdRemoveInstance( app.getMySqlVm())); Assert.assertNull( processor.scopedInstance ); processor.scopedInstance = app.getMySqlVm(); processor.processMessage( new MsgCmdRemoveInstance( app.getMySqlVm())); Assert.assertEquals( app.getMySqlVm(), processor.scopedInstance ); Assert.assertEquals( 2, InstanceHelpers.buildHierarchicalList( app.getMySqlVm()).size()); processor.processMessage( new MsgCmdRemoveInstance( app.getTomcat())); processor.processMessage( new MsgCmdRemoveInstance( app.getTomcatVm())); Assert.assertEquals( 2, InstanceHelpers.buildHierarchicalList( app.getMySqlVm()).size()); app.getMySql().setStatus( InstanceStatus.DEPLOYED_STARTED ); processor.processMessage( new MsgCmdRemoveInstance( app.getMySql())); Assert.assertEquals( 2, InstanceHelpers.buildHierarchicalList( app.getMySqlVm()).size()); app.getMySql().setStatus( InstanceStatus.NOT_DEPLOYED ); processor.processMessage( new MsgCmdRemoveInstance( app.getMySql())); Assert.assertEquals( 1, InstanceHelpers.buildHierarchicalList( app.getMySqlVm()).size()); Assert.assertEquals( 1, this.client.messagesForTheDm.size()); Assert.assertEquals( MsgNotifInstanceRemoved.class, this.client.messagesForTheDm.get( 0 ).getClass()); Assert.assertEquals( InstanceHelpers.computeInstancePath( app.getMySql()), ((MsgNotifInstanceRemoved) this.client.messagesForTheDm.get( 0 )).getInstancePath()); }

Target:
public void testRemoveInstance() { AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); Assert.assertNull( processor.scopedInstance ); processor.processMessage( new MsgCmdRemoveInstance( app.getMySqlVm())); Assert.assertNull( processor.scopedInstance ); processor.scopedInstance = app.getMySqlVm(); processor.processMessage( new MsgCmdRemoveInstance( app.getMySqlVm())); Assert.assertEquals( app.getMySqlVm(), processor.scopedInstance ); Assert.assertEquals( 2, InstanceHelpers.buildHierarchicalList( app.getMySqlVm()).size()); processor.processMessage( new MsgCmdRemoveInstance( app.getTomcat())); processor.processMessage( new MsgCmdRemoveInstance( app.getTomcatVm())); Assert.assertEquals( 2, InstanceHelpers.buildHierarchicalList( app.getMySqlVm()).size()); app.getMySql().setStatus( InstanceStatus.DEPLOYED_STARTED ); processor.processMessage( new MsgCmdRemoveInstance( app.getMySql())); Assert.assertEquals( 2, InstanceHelpers.buildHierarchicalList( app.getMySqlVm()).size()); app.getMySql().setStatus( InstanceStatus.NOT_DEPLOYED ); processor.processMessage( new MsgCmdRemoveInstance( app.getMySql())); Assert.assertEquals( 1, InstanceHelpers.buildHierarchicalList( app.getMySqlVm()).size()); Assert.assertEquals( 1, this.client.messagesForTheDm.size()); Assert.assertEquals( MsgNotifInstanceRemoved.class, this.client.messagesForTheDm.get( 0 ).getClass()); Assert.assertEquals( InstanceHelpers.computeInstancePath( app.getMySql()), ((MsgNotifInstanceRemoved) this.client.messagesForTheDm.get( 0 )).getInstancePath()); }