Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

Commit 12b4432

Browse files
cppwfsilayaperumalg
authored andcommitted
Update SchedulerTemplate to pass the arguments properly (#4005)
1 parent 30fe175 commit 12b4432

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

spring-cloud-dataflow-rest-client/src/main/java/org/springframework/cloud/dataflow/rest/client/SchedulerTemplate.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,18 @@ public void schedule(String scheduleName, String taskDefinitionName, Map<String,
6666
values.add("scheduleName", scheduleName);
6767
values.add("properties", DeploymentPropertiesUtils.format(taskProperties));
6868
values.add("taskDefinitionName", taskDefinitionName);
69-
values.add("arguments", commandLineArgs);
69+
String commandLineArgValue = new String();
70+
boolean isFirst = true;
71+
for(String command : commandLineArgs) {
72+
if(isFirst) {
73+
isFirst = false;
74+
}
75+
else {
76+
commandLineArgValue += " ";
77+
}
78+
commandLineArgValue += command;
79+
}
80+
values.add("arguments", commandLineArgValue);
7081
restTemplate.postForObject(schedulesLink.getHref(), values, Long.class);
7182
}
7283

spring-cloud-dataflow-rest-client/src/test/java/org/springframework/cloud/dataflow/rest/client/SchedulerTemplateTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public void scheduleTest() {
6868
values.add("scheduleName", DEFAULT_SCHEDULE_NAME);
6969
values.add("properties", DeploymentPropertiesUtils.format(props));
7070
values.add("taskDefinitionName", DEFAULT_DEFINITION_NAME);
71-
values.add("arguments", args);
71+
values.add("arguments", args.get(0));
7272
Mockito.verify(restTemplate).postForObject(SCHEDULES_RELATION, values, Long.class);
7373
}
7474

0 commit comments

Comments
 (0)