use of io.confluent.kafkarest.exceptions.v3.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;
}
use of io.confluent.kafkarest.exceptions.v3.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();
}
use of io.confluent.kafkarest.exceptions.v3.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());
}
use of io.confluent.kafkarest.exceptions.v3.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());
}
use of io.confluent.kafkarest.exceptions.v3.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());
}
Aggregations