TargetConfiguratorImpl implements ITargetConfigurator { @Override public void cancelCandidate( TargetHandlerParameters parameters, Instance scopedInstance ) { String key = parameters.getApplicationName() + "_" + parameters.getScopedInstancePath(); this.candidates.remove( key ); }  @Override void start(); @Override void stop(); void setTargetHandlerResolver( ITargetHandlerResolver targetHandlerResolver ); @Override void reportCandidate( TargetHandlerParameters parameters, Instance scopedInstance ); @Override void cancelCandidate( TargetHandlerParameters parameters, Instance scopedInstance ); @Override void verifyCandidates();  }
@Test public void testCancelCandidate() throws Exception { TestApplication app = new TestApplication(); app.setName( "app" ); TargetHandlerParameters parameters1 = new TargetHandlerParameters() .applicationName( app.getName()) .scopedInstancePath( InstanceHelpers.computeInstancePath( app.getMySqlVm())) .domain( "domain" ); TargetHandlerParameters parameters2 = new TargetHandlerParameters() .applicationName( app.getName()) .scopedInstancePath( InstanceHelpers.computeInstancePath( app.getTomcatVm())) .domain( "domain" ); this.targetConfigurator.reportCandidate( parameters1, app.getMySqlVm()); Assert.assertEquals( 1, this.targetConfigurator.candidates.size()); this.targetConfigurator.reportCandidate( parameters2, app.getTomcatVm()); Assert.assertEquals( 2, this.targetConfigurator.candidates.size()); this.targetConfigurator.cancelCandidate( parameters1, app.getMySqlVm()); Assert.assertEquals( 1, this.targetConfigurator.candidates.size()); this.targetConfigurator.cancelCandidate( parameters2, app.getTomcatVm()); Assert.assertEquals( 0, this.targetConfigurator.candidates.size()); this.targetConfigurator.cancelCandidate( parameters2, app.getTomcat()); Assert.assertEquals( 0, this.targetConfigurator.candidates.size()); }