forked from julianpeeters/avro-scala-macro-annotations
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow a record to have fields of types defined in separate .avsc files
Alt solution to julianpeeters#31
- Loading branch information
Showing
8 changed files
with
86 additions
and
19 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
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"type": "record", | ||
"name": "SeparateMetaData", | ||
"namespace": "test", | ||
"fields": [ | ||
{"name": "source", "type": "string"}, | ||
{"name": "timestamp", "type": "string"} | ||
] | ||
} |
12 changes: 12 additions & 0 deletions
12
tests/src/test/resources/separate/SeparateTestMessage.avsc
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,12 @@ | ||
{ | ||
"type": "record", | ||
"name": "SeparateTestMessage", | ||
"namespace": "test", | ||
"fields": [ | ||
{"name": "message", "type": "string"}, | ||
{ | ||
"name": "metaData", | ||
"type": "SeparateMetaData" | ||
} | ||
] | ||
} |
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
18 changes: 18 additions & 0 deletions
18
.../src/test/scala/AvroTypeProviderTests/AvroTypeProviderNestedSeparateSchemaFilesTest.scala
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,18 @@ | ||
|
||
package test | ||
// Specs2 | ||
import org.specs2.mutable.Specification | ||
|
||
import java.io.File | ||
|
||
import com.julianpeeters.avro.annotations._ | ||
|
||
class AvroTypeProviderNestedSeparateSchemaFilesTest extends Specification { | ||
|
||
"A case class with types provided from two separate .avsc files" should { | ||
"serialize and deserialize correctly" in { | ||
val record = SeparateTestMessage("Achilles", SeparateMetaData("ow", "12345")) | ||
TestUtil.verifyWriteAndRead(List(record)) | ||
} | ||
} | ||
} |