@Test public void testParseTargetProperties_ok() throws Exception { File dir = new File( this.folder.newFolder(), Constants.PROJECT_DIR_GRAPH + "/c" ); Utils.createDirectory( dir ); Utils.writeStringInto( "id: tid1\nhandler: in", new File( dir, "t1.properties" )); List<ModelError> errors = TargetValidator.parseTargetProperties( dir.getParentFile().getParentFile(), new Component( "c" )); Assert.assertEquals( 1, errors.size()); Assert.assertEquals( ErrorCode.REC_TARGET_NO_NAME, errors.get( 0 ).getErrorCode()); }
public static List<ModelError> parseTargetProperties( File projectDirectory, Component c ) { List<ModelError> errors; File dir = ResourceUtils.findInstanceResourcesDirectory( projectDirectory, c ); if( dir.isDirectory() && ! Utils.listAllFiles( dir, Constants.FILE_EXT_PROPERTIES ).isEmpty()) errors = parseDirectory( dir, c ); else errors = new ArrayList<>( 0 ); return errors; }
TargetValidator { public static List<ModelError> parseTargetProperties( File projectDirectory, Component c ) { List<ModelError> errors; File dir = ResourceUtils.findInstanceResourcesDirectory( projectDirectory, c ); if( dir.isDirectory() && ! Utils.listAllFiles( dir, Constants.FILE_EXT_PROPERTIES ).isEmpty()) errors = parseDirectory( dir, c ); else errors = new ArrayList<>( 0 ); return errors; } }
TargetValidator { public static List<ModelError> parseTargetProperties( File projectDirectory, Component c ) { List<ModelError> errors; File dir = ResourceUtils.findInstanceResourcesDirectory( projectDirectory, c ); if( dir.isDirectory() && ! Utils.listAllFiles( dir, Constants.FILE_EXT_PROPERTIES ).isEmpty()) errors = parseDirectory( dir, c ); else errors = new ArrayList<>( 0 ); return errors; } TargetValidator( String propertiesFileContent );  TargetValidator( File propertiesFile );  TargetValidator( File propertiesFile, Object modelObject ); }
TargetValidator { public static List<ModelError> parseTargetProperties( File projectDirectory, Component c ) { List<ModelError> errors; File dir = ResourceUtils.findInstanceResourcesDirectory( projectDirectory, c ); if( dir.isDirectory() && ! Utils.listAllFiles( dir, Constants.FILE_EXT_PROPERTIES ).isEmpty()) errors = parseDirectory( dir, c ); else errors = new ArrayList<>( 0 ); return errors; } TargetValidator( String propertiesFileContent );  TargetValidator( File propertiesFile );  TargetValidator( File propertiesFile, Object modelObject ); void validate(); List<ModelError> getErrors(); Properties getProperties(); static List<ModelError> parseDirectory( File directory ); static List<ModelError> parseDirectory( File directory, Component c ); static List<ModelError> parseTargetProperties( File projectDirectory, Component c ); }
TargetValidator { public static List<ModelError> parseTargetProperties( File projectDirectory, Component c ) { List<ModelError> errors; File dir = ResourceUtils.findInstanceResourcesDirectory( projectDirectory, c ); if( dir.isDirectory() && ! Utils.listAllFiles( dir, Constants.FILE_EXT_PROPERTIES ).isEmpty()) errors = parseDirectory( dir, c ); else errors = new ArrayList<>( 0 ); return errors; } TargetValidator( String propertiesFileContent );  TargetValidator( File propertiesFile );  TargetValidator( File propertiesFile, Object modelObject ); void validate(); List<ModelError> getErrors(); Properties getProperties(); static List<ModelError> parseDirectory( File directory ); static List<ModelError> parseDirectory( File directory, Component c ); static List<ModelError> parseTargetProperties( File projectDirectory, Component c );  }