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

Commit c15cf36

Browse files
ilayaperumalgsobychacko
authored andcommitted
Append group in stream DSL on app definition
- When the stream DSL has `input` group set, then the `group` property needs to be set on the app definition associated with it. - Update test Resolves #4463
1 parent 6c839d3 commit c15cf36

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

spring-cloud-dataflow-core/src/main/java/org/springframework/cloud/dataflow/core/DefaultStreamDefinitionService.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,16 @@ public String constructDsl(String originalDslText, LinkedList<StreamAppDefinitio
7272
// Check for Input Named Destination
7373
if (appDefinitionIndex == 0 && StringUtils.hasText(inputDestination)) {
7474
dslBuilder.append(":").append(inputDestination);
75-
if (inputGroup != null && !inputGroup.equals(appDefinition.getStreamName())) {
76-
dslBuilder.append(" --group=").append(inputGroup);
77-
}
7875
dslBuilder.append(" > ");
7976
}
8077

8178
// Add App Definition
8279
dslBuilder.append(appDefinition.getName());
8380

81+
if (inputGroup != null && !inputGroup.equals(appDefinition.getStreamName())) {
82+
dslBuilder.append(" --group=").append(inputGroup);
83+
}
84+
8485
if (!appDefinition.getName().equals(appDefinition.getRegisteredAppName())) {
8586
dslBuilder.append(": ").append(appDefinition.getRegisteredAppName());
8687
}

spring-cloud-dataflow-core/src/test/java/org/springframework/cloud/dataflow/core/StreamDefinitionServiceUtilsTests.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void testXD2416_2() {
7373

7474
@Test
7575
public void testSourceDestinationArgs() {
76-
reverseDslTest(":test --group=test > file", 1);
76+
reverseDslTest(":test > file --group=test", 1);
7777
}
7878

7979
@Test
@@ -133,7 +133,6 @@ public void testExclusionOfDataFlowAddedProperties() {
133133
DataFlowPropertyKeys.STREAM_APP_TYPE,
134134
DataFlowPropertyKeys.STREAM_APP_LABEL,
135135
DataFlowPropertyKeys.STREAM_NAME,
136-
BindingPropertyKeys.INPUT_GROUP,
137136
BindingPropertyKeys.OUTPUT_REQUIRED_GROUPS,
138137
BindingPropertyKeys.OUTPUT_DESTINATION);
139138

@@ -163,7 +162,9 @@ public void testInputDestinationProperty() {
163162
@Test
164163
public void testPropertyAutoQuotes() {
165164

166-
StreamDefinition streamDefinition = new StreamDefinition("streamName", "foo | bar");
165+
String streamName = "stream2";
166+
167+
StreamDefinition streamDefinition = new StreamDefinition(streamName, "foo | bar");
167168

168169
StreamAppDefinition foo = this.streamDefinitionService.getAppDefinitions(streamDefinition).get(0);
169170
StreamAppDefinition bar = this.streamDefinitionService.getAppDefinitions(streamDefinition).get(1);
@@ -174,13 +175,13 @@ public void testPropertyAutoQuotes() {
174175
.setProperty("p3", "ef")
175176
.setProperty("p4", "'i' 'j'")
176177
.setProperty("p5", "\"k l\"")
177-
.build("stream2");
178+
.build(streamName);
178179

179180
StreamAppDefinition bar2 = StreamAppDefinition.Builder.from(bar)
180181
.setProperty("p1", "a b")
181182
.setProperty("p2", "'c d'")
182183
.setProperty("p3", "ef")
183-
.build("stream2");
184+
.build(streamName);
184185

185186
assertEquals("foo --p1='a b' --p2=\"'c d'\" --p3=ef --p4=\"'i' 'j'\" --p5=\"k l\" | bar --p1='a b' --p2=\"'c d'\" --p3=ef",
186187
this.streamDefinitionService.constructDsl(streamDefinition.getDslText(), new LinkedList(Arrays.asList(foo2, bar2))));

0 commit comments

Comments
 (0)