Skip to content

Commit 6e1f346

Browse files
committed
Really enable exception response tests
1 parent 3676bcb commit 6e1f346

File tree

6 files changed

+36
-17
lines changed

6 files changed

+36
-17
lines changed

aws/client/aws-client-awsjson/src/it/java/software/amazon/smithy/java/client/aws/jsonprotocols/AwsJson1ProtocolTests.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,13 @@ public void requestTest(DataStream expected, DataStream actual) {
5050
@ProtocolTestFilter(
5151
skipTests = {
5252
"AwsJson10ClientPopulatesDefaultsValuesWhenMissingInResponse",
53-
"AwsJson10ClientIgnoresDefaultValuesIfMemberValuesArePresentInResponse"
53+
"AwsJson10ClientIgnoresDefaultValuesIfMemberValuesArePresentInResponse",
54+
//The below fail because we haven't implemented code based exception handling
55+
"AwsJson10FooErrorUsingCode",
56+
"AwsJson10FooErrorUsingCodeAndNamespace",
57+
"AwsJson10FooErrorUsingCodeUriAndNamespace",
58+
"AwsJson10FooErrorWithDunderTypeUriAndNamespace"
59+
5460
},
5561
skipOperations = "aws.protocoltests.json10#OperationWithRequiredMembersWithDefaults")
5662
public void responseTest(Runnable test) {

aws/client/aws-client-restjson/src/it/java/software/amazon/smithy/java/client/aws/restjson/RestJson1ProtocolTests.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ public void requestTest(DataStream expected, DataStream actual) {
6666
@HttpClientResponseTests
6767
@ProtocolTestFilter(
6868
skipTests = {
69-
"RestJsonInputAndOutputWithQuotedStringHeaders"
69+
"RestJsonInputAndOutputWithQuotedStringHeaders",
70+
"RestJsonFooErrorUsingCode",
71+
"RestJsonFooErrorUsingCodeAndNamespace",
72+
"RestJsonFooErrorUsingCodeUriAndNamespace",
73+
"RestJsonFooErrorWithDunderTypeUriAndNamespace"
7074
})
7175
public void responseTest(Runnable test) {
7276
test.run();

aws/client/aws-client-restxml/src/it/java/software/amazon/smithy/java/aws/client/restxml/RestXmlProtocolTests.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ public void requestTest(DataStream expected, DataStream actual) {
5757
}
5858

5959
@HttpClientResponseTests
60+
@ProtocolTestFilter(skipTests = {
61+
"InvalidGreetingError",
62+
"ComplexError"
63+
})
6064
public void responseTest(Runnable test) {
6165
test.run();
6266
}

aws/server/aws-server-restjson/src/it/java/software/amazon/smithy/java/server/protocols/restjson/AwsRestJson1ProtocolTests.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ public void requestTest(Runnable test) {
7373
"RestJsonStreamingTraitsWithMediaTypeWithBlob",
7474
"RestJsonDeserializesDenseSetMapAndSkipsNull",
7575
"RestJsonServerPopulatesDefaultsInResponseWhenMissingInParams",
76+
// These can be fixed after https://github.com/smithy-lang/smithy-java/blob/main/http-binding/src/main/java/software/amazon/smithy/java/http/binding/HttpBindingSerializer.java#L109
7677
"RestJsonInvalidGreetingError",
78+
"RestJsonComplexErrorWithNoMessage",
79+
"RestJsonEmptyComplexErrorWithNoMessage",
7780
//TODO this breaks because of Validation and errorCorrection doesn't handle that.
7881
"RestJsonServerPopulatesNestedDefaultValuesWhenMissingInInResponseParams"
7982

client/client-rpcv2-cbor/src/it/java/software/amazon/smithy/java/client/rpcv2/RpcV2CborProtocolTests.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ public void requestTest(DataStream expected, DataStream actual) {
3535
@HttpClientResponseTests
3636
@ProtocolTestFilter(
3737
skipTests = {
38-
"RpcV2CborClientPopulatesDefaultsValuesWhenMissingInResponse"
38+
"RpcV2CborClientPopulatesDefaultsValuesWhenMissingInResponse",
39+
"RpcV2CborInvalidGreetingError",
40+
"RpcV2CborEmptyComplexError",
41+
"RpcV2CborComplexError"
3942
})
4043
public void responseTest(Runnable test) {
4144
test.run();

protocol-test-harness/src/main/java/software/amazon/smithy/java/protocoltests/harness/ProtocolTestExtension.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -314,21 +314,20 @@ private static List<HttpTestOperation> getTestOperations(
314314
});
315315
for (var errorId : operation.getErrors()) {
316316
var error = serviceModel.getShape(errorId);
317-
if (error.map(Shape::isStructureShape).orElse(false)) {
318-
continue;
319-
}
320-
var errorShape = error.get().asStructureShape().get();
321-
errorShape.getTrait(HttpResponseTestsTrait.class).ifPresent(httpResponseTestsTrait -> {
322-
for (var testCase : httpResponseTestsTrait.getTestCases()) {
323-
if (testTypeFiler.test(testCase)) {
324-
responseTestsCases.add(
325-
new HttpResponseProtocolTestCase(
326-
testCase,
327-
true,
328-
getApiExceptionBuilder(symbolProvider, errorShape)));
317+
if (error.isPresent() && error.get().isStructureShape()) {
318+
var errorShape = error.get().asStructureShape().get();
319+
errorShape.getTrait(HttpResponseTestsTrait.class).ifPresent(httpResponseTestsTrait -> {
320+
for (var testCase : httpResponseTestsTrait.getTestCases()) {
321+
if (testTypeFiler.test(testCase)) {
322+
responseTestsCases.add(
323+
new HttpResponseProtocolTestCase(
324+
testCase,
325+
true,
326+
getApiExceptionBuilder(symbolProvider, errorShape)));
327+
}
329328
}
330-
}
331-
});
329+
});
330+
}
332331
}
333332
operation.getTrait(HttpMalformedRequestTestsTrait.class)
334333
.map(HttpMalformedRequestTestsTrait::getTestCases)

0 commit comments

Comments
 (0)