From 0c97886dcacb765cbc11a67b8e11cad54e12f7d8 Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Fri, 6 Oct 2023 21:49:44 -0500 Subject: [PATCH 1/2] fix!: Fix tests related to output struct rename (#1170) --- .../WaitersTests/ErrorTypeMatcherTests.swift | 2 +- .../InputOutputMatcherTests.swift | 4 +- .../WaitersTests/OutputMatcherTests.swift | 46 +++++------ .../WaitersTests/SuccessMatcherTests.swift | 4 +- .../aws/swift/codegen/EventStreamTests.kt | 22 +++--- ...perationEndpointResolverMiddlewareTests.kt | 2 +- .../swift/codegen/PresignerGeneratorTests.kt | 76 +++++++++---------- .../awsquery/AWSQueryOperationStackTest.kt | 22 +++--- .../StructDecodeWrappedXMLGeneratorTests.kt | 6 +- .../PresignableUrlIntegrationTests.kt | 10 +-- .../codegen/customizations/S3ExpiresTest.kt | 8 +- .../serde/S3UnwrappedXMLOutputTraitTests.kt | 4 +- 12 files changed, 103 insertions(+), 103 deletions(-) diff --git a/codegen/protocol-test-codegen-local/Tests/swift-codegen/WaitersTests/ErrorTypeMatcherTests.swift b/codegen/protocol-test-codegen-local/Tests/swift-codegen/WaitersTests/ErrorTypeMatcherTests.swift index ad18834d5ff..223d8369f64 100644 --- a/codegen/protocol-test-codegen-local/Tests/swift-codegen/WaitersTests/ErrorTypeMatcherTests.swift +++ b/codegen/protocol-test-codegen-local/Tests/swift-codegen/WaitersTests/ErrorTypeMatcherTests.swift @@ -37,7 +37,7 @@ class ErrorTypeMatcherTests: XCTestCase { } func test_errorType_doesNotMatchWhenResultIsSuccess() async throws { - let response = GetWidgetOutputResponse() + let response = GetWidgetOutput() let subject = try WaitersClient.errorTypeMatcherWaiterConfig().acceptors[0] let match = subject.evaluate(input: anInput, result: .success(response)) XCTAssertNil(match) diff --git a/codegen/protocol-test-codegen-local/Tests/swift-codegen/WaitersTests/InputOutputMatcherTests.swift b/codegen/protocol-test-codegen-local/Tests/swift-codegen/WaitersTests/InputOutputMatcherTests.swift index 3d6ce83a2e5..7fe2f29cf64 100644 --- a/codegen/protocol-test-codegen-local/Tests/swift-codegen/WaitersTests/InputOutputMatcherTests.swift +++ b/codegen/protocol-test-codegen-local/Tests/swift-codegen/WaitersTests/InputOutputMatcherTests.swift @@ -21,7 +21,7 @@ class InputOutputMatcherTests: XCTestCase { func test_inputOutput_acceptorMatchesWhenInputAndOutputPropertiesMatch() async throws { let value = UUID().uuidString let input = GetWidgetInput(stringProperty: value) - let output = GetWidgetOutputResponse(stringProperty: value) + let output = GetWidgetOutput(stringProperty: value) let subject = try WaitersClient.inputOutputPropertyMatcherWaiterConfig().acceptors[0] let match = subject.evaluate(input: input, result: .success(output)) XCTAssertEqual(match, .success(.success(output))) @@ -30,7 +30,7 @@ class InputOutputMatcherTests: XCTestCase { func test_inputOutput_acceptorFailsToMatchWhenInputAndOutputPropertiesDontMatch() async throws { let value = UUID().uuidString let input = GetWidgetInput(stringProperty: value) - let output = GetWidgetOutputResponse(stringProperty: value + "xxx") + let output = GetWidgetOutput(stringProperty: value + "xxx") let subject = try WaitersClient.inputOutputPropertyMatcherWaiterConfig().acceptors[0] let match = subject.evaluate(input: input, result: .success(output)) XCTAssertNil(match) diff --git a/codegen/protocol-test-codegen-local/Tests/swift-codegen/WaitersTests/OutputMatcherTests.swift b/codegen/protocol-test-codegen-local/Tests/swift-codegen/WaitersTests/OutputMatcherTests.swift index e17dbe1e43d..b33efe2a46c 100644 --- a/codegen/protocol-test-codegen-local/Tests/swift-codegen/WaitersTests/OutputMatcherTests.swift +++ b/codegen/protocol-test-codegen-local/Tests/swift-codegen/WaitersTests/OutputMatcherTests.swift @@ -18,21 +18,21 @@ class OutputMatcherTests: XCTestCase { // JMESPath expected value: payload property contents func test_outputStringProperty_acceptorMatchesOnPropertyMatch() async throws { - let output = GetWidgetOutputResponse(stringProperty: "payload property contents") + let output = GetWidgetOutput(stringProperty: "payload property contents") let subject = try WaitersClient.outputStringPropertyMatcherWaiterConfig().acceptors[0] let match = subject.evaluate(input: anInput, result: .success(output)) XCTAssertEqual(match, .success(.success(output))) } func test_outputStringProperty_acceptorFailsToMatchOnPropertyMismatch() async throws { - let output = GetWidgetOutputResponse(stringProperty: "not the payload property contents") + let output = GetWidgetOutput(stringProperty: "not the payload property contents") let subject = try WaitersClient.outputStringPropertyMatcherWaiterConfig().acceptors[0] let match = subject.evaluate(input: anInput, result: .success(output)) XCTAssertNil(match) } func test_outputStringProperty_acceptorFailsToMatchOnNullProperty() async throws { - let output = GetWidgetOutputResponse(stringProperty: nil) + let output = GetWidgetOutput(stringProperty: nil) let subject = try WaitersClient.outputStringPropertyMatcherWaiterConfig().acceptors[0] let match = subject.evaluate(input: anInput, result: .success(output)) XCTAssertNil(match) @@ -45,21 +45,21 @@ class OutputMatcherTests: XCTestCase { // JMESPath expected value: false func test_outputBooleanProperty_acceptorMatchesOnPropertyMatch() async throws { - let output = GetWidgetOutputResponse(booleanProperty: false) + let output = GetWidgetOutput(booleanProperty: false) let subject = try WaitersClient.outputBooleanPropertyMatcherWaiterConfig().acceptors[0] let match = subject.evaluate(input: anInput, result: .success(output)) XCTAssertEqual(match, .success(.success(output))) } func test_outputBooleanProperty_acceptorFailsToMatchOnPropertyMismatch() async throws { - let output = GetWidgetOutputResponse(booleanProperty: true) + let output = GetWidgetOutput(booleanProperty: true) let subject = try WaitersClient.outputBooleanPropertyMatcherWaiterConfig().acceptors[0] let match = subject.evaluate(input: anInput, result: .success(output)) XCTAssertNil(match) } func test_outputBooleanProperty_acceptorFailsToMatchOnNullProperty() async throws { - let output = GetWidgetOutputResponse(booleanProperty: nil) + let output = GetWidgetOutput(booleanProperty: nil) let subject = try WaitersClient.outputBooleanPropertyMatcherWaiterConfig().acceptors[0] let match = subject.evaluate(input: anInput, result: .success(output)) XCTAssertNil(match) @@ -73,7 +73,7 @@ class OutputMatcherTests: XCTestCase { func test_arrayPropertyAll_acceptorMatchesWhenArrayElementsAllMatch() async throws { let expected = "payload property contents" - let output = GetWidgetOutputResponse(stringArrayProperty: [expected, expected, expected]) + let output = GetWidgetOutput(stringArrayProperty: [expected, expected, expected]) let subject = try WaitersClient.outputStringArrayAllPropertyMatcherWaiterConfig().acceptors[0] let match = subject.evaluate(input: anInput, result: .success(output)) XCTAssertEqual(match, .success(.success(output))) @@ -81,21 +81,21 @@ class OutputMatcherTests: XCTestCase { func test_arrayPropertyAll_acceptorFailsToMatchWhenArrayElementsDontMatch() async throws { let expected = "payload property contents" - let output = GetWidgetOutputResponse(stringArrayProperty: [expected, expected, "unexpected"]) + let output = GetWidgetOutput(stringArrayProperty: [expected, expected, "unexpected"]) let subject = try WaitersClient.outputStringArrayAllPropertyMatcherWaiterConfig().acceptors[0] let match = subject.evaluate(input: anInput, result: .success(output)) XCTAssertNil(match) } func test_arrayPropertyAll_acceptorFailsToMatchWhenArrayIsEmpty() async throws { - let output = GetWidgetOutputResponse(stringArrayProperty: []) + let output = GetWidgetOutput(stringArrayProperty: []) let subject = try WaitersClient.outputStringArrayAllPropertyMatcherWaiterConfig().acceptors[0] let match = subject.evaluate(input: anInput, result: .success(output)) XCTAssertNil(match) } func test_arrayPropertyAll_acceptorFailsToMatchWhenArrayIsNull() async throws { - let output = GetWidgetOutputResponse(stringArrayProperty: nil) + let output = GetWidgetOutput(stringArrayProperty: nil) let subject = try WaitersClient.outputStringArrayAllPropertyMatcherWaiterConfig().acceptors[0] let match = subject.evaluate(input: anInput, result: .success(output)) XCTAssertNil(match) @@ -109,7 +109,7 @@ class OutputMatcherTests: XCTestCase { func test_arrayPropertyAny_acceptorMatchesWhenArrayElementsAllMatch() async throws { let expected = "payload property contents" - let output = GetWidgetOutputResponse(stringArrayProperty: [expected, expected, expected]) + let output = GetWidgetOutput(stringArrayProperty: [expected, expected, expected]) let subject = try WaitersClient.outputStringArrayAnyPropertyMatcherWaiterConfig().acceptors[0] let match = subject.evaluate(input: anInput, result: .success(output)) XCTAssertEqual(match, .success(.success(output))) @@ -117,7 +117,7 @@ class OutputMatcherTests: XCTestCase { func test_arrayPropertyAny_acceptorMatchesWhenAllButOneElementMismatches() async throws { let expected = "payload property contents" - let output = GetWidgetOutputResponse(stringArrayProperty: [expected, expected, "unexpected"]) + let output = GetWidgetOutput(stringArrayProperty: [expected, expected, "unexpected"]) let subject = try WaitersClient.outputStringArrayAnyPropertyMatcherWaiterConfig().acceptors[0] let match = subject.evaluate(input: anInput, result: .success(output)) XCTAssertEqual(match, .success(.success(output))) @@ -125,21 +125,21 @@ class OutputMatcherTests: XCTestCase { func test_arrayPropertyAny_acceptorFailsToMatchWhenAllElementsMismatch() async throws { let unexpected = "unexpected" - let output = GetWidgetOutputResponse(stringArrayProperty: [unexpected, unexpected, unexpected]) + let output = GetWidgetOutput(stringArrayProperty: [unexpected, unexpected, unexpected]) let subject = try WaitersClient.outputStringArrayAnyPropertyMatcherWaiterConfig().acceptors[0] let match = subject.evaluate(input: anInput, result: .success(output)) XCTAssertNil(match) } func test_arrayPropertyAny_acceptorFailsToMatchWhenArrayIsEmpty() async throws { - let output = GetWidgetOutputResponse(stringArrayProperty: []) + let output = GetWidgetOutput(stringArrayProperty: []) let subject = try WaitersClient.outputStringArrayAnyPropertyMatcherWaiterConfig().acceptors[0] let match = subject.evaluate(input: anInput, result: .success(output)) XCTAssertNil(match) } func test_arrayPropertyAny_acceptorFailsToMatchWhenArrayIsNull() async throws { - let output = GetWidgetOutputResponse(stringArrayProperty: nil) + let output = GetWidgetOutput(stringArrayProperty: nil) let subject = try WaitersClient.outputStringArrayAnyPropertyMatcherWaiterConfig().acceptors[0] let match = subject.evaluate(input: anInput, result: .success(output)) XCTAssertNil(match) @@ -226,14 +226,14 @@ class OutputMatcherTests: XCTestCase { // JMESPath expected value: "abc" func test_projection_acceptorMatchesWhenProjectedValuesMatchExpectation() async throws { - let output = GetWidgetOutputResponse(dataMap: ["x": "abc", "y": "abc", "z": "abc"]) + let output = GetWidgetOutput(dataMap: ["x": "abc", "y": "abc", "z": "abc"]) let subject = try WaitersClient.projectionMatcherWaiterConfig().acceptors[0] let match = subject.evaluate(input: anInput, result: .success(output)) XCTAssertEqual(match, .success(.success(output))) } func test_projection_acceptorDoesNotMatchWhenProjectedValuesDontMatchExpectation() async throws { - let output = GetWidgetOutputResponse(dataMap: ["x": "abc", "y": "abc", "z": "def"]) + let output = GetWidgetOutput(dataMap: ["x": "abc", "y": "abc", "z": "def"]) let subject = try WaitersClient.projectionMatcherWaiterConfig().acceptors[0] let match = subject.evaluate(input: anInput, result: .success(output)) XCTAssertNil(match) @@ -246,14 +246,14 @@ class OutputMatcherTests: XCTestCase { // JMESPath expected value: "true" func test_containsNonLiteral_acceptorMatchesWhenStringPropertyIsFound() async throws { - let output = GetWidgetOutputResponse(dataMap: ["a": "abc", "b": "xyz"], stringProperty: "xyz") + let output = GetWidgetOutput(dataMap: ["a": "abc", "b": "xyz"], stringProperty: "xyz") let subject = try WaitersClient.containsFieldMatcherWaiterConfig().acceptors[0] let match = subject.evaluate(input: anInput, result: .success(output)) XCTAssertEqual(match, .success(.success(output))) } func test_containsNonLiteral_acceptorDoesNotMatchWhenStringPropertyIsNotFound() async throws { - let output = GetWidgetOutputResponse(dataMap: ["a": "abc", "b": "xyz"], stringProperty: "def") + let output = GetWidgetOutput(dataMap: ["a": "abc", "b": "xyz"], stringProperty: "def") let subject = try WaitersClient.containsFieldMatcherWaiterConfig().acceptors[0] let match = subject.evaluate(input: anInput, result: .success(output)) XCTAssertNil(match) @@ -266,14 +266,14 @@ class OutputMatcherTests: XCTestCase { // JMESPath expected value: "true" func test_andInequality_acceptorMatchesWhenCountsAreThreeAndNotThree() async throws { - let output = GetWidgetOutputResponse(dataMap: ["a": "a", "b": "b", "c": "c"], stringArrayProperty: ["a", "b"]) + let output = GetWidgetOutput(dataMap: ["a": "a", "b": "b", "c": "c"], stringArrayProperty: ["a", "b"]) let subject = try WaitersClient.andInequalityMatcherWaiterConfig().acceptors[0] let match = subject.evaluate(input: anInput, result: .success(output)) XCTAssertEqual(match, .success(.success(output))) } func test_andInequality_acceptorDoesNotMatchWhenCountsAreNotThreeAndThree() async throws { - let output = GetWidgetOutputResponse(dataMap: ["a": "a", "b": "b"], stringArrayProperty: ["a", "b", "c"]) + let output = GetWidgetOutput(dataMap: ["a": "a", "b": "b"], stringArrayProperty: ["a", "b", "c"]) let subject = try WaitersClient.andInequalityMatcherWaiterConfig().acceptors[0] let match = subject.evaluate(input: anInput, result: .success(output)) XCTAssertNil(match) @@ -281,13 +281,13 @@ class OutputMatcherTests: XCTestCase { // MARK: - Helper methods - private func outputTree(globalName: String? = nil, embeddedName: String? = "c", appendBonusKid: Bool = false) -> GetWidgetOutputResponse { + private func outputTree(globalName: String? = nil, embeddedName: String? = "c", appendBonusKid: Bool = false) -> GetWidgetOutput { var grandchildren2: [WaitersClientTypes.Grandchild] = [ .init(name: embeddedName ?? globalName, number: 1), .init(name: globalName ?? "d", number: 2) ] if appendBonusKid { grandchildren2.append(.init(name: "bonus kid", number: 7))} - return GetWidgetOutputResponse(children: [ + return GetWidgetOutput(children: [ .init(grandchildren: [ .init(name: globalName ?? "a", number: 3), .init(name: globalName ?? "b", number: 4) diff --git a/codegen/protocol-test-codegen-local/Tests/swift-codegen/WaitersTests/SuccessMatcherTests.swift b/codegen/protocol-test-codegen-local/Tests/swift-codegen/WaitersTests/SuccessMatcherTests.swift index 22b01a7bcc4..894d9571e97 100644 --- a/codegen/protocol-test-codegen-local/Tests/swift-codegen/WaitersTests/SuccessMatcherTests.swift +++ b/codegen/protocol-test-codegen-local/Tests/swift-codegen/WaitersTests/SuccessMatcherTests.swift @@ -20,7 +20,7 @@ class SuccessMatcherTests: XCTestCase { } func test_successTrue_acceptorMatchesOnOutput() async throws { - let output = GetWidgetOutputResponse() + let output = GetWidgetOutput() let subject = try WaitersClient.successTrueMatcherWaiterConfig().acceptors[0] let match = subject.evaluate(input: anInput, result: .success(output)) XCTAssertEqual(match, .success(.success(output))) @@ -33,7 +33,7 @@ class SuccessMatcherTests: XCTestCase { } func test_successFalse_acceptorFailsToMatchOnOutput() async throws { - let output = GetWidgetOutputResponse() + let output = GetWidgetOutput() let subject = try WaitersClient.successFalseMatcherWaiterConfig().acceptors[0] let match = subject.evaluate(input: anInput, result: .success(output)) XCTAssertNil(match) diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/EventStreamTests.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/EventStreamTests.kt index 54bf425068c..0b9f17652b1 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/EventStreamTests.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/EventStreamTests.kt @@ -197,13 +197,13 @@ extension EventStreamTestClient: EventStreamTestClientProtocol { /// /// - Parameter TestStreamOpInput : [no documentation found] /// - /// - Returns: `TestStreamOpOutputResponse` : [no documentation found] + /// - Returns: `TestStreamOpOutput` : [no documentation found] /// /// - Throws: One of the exceptions listed below __Possible Exceptions__. /// /// __Possible Exceptions:__ /// - `SomeError` : You don't have permission. - public func testStreamOp(input: TestStreamOpInput) async throws -> TestStreamOpOutputResponse + public func testStreamOp(input: TestStreamOpInput) async throws -> TestStreamOpOutput { let context = ClientRuntime.HttpContextBuilder() .withEncoder(value: encoder) @@ -220,20 +220,20 @@ extension EventStreamTestClient: EventStreamTestClientProtocol { .withSigningRegion(value: config.signingRegion) .build() try context.setupBidirectionalStreaming() - var operation = ClientRuntime.OperationStack(id: "testStreamOp") - operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware()) - operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) + var operation = ClientRuntime.OperationStack(id: "testStreamOp") + operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware()) + operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) let endpointParams = EndpointParams() - operation.buildStep.intercept(position: .before, middleware: EndpointResolverMiddleware(endpointResolver: config.serviceSpecific.endpointResolver, endpointParams: endpointParams)) + operation.buildStep.intercept(position: .before, middleware: EndpointResolverMiddleware(endpointResolver: config.serviceSpecific.endpointResolver, endpointParams: endpointParams)) operation.buildStep.intercept(position: .before, middleware: AWSClientRuntime.UserAgentMiddleware(metadata: AWSClientRuntime.AWSUserAgentMetadata.fromConfig(serviceID: serviceName, version: "1.0.0", config: config))) - operation.serializeStep.intercept(position: .after, middleware: ContentTypeMiddleware(contentType: "application/json")) + operation.serializeStep.intercept(position: .after, middleware: ContentTypeMiddleware(contentType: "application/json")) operation.serializeStep.intercept(position: .after, middleware: TestStreamOpInputBodyMiddleware()) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.ContentLengthMiddleware()) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) let sigv4Config = AWSClientRuntime.SigV4Config(unsignedBody: false, signingAlgorithm: .sigv4) - operation.finalizeStep.intercept(position: .before, middleware: AWSClientRuntime.SigV4Middleware(config: sigv4Config)) - operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware()) - operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) + operation.finalizeStep.intercept(position: .before, middleware: AWSClientRuntime.SigV4Middleware(config: sigv4Config)) + operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware()) + operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) let result = try await operation.handleMiddleware(context: context, input: input, next: client.getHandler()) return result } diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/OperationEndpointResolverMiddlewareTests.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/OperationEndpointResolverMiddlewareTests.kt index bafb7814fdc..087a7ca1353 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/OperationEndpointResolverMiddlewareTests.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/OperationEndpointResolverMiddlewareTests.kt @@ -26,7 +26,7 @@ class OperationEndpointResolverMiddlewareTests { throw SdkError.client(ClientError.unknownError(("Missing required parameter: region"))) } let endpointParams = EndpointParams(boolBar: true, boolBaz: input.fuzz, boolFoo: config.serviceSpecific.boolFoo, endpoint: config.endpoint, region: region, stringBar: "some value", stringBaz: input.buzz, stringFoo: config.serviceSpecific.stringFoo) - operationStack.buildStep.intercept(position: .before, middleware: EndpointResolverMiddleware(endpointResolver: config.serviceSpecific.endpointResolver, endpointParams: endpointParams)) + operationStack.buildStep.intercept(position: .before, middleware: EndpointResolverMiddleware(endpointResolver: config.serviceSpecific.endpointResolver, endpointParams: endpointParams)) """.trimIndent() contents.shouldContainOnlyOnce(expected) } diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/PresignerGeneratorTests.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/PresignerGeneratorTests.kt index 7c9f40bca56..1e617c4ca1f 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/PresignerGeneratorTests.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/PresignerGeneratorTests.kt @@ -44,17 +44,17 @@ class PresignerGeneratorTests { .withSigningName(value: "example-signing-name") .withSigningRegion(value: config.signingRegion) .build() - var operation = ClientRuntime.OperationStack(id: "getFoo") - operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware()) - operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) + var operation = ClientRuntime.OperationStack(id: "getFoo") + operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware()) + operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) let endpointParams = EndpointParams() - operation.buildStep.intercept(position: .before, middleware: EndpointResolverMiddleware(endpointResolver: config.serviceSpecific.endpointResolver, endpointParams: endpointParams)) + operation.buildStep.intercept(position: .before, middleware: EndpointResolverMiddleware(endpointResolver: config.serviceSpecific.endpointResolver, endpointParams: endpointParams)) operation.buildStep.intercept(position: .before, middleware: AWSClientRuntime.UserAgentMiddleware(metadata: AWSClientRuntime.AWSUserAgentMetadata.fromConfig(serviceID: serviceName, version: "1.0.0", config: config))) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) let sigv4Config = AWSClientRuntime.SigV4Config(expiration: expiration, unsignedBody: false, signingAlgorithm: .sigv4) - operation.finalizeStep.intercept(position: .before, middleware: AWSClientRuntime.SigV4Middleware(config: sigv4Config)) - operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware()) - operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) + operation.finalizeStep.intercept(position: .before, middleware: AWSClientRuntime.SigV4Middleware(config: sigv4Config)) + operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware()) + operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) let presignedRequestBuilder = try await operation.presignedRequest(context: context, input: input, next: ClientRuntime.NoopHandler()) guard let builtRequest = presignedRequestBuilder?.build() else { return nil @@ -101,20 +101,20 @@ class PresignerGeneratorTests { .withSigningName(value: "example-signing-name") .withSigningRegion(value: config.signingRegion) .build() - var operation = ClientRuntime.OperationStack(id: "postFoo") - operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware()) - operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) + var operation = ClientRuntime.OperationStack(id: "postFoo") + operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware()) + operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) let endpointParams = EndpointParams() - operation.buildStep.intercept(position: .before, middleware: EndpointResolverMiddleware(endpointResolver: config.serviceSpecific.endpointResolver, endpointParams: endpointParams)) + operation.buildStep.intercept(position: .before, middleware: EndpointResolverMiddleware(endpointResolver: config.serviceSpecific.endpointResolver, endpointParams: endpointParams)) operation.buildStep.intercept(position: .before, middleware: AWSClientRuntime.UserAgentMiddleware(metadata: AWSClientRuntime.AWSUserAgentMetadata.fromConfig(serviceID: serviceName, version: "1.0.0", config: config))) - operation.serializeStep.intercept(position: .after, middleware: ContentTypeMiddleware(contentType: "application/json")) - operation.serializeStep.intercept(position: .after, middleware: ClientRuntime.SerializableBodyMiddleware(xmlName: "GetFooInput")) + operation.serializeStep.intercept(position: .after, middleware: ContentTypeMiddleware(contentType: "application/json")) + operation.serializeStep.intercept(position: .after, middleware: ClientRuntime.SerializableBodyMiddleware(xmlName: "GetFooInput")) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.ContentLengthMiddleware()) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) let sigv4Config = AWSClientRuntime.SigV4Config(expiration: expiration, unsignedBody: false, signingAlgorithm: .sigv4) - operation.finalizeStep.intercept(position: .before, middleware: AWSClientRuntime.SigV4Middleware(config: sigv4Config)) - operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware()) - operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) + operation.finalizeStep.intercept(position: .before, middleware: AWSClientRuntime.SigV4Middleware(config: sigv4Config)) + operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware()) + operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) let presignedRequestBuilder = try await operation.presignedRequest(context: context, input: input, next: ClientRuntime.NoopHandler()) guard let builtRequest = presignedRequestBuilder?.build() else { return nil @@ -161,20 +161,20 @@ class PresignerGeneratorTests { .withSigningName(value: "example-signing-name") .withSigningRegion(value: config.signingRegion) .build() - var operation = ClientRuntime.OperationStack(id: "putFoo") - operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware()) - operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) + var operation = ClientRuntime.OperationStack(id: "putFoo") + operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware()) + operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) let endpointParams = EndpointParams() - operation.buildStep.intercept(position: .before, middleware: EndpointResolverMiddleware(endpointResolver: config.serviceSpecific.endpointResolver, endpointParams: endpointParams)) + operation.buildStep.intercept(position: .before, middleware: EndpointResolverMiddleware(endpointResolver: config.serviceSpecific.endpointResolver, endpointParams: endpointParams)) operation.buildStep.intercept(position: .before, middleware: AWSClientRuntime.UserAgentMiddleware(metadata: AWSClientRuntime.AWSUserAgentMetadata.fromConfig(serviceID: serviceName, version: "1.0.0", config: config))) - operation.serializeStep.intercept(position: .after, middleware: ContentTypeMiddleware(contentType: "application/json")) - operation.serializeStep.intercept(position: .after, middleware: ClientRuntime.SerializableBodyMiddleware(xmlName: "GetFooInput")) + operation.serializeStep.intercept(position: .after, middleware: ContentTypeMiddleware(contentType: "application/json")) + operation.serializeStep.intercept(position: .after, middleware: ClientRuntime.SerializableBodyMiddleware(xmlName: "GetFooInput")) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.ContentLengthMiddleware()) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) let sigv4Config = AWSClientRuntime.SigV4Config(expiration: expiration, unsignedBody: false, signingAlgorithm: .sigv4) - operation.finalizeStep.intercept(position: .before, middleware: AWSClientRuntime.SigV4Middleware(config: sigv4Config)) - operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware()) - operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) + operation.finalizeStep.intercept(position: .before, middleware: AWSClientRuntime.SigV4Middleware(config: sigv4Config)) + operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware()) + operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) let presignedRequestBuilder = try await operation.presignedRequest(context: context, input: input, next: ClientRuntime.NoopHandler()) guard let builtRequest = presignedRequestBuilder?.build() else { return nil @@ -221,20 +221,20 @@ class PresignerGeneratorTests { .withSigningName(value: "s3") .withSigningRegion(value: config.signingRegion) .build() - var operation = ClientRuntime.OperationStack(id: "putObject") - operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware()) - operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) + var operation = ClientRuntime.OperationStack(id: "putObject") + operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware()) + operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) let endpointParams = EndpointParams() - operation.buildStep.intercept(position: .before, middleware: EndpointResolverMiddleware(endpointResolver: config.serviceSpecific.endpointResolver, endpointParams: endpointParams)) + operation.buildStep.intercept(position: .before, middleware: EndpointResolverMiddleware(endpointResolver: config.serviceSpecific.endpointResolver, endpointParams: endpointParams)) operation.buildStep.intercept(position: .before, middleware: AWSClientRuntime.UserAgentMiddleware(metadata: AWSClientRuntime.AWSUserAgentMetadata.fromConfig(serviceID: serviceName, version: "1.0.0", config: config))) - operation.serializeStep.intercept(position: .after, middleware: ContentTypeMiddleware(contentType: "application/json")) - operation.serializeStep.intercept(position: .after, middleware: ClientRuntime.SerializableBodyMiddleware(xmlName: "PutObjectInput")) + operation.serializeStep.intercept(position: .after, middleware: ContentTypeMiddleware(contentType: "application/json")) + operation.serializeStep.intercept(position: .after, middleware: ClientRuntime.SerializableBodyMiddleware(xmlName: "PutObjectInput")) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.ContentLengthMiddleware()) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) let sigv4Config = AWSClientRuntime.SigV4Config(useDoubleURIEncode: false, shouldNormalizeURIPath: false, expiration: expiration, signedBodyHeader: .contentSha256, unsignedBody: false, signingAlgorithm: .sigv4) - operation.finalizeStep.intercept(position: .before, middleware: AWSClientRuntime.SigV4Middleware(config: sigv4Config)) - operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware()) - operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) + operation.finalizeStep.intercept(position: .before, middleware: AWSClientRuntime.SigV4Middleware(config: sigv4Config)) + operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware()) + operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) let presignedRequestBuilder = try await operation.presignedRequest(context: context, input: input, next: ClientRuntime.NoopHandler()) guard let builtRequest = presignedRequestBuilder?.build() else { return nil diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/AWSQueryOperationStackTest.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/AWSQueryOperationStackTest.kt index 67ec86c0b7e..077ec4e8daa 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/AWSQueryOperationStackTest.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/AWSQueryOperationStackTest.kt @@ -26,8 +26,8 @@ extension QueryProtocolClient: QueryProtocolClientProtocol { /// /// - Parameter NoInputAndOutputInput : [no documentation found] /// - /// - Returns: `NoInputAndOutputOutputResponse` : [no documentation found] - public func noInputAndOutput(input: NoInputAndOutputInput) async throws -> NoInputAndOutputOutputResponse + /// - Returns: `NoInputAndOutputOutput` : [no documentation found] + public func noInputAndOutput(input: NoInputAndOutputInput) async throws -> NoInputAndOutputOutput { let context = ClientRuntime.HttpContextBuilder() .withEncoder(value: encoder) @@ -41,18 +41,18 @@ extension QueryProtocolClient: QueryProtocolClientProtocol { .withCredentialsProvider(value: config.credentialsProvider) .withRegion(value: config.region) .build() - var operation = ClientRuntime.OperationStack(id: "noInputAndOutput") - operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware()) - operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) + var operation = ClientRuntime.OperationStack(id: "noInputAndOutput") + operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLPathMiddleware()) + operation.initializeStep.intercept(position: .after, middleware: ClientRuntime.URLHostMiddleware()) let endpointParams = EndpointParams() - operation.buildStep.intercept(position: .before, middleware: EndpointResolverMiddleware(endpointResolver: config.serviceSpecific.endpointResolver, endpointParams: endpointParams)) + operation.buildStep.intercept(position: .before, middleware: EndpointResolverMiddleware(endpointResolver: config.serviceSpecific.endpointResolver, endpointParams: endpointParams)) operation.buildStep.intercept(position: .before, middleware: AWSClientRuntime.UserAgentMiddleware(metadata: AWSClientRuntime.AWSUserAgentMetadata.fromConfig(serviceID: serviceName, version: "1.0.0", config: config))) - operation.serializeStep.intercept(position: .after, middleware: ClientRuntime.SerializableBodyMiddleware(xmlName: "NoInputAndOutputInput")) - operation.serializeStep.intercept(position: .after, middleware: ContentTypeMiddleware(contentType: "application/x-www-form-urlencoded")) + operation.serializeStep.intercept(position: .after, middleware: ClientRuntime.SerializableBodyMiddleware(xmlName: "NoInputAndOutputInput")) + operation.serializeStep.intercept(position: .after, middleware: ContentTypeMiddleware(contentType: "application/x-www-form-urlencoded")) operation.finalizeStep.intercept(position: .before, middleware: ClientRuntime.ContentLengthMiddleware()) - operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) - operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware()) - operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) + operation.finalizeStep.intercept(position: .after, middleware: ClientRuntime.RetryMiddleware(options: config.retryStrategyOptions)) + operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.DeserializeMiddleware()) + operation.deserializeStep.intercept(position: .after, middleware: ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) let result = try await operation.handleMiddleware(context: context, input: input, next: client.getHandler()) return result } diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/StructDecodeWrappedXMLGeneratorTests.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/StructDecodeWrappedXMLGeneratorTests.kt index 00229045785..67061e5a8dc 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/StructDecodeWrappedXMLGeneratorTests.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/StructDecodeWrappedXMLGeneratorTests.kt @@ -17,13 +17,13 @@ class StructDecodeWrappedXMLGeneratorTests { @Test fun `wrapped map decodable`() { val context = setupTests("awsquery/flattened-map.smithy", "aws.protocoltests.query#AwsQuery") - val contents = getFileContents(context.manifest, "/Example/models/FlattenedXmlMapOutputResponseBody+Decodable.swift") + val contents = getFileContents(context.manifest, "/Example/models/FlattenedXmlMapOutputBody+Decodable.swift") val expectedContents = """ - struct FlattenedXmlMapOutputResponseBody: Swift.Equatable { + struct FlattenedXmlMapOutputBody: Swift.Equatable { let myMap: [Swift.String:Swift.String]? } - extension FlattenedXmlMapOutputResponseBody: Swift.Decodable { + extension FlattenedXmlMapOutputBody: Swift.Decodable { enum CodingKeys: Swift.String, Swift.CodingKey { case myMap } diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/customizations/PresignableUrlIntegrationTests.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/customizations/PresignableUrlIntegrationTests.kt index 7df82b10af8..8df7fec721e 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/customizations/PresignableUrlIntegrationTests.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/customizations/PresignableUrlIntegrationTests.kt @@ -21,7 +21,7 @@ class PresignableUrlIntegrationTests { contents.shouldSyntacticSanityCheck() val expectedContents = """ let sigv4Config = AWSClientRuntime.SigV4Config(signatureType: .requestQueryParams, expiration: expiration, unsignedBody: false, signingAlgorithm: .sigv4) - operation.finalizeStep.intercept(position: .before, middleware: AWSClientRuntime.SigV4Middleware(config: sigv4Config)) + operation.finalizeStep.intercept(position: .before, middleware: AWSClientRuntime.SigV4Middleware(config: sigv4Config)) """ contents.shouldContainOnlyOnce(expectedContents) } @@ -33,7 +33,7 @@ class PresignableUrlIntegrationTests { contents.shouldSyntacticSanityCheck() val expectedContents = """ let sigv4Config = AWSClientRuntime.SigV4Config(signatureType: .requestQueryParams, useDoubleURIEncode: false, shouldNormalizeURIPath: false, expiration: expiration, unsignedBody: true, signingAlgorithm: .sigv4) - operation.finalizeStep.intercept(position: .before, middleware: AWSClientRuntime.SigV4Middleware(config: sigv4Config)) + operation.finalizeStep.intercept(position: .before, middleware: AWSClientRuntime.SigV4Middleware(config: sigv4Config)) """ contents.shouldContainOnlyOnce(expectedContents) } @@ -45,7 +45,7 @@ class PresignableUrlIntegrationTests { contents.shouldSyntacticSanityCheck() val expectedContents = """ let sigv4Config = AWSClientRuntime.SigV4Config(signatureType: .requestQueryParams, useDoubleURIEncode: false, shouldNormalizeURIPath: false, expiration: expiration, unsignedBody: true, signingAlgorithm: .sigv4) - operation.finalizeStep.intercept(position: .before, middleware: AWSClientRuntime.SigV4Middleware(config: sigv4Config)) + operation.finalizeStep.intercept(position: .before, middleware: AWSClientRuntime.SigV4Middleware(config: sigv4Config)) """ contents.shouldContainOnlyOnce(expectedContents) } @@ -74,7 +74,7 @@ public struct PutObjectPresignedURLMiddleware: ClientRuntime.Middleware { public func handle(context: Context, input: ClientRuntime.SerializeStepInput, - next: H) async throws -> ClientRuntime.OperationOutput + next: H) async throws -> ClientRuntime.OperationOutput where H: Handler, Self.MInput == H.Input, Self.MOutput == H.Output, @@ -92,7 +92,7 @@ public struct PutObjectPresignedURLMiddleware: ClientRuntime.Middleware { } public typealias MInput = ClientRuntime.SerializeStepInput - public typealias MOutput = ClientRuntime.OperationOutput + public typealias MOutput = ClientRuntime.OperationOutput public typealias Context = ClientRuntime.HttpContext } """ diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/customizations/S3ExpiresTest.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/customizations/S3ExpiresTest.kt index dc4df790fc8..963a6369f34 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/customizations/S3ExpiresTest.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/customizations/S3ExpiresTest.kt @@ -13,11 +13,11 @@ class S3ExpiresTest { @Test fun `001 test S3 output members named expires are changed to string type`() { val context = setupTests("s3-expires.smithy", "com.amazonaws.s3#S3", "S3") - val contents = TestContextGenerator.getFileContents(context.manifest, "/Example/models/FooOutputResponse.swift") + val contents = TestContextGenerator.getFileContents(context.manifest, "/Example/models/FooOutput.swift") contents.shouldSyntacticSanityCheck() val expectedContents = """ - public struct FooOutputResponse: Swift.Equatable { + public struct FooOutput: Swift.Equatable { public var expires: Swift.String? public var payload1: Swift.String? @@ -61,11 +61,11 @@ class S3ExpiresTest { @Test fun `003 test non-S3 output members named expires are not changed`() { val context = setupTests("s3-expires.smithy", "com.amazonaws.s3#Bar", "Bar") - val contents = TestContextGenerator.getFileContents(context.manifest, "/Example/models/FooOutputResponse.swift") + val contents = TestContextGenerator.getFileContents(context.manifest, "/Example/models/FooOutput.swift") contents.shouldSyntacticSanityCheck() val expectedContents = """ - public struct FooOutputResponse: Swift.Equatable { + public struct FooOutput: Swift.Equatable { public var expires: ClientRuntime.Date? public var payload1: Swift.String? diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/serde/S3UnwrappedXMLOutputTraitTests.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/serde/S3UnwrappedXMLOutputTraitTests.kt index bae1c08965d..623d4def08a 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/serde/S3UnwrappedXMLOutputTraitTests.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/serde/S3UnwrappedXMLOutputTraitTests.kt @@ -12,11 +12,11 @@ class S3UnwrappedXMLOutputTraitTests { @Test fun `001 S3UnwrappedXmlOutputTrait`() { val context = setupTests("restxml/serde/s3unwrappedxmloutput.smithy", "aws.protocoltests.restxml#RestXml") - val contents = getFileContents(context.manifest, "/Example/models/GetBucketLocationOutputResponseBody+Decodable.swift") + val contents = getFileContents(context.manifest, "/Example/models/GetBucketLocationOutputBody+Decodable.swift") val expectedContents = """ - extension GetBucketLocationOutputResponseBody: Swift.Decodable { + extension GetBucketLocationOutputBody: Swift.Decodable { enum CodingKeys: Swift.String, Swift.CodingKey { case locationConstraint = "LocationConstraint" } From 3dede8d29601bd927b9e7530e0966ca517ea5cad Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Tue, 10 Oct 2023 21:56:09 -0500 Subject: [PATCH 2/2] chore!: Require Swift 5.7, fix deprecation warnings (#1173) --- .../Resources/Package.Base.swift | 8 +- Docker/5.5.3/ubuntu/20.04/Dockerfile | 116 ------------------ Package.swift | 10 +- README.md | 2 +- .../CachedCredentialsProviderTests.swift | 27 ++-- codegen/Package.swift | 7 +- 6 files changed, 26 insertions(+), 144 deletions(-) delete mode 100644 Docker/5.5.3/ubuntu/20.04/Dockerfile diff --git a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Resources/Package.Base.swift b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Resources/Package.Base.swift index 7c08283530a..603d5da3a0e 100644 --- a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Resources/Package.Base.swift +++ b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Resources/Package.Base.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.5 +// swift-tools-version:5.7 // // Copyright Amazon.com Inc. or its affiliates. @@ -68,18 +68,18 @@ func addClientRuntimeDependency(_ version: Version) { ] case (false, true): package.dependencies += [ - .package(url: smithySwiftURL, .branch("main")) + .package(url: smithySwiftURL, branch: "main") ] case (false, false): package.dependencies += [ - .package(url: smithySwiftURL, .exact(version)) + .package(url: smithySwiftURL, exact: version) ] } } func addCRTDependency(_ version: Version) { package.dependencies += [ - .package(url: "https://github.com/awslabs/aws-crt-swift", .exact(version)) + .package(url: "https://github.com/awslabs/aws-crt-swift", exact: version) ] } diff --git a/Docker/5.5.3/ubuntu/20.04/Dockerfile b/Docker/5.5.3/ubuntu/20.04/Dockerfile deleted file mode 100644 index ac2d9015f15..00000000000 --- a/Docker/5.5.3/ubuntu/20.04/Dockerfile +++ /dev/null @@ -1,116 +0,0 @@ -FROM swift:5.5.3-focal - -# Install Open SSL -- dependency of CRT -RUN apt-get -q update && \ - apt-get -q install -y libssl-dev - -## The rest of this file is from https://github.com/aws/aws-codebuild-docker-images/blob/master/ubuntu/standard/5.0/Dockerfile - -# Install other utilities -RUN apt-get install -y -qq --no-install-recommends \ - curl unzip wget - -## Install Java - -#**************** JAVA **************************************************** -ENV JAVA_11_HOME="/usr/lib/jvm/java-11-amazon-corretto" -ENV JDK_11_HOME="/usr/lib/jvm/java-11-amazon-corretto" -ENV JRE_11_HOME="/usr/lib/jvm/java-11-amazon-corretto" -ENV JAVA_8_HOME="/usr/lib/jvm/java-1.8.0-amazon-corretto" -ENV JDK_8_HOME="/usr/lib/jvm/java-1.8.0-amazon-corretto" -ENV JRE_8_HOME="/usr/lib/jvm/java-1.8.0-amazon-corretto/jre" -ARG ANT_VERSION=1.10.12 -ARG MAVEN_HOME="/opt/maven" -ARG MAVEN_VERSION=3.6.3 -ARG INSTALLED_GRADLE_VERSIONS="5.6.4 6.7.1" -ARG GRADLE_VERSION=5.6.4 -ARG SBT_VERSION=1.6.2 -ARG GRADLE_PATH="$SRC_DIR/gradle" -ARG ANT_DOWNLOAD_SHA512="2287dc5cfc21043c14e5413f9afb1c87c9f266ec2a9ba2d3bf2285446f6e4ccb59b558bf2e5c57911a05dfa293c7d5c7ad60ac9f744ba11406f4e6f9a27b2403" -ARG MAVEN_DOWNLOAD_SHA512="c35a1803a6e70a126e80b2b3ae33eed961f83ed74d18fcd16909b2d44d7dada3203f1ffe726c17ef8dcca2dcaa9fca676987befeadc9b9f759967a8cb77181c0" -ARG GRADLE_DOWNLOADS_SHA256="abc10bcedb58806e8654210f96031db541bcd2d6fc3161e81cb0572d6a15e821 5.6.4\n22449f5231796abd892c98b2a07c9ceebe4688d192cd2d6763f8e3bf8acbedeb 6.7.1" -ARG SBT_DOWNLOAD_SHA256="637637b6c4e6fa04ab62cd364061e32b12480b09001cd23303df62b36fadd440" -ENV LOG4J_UNSAFE_VERSIONS="2.11.1 1.2.8" - -ARG MAVEN_CONFIG_HOME="/root/.m2" - -ENV JAVA_HOME="$JAVA_11_HOME" \ - JDK_HOME="$JDK_11_HOME" \ - JRE_HOME="$JRE_11_HOME" - -ENV PATH="${PATH}:/opt/tools" - -RUN set -ex \ - && apt-get update \ - && apt-get install -y -qq software-properties-common apt-utils \ - # Install Corretto 8 - && wget -qO- https://apt.corretto.aws/corretto.key | apt-key add - \ - && add-apt-repository 'deb https://apt.corretto.aws stable main' \ - && apt-get update \ - && apt-get install -y -qq java-1.8.0-amazon-corretto-jdk \ - && apt-get install -y -qq --no-install-recommends ca-certificates-java \ - # Ensure Java cacerts symlink points to valid location - && update-ca-certificates -f \ - && dpkg --add-architecture i386 \ - && apt-get update \ - && apt-get install -y -qq --force-yes libc6-i386 \ - lib32stdc++6 lib32gcc1 lib32ncurses6 \ - lib32z1 libqt5widgets5 - -RUN set -ex \ - # Install Corretto 11 - # Note: We will use update-alternatives to make sure JDK11 has higher priority for all the tools - && apt-get install -y -qq java-11-amazon-corretto-jdk \ - && for tool_path in $JAVA_HOME/bin/*; do \ - tool=`basename $tool_path`; \ - update-alternatives --install /usr/bin/$tool $tool $tool_path 10000; \ - update-alternatives --set $tool $tool_path; \ - done \ - && rm $JAVA_HOME/lib/security/cacerts && ln -s /etc/ssl/certs/java/cacerts $JAVA_HOME/lib/security/cacerts \ - # Install Ant - && curl -LSso /var/tmp/apache-ant-$ANT_VERSION-bin.tar.gz https://archive.apache.org/dist/ant/binaries/apache-ant-$ANT_VERSION-bin.tar.gz \ - && echo "$ANT_DOWNLOAD_SHA512 /var/tmp/apache-ant-$ANT_VERSION-bin.tar.gz" | sha512sum -c - \ - && tar -xzf /var/tmp/apache-ant-$ANT_VERSION-bin.tar.gz -C /opt \ - && rm /var/tmp/apache-ant-$ANT_VERSION-bin.tar.gz \ - && update-alternatives --install /usr/bin/ant ant /opt/apache-ant-$ANT_VERSION/bin/ant 10000 - -RUN set -ex \ - # Install Maven - && mkdir -p $MAVEN_HOME \ - && curl -LSso /var/tmp/apache-maven-$MAVEN_VERSION-bin.tar.gz https://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz \ - && echo "$MAVEN_DOWNLOAD_SHA512 /var/tmp/apache-maven-$MAVEN_VERSION-bin.tar.gz" | sha512sum -c - \ - && tar xzf /var/tmp/apache-maven-$MAVEN_VERSION-bin.tar.gz -C $MAVEN_HOME --strip-components=1 \ - && rm /var/tmp/apache-maven-$MAVEN_VERSION-bin.tar.gz \ - && update-alternatives --install /usr/bin/mvn mvn /opt/maven/bin/mvn 10000 \ - && mkdir -p $MAVEN_CONFIG_HOME \ - # Install Gradle - && mkdir -p $GRADLE_PATH \ - && for version in $INSTALLED_GRADLE_VERSIONS; do { \ - wget -q "https://services.gradle.org/distributions/gradle-$version-all.zip" -O "$GRADLE_PATH/gradle-$version-all.zip" \ - && unzip -q "$GRADLE_PATH/gradle-$version-all.zip" -d /usr/local \ - && echo "$GRADLE_DOWNLOADS_SHA256" | grep "$version" | sed "s|$version|$GRADLE_PATH/gradle-$version-all.zip|" | sha256sum -c - \ - && rm "$GRADLE_PATH/gradle-$version-all.zip" \ - && mkdir "/tmp/gradle-$version" \ - && "/usr/local/gradle-$version/bin/gradle" -p "/tmp/gradle-$version" wrapper \ - # Android Studio uses the "-all" distribution for it's wrapper script. - && perl -pi -e "s/gradle-$version-bin.zip/gradle-$version-all.zip/" "/tmp/gradle-$version/gradle/wrapper/gradle-wrapper.properties" \ - && "/tmp/gradle-$version/gradlew" -p "/tmp/gradle-$version" init \ - && rm -rf "/tmp/gradle-$version" \ - && if [ "$version" != "$GRADLE_VERSION" ]; then rm -rf "/usr/local/gradle-$version"; fi; \ - }; done \ - # Install default GRADLE_VERSION to path - && ln -s /usr/local/gradle-$GRADLE_VERSION/bin/gradle /usr/bin/gradle \ - && rm -rf $GRADLE_PATH \ - # Install SBT - && curl -fSL "https://github.com/sbt/sbt/releases/download/v${SBT_VERSION}/sbt-${SBT_VERSION}.tgz" -o sbt.tgz \ - && echo "${SBT_DOWNLOAD_SHA256} *sbt.tgz" | sha256sum -c - \ - && tar xzf sbt.tgz -C /usr/local/bin/ \ - && rm sbt.tgz \ - && for version in $LOG4J_UNSAFE_VERSIONS; do find / -name log4j*-$version.jar | xargs rm -f; done - -ENV PATH "/usr/local/bin/sbt/bin:$PATH" -RUN sbt version -Dsbt.rootdir=true -# Cleanup -RUN rm -fr /var/lib/apt/lists/* /tmp/* /var/tmp/* \ - && apt-get clean -#**************** END JAVA **************************************************** \ No newline at end of file diff --git a/Package.swift b/Package.swift index 194a5ba6eea..977f8f365ec 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.5 +// swift-tools-version:5.7 // // Copyright Amazon.com Inc. or its affiliates. @@ -68,18 +68,18 @@ func addClientRuntimeDependency(_ version: Version) { ] case (false, true): package.dependencies += [ - .package(url: smithySwiftURL, .branch("main")) + .package(url: smithySwiftURL, branch: "main") ] case (false, false): package.dependencies += [ - .package(url: smithySwiftURL, .exact(version)) + .package(url: smithySwiftURL, exact: version) ] } } func addCRTDependency(_ version: Version) { package.dependencies += [ - .package(url: "https://github.com/awslabs/aws-crt-swift", .exact(version)) + .package(url: "https://github.com/awslabs/aws-crt-swift", exact: version) ] } @@ -555,4 +555,4 @@ let servicesWithIntegrationTests: [String] = [ servicesWithIntegrationTests.forEach(addIntegrationTestTarget) // Uncomment this line to enable protocol tests -// addProtocolTests() \ No newline at end of file +addProtocolTests() \ No newline at end of file diff --git a/README.md b/README.md index 9b900ecd8de..c90e556f41f 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ $ swift package init --type executable 2. Edit your new package's `Package.swift` file to read: ``` -// swift-tools-version: 5.5 +// swift-tools-version: 5.7 import PackageDescription diff --git a/Tests/Core/AWSClientRuntimeTests/Auth/CredentialsProvidersTests/CachedCredentialsProviderTests.swift b/Tests/Core/AWSClientRuntimeTests/Auth/CredentialsProvidersTests/CachedCredentialsProviderTests.swift index 0aeab234a9e..0695217946a 100644 --- a/Tests/Core/AWSClientRuntimeTests/Auth/CredentialsProvidersTests/CachedCredentialsProviderTests.swift +++ b/Tests/Core/AWSClientRuntimeTests/Auth/CredentialsProvidersTests/CachedCredentialsProviderTests.swift @@ -12,31 +12,34 @@ import XCTest @_spi(FileBasedConfig) @testable import AWSClientRuntime class CachedCredentialsProviderTests: XCTestCase { + func testGetCredentials() async throws { var counter: Int = 0 + let accessKey = UUID().uuidString + let secret = UUID().uuidString let coreProvider = MockCredentialsProvider { counter += 1 - return .init(accessKey: "some_access_key", secret: "some_secret") + return .init(accessKey: accessKey, secret: secret) } - let subject = try CachedCredentialsProvider( source: coreProvider, - refreshTime: 1 + refreshTime: 0.01 ) - + _ = try await subject.getCredentials() _ = try await subject.getCredentials() _ = try await subject.getCredentials() _ = try await subject.getCredentials() - + + // Counter is 1 because the last three accesses use cached credentials XCTAssertEqual(counter, 1) - - try! await Task.sleep(nanoseconds: 1 * 1_000_000_000) - - let credentials = try! await subject.getCredentials() - + + try! await Task.sleep(nanoseconds: 1_000_000_000 / 100) // 0.01 seconds + let credentials = try await subject.getCredentials() + + // Counter is 2 because we slept long enough for cache to expire XCTAssertEqual(counter, 2) - XCTAssertEqual(credentials.accessKey, "some_access_key") - XCTAssertEqual(credentials.secret, "some_secret") + XCTAssertEqual(credentials.accessKey, accessKey) + XCTAssertEqual(credentials.secret, secret) } } diff --git a/codegen/Package.swift b/codegen/Package.swift index 3378aa90951..e8ee7fa856e 100644 --- a/codegen/Package.swift +++ b/codegen/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.5.0 +// swift-tools-version:5.7 /* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. @@ -7,7 +7,6 @@ import PackageDescription import class Foundation.ProcessInfo -import class Foundation.FileManager let baseDir = "./protocol-test-codegen/build/smithyprojections/protocol-test-codegen" let baseDirLocal = "./protocol-test-codegen-local/build/smithyprojections/protocol-test-codegen-local" @@ -87,11 +86,7 @@ func appendLibTarget(name: String, path: String) { func appendTstTarget(name: String, path: String, dependency: String) { var dependencies: [Target.Dependency] = [.product(name: "SmithyTestUtil", package: "smithy-swift")] -#if swift(>=5.7) dependencies.append(.byNameItem(name: dependency, condition: nil)) -#else - dependencies.append(._byNameItem(name: dependency, condition: nil)) -#endif package.targets.append(.testTarget(name: name, dependencies: dependencies, path: "\(path)/swift-codegen/\(name)")