Skip to content

Commit 4b631c7

Browse files
committed
Fixes document shape smoke test codegen
1 parent 5849c28 commit 4b631c7

File tree

4 files changed

+22
-6
lines changed

4 files changed

+22
-6
lines changed

tools/code-generation/smithy/codegen/cpp-smoke-tests-codegen/src/main/java/com/amazonaws/util/awsclientsmithygenerator/generators/CppImportContainer.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
package com.amazonaws.util.awsclientsmithygenerator.generators;
77

8+
import com.google.common.base.CaseFormat;
89
import com.google.common.collect.ImmutableMap;
910
import com.google.common.collect.ImmutableSet;
1011
import software.amazon.smithy.codegen.core.ImportContainer;
@@ -56,7 +57,9 @@ public CppImportContainer(String namespace) {
5657
"Aws::Utils::Document", "aws/core/utils/Document.h",
5758
"Aws::Utils::ByteBuffer", "aws/core/utils/Array.h");
5859

59-
dynamicHeaders.add(String.format("aws/%s/%sClient.h", c2jNamespace, clientNamespace));
60+
dynamicHeaders.add(String.format("aws/%s/%sClient.h",
61+
c2jNamespace,
62+
CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, clientNamespace)));
6063

6164
}
6265

tools/code-generation/smithy/codegen/cpp-smoke-tests-codegen/src/main/java/com/amazonaws/util/awsclientsmithygenerator/generators/GenericCodegenAdapter.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ public interface GenericCodegenAdapter<SHAPE, DATA> {
4747

4848
public boolean isDoubleShape( SHAPE s);
4949

50+
public boolean isDocumentShape(SHAPE s);
51+
5052
public List<DATA> getList(DATA d);
5153

5254
public Map<String, DATA> getMap(DATA d);
@@ -213,8 +215,9 @@ else if(isDouble(value))
213215
{
214216
throw new RuntimeException("unsupported timestamp shape format");
215217
}
216-
}
217-
else
218+
} else if (isDocumentShape(shape)) {
219+
functionName = String.format("Aws::Utils::Document{R\"({\"%s\", \"%s\"})\"}", key, value);
220+
} else
218221
{
219222
throw new RuntimeException(String.format("shape not supported:%s",shape));
220223
}

tools/code-generation/smithy/codegen/cpp-smoke-tests-codegen/src/main/java/com/amazonaws/util/awsclientsmithygenerator/generators/SmithyCodegenAdapter.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,11 @@ public boolean isTimestampShape(Shape s)
191191
return s.getType() == ShapeType.TIMESTAMP;
192192
}
193193

194+
@Override
195+
public boolean isDocumentShape(Shape s) {
196+
return s.getType() == ShapeType.DOCUMENT;
197+
}
198+
194199
@Override
195200
public List<Node> getList(Node d)
196201
{

tools/code-generation/smithy/codegen/cpp-smoke-tests-codegen/src/main/java/com/amazonaws/util/awsclientsmithygenerator/generators/SmokeTestsSourceWriter.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
*/
66
package com.amazonaws.util.awsclientsmithygenerator.generators;
77

8-
import software.amazon.smithy.codegen.core.SymbolWriter;
8+
import com.google.common.base.CaseFormat;
99
import software.amazon.smithy.aws.smoketests.model.AwsVendorParams;
10+
import software.amazon.smithy.codegen.core.SymbolWriter;
11+
1012
import java.util.List;
1113
import java.util.Objects;
1214

@@ -45,7 +47,9 @@ protected void defineTestCase(SmokeTestData test)
4547
{
4648
//declare test fixture
4749
write("TEST_F($LSmokeTestSuite, $L )",clientNamespace, test.getTestcaseName()).write("{").indent().
48-
write("Aws::$L::$LClientConfiguration clientConfiguration;", clientNamespace,clientNamespace);
50+
write("Aws::$L::$LClientConfiguration clientConfiguration;",
51+
clientNamespace,
52+
CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, clientNamespace));
4953
if(test.getConfig().getParams() instanceof AwsVendorParams)
5054
{
5155
AwsVendorParams configParams = (AwsVendorParams) test.getConfig().getParams();
@@ -60,7 +64,8 @@ protected void defineTestCase(SmokeTestData test)
6064

6165
if(Objects.equals(test.getAuth(), "sigv4") || Objects.equals(test.getAuth(), "sigv4a"))
6266
{
63-
write("auto clientSp = Aws::MakeShared<$LClient>(ALLOCATION_TAG, clientConfiguration);",clientNamespace);
67+
write("auto clientSp = Aws::MakeShared<$LClient>(ALLOCATION_TAG, clientConfiguration);",
68+
CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, clientNamespace));
6469
}
6570
//comments
6671
if( !test.getTestDataCodeBlock().isEmpty() )

0 commit comments

Comments
 (0)