Skip to content

Commit ac60ffb

Browse files
committed
Basic protocol tests
1 parent cc3eda2 commit ac60ffb

10 files changed

+1350
-4
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.34.0
1+
1.35.0

smithy-aws-protocol-tests/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ ext {
2727
dependencies {
2828
implementation project(path: ":smithy-cli", configuration: "shadow")
2929
implementation project(":smithy-protocol-test-traits")
30+
implementation project(":smithy-protocols-traits")
3031
implementation project(":smithy-aws-traits")
3132
api project(":smithy-validation-model")
3233
}
Lines changed: 258 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,258 @@
1+
// This file defines test cases that serialize lists in JSON documents.
2+
3+
$version: "2.0"
4+
5+
namespace aws.protocoltests.rpcv2
6+
7+
use aws.protocoltests.shared#BooleanList
8+
use aws.protocoltests.shared#FooEnumList
9+
use aws.protocoltests.shared#IntegerEnumList
10+
use aws.protocoltests.shared#IntegerList
11+
use aws.protocoltests.shared#NestedStringList
12+
use aws.protocoltests.shared#SparseStringList
13+
use aws.protocoltests.shared#StringList
14+
use aws.protocoltests.shared#StringSet
15+
use aws.protocoltests.shared#TimestampList
16+
use smithy.protocols#rpcv2
17+
use smithy.test#httpRequestTests
18+
use smithy.test#httpResponseTests
19+
20+
/// This test case serializes JSON lists for the following cases for both
21+
/// input and output:
22+
///
23+
/// 1. Normal lists.
24+
/// 2. Normal sets.
25+
/// 3. Lists of lists.
26+
/// 4. Lists of structures.
27+
@idempotent
28+
operation RpcV2CborLists {
29+
input: RpcV2CborListInputOutput,
30+
output: RpcV2CborListInputOutput
31+
}
32+
33+
apply RpcV2CborLists @httpRequestTests([
34+
{
35+
id: "RpcV2CborLists",
36+
documentation: "Serializes RpcV2 Cbor lists",
37+
protocol: rpcv2,
38+
method: "POST",
39+
uri: "/service/RpcV2Protocol/operation/RpcV2CborLists",
40+
body: "v2tib29sZWFuTGlzdJ/19P9oZW51bUxpc3SfY0Zvb2Ew/2tpbnRFbnVtTGlzdJ8BAv9raW50ZWdlckxpc3SfAQL/cG5lc3RlZFN0cmluZ0xpc3Sfn2Nmb29jYmFy/59jYmF6Y3F1eP//anN0cmluZ0xpc3SfY2Zvb2NiYXL/aXN0cmluZ1NldJ9jZm9vY2Jhcv9tc3RydWN0dXJlTGlzdJ+/YWFhMWFiYTL/v2FhYTNhYmE0//9tdGltZXN0YW1wTGlzdJ/B+0HU1/vzgAAAwftB1Nf784AAAP//",
41+
bodyMediaType: "application/cbor",
42+
headers: {
43+
"smithy-protocol": "rpc-v2-cbor",
44+
"Accept": "application/cbor",
45+
"Content-Type": "application/cbor"
46+
},
47+
params: {
48+
"stringList": [
49+
"foo",
50+
"bar"
51+
],
52+
"stringSet": [
53+
"foo",
54+
"bar"
55+
],
56+
"integerList": [
57+
1,
58+
2
59+
],
60+
"booleanList": [
61+
true,
62+
false
63+
],
64+
"timestampList": [
65+
1398796238,
66+
1398796238
67+
],
68+
"enumList": [
69+
"Foo",
70+
"0"
71+
],
72+
"intEnumList": [
73+
1,
74+
2
75+
],
76+
"nestedStringList": [
77+
[
78+
"foo",
79+
"bar"
80+
],
81+
[
82+
"baz",
83+
"qux"
84+
]
85+
],
86+
"structureList": [
87+
{
88+
"a": "1",
89+
"b": "2"
90+
},
91+
{
92+
"a": "3",
93+
"b": "4"
94+
}
95+
]
96+
}
97+
},
98+
{
99+
id: "RpcV2CborListsEmpty",
100+
documentation: "Serializes empty JSON lists",
101+
protocol: rpcv2,
102+
method: "POST",
103+
uri: "/service/RpcV2Protocol/operation/RpcV2CborLists",
104+
body: "v2pzdHJpbmdMaXN0n///",
105+
bodyMediaType: "application/cbor",
106+
headers: {
107+
"smithy-protocol": "rpc-v2-cbor",
108+
"Accept": "application/cbor",
109+
"Content-Type": "application/cbor"
110+
},
111+
params: {
112+
stringList: []
113+
}
114+
},
115+
{
116+
id: "RpcV2CborListsSerializeNull",
117+
documentation: "Serializes null values in lists",
118+
protocol: rpcv2,
119+
method: "POST",
120+
uri: "/service/RpcV2Protocol/operation/RpcV2CborLists",
121+
body: "v3BzcGFyc2VTdHJpbmdMaXN0n/ZiaGn//w==",
122+
bodyMediaType: "application/cbor",
123+
headers: {
124+
"smithy-protocol": "rpc-v2-cbor",
125+
"Accept": "application/cbor",
126+
"Content-Type": "application/cbor"
127+
},
128+
params: {
129+
sparseStringList: [null, "hi"]
130+
}
131+
}
132+
])
133+
134+
apply RpcV2CborLists @httpResponseTests([
135+
{
136+
id: "RpcV2CborLists",
137+
documentation: "Serializes RpcV2 Cbor lists",
138+
protocol: rpcv2,
139+
code: 200,
140+
body: "v2tib29sZWFuTGlzdJ/19P9oZW51bUxpc3SfY0Zvb2Ew/2tpbnRFbnVtTGlzdJ8BAv9raW50ZWdlckxpc3SfAQL/cG5lc3RlZFN0cmluZ0xpc3Sfn2Nmb29jYmFy/59jYmF6Y3F1eP//anN0cmluZ0xpc3SfY2Zvb2NiYXL/aXN0cmluZ1NldJ9jZm9vY2Jhcv9tc3RydWN0dXJlTGlzdJ+/YWFhMWFiYTL/v2FhYTNhYmE0//9tdGltZXN0YW1wTGlzdJ/B+0HU1/vzgAAAwftB1Nf784AAAP//",
141+
bodyMediaType: "application/cbor",
142+
headers: {
143+
"smithy-protocol": "rpc-v2-cbor",
144+
"Content-Type": "application/cbor"
145+
},
146+
params: {
147+
"stringList": [
148+
"foo",
149+
"bar"
150+
],
151+
"stringSet": [
152+
"foo",
153+
"bar"
154+
],
155+
"integerList": [
156+
1,
157+
2
158+
],
159+
"booleanList": [
160+
true,
161+
false
162+
],
163+
"timestampList": [
164+
1398796238,
165+
1398796238
166+
],
167+
"enumList": [
168+
"Foo",
169+
"0"
170+
],
171+
"intEnumList": [
172+
1,
173+
2
174+
],
175+
"nestedStringList": [
176+
[
177+
"foo",
178+
"bar"
179+
],
180+
[
181+
"baz",
182+
"qux"
183+
]
184+
],
185+
"structureList": [
186+
{
187+
"a": "1",
188+
"b": "2"
189+
},
190+
{
191+
"a": "3",
192+
"b": "4"
193+
}
194+
]
195+
}
196+
},
197+
{
198+
id: "RpcV2CborListsEmpty",
199+
documentation: "Serializes empty RpcV2 Cbor lists",
200+
protocol: rpcv2,
201+
code: 200,
202+
body: "v2pzdHJpbmdMaXN0n///",
203+
bodyMediaType: "application/cbor",
204+
headers: {
205+
"smithy-protocol": "rpc-v2-cbor",
206+
"Content-Type": "application/cbor"
207+
},
208+
params: {
209+
stringList: []
210+
}
211+
},
212+
{
213+
id: "RpcV2CborListsSerializeNull",
214+
documentation: "Serializes null values in sparse lists",
215+
protocol: rpcv2,
216+
code: 200,
217+
body: "v3BzcGFyc2VTdHJpbmdMaXN0n/ZiaGn//w==",
218+
bodyMediaType: "application/cbor",
219+
headers: {
220+
"smithy-protocol": "rpc-v2-cbor",
221+
"Content-Type": "application/cbor"
222+
},
223+
params: {
224+
sparseStringList: [null, "hi"]
225+
}
226+
}
227+
])
228+
229+
structure RpcV2CborListInputOutput {
230+
stringList: StringList,
231+
232+
sparseStringList: SparseStringList,
233+
234+
stringSet: StringSet,
235+
236+
integerList: IntegerList,
237+
238+
booleanList: BooleanList,
239+
240+
timestampList: TimestampList,
241+
242+
enumList: FooEnumList,
243+
244+
intEnumList: IntegerEnumList,
245+
246+
nestedStringList: NestedStringList,
247+
248+
structureList: StructureList
249+
}
250+
251+
list StructureList {
252+
member: StructureListMember,
253+
}
254+
255+
structure StructureListMember {
256+
a: String,
257+
b: String,
258+
}

0 commit comments

Comments
 (0)