Skip to content

Commit 3024e10

Browse files
authored
chore: update test expectations to match explicit API mode from smithy-kotlin (#657)
1 parent c8b6844 commit 3024e10

File tree

6 files changed

+26
-23
lines changed

6 files changed

+26
-23
lines changed

codegen/smithy-aws-kotlin-codegen/build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ tasks.test {
8282
testLogging {
8383
events("passed", "skipped", "failed")
8484
showStandardStreams = true
85+
showStackTraces = true
86+
showExceptions = true
87+
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
8588
}
8689
}
8790

codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/AwsServiceConfigIntegration.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class AwsServiceConfigIntegration : KotlinIntegration {
3838

3939
propertyType = ClientConfigPropertyType.Custom(render = { prop, writer ->
4040
writer.write(
41-
"val #1L: #2T = builder.#1L?.borrow() ?: #3T()",
41+
"public val #1L: #2T = builder.#1L?.borrow() ?: #3T()",
4242
prop.propertyName,
4343
prop.symbol,
4444
AwsRuntimeTypes.Config.Credentials.DefaultChainCredentialsProvider
@@ -55,9 +55,9 @@ class AwsServiceConfigIntegration : KotlinIntegration {
5555
private val overrideServiceCompanionObjectWriter = SectionWriter { writer, _ ->
5656
// override the service client companion object for how a client is constructed
5757
val serviceSymbol: Symbol = writer.getContextValue(ServiceGenerator.SectionServiceCompanionObject.ServiceSymbol)
58-
writer.withBlock("companion object {", "}") {
58+
writer.withBlock("public companion object {", "}") {
5959
withBlock(
60-
"operator fun invoke(block: Config.Builder.() -> Unit): #L {",
60+
"public operator fun invoke(block: Config.Builder.() -> Unit): #L {",
6161
"}",
6262
serviceSymbol.name
6363
) {
@@ -66,15 +66,15 @@ class AwsServiceConfigIntegration : KotlinIntegration {
6666
}
6767

6868
write("")
69-
write("operator fun invoke(config: Config): ${serviceSymbol.name} = Default${serviceSymbol.name}(config)")
69+
write("public operator fun invoke(config: Config): ${serviceSymbol.name} = Default${serviceSymbol.name}(config)")
7070

7171
// generate a convenience init to resolve a client from the current environment
7272
write("")
7373
dokka {
7474
write("Construct a [${serviceSymbol.name}] by resolving the configuration from the current environment.")
7575
}
7676
writer.withBlock(
77-
"suspend fun fromEnvironment(block: (Config.Builder.() -> Unit)? = null): #T {",
77+
"public suspend fun fromEnvironment(block: (Config.Builder.() -> Unit)? = null): #T {",
7878
"}",
7979
serviceSymbol
8080
) {

codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/protocols/core/AwsHttpProtocolClientGenerator.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ open class AwsHttpProtocolClientGenerator(
3232

3333
override fun render(writer: KotlinWriter) {
3434
writer.write("\n\n")
35-
writer.write("const val ServiceId: String = #S", ctx.service.sdkId)
36-
writer.write("const val ServiceApiVersion: String = #S", ctx.service.version)
37-
writer.write("const val SdkVersion: String = #S", ctx.settings.pkg.version)
35+
writer.write("public const val ServiceId: String = #S", ctx.service.sdkId)
36+
writer.write("public const val ServiceApiVersion: String = #S", ctx.service.version)
37+
writer.write("public const val SdkVersion: String = #S", ctx.settings.pkg.version)
3838
writer.write("\n\n")
3939
super.render(writer)
4040

codegen/smithy-aws-kotlin-codegen/src/test/kotlin/aws/sdk/kotlin/codegen/AwsServiceConfigIntegrationTest.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ class AwsServiceConfigIntegrationTest {
4343
val contents = writer.toString()
4444

4545
val expectedProps = """
46-
val credentialsProvider: CredentialsProvider = builder.credentialsProvider?.borrow() ?: DefaultChainCredentialsProvider()
47-
val endpointResolver: AwsEndpointResolver = builder.endpointResolver ?: DefaultEndpointResolver()
48-
val region: String = requireNotNull(builder.region) { "region is a required configuration property" }
46+
public val credentialsProvider: CredentialsProvider = builder.credentialsProvider?.borrow() ?: DefaultChainCredentialsProvider()
47+
public val endpointResolver: AwsEndpointResolver = builder.endpointResolver ?: DefaultEndpointResolver()
48+
public val region: String = requireNotNull(builder.region) { "region is a required configuration property" }
4949
"""
5050
contents.shouldContainOnlyOnceWithDiff(expectedProps)
5151

@@ -56,16 +56,16 @@ class AwsServiceConfigIntegrationTest {
5656
* NOTE: The caller is responsible for managing the lifetime of the provider when set. The SDK
5757
* client will not close it when the client is closed.
5858
*/
59-
var credentialsProvider: CredentialsProvider? = null
59+
public var credentialsProvider: CredentialsProvider? = null
6060
/**
6161
* Determines the endpoint (hostname) to make requests to. When not provided a default
6262
* resolver is configured automatically. This is an advanced client option.
6363
*/
64-
var endpointResolver: AwsEndpointResolver? = null
64+
public var endpointResolver: AwsEndpointResolver? = null
6565
/**
6666
* AWS region to make requests to
6767
*/
68-
var region: String? = null
68+
public var region: String? = null
6969
"""
7070
contents.shouldContainOnlyOnceWithDiff(expectedImpl)
7171
}

codegen/smithy-aws-kotlin-codegen/src/test/kotlin/aws/sdk/kotlin/codegen/PresignerGeneratorTest.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ class PresignerGeneratorTest {
232232
* This type can be used to presign requests in cases where an existing service client
233233
* instance is not available.
234234
*/
235-
class TestPresignConfig private constructor(builder: Builder): ServicePresignConfig {
235+
public class TestPresignConfig private constructor(builder: Builder): ServicePresignConfig {
236236
override val credentialsProvider: CredentialsProvider = requireNotNull(builder.credentialsProvider) { "credentialsProvider is a required configuration property" }
237237
override val endpointProvider: SigningEndpointProvider = builder.endpointProvider ?: DefaultEndpointResolver().asSigningEndpointProvider()
238238
override val normalizeUriPath: Boolean = true
@@ -241,27 +241,27 @@ class PresignerGeneratorTest {
241241
override val signer: AwsSigner = builder.signer ?: DefaultAwsSigner
242242
override val signingName: String = "example-signing-name"
243243
override val useDoubleUriEncode: Boolean = true
244-
companion object {
245-
inline operator fun invoke(block: Builder.() -> kotlin.Unit): ServicePresignConfig = Builder().apply(block).build()
244+
public companion object {
245+
public inline operator fun invoke(block: Builder.() -> kotlin.Unit): ServicePresignConfig = Builder().apply(block).build()
246246
}
247247
248-
class Builder {
248+
public class Builder {
249249
/**
250250
* The AWS credentials provider to use for authenticating requests. If not provided a [aws.sdk.kotlin.runtime.auth.credentials.DefaultChainCredentialsProvider] instance will be used.
251251
*/
252-
var credentialsProvider: CredentialsProvider? = null
252+
public var credentialsProvider: CredentialsProvider? = null
253253
/**
254254
* Provides the endpoint (hostname) and signing context to make requests to. When not provided a default resolver is configured automatically. This is an advanced client option.
255255
*/
256-
var endpointProvider: SigningEndpointProvider? = null
256+
public var endpointProvider: SigningEndpointProvider? = null
257257
/**
258258
* AWS region to make requests for
259259
*/
260-
var region: String? = null
260+
public var region: String? = null
261261
/**
262262
* The implementation of AWS signer to use for signing requests
263263
*/
264-
var signer: AwsSigner? = null
264+
public var signer: AwsSigner? = null
265265
266266
@PublishedApi
267267
internal fun build(): TestPresignConfig = TestPresignConfig(this)

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ sdkVersion=0.17.1-SNAPSHOT
1212
smithyVersion=1.22.0
1313
smithyGradleVersion=0.5.3
1414
# smithy-kotlin codegen and runtime are versioned together
15-
smithyKotlinVersion=0.12.0
15+
smithyKotlinVersion=0.12.1-SNAPSHOT
1616

1717
# kotlin
1818
kotlinVersion=1.7.0

0 commit comments

Comments
 (0)