From 73f0d27c637f1b3e948f06084d5bf5ffa1d24ea3 Mon Sep 17 00:00:00 2001 From: Sterchi Daniel Date: Fri, 5 Jul 2024 17:17:53 +0200 Subject: [PATCH] update TODOs --- .../openapi/OpenApiTestDataGenerator.java | 2 +- .../OpenApiClientRequestActionBuilder.java | 2 +- .../openapi/integration/OpenApiClientIT.java | 53 +++++++++---------- .../generator/gen/OpenapiPetstore.java | 2 +- .../generator/gen/OpenapiPetstoreTest.java | 1 + 5 files changed, 29 insertions(+), 31 deletions(-) diff --git a/connectors/citrus-openapi/src/main/java/org/citrusframework/openapi/OpenApiTestDataGenerator.java b/connectors/citrus-openapi/src/main/java/org/citrusframework/openapi/OpenApiTestDataGenerator.java index 6b31655892..ed690530a8 100644 --- a/connectors/citrus-openapi/src/main/java/org/citrusframework/openapi/OpenApiTestDataGenerator.java +++ b/connectors/citrus-openapi/src/main/java/org/citrusframework/openapi/OpenApiTestDataGenerator.java @@ -313,7 +313,7 @@ public static String createValidationExpression( } /** - * TODO TAT-1291 this method does not respect optional/required properties + * TODO BUG this method does not respect optional/required properties * Create validation expression using functions according to schema type and format. * * @param schema diff --git a/connectors/citrus-openapi/src/main/java/org/citrusframework/openapi/actions/OpenApiClientRequestActionBuilder.java b/connectors/citrus-openapi/src/main/java/org/citrusframework/openapi/actions/OpenApiClientRequestActionBuilder.java index 433324e5d1..8d306a7761 100644 --- a/connectors/citrus-openapi/src/main/java/org/citrusframework/openapi/actions/OpenApiClientRequestActionBuilder.java +++ b/connectors/citrus-openapi/src/main/java/org/citrusframework/openapi/actions/OpenApiClientRequestActionBuilder.java @@ -119,7 +119,7 @@ public static OasItem create(String operationId, OasDocument oasDocument) { @Override public Message build(TestContext context, String messageType) { - // TODO: TAT-1291 - make parameter substitution more explicit? + // TODO TAT-1291 - make parameter substitution more explicit context.addVariables(parameters); OasDocument oasDocument = openApiSpec.getOpenApiDoc(context); var item = OasItem.create(operationId, oasDocument); diff --git a/connectors/citrus-openapi/src/test/java/org/citrusframework/openapi/integration/OpenApiClientIT.java b/connectors/citrus-openapi/src/test/java/org/citrusframework/openapi/integration/OpenApiClientIT.java index 27536a40b6..97c58b45c6 100644 --- a/connectors/citrus-openapi/src/test/java/org/citrusframework/openapi/integration/OpenApiClientIT.java +++ b/connectors/citrus-openapi/src/test/java/org/citrusframework/openapi/integration/OpenApiClientIT.java @@ -66,10 +66,10 @@ public void getPetById() { variable("correlationIds", "1234abcd"); when(openapi(petstoreSpec) - .client(httpClient) - .send("getPetById") - .fork(true) - .message() + .client(httpClient) + .send("getPetById") + .fork(true) + .message() ); then(http().server(httpServer) @@ -77,7 +77,7 @@ public void getPetById() { .get("/pet/1001") .queryParam("verbose", "true") .message() - // TODO bug? - cannot check correlationId + // TODO BUG? - cannot check correlationId // see: org/citrusframework/validation/DefaultMessageHeaderValidator.java:68 // see: org.citrusframework.message.MessageHeaderUtils.isSpringInternalHeader .header("correlationIds", "1234abcd") @@ -106,10 +106,10 @@ public void getPetById_requiredParamsShouldBeGeneratedIfNotProvided() { ); then(http().server(httpServer) - .receive() - .get("@matches('/pet/\\d+')@") - .message() - // TODO bug? - cannot check correlationId + .receive() + .get("@matches('/pet/\\d+')@") + .message() + // TODO BUG? - cannot check correlationId // see: org/citrusframework/validation/DefaultMessageHeaderValidator.java:68 // see: org.citrusframework.message.MessageHeaderUtils.isSpringInternalHeader // .header("correlationId", "@matches('\\w+')@") @@ -188,7 +188,7 @@ public void getPetById_generated() { .receive("getPetById", HttpStatus.OK)); } - /* TODO create issues + // TODO TAT-1291 create issues for Bugs @CitrusTest public void BUG_getPetById_paramsCanAlsoBeSetWithMessageBuilder() { variable("petId", "1001"); @@ -224,7 +224,6 @@ public void BUG_getPetById_paramsCanAlsoBeSetWithMessageBuilder() { } @CitrusTest - @Ignore public void BUG_should_be_possible_to_switch_content_type__to_xml() { variable("petId", "1001"); @@ -252,9 +251,9 @@ public void BUG_should_be_possible_to_switch_content_type__to_xml() { .client(httpClient) .receive("getPetById", HttpStatus.OK) .message() - // TODO XML bodies do not seem to work, even if there is just XML as "produces" in the spec + // TODO BUG XML bodies do not seem to work, even if there is just XML as "produces" in the spec .body(Resources.create("classpath:org/citrusframework/openapi/petstore/pet.xml")) - // TODO the type/contentType statements are useless, if there is another type in the spec. + // TODO BUG the type/contentType statements are useless, if there is another type in the spec. // even if there are two. i.E: // # this will always use JSON as type // produces: @@ -265,7 +264,6 @@ public void BUG_should_be_possible_to_switch_content_type__to_xml() { } @CitrusTest - @Ignore public void BUG_should_only_validate_the_presence_of_required_properties() { variable("petId", "1001"); @@ -286,7 +284,7 @@ public void BUG_should_only_validate_the_presence_of_required_properties() { .send() .response(HttpStatus.OK) .message() - // this should be valid, according to the spec-file + // TODO BUG this should be valid, according to the spec-file .body(""" { "category": {}, @@ -302,7 +300,6 @@ public void BUG_should_only_validate_the_presence_of_required_properties() { .message() ); } - */ @CitrusTest public void postAddPet() { @@ -318,18 +315,18 @@ public void postAddPet() { .post("/pet") .message() .body(""" - { - "id": "@isNumber()@", - "name": "@notEmpty()@", - "category": { - "id": "@isNumber()@", - "name": "@notEmpty()@" - }, - "photoUrls": "@notEmpty()@", - "tags": "@ignore@", - "status": "@matches(sold|pending|available)@" - } - """) + { + "id": "@isNumber()@", + "name": "@notEmpty()@", + "category": { + "id": "@isNumber()@", + "name": "@notEmpty()@" + }, + "photoUrls": "@notEmpty()@", + "tags": "@ignore@", + "status": "@matches(sold|pending|available)@" + } + """) .contentType("application/json;charset=UTF-8")); then(http().server(httpServer) diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/gen/OpenapiPetstore.java b/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/gen/OpenapiPetstore.java index 5ad19b5e25..e40075b73a 100644 --- a/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/gen/OpenapiPetstore.java +++ b/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/gen/OpenapiPetstore.java @@ -12,7 +12,7 @@ import static org.citrusframework.spi.Resources.create; -// TODO move to mustache File +// TODO TAT-1291 is in api.mustache File - delete this class public class OpenapiPetstore { private static final OpenApiSpecification petstoreSpec = OpenApiSpecification.from( create("src/test/resources/apis/petstore.yaml") diff --git a/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/gen/OpenapiPetstoreTest.java b/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/gen/OpenapiPetstoreTest.java index bda71a12b4..4577e64541 100644 --- a/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/gen/OpenapiPetstoreTest.java +++ b/test-api-generator/citrus-test-api-generator-core/src/test/java/org/citrusframework/openapi/generator/gen/OpenapiPetstoreTest.java @@ -31,6 +31,7 @@ import static org.mockito.Mockito.when; import static org.springframework.http.HttpStatus.OK; +// TODO TAT-1291 can this test be removed? in favor of GetPetByIdIT.java @ExtendWith(CitrusSpringExtension.class) @SpringBootTest(classes = {PetStoreBeanConfiguration.class, CitrusSpringConfig.class, Config.class}) class OpenapiPetstoreTest {