Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

fix: YAML>JSON integration REST returns duplicated START step #498

Merged
merged 1 commit into from
Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static io.restassured.RestAssured.given;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.IOException;
Expand All @@ -15,6 +16,7 @@
import javax.inject.Inject;
import javax.ws.rs.core.Response;

import com.fasterxml.jackson.databind.JsonNode;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.yaml.snakeyaml.Yaml;
Expand Down Expand Up @@ -164,4 +166,28 @@ void complexEIP() throws URISyntaxException, IOException {

assertThat(res.extract().body().asString()).isEqualToNormalizingNewlines(yaml);
}

@Test
void amqAmq() throws Exception {
String yaml = Files.readString(Path.of(
DeploymentsResourceTest.class.getResource(
"../amq-amq.yaml")
.toURI()));

var res = given()
.when()
.contentType("text/yaml")
.body(yaml)
.post("")
.then()
.statusCode(Response.Status.OK.getStatusCode());

JsonNode json = new ObjectMapper().readTree(res.extract().body().asInputStream());
JsonNode amq1 = json.get("steps").get(0);
JsonNode amq2 = json.get("steps").get(1);
assertEquals("START", amq1.get("type").asText());
assertEquals("activemq", amq1.get("name").asText());
assertEquals("activemq", amq2.get("name").asText());
assertNotEquals("START", amq2.get("type").asText());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- from:
uri: activemq:null:queue
steps:
- to:
uri: activemq:null:queue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public ParseResult<Step> deepParse(final String input) {
if (from.getSteps() != null) {
int i = 0;
for (FlowStep step : from.getSteps()) {
steps.add(ksps.processStep(step, i == 0, i++ == from.getSteps().size() - 1));
steps.add(ksps.processStep(step, false, i++ == from.getSteps().size() - 1));
}
}

Expand Down