diff --git a/README.md b/README.md index 0f9dcf3..9b94f98 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Install the plugin (compatible with sbt 1.3+) Add the following lines to the file ``myproject/project/plugins.sbt`` in your project directory: - addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.8.4") + addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.9.0") @@ -98,7 +98,7 @@ Compile / avroScalaSpecificCustomTypes := { * `array` can be assigned to `ScalaSeq`, `ScalaArray`, `ScalaList`, and `ScalaVector` * `enum` can be assigned to `JavaEnum`, `ScalaCaseObjectEnum`, `EnumAsScalaString`, and `ScalaEnumeration` * `fixed` can be assigned to , `ScalaCaseClassWrapper` and `ScalaCaseClassWrapperWithSchema`(with schema in a companion object) -* `union` can be assigned to `OptionEitherShapelessCoproduct` and `OptionalShapelessCoproduct` +* `union` can be assigned to `OptionEitherShapelessCoproduct` (incompatible with `Specific`), `OptionalShapelessCoproduct` and `OptionScala3UnionType` (incompatible with `Standard`) * `int`, `long`, `float`, `double` can be assigned to `ScalaInt`, `ScalaLong`, `ScalaFloat`, `ScalaDouble` * `date` logical type can be assigned to `JavaTimeLocalDate` and `JavaSqlDate` * `timestamp-millis` logical type can be assigned to `JavaTimeInstant` and `JavaSqlTimestamp` diff --git a/build.sbt b/build.sbt index 9787657..c0ecae3 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,6 @@ ThisBuild / organization := "com.julianpeeters" ThisBuild / description := "Sbt plugin for compiling Avro to Scala" -ThisBuild / version := "2.8.4" +ThisBuild / version := "2.9.0" ThisBuild / versionScheme := Some("semver-spec") enablePlugins(SbtPlugin) @@ -14,8 +14,8 @@ ThisBuild / crossSbtVersions := Seq(sbtVersion.value) ThisBuild / scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature", "-Ywarn-value-discard") ThisBuild / libraryDependencies ++= Seq( - "com.julianpeeters" %% "avrohugger-core" % "2.8.4", - "com.julianpeeters" %% "avrohugger-filesorter" % "2.8.4", + "com.julianpeeters" %% "avrohugger-core" % "2.9.0", + "com.julianpeeters" %% "avrohugger-filesorter" % "2.9.0", "io.spray" %% "spray-json" % "1.3.6", "org.specs2" %% "specs2-core" % "4.20.2" % "test") diff --git a/project/build.properties b/project/build.properties index 3829f19..2a577ee 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.2 \ No newline at end of file +sbt.version=1.10.6 \ No newline at end of file diff --git a/project/gpg.sbt b/project/gpg.sbt index e1a7f31..ea1a800 100644 --- a/project/gpg.sbt +++ b/project/gpg.sbt @@ -1 +1 @@ -addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.3.0") \ No newline at end of file +addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.3.1") \ No newline at end of file diff --git a/src/sbt-test/avrohugger/GenericADTSerializationTests/project/build.properties b/src/sbt-test/avrohugger/GenericADTSerializationTests/project/build.properties index 0b699c3..e88a0d8 100644 --- a/src/sbt-test/avrohugger/GenericADTSerializationTests/project/build.properties +++ b/src/sbt-test/avrohugger/GenericADTSerializationTests/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.2 +sbt.version=1.10.6 diff --git a/src/sbt-test/avrohugger/GenericADTSerializationTests/project/plugins.sbt b/src/sbt-test/avrohugger/GenericADTSerializationTests/project/plugins.sbt index 74ab1ed..9728bd6 100644 --- a/src/sbt-test/avrohugger/GenericADTSerializationTests/project/plugins.sbt +++ b/src/sbt-test/avrohugger/GenericADTSerializationTests/project/plugins.sbt @@ -1,4 +1,4 @@ -addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.8.4") +addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.9.0") resolvers += Resolver.file("Local Ivy Repository", file(Path.userHome.absolutePath + "/.ivy2/local/"))(Resolver.ivyStylePatterns) diff --git a/src/sbt-test/avrohugger/GenericCaseObjectEnumSerializationTests/project/build.properties b/src/sbt-test/avrohugger/GenericCaseObjectEnumSerializationTests/project/build.properties index 0b699c3..e88a0d8 100644 --- a/src/sbt-test/avrohugger/GenericCaseObjectEnumSerializationTests/project/build.properties +++ b/src/sbt-test/avrohugger/GenericCaseObjectEnumSerializationTests/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.2 +sbt.version=1.10.6 diff --git a/src/sbt-test/avrohugger/GenericCaseObjectEnumSerializationTests/project/plugins.sbt b/src/sbt-test/avrohugger/GenericCaseObjectEnumSerializationTests/project/plugins.sbt index 74ab1ed..9728bd6 100644 --- a/src/sbt-test/avrohugger/GenericCaseObjectEnumSerializationTests/project/plugins.sbt +++ b/src/sbt-test/avrohugger/GenericCaseObjectEnumSerializationTests/project/plugins.sbt @@ -1,4 +1,4 @@ -addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.8.4") +addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.9.0") resolvers += Resolver.file("Local Ivy Repository", file(Path.userHome.absolutePath + "/.ivy2/local/"))(Resolver.ivyStylePatterns) diff --git a/src/sbt-test/avrohugger/GenericDecimalTaggedSerializationTests/project/build.properties b/src/sbt-test/avrohugger/GenericDecimalTaggedSerializationTests/project/build.properties index 0b699c3..e88a0d8 100644 --- a/src/sbt-test/avrohugger/GenericDecimalTaggedSerializationTests/project/build.properties +++ b/src/sbt-test/avrohugger/GenericDecimalTaggedSerializationTests/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.2 +sbt.version=1.10.6 diff --git a/src/sbt-test/avrohugger/GenericDecimalTaggedSerializationTests/project/plugins.sbt b/src/sbt-test/avrohugger/GenericDecimalTaggedSerializationTests/project/plugins.sbt index 74ab1ed..9728bd6 100644 --- a/src/sbt-test/avrohugger/GenericDecimalTaggedSerializationTests/project/plugins.sbt +++ b/src/sbt-test/avrohugger/GenericDecimalTaggedSerializationTests/project/plugins.sbt @@ -1,4 +1,4 @@ -addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.8.4") +addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.9.0") resolvers += Resolver.file("Local Ivy Repository", file(Path.userHome.absolutePath + "/.ivy2/local/"))(Resolver.ivyStylePatterns) diff --git a/src/sbt-test/avrohugger/GenericJavaEnumSerializationTests/project/build.properties b/src/sbt-test/avrohugger/GenericJavaEnumSerializationTests/project/build.properties index 0b699c3..e88a0d8 100644 --- a/src/sbt-test/avrohugger/GenericJavaEnumSerializationTests/project/build.properties +++ b/src/sbt-test/avrohugger/GenericJavaEnumSerializationTests/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.2 +sbt.version=1.10.6 diff --git a/src/sbt-test/avrohugger/GenericJavaEnumSerializationTests/project/plugins.sbt b/src/sbt-test/avrohugger/GenericJavaEnumSerializationTests/project/plugins.sbt index 74ab1ed..9728bd6 100644 --- a/src/sbt-test/avrohugger/GenericJavaEnumSerializationTests/project/plugins.sbt +++ b/src/sbt-test/avrohugger/GenericJavaEnumSerializationTests/project/plugins.sbt @@ -1,4 +1,4 @@ -addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.8.4") +addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.9.0") resolvers += Resolver.file("Local Ivy Repository", file(Path.userHome.absolutePath + "/.ivy2/local/"))(Resolver.ivyStylePatterns) diff --git a/src/sbt-test/avrohugger/GenericOptionShapelessUnionsSerializationTests/project/build.properties b/src/sbt-test/avrohugger/GenericOptionShapelessUnionsSerializationTests/project/build.properties index 0b699c3..e88a0d8 100644 --- a/src/sbt-test/avrohugger/GenericOptionShapelessUnionsSerializationTests/project/build.properties +++ b/src/sbt-test/avrohugger/GenericOptionShapelessUnionsSerializationTests/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.2 +sbt.version=1.10.6 diff --git a/src/sbt-test/avrohugger/GenericOptionShapelessUnionsSerializationTests/project/plugins.sbt b/src/sbt-test/avrohugger/GenericOptionShapelessUnionsSerializationTests/project/plugins.sbt index 74ab1ed..9728bd6 100644 --- a/src/sbt-test/avrohugger/GenericOptionShapelessUnionsSerializationTests/project/plugins.sbt +++ b/src/sbt-test/avrohugger/GenericOptionShapelessUnionsSerializationTests/project/plugins.sbt @@ -1,4 +1,4 @@ -addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.8.4") +addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.9.0") resolvers += Resolver.file("Local Ivy Repository", file(Path.userHome.absolutePath + "/.ivy2/local/"))(Resolver.ivyStylePatterns) diff --git a/src/sbt-test/avrohugger/GenericOptionalShapelessUnionsSerializationTests/project/build.properties b/src/sbt-test/avrohugger/GenericOptionalShapelessUnionsSerializationTests/project/build.properties index 0b699c3..e88a0d8 100644 --- a/src/sbt-test/avrohugger/GenericOptionalShapelessUnionsSerializationTests/project/build.properties +++ b/src/sbt-test/avrohugger/GenericOptionalShapelessUnionsSerializationTests/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.2 +sbt.version=1.10.6 diff --git a/src/sbt-test/avrohugger/GenericOptionalShapelessUnionsSerializationTests/project/plugins.sbt b/src/sbt-test/avrohugger/GenericOptionalShapelessUnionsSerializationTests/project/plugins.sbt index 74ab1ed..9728bd6 100644 --- a/src/sbt-test/avrohugger/GenericOptionalShapelessUnionsSerializationTests/project/plugins.sbt +++ b/src/sbt-test/avrohugger/GenericOptionalShapelessUnionsSerializationTests/project/plugins.sbt @@ -1,4 +1,4 @@ -addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.8.4") +addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.9.0") resolvers += Resolver.file("Local Ivy Repository", file(Path.userHome.absolutePath + "/.ivy2/local/"))(Resolver.ivyStylePatterns) diff --git a/src/sbt-test/avrohugger/GenericSerializationTests/project/build.properties b/src/sbt-test/avrohugger/GenericSerializationTests/project/build.properties index 0b699c3..e88a0d8 100644 --- a/src/sbt-test/avrohugger/GenericSerializationTests/project/build.properties +++ b/src/sbt-test/avrohugger/GenericSerializationTests/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.2 +sbt.version=1.10.6 diff --git a/src/sbt-test/avrohugger/GenericSerializationTests/project/plugins.sbt b/src/sbt-test/avrohugger/GenericSerializationTests/project/plugins.sbt index 74ab1ed..9728bd6 100644 --- a/src/sbt-test/avrohugger/GenericSerializationTests/project/plugins.sbt +++ b/src/sbt-test/avrohugger/GenericSerializationTests/project/plugins.sbt @@ -1,4 +1,4 @@ -addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.8.4") +addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.9.0") resolvers += Resolver.file("Local Ivy Repository", file(Path.userHome.absolutePath + "/.ivy2/local/"))(Resolver.ivyStylePatterns) diff --git a/src/sbt-test/avrohugger/GenericStringEnumSerializationTests/project/build.properties b/src/sbt-test/avrohugger/GenericStringEnumSerializationTests/project/build.properties index 0b699c3..e88a0d8 100644 --- a/src/sbt-test/avrohugger/GenericStringEnumSerializationTests/project/build.properties +++ b/src/sbt-test/avrohugger/GenericStringEnumSerializationTests/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.2 +sbt.version=1.10.6 diff --git a/src/sbt-test/avrohugger/GenericStringEnumSerializationTests/project/plugins.sbt b/src/sbt-test/avrohugger/GenericStringEnumSerializationTests/project/plugins.sbt index 74ab1ed..9728bd6 100644 --- a/src/sbt-test/avrohugger/GenericStringEnumSerializationTests/project/plugins.sbt +++ b/src/sbt-test/avrohugger/GenericStringEnumSerializationTests/project/plugins.sbt @@ -1,4 +1,4 @@ -addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.8.4") +addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.9.0") resolvers += Resolver.file("Local Ivy Repository", file(Path.userHome.absolutePath + "/.ivy2/local/"))(Resolver.ivyStylePatterns) diff --git a/src/sbt-test/avrohugger/OverrideSettings/project/build.properties b/src/sbt-test/avrohugger/OverrideSettings/project/build.properties index 0b699c3..e88a0d8 100644 --- a/src/sbt-test/avrohugger/OverrideSettings/project/build.properties +++ b/src/sbt-test/avrohugger/OverrideSettings/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.2 +sbt.version=1.10.6 diff --git a/src/sbt-test/avrohugger/OverrideSettings/project/plugins.sbt b/src/sbt-test/avrohugger/OverrideSettings/project/plugins.sbt index 21c66a1..e976db6 100644 --- a/src/sbt-test/avrohugger/OverrideSettings/project/plugins.sbt +++ b/src/sbt-test/avrohugger/OverrideSettings/project/plugins.sbt @@ -1,3 +1,3 @@ -addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.8.4") +addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.9.0") resolvers += Resolver.file("Local Ivy Repository", file("~/.ivy2/local/"))(Resolver.ivyStylePatterns) diff --git a/src/sbt-test/avrohugger/SpecificADTSerializationTests/project/build.properties b/src/sbt-test/avrohugger/SpecificADTSerializationTests/project/build.properties index 0b699c3..e88a0d8 100644 --- a/src/sbt-test/avrohugger/SpecificADTSerializationTests/project/build.properties +++ b/src/sbt-test/avrohugger/SpecificADTSerializationTests/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.2 +sbt.version=1.10.6 diff --git a/src/sbt-test/avrohugger/SpecificADTSerializationTests/project/plugins.sbt b/src/sbt-test/avrohugger/SpecificADTSerializationTests/project/plugins.sbt index 74ab1ed..9728bd6 100644 --- a/src/sbt-test/avrohugger/SpecificADTSerializationTests/project/plugins.sbt +++ b/src/sbt-test/avrohugger/SpecificADTSerializationTests/project/plugins.sbt @@ -1,4 +1,4 @@ -addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.8.4") +addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.9.0") resolvers += Resolver.file("Local Ivy Repository", file(Path.userHome.absolutePath + "/.ivy2/local/"))(Resolver.ivyStylePatterns) diff --git a/src/sbt-test/avrohugger/SpecificOptionScala3UnionTypeSerializationTests/README.md b/src/sbt-test/avrohugger/SpecificOptionScala3UnionTypeSerializationTests/README.md new file mode 100644 index 0000000..9b4ae93 --- /dev/null +++ b/src/sbt-test/avrohugger/SpecificOptionScala3UnionTypeSerializationTests/README.md @@ -0,0 +1,2 @@ +Supplemental integration tests. sbt-avrohugger must be updated with any +changes made to avrohugger that need to be tested in a real-world project. \ No newline at end of file diff --git a/src/sbt-test/avrohugger/SpecificOptionScala3UnionTypeSerializationTests/build.sbt b/src/sbt-test/avrohugger/SpecificOptionScala3UnionTypeSerializationTests/build.sbt new file mode 100644 index 0000000..d32bbe9 --- /dev/null +++ b/src/sbt-test/avrohugger/SpecificOptionScala3UnionTypeSerializationTests/build.sbt @@ -0,0 +1,24 @@ +import avrohugger.types.{OptionScala3UnionType, ScalaADT} + +Compile / sourceGenerators += (Compile / avroScalaGenerateSpecific).taskValue + +organization := "com.julianpeeters" + +name := "datatype-avro-serializaton-tests" + +version := "0.4-SNAPSHOT" + +scalaVersion := "3.3.4" + +scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature") + +libraryDependencies += "org.apache.avro" % "avro" % "1.11.4" + +libraryDependencies += "org.specs2" %% "specs2-core" % "4.20.2" % Test + +Compile / avroScalaSpecificCustomTypes := { + avrohugger.format.Standard.defaultTypes.copy( + union = OptionScala3UnionType, + protocol = ScalaADT + ) +} \ No newline at end of file diff --git a/src/sbt-test/avrohugger/SpecificOptionScala3UnionTypeSerializationTests/project/build.properties b/src/sbt-test/avrohugger/SpecificOptionScala3UnionTypeSerializationTests/project/build.properties new file mode 100644 index 0000000..e88a0d8 --- /dev/null +++ b/src/sbt-test/avrohugger/SpecificOptionScala3UnionTypeSerializationTests/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.10.6 diff --git a/src/sbt-test/avrohugger/SpecificOptionScala3UnionTypeSerializationTests/project/plugins.sbt b/src/sbt-test/avrohugger/SpecificOptionScala3UnionTypeSerializationTests/project/plugins.sbt new file mode 100644 index 0000000..9728bd6 --- /dev/null +++ b/src/sbt-test/avrohugger/SpecificOptionScala3UnionTypeSerializationTests/project/plugins.sbt @@ -0,0 +1,5 @@ +addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.9.0") + +resolvers += Resolver.file("Local Ivy Repository", file(Path.userHome.absolutePath + "/.ivy2/local/"))(Resolver.ivyStylePatterns) + + diff --git a/src/sbt-test/avrohugger/SpecificOptionScala3UnionTypeSerializationTests/src/main/avro/unions_with_coproduct2.avsc b/src/sbt-test/avrohugger/SpecificOptionScala3UnionTypeSerializationTests/src/main/avro/unions_with_coproduct2.avsc new file mode 100644 index 0000000..53f9a75 --- /dev/null +++ b/src/sbt-test/avrohugger/SpecificOptionScala3UnionTypeSerializationTests/src/main/avro/unions_with_coproduct2.avsc @@ -0,0 +1,33 @@ +[ + { + "namespace": "com.example.avrohugger", + "name": "NonNullUnion", + "type": "record", + "fields": [ + { + "name": "r6", + "type": [ + "boolean", + "int", + "string" + ] + } + ] + }, + { + "namespace": "com.example.avrohugger", + "name": "NullableUnion", + "type": "record", + "fields": [ + { + "name": "r7", + "type": [ + "null", + "boolean", + "int", + "string" + ] + } + ] + } +] diff --git a/src/sbt-test/avrohugger/SpecificOptionScala3UnionTypeSerializationTests/src/test/scala/test/SpecificTestUtil.scala b/src/sbt-test/avrohugger/SpecificOptionScala3UnionTypeSerializationTests/src/test/scala/test/SpecificTestUtil.scala new file mode 100644 index 0000000..450b5f9 --- /dev/null +++ b/src/sbt-test/avrohugger/SpecificOptionScala3UnionTypeSerializationTests/src/test/scala/test/SpecificTestUtil.scala @@ -0,0 +1,72 @@ +package test + +import java.io.File + +import org.apache.avro.io.{DecoderFactory, EncoderFactory} +import org.apache.avro.generic.{ GenericDatumReader, GenericRecord} +import org.apache.avro.specific.{ + SpecificDatumReader, + SpecificDatumWriter, + SpecificRecordBase +} +import org.apache.avro.Schema +import org.apache.avro.file.{ DataFileReader, DataFileWriter } + +import org.specs2.mutable.Specification + +object SpecificTestUtil extends Specification { + + def write[T <: SpecificRecordBase](file: File, records: List[T]) = { + val userDatumWriter = new SpecificDatumWriter[T] + val dataFileWriter = new DataFileWriter[T](userDatumWriter) + dataFileWriter.create(records.head.getSchema, file); + records.foreach(record => dataFileWriter.append(record)) + dataFileWriter.close(); + } + + def read[T <: SpecificRecordBase](file: File, records: List[T]) = { + val dummyRecord = new GenericDatumReader[GenericRecord] + val schema = new DataFileReader(file, dummyRecord).getSchema + val userDatumReader = new SpecificDatumReader[T](schema) + val dataFileReader = new DataFileReader[T](file, userDatumReader) + // Adapted from: https://github.com/tackley/avrohugger-list-issue/blob/master/src/main/scala/net/tackley/Reader.scala + // This isn't great scala, but represents how org.apache.avro.mapred.AvroInputFormat + // (via org.apache.avro.file.DataFileStream) interacts with the SpecificDatumReader. + var record: T = null.asInstanceOf[T] + var sameRecord: T = null.asInstanceOf[T] + val recordIter = records.iterator + while (dataFileReader.hasNext) { + sameRecord = dataFileReader.next(sameRecord) + record = recordIter.next() + } + dataFileReader.close() + sameRecord.equals(record) + } + + def verifyWriteAndRead[T <: SpecificRecordBase](records: List[T]) = { + val fileName = s"${records.head.getClass.getName}" + val fileEnding = "avro" + val file = File.createTempFile(fileName, fileEnding) + file.deleteOnExit() + write(file, records) + read(file, records) + } + + def verifyEncodeDecode[T <: SpecificRecordBase](record: T) = { + val schema = record.getSchema + val writer = new SpecificDatumWriter[T](schema) + val out = new java.io.ByteArrayOutputStream() + val encoder = EncoderFactory.get().binaryEncoder(out, null) + writer.write(record, encoder) + encoder.flush + val ba = out.toByteArray + ba.size must ===(1) + ba(0) must ===(0) + out.close + val reader = new SpecificDatumReader[T](schema) + val decoder = DecoderFactory.get().binaryDecoder(ba, null) + val decoded = reader.read(record, decoder) + decoded must ===(record) + } + +} diff --git a/src/sbt-test/avrohugger/SpecificOptionScala3UnionTypeSerializationTests/src/test/scala/test/specific/SpecificSpec.scala b/src/sbt-test/avrohugger/SpecificOptionScala3UnionTypeSerializationTests/src/test/scala/test/specific/SpecificSpec.scala new file mode 100644 index 0000000..53103ce --- /dev/null +++ b/src/sbt-test/avrohugger/SpecificOptionScala3UnionTypeSerializationTests/src/test/scala/test/specific/SpecificSpec.scala @@ -0,0 +1,30 @@ +package test.specific + +import com.example.avrohugger.{NonNullUnion, NullableUnion} +import org.specs2.mutable.Specification +import test.SpecificTestUtil + +class SpecificSpec extends Specification { + + "A case class with multiple non null types" should { + "serialize and deserialize correctly" in { + val record1 = NonNullUnion(true) + val record2 = NonNullUnion(1) + val record3 = NonNullUnion("abc") + val records = List(record1, record2, record3) + SpecificTestUtil.verifyWriteAndRead(records) + } + } + + "A case class with multiple nullable types" should { + "serialize and deserialize correctly" in { + val record1 = NullableUnion(Some(true)) + val record2 = NullableUnion(Some(1)) + val record3 = NullableUnion(Some("abc")) + val record4 = NullableUnion(None) + val records = List(record1, record2, record3, record4) + SpecificTestUtil.verifyWriteAndRead(records) + } + } + +} diff --git a/src/sbt-test/avrohugger/SpecificOptionScala3UnionTypeSerializationTests/test b/src/sbt-test/avrohugger/SpecificOptionScala3UnionTypeSerializationTests/test new file mode 100644 index 0000000..b013eac --- /dev/null +++ b/src/sbt-test/avrohugger/SpecificOptionScala3UnionTypeSerializationTests/test @@ -0,0 +1,7 @@ +> ++3.3.4 + +> update + +> clean + +> test diff --git a/src/sbt-test/avrohugger/SpecificSerializationTests/project/build.properties b/src/sbt-test/avrohugger/SpecificSerializationTests/project/build.properties index 3829f19..2a577ee 100644 --- a/src/sbt-test/avrohugger/SpecificSerializationTests/project/build.properties +++ b/src/sbt-test/avrohugger/SpecificSerializationTests/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.2 \ No newline at end of file +sbt.version=1.10.6 \ No newline at end of file diff --git a/src/sbt-test/avrohugger/SpecificSerializationTests/project/plugins.sbt b/src/sbt-test/avrohugger/SpecificSerializationTests/project/plugins.sbt index 74ab1ed..9728bd6 100644 --- a/src/sbt-test/avrohugger/SpecificSerializationTests/project/plugins.sbt +++ b/src/sbt-test/avrohugger/SpecificSerializationTests/project/plugins.sbt @@ -1,4 +1,4 @@ -addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.8.4") +addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.9.0") resolvers += Resolver.file("Local Ivy Repository", file(Path.userHome.absolutePath + "/.ivy2/local/"))(Resolver.ivyStylePatterns) diff --git a/src/sbt-test/avrohugger/SpecificSerializationTests/src/main/avro/defaults.avdl b/src/sbt-test/avrohugger/SpecificSerializationTests/src/main/avro/defaults.avdl index 0c6e248..f75b079 100644 --- a/src/sbt-test/avrohugger/SpecificSerializationTests/src/main/avro/defaults.avdl +++ b/src/sbt-test/avrohugger/SpecificSerializationTests/src/main/avro/defaults.avdl @@ -25,4 +25,4 @@ protocol Defaults { bytes byt = "\u00FF"; fix1 fx; } -} +} \ No newline at end of file diff --git a/src/sbt-test/avrohugger/SpecificStringEnumSerializationTests/project/build.properties b/src/sbt-test/avrohugger/SpecificStringEnumSerializationTests/project/build.properties index 0b699c3..e88a0d8 100644 --- a/src/sbt-test/avrohugger/SpecificStringEnumSerializationTests/project/build.properties +++ b/src/sbt-test/avrohugger/SpecificStringEnumSerializationTests/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.2 +sbt.version=1.10.6 diff --git a/src/sbt-test/avrohugger/SpecificStringEnumSerializationTests/project/plugins.sbt b/src/sbt-test/avrohugger/SpecificStringEnumSerializationTests/project/plugins.sbt index 74ab1ed..9728bd6 100644 --- a/src/sbt-test/avrohugger/SpecificStringEnumSerializationTests/project/plugins.sbt +++ b/src/sbt-test/avrohugger/SpecificStringEnumSerializationTests/project/plugins.sbt @@ -1,4 +1,4 @@ -addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.8.4") +addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.9.0") resolvers += Resolver.file("Local Ivy Repository", file(Path.userHome.absolutePath + "/.ivy2/local/"))(Resolver.ivyStylePatterns) diff --git a/src/sbt-test/avrohugger/SpecificVectorSerializationTests/project/build.properties b/src/sbt-test/avrohugger/SpecificVectorSerializationTests/project/build.properties index 0b699c3..e88a0d8 100644 --- a/src/sbt-test/avrohugger/SpecificVectorSerializationTests/project/build.properties +++ b/src/sbt-test/avrohugger/SpecificVectorSerializationTests/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.2 +sbt.version=1.10.6 diff --git a/src/sbt-test/avrohugger/SpecificVectorSerializationTests/project/plugins.sbt b/src/sbt-test/avrohugger/SpecificVectorSerializationTests/project/plugins.sbt index 74ab1ed..9728bd6 100644 --- a/src/sbt-test/avrohugger/SpecificVectorSerializationTests/project/plugins.sbt +++ b/src/sbt-test/avrohugger/SpecificVectorSerializationTests/project/plugins.sbt @@ -1,4 +1,4 @@ -addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.8.4") +addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.9.0") resolvers += Resolver.file("Local Ivy Repository", file(Path.userHome.absolutePath + "/.ivy2/local/"))(Resolver.ivyStylePatterns) diff --git a/src/sbt-test/avrohugger/filesorter/project/build.properties b/src/sbt-test/avrohugger/filesorter/project/build.properties index 3829f19..2a577ee 100644 --- a/src/sbt-test/avrohugger/filesorter/project/build.properties +++ b/src/sbt-test/avrohugger/filesorter/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.2 \ No newline at end of file +sbt.version=1.10.6 \ No newline at end of file diff --git a/src/sbt-test/avrohugger/filesorter/project/plugins.sbt b/src/sbt-test/avrohugger/filesorter/project/plugins.sbt index 6cf6a52..b0354da 100644 --- a/src/sbt-test/avrohugger/filesorter/project/plugins.sbt +++ b/src/sbt-test/avrohugger/filesorter/project/plugins.sbt @@ -1 +1 @@ -addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.8.4") \ No newline at end of file +addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.9.0") \ No newline at end of file diff --git a/src/sbt-test/sbt-avrohugger/module/project/build.properties b/src/sbt-test/sbt-avrohugger/module/project/build.properties index 0b699c3..e88a0d8 100644 --- a/src/sbt-test/sbt-avrohugger/module/project/build.properties +++ b/src/sbt-test/sbt-avrohugger/module/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.2 +sbt.version=1.10.6 diff --git a/src/sbt-test/sbt-avrohugger/overridesettings/project/build.properties b/src/sbt-test/sbt-avrohugger/overridesettings/project/build.properties index 0b699c3..e88a0d8 100644 --- a/src/sbt-test/sbt-avrohugger/overridesettings/project/build.properties +++ b/src/sbt-test/sbt-avrohugger/overridesettings/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.2 +sbt.version=1.10.6 diff --git a/src/sbt-test/sbt-avrohugger/overridesettings/project/plugins.sbt b/src/sbt-test/sbt-avrohugger/overridesettings/project/plugins.sbt index 6cf6a52..b0354da 100644 --- a/src/sbt-test/sbt-avrohugger/overridesettings/project/plugins.sbt +++ b/src/sbt-test/sbt-avrohugger/overridesettings/project/plugins.sbt @@ -1 +1 @@ -addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.8.4") \ No newline at end of file +addSbtPlugin("com.julianpeeters" % "sbt-avrohugger" % "2.9.0") \ No newline at end of file diff --git a/src/sbt-test/sbt-avrohugger/specific/project/build.properties b/src/sbt-test/sbt-avrohugger/specific/project/build.properties index 0b699c3..e88a0d8 100644 --- a/src/sbt-test/sbt-avrohugger/specific/project/build.properties +++ b/src/sbt-test/sbt-avrohugger/specific/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.2 +sbt.version=1.10.6 diff --git a/src/sbt-test/sbt-avrohugger/standard/project/build.properties b/src/sbt-test/sbt-avrohugger/standard/project/build.properties index 0b699c3..e88a0d8 100644 --- a/src/sbt-test/sbt-avrohugger/standard/project/build.properties +++ b/src/sbt-test/sbt-avrohugger/standard/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.2 +sbt.version=1.10.6