diff --git a/Sources/Services/AWSBedrockAgentRuntime/models/Models.swift b/Sources/Services/AWSBedrockAgentRuntime/models/Models.swift index a03163e97c1..8e6fa989ece 100644 --- a/Sources/Services/AWSBedrockAgentRuntime/models/Models.swift +++ b/Sources/Services/AWSBedrockAgentRuntime/models/Models.swift @@ -2760,17 +2760,17 @@ extension BedrockAgentRuntimeClientTypes.RetrieveAndGenerateInput: Swift.Codable } } -extension RetrieveAndGenerateInput: Swift.CustomDebugStringConvertible { - public var debugDescription: Swift.String { - "RetrieveAndGenerateInput(retrieveAndGenerateConfiguration: \(Swift.String(describing: retrieveAndGenerateConfiguration)), sessionConfiguration: \(Swift.String(describing: sessionConfiguration)), sessionId: \(Swift.String(describing: sessionId)), input: \"CONTENT_REDACTED\")"} -} - extension BedrockAgentRuntimeClientTypes.RetrieveAndGenerateInput: Swift.CustomDebugStringConvertible { public var debugDescription: Swift.String { "CONTENT_REDACTED" } } +extension RetrieveAndGenerateInput: Swift.CustomDebugStringConvertible { + public var debugDescription: Swift.String { + "RetrieveAndGenerateInput(retrieveAndGenerateConfiguration: \(Swift.String(describing: retrieveAndGenerateConfiguration)), sessionConfiguration: \(Swift.String(describing: sessionConfiguration)), sessionId: \(Swift.String(describing: sessionId)), input: \"CONTENT_REDACTED\")"} +} + extension RetrieveAndGenerateInput: Swift.Encodable { enum CodingKeys: Swift.String, Swift.CodingKey { case input @@ -2803,6 +2803,23 @@ extension RetrieveAndGenerateInput { } } +extension BedrockAgentRuntimeClientTypes { + /// Contains the query made to the knowledge base. + public struct RetrieveAndGenerateInput: Swift.Equatable { + /// The query made to the knowledge base. + /// This member is required. + public var text: Swift.String? + + public init( + text: Swift.String? = nil + ) + { + self.text = text + } + } + +} + public struct RetrieveAndGenerateInput: Swift.Equatable { /// Contains the query made to the knowledge base. /// This member is required. @@ -2828,23 +2845,6 @@ public struct RetrieveAndGenerateInput: Swift.Equatable { } } -extension BedrockAgentRuntimeClientTypes { - /// Contains the query made to the knowledge base. - public struct RetrieveAndGenerateInput: Swift.Equatable { - /// The query made to the knowledge base. - /// This member is required. - public var text: Swift.String? - - public init( - text: Swift.String? = nil - ) - { - self.text = text - } - } - -} - struct RetrieveAndGenerateInputBody: Swift.Equatable { let sessionId: Swift.String? let input: BedrockAgentRuntimeClientTypes.RetrieveAndGenerateInput? @@ -2892,17 +2892,17 @@ extension BedrockAgentRuntimeClientTypes.RetrieveAndGenerateOutput: Swift.Codabl } } -extension RetrieveAndGenerateOutput: Swift.CustomDebugStringConvertible { - public var debugDescription: Swift.String { - "RetrieveAndGenerateOutput(citations: \(Swift.String(describing: citations)), sessionId: \(Swift.String(describing: sessionId)), output: \"CONTENT_REDACTED\")"} -} - extension BedrockAgentRuntimeClientTypes.RetrieveAndGenerateOutput: Swift.CustomDebugStringConvertible { public var debugDescription: Swift.String { "CONTENT_REDACTED" } } +extension RetrieveAndGenerateOutput: Swift.CustomDebugStringConvertible { + public var debugDescription: Swift.String { + "RetrieveAndGenerateOutput(citations: \(Swift.String(describing: citations)), sessionId: \(Swift.String(describing: sessionId)), output: \"CONTENT_REDACTED\")"} +} + extension RetrieveAndGenerateOutput: ClientRuntime.HttpResponseBinding { public init(httpResponse: ClientRuntime.HttpResponse, decoder: ClientRuntime.ResponseDecoder? = nil) async throws { if let data = try await httpResponse.body.readData(), @@ -2919,6 +2919,23 @@ extension RetrieveAndGenerateOutput: ClientRuntime.HttpResponseBinding { } } +extension BedrockAgentRuntimeClientTypes { + /// Contains the response generated from querying the knowledge base. + public struct RetrieveAndGenerateOutput: Swift.Equatable { + /// The response generated from querying the knowledge base. + /// This member is required. + public var text: Swift.String? + + public init( + text: Swift.String? = nil + ) + { + self.text = text + } + } + +} + public struct RetrieveAndGenerateOutput: Swift.Equatable { /// A list of segments of the generated response that are based on sources in the knowledge base, alongside information about the sources. public var citations: [BedrockAgentRuntimeClientTypes.Citation]? @@ -2941,23 +2958,6 @@ public struct RetrieveAndGenerateOutput: Swift.Equatable { } } -extension BedrockAgentRuntimeClientTypes { - /// Contains the response generated from querying the knowledge base. - public struct RetrieveAndGenerateOutput: Swift.Equatable { - /// The response generated from querying the knowledge base. - /// This member is required. - public var text: Swift.String? - - public init( - text: Swift.String? = nil - ) - { - self.text = text - } - } - -} - struct RetrieveAndGenerateOutputBody: Swift.Equatable { let sessionId: Swift.String? let output: BedrockAgentRuntimeClientTypes.RetrieveAndGenerateOutput? diff --git a/Sources/Services/AWSElasticTranscoder/models/Models.swift b/Sources/Services/AWSElasticTranscoder/models/Models.swift index 41426ff82f7..b68d2428589 100644 --- a/Sources/Services/AWSElasticTranscoder/models/Models.swift +++ b/Sources/Services/AWSElasticTranscoder/models/Models.swift @@ -1050,19 +1050,6 @@ extension CreateJobOutput: ClientRuntime.HttpResponseBinding { } } -/// The CreateJobResponse structure. -public struct CreateJobOutput: Swift.Equatable { - /// A section of the response body that provides information about the job that is created. - public var job: ElasticTranscoderClientTypes.Job? - - public init( - job: ElasticTranscoderClientTypes.Job? = nil - ) - { - self.job = job - } -} - extension ElasticTranscoderClientTypes { /// The CreateJobOutput structure. public struct CreateJobOutput: Swift.Equatable { @@ -1136,6 +1123,19 @@ extension ElasticTranscoderClientTypes { } +/// The CreateJobResponse structure. +public struct CreateJobOutput: Swift.Equatable { + /// A section of the response body that provides information about the job that is created. + public var job: ElasticTranscoderClientTypes.Job? + + public init( + job: ElasticTranscoderClientTypes.Job? = nil + ) + { + self.job = job + } +} + struct CreateJobOutputBody: Swift.Equatable { let job: ElasticTranscoderClientTypes.Job? } diff --git a/Sources/Services/AWSGlacier/models/Models.swift b/Sources/Services/AWSGlacier/models/Models.swift index fad22e09f09..044a88053a6 100644 --- a/Sources/Services/AWSGlacier/models/Models.swift +++ b/Sources/Services/AWSGlacier/models/Models.swift @@ -1560,6 +1560,39 @@ extension DescribeVaultOutput: ClientRuntime.HttpResponseBinding { } } +/// Contains the Amazon S3 Glacier response to your request. +public struct DescribeVaultOutput: Swift.Equatable { + /// The Universal Coordinated Time (UTC) date when the vault was created. This value should be a string in the ISO 8601 date format, for example 2012-03-20T17:03:43.221Z. + public var creationDate: Swift.String? + /// The Universal Coordinated Time (UTC) date when Amazon S3 Glacier completed the last vault inventory. This value should be a string in the ISO 8601 date format, for example 2012-03-20T17:03:43.221Z. + public var lastInventoryDate: Swift.String? + /// The number of archives in the vault as of the last inventory date. This field will return null if an inventory has not yet run on the vault, for example if you just created the vault. + public var numberOfArchives: Swift.Int + /// Total size, in bytes, of the archives in the vault as of the last inventory date. This field will return null if an inventory has not yet run on the vault, for example if you just created the vault. + public var sizeInBytes: Swift.Int + /// The Amazon Resource Name (ARN) of the vault. + public var vaultARN: Swift.String? + /// The name of the vault. + public var vaultName: Swift.String? + + public init( + creationDate: Swift.String? = nil, + lastInventoryDate: Swift.String? = nil, + numberOfArchives: Swift.Int = 0, + sizeInBytes: Swift.Int = 0, + vaultARN: Swift.String? = nil, + vaultName: Swift.String? = nil + ) + { + self.creationDate = creationDate + self.lastInventoryDate = lastInventoryDate + self.numberOfArchives = numberOfArchives + self.sizeInBytes = sizeInBytes + self.vaultARN = vaultARN + self.vaultName = vaultName + } +} + extension GlacierClientTypes { /// Contains the Amazon S3 Glacier response to your request. public struct DescribeVaultOutput: Swift.Equatable { @@ -1596,39 +1629,6 @@ extension GlacierClientTypes { } -/// Contains the Amazon S3 Glacier response to your request. -public struct DescribeVaultOutput: Swift.Equatable { - /// The Universal Coordinated Time (UTC) date when the vault was created. This value should be a string in the ISO 8601 date format, for example 2012-03-20T17:03:43.221Z. - public var creationDate: Swift.String? - /// The Universal Coordinated Time (UTC) date when Amazon S3 Glacier completed the last vault inventory. This value should be a string in the ISO 8601 date format, for example 2012-03-20T17:03:43.221Z. - public var lastInventoryDate: Swift.String? - /// The number of archives in the vault as of the last inventory date. This field will return null if an inventory has not yet run on the vault, for example if you just created the vault. - public var numberOfArchives: Swift.Int - /// Total size, in bytes, of the archives in the vault as of the last inventory date. This field will return null if an inventory has not yet run on the vault, for example if you just created the vault. - public var sizeInBytes: Swift.Int - /// The Amazon Resource Name (ARN) of the vault. - public var vaultARN: Swift.String? - /// The name of the vault. - public var vaultName: Swift.String? - - public init( - creationDate: Swift.String? = nil, - lastInventoryDate: Swift.String? = nil, - numberOfArchives: Swift.Int = 0, - sizeInBytes: Swift.Int = 0, - vaultARN: Swift.String? = nil, - vaultName: Swift.String? = nil - ) - { - self.creationDate = creationDate - self.lastInventoryDate = lastInventoryDate - self.numberOfArchives = numberOfArchives - self.sizeInBytes = sizeInBytes - self.vaultARN = vaultARN - self.vaultName = vaultName - } -} - struct DescribeVaultOutputBody: Swift.Equatable { let vaultARN: Swift.String? let vaultName: Swift.String? diff --git a/Sources/Services/AWSRoute53RecoveryReadiness/models/Models.swift b/Sources/Services/AWSRoute53RecoveryReadiness/models/Models.swift index aa9b14c7c52..c8c91834f6e 100644 --- a/Sources/Services/AWSRoute53RecoveryReadiness/models/Models.swift +++ b/Sources/Services/AWSRoute53RecoveryReadiness/models/Models.swift @@ -3561,22 +3561,6 @@ extension ListRulesOutput: ClientRuntime.HttpResponseBinding { } } -public struct ListRulesOutput: Swift.Equatable { - /// The token that identifies which batch of results you want to see. - public var nextToken: Swift.String? - /// A list of readiness rules for a specific resource type. - public var rules: [Route53RecoveryReadinessClientTypes.ListRulesOutput]? - - public init( - nextToken: Swift.String? = nil, - rules: [Route53RecoveryReadinessClientTypes.ListRulesOutput]? = nil - ) - { - self.nextToken = nextToken - self.rules = rules - } -} - extension Route53RecoveryReadinessClientTypes { /// Readiness rule information, including the resource type, rule ID, and rule description. public struct ListRulesOutput: Swift.Equatable { @@ -3604,6 +3588,22 @@ extension Route53RecoveryReadinessClientTypes { } +public struct ListRulesOutput: Swift.Equatable { + /// The token that identifies which batch of results you want to see. + public var nextToken: Swift.String? + /// A list of readiness rules for a specific resource type. + public var rules: [Route53RecoveryReadinessClientTypes.ListRulesOutput]? + + public init( + nextToken: Swift.String? = nil, + rules: [Route53RecoveryReadinessClientTypes.ListRulesOutput]? = nil + ) + { + self.nextToken = nextToken + self.rules = rules + } +} + struct ListRulesOutputBody: Swift.Equatable { let nextToken: Swift.String? let rules: [Route53RecoveryReadinessClientTypes.ListRulesOutput]? diff --git a/Sources/Services/AWSS3Control/models/Models.swift b/Sources/Services/AWSS3Control/models/Models.swift index e4294d546e2..08884d26a36 100644 --- a/Sources/Services/AWSS3Control/models/Models.swift +++ b/Sources/Services/AWSS3Control/models/Models.swift @@ -11824,6 +11824,28 @@ extension PutMultiRegionAccessPointPolicyInput { } } +extension S3ControlClientTypes { + /// A container for the information associated with a [PutMultiRegionAccessPoint](https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutMultiRegionAccessPoint.html) request. + public struct PutMultiRegionAccessPointPolicyInput: Swift.Equatable { + /// The name of the Multi-Region Access Point associated with the request. + /// This member is required. + public var name: Swift.String? + /// The policy details for the PutMultiRegionAccessPoint request. + /// This member is required. + public var policy: Swift.String? + + public init( + name: Swift.String? = nil, + policy: Swift.String? = nil + ) + { + self.name = name + self.policy = policy + } + } + +} + public struct PutMultiRegionAccessPointPolicyInput: Swift.Equatable { /// The Amazon Web Services account ID for the owner of the Multi-Region Access Point. /// This member is required. @@ -11847,28 +11869,6 @@ public struct PutMultiRegionAccessPointPolicyInput: Swift.Equatable { } } -extension S3ControlClientTypes { - /// A container for the information associated with a [PutMultiRegionAccessPoint](https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutMultiRegionAccessPoint.html) request. - public struct PutMultiRegionAccessPointPolicyInput: Swift.Equatable { - /// The name of the Multi-Region Access Point associated with the request. - /// This member is required. - public var name: Swift.String? - /// The policy details for the PutMultiRegionAccessPoint request. - /// This member is required. - public var policy: Swift.String? - - public init( - name: Swift.String? = nil, - policy: Swift.String? = nil - ) - { - self.name = name - self.policy = policy - } - } - -} - extension PutMultiRegionAccessPointPolicyOutput { static var httpBinding: ClientRuntime.HTTPResponseOutputBinding { diff --git a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/PresignerGenerator.kt b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/PresignerGenerator.kt index d957ebecca2..5a3a57157a0 100644 --- a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/PresignerGenerator.kt +++ b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/PresignerGenerator.kt @@ -14,7 +14,7 @@ import software.amazon.smithy.swift.codegen.ClientRuntimeTypes.Middleware.NoopHa import software.amazon.smithy.swift.codegen.FoundationTypes import software.amazon.smithy.swift.codegen.SwiftDelegator import software.amazon.smithy.swift.codegen.SwiftWriter -import software.amazon.smithy.swift.codegen.core.CodegenContext +import software.amazon.smithy.swift.codegen.core.SwiftCodegenContext import software.amazon.smithy.swift.codegen.core.toProtocolGenerationContext import software.amazon.smithy.swift.codegen.integration.ProtocolGenerator import software.amazon.smithy.swift.codegen.integration.SwiftIntegration @@ -29,7 +29,7 @@ data class PresignableOperation( ) class PresignerGenerator : SwiftIntegration { - override fun writeAdditionalFiles(ctx: CodegenContext, protoCtx: ProtocolGenerator.GenerationContext, delegator: SwiftDelegator) { + override fun writeAdditionalFiles(ctx: SwiftCodegenContext, protoCtx: ProtocolGenerator.GenerationContext, delegator: SwiftDelegator) { val service = ctx.model.expectShape(ctx.settings.service) if (!SigV4Utils.isSupportedAuthentication(ctx.model, service)) return @@ -66,7 +66,7 @@ class PresignerGenerator : SwiftIntegration { private fun renderPresigner( writer: SwiftWriter, - ctx: CodegenContext, + ctx: SwiftCodegenContext, delegator: SwiftDelegator, op: OperationShape, inputType: String, diff --git a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/customization/machinelearning/PredictEndpointIntegration.kt b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/customization/machinelearning/PredictEndpointIntegration.kt index 30ac25eda1f..780e182a272 100644 --- a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/customization/machinelearning/PredictEndpointIntegration.kt +++ b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/customization/machinelearning/PredictEndpointIntegration.kt @@ -9,7 +9,7 @@ import software.amazon.smithy.swift.codegen.MiddlewareGenerator import software.amazon.smithy.swift.codegen.SwiftDelegator import software.amazon.smithy.swift.codegen.SwiftDependency import software.amazon.smithy.swift.codegen.SwiftSettings -import software.amazon.smithy.swift.codegen.core.CodegenContext +import software.amazon.smithy.swift.codegen.core.SwiftCodegenContext import software.amazon.smithy.swift.codegen.core.toProtocolGenerationContext import software.amazon.smithy.swift.codegen.integration.ProtocolGenerator import software.amazon.smithy.swift.codegen.integration.SwiftIntegration @@ -30,7 +30,7 @@ class PredictEndpointIntegration(private val enabledOperations: Map(settings.service).id.toString() return enabledOperations.keys.contains(currentServiceId) } - override fun writeAdditionalFiles(ctx: CodegenContext, protoCtx: ProtocolGenerator.GenerationContext, delegator: SwiftDelegator) { + override fun writeAdditionalFiles(ctx: SwiftCodegenContext, protoCtx: ProtocolGenerator.GenerationContext, delegator: SwiftDelegator) { val serviceShape = ctx.model.expectShape(ctx.settings.service) val protocolGeneratorContext = ctx.toProtocolGenerationContext(serviceShape, delegator)?.let { it } ?: run { return } val service = ctx.model.expectShape(ctx.settings.service) diff --git a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/customization/presignable/PresignableUrlIntegration.kt b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/customization/presignable/PresignableUrlIntegration.kt index 9446a1e68e6..dcca0ecf1f9 100644 --- a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/customization/presignable/PresignableUrlIntegration.kt +++ b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/customization/presignable/PresignableUrlIntegration.kt @@ -20,7 +20,7 @@ import software.amazon.smithy.swift.codegen.SwiftDelegator import software.amazon.smithy.swift.codegen.SwiftDependency import software.amazon.smithy.swift.codegen.SwiftSettings import software.amazon.smithy.swift.codegen.SwiftWriter -import software.amazon.smithy.swift.codegen.core.CodegenContext +import software.amazon.smithy.swift.codegen.core.SwiftCodegenContext import software.amazon.smithy.swift.codegen.core.toProtocolGenerationContext import software.amazon.smithy.swift.codegen.integration.ProtocolGenerator import software.amazon.smithy.swift.codegen.integration.SwiftIntegration @@ -49,7 +49,7 @@ class PresignableUrlIntegration(private val presignedOperations: Map(ctx.settings.service) if (!SigV4Utils.isSupportedAuthentication(ctx.model, service)) return @@ -89,7 +89,7 @@ class PresignableUrlIntegration(private val presignedOperations: Map(codegenContext.settings.service) val ctx = codegenContext.toProtocolGenerationContext(serviceShape, delegator)?.let { it } ?: run { return } @@ -243,7 +243,7 @@ class PresignableUrlIntegration(private val presignedOperations: Map(codegenContext.settings.service) val ctx = codegenContext.toProtocolGenerationContext(serviceShape, delegator)?.let { it } ?: run { return } diff --git a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/customization/route53/Route53InvalidBatchErrorIntegration.kt b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/customization/route53/Route53InvalidBatchErrorIntegration.kt index 4766a775911..12d8aef0c55 100644 --- a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/customization/route53/Route53InvalidBatchErrorIntegration.kt +++ b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/customization/route53/Route53InvalidBatchErrorIntegration.kt @@ -8,7 +8,7 @@ import software.amazon.smithy.swift.codegen.SwiftDelegator import software.amazon.smithy.swift.codegen.SwiftDependency import software.amazon.smithy.swift.codegen.SwiftSettings import software.amazon.smithy.swift.codegen.SwiftWriter -import software.amazon.smithy.swift.codegen.core.CodegenContext +import software.amazon.smithy.swift.codegen.core.SwiftCodegenContext import software.amazon.smithy.swift.codegen.integration.ProtocolGenerator import software.amazon.smithy.swift.codegen.integration.SectionWriter import software.amazon.smithy.swift.codegen.integration.SectionWriterBinding @@ -38,7 +38,7 @@ class Route53InvalidBatchErrorIntegration : SwiftIntegration { writer.write(previousCode) } - override fun writeAdditionalFiles(ctx: CodegenContext, protocolGenerationContext: ProtocolGenerator.GenerationContext, delegator: SwiftDelegator) { + override fun writeAdditionalFiles(ctx: SwiftCodegenContext, protocolGenerationContext: ProtocolGenerator.GenerationContext, delegator: SwiftDelegator) { delegator.useFileWriter("${ctx.settings.moduleName}/models/ChangeResourceRecordSetsOutputError+Customization.swift") { writer -> writer.addImport(SwiftDependency.CLIENT_RUNTIME.target) renderCustomInvalidBatchError(writer) 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 e327f232127..ee0fcfdf377 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 @@ -2,7 +2,7 @@ package software.amazon.smithy.aws.swift.codegen import io.kotest.matchers.string.shouldContainOnlyOnce import org.junit.jupiter.api.Test -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator.Companion.getFileContents +import software.amazon.smithy.aws.swift.codegen.TestUtils.Companion.getFileContents import software.amazon.smithy.aws.swift.codegen.restjson.AWSRestJson1ProtocolGenerator import software.amazon.smithy.aws.traits.protocols.RestJson1Trait @@ -230,7 +230,7 @@ extension EventStreamTestClientTypes.TestStream: ClientRuntime.MessageUnmarshall } private fun setupTests(smithyFile: String, serviceShapeId: String): TestContext { - val context = TestContextGenerator.initContextFrom(smithyFile, serviceShapeId, RestJson1Trait.ID) + val context = TestUtils.executeDirectedCodegen(smithyFile, serviceShapeId, RestJson1Trait.ID) val generator = AWSRestJson1ProtocolGenerator() generator.generateProtocolUnitTests(context.ctx) 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 3877c15805b..09321a31f9a 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 @@ -33,6 +33,6 @@ operationStack.buildStep.intercept(position: .before, middleware: EndpointResolv } fun setupGenerationContext(smithyFile: String, serviceShapeId: String): ProtocolGenerator.GenerationContext { - val context = TestContextGenerator.initContextFrom(smithyFile, serviceShapeId, RestJson1Trait.ID) + val context = TestUtils.executeDirectedCodegen(smithyFile, serviceShapeId, RestJson1Trait.ID) return ProtocolGenerator.GenerationContext(context.ctx.settings, context.ctx.model, context.ctx.service, context.ctx.symbolProvider, listOf(), RestJson1Trait.ID, context.ctx.delegator) } 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 f3399b1da29..3ac3d4844f6 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 @@ -9,7 +9,7 @@ class PresignerGeneratorTests { @Test fun `001 presignable on getFooInput`() { val context = setupTests("awsrestjson1/presignable.smithy", "smithy.swift.traits#Example") - val contents = TestContextGenerator.getFileContents(context.manifest, "/Example/models/GetFooInput+Presigner.swift") + val contents = TestUtils.getFileContents(context.manifest, "/Example/models/GetFooInput+Presigner.swift") contents.shouldSyntacticSanityCheck() val expectedContents = """ extension GetFooInput { @@ -66,7 +66,7 @@ extension GetFooInput { @Test fun `002 presignable on postFooInput`() { val context = setupTests("awsrestjson1/presignable.smithy", "smithy.swift.traits#Example") - val contents = TestContextGenerator.getFileContents(context.manifest, "/Example/models/PostFooInput+Presigner.swift") + val contents = TestUtils.getFileContents(context.manifest, "/Example/models/PostFooInput+Presigner.swift") contents.shouldSyntacticSanityCheck() val expectedContents = """ extension PostFooInput { @@ -126,7 +126,7 @@ extension PostFooInput { @Test fun `003 presignable on putFooInput`() { val context = setupTests("awsrestjson1/presignable.smithy", "smithy.swift.traits#Example") - val contents = TestContextGenerator.getFileContents(context.manifest, "/Example/models/PutFooInput+Presigner.swift") + val contents = TestUtils.getFileContents(context.manifest, "/Example/models/PutFooInput+Presigner.swift") contents.shouldSyntacticSanityCheck() val expectedContents = """ extension PutFooInput { @@ -186,7 +186,7 @@ extension PutFooInput { @Test fun `004 presignable on S3`() { val context = setupTests("presign-urls-s3.smithy", "com.amazonaws.s3#AmazonS3") - val contents = TestContextGenerator.getFileContents(context.manifest, "/Example/models/PutObjectInput+Presigner.swift") + val contents = TestUtils.getFileContents(context.manifest, "/Example/models/PutObjectInput+Presigner.swift") contents.shouldSyntacticSanityCheck() val expectedContents = """ extension PutObjectInput { @@ -243,10 +243,10 @@ extension PutObjectInput { contents.shouldContainOnlyOnce(expectedContents) } private fun setupTests(smithyFile: String, serviceShapeId: String): TestContext { - val context = TestContextGenerator.initContextFrom(smithyFile, serviceShapeId, RestJson1Trait.ID) + val context = TestUtils.executeDirectedCodegen(smithyFile, serviceShapeId, RestJson1Trait.ID) val presigner = PresignerGenerator() val generator = AWSRestJson1ProtocolGenerator() - val codegenContext = GenerationContext(context.ctx.model, context.ctx.symbolProvider, context.ctx.settings, generator) + val codegenContext = GenerationContext(context.ctx.model, context.ctx.symbolProvider, context.ctx.settings, context.manifest, generator) val protocolGenerationContext = ProtocolGenerator.GenerationContext(context.ctx.settings, context.ctx.model, context.ctx.service, context.ctx.symbolProvider, listOf(), RestJson1Trait.ID, context.ctx.delegator) codegenContext.protocolGenerator?.initializeMiddleware(context.ctx) presigner.writeAdditionalFiles(codegenContext, protocolGenerationContext, context.ctx.delegator) diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/TestContextGenerator.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/TestUtils.kt similarity index 89% rename from codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/TestContextGenerator.kt rename to codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/TestUtils.kt index 9dd55758c16..0ff8d4c2143 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/TestContextGenerator.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/TestUtils.kt @@ -14,7 +14,6 @@ import software.amazon.smithy.model.node.Node import software.amazon.smithy.model.node.ObjectNode import software.amazon.smithy.model.shapes.ShapeId import software.amazon.smithy.model.validation.ValidatedResultException -import software.amazon.smithy.swift.codegen.CodegenVisitor import software.amazon.smithy.swift.codegen.SwiftCodegenPlugin import software.amazon.smithy.swift.codegen.SwiftDelegator import software.amazon.smithy.swift.codegen.SwiftSettings @@ -27,9 +26,13 @@ data class TestContext( val manifest: MockManifest ) -class TestContextGenerator { +class TestUtils { companion object { - fun initContextFrom(modelFile: String, serviceShapeIdWithNamespace: String, protocol: ShapeId): TestContext { + + /** + * Execute directed codegen and returns a context containing GenerationContext and MockManifest + */ + fun executeDirectedCodegen(modelFile: String, serviceShapeIdWithNamespace: String, protocol: ShapeId): TestContext { val manifest = MockManifest() var model = createModelFromSmithy(modelFile) @@ -37,6 +40,7 @@ class TestContextGenerator { val service = model.getShape(ShapeId.from(serviceShapeIdWithNamespace)).get().asServiceShape().get() val settings = buildDefaultSwiftSettingsObjectNode(serviceShapeIdWithNamespace, service.sdkId) val swiftSettings = SwiftSettings.from(model, settings) + val integrations = mutableListOf() val pluginContext = PluginContext.builder() .model(model) @@ -44,11 +48,12 @@ class TestContextGenerator { .settings(settings) .build() - val codegen = CodegenVisitor(pluginContext) - codegen.execute() - model = codegen.model + val swiftCodegenPlugin = SwiftCodegenPlugin() + + swiftCodegenPlugin.execute(pluginContext) + + model = swiftCodegenPlugin.getResolvedModel()!! - val integrations = mutableListOf() val provider = SwiftCodegenPlugin.createSymbolProvider(model, swiftSettings) val delegator = SwiftDelegator(swiftSettings, model, manifest, provider, integrations) val ctx = ProtocolGenerator.GenerationContext(swiftSettings, model, service, provider, integrations, protocol, delegator) @@ -64,7 +69,7 @@ class TestContextGenerator { } fun getSmithyResource(smithyTestResourceName: String): URL? { - return TestContextGenerator::class.java.classLoader.getResource("software.amazon.smithy.aws.swift.codegen/$smithyTestResourceName") + return TestUtils::class.java.classLoader.getResource("software.amazon.smithy.aws.swift.codegen/$smithyTestResourceName") } fun buildDefaultSwiftSettingsObjectNode( @@ -153,7 +158,7 @@ fun Model.newTestContext( serviceShapeId: String, generator: ProtocolGenerator ): TestContext { - val settings = SwiftSettings.from(this, TestContextGenerator.buildDefaultSwiftSettingsObjectNode("com.test#Example")) + val settings = SwiftSettings.from(this, TestUtils.buildDefaultSwiftSettingsObjectNode("com.test#Example")) val provider: SymbolProvider = SwiftCodegenPlugin.createSymbolProvider(this, settings) val service = this.getShape(ShapeId.from(serviceShapeId)).get().asServiceShape().get() val delegator = SwiftDelegator(settings, this, manifest, provider) diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsjson/AWSJsonHttpInitialRequestTests.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsjson/AWSJsonHttpInitialRequestTests.kt index 8f3c41cf9b3..398228d3e0d 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsjson/AWSJsonHttpInitialRequestTests.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsjson/AWSJsonHttpInitialRequestTests.kt @@ -3,7 +3,7 @@ package software.amazon.smithy.aws.swift.codegen.awsjson import io.kotest.matchers.string.shouldContainOnlyOnce import org.junit.jupiter.api.Test import software.amazon.smithy.aws.swift.codegen.TestContext -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator +import software.amazon.smithy.aws.swift.codegen.TestUtils import software.amazon.smithy.aws.swift.codegen.shouldSyntacticSanityCheck import software.amazon.smithy.aws.traits.protocols.AwsJson1_0Trait @@ -14,7 +14,7 @@ class AWSJsonHttpInitialRequestTests { "awsjson/initial-request.smithy", "com.test#InitialRequestTest" ) - val contents = TestContextGenerator.getFileContents( + val contents = TestUtils.getFileContents( context.manifest, "/Example/models/TestStream+MessageMarshallable.swift" ) @@ -46,7 +46,7 @@ class AWSJsonHttpInitialRequestTests { "awsjson/initial-request.smithy", "com.test#InitialRequestTest" ) - val contents = TestContextGenerator.getFileContents( + val contents = TestUtils.getFileContents( context.manifest, "/Example/InitialRequestTestClient.swift" ) @@ -64,7 +64,7 @@ class AWSJsonHttpInitialRequestTests { "awsjson/initial-request.smithy", "com.test#InitialRequestTest" ) - val contents = TestContextGenerator.getFileContents( + val contents = TestUtils.getFileContents( context.manifest, "/Example/models/EventStreamOpInput+Encodable.swift" ) @@ -96,7 +96,7 @@ class AWSJsonHttpInitialRequestTests { "awsjson/initial-request.smithy", "com.test#InitialRequestTest" ) - val contents = TestContextGenerator.getFileContents( + val contents = TestUtils.getFileContents( context.manifest, "/Example/models/EventStreamOpInput+MakeInitialRequestMessage.swift" ) @@ -120,7 +120,7 @@ class AWSJsonHttpInitialRequestTests { contents.shouldContainOnlyOnce(expectedContents) } private fun setupTests(smithyFile: String, serviceShapeId: String): TestContext { - val context = TestContextGenerator.initContextFrom(smithyFile, serviceShapeId, AwsJson1_0Trait.ID) + val context = TestUtils.executeDirectedCodegen(smithyFile, serviceShapeId, AwsJson1_0Trait.ID) AwsJson1_0_ProtocolGenerator().run { generateMessageMarshallable(context.ctx) generateSerializers(context.ctx) diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsjson/AWSJsonHttpResponseBindingErrorGeneratorTests.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsjson/AWSJsonHttpResponseBindingErrorGeneratorTests.kt index 2e8d5069dce..b6c0bc9358a 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsjson/AWSJsonHttpResponseBindingErrorGeneratorTests.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsjson/AWSJsonHttpResponseBindingErrorGeneratorTests.kt @@ -3,7 +3,7 @@ package software.amazon.smithy.aws.swift.codegen.awsjson import io.kotest.matchers.string.shouldContainOnlyOnce import org.junit.jupiter.api.Test import software.amazon.smithy.aws.swift.codegen.TestContext -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator +import software.amazon.smithy.aws.swift.codegen.TestUtils import software.amazon.smithy.aws.swift.codegen.shouldSyntacticSanityCheck import software.amazon.smithy.aws.traits.protocols.AwsJson1_0Trait @@ -14,7 +14,7 @@ class AWSJsonHttpResponseBindingErrorGeneratorTests { @Test fun `001 GreetingWithErrorsOutputError+HttpResponseBinding`() { val context = setupTests("awsjson/json-error.smithy", "aws.protocoltests.json10#AwsJson10") - val contents = TestContextGenerator.getFileContents( + val contents = TestUtils.getFileContents( context.manifest, "/Example/models/GreetingWithErrorsOutputError+HttpResponseErrorBinding.swift" ) @@ -41,7 +41,7 @@ class AWSJsonHttpResponseBindingErrorGeneratorTests { @Test fun `002 AWSJson+ServiceErrorHelperMethod AWSHttpServiceError`() { val context = setupTests("awsjson/json-error.smithy", "aws.protocoltests.json10#AwsJson10") - val contents = TestContextGenerator.getFileContents( + val contents = TestUtils.getFileContents( context.manifest, "/Example/models/AwsJson10+ServiceErrorHelperMethod.swift" ) @@ -61,7 +61,7 @@ class AWSJsonHttpResponseBindingErrorGeneratorTests { } private fun setupTests(smithyFile: String, serviceShapeId: String): TestContext { - val context = TestContextGenerator.initContextFrom(smithyFile, serviceShapeId, AwsJson1_0Trait.ID) + val context = TestUtils.executeDirectedCodegen(smithyFile, serviceShapeId, AwsJson1_0Trait.ID) AwsJson1_0_ProtocolGenerator().run { generateDeserializers(context.ctx) 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 0d192198c2f..4d59e16960e 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 @@ -8,8 +8,8 @@ package software.amazon.smithy.aws.swift.codegen.awsquery import io.kotest.matchers.string.shouldContainOnlyOnce import org.junit.jupiter.api.Test import software.amazon.smithy.aws.swift.codegen.TestContext -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator.Companion.getFileContents +import software.amazon.smithy.aws.swift.codegen.TestUtils +import software.amazon.smithy.aws.swift.codegen.TestUtils.Companion.getFileContents import software.amazon.smithy.aws.swift.codegen.shouldSyntacticSanityCheck import software.amazon.smithy.aws.traits.protocols.AwsQueryTrait @@ -58,7 +58,7 @@ class AWSQueryOperationStackTest { } private fun setupTests(smithyFile: String, serviceShapeId: String): TestContext { - val context = TestContextGenerator.initContextFrom(smithyFile, serviceShapeId, AwsQueryTrait.ID) + val context = TestUtils.executeDirectedCodegen(smithyFile, serviceShapeId, AwsQueryTrait.ID) val generator = AwsQueryProtocolGenerator() generator.generateCodableConformanceForNestedTypes(context.ctx) generator.generateSerializers(context.ctx) diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/BlobEncodeGeneratorTests.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/BlobEncodeGeneratorTests.kt index 1631094cacf..4ae9d72d42c 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/BlobEncodeGeneratorTests.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/BlobEncodeGeneratorTests.kt @@ -8,8 +8,8 @@ package software.amazon.smithy.aws.swift.codegen.awsquery import io.kotest.matchers.string.shouldContainOnlyOnce import org.junit.jupiter.api.Test import software.amazon.smithy.aws.swift.codegen.TestContext -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator.Companion.getFileContents -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator.Companion.initContextFrom +import software.amazon.smithy.aws.swift.codegen.TestUtils.Companion.executeDirectedCodegen +import software.amazon.smithy.aws.swift.codegen.TestUtils.Companion.getFileContents import software.amazon.smithy.aws.swift.codegen.shouldSyntacticSanityCheck import software.amazon.smithy.aws.traits.protocols.AwsQueryTrait @@ -91,7 +91,7 @@ extension BlobInputParamsInput: Swift.Encodable { } private fun setupTests(smithyFile: String, serviceShapeId: String): TestContext { - val context = initContextFrom(smithyFile, serviceShapeId, AwsQueryTrait.ID) + val context = executeDirectedCodegen(smithyFile, serviceShapeId, AwsQueryTrait.ID) val generator = AwsQueryProtocolGenerator() generator.generateCodableConformanceForNestedTypes(context.ctx) generator.generateSerializers(context.ctx) diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/ListEncodeFormURLGeneratorTests.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/ListEncodeFormURLGeneratorTests.kt index 980ddb9d63b..e0f12154223 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/ListEncodeFormURLGeneratorTests.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/ListEncodeFormURLGeneratorTests.kt @@ -8,8 +8,8 @@ package software.amazon.smithy.aws.swift.codegen.awsquery import io.kotest.matchers.string.shouldContainOnlyOnce import org.junit.jupiter.api.Test import software.amazon.smithy.aws.swift.codegen.TestContext -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator.Companion.getFileContents +import software.amazon.smithy.aws.swift.codegen.TestUtils +import software.amazon.smithy.aws.swift.codegen.TestUtils.Companion.getFileContents import software.amazon.smithy.aws.swift.codegen.shouldSyntacticSanityCheck import software.amazon.smithy.aws.traits.protocols.AwsQueryTrait @@ -127,7 +127,7 @@ extension QueryListsInput: Swift.Encodable { private fun setupTests(smithyFile: String, serviceShapeId: String): TestContext { val context = - TestContextGenerator.initContextFrom(smithyFile, serviceShapeId, AwsQueryTrait.ID) + TestUtils.executeDirectedCodegen(smithyFile, serviceShapeId, AwsQueryTrait.ID) val generator = AwsQueryProtocolGenerator() generator.generateCodableConformanceForNestedTypes(context.ctx) generator.generateSerializers(context.ctx) diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/MapEncodeFormURLGeneratorTests.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/MapEncodeFormURLGeneratorTests.kt index c3303fd42a1..dd174ffb52e 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/MapEncodeFormURLGeneratorTests.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/MapEncodeFormURLGeneratorTests.kt @@ -8,8 +8,8 @@ package software.amazon.smithy.aws.swift.codegen.awsquery import io.kotest.matchers.string.shouldContainOnlyOnce import org.junit.jupiter.api.Test import software.amazon.smithy.aws.swift.codegen.TestContext -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator.Companion.getFileContents +import software.amazon.smithy.aws.swift.codegen.TestUtils +import software.amazon.smithy.aws.swift.codegen.TestUtils.Companion.getFileContents import software.amazon.smithy.aws.swift.codegen.shouldSyntacticSanityCheck import software.amazon.smithy.aws.traits.protocols.AwsQueryTrait @@ -132,7 +132,7 @@ extension QueryMapsInput: Swift.Encodable { private fun setupTests(smithyFile: String, serviceShapeId: String): TestContext { val context = - TestContextGenerator.initContextFrom(smithyFile, serviceShapeId, AwsQueryTrait.ID) + TestUtils.executeDirectedCodegen(smithyFile, serviceShapeId, AwsQueryTrait.ID) val generator = AwsQueryProtocolGenerator() generator.generateCodableConformanceForNestedTypes(context.ctx) generator.generateSerializers(context.ctx) diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/QueryIdempotencyTokenAutoFillGeneratorTests.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/QueryIdempotencyTokenAutoFillGeneratorTests.kt index 7454da63aec..30069c400d6 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/QueryIdempotencyTokenAutoFillGeneratorTests.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/QueryIdempotencyTokenAutoFillGeneratorTests.kt @@ -8,8 +8,8 @@ package software.amazon.smithy.aws.swift.codegen.awsquery import io.kotest.matchers.string.shouldContainOnlyOnce import org.junit.jupiter.api.Test import software.amazon.smithy.aws.swift.codegen.TestContext -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator.Companion.getFileContents +import software.amazon.smithy.aws.swift.codegen.TestUtils +import software.amazon.smithy.aws.swift.codegen.TestUtils.Companion.getFileContents import software.amazon.smithy.aws.swift.codegen.shouldSyntacticSanityCheck import software.amazon.smithy.aws.traits.protocols.AwsQueryTrait @@ -41,7 +41,7 @@ extension QueryIdempotencyTokenAutoFillInput: Swift.Encodable { private fun setupTests(smithyFile: String, serviceShapeId: String): TestContext { val context = - TestContextGenerator.initContextFrom(smithyFile, serviceShapeId, AwsQueryTrait.ID) + TestUtils.executeDirectedCodegen(smithyFile, serviceShapeId, AwsQueryTrait.ID) val generator = AwsQueryProtocolGenerator() generator.generateCodableConformanceForNestedTypes(context.ctx) generator.generateSerializers(context.ctx) 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 349cc0f2da3..e1237c823c4 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 @@ -8,8 +8,8 @@ package software.amazon.smithy.aws.swift.codegen.awsquery import io.kotest.matchers.string.shouldContainOnlyOnce import org.junit.jupiter.api.Test import software.amazon.smithy.aws.swift.codegen.TestContext -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator.Companion.getFileContents +import software.amazon.smithy.aws.swift.codegen.TestUtils +import software.amazon.smithy.aws.swift.codegen.TestUtils.Companion.getFileContents import software.amazon.smithy.aws.traits.protocols.AwsQueryTrait class StructDecodeWrappedXMLGeneratorTests { @@ -37,7 +37,7 @@ extension FlattenedXmlMapOutput { private fun setupTests(smithyFile: String, serviceShapeId: String): TestContext { val context = - TestContextGenerator.initContextFrom(smithyFile, serviceShapeId, AwsQueryTrait.ID) + TestUtils.executeDirectedCodegen(smithyFile, serviceShapeId, AwsQueryTrait.ID) val generator = AwsQueryProtocolGenerator() generator.generateCodableConformanceForNestedTypes(context.ctx) generator.generateDeserializers(context.ctx) diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/TimestampGeneratorTests.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/TimestampGeneratorTests.kt index 3813de23668..c8f52964371 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/TimestampGeneratorTests.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/TimestampGeneratorTests.kt @@ -8,8 +8,8 @@ package software.amazon.smithy.aws.swift.codegen.awsquery import io.kotest.matchers.string.shouldContainOnlyOnce import org.junit.jupiter.api.Test import software.amazon.smithy.aws.swift.codegen.TestContext -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator.Companion.getFileContents +import software.amazon.smithy.aws.swift.codegen.TestUtils +import software.amazon.smithy.aws.swift.codegen.TestUtils.Companion.getFileContents import software.amazon.smithy.aws.swift.codegen.shouldSyntacticSanityCheck import software.amazon.smithy.aws.traits.protocols.AwsQueryTrait @@ -49,7 +49,7 @@ extension QueryTimestampsInput: Swift.Encodable { private fun setupTests(smithyFile: String, serviceShapeId: String): TestContext { val context = - TestContextGenerator.initContextFrom(smithyFile, serviceShapeId, AwsQueryTrait.ID) + TestUtils.executeDirectedCodegen(smithyFile, serviceShapeId, AwsQueryTrait.ID) val generator = AwsQueryProtocolGenerator() generator.generateCodableConformanceForNestedTypes(context.ctx) generator.generateSerializers(context.ctx) diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsrestjson/AWSRestJson1HttpResponseBindingErrorGeneratableTests.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsrestjson/AWSRestJson1HttpResponseBindingErrorGeneratableTests.kt index 97a06a535ac..2274d5ed600 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsrestjson/AWSRestJson1HttpResponseBindingErrorGeneratableTests.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsrestjson/AWSRestJson1HttpResponseBindingErrorGeneratableTests.kt @@ -3,7 +3,7 @@ package software.amazon.smithy.aws.swift.codegen.awsrestjson import io.kotest.matchers.string.shouldContainOnlyOnce import org.junit.jupiter.api.Test import software.amazon.smithy.aws.swift.codegen.TestContext -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator +import software.amazon.smithy.aws.swift.codegen.TestUtils import software.amazon.smithy.aws.swift.codegen.restjson.AWSRestJson1ProtocolGenerator import software.amazon.smithy.aws.swift.codegen.shouldSyntacticSanityCheck import software.amazon.smithy.aws.traits.protocols.RestJson1Trait @@ -12,7 +12,7 @@ class AWSRestJson1HttpResponseBindingErrorGeneratableTests { @Test fun `001 GreetingWithErrorsOutputError+HttpResponseBinding`() { val context = setupTests("awsrestjson1/restjson-error.smithy", "aws.protocoltests.restjson1#RestJson1") - val contents = TestContextGenerator.getFileContents( + val contents = TestUtils.getFileContents( context.manifest, "/Example/models/GreetingWithErrorsOutputError+HttpResponseBinding.swift" ) @@ -39,7 +39,7 @@ class AWSRestJson1HttpResponseBindingErrorGeneratableTests { @Test fun `002 AWSJson+ServiceErrorHelperMethod AWSHttpServiceError`() { val context = setupTests("awsrestjson1/restjson-error.smithy", "aws.protocoltests.restjson1#RestJson1") - val contents = TestContextGenerator.getFileContents( + val contents = TestUtils.getFileContents( context.manifest, "/Example/models/RestJson1+ServiceErrorHelperMethod.swift" ) @@ -59,7 +59,7 @@ class AWSRestJson1HttpResponseBindingErrorGeneratableTests { } private fun setupTests(smithyFile: String, serviceShapeId: String): TestContext { - val context = TestContextGenerator.initContextFrom(smithyFile, serviceShapeId, RestJson1Trait.ID) + val context = TestUtils.executeDirectedCodegen(smithyFile, serviceShapeId, RestJson1Trait.ID) AWSRestJson1ProtocolGenerator().run { generateDeserializers(context.ctx) diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsrestjson/AWSRestJson1ProtocolGeneratorTests.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsrestjson/AWSRestJson1ProtocolGeneratorTests.kt index f470ccb6a37..a94522aa105 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsrestjson/AWSRestJson1ProtocolGeneratorTests.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/awsrestjson/AWSRestJson1ProtocolGeneratorTests.kt @@ -8,9 +8,9 @@ package software.amazon.smithy.aws.swift.codegen.awsrestjson import io.kotest.matchers.string.shouldContainOnlyOnce import org.junit.jupiter.api.Test import software.amazon.smithy.aws.swift.codegen.TestContext -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator.Companion.getClientFileContents -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator.Companion.getModelFileContents -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator.Companion.initContextFrom +import software.amazon.smithy.aws.swift.codegen.TestUtils.Companion.executeDirectedCodegen +import software.amazon.smithy.aws.swift.codegen.TestUtils.Companion.getClientFileContents +import software.amazon.smithy.aws.swift.codegen.TestUtils.Companion.getModelFileContents import software.amazon.smithy.aws.swift.codegen.restjson.AWSRestJson1ProtocolGenerator import software.amazon.smithy.aws.swift.codegen.shouldSyntacticSanityCheck import software.amazon.smithy.aws.traits.protocols.RestJson1Trait @@ -217,7 +217,7 @@ class RestJsonProtocolGeneratorTests { contents.shouldContainOnlyOnce(expectedContents) } private fun setupTests(smithyFile: String, serviceShapeId: String): TestContext { - val context = initContextFrom(smithyFile, serviceShapeId, RestJson1Trait.ID) + val context = executeDirectedCodegen(smithyFile, serviceShapeId, RestJson1Trait.ID) val generator = AWSRestJson1ProtocolGenerator() generator.generateProtocolUnitTests(context.ctx) diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/customizations/FlexibleChecksumMiddlewareTests.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/customizations/FlexibleChecksumMiddlewareTests.kt index 3ac43bae5f7..0f59a0c7765 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/customizations/FlexibleChecksumMiddlewareTests.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/customizations/FlexibleChecksumMiddlewareTests.kt @@ -3,7 +3,7 @@ package software.amazon.smithy.aws.swift.codegen.customizations import io.kotest.matchers.string.shouldContainOnlyOnce import org.junit.jupiter.api.Test import software.amazon.smithy.aws.swift.codegen.TestContext -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator +import software.amazon.smithy.aws.swift.codegen.TestUtils import software.amazon.smithy.aws.swift.codegen.restjson.AWSRestJson1ProtocolGenerator import software.amazon.smithy.aws.swift.codegen.shouldSyntacticSanityCheck import software.amazon.smithy.aws.traits.protocols.RestJson1Trait @@ -13,7 +13,7 @@ class FlexibleChecksumMiddlewareTests { @Test fun `Test that FlexibleChecksumsRequestMiddleware and FlexibleChecksumsResponseMiddleware are properly generated`() { val context = setupTests("flexible-checksums.smithy", "aws.flex.checks#ChecksumTests") - val contents = TestContextGenerator.getFileContents(context.manifest, "/Example/ChecksumTestsClient.swift") + val contents = TestUtils.getFileContents(context.manifest, "/Example/ChecksumTestsClient.swift") contents.shouldSyntacticSanityCheck() val expectedContents = """ extension ChecksumTestsClient { @@ -69,7 +69,7 @@ extension ChecksumTestsClient { private fun setupTests(smithyFile: String, serviceShapeId: String): TestContext { val context = - TestContextGenerator.initContextFrom(smithyFile, serviceShapeId, RestJson1Trait.ID) + TestUtils.executeDirectedCodegen(smithyFile, serviceShapeId, RestJson1Trait.ID) val generator = AWSRestJson1ProtocolGenerator() generator.generateProtocolUnitTests(context.ctx) 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 7ffe9d9a8b3..01c4af82bbc 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 @@ -3,7 +3,7 @@ package software.amazon.smithy.aws.swift.codegen.customizations import io.kotest.matchers.string.shouldContainOnlyOnce import org.junit.jupiter.api.Test import software.amazon.smithy.aws.swift.codegen.TestContext -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator +import software.amazon.smithy.aws.swift.codegen.TestUtils import software.amazon.smithy.aws.swift.codegen.customization.presignable.PresignableUrlIntegration import software.amazon.smithy.aws.swift.codegen.restjson.AWSRestJson1ProtocolGenerator import software.amazon.smithy.aws.swift.codegen.shouldSyntacticSanityCheck @@ -16,7 +16,7 @@ class PresignableUrlIntegrationTests { @Test fun `S3 PutObject operation stack contains the PutObjectPresignedURLMiddleware`() { val context = setupTests("presign-urls-s3.smithy", "com.amazonaws.s3#AmazonS3") - val contents = TestContextGenerator.getFileContents(context.manifest, "/Example/models/PutObjectInput+Presigner.swift") + val contents = TestUtils.getFileContents(context.manifest, "/Example/models/PutObjectInput+Presigner.swift") contents.shouldSyntacticSanityCheck() val expectedContents = """ operation.serializeStep.intercept(position: .after, middleware: PutObjectPresignedURLMiddleware()) @@ -27,7 +27,7 @@ class PresignableUrlIntegrationTests { @Test fun `S3 PutObject's PutObjectPresignedURLMiddleware is rendered`() { val context = setupTests("presign-urls-s3.smithy", "com.amazonaws.s3#AmazonS3") - val contents = TestContextGenerator.getFileContents(context.manifest, "/Example/models/PutObjectInput+QueryItemMiddlewareForPresignUrl.swift") + val contents = TestUtils.getFileContents(context.manifest, "/Example/models/PutObjectInput+QueryItemMiddlewareForPresignUrl.swift") contents.shouldSyntacticSanityCheck() val expectedContents = """ public struct PutObjectPresignedURLMiddleware: ClientRuntime.Middleware { @@ -63,11 +63,11 @@ public struct PutObjectPresignedURLMiddleware: ClientRuntime.Middleware { } private fun setupTests(smithyFile: String, serviceShapeId: String): TestContext { - val context = TestContextGenerator.initContextFrom(smithyFile, serviceShapeId, RestXmlTrait.ID) + val context = TestUtils.executeDirectedCodegen(smithyFile, serviceShapeId, RestXmlTrait.ID) val presigner = PresignableUrlIntegration() val generator = AWSRestJson1ProtocolGenerator() - val codegenContext = GenerationContext(context.ctx.model, context.ctx.symbolProvider, context.ctx.settings, generator) + val codegenContext = GenerationContext(context.ctx.model, context.ctx.symbolProvider, context.ctx.settings, context.manifest, generator) val protocolGenerationContext = ProtocolGenerator.GenerationContext(context.ctx.settings, context.ctx.model, context.ctx.service, context.ctx.symbolProvider, listOf(), RestJson1Trait.ID, context.ctx.delegator) codegenContext.protocolGenerator?.initializeMiddleware(context.ctx) presigner.writeAdditionalFiles(codegenContext, protocolGenerationContext, context.ctx.delegator) diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/customizations/Route53InvalidBatchErrorIntegrationTests.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/customizations/Route53InvalidBatchErrorIntegrationTests.kt index 7c884ed0f2f..9f48dd33194 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/customizations/Route53InvalidBatchErrorIntegrationTests.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/customizations/Route53InvalidBatchErrorIntegrationTests.kt @@ -3,7 +3,7 @@ package software.amazon.smithy.aws.swift.codegen.customizations import io.kotest.matchers.string.shouldContainOnlyOnce import org.junit.jupiter.api.Test import software.amazon.smithy.aws.swift.codegen.TestContext -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator +import software.amazon.smithy.aws.swift.codegen.TestUtils import software.amazon.smithy.aws.swift.codegen.shouldSyntacticSanityCheck import software.amazon.smithy.aws.traits.protocols.RestXmlTrait @@ -12,7 +12,7 @@ class Route53InvalidBatchErrorIntegrationTests { @Test fun `001 test additional structs and extensions are generated`() { val context = setupTests("route53-invalidbatch.smithy", "com.amazonaws.route53#Route53") - val contents = TestContextGenerator.getFileContents(context.manifest, "/Example/models/ChangeResourceRecordSetsOutputError+Customization.swift") + val contents = TestUtils.getFileContents(context.manifest, "/Example/models/ChangeResourceRecordSetsOutputError+Customization.swift") contents.shouldSyntacticSanityCheck() val expectedContents = """ struct CustomInvalidBatchError { @@ -67,7 +67,7 @@ extension InvalidChangeBatch { @Test fun `002 test ChangeResourceRecordSetsOutputError+HttpResponseBinding is customized`() { val context = setupTests("route53-invalidbatch.smithy", "com.amazonaws.route53#Route53") - val contents = TestContextGenerator.getFileContents(context.manifest, "/Example/models/ChangeResourceRecordSetsOutputError+HttpResponseErrorBinding.swift") + val contents = TestUtils.getFileContents(context.manifest, "/Example/models/ChangeResourceRecordSetsOutputError+HttpResponseErrorBinding.swift") contents.shouldSyntacticSanityCheck() val expectedContents = """ enum ChangeResourceRecordSetsOutputError { @@ -95,7 +95,7 @@ enum ChangeResourceRecordSetsOutputError { } private fun setupTests(smithyFile: String, serviceShapeId: String): TestContext { - val context = TestContextGenerator.initContextFrom(smithyFile, serviceShapeId, RestXmlTrait.ID) + val context = TestUtils.executeDirectedCodegen(smithyFile, serviceShapeId, RestXmlTrait.ID) return context } } diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/customizations/RulesBasedAuthSchemeResolverGeneratorTests.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/customizations/RulesBasedAuthSchemeResolverGeneratorTests.kt index b66b643853e..5bb7a4179c8 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/customizations/RulesBasedAuthSchemeResolverGeneratorTests.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/customizations/RulesBasedAuthSchemeResolverGeneratorTests.kt @@ -3,7 +3,7 @@ package software.amazon.smithy.aws.swift.codegen.customizations import io.kotest.matchers.string.shouldContainOnlyOnce import org.junit.jupiter.api.Test import software.amazon.smithy.aws.swift.codegen.TestContext -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator +import software.amazon.smithy.aws.swift.codegen.TestUtils import software.amazon.smithy.aws.swift.codegen.restjson.AWSRestJson1ProtocolGenerator import software.amazon.smithy.aws.swift.codegen.shouldSyntacticSanityCheck import software.amazon.smithy.aws.traits.protocols.RestJson1Trait @@ -17,7 +17,7 @@ class RulesBasedAuthSchemeResolverGeneratorTests { fun `rules based auth scheme resolver generation test with fake S3 smithy model`() { val context = setupTests("rules-based-auth-resolver-test.smithy", "com.test#S3") val contents = - TestContextGenerator.getFileContents(context.manifest, "Example/AuthSchemeResolver.swift") + TestUtils.getFileContents(context.manifest, "Example/AuthSchemeResolver.swift") contents.shouldSyntacticSanityCheck() val expectedContents = """ @@ -139,7 +139,7 @@ public struct DefaultS3AuthSchemeResolver: S3AuthSchemeResolver { } private fun setupTests(smithyFile: String, serviceShapeId: String): TestContext { - val context = TestContextGenerator.initContextFrom(smithyFile, serviceShapeId, RestJson1Trait.ID) + val context = TestUtils.executeDirectedCodegen(smithyFile, serviceShapeId, RestJson1Trait.ID) val generator = AWSRestJson1ProtocolGenerator() generator.initializeMiddleware(context.ctx) 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 963a6369f34..d034676612c 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 @@ -3,7 +3,7 @@ package software.amazon.smithy.aws.swift.codegen.customizations import io.kotest.matchers.string.shouldContainOnlyOnce import org.junit.jupiter.api.Test import software.amazon.smithy.aws.swift.codegen.TestContext -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator +import software.amazon.smithy.aws.swift.codegen.TestUtils import software.amazon.smithy.aws.swift.codegen.restjson.AWSRestJson1ProtocolGenerator import software.amazon.smithy.aws.swift.codegen.shouldSyntacticSanityCheck import software.amazon.smithy.aws.traits.protocols.RestJson1Trait @@ -13,7 +13,7 @@ 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/FooOutput.swift") + val contents = TestUtils.getFileContents(context.manifest, "/Example/models/FooOutput.swift") contents.shouldSyntacticSanityCheck() val expectedContents = """ @@ -37,7 +37,7 @@ class S3ExpiresTest { @Test fun `002 test S3 input members named expires are not changed`() { val context = setupTests("s3-expires.smithy", "com.amazonaws.s3#S3", "S3") - val contents = TestContextGenerator.getFileContents(context.manifest, "/Example/models/FooInput.swift") + val contents = TestUtils.getFileContents(context.manifest, "/Example/models/FooInput.swift") contents.shouldSyntacticSanityCheck() val expectedContents = """ @@ -61,7 +61,7 @@ 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/FooOutput.swift") + val contents = TestUtils.getFileContents(context.manifest, "/Example/models/FooOutput.swift") contents.shouldSyntacticSanityCheck() val expectedContents = """ @@ -84,7 +84,7 @@ class S3ExpiresTest { private fun setupTests(smithyFile: String, serviceShapeId: String, sdkID: String): TestContext { val context = - TestContextGenerator.initContextFrom(smithyFile, serviceShapeId, RestJson1Trait.ID) + TestUtils.executeDirectedCodegen(smithyFile, serviceShapeId, RestJson1Trait.ID) val generator = AWSRestJson1ProtocolGenerator() generator.generateProtocolUnitTests(context.ctx) diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/ec2query/Ec2QueryHttpResponseBindingErrorGeneratorTests.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/ec2query/Ec2QueryHttpResponseBindingErrorGeneratorTests.kt index 78c783709fa..e628bc287cc 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/ec2query/Ec2QueryHttpResponseBindingErrorGeneratorTests.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/ec2query/Ec2QueryHttpResponseBindingErrorGeneratorTests.kt @@ -8,7 +8,7 @@ package software.amazon.smithy.aws.swift.codegen.ec2query import io.kotest.matchers.string.shouldContainOnlyOnce import org.junit.jupiter.api.Test import software.amazon.smithy.aws.swift.codegen.TestContext -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator +import software.amazon.smithy.aws.swift.codegen.TestUtils import software.amazon.smithy.aws.swift.codegen.shouldSyntacticSanityCheck import software.amazon.smithy.aws.traits.protocols.Ec2QueryTrait @@ -17,7 +17,7 @@ class Ec2QueryHttpResponseBindingErrorGeneratorTests { @Test fun `002 GreetingWithErrorsOutputError+HttpResponseBinding has with correct cases`() { val context = setupTests("ec2query/query-error.smithy", "aws.protocoltests.ec2#AwsEc2") - val contents = TestContextGenerator.getFileContents(context.manifest, "/Example/models/GreetingWithErrorsOutputError+HttpResponseErrorBinding.swift") + val contents = TestUtils.getFileContents(context.manifest, "/Example/models/GreetingWithErrorsOutputError+HttpResponseErrorBinding.swift") contents.shouldSyntacticSanityCheck() val expectedContents = """ enum GreetingWithErrorsOutputError { @@ -46,7 +46,7 @@ enum GreetingWithErrorsOutputError { @Test fun `003 ComplexError+Init`() { val context = setupTests("ec2query/query-error.smithy", "aws.protocoltests.ec2#AwsEc2") - val contents = TestContextGenerator.getFileContents(context.manifest, "/Example/models/ComplexError+Init.swift") + val contents = TestUtils.getFileContents(context.manifest, "/Example/models/ComplexError+Init.swift") contents.shouldSyntacticSanityCheck() val expectedContents = """ extension ComplexError { @@ -68,7 +68,7 @@ extension ComplexError { @Test fun `004 ComplexError constructor conforms to AWSHttpServiceError`() { val context = setupTests("ec2query/query-error.smithy", "aws.protocoltests.ec2#AwsEc2") - val contents = TestContextGenerator.getFileContents(context.manifest, "/Example/models/ComplexError.swift") + val contents = TestUtils.getFileContents(context.manifest, "/Example/models/ComplexError.swift") contents.shouldSyntacticSanityCheck() val expectedContents = """ @@ -104,7 +104,7 @@ extension ComplexError { @Test fun `005 AwsEc2+ServiceErrorHelperMethod AWSHttpServiceError`() { val context = setupTests("ec2query/query-error.smithy", "aws.protocoltests.ec2#AwsEc2") - val contents = TestContextGenerator.getFileContents(context.manifest, "/Example/models/AwsEc2+ServiceErrorHelperMethod.swift") + val contents = TestUtils.getFileContents(context.manifest, "/Example/models/AwsEc2+ServiceErrorHelperMethod.swift") contents.shouldSyntacticSanityCheck() val expectedContents = """ @@ -122,7 +122,7 @@ extension ComplexError { private fun setupTests(smithyFile: String, serviceShapeId: String): TestContext { val context = - TestContextGenerator.initContextFrom(smithyFile, serviceShapeId, Ec2QueryTrait.ID) + TestUtils.executeDirectedCodegen(smithyFile, serviceShapeId, Ec2QueryTrait.ID) Ec2QueryProtocolGenerator().run { generateDeserializers(context.ctx) diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/AWSRestXMLEventStreamTests.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/AWSRestXMLEventStreamTests.kt index f53cc18ca07..e42bdea01c5 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/AWSRestXMLEventStreamTests.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/AWSRestXMLEventStreamTests.kt @@ -2,7 +2,7 @@ package software.amazon.smithy.aws.swift.codegen.restxml import org.junit.jupiter.api.Test import software.amazon.smithy.aws.swift.codegen.TestContext -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator +import software.amazon.smithy.aws.swift.codegen.TestUtils import software.amazon.smithy.aws.swift.codegen.shouldSyntacticSanityCheck import software.amazon.smithy.aws.traits.protocols.RestXmlTrait @@ -13,7 +13,7 @@ class AWSRestXMLEventStreamTests { "restxml/xml-event-stream.smithy", "com.test#EventStreamTest" ) - val contents = TestContextGenerator.getFileContents( + val contents = TestUtils.getFileContents( context.manifest, "/Example/EventStreamTestClient.swift" ) @@ -29,7 +29,7 @@ class AWSRestXMLEventStreamTests { "restxml/xml-event-stream.smithy", "com.test#EventStreamTest" ) - val contents = TestContextGenerator.getFileContents( + val contents = TestUtils.getFileContents( context.manifest, "/Example/models/TestEvents+MessageMarshallable.swift" ) @@ -68,7 +68,7 @@ class AWSRestXMLEventStreamTests { "restxml/xml-event-stream.smithy", "com.test#EventStreamTest" ) - val contents = TestContextGenerator.getFileContents( + val contents = TestUtils.getFileContents( context.manifest, "/Example/models/MessageWithAudio+Codable.swift" ) @@ -101,7 +101,7 @@ class AWSRestXMLEventStreamTests { "restxml/xml-event-stream.smithy", "com.test#EventStreamTest" ) - val contents = TestContextGenerator.getFileContents( + val contents = TestUtils.getFileContents( context.manifest, "/Example/models/Audio+Codable.swift" ) @@ -127,7 +127,7 @@ class AWSRestXMLEventStreamTests { } private fun setupTests(smithyFile: String, serviceShapeId: String): TestContext { - val context = TestContextGenerator.initContextFrom(smithyFile, serviceShapeId, RestXmlTrait.ID) + val context = TestUtils.executeDirectedCodegen(smithyFile, serviceShapeId, RestXmlTrait.ID) RestXmlProtocolGenerator().run { generateMessageMarshallable(context.ctx) generateSerializers(context.ctx) diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/AWSRestXMLHttpResponseBindingErrorGeneratorTests.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/AWSRestXMLHttpResponseBindingErrorGeneratorTests.kt index 4770f178888..61de796a443 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/AWSRestXMLHttpResponseBindingErrorGeneratorTests.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/AWSRestXMLHttpResponseBindingErrorGeneratorTests.kt @@ -8,8 +8,8 @@ package software.amazon.smithy.aws.swift.codegen.restxml import io.kotest.matchers.string.shouldContainOnlyOnce import org.junit.jupiter.api.Test import software.amazon.smithy.aws.swift.codegen.TestContext -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator.Companion.getFileContents -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator.Companion.initContextFrom +import software.amazon.smithy.aws.swift.codegen.TestUtils.Companion.executeDirectedCodegen +import software.amazon.smithy.aws.swift.codegen.TestUtils.Companion.getFileContents import software.amazon.smithy.aws.swift.codegen.shouldSyntacticSanityCheck import software.amazon.smithy.aws.traits.protocols.RestXmlTrait @@ -148,7 +148,7 @@ extension RestXmlerrorsClientTypes { } private fun setupTests(smithyFile: String, serviceShapeId: String): TestContext { - val context = initContextFrom(smithyFile, serviceShapeId, RestXmlTrait.ID) + val context = executeDirectedCodegen(smithyFile, serviceShapeId, RestXmlTrait.ID) RestXmlProtocolGenerator().run { generateDeserializers(context.ctx) diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/RestXMLProtocolNoInputNoOutputGeneratorTests.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/RestXMLProtocolNoInputNoOutputGeneratorTests.kt index 97e8f586601..01829912d0e 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/RestXMLProtocolNoInputNoOutputGeneratorTests.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/RestXMLProtocolNoInputNoOutputGeneratorTests.kt @@ -8,8 +8,8 @@ package software.amazon.smithy.aws.swift.codegen.restxml import io.kotest.matchers.string.shouldContainOnlyOnce import org.junit.jupiter.api.Test import software.amazon.smithy.aws.swift.codegen.TestContext -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator.Companion.getClientFileContents -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator.Companion.initContextFrom +import software.amazon.smithy.aws.swift.codegen.TestUtils.Companion.executeDirectedCodegen +import software.amazon.smithy.aws.swift.codegen.TestUtils.Companion.getClientFileContents import software.amazon.smithy.aws.swift.codegen.shouldSyntacticSanityCheck import software.amazon.smithy.aws.traits.protocols.RestXmlTrait @@ -29,7 +29,7 @@ class RestXMLProtocolNoInputNoOutputGeneratorTests { } private fun setupTests(smithyFile: String, serviceShapeId: String): TestContext { - val context = initContextFrom(smithyFile, serviceShapeId, RestXmlTrait.ID) + val context = executeDirectedCodegen(smithyFile, serviceShapeId, RestXmlTrait.ID) val generator = RestXmlProtocolGenerator() generator.generateProtocolUnitTests(context.ctx) diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/RestXMLProtocolXMLAttributesGeneratorTests.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/RestXMLProtocolXMLAttributesGeneratorTests.kt index e80ef5d3e70..5e4e6771c07 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/RestXMLProtocolXMLAttributesGeneratorTests.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/RestXMLProtocolXMLAttributesGeneratorTests.kt @@ -8,8 +8,8 @@ package software.amazon.smithy.aws.swift.codegen.restxml import io.kotest.matchers.string.shouldContainOnlyOnce import org.junit.jupiter.api.Test import software.amazon.smithy.aws.swift.codegen.TestContext -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator.Companion.getClientFileContents -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator.Companion.initContextFrom +import software.amazon.smithy.aws.swift.codegen.TestUtils.Companion.executeDirectedCodegen +import software.amazon.smithy.aws.swift.codegen.TestUtils.Companion.getClientFileContents import software.amazon.smithy.aws.swift.codegen.shouldSyntacticSanityCheck import software.amazon.smithy.aws.traits.protocols.RestXmlTrait @@ -29,7 +29,7 @@ class RestXMLProtocolXMLAttributesGeneratorTests { } private fun setupTests(smithyFile: String, serviceShapeId: String): TestContext { - val context = initContextFrom(smithyFile, serviceShapeId, RestXmlTrait.ID) + val context = executeDirectedCodegen(smithyFile, serviceShapeId, RestXmlTrait.ID) val generator = RestXmlProtocolGenerator() generator.generateProtocolUnitTests(context.ctx) 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 44ed7bf21e4..9aff0c5f8df 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 @@ -3,8 +3,8 @@ package software.amazon.smithy.aws.swift.codegen.restxml.serde import io.kotest.matchers.string.shouldContainOnlyOnce import org.junit.jupiter.api.Test import software.amazon.smithy.aws.swift.codegen.TestContext -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator -import software.amazon.smithy.aws.swift.codegen.TestContextGenerator.Companion.getFileContents +import software.amazon.smithy.aws.swift.codegen.TestUtils +import software.amazon.smithy.aws.swift.codegen.TestUtils.Companion.getFileContents import software.amazon.smithy.aws.swift.codegen.restxml.RestXmlProtocolGenerator import software.amazon.smithy.aws.traits.protocols.RestXmlTrait @@ -32,7 +32,7 @@ extension GetBucketLocationOutput { } private fun setupTests(smithyFile: String, serviceShapeId: String): TestContext { - val context = TestContextGenerator.initContextFrom(smithyFile, serviceShapeId, RestXmlTrait.ID) + val context = TestUtils.executeDirectedCodegen(smithyFile, serviceShapeId, RestXmlTrait.ID) val generator = RestXmlProtocolGenerator() generator.generateCodableConformanceForNestedTypes(context.ctx) generator.generateDeserializers(context.ctx)