Browse Source

merge from 1.3.3-release

pull/3/MERGE
baoliang 4 years ago
parent
commit
e053858e92
  1. 3
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
  2. 10
      dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java

3
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java

@ -243,6 +243,9 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
for (TaskNode taskNode : tasks) { for (TaskNode taskNode : tasks) {
String taskParameter = taskNode.getParams(); String taskParameter = taskNode.getParams();
AbstractParameters params = TaskParametersUtils.getParameters(taskNode.getType(), taskParameter); AbstractParameters params = TaskParametersUtils.getParameters(taskNode.getType(), taskParameter);
if (params == null) {
continue;
}
if (CollectionUtils.isNotEmpty(params.getResourceFilesList())) { if (CollectionUtils.isNotEmpty(params.getResourceFilesList())) {
Set<Integer> tempSet = params.getResourceFilesList(). Set<Integer> tempSet = params.getResourceFilesList().
stream() stream()

10
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java

@ -1035,15 +1035,15 @@ public class ProcessDefinitionServiceTest {
taskNode5.setType("SHELL"); taskNode5.setType("SHELL");
ShellParameters shellParameters5 = new ShellParameters(); ShellParameters shellParameters5 = new ShellParameters();
ResourceInfo resourceInfo5A = new ResourceInfo(); ResourceInfo resourceInfo5A = new ResourceInfo();
resourceInfo5A.setId(0); resourceInfo5A.setId(1);
ResourceInfo resourceInfo5B = new ResourceInfo(); ResourceInfo resourceInfo5B = new ResourceInfo();
resourceInfo5B.setId(1); resourceInfo5B.setId(2);
shellParameters5.setResourceList(Arrays.asList(resourceInfo5A, resourceInfo5B)); shellParameters5.setResourceList(Arrays.asList(resourceInfo5A, resourceInfo5B));
taskNode5.setParams(JSONUtils.toJsonString(shellParameters5)); taskNode5.setParams(JSONUtils.toJsonString(shellParameters5));
input5.setTasks(Collections.singletonList(taskNode5)); input5.setTasks(Collections.singletonList(taskNode5));
String output5 = (String) testMethod.invoke(processDefinitionService, input5); String output5 = (String) testMethod.invoke(processDefinitionService, input5);
assertThat(output5.split(",")).hasSize(2) assertThat(output5.split(",")).hasSize(2)
.containsExactlyInAnyOrder("0", "1"); .containsExactlyInAnyOrder("1", "2");
// when resource id list is 0 1 1 2, then return 0,1,2 // when resource id list is 0 1 1 2, then return 0,1,2
ProcessData input6 = new ProcessData(); ProcessData input6 = new ProcessData();
@ -1051,7 +1051,7 @@ public class ProcessDefinitionServiceTest {
taskNode6.setType("SHELL"); taskNode6.setType("SHELL");
ShellParameters shellParameters6 = new ShellParameters(); ShellParameters shellParameters6 = new ShellParameters();
ResourceInfo resourceInfo6A = new ResourceInfo(); ResourceInfo resourceInfo6A = new ResourceInfo();
resourceInfo6A.setId(0); resourceInfo6A.setId(3);
ResourceInfo resourceInfo6B = new ResourceInfo(); ResourceInfo resourceInfo6B = new ResourceInfo();
resourceInfo6B.setId(1); resourceInfo6B.setId(1);
ResourceInfo resourceInfo6C = new ResourceInfo(); ResourceInfo resourceInfo6C = new ResourceInfo();
@ -1065,7 +1065,7 @@ public class ProcessDefinitionServiceTest {
String output6 = (String) testMethod.invoke(processDefinitionService, input6); String output6 = (String) testMethod.invoke(processDefinitionService, input6);
assertThat(output6.split(",")).hasSize(3) assertThat(output6.split(",")).hasSize(3)
.containsExactlyInAnyOrder("0", "1", "2"); .containsExactlyInAnyOrder("3", "1", "2");
} }
/** /**

Loading…
Cancel
Save