OpenstackIaasHandler extends AbstractThreadedTargetHandler { static String identity( Map<String,String> targetProperties ) { return targetProperties.get( TENANT_NAME ) + ":" + targetProperties.get( USER ); }  @Override String getTargetId(); @Override String createMachine( TargetHandlerParameters parameters ); @Override boolean isMachineRunning( TargetHandlerParameters parameters, String machineId ); @Override MachineConfigurator machineConfigurator( TargetHandlerParameters parameters, String machineId ); @Override void terminateMachine( TargetHandlerParameters parameters, String machineId ); @Override String retrievePublicIpAddress( TargetHandlerParameters parameters, String machineId ); static final String TARGET_ID; }
@Test public void testIdentity() { Map<String,String> targetProperties = new HashMap<>(); targetProperties.put( TENANT_NAME, "tenant" ); targetProperties.put( USER, "me" ); Assert.assertEquals( "tenant:me", identity( targetProperties )); targetProperties.remove( USER ); Assert.assertEquals( "tenant:null", identity( targetProperties )); targetProperties.remove( TENANT_NAME ); Assert.assertEquals( "null:null", identity( targetProperties )); targetProperties.put( USER, "me" ); Assert.assertEquals( "null:me", identity( targetProperties )); }