Skip to content

Commit

Permalink
test8
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasCAI-mlv committed Aug 27, 2024
1 parent e49939d commit 34d4a88
Showing 1 changed file with 4 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -768,47 +768,6 @@ void shouldRegisterSameSchemaTwice() {
assertEquals("ns1-subject3-value", schemaAfterPostOnRegistry.subject());
}

@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();

// Apply schema
var createResponse = ns4KafkaClient
.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));

assertTrue(getResponse.getBody().isPresent());
assertTrue(getResponse.getBody().get()
.stream()
.anyMatch(schemaList -> schemaList.getMetadata().getName().equals("ns1-subject3-value")));
}

@Test
void shouldDeleteSchema() {
Schema schemaV1 = Schema.builder()
Expand Down Expand Up @@ -845,9 +804,7 @@ void shouldDeleteSchema() {
+ "\"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\"}]}")
+ "\"doc\":\"Last name of the person\"}]}")
.build())
.build();

Expand All @@ -867,9 +824,7 @@ void shouldDeleteSchema() {
.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\"}]}")
+ "\"default\":null,\"doc\":\"First name of the person\"}]}")
.build())
.build();

Expand All @@ -890,10 +845,8 @@ void shouldDeleteSchema() {
"{\"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\"}]}")
+ "{\"name\":\"age\",\"type\":[\"null\",\"string\"],\"default\":null,"
+ "\"doc\":\"Age of the person\"}]}")
.build())
.build();

Expand Down

0 comments on commit 34d4a88

Please sign in to comment.