diff --git a/avro-resources/src/main/scala/com/skraba/avro/enchiridion/resources/AvroTestResources.scala b/avro-resources/src/main/scala/com/skraba/avro/enchiridion/resources/AvroTestResources.scala
index 6ecc3e1..7422f4d 100644
--- a/avro-resources/src/main/scala/com/skraba/avro/enchiridion/resources/AvroTestResources.scala
+++ b/avro-resources/src/main/scala/com/skraba/avro/enchiridion/resources/AvroTestResources.scala
@@ -336,61 +336,57 @@ object AvroTestResources {
Base
.resolve("plugin/src/test/avro/com/skraba/avro/enchiridion/simple")
.createDirectory()
- .resolve("SimpleEnum.avsc")
+ .resolve("DateLogicalTypeOptionalRecord.avsc")
.toFile
- .writeAll(Json.prettyPrint(Json.parse(SimpleEnum)))
+ .writeAll(Json.prettyPrint(DateLogicalTypeOptionalRecord))
Base
.resolve("plugin/src/test/avro/com/skraba/avro/enchiridion/simple")
.createDirectory()
- .resolve("SimpleFixed.avsc")
+ .resolve("DateLogicalTypeRecord.avsc")
.toFile
- .writeAll(Json.prettyPrint(Json.parse(SimpleFixed)))
+ .writeAll(Json.prettyPrint(DateLogicalTypeRecord))
Base
.resolve("plugin/src/test/avro/com/skraba/avro/enchiridion/simple")
.createDirectory()
- .resolve("SimpleEnum.avsc")
+ .resolve("DecimalLogicalTypeRecord.avsc")
.toFile
- .writeAll(Json.prettyPrint(Json.parse(SimpleRecord)))
-
+ .writeAll(Json.prettyPrint(DecimalLogicalTypeRecord))
Base
.resolve("plugin/src/main/avro/com/skraba/avro/enchiridion/recipe")
.createDirectory()
.resolve("Recipe.avsc")
.toFile
.writeAll(Json.prettyPrint(Json.parse(Recipe)))
-
Base
.resolve("plugin/src/test/avro/com/skraba/avro/enchiridion/simple")
.createDirectory()
- .resolve("DateLogicalTypeRecord.avsc")
+ .resolve("SimpleEnum.avsc")
.toFile
- .writeAll(Json.prettyPrint(DateLogicalTypeRecord))
-
+ .writeAll(Json.prettyPrint(Json.parse(SimpleEnum)))
Base
.resolve("plugin/src/test/avro/com/skraba/avro/enchiridion/simple")
.createDirectory()
- .resolve("DateLogicalTypeOptionalRecord.avsc")
+ .resolve("SimpleFixed.avsc")
.toFile
- .writeAll(Json.prettyPrint(DateLogicalTypeOptionalRecord))
-
+ .writeAll(Json.prettyPrint(Json.parse(SimpleFixed)))
Base
.resolve("plugin/src/test/avro/com/skraba/avro/enchiridion/simple")
.createDirectory()
- .resolve("DecimalLogicalTypeRecord.avsc")
+ .resolve("SimpleRecord.avsc")
.toFile
- .writeAll(Json.prettyPrint(DecimalLogicalTypeRecord))
+ .writeAll(Json.prettyPrint(Json.parse(SimpleRecord)))
// Rewrite this source itself with prettified JSON.
val schemasToPrettify: Map[String, String] = Map(
+ "Avro1965" -> Avro1965,
+ "Avro2299CanonicalMisplacedSize" -> Avro2299CanonicalMisplacedSize,
+ "Recursive" -> Recursive,
+ "RecursiveIndirect" -> RecursiveIndirect,
"SimpleArray" -> SimpleArray,
"SimpleEnum" -> SimpleEnum,
"SimpleFixed" -> SimpleFixed,
"SimpleMap" -> SimpleMap,
- "SimpleRecord" -> SimpleRecord,
- "Recursive" -> Recursive,
- "RecursiveIndirect" -> RecursiveIndirect,
- "Avro1965" -> Avro1965,
- "Avro2299CanonicalMisplacedSize" -> Avro2299CanonicalMisplacedSize
+ "SimpleRecord" -> SimpleRecord
)
ThisFile.writeAll(
{
diff --git a/core-master-snapshot/pom.xml b/core-master-snapshot/pom.xml
index b33a6f5..5aefd2d 100644
--- a/core-master-snapshot/pom.xml
+++ b/core-master-snapshot/pom.xml
@@ -17,7 +17,7 @@
false
1.11
- 1.12.0-SNAPSHOT
+ 1.13.0-SNAPSHOT
diff --git a/core-master-snapshot/src/test/java/com/skraba/avro/enchiridion/coresnapshot/AggregatedSnapshotTest.java b/core-master-snapshot/src/test/java/com/skraba/avro/enchiridion/coresnapshot/AggregatedSnapshotTest.java
index e34ad46..a328314 100644
--- a/core-master-snapshot/src/test/java/com/skraba/avro/enchiridion/coresnapshot/AggregatedSnapshotTest.java
+++ b/core-master-snapshot/src/test/java/com/skraba/avro/enchiridion/coresnapshot/AggregatedSnapshotTest.java
@@ -11,7 +11,7 @@ public class AggregatedSnapshotTest extends Aggregated {
@Test
public void testAvroVersion() {
assertThat(AvroVersion.avro_infinity.before("Next major version"), is(true));
- assertThat(AvroVersion.avro_1_12.orAfter("This major version"), is(true));
- assertThat(AvroVersion.getInstalledAvro(), is(AvroVersion.avro_1_12));
+ assertThat(AvroVersion.avro_1_13.orAfter("This major version"), is(true));
+ assertThat(AvroVersion.getInstalledAvro(), is(AvroVersion.avro_1_13));
}
}
diff --git a/core/src/test/java/com/skraba/avro/enchiridion/core/SerializeToBytesTest.java b/core/src/test/java/com/skraba/avro/enchiridion/core/SerializeToBytesTest.java
index cd98f85..0d4bee9 100644
--- a/core/src/test/java/com/skraba/avro/enchiridion/core/SerializeToBytesTest.java
+++ b/core/src/test/java/com/skraba/avro/enchiridion/core/SerializeToBytesTest.java
@@ -10,6 +10,7 @@
import java.nio.ByteBuffer;
import java.util.*;
import java.util.function.Function;
+import org.apache.avro.AvroTypeException;
import org.apache.avro.Schema;
import org.apache.avro.SchemaBuilder;
import org.apache.avro.generic.*;
@@ -637,13 +638,18 @@ public void testRoundTripEnum() {
assertThat((GenericEnumSymbol>) fromBytes(GenericData.get(), schema, value))
.hasToString("W"));
- // TODO: The error message here doesn't seem quite right! Raise an AVRO JIRA?
- assertThatThrownBy(() -> toBytes(schema, new GenericData.EnumSymbol(schema, "A")))
- .isInstanceOf(NullPointerException.class)
- .hasMessageContaining(
- AvroVersion.avro_1_11.before("Changed exception message in 1.11.1")
- ? "null of E1"
- : "null value for (non-nullable) E1");
+ if (AvroVersion.avro_1_12.orAfter("Changed exception type in 1.12.0")) {
+ assertThatThrownBy(() -> toBytes(schema, new GenericData.EnumSymbol(schema, "A")))
+ .isInstanceOf(AvroTypeException.class)
+ .hasMessageContaining("enum value 'A' is not in the enum symbol set: [Z, Y, X, W]");
+ } else {
+ assertThatThrownBy(() -> toBytes(schema, new GenericData.EnumSymbol(schema, "A")))
+ .isInstanceOf(NullPointerException.class)
+ .hasMessageContaining(
+ AvroVersion.avro_1_11.before("Changed exception message in 1.11.1")
+ ? "null of E1"
+ : "null value for (non-nullable) E1");
+ }
}
@Test
diff --git a/core/src/test/java/com/skraba/avro/enchiridion/core/schema/ParserTest.java b/core/src/test/java/com/skraba/avro/enchiridion/core/schema/ParserTest.java
index cc06253..9b3c8ca 100644
--- a/core/src/test/java/com/skraba/avro/enchiridion/core/schema/ParserTest.java
+++ b/core/src/test/java/com/skraba/avro/enchiridion/core/schema/ParserTest.java
@@ -10,6 +10,7 @@
import static org.hamcrest.Matchers.*;
import static org.junit.jupiter.api.Assertions.assertThrows;
+import com.skraba.avro.enchiridion.testkit.AvroVersion;
import org.apache.avro.Schema;
import org.apache.avro.SchemaParseException;
import org.apache.avro.generic.GenericData;
@@ -36,6 +37,8 @@ public void testBasicString() {
@Test
public void testNotCaseInsensitive() {
- assertThrows(SchemaParseException.class, () -> api().parse(qqify("'String'")));
+ if (AvroVersion.avro_1_12.before("TODO: Is this an error in 1.12.0?"))
+ assertThrows(SchemaParseException.class, () -> api().parse(qqify("'String'")));
+ else assertThrows(NullPointerException.class, () -> api().parse(qqify("'String'")));
}
}
diff --git a/core111x/pom.xml b/core111x/pom.xml
new file mode 100644
index 0000000..f802894
--- /dev/null
+++ b/core111x/pom.xml
@@ -0,0 +1,45 @@
+
+
+ 4.0.0
+
+
+ com.skraba.avro.enchiridion
+ avro-enchiridion
+ 0.0.1-SNAPSHOT
+
+
+ avro-enchiridion-core111x
+ jar
+
+ Avro Enchiridion :: Core 1.11.x
+ Avro core examples with the latest 1.11.x version.
+
+
+ false
+ 1.11
+ 1.11.4
+
+
+
+
+ org.apache.avro
+ avro
+
+
+
+
+ com.skraba.avro.enchiridion
+ avro-enchiridion-core
+ ${project.version}
+ test-jar
+ test
+
+
+ com.skraba.avro.enchiridion
+ avro-enchiridion-testkit
+ ${project.version}
+ test
+
+
+
+
diff --git a/core111x/readme.md b/core111x/readme.md
new file mode 100644
index 0000000..be547bc
--- /dev/null
+++ b/core111x/readme.md
@@ -0,0 +1,4 @@
+Core 1.11.x Tests
+==============================================================================
+
+Runs some or all of the [Avro core](../core/readme.md) tests using Avro 1.11.x libraries.
diff --git a/core111x/src/test/java/com/skraba/avro/enchiridion/core111x/Aggregated111Test.java b/core111x/src/test/java/com/skraba/avro/enchiridion/core111x/Aggregated111Test.java
new file mode 100644
index 0000000..be1a63e
--- /dev/null
+++ b/core111x/src/test/java/com/skraba/avro/enchiridion/core111x/Aggregated111Test.java
@@ -0,0 +1,20 @@
+package com.skraba.avro.enchiridion.core111x;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+
+import com.skraba.avro.enchiridion.core.Aggregated;
+import com.skraba.avro.enchiridion.testkit.AvroVersion;
+import org.junit.jupiter.api.Test;
+
+public class Aggregated111Test extends Aggregated {
+
+ @Test
+ public void testAvroVersion() {
+ assertThat(AvroVersion.avro_1_11.before("This major version"), is(false));
+ assertThat(AvroVersion.avro_1_11.orAfter("This major version"), is(true));
+ assertThat(AvroVersion.avro_1_12.before("Next major version"), is(true));
+ assertThat(AvroVersion.avro_1_12.orAfter("Next major version"), is(false));
+ assertThat(AvroVersion.getInstalledAvro(), is(AvroVersion.avro_1_11));
+ }
+}
diff --git a/plugin/pom.xml b/plugin/pom.xml
index c4ac075..cf31be7 100644
--- a/plugin/pom.xml
+++ b/plugin/pom.xml
@@ -41,6 +41,12 @@
avro-enchiridion-resources
${project.version}
+
+ com.skraba.avro.enchiridion
+ avro-enchiridion-testkit
+ ${project.version}
+ test
+
diff --git a/plugin/src/test/avro/com/skraba/avro/enchiridion/simple/SimpleEnum.avsc b/plugin/src/test/avro/com/skraba/avro/enchiridion/simple/SimpleEnum.avsc
index 80062db..c0d34c3 100644
--- a/plugin/src/test/avro/com/skraba/avro/enchiridion/simple/SimpleEnum.avsc
+++ b/plugin/src/test/avro/com/skraba/avro/enchiridion/simple/SimpleEnum.avsc
@@ -1,13 +1,6 @@
{
- "type" : "record",
- "name" : "SimpleRecord",
+ "type" : "enum",
+ "name" : "SimpleEnum",
"namespace" : "com.skraba.avro.enchiridion.simple",
- "doc" : "Simple two column record",
- "fields" : [ {
- "name" : "id",
- "type" : "long"
- }, {
- "name" : "name",
- "type" : "string"
- } ]
+ "symbols" : [ "e1", "e2", "e3" ]
}
\ No newline at end of file
diff --git a/plugin/src/test/java/com/skraba/avro/enchiridion/plugin/Avro2956ReservedKeywordTest.java b/plugin/src/test/java/com/skraba/avro/enchiridion/plugin/Avro2956ReservedKeywordTest.java
index c60a555..6b5a06d 100644
--- a/plugin/src/test/java/com/skraba/avro/enchiridion/plugin/Avro2956ReservedKeywordTest.java
+++ b/plugin/src/test/java/com/skraba/avro/enchiridion/plugin/Avro2956ReservedKeywordTest.java
@@ -3,14 +3,14 @@
import static com.skraba.avro.enchiridion.plugin.SimpleRecordTest.fromBytes;
import static com.skraba.avro.enchiridion.plugin.SimpleRecordTest.toBytes;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.containsString;
-import static org.hamcrest.Matchers.instanceOf;
-import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.*;
import static org.junit.jupiter.api.Assertions.assertThrows;
import com.skraba.avro.enchiridion.iddl.goto$.case$;
import com.skraba.avro.enchiridion.idl.Avro2956ReservedKeywordWrapper;
import com.skraba.avro.enchiridion.idl.break$.static$;
+import com.skraba.avro.enchiridion.testkit.AvroVersion;
+import com.skraba.avro.enchiridion.testkit.EnabledForAvroVersion;
import org.apache.avro.generic.GenericData;
import org.apache.avro.generic.GenericRecord;
import org.apache.avro.specific.SpecificData;
@@ -20,6 +20,7 @@
public class Avro2956ReservedKeywordTest {
@Test
+ @EnabledForAvroVersion(until = AvroVersion.avro_1_12, reason = "Fixed in Avro 1.12.0")
public void testBasic() {
// Start with a simple serialized long.
diff --git a/pom.xml b/pom.xml
index 47b51c4..eec1066 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,6 +13,7 @@
avro-resources
core
core-master-snapshot
+ core111x
core110x
core19x
core18x
@@ -37,7 +38,7 @@
3.23.1
- 1.11.3
+ 1.12.0
0.6.0.20150202
2.2
2.11.1
@@ -204,6 +205,11 @@
+
+ org.scala-lang
+ scala-compiler
+ ${scala.version}
+
org.scala-lang
scala-library
diff --git a/testkit/src/main/java/com/skraba/avro/enchiridion/testkit/AvroVersion.java b/testkit/src/main/java/com/skraba/avro/enchiridion/testkit/AvroVersion.java
index d5cdf71..0e0170b 100644
--- a/testkit/src/main/java/com/skraba/avro/enchiridion/testkit/AvroVersion.java
+++ b/testkit/src/main/java/com/skraba/avro/enchiridion/testkit/AvroVersion.java
@@ -22,6 +22,7 @@ public enum AvroVersion {
avro_1_10,
avro_1_11,
avro_1_12,
+ avro_1_13,
/** An avro version far, far off in the future. */
avro_infinity;