Skip to content

Commit d26479d

Browse files
committed
address pr reviews
1 parent aeebf80 commit d26479d

File tree

2 files changed

+43
-46
lines changed

2 files changed

+43
-46
lines changed

codegen/smithy-aws-kotlin-codegen/src/test/kotlin/software/amazon/smithy/kotlin/codegen/aws/customization/RegionSupportTest.kt

Lines changed: 42 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,29 @@ import org.junit.jupiter.api.Test
44
import software.amazon.smithy.kotlin.codegen.core.KotlinWriter
55
import software.amazon.smithy.kotlin.codegen.model.expectShape
66
import software.amazon.smithy.kotlin.codegen.rendering.ServiceClientConfigGenerator
7-
import software.amazon.smithy.kotlin.codegen.test.newTestContext
8-
import software.amazon.smithy.kotlin.codegen.test.shouldContainOnlyOnceWithDiff
9-
import software.amazon.smithy.kotlin.codegen.test.toRenderingContext
10-
import software.amazon.smithy.kotlin.codegen.test.toSmithyModel
7+
import software.amazon.smithy.kotlin.codegen.test.*
118
import software.amazon.smithy.model.shapes.ServiceShape
129

1310
class RegionSupportTest {
1411
@Test
1512
fun testRegionSupportProperties() {
1613
val model = """
17-
namespace com.test
18-
19-
use aws.protocols#awsJson1_1
20-
use aws.api#service
21-
use aws.auth#sigv4
22-
23-
@service(sdkId: "service with overrides", endpointPrefix: "service-with-overrides")
24-
@sigv4(name: "example")
25-
@awsJson1_1
26-
service Example {
27-
version: "1.0.0",
28-
operations: [GetFoo]
29-
}
30-
31-
operation GetFoo {}
32-
""".toSmithyModel()
14+
namespace com.test
15+
16+
use aws.protocols#awsJson1_1
17+
use aws.api#service
18+
use aws.auth#sigv4
19+
20+
@service(sdkId: "service with overrides", endpointPrefix: "service-with-overrides")
21+
@sigv4(name: "example")
22+
@awsJson1_1
23+
service Example {
24+
version: "1.0.0",
25+
operations: [GetFoo]
26+
}
27+
28+
operation GetFoo {}
29+
""".toSmithyModel()
3330

3431
val serviceShape = model.expectShape<ServiceShape>("com.test#Example")
3532

@@ -43,34 +40,34 @@ class RegionSupportTest {
4340
val contents = writer.toString()
4441

4542
val expectedProps = """
46-
public val region: String? = builder.region
47-
public val regionProvider: RegionProvider? = builder.regionProvider
48-
"""
43+
public val region: String? = builder.region
44+
public val regionProvider: RegionProvider? = builder.regionProvider
45+
""".formatForTest()
4946
contents.shouldContainOnlyOnceWithDiff(expectedProps)
5047

5148
val expectedImpl = """
52-
/**
53-
* The AWS region to sign with and make requests to. When specified, this static region configuration
54-
* takes precedence over other region resolution methods.
55-
*
56-
* The region resolution order is:
57-
* 1. Static region (if specified)
58-
* 2. Custom region provider (if configured)
59-
* 3. Default region provider chain
60-
*/
61-
public var region: String? = null
62-
63-
/**
64-
* An optional region provider that determines the AWS region for client operations. When specified, this provider
65-
* takes precedence over the default region provider chain, unless a static region is explicitly configured.
66-
*
67-
* The region resolution order is:
68-
* 1. Static region (if specified)
69-
* 2. Custom region provider (if configured)
70-
* 3. Default region provider chain
71-
*/
72-
public var regionProvider: RegionProvider? = null
73-
"""
49+
/**
50+
* The AWS region to sign with and make requests to. When specified, this static region configuration
51+
* takes precedence over other region resolution methods.
52+
*
53+
* The region resolution order is:
54+
* 1. Static region (if specified)
55+
* 2. Custom region provider (if configured)
56+
* 3. Default region provider chain
57+
*/
58+
public var region: String? = null
59+
60+
/**
61+
* An optional region provider that determines the AWS region for client operations. When specified, this provider
62+
* takes precedence over the default region provider chain, unless a static region is explicitly configured.
63+
*
64+
* The region resolution order is:
65+
* 1. Static region (if specified)
66+
* 2. Custom region provider (if configured)
67+
* 3. Default region provider chain
68+
*/
69+
public var regionProvider: RegionProvider? = null
70+
""".formatForTest(indent = " ")
7471
contents.shouldContainOnlyOnceWithDiff(expectedImpl)
7572
}
7673
}

runtime/smithy-client/common/test/aws/smithy/kotlin/runtime/client/region/RegionProviderChainTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import kotlin.test.Test
1010
import kotlin.test.assertEquals
1111
import kotlin.test.assertFails
1212

13-
class AwsRegionProviderChainTest {
13+
class RegionProviderChainTest {
1414
@Test
1515
fun testNoProviders() {
1616
assertFails("at least one provider") {

0 commit comments

Comments
 (0)