@Test public void testFindStorageIds() { Map<String,String> targetProperties = new HashMap<>(); targetProperties.put( USE_BLOCK_STORAGE, "" ); Assert.assertEquals( Arrays.asList(), findStorageIds( targetProperties )); targetProperties.put( USE_BLOCK_STORAGE, "a" ); Assert.assertEquals( Arrays.asList( "a" ), findStorageIds( targetProperties )); targetProperties.put( USE_BLOCK_STORAGE, "a,b" ); Assert.assertEquals( Arrays.asList( "a", "b" ), findStorageIds( targetProperties )); targetProperties.put( USE_BLOCK_STORAGE, "a,, b , c " ); Assert.assertEquals( Arrays.asList( "a", "b", "c" ), findStorageIds( targetProperties )); }
static List<String> findStorageIds( Map<String,String> targetProperties ) { List<String> result = new ArrayList<> (); String prop = targetProperties.get( USE_BLOCK_STORAGE ); if( ! Utils.isEmptyOrWhitespaces( prop )) { for( String s : Utils.splitNicely( prop, "," )) { if( ! Utils.isEmptyOrWhitespaces( s )) result.add( s ); } } return result; }
Ec2IaasHandler extends AbstractThreadedTargetHandler { static List<String> findStorageIds( Map<String,String> targetProperties ) { List<String> result = new ArrayList<> (); String prop = targetProperties.get( USE_BLOCK_STORAGE ); if( ! Utils.isEmptyOrWhitespaces( prop )) { for( String s : Utils.splitNicely( prop, "," )) { if( ! Utils.isEmptyOrWhitespaces( s )) result.add( s ); } } return result; } }
Ec2IaasHandler extends AbstractThreadedTargetHandler { static List<String> findStorageIds( Map<String,String> targetProperties ) { List<String> result = new ArrayList<> (); String prop = targetProperties.get( USE_BLOCK_STORAGE ); if( ! Utils.isEmptyOrWhitespaces( prop )) { for( String s : Utils.splitNicely( prop, "," )) { if( ! Utils.isEmptyOrWhitespaces( s )) result.add( s ); } } return result; }  }
Ec2IaasHandler extends AbstractThreadedTargetHandler { static List<String> findStorageIds( Map<String,String> targetProperties ) { List<String> result = new ArrayList<> (); String prop = targetProperties.get( USE_BLOCK_STORAGE ); if( ! Utils.isEmptyOrWhitespaces( prop )) { for( String s : Utils.splitNicely( prop, "," )) { if( ! Utils.isEmptyOrWhitespaces( s )) result.add( s ); } } return result; }  @Override String getTargetId(); @Override String createMachine( TargetHandlerParameters parameters ); @Override MachineConfigurator machineConfigurator( TargetHandlerParameters parameters, String machineId ); @Override boolean isMachineRunning( TargetHandlerParameters parameters, String machineId ); @Override void terminateMachine( TargetHandlerParameters parameters, String machineId ); @Override String retrievePublicIpAddress( TargetHandlerParameters parameters, String machineId ); static AmazonEC2 createEc2Client( Map<String,String> targetProperties ); }
Ec2IaasHandler extends AbstractThreadedTargetHandler { static List<String> findStorageIds( Map<String,String> targetProperties ) { List<String> result = new ArrayList<> (); String prop = targetProperties.get( USE_BLOCK_STORAGE ); if( ! Utils.isEmptyOrWhitespaces( prop )) { for( String s : Utils.splitNicely( prop, "," )) { if( ! Utils.isEmptyOrWhitespaces( s )) result.add( s ); } } return result; }  @Override String getTargetId(); @Override String createMachine( TargetHandlerParameters parameters ); @Override MachineConfigurator machineConfigurator( TargetHandlerParameters parameters, String machineId ); @Override boolean isMachineRunning( TargetHandlerParameters parameters, String machineId ); @Override void terminateMachine( TargetHandlerParameters parameters, String machineId ); @Override String retrievePublicIpAddress( TargetHandlerParameters parameters, String machineId ); static AmazonEC2 createEc2Client( Map<String,String> targetProperties ); static final String TARGET_ID; }