Examples of addViolation()


Examples of br.gov.frameworkdemoiselle.HttpViolationException.addViolation()

    assertEquals(SC_PRECONDITION_FAILED, response.getStatusLine().getStatusCode());
    violations = mapper.readValue(response.getEntity().getContent(),
        new TypeReference<Set<UnprocessableEntityException.Violation>>() {
        });
    expected = new UnprocessableEntityException();
    expected.addViolation("description", "não pode ser nulo");
    expected.addViolation("link", "não pode ser nulo");
    assertEquals(expected.getViolations(), violations);

    bookmark = new Bookmark();
    bookmark.setDescription("Google");
View Full Code Here

Examples of br.gov.frameworkdemoiselle.HttpViolationException.addViolation()

    violations = mapper.readValue(response.getEntity().getContent(),
        new TypeReference<Set<UnprocessableEntityException.Violation>>() {
        });
    expected = new UnprocessableEntityException();
    expected.addViolation("description", "não pode ser nulo");
    expected.addViolation("link", "não pode ser nulo");
    assertEquals(expected.getViolations(), violations);

    bookmark = new Bookmark();
    bookmark.setDescription("Google");
    bookmark.setLink("http: // google . com");
View Full Code Here

Examples of br.gov.frameworkdemoiselle.HttpViolationException.addViolation()

    assertEquals(SC_PRECONDITION_FAILED, response.getStatusLine().getStatusCode());
    violations = mapper.readValue(response.getEntity().getContent(),
        new TypeReference<Set<UnprocessableEntityException.Violation>>() {
        });
    expected = new UnprocessableEntityException();
    expected.addViolation("description", "não pode ser nulo");
    expected.addViolation("link", "não pode ser nulo");
    assertEquals(expected.getViolations(), violations);

    bookmark = new Bookmark();
    bookmark.setDescription("Google");
View Full Code Here

Examples of br.gov.frameworkdemoiselle.HttpViolationException.addViolation()

    violations = mapper.readValue(response.getEntity().getContent(),
        new TypeReference<Set<UnprocessableEntityException.Violation>>() {
        });
    expected = new UnprocessableEntityException();
    expected.addViolation("description", "não pode ser nulo");
    expected.addViolation("link", "não pode ser nulo");
    assertEquals(expected.getViolations(), violations);

    bookmark = new Bookmark();
    bookmark.setDescription("Google");
    bookmark.setLink("http: // google . com");
View Full Code Here

Examples of br.gov.frameworkdemoiselle.PreconditionFailedException.addViolation()

    assertEquals(SC_PRECONDITION_FAILED, response.getStatusLine().getStatusCode());
    violations = mapper.readValue(response.getEntity().getContent(),
        new TypeReference<Set<PreconditionFailedException.Violation>>() {
        });
    expected = new PreconditionFailedException();
    expected.addViolation("description", "não pode ser nulo");
    expected.addViolation("link", "não pode ser nulo");
    assertEquals(expected.getViolations(), violations);

    bookmark = new Bookmark();
    bookmark.setDescription("Google");
View Full Code Here

Examples of br.gov.frameworkdemoiselle.PreconditionFailedException.addViolation()

    violations = mapper.readValue(response.getEntity().getContent(),
        new TypeReference<Set<PreconditionFailedException.Violation>>() {
        });
    expected = new PreconditionFailedException();
    expected.addViolation("description", "não pode ser nulo");
    expected.addViolation("link", "não pode ser nulo");
    assertEquals(expected.getViolations(), violations);

    bookmark = new Bookmark();
    bookmark.setDescription("Google");
    bookmark.setLink("http: // google . com");
View Full Code Here

Examples of br.gov.frameworkdemoiselle.PreconditionFailedException.addViolation()

    assertEquals(SC_PRECONDITION_FAILED, response.getStatusLine().getStatusCode());
    violations = mapper.readValue(response.getEntity().getContent(),
        new TypeReference<Set<PreconditionFailedException.Violation>>() {
        });
    expected = new PreconditionFailedException();
    expected.addViolation("description", "não pode ser nulo");
    expected.addViolation("link", "não pode ser nulo");
    assertEquals(expected.getViolations(), violations);

    bookmark = new Bookmark();
    bookmark.setDescription("Google");
View Full Code Here

Examples of br.gov.frameworkdemoiselle.PreconditionFailedException.addViolation()

    violations = mapper.readValue(response.getEntity().getContent(),
        new TypeReference<Set<PreconditionFailedException.Violation>>() {
        });
    expected = new PreconditionFailedException();
    expected.addViolation("description", "não pode ser nulo");
    expected.addViolation("link", "não pode ser nulo");
    assertEquals(expected.getViolations(), violations);

    bookmark = new Bookmark();
    bookmark.setDescription("Google");
    bookmark.setLink("http: // google . com");
View Full Code Here

Examples of br.gov.frameworkdemoiselle.PreconditionFailedException.addViolation()

  public Response toResponse(ConstraintViolationException exception) {
    PreconditionFailedException failed = new PreconditionFailedException();

    for (Iterator<ConstraintViolation<?>> iter = exception.getConstraintViolations().iterator(); iter.hasNext();) {
      ConstraintViolation<?> violation = iter.next();
      failed.addViolation(violation.getPropertyPath().toString(), violation.getMessage());
    }

    return Response.status(PRECONDITION_FAILED).entity(failed.getViolations()).build();
  }
}
View Full Code Here

Examples of br.gov.frameworkdemoiselle.UnprocessableEntityException.addViolation()

    UnprocessableEntityException failed = new UnprocessableEntityException();
    int status = new UnprocessableEntityException().getStatusCode();

    for (Iterator<ConstraintViolation<?>> iter = exception.getConstraintViolations().iterator(); iter.hasNext();) {
      ConstraintViolation<?> violation = iter.next();
      failed.addViolation(violation.getPropertyPath().toString(), violation.getMessage());
    }

    getLogger().debug(getBundle().getString("mapping-violations", status, failed.getViolations().toString()));
    return Response.status(status).entity(failed.getViolations()).build();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.