From e49939d93d9e6d2f51e0b0be0bc6308a2bf62c1c Mon Sep 17 00:00:00 2001 From: thcai Date: Tue, 27 Aug 2024 17:39:31 +0200 Subject: [PATCH] test7 --- .../integration/SchemaIntegrationTest.java | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/test/java/com/michelin/ns4kafka/integration/SchemaIntegrationTest.java b/src/test/java/com/michelin/ns4kafka/integration/SchemaIntegrationTest.java index 4ff005f0..6a502f95 100644 --- a/src/test/java/com/michelin/ns4kafka/integration/SchemaIntegrationTest.java +++ b/src/test/java/com/michelin/ns4kafka/integration/SchemaIntegrationTest.java @@ -768,46 +768,46 @@ void shouldRegisterSameSchemaTwice() { assertEquals("ns1-subject3-value", schemaAfterPostOnRegistry.subject()); } - @Test + @Test void shouldRegisterSameSchemaTwice2() { Schema schema = Schema.builder() - .metadata(Metadata.builder() - .name("ns1-subject3-value") - .build()) - .spec(Schema.SchemaSpec.builder() - .schema( - "{\"namespace\":\"com.michelin.kafka.producer.showcase.avro\",\"type\":\"record\"," - + "\"name\":\"PersonAvro\",\"fields\":[{\"name\":\"firstName\",\"type\":[\"null\",\"string\"]," - + "\"default\":null,\"doc\":\"First name of the person\"}," - + "{\"name\":\"lastName\",\"type\":[\"null\",\"string\"],\"default\":null," - + "\"doc\":\"Last name of the person\"},{\"name\":\"dateOfBirth\",\"type\":[\"null\"," - + "{\"type\":\"long\",\"logicalType\":\"timestamp-millis\"}],\"default\":null," - + "\"doc\":\"Date of birth of the person\"}]}") - .build()) - .build(); + .metadata(Metadata.builder() + .name("ns1-subject3-value") + .build()) + .spec(Schema.SchemaSpec.builder() + .schema( + "{\"namespace\":\"com.michelin.kafka.producer.showcase.avro\",\"type\":\"record\"," + + "\"name\":\"PersonAvro\",\"fields\":[{\"name\":\"firstName\",\"type\":[\"null\",\"string\"]," + + "\"default\":null,\"doc\":\"First name of the person\"}," + + "{\"name\":\"lastName\",\"type\":[\"null\",\"string\"],\"default\":null," + + "\"doc\":\"Last name of the person\"},{\"name\":\"dateOfBirth\",\"type\":[\"null\"," + + "{\"type\":\"long\",\"logicalType\":\"timestamp-millis\"}],\"default\":null," + + "\"doc\":\"Date of birth of the person\"}]}") + .build()) + .build(); // Apply schema var createResponse = ns4KafkaClient - .toBlocking() - .exchange(HttpRequest - .create(HttpMethod.POST, "/api/namespaces/ns1/schemas") - .bearerAuth(token) - .body(schema), Schema.class); + .toBlocking() + .exchange(HttpRequest + .create(HttpMethod.POST, "/api/namespaces/ns1/schemas") + .bearerAuth(token) + .body(schema), Schema.class); assertEquals("created", createResponse.header("X-Ns4kafka-Result")); // Get all schemas var getResponse = ns4KafkaClient - .toBlocking() - .exchange(HttpRequest - .create(HttpMethod.GET, "/api/namespaces/ns1/schemas") - .bearerAuth(token), Argument.listOf(SchemaList.class)); + .toBlocking() + .exchange(HttpRequest + .create(HttpMethod.GET, "/api/namespaces/ns1/schemas") + .bearerAuth(token), Argument.listOf(SchemaList.class)); assertTrue(getResponse.getBody().isPresent()); assertTrue(getResponse.getBody().get() - .stream() - .anyMatch(schemaList -> schemaList.getMetadata().getName().equals("ns1-subject3-value"))); - } + .stream() + .anyMatch(schemaList -> schemaList.getMetadata().getName().equals("ns1-subject3-value"))); + } @Test void shouldDeleteSchema() {