This repository has been archived by the owner on Jun 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 292
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Testing that every schema version is loadable
- Loading branch information
Thomas Abraham
committed
Apr 1, 2022
1 parent
bdd36c4
commit 751e491
Showing
7 changed files
with
75 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,4 +48,4 @@ | |
"type": "int" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,4 +24,4 @@ | |
"type": "string" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,4 @@ | |
"type": "string" | ||
} | ||
] | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
core-common/src/test/java/org/zalando/nakadi/service/AvroSchemaTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package org.zalando.nakadi.service; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.dataformat.avro.AvroMapper; | ||
import org.junit.Test; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.springframework.core.io.DefaultResourceLoader; | ||
import org.zalando.nakadi.config.KPIEventTypes; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class AvroSchemaTest { | ||
private final AvroSchema avroSchema; | ||
private final Map<String, List<String>> allSchemas = Map.of( | ||
AvroSchema.METADATA_KEY, List.of("0", "1"), | ||
KPIEventTypes.ACCESS_LOG, List.of("0", "1"), | ||
KPIEventTypes.BATCH_PUBLISHED, List.of("0"), | ||
KPIEventTypes.DATA_STREAMED, List.of("0"), | ||
KPIEventTypes.EVENT_TYPE_LOG, List.of("0"), | ||
KPIEventTypes.SUBSCRIPTION_LOG, List.of("0") | ||
); | ||
|
||
public AvroSchemaTest() throws IOException { | ||
final var eventTypeRes = new DefaultResourceLoader().getResource("event-type-schema/"); | ||
avroSchema = new AvroSchema(new AvroMapper(), new ObjectMapper(), eventTypeRes); | ||
} | ||
|
||
@Test | ||
public void testAllSchemaVersionAreLoadable() { | ||
allSchemas.entrySet().stream() | ||
.flatMap(schemaEntry -> schemaEntry.getValue().stream() | ||
.map(version -> Map.entry(schemaEntry.getKey(), version))) | ||
.forEach(schemaEntry -> Assertions.assertDoesNotThrow( | ||
() -> avroSchema.getEventTypeSchema(schemaEntry.getKey(), schemaEntry.getValue()), | ||
"Schema of " + schemaEntry.getKey() | ||
+ ", version " + schemaEntry.getValue() + " unavailable")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
log4j.rootCategory=INFO, CONSOLE | ||
|
||
LOG_PATTERN=[%d{yyyy-MM-dd HH:mm:ss.SSSXXX}] [%p] [%x] [%t] [%c] --- %m %throwable{compact} %n | ||
|
||
# CONSOLE is set to be a ConsoleAppender using a PatternLayout. | ||
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender | ||
log4j.appender.CONSOLE.layout=org.apache.log4j.EnhancedPatternLayout | ||
log4j.appender.CONSOLE.layout.ConversionPattern=${LOG_PATTERN} | ||
|
||
log4j.category.org.apache.catalina.startup.DigesterFactory=ERROR | ||
log4j.category.org.apache.catalina.util.LifecycleBase=ERROR | ||
log4j.category.org.apache.coyote.http11.Http11NioProtocol=WARN | ||
log4j.category.org.apache.tomcat.util.net.NioSelectorPool=WARN | ||
log4j.category.org.crsh.plugin=WARN | ||
log4j.category.org.crsh.ssh=WARN | ||
log4j.category.org.eclipse.jetty.util.component.AbstractLifeCycle=ERROR | ||
log4j.category.org.hibernate.validator.internal.util.Version=WARN | ||
log4j.category.org.springframework.boot.actuate.autoconfigure.CrshAutoConfiguration=WARN | ||
log4j.category.org.springframework.boot.actuate.endpoint.jmx=WARN | ||
log4j.category.org.thymeleaf=WARN | ||
log4j.category.org.zalando.nakadi=DEBUG | ||
log4j.category.org.zalando.nakadi.config=INFO | ||
log4j.category.org.apache.kafka=WARN | ||
log4j.category.org.zalando.nakadi.service.ClosedConnectionsCrutch=WARN | ||
log4j.category.org.zalando.nakadi.repository.kafka.KafkaFactory$KafkaCrutchConsumer=WARN |