use of org.infinispan.client.rest.RestSchemaClient in project infinispan by infinispan.
the class ProtobufResourceTest method putAndGetWrongProtobuf.
@Test
public void putAndGetWrongProtobuf() throws Exception {
RestSchemaClient schemaClient = client.schemas();
String errorProto = getResourceAsString("error.proto", getClass().getClassLoader());
RestResponse response = join(schemaClient.post("error", errorProto));
String cause = "java.lang.IllegalStateException:" + " Syntax error in error.proto at 3:8: unexpected label: messoge";
ResponseAssertion.assertThat(response).isOk();
Json jsonNode = Json.read(response.getBody());
assertEquals("error.proto", jsonNode.at("name").asString());
assertEquals("Schema error.proto has errors", jsonNode.at("error").at("message").asString());
assertEquals(cause, jsonNode.at("error").at("cause").asString());
// Read adding .proto should also work
response = join(schemaClient.get("error"));
ResponseAssertion.assertThat(response).isOk();
ResponseAssertion.assertThat(response).hasContentEqualToFile("error.proto");
checkListProtobufEndpointUrl("error.proto", cause);
}
use of org.infinispan.client.rest.RestSchemaClient in project infinispan by infinispan.
the class ProtobufResourceTest method createTwiceSchema.
@Test
public void createTwiceSchema() throws Exception {
RestSchemaClient schemaClient = client.schemas();
String personProto = getResourceAsString("person.proto", getClass().getClassLoader());
CompletionStage<RestResponse> response = schemaClient.post("person", personProto);
ResponseAssertion.assertThat(response).isOk();
response = schemaClient.post("person", personProto);
ResponseAssertion.assertThat(response).isConflicted();
}
Aggregations