Skip to content

Commit 499cc12

Browse files
committed
Added test for writing Avro data (#160)
1 parent 30a5b57 commit 499cc12

File tree

4 files changed

+591
-0
lines changed

4 files changed

+591
-0
lines changed

build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ plugins {
88
id 'com.marklogic.ml-gradle' version '4.5.0'
99
id 'jacoco'
1010
id "org.sonarqube" version "3.5.0.2730"
11+
12+
// Used to generate Avro classes. This will write classes to build/generated-test-avro-java and also add that folder
13+
// as a source root. Since this is commented out by default, the generated Avro test class has been added to
14+
// src/test/java. This only needs to be uncommented when there's a need to regenerate that class, at which point it
15+
// should be copied over to src/test/java and then this plugin should be commented out again.
16+
// id "com.github.davidmc24.gradle.plugin.avro" version "1.6.0"
1117
}
1218

1319
java {
@@ -72,6 +78,8 @@ dependencies {
7278
testImplementation "org.apache.kafka:connect-json:${kafkaVersion}"
7379
testImplementation 'net.mguenther.kafka:kafka-junit:3.2.2'
7480

81+
testImplementation "org.apache.avro:avro-compiler:1.11.1"
82+
7583
// Forcing logback to be used for test logging
7684
testImplementation "ch.qos.logback:logback-classic:1.3.5"
7785
testImplementation "org.slf4j:jcl-over-slf4j:1.7.36"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"type" : "record",
3+
"name" : "AvroTestClass",
4+
"namespace" : "com.marklogic.kafka.connect.sink",
5+
"fields" : [ {
6+
"name" : "name",
7+
"type" : "string"
8+
}, {
9+
"name" : "luckyNumber",
10+
"type" : "int"
11+
}, {
12+
"name" : "enabled",
13+
"type" : "boolean"
14+
} ]
15+
}

0 commit comments

Comments
 (0)