File tree Expand file tree Collapse file tree 3 files changed +15
-4
lines changed
main/java/software/amazon/awssdk/migration/internal/utils
test/java/software/amazon/awssdk/migration/internal/utils Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -33,13 +33,14 @@ public static String getV2Equivalent(String currentFqcn) {
33
33
String v1ClassName = currentFqcn .substring (lastIndexOfDot + 1 , currentFqcn .length ());
34
34
String packagePrefix = currentFqcn .substring (0 , lastIndexOfDot );
35
35
36
- String v2ClassName ;
36
+ String v2ClassName = CodegenNamingUtils . pascalCase ( v1ClassName ) ;
37
37
String v2PackagePrefix = packagePrefix .replace (V1_PACKAGE_PREFIX , V2_PACKAGE_PREFIX );
38
38
39
39
if (Stream .of ("Abstract" , "Amazon" , "AWS" ).anyMatch (v1ClassName ::startsWith )) {
40
40
v2ClassName = getV2ClientEquivalent (v1ClassName );
41
- } else {
42
- v2ClassName = v1ClassName .replace ("Result" , "Response" );
41
+ } else if (v1ClassName .endsWith ("Result" )) {
42
+ int lastIndex = v1ClassName .lastIndexOf ("Result" );
43
+ v2ClassName = v1ClassName .substring (0 , lastIndex ) + "Response" ;
43
44
}
44
45
45
46
return v2PackagePrefix + "." + v2ClassName ;
Original file line number Diff line number Diff line change @@ -137,7 +137,8 @@ public static boolean isV2ClientBuilder(JavaType type) {
137
137
}
138
138
139
139
public static boolean isEligibleToConvertToBuilder (JavaType .FullyQualified type ) {
140
- return type != null && (isV2ModelClass (type ) || isV2ClientClass (type ) || isV2CoreClassesWithBuilder (type .getFullyQualifiedName ()));
140
+ return type != null && (isV2ModelClass (type ) || isV2ClientClass (type ) ||
141
+ isV2CoreClassesWithBuilder (type .getFullyQualifiedName ()));
141
142
}
142
143
143
144
public static boolean isEligibleToConvertToStaticFactory (JavaType .FullyQualified type ) {
Original file line number Diff line number Diff line change @@ -31,6 +31,15 @@ void v1Pojos_shouldConvertToV2() {
31
31
32
32
assertThat (NamingConversionUtils .getV2Equivalent ("com.amazonaws.services.iot.model.AuditFinding" ))
33
33
.isEqualTo ("software.amazon.awssdk.services.iot.model.AuditFinding" );
34
+
35
+ assertThat (NamingConversionUtils .getV2Equivalent ("com.amazonaws.services.iot.ResultConfiguration" ))
36
+ .isEqualTo ("software.amazon.awssdk.services.iot.ResultConfiguration" );
37
+
38
+ assertThat (NamingConversionUtils .getV2Equivalent ("com.amazonaws.services.iot.ResultConfigurationResult" ))
39
+ .isEqualTo ("software.amazon.awssdk.services.iot.ResultConfigurationResponse" );
40
+
41
+ assertThat (NamingConversionUtils .getV2Equivalent ("com.amazonaws.services.iot.ListCACertificatesRequest" ))
42
+ .isEqualTo ("software.amazon.awssdk.services.iot.ListCaCertificatesRequest" );
34
43
}
35
44
36
45
@ Test
You can’t perform that action at this time.
0 commit comments