@Test public void validateProject_withMavenVersion_butNotMavenProject() throws Exception { File dir = this.folder.newFolder(); CreationBean bean = new CreationBean() .projectDescription( "some desc" ).projectName( "my-project" ) .groupId( "net.roboconf" ).projectVersion( "${project.version}" ).mavenProject( false ); ProjectUtils.createProjectSkeleton( dir, bean ); List<RoboconfError> errors = ProjectValidator.validateProject( dir ).getErrors(); Assert.assertEquals( 3, errors.size()); Assert.assertEquals( ErrorCode.RM_INVALID_APPLICATION_VERSION, errors.get( 0 ).getErrorCode()); Assert.assertEquals( ErrorCode.PROJ_NO_RESOURCE_DIRECTORY, errors.get( 1 ).getErrorCode()); Assert.assertEquals( ErrorCode.PROJ_NO_RESOURCE_DIRECTORY, errors.get( 2 ).getErrorCode()); }
public static ProjectValidationResult validateProject( File appDirectory ) { File instancesDir = new File( appDirectory, Constants.PROJECT_DIR_INSTANCES ); boolean isRecipe = ! new File( appDirectory, Constants.PROJECT_DIR_DESC + "/" + Constants.PROJECT_FILE_DESCRIPTOR ).exists() && (! instancesDir.isDirectory() || Utils.listAllFiles( instancesDir ).isEmpty()); return validateProject( appDirectory, isRecipe ); }
ProjectValidator { public static ProjectValidationResult validateProject( File appDirectory ) { File instancesDir = new File( appDirectory, Constants.PROJECT_DIR_INSTANCES ); boolean isRecipe = ! new File( appDirectory, Constants.PROJECT_DIR_DESC + "/" + Constants.PROJECT_FILE_DESCRIPTOR ).exists() && (! instancesDir.isDirectory() || Utils.listAllFiles( instancesDir ).isEmpty()); return validateProject( appDirectory, isRecipe ); } }
ProjectValidator { public static ProjectValidationResult validateProject( File appDirectory ) { File instancesDir = new File( appDirectory, Constants.PROJECT_DIR_INSTANCES ); boolean isRecipe = ! new File( appDirectory, Constants.PROJECT_DIR_DESC + "/" + Constants.PROJECT_FILE_DESCRIPTOR ).exists() && (! instancesDir.isDirectory() || Utils.listAllFiles( instancesDir ).isEmpty()); return validateProject( appDirectory, isRecipe ); } private  ProjectValidator(); }
ProjectValidator { public static ProjectValidationResult validateProject( File appDirectory ) { File instancesDir = new File( appDirectory, Constants.PROJECT_DIR_INSTANCES ); boolean isRecipe = ! new File( appDirectory, Constants.PROJECT_DIR_DESC + "/" + Constants.PROJECT_FILE_DESCRIPTOR ).exists() && (! instancesDir.isDirectory() || Utils.listAllFiles( instancesDir ).isEmpty()); return validateProject( appDirectory, isRecipe ); } private  ProjectValidator(); static ProjectValidationResult validateProject( File appDirectory ); static ProjectValidationResult validateProject( File appDirectory, boolean isRecipe ); }
ProjectValidator { public static ProjectValidationResult validateProject( File appDirectory ) { File instancesDir = new File( appDirectory, Constants.PROJECT_DIR_INSTANCES ); boolean isRecipe = ! new File( appDirectory, Constants.PROJECT_DIR_DESC + "/" + Constants.PROJECT_FILE_DESCRIPTOR ).exists() && (! instancesDir.isDirectory() || Utils.listAllFiles( instancesDir ).isEmpty()); return validateProject( appDirectory, isRecipe ); } private  ProjectValidator(); static ProjectValidationResult validateProject( File appDirectory ); static ProjectValidationResult validateProject( File appDirectory, boolean isRecipe );  }