Skip to content

Commit 8469569

Browse files
committed
fix: add test data
1 parent 7d120e5 commit 8469569

File tree

9 files changed

+127
-0
lines changed

9 files changed

+127
-0
lines changed

packages/avsc/test/dat/Custom.avdl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* A protocol using advanced features.
3+
*
4+
*/
5+
@namespace("org.apache.avro.test")
6+
protocol { // Anonymous.
7+
8+
// Inline response type definition.
9+
enum { SUCCESS, FAILURE } ok();
10+
11+
// Now an anonymous argument.
12+
int hash(fixed(2) fixed = "aa", long length);
13+
14+
// Reserved name.
15+
void import();
16+
17+
record Person {
18+
19+
// An inline enum, the default is the field's.
20+
enum Name { ANN, BOB } name = "ANN";
21+
}
22+
}

packages/avsc/test/dat/Hello.avdl

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import idl "Hello.avdl"; // Test circular import.
2+
3+
/**
4+
* An example protocol in Avro IDL.
5+
*
6+
* Inspired by the Avro specification IDL page:
7+
* https://avro.apache.org/docs/current/idl.html#example
8+
*
9+
*/
10+
@namespace("org.apache.avro.test")
11+
protocol Simple {
12+
13+
/** An enum. */
14+
@aliases(["org.foo.KindOf"])
15+
enum Kind {
16+
FOO,
17+
BAR, // the bar enum value
18+
BAZ
19+
}
20+
21+
/** An enum with a default value. */
22+
enum Letters {
23+
A,
24+
B,
25+
C
26+
} = A;
27+
28+
/** A fixed. */
29+
fixed MD5(16);
30+
31+
/** A record. */
32+
record TestRecord {
33+
@foo("first and last")
34+
string @order("ignore") name;
35+
36+
Kind @order("descending") kind;
37+
38+
MD5 hash;
39+
40+
/** A field. */
41+
union { MD5, null} @aliases(["hash"]) nullableHash;
42+
43+
array<@logicalType("date") long> arrayOfDates;
44+
45+
map<boolean> someMap = {"true": true};
46+
47+
/** */
48+
string fieldWithEmptyDoc;
49+
}
50+
51+
@doc("An error.")
52+
error TestError {
53+
string message;
54+
}
55+
56+
/* Another error (not docstring-ed). */
57+
error EmptyError {}
58+
59+
/** An overridden message docstring. */
60+
string @doc("Greeting.") hello(string greeting = "hi");
61+
62+
int @doc("Adding.") add(int arg1, int arg2);
63+
64+
/** Echoing. */
65+
bytes echoBytes(bytes data);
66+
67+
TestRecord /** Ignored. */ echo(TestRecord `record`);
68+
void `error`() throws TestError;
69+
string `errors`() throws TestError, EmptyError;
70+
void ping() oneway;
71+
void pong();
72+
}

packages/avsc/test/dat/Id.avdl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@namespace("id")
2+
fixed Id(64)

packages/avsc/test/dat/Id.avsc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"type": "fixed",
3+
"name": "Id",
4+
"namespace": "id",
5+
"size": 64
6+
}

packages/avsc/test/dat/Person.avsc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "Person",
3+
"type": "record",
4+
"fields": [
5+
{"name": "name", "type": "string"},
6+
{"name": "age", "type": ["null", "int"], "default": null},
7+
{
8+
"name": "gender",
9+
"type": {"name": "Gender", "type": "enum", "symbols": ["FEMALE", "MALE"]}
10+
},
11+
{
12+
"name": "address",
13+
"type": {
14+
"name": "Address",
15+
"type": "record",
16+
"fields": [{"name": "zipcode", "type": "int"}]
17+
}
18+
}
19+
]
20+
}

packages/avsc/test/dat/Ping.avdl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import schema "Id.avsc";
2+
protocol Ping {
3+
import schema "Id.avsc";
4+
id.Id ping();
5+
}
510 Bytes
Binary file not shown.
192 Bytes
Binary file not shown.
495 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)