@Test( expected = TargetException.class ) public void testInvalidConfiguration() throws Exception { AzureIaasHandler.buildProperties( new HashMap<String,String> ()); }
static AzureProperties buildProperties( Map<String,String> targetProperties ) throws TargetException { String[] properties = { AzureConstants.AZURE_SUBSCRIPTION_ID, AzureConstants.AZURE_KEY_STORE_FILE, AzureConstants.AZURE_KEY_STORE_PASSWORD, AzureConstants.AZURE_CREATE_CLOUD_SERVICE_TEMPLATE, AzureConstants.AZURE_CREATE_DEPLOYMENT_TEMPLATE, AzureConstants.AZURE_LOCATION, AzureConstants.AZURE_VM_SIZE, AzureConstants.AZURE_VM_TEMPLATE }; for( String property : properties ) { if( Utils.isEmptyOrWhitespaces( targetProperties.get( property ))) throw new TargetException( "The value for " + property + " cannot be null or empty." ); } AzureProperties azureProperties = new AzureProperties(); String s = targetProperties.get( AzureConstants.AZURE_SUBSCRIPTION_ID ); azureProperties.setSubscriptionId( s.trim()); s = targetProperties.get( AzureConstants.AZURE_KEY_STORE_FILE ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_KEY_STORE_PASSWORD ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_CREATE_CLOUD_SERVICE_TEMPLATE ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_CREATE_DEPLOYMENT_TEMPLATE ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_LOCATION ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_VM_SIZE ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_VM_TEMPLATE ); azureProperties.setKeyStoreFile( s.trim()); return azureProperties; }
AzureIaasHandler implements TargetHandler { static AzureProperties buildProperties( Map<String,String> targetProperties ) throws TargetException { String[] properties = { AzureConstants.AZURE_SUBSCRIPTION_ID, AzureConstants.AZURE_KEY_STORE_FILE, AzureConstants.AZURE_KEY_STORE_PASSWORD, AzureConstants.AZURE_CREATE_CLOUD_SERVICE_TEMPLATE, AzureConstants.AZURE_CREATE_DEPLOYMENT_TEMPLATE, AzureConstants.AZURE_LOCATION, AzureConstants.AZURE_VM_SIZE, AzureConstants.AZURE_VM_TEMPLATE }; for( String property : properties ) { if( Utils.isEmptyOrWhitespaces( targetProperties.get( property ))) throw new TargetException( "The value for " + property + " cannot be null or empty." ); } AzureProperties azureProperties = new AzureProperties(); String s = targetProperties.get( AzureConstants.AZURE_SUBSCRIPTION_ID ); azureProperties.setSubscriptionId( s.trim()); s = targetProperties.get( AzureConstants.AZURE_KEY_STORE_FILE ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_KEY_STORE_PASSWORD ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_CREATE_CLOUD_SERVICE_TEMPLATE ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_CREATE_DEPLOYMENT_TEMPLATE ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_LOCATION ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_VM_SIZE ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_VM_TEMPLATE ); azureProperties.setKeyStoreFile( s.trim()); return azureProperties; } }
AzureIaasHandler implements TargetHandler { static AzureProperties buildProperties( Map<String,String> targetProperties ) throws TargetException { String[] properties = { AzureConstants.AZURE_SUBSCRIPTION_ID, AzureConstants.AZURE_KEY_STORE_FILE, AzureConstants.AZURE_KEY_STORE_PASSWORD, AzureConstants.AZURE_CREATE_CLOUD_SERVICE_TEMPLATE, AzureConstants.AZURE_CREATE_DEPLOYMENT_TEMPLATE, AzureConstants.AZURE_LOCATION, AzureConstants.AZURE_VM_SIZE, AzureConstants.AZURE_VM_TEMPLATE }; for( String property : properties ) { if( Utils.isEmptyOrWhitespaces( targetProperties.get( property ))) throw new TargetException( "The value for " + property + " cannot be null or empty." ); } AzureProperties azureProperties = new AzureProperties(); String s = targetProperties.get( AzureConstants.AZURE_SUBSCRIPTION_ID ); azureProperties.setSubscriptionId( s.trim()); s = targetProperties.get( AzureConstants.AZURE_KEY_STORE_FILE ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_KEY_STORE_PASSWORD ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_CREATE_CLOUD_SERVICE_TEMPLATE ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_CREATE_DEPLOYMENT_TEMPLATE ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_LOCATION ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_VM_SIZE ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_VM_TEMPLATE ); azureProperties.setKeyStoreFile( s.trim()); return azureProperties; }  }
AzureIaasHandler implements TargetHandler { static AzureProperties buildProperties( Map<String,String> targetProperties ) throws TargetException { String[] properties = { AzureConstants.AZURE_SUBSCRIPTION_ID, AzureConstants.AZURE_KEY_STORE_FILE, AzureConstants.AZURE_KEY_STORE_PASSWORD, AzureConstants.AZURE_CREATE_CLOUD_SERVICE_TEMPLATE, AzureConstants.AZURE_CREATE_DEPLOYMENT_TEMPLATE, AzureConstants.AZURE_LOCATION, AzureConstants.AZURE_VM_SIZE, AzureConstants.AZURE_VM_TEMPLATE }; for( String property : properties ) { if( Utils.isEmptyOrWhitespaces( targetProperties.get( property ))) throw new TargetException( "The value for " + property + " cannot be null or empty." ); } AzureProperties azureProperties = new AzureProperties(); String s = targetProperties.get( AzureConstants.AZURE_SUBSCRIPTION_ID ); azureProperties.setSubscriptionId( s.trim()); s = targetProperties.get( AzureConstants.AZURE_KEY_STORE_FILE ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_KEY_STORE_PASSWORD ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_CREATE_CLOUD_SERVICE_TEMPLATE ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_CREATE_DEPLOYMENT_TEMPLATE ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_LOCATION ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_VM_SIZE ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_VM_TEMPLATE ); azureProperties.setKeyStoreFile( s.trim()); return azureProperties; }  @Override String getTargetId(); @Override String createMachine( TargetHandlerParameters parameters ); @Override void configureMachine( TargetHandlerParameters parameters, String machineId ); @Override boolean isMachineRunning( TargetHandlerParameters parameters, String machineId ); @Override void terminateMachine( TargetHandlerParameters parameters, String instanceId ); @Override String retrievePublicIpAddress( TargetHandlerParameters parameters, String machineId ); }
AzureIaasHandler implements TargetHandler { static AzureProperties buildProperties( Map<String,String> targetProperties ) throws TargetException { String[] properties = { AzureConstants.AZURE_SUBSCRIPTION_ID, AzureConstants.AZURE_KEY_STORE_FILE, AzureConstants.AZURE_KEY_STORE_PASSWORD, AzureConstants.AZURE_CREATE_CLOUD_SERVICE_TEMPLATE, AzureConstants.AZURE_CREATE_DEPLOYMENT_TEMPLATE, AzureConstants.AZURE_LOCATION, AzureConstants.AZURE_VM_SIZE, AzureConstants.AZURE_VM_TEMPLATE }; for( String property : properties ) { if( Utils.isEmptyOrWhitespaces( targetProperties.get( property ))) throw new TargetException( "The value for " + property + " cannot be null or empty." ); } AzureProperties azureProperties = new AzureProperties(); String s = targetProperties.get( AzureConstants.AZURE_SUBSCRIPTION_ID ); azureProperties.setSubscriptionId( s.trim()); s = targetProperties.get( AzureConstants.AZURE_KEY_STORE_FILE ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_KEY_STORE_PASSWORD ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_CREATE_CLOUD_SERVICE_TEMPLATE ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_CREATE_DEPLOYMENT_TEMPLATE ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_LOCATION ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_VM_SIZE ); azureProperties.setKeyStoreFile( s.trim()); s = targetProperties.get( AzureConstants.AZURE_VM_TEMPLATE ); azureProperties.setKeyStoreFile( s.trim()); return azureProperties; }  @Override String getTargetId(); @Override String createMachine( TargetHandlerParameters parameters ); @Override void configureMachine( TargetHandlerParameters parameters, String machineId ); @Override boolean isMachineRunning( TargetHandlerParameters parameters, String machineId ); @Override void terminateMachine( TargetHandlerParameters parameters, String instanceId ); @Override String retrievePublicIpAddress( TargetHandlerParameters parameters, String machineId ); static final String TARGET_ID; }