Search in sources :

Example 6 with Violation

use of io.syndesis.common.model.Violation in project syndesis by syndesisio.

the class UpdaterITCase method updaterShouldValidateAfterPatching.

@Test
public void updaterShouldValidateAfterPatching() {
    dataManager.create(new Integration.Builder().name("Existing integration").build());
    final Integration integration = new Integration.Builder().name("New integration").build();
    final ResponseEntity<Integration> created = post("/api/v1/integrations", integration, Integration.class, tokenRule.validToken(), HttpStatus.OK);
    final String integrationId = created.getBody().getId().get();
    final ResponseEntity<List<Violation>> response = patch("/api/v1/integrations/" + integrationId, Collections.singletonMap("name", "Existing integration"), new ParameterizedTypeReference<List<Violation>>() {
    }, tokenRule.validToken(), HttpStatus.BAD_REQUEST);
    assertThat(response.getBody()).containsOnly(new Violation.Builder().error("UniqueProperty").property("name").message("Value 'Existing integration' is not unique").build());
}
Also used : Violation(io.syndesis.common.model.Violation) Integration(io.syndesis.common.model.integration.Integration) List(java.util.List) Test(org.junit.Test)

Aggregations

Violation (io.syndesis.common.model.Violation)6 List (java.util.List)5 Test (org.junit.Test)5 Connection (io.syndesis.common.model.connection.Connection)4 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ProcessingException (com.github.fge.jsonschema.core.exceptions.ProcessingException)1 ProcessingMessage (com.github.fge.jsonschema.core.report.ProcessingMessage)1 ProcessingReport (com.github.fge.jsonschema.core.report.ProcessingReport)1 Integration (io.syndesis.common.model.integration.Integration)1 SwaggerModelInfo (io.syndesis.server.connector.generator.swagger.SwaggerModelInfo)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1