This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects
Commit e8dd9625 authored by Michael Breu's avatar Michael Breu :speech_balloon:
Browse files

Fixing Tests

parent 5f268794
Branches
2 merge requests!188Merging Peer Reviewing et. al to Master,!164211 peer reviewing functionality
...@@ -391,13 +391,33 @@ public class ElasticSearchTestServerConfiguration { ...@@ -391,13 +391,33 @@ public class ElasticSearchTestServerConfiguration {
} }
} }
/**
* parse the mete data file and return a normalized meta data
* @param metaDataFile the meta data file
* @return parsed metadata
* @throws JsonParseException
* @throws JsonMappingException
* @throws IOException
*/
private UserProvidedMetadataDTO parseMetaDataFile(File metaDataFile) private UserProvidedMetadataDTO parseMetaDataFile(File metaDataFile)
throws JsonParseException, JsonMappingException, IOException { throws JsonParseException, JsonMappingException, IOException {
ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
mapper.findAndRegisterModules(); mapper.findAndRegisterModules();
UserProvidedMetadataDTO result = mapper.readValue(metaDataFile, UserProvidedMetadataDTO.class); UserProvidedMetadataDTO result = mapper.readValue(metaDataFile, UserProvidedMetadataDTO.class);
makeUpperCase(result.getProgrammingLanguage());
return result; return result;
} }
/**
* make all strings in Array uppercase.
* @param strings
*/
private void makeUpperCase(String[] strings) {
if(strings==null) return;
for(int i=0; i<strings.length; i++) {
strings[i] = strings[i].toUpperCase();
}
}
private ExtendedGitProject parseProjectFile(File projectFile) private ExtendedGitProject parseProjectFile(File projectFile)
throws JsonParseException, JsonMappingException, IOException { throws JsonParseException, JsonMappingException, IOException {
...@@ -407,12 +427,26 @@ public class ElasticSearchTestServerConfiguration { ...@@ -407,12 +427,26 @@ public class ElasticSearchTestServerConfiguration {
return result; return result;
} }
/**
* an interface that is invoked on each node of the tree with a metadata
* @author Michael Breu
*
* @param <T> the harvested data type
*/
private interface Harvester<T> { private interface Harvester<T> {
/**
*
* @param f the metaData File
* @param subResults the list of results of the next node level
* @param relativePath the relative path from test root
* @param gitProject the information about the git project.
* @return
*/
List<T> harvest(File f, List<T> subResults, String relativePath, ExtendedGitProject gitProject); List<T> harvest(File f, List<T> subResults, String relativePath, ExtendedGitProject gitProject);
} }
/** /**
* recursively visits all nodes, collects all children metadta and then calls * recursively visits all nodes, collects all children metadata and then calls
* the harvester * the harvester
* *
* @param <T> the type the harvester returns * @param <T> the type the harvester returns
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment