Search in sources :

Example 1 with ErrorResponse

use of io.jans.scim.model.scim2.ErrorResponse in project oxTrust by GluuFederation.

the class BulkWebService method createErrorResponse.

private ErrorResponse createErrorResponse(Response.Status status, ErrorScimType scimType, String detail) {
    ErrorResponse errorResponse = new ErrorResponse();
    List<String> schemas = new ArrayList<String>();
    schemas.add(Constants.ERROR_RESPONSE_URI);
    errorResponse.setSchemas(schemas);
    errorResponse.setStatus(String.valueOf(status.getStatusCode()));
    errorResponse.setScimType(scimType);
    errorResponse.setDetail(detail);
    return errorResponse;
}
Also used : ArrayList(java.util.ArrayList) ErrorResponse(org.gluu.oxtrust.model.scim2.ErrorResponse)

Example 2 with ErrorResponse

use of io.jans.scim.model.scim2.ErrorResponse in project oxTrust by GluuFederation.

the class BaseScimWebService method getErrorResponse.

public static Response getErrorResponse(int statusCode, ErrorScimType scimType, String detail) {
    ErrorResponse errorResponse = new ErrorResponse();
    errorResponse.setStatus(String.valueOf(statusCode));
    errorResponse.setScimType(scimType);
    errorResponse.setDetail(detail);
    return Response.status(statusCode).entity(errorResponse).build();
}
Also used : ErrorResponse(org.gluu.oxtrust.model.scim2.ErrorResponse)

Example 3 with ErrorResponse

use of io.jans.scim.model.scim2.ErrorResponse in project kafka-rest by confluentinc.

the class ProduceActionIntegrationTest method produceAvroWithRecordSchemaSubjectStrategyAndSchemaVersion_returnsBadRequest.

@Test
public void produceAvroWithRecordSchemaSubjectStrategyAndSchemaVersion_returnsBadRequest() throws Exception {
    String clusterId = testEnv.kafkaCluster().getClusterId();
    String request = "{ \"key\": { \"subject_name_strategy\": \"RECORD_NAME\", \"schema_version\": 1 } }";
    Response response = testEnv.kafkaRest().target().path("/v3/clusters/" + clusterId + "/topics/" + TOPIC_NAME + "/records").request().accept(MediaType.APPLICATION_JSON).post(Entity.entity(request, MediaType.APPLICATION_JSON));
    assertEquals(Status.OK.getStatusCode(), response.getStatus());
    ErrorResponse actual = response.readEntity(ErrorResponse.class);
    assertEquals(400, actual.getErrorCode());
}
Also used : Response(javax.ws.rs.core.Response) ErrorResponse(io.confluent.kafkarest.exceptions.v3.ErrorResponse) ProduceResponse(io.confluent.kafkarest.entities.v3.ProduceResponse) ByteString(com.google.protobuf.ByteString) ErrorResponse(io.confluent.kafkarest.exceptions.v3.ErrorResponse) Test(org.junit.jupiter.api.Test)

Example 4 with ErrorResponse

use of io.jans.scim.model.scim2.ErrorResponse in project kafka-rest by confluentinc.

the class ProduceActionIntegrationTest method produceAvroWithRawSchemaAndSchemaVersion_returnsBadRequest.

@Test
public void produceAvroWithRawSchemaAndSchemaVersion_returnsBadRequest() throws Exception {
    String clusterId = testEnv.kafkaCluster().getClusterId();
    String request = "{ \"key\": { \"schema\": \"{ \\\"type\\\": \\\"string\\\" }\", \"schema_version\": 1 } }";
    Response response = testEnv.kafkaRest().target().path("/v3/clusters/" + clusterId + "/topics/" + TOPIC_NAME + "/records").request().accept(MediaType.APPLICATION_JSON).post(Entity.entity(request, MediaType.APPLICATION_JSON));
    assertEquals(Status.OK.getStatusCode(), response.getStatus());
    ErrorResponse actual = response.readEntity(ErrorResponse.class);
    assertEquals(400, actual.getErrorCode());
}
Also used : Response(javax.ws.rs.core.Response) ErrorResponse(io.confluent.kafkarest.exceptions.v3.ErrorResponse) ProduceResponse(io.confluent.kafkarest.entities.v3.ProduceResponse) ByteString(com.google.protobuf.ByteString) ErrorResponse(io.confluent.kafkarest.exceptions.v3.ErrorResponse) Test(org.junit.jupiter.api.Test)

Example 5 with ErrorResponse

use of io.jans.scim.model.scim2.ErrorResponse in project kafka-rest by confluentinc.

the class ProduceActionIntegrationTest method produceBinaryWithSchemaId_returnsBadRequest.

@Test
public void produceBinaryWithSchemaId_returnsBadRequest() throws Exception {
    String clusterId = testEnv.kafkaCluster().getClusterId();
    String request = "{ \"key\": { \"type\": \"BINARY\", \"schema_id\": 1 } }";
    Response response = testEnv.kafkaRest().target().path("/v3/clusters/" + clusterId + "/topics/" + TOPIC_NAME + "/records").request().accept(MediaType.APPLICATION_JSON).post(Entity.entity(request, MediaType.APPLICATION_JSON));
    assertEquals(Status.OK.getStatusCode(), response.getStatus());
    ErrorResponse actual = response.readEntity(ErrorResponse.class);
    assertEquals(400, actual.getErrorCode());
}
Also used : Response(javax.ws.rs.core.Response) ErrorResponse(io.confluent.kafkarest.exceptions.v3.ErrorResponse) ProduceResponse(io.confluent.kafkarest.entities.v3.ProduceResponse) ByteString(com.google.protobuf.ByteString) ErrorResponse(io.confluent.kafkarest.exceptions.v3.ErrorResponse) Test(org.junit.jupiter.api.Test)

Aggregations

ErrorResponse (io.confluent.kafkarest.exceptions.v3.ErrorResponse)23 Test (org.junit.jupiter.api.Test)23 ProduceResponse (io.confluent.kafkarest.entities.v3.ProduceResponse)21 Response (javax.ws.rs.core.Response)20 ByteString (com.google.protobuf.ByteString)19 ProduceRequest (io.confluent.kafkarest.entities.v3.ProduceRequest)8 RequestRateLimiter (io.confluent.kafkarest.ratelimit.RequestRateLimiter)3 ChunkedOutputFactory (io.confluent.kafkarest.response.ChunkedOutputFactory)3 FakeAsyncResponse (io.confluent.kafkarest.response.FakeAsyncResponse)3 ResultOrError (io.confluent.kafkarest.response.StreamingResponse.ResultOrError)3 Properties (java.util.Properties)3 RateLimitExceededException (io.confluent.kafkarest.ratelimit.RateLimitExceededException)2 ArrayList (java.util.ArrayList)2 ErrorResponse (org.gluu.oxtrust.model.scim2.ErrorResponse)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ProtobufSchema (io.confluent.kafka.schemaregistry.protobuf.ProtobufSchema)1 ErrorResponse (io.jans.scim.model.scim2.ErrorResponse)1