Search in sources :

Example 6 with ConfluentSchemaRegistryClient

use of org.springframework.cloud.stream.schema.client.ConfluentSchemaRegistryClient in project spring-cloud-stream by spring-cloud.

the class ConfluentSchemaRegistryClientTests method schemaNotFound.

@Test(expected = SchemaNotFoundException.class)
public void schemaNotFound() {
    this.mockRestServiceServer.expect(requestTo("http://localhost:8081/subjects/user/versions/1")).andExpect(method(HttpMethod.GET)).andExpect(header("Content-Type", "application/vnd.schemaregistry.v1+json")).andExpect(header("Accept", "application/vnd.schemaregistry.v1+json")).andRespond(withStatus(HttpStatus.NOT_FOUND));
    ConfluentSchemaRegistryClient client = new ConfluentSchemaRegistryClient(this.restTemplate);
    SchemaReference reference = new SchemaReference("user", 1, "avro");
    String schema = client.fetch(reference);
}
Also used : SchemaReference(org.springframework.cloud.stream.schema.SchemaReference) ConfluentSchemaRegistryClient(org.springframework.cloud.stream.schema.client.ConfluentSchemaRegistryClient) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)6 ConfluentSchemaRegistryClient (org.springframework.cloud.stream.schema.client.ConfluentSchemaRegistryClient)6 SchemaRegistrationResponse (org.springframework.cloud.stream.schema.SchemaRegistrationResponse)4 SchemaNotFoundException (org.springframework.cloud.stream.schema.SchemaNotFoundException)2 SchemaReference (org.springframework.cloud.stream.schema.SchemaReference)2 HttpStatusCodeException (org.springframework.web.client.HttpStatusCodeException)2