Skip to content

Commit

Permalink
JBPM-5237 - parsing workitems without dependencies defined in wid sho…
Browse files Browse the repository at this point in the history
…uld not fail (#528)
  • Loading branch information
Tihomir Surdilovic authored and mswiderski committed Aug 7, 2016
1 parent 22a0182 commit 594980f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
Expand Up @@ -64,9 +64,12 @@ public static Map<String, WorkDefinitionImpl> getWorkDefinitions(String path, St
}
}
workDefinition.setResults(results);

workDefinition.setDefaultHandler((String) workDefinitionMap.get("defaultHandler"));

workDefinition.setDependencies(((List<String>) workDefinitionMap.get("dependencies")).toArray(new String[0]));
if(workDefinitionMap.get("dependencies") != null) {
workDefinition.setDependencies(((List<String>) workDefinitionMap.get("dependencies")).toArray(new String[0]));
}

if(workDefinitionMap.get("mavenDependencies") != null) {
workDefinition.setMavenDependencies(((List<String>) workDefinitionMap.get("mavenDependencies")).toArray(new String[0]));
Expand Down
Expand Up @@ -30,7 +30,7 @@ public void testServices() throws Exception {
Map<String, WorkDefinitionImpl> repoResults = WorkItemRepository.getWorkDefinitions(getClass().getResource("repository").toURI().toString());
assertNotNull(repoResults);
assertFalse(repoResults.isEmpty());
assertEquals(repoResults.size(), 5);
assertEquals(repoResults.size(), 6);

WorkDefinitionImpl testServiceOne = repoResults.get("TestServiceOne");
assertNotNull(testServiceOne);
Expand Down Expand Up @@ -86,6 +86,14 @@ public void testServices() throws Exception {
assertEquals(3, testServiceFour2.getDependencies().length);
assertEquals(2, testServiceFour2.getMavenDependencies().length);
assertEquals("json", testServiceFour2.getWidType());

// workitem with no dependency defined
WorkDefinitionImpl testServiceFive = repoResults.get("TestServiceFive");
assertNotNull(testServiceFive);
assertEquals("TestServiceFive", testServiceFive.getName());
assertEquals("TestServiceFive", testServiceFive.getDisplayName());
assertNull(testServiceFive.getDependencies());

}

}
Expand Up @@ -29,7 +29,7 @@ public void testGetWorkDefinitions() throws Exception {
Map<String, WorkDefinitionImpl> repoResults = WorkItemRepository.getWorkDefinitions(getClass().getResource("repository").toURI().toString());
assertNotNull(repoResults);
assertFalse(repoResults.isEmpty());
assertEquals(repoResults.size(), 5);
assertEquals(repoResults.size(), 6);
}

@Test
Expand Down
@@ -0,0 +1,9 @@
[
[
"java.util.HashMap",
{
"displayName":"TestServiceFive",
"name":"TestServiceFive"
}
]
]
Expand Up @@ -2,3 +2,4 @@ TestServiceOne
TestServiceTwo
TestServiceThree
TestServiceFour
TestServiceFive

0 comments on commit 594980f

Please sign in to comment.