diff --git a/api/src/test/java/io/kaoto/backend/api/resource/v1/IntegrationsResourceTest.java b/api/src/test/java/io/kaoto/backend/api/resource/v1/IntegrationsResourceTest.java index 06e246494..fba95a9d4 100644 --- a/api/src/test/java/io/kaoto/backend/api/resource/v1/IntegrationsResourceTest.java +++ b/api/src/test/java/io/kaoto/backend/api/resource/v1/IntegrationsResourceTest.java @@ -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; @@ -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; @@ -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()); + } } diff --git a/api/src/test/resources/io/kaoto/backend/api/resource/amq-amq.yaml b/api/src/test/resources/io/kaoto/backend/api/resource/amq-amq.yaml new file mode 100644 index 000000000..25d0d499c --- /dev/null +++ b/api/src/test/resources/io/kaoto/backend/api/resource/amq-amq.yaml @@ -0,0 +1,5 @@ +- from: + uri: activemq:null:queue + steps: + - to: + uri: activemq:null:queue diff --git a/camel-route-support/src/main/java/io/kaoto/backend/api/service/step/parser/camelroute/CamelRouteStepParserService.java b/camel-route-support/src/main/java/io/kaoto/backend/api/service/step/parser/camelroute/CamelRouteStepParserService.java index 96d734760..5f174c883 100644 --- a/camel-route-support/src/main/java/io/kaoto/backend/api/service/step/parser/camelroute/CamelRouteStepParserService.java +++ b/camel-route-support/src/main/java/io/kaoto/backend/api/service/step/parser/camelroute/CamelRouteStepParserService.java @@ -57,7 +57,7 @@ public ParseResult 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)); } }