@Test public void testScriptValidation_noScriptsDirectory() throws Exception { File appDir = this.folder.newFolder(); Component comp = new Component( "toto" ).installerName( "script" ); File directory = ResourceUtils.findInstanceResourcesDirectory( appDir, comp ); Assert.assertTrue( directory.mkdirs()); Utils.writeStringInto( "", new File( directory, "test.sh" )); List<ModelError> errors = RecipesValidator.validateComponentRecipes( appDir, comp ); Assert.assertEquals( 1, errors.size()); Assert.assertEquals( ErrorCode.REC_SCRIPT_NO_SCRIPTS_DIR, errors.get( 0 ).getErrorCode()); }
public static List<ModelError> validateComponentRecipes( File applicationFilesDirectory, Component component ) { List<ModelError> result; if( "puppet".equalsIgnoreCase( component.getInstallerName())) result = validatePuppetComponent( applicationFilesDirectory, component ); else if( "script".equalsIgnoreCase( component.getInstallerName())) result = validateScriptComponent( applicationFilesDirectory, component ); else result = Collections.emptyList(); return result; }
RecipesValidator { public static List<ModelError> validateComponentRecipes( File applicationFilesDirectory, Component component ) { List<ModelError> result; if( "puppet".equalsIgnoreCase( component.getInstallerName())) result = validatePuppetComponent( applicationFilesDirectory, component ); else if( "script".equalsIgnoreCase( component.getInstallerName())) result = validateScriptComponent( applicationFilesDirectory, component ); else result = Collections.emptyList(); return result; } }
RecipesValidator { public static List<ModelError> validateComponentRecipes( File applicationFilesDirectory, Component component ) { List<ModelError> result; if( "puppet".equalsIgnoreCase( component.getInstallerName())) result = validatePuppetComponent( applicationFilesDirectory, component ); else if( "script".equalsIgnoreCase( component.getInstallerName())) result = validateScriptComponent( applicationFilesDirectory, component ); else result = Collections.emptyList(); return result; } private  RecipesValidator(); }
RecipesValidator { public static List<ModelError> validateComponentRecipes( File applicationFilesDirectory, Component component ) { List<ModelError> result; if( "puppet".equalsIgnoreCase( component.getInstallerName())) result = validatePuppetComponent( applicationFilesDirectory, component ); else if( "script".equalsIgnoreCase( component.getInstallerName())) result = validateScriptComponent( applicationFilesDirectory, component ); else result = Collections.emptyList(); return result; } private  RecipesValidator(); static List<ModelError> validateComponentRecipes( File applicationFilesDirectory, Component component ); }
RecipesValidator { public static List<ModelError> validateComponentRecipes( File applicationFilesDirectory, Component component ) { List<ModelError> result; if( "puppet".equalsIgnoreCase( component.getInstallerName())) result = validatePuppetComponent( applicationFilesDirectory, component ); else if( "script".equalsIgnoreCase( component.getInstallerName())) result = validateScriptComponent( applicationFilesDirectory, component ); else result = Collections.emptyList(); return result; } private  RecipesValidator(); static List<ModelError> validateComponentRecipes( File applicationFilesDirectory, Component component ); static final String SCRIPTS_DIR_NAME; }