use of io.jans.scim.model.scim2.ErrorResponse in project kafka-rest by confluentinc.
the class ProduceActionIntegrationTest method produceAvroWithTypeAndSchemaId_returnsBadRequest.
@Test
public void produceAvroWithTypeAndSchemaId_returnsBadRequest() throws Exception {
String clusterId = testEnv.kafkaCluster().getClusterId();
String request = "{ \"key\": { \"type\": \"AVRO\", \"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());
}
use of io.jans.scim.model.scim2.ErrorResponse in project kafka-rest by confluentinc.
the class ProduceActionIntegrationTest method produceAvroWithSchemaSubjectAndSchemaSubjectStrategy_returnsBadRequest.
@Test
public void produceAvroWithSchemaSubjectAndSchemaSubjectStrategy_returnsBadRequest() throws Exception {
String clusterId = testEnv.kafkaCluster().getClusterId();
String request = "{ \"key\": { \"subject\": \"foobar\", \"subject_name_strategy\": \"TOPIC\" } }";
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.jans.scim.model.scim2.ErrorResponse in project kafka-rest by confluentinc.
the class ProduceActionIntegrationTest method produceProtobufWithRawSchemaAndInvalidData_throwsBadRequest.
@Test
public void produceProtobufWithRawSchemaAndInvalidData_throwsBadRequest() throws Exception {
String clusterId = testEnv.kafkaCluster().getClusterId();
ProtobufSchema keySchema = new ProtobufSchema("syntax = \"proto3\"; message MyKey { string foo = 1; }");
ProtobufSchema valueSchema = new ProtobufSchema("syntax = \"proto3\"; message MyValue { string bar = 1; }");
ProduceRequest request = ProduceRequest.builder().setKey(ProduceRequestData.builder().setFormat(EmbeddedFormat.PROTOBUF).setRawSchema(keySchema.canonicalString()).setData(IntNode.valueOf(1)).build()).setValue(ProduceRequestData.builder().setFormat(EmbeddedFormat.PROTOBUF).setRawSchema(valueSchema.canonicalString()).setData(IntNode.valueOf(2)).build()).setOriginalSize(0L).build();
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.jans.scim.model.scim2.ErrorResponse in project kafka-rest by confluentinc.
the class ProduceActionIntegrationTest method produceAvroWithTypeAndSchemaVersion_returnsBadRequest.
@Test
public void produceAvroWithTypeAndSchemaVersion_returnsBadRequest() throws Exception {
String clusterId = testEnv.kafkaCluster().getClusterId();
String request = "{ \"key\": { \"type\": \"AVRO\", \"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.jans.scim.model.scim2.ErrorResponse in project kafka-rest by confluentinc.
the class ProduceActionIntegrationTest method produceBinaryWithSchemaVersion_returnsBadRequest.
@Test
public void produceBinaryWithSchemaVersion_returnsBadRequest() throws Exception {
String clusterId = testEnv.kafkaCluster().getClusterId();
String request = "{ \"key\": { \"type\": \"BINARY\", \"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());
}
Aggregations