Skip to content

RpcV2 Protocol tests #1911

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: ci

on:
push:
branches: [main]
branches: [main, smithy-rpc-v2]
pull_request:
branches: [main]
branches: [main, smithy-rpc-v2]

jobs:
build:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,8 @@ build/
*/*/out/
/wrapper

# jdt-ls
.metadata

# Smithy
.smithy.lsp.log
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ include ":smithy-rules-engine"
include ":smithy-smoke-test-traits"
include ":smithy-syntax"
include ":smithy-aws-endpoints"
include ":smithy-protocol-traits"
1 change: 1 addition & 0 deletions smithy-aws-protocol-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ ext {
dependencies {
implementation project(path: ":smithy-cli", configuration: "shadow")
implementation project(":smithy-protocol-test-traits")
implementation project(":smithy-protocol-traits")
implementation project(":smithy-aws-traits")
api project(":smithy-validation-model")
}
Expand Down
258 changes: 258 additions & 0 deletions smithy-aws-protocol-tests/model/rpcV2/cbor-lists.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,258 @@
// This file defines test cases that serialize lists in JSON documents.

$version: "2.0"

namespace aws.protocoltests.rpcv2Cbor

use aws.protocoltests.shared#BooleanList
use aws.protocoltests.shared#FooEnumList
use aws.protocoltests.shared#IntegerEnumList
use aws.protocoltests.shared#IntegerList
use aws.protocoltests.shared#NestedStringList
use aws.protocoltests.shared#SparseStringList
use aws.protocoltests.shared#StringList
use aws.protocoltests.shared#StringSet
use aws.protocoltests.shared#TimestampList
use smithy.protocols#rpcv2Cbor
use smithy.test#httpRequestTests
use smithy.test#httpResponseTests

/// This test case serializes JSON lists for the following cases for both
/// input and output:
///
/// 1. Normal lists.
/// 2. Normal sets.
/// 3. Lists of lists.
/// 4. Lists of structures.
@idempotent
operation RpcV2CborLists {
input: RpcV2CborListInputOutput,
output: RpcV2CborListInputOutput
}

apply RpcV2CborLists @httpRequestTests([
{
id: "RpcV2CborLists",
documentation: "Serializes RpcV2 Cbor lists",
protocol: rpcv2Cbor,
method: "POST",
uri: "/service/RpcV2Protocol/operation/RpcV2CborLists",
body: "v2tib29sZWFuTGlzdJ/19P9oZW51bUxpc3SfY0Zvb2Ew/2tpbnRFbnVtTGlzdJ8BAv9raW50ZWdlckxpc3SfAQL/cG5lc3RlZFN0cmluZ0xpc3Sfn2Nmb29jYmFy/59jYmF6Y3F1eP//anN0cmluZ0xpc3SfY2Zvb2NiYXL/aXN0cmluZ1NldJ9jZm9vY2Jhcv9tc3RydWN0dXJlTGlzdJ+/YWFhMWFiYTL/v2FhYTNhYmE0//9tdGltZXN0YW1wTGlzdJ/B+0HU1/vzgAAAwftB1Nf784AAAP//",
bodyMediaType: "application/cbor",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
},
params: {
"stringList": [
"foo",
"bar"
],
"stringSet": [
"foo",
"bar"
],
"integerList": [
1,
2
],
"booleanList": [
true,
false
],
"timestampList": [
1398796238,
1398796238
],
"enumList": [
"Foo",
"0"
],
"intEnumList": [
1,
2
],
"nestedStringList": [
[
"foo",
"bar"
],
[
"baz",
"qux"
]
],
"structureList": [
{
"a": "1",
"b": "2"
},
{
"a": "3",
"b": "4"
}
]
}
},
{
id: "RpcV2CborListsEmpty",
documentation: "Serializes empty JSON lists",
protocol: rpcv2Cbor,
method: "POST",
uri: "/service/RpcV2Protocol/operation/RpcV2CborLists",
body: "v2pzdHJpbmdMaXN0n///",
bodyMediaType: "application/cbor",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
},
params: {
stringList: []
}
},
{
id: "RpcV2CborListsSerializeNull",
documentation: "Serializes null values in lists",
protocol: rpcv2Cbor,
method: "POST",
uri: "/service/RpcV2Protocol/operation/RpcV2CborLists",
body: "v3BzcGFyc2VTdHJpbmdMaXN0n/ZiaGn//w==",
bodyMediaType: "application/cbor",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Accept": "application/cbor",
"Content-Type": "application/cbor"
},
params: {
sparseStringList: [null, "hi"]
}
}
])

apply RpcV2CborLists @httpResponseTests([
{
id: "RpcV2CborLists",
documentation: "Serializes RpcV2 Cbor lists",
protocol: rpcv2Cbor,
code: 200,
body: "v2tib29sZWFuTGlzdJ/19P9oZW51bUxpc3SfY0Zvb2Ew/2tpbnRFbnVtTGlzdJ8BAv9raW50ZWdlckxpc3SfAQL/cG5lc3RlZFN0cmluZ0xpc3Sfn2Nmb29jYmFy/59jYmF6Y3F1eP//anN0cmluZ0xpc3SfY2Zvb2NiYXL/aXN0cmluZ1NldJ9jZm9vY2Jhcv9tc3RydWN0dXJlTGlzdJ+/YWFhMWFiYTL/v2FhYTNhYmE0//9tdGltZXN0YW1wTGlzdJ/B+0HU1/vzgAAAwftB1Nf784AAAP//",
bodyMediaType: "application/cbor",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Content-Type": "application/cbor"
},
params: {
"stringList": [
"foo",
"bar"
],
"stringSet": [
"foo",
"bar"
],
"integerList": [
1,
2
],
"booleanList": [
true,
false
],
"timestampList": [
1398796238,
1398796238
],
"enumList": [
"Foo",
"0"
],
"intEnumList": [
1,
2
],
"nestedStringList": [
[
"foo",
"bar"
],
[
"baz",
"qux"
]
],
"structureList": [
{
"a": "1",
"b": "2"
},
{
"a": "3",
"b": "4"
}
]
}
},
{
id: "RpcV2CborListsEmpty",
documentation: "Serializes empty RpcV2 Cbor lists",
protocol: rpcv2Cbor,
code: 200,
body: "v2pzdHJpbmdMaXN0n///",
bodyMediaType: "application/cbor",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Content-Type": "application/cbor"
},
params: {
stringList: []
}
},
{
id: "RpcV2CborListsSerializeNull",
documentation: "Serializes null values in sparse lists",
protocol: rpcv2Cbor,
code: 200,
body: "v3BzcGFyc2VTdHJpbmdMaXN0n/ZiaGn//w==",
bodyMediaType: "application/cbor",
headers: {
"smithy-protocol": "rpc-v2-cbor",
"Content-Type": "application/cbor"
},
params: {
sparseStringList: [null, "hi"]
}
}
])

structure RpcV2CborListInputOutput {
stringList: StringList,

sparseStringList: SparseStringList,

stringSet: StringSet,

integerList: IntegerList,

booleanList: BooleanList,

timestampList: TimestampList,

enumList: FooEnumList,

intEnumList: IntegerEnumList,

nestedStringList: NestedStringList,

structureList: StructureList
}

list StructureList {
member: StructureListMember,
}

structure StructureListMember {
a: String,
b: String,
}
Loading