Skip to content

Commit

Permalink
update TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
Sterchi Daniel committed Jul 17, 2024
1 parent 58c2034 commit 5836a12
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,18 @@ 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)
.receive()
.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")
Expand Down Expand Up @@ -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+')@")
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");

Expand Down Expand Up @@ -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:
Expand All @@ -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");

Expand All @@ -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": {},
Expand All @@ -302,7 +300,6 @@ public void BUG_should_only_validate_the_presence_of_required_properties() {
.message()
);
}
*/

@CitrusTest
public void postAddPet() {
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 5836a12

Please sign in to comment.