Skip to content

Commit 5db3da6

Browse files
committed
Pr comments:
- added codegen tests - added equals & hash-code test for ConstructorArgs classes - fix cache size - SdkUri constructor - checkstyle complained about newURI -> renamed newUri
1 parent 7c5926f commit 5db3da6

File tree

15 files changed

+465
-42
lines changed

15 files changed

+465
-42
lines changed

.changes/next-release/feature-AWSSDKforJavav2-b405876.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"type": "feature",
33
"category": "AWS SDK for Java v2",
44
"contributor": "",
5-
"description": "URI cache for DynamoDB account id based endpoint"
5+
"description": "Enable caching calls to URI constructors for account-id based endpoints"
66
}

codegen/src/test/java/software/amazon/awssdk/codegen/poet/ClientTestModels.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,28 @@ public static IntermediateModel queryServiceModelsWithOverrideKnowProperties() {
159159
return new IntermediateModelBuilder(models).build();
160160
}
161161

162+
public static IntermediateModel queryServiceModelsWithUriCache() {
163+
File serviceModel = new File(ClientTestModels.class.getResource("client/c2j/query/service-2.json").getFile());
164+
File customizationModel =
165+
new File(ClientTestModels.class.getResource("client/c2j/query/customization-uri-cache.config").getFile());
166+
File waitersModel = new File(ClientTestModels.class.getResource("client/c2j/query/waiters-2.json").getFile());
167+
File endpointRuleSetModel =
168+
new File(ClientTestModels.class.getResource("client/c2j/query/endpoint-rule-set.json").getFile());
169+
File endpointTestsModel =
170+
new File(ClientTestModels.class.getResource("client/c2j/query/endpoint-tests.json").getFile());
171+
172+
C2jModels models = C2jModels
173+
.builder()
174+
.serviceModel(getServiceModel(serviceModel))
175+
.customizationConfig(getCustomizationConfig(customizationModel))
176+
.waitersModel(getWaiters(waitersModel))
177+
.endpointRuleSetModel(getEndpointRuleSet(endpointRuleSetModel))
178+
.endpointTestSuiteModel(getEndpointTestSuite(endpointTestsModel))
179+
.build();
180+
181+
return new IntermediateModelBuilder(models).build();
182+
}
183+
162184
public static IntermediateModel queryServiceModelsEndpointAuthParamsWithAllowList() {
163185
File serviceModel = new File(ClientTestModels.class.getResource("client/c2j/query/service-2.json").getFile());
164186
File customizationModel =

codegen/src/test/java/software/amazon/awssdk/codegen/poet/rules/EndpointProviderCompiledRulesClassSpecTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,11 @@ void knowPropertiesOverride() {
3737
new EndpointProviderSpec2(ClientTestModels.queryServiceModelsWithOverrideKnowProperties());
3838
assertThat(endpointProviderSpec, generatesTo("endpoint-provider-know-prop-override-class.java"));
3939
}
40+
41+
@Test
42+
void endpointProviderClassWithUriCache() {
43+
ClassSpec endpointProviderSpec =
44+
new EndpointProviderSpec2(ClientTestModels.queryServiceModelsWithUriCache());
45+
assertThat(endpointProviderSpec, generatesTo("endpoint-provider-uri-cache-class.java"));
46+
}
4047
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"authPolicyActions" : {
3+
"skip" : true
4+
},
5+
"skipEndpointTests": {
6+
"test case 4": "Does not work"
7+
},
8+
"endpointParameters": {
9+
"CustomEndpointArray": {
10+
"required": false,
11+
"documentation": "Parameter from the customization config",
12+
"type": "StringArray"
13+
},
14+
"ArnList": {
15+
"required": false,
16+
"documentation": "Parameter from the customization config",
17+
"type": "StringArray"
18+
}
19+
},
20+
"customOperationContextParams": [
21+
{
22+
"operationName": "OperationWithCustomizedOperationContextParam",
23+
"operationContextParamsMap": {
24+
"customEndpointArray": {
25+
"path": "ListMember.StringList[*].LeafString"
26+
}
27+
}
28+
}
29+
],
30+
"preClientExecutionRequestCustomizer": {
31+
"OperationWithCustomMember": {
32+
"methodName": "dummyRequestModifier",
33+
"className": "software.amazon.awssdk.codegen.internal.UtilsTest"
34+
}
35+
},
36+
"enableEndpointProviderUriCaching": true
37+
}

0 commit comments

Comments
 (0)