Skip to content

Commit 94f5744

Browse files
committed
Revert "Add support for event stream requests over RPC"
This reverts commit 8763931.
1 parent 736e66c commit 94f5744

File tree

28 files changed

+31
-2319
lines changed

28 files changed

+31
-2319
lines changed

codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ public CodeBlock asyncExecutionHandler(IntermediateModel intermediateModel, Oper
232232
.add(".withMarshaller($L)\n", asyncMarshaller(model, opModel, marshaller, protocolFactory))
233233
.add(asyncRequestBody(opModel))
234234
.add(fullDuplex(opModel))
235-
.add(hasInitialRequestEvent(opModel, isRestJson))
236235
.add(".withResponseHandler($L)\n", responseHandlerName(opModel, isRestJson))
237236
.add(".withErrorResponseHandler(errorResponseHandler)\n")
238237
.add(".withMetricCollector(apiCallMetricCollector)\n")
@@ -272,11 +271,6 @@ private CodeBlock fullDuplex(OperationModel opModel) {
272271
: CodeBlock.of("");
273272
}
274273

275-
private CodeBlock hasInitialRequestEvent(OperationModel opModel, boolean isRestJson) {
276-
return opModel.hasEventStreamInput() && !isRestJson ? CodeBlock.of(".withInitialRequestEvent(true)")
277-
: CodeBlock.of("");
278-
}
279-
280274
private CodeBlock asyncRequestBody(OperationModel opModel) {
281275
return opModel.hasEventStreamInput() ? CodeBlock.of(".withAsyncRequestBody($T.fromPublisher(adapted))",
282276
AsyncRequestBody.class)

codegen/src/main/java/software/amazon/awssdk/codegen/poet/transform/protocols/EventStreamJsonMarshallerSpec.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
*/
3333
public final class EventStreamJsonMarshallerSpec extends JsonMarshallerSpec {
3434

35+
private static final String JSON_CONTENT_TYPE = "application/json";
36+
3537
public EventStreamJsonMarshallerSpec(IntermediateModel model, ShapeModel shapeModel) {
3638
super(shapeModel);
3739
}
@@ -49,7 +51,7 @@ public CodeBlock marshalCodeBlock(ClassName requestClassName) {
4951

5052
// Add :content-type header only if payload is present
5153
if (!shapeModel.hasNoEventPayload()) {
52-
builder.add(".putHeader(\":content-type\", $L)", determinePayloadContentType());
54+
builder.add(".putHeader(\":content-type\", \"$L\")", determinePayloadContentType());
5355
}
5456

5557
builder.add(".build();");
@@ -83,12 +85,12 @@ private String determinePayloadContentType() {
8385
return getPayloadContentType(explicitEventPayload);
8486
}
8587

86-
return "protocolFactory.getContentType()";
88+
return JSON_CONTENT_TYPE;
8789
}
8890

8991
private String getPayloadContentType(MemberModel memberModel) {
90-
String blobContentType = "\"application/octet-stream\"";
91-
String stringContentType = "\"text/plain\"";
92+
String blobContentType = "application/octet-stream";
93+
String stringContentType = "text/plain";
9294
String variableType = memberModel.getVariable().getVariableType();
9395

9496
if ("software.amazon.awssdk.core.SdkBytes".equals(variableType)) {
@@ -97,6 +99,6 @@ private String getPayloadContentType(MemberModel memberModel) {
9799
return stringContentType;
98100
}
99101

100-
return "protocolFactory.getContentType()";
102+
return JSON_CONTENT_TYPE;
101103
}
102104
}

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

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
package software.amazon.awssdk.codegen.poet;
1717

1818
import java.io.File;
19-
20-
import org.eclipse.core.runtime.internal.adaptor.IModel;
2119
import software.amazon.awssdk.codegen.C2jModels;
2220
import software.amazon.awssdk.codegen.IntermediateModelBuilder;
2321
import software.amazon.awssdk.codegen.model.config.customization.CustomizationConfig;
@@ -33,20 +31,7 @@
3331
public class ClientTestModels {
3432
private ClientTestModels() {}
3533

36-
public static IntermediateModel awsJsonServiceModels() {
37-
File serviceModel = new File(ClientTestModels.class.getResource("client/c2j/json/service-2.json").getFile());
38-
File customizationModel = new File(ClientTestModels.class.getResource("client/c2j/json/customization.config").getFile());
39-
File paginatorsModel = new File(ClientTestModels.class.getResource("client/c2j/json/paginators.json").getFile());
40-
C2jModels models = C2jModels.builder()
41-
.serviceModel(getServiceModel(serviceModel))
42-
.customizationConfig(getCustomizationConfig(customizationModel))
43-
.paginatorsModel(getPaginatorsModel(paginatorsModel))
44-
.build();
45-
46-
return new IntermediateModelBuilder(models).build();
47-
}
48-
49-
public static IntermediateModel restJsonServiceModels() {
34+
public static IntermediateModel jsonServiceModels() {
5035
File serviceModel = new File(ClientTestModels.class.getResource("client/c2j/rest-json/service-2.json").getFile());
5136
File customizationModel = new File(ClientTestModels.class.getResource("client/c2j/rest-json/customization.config").getFile());
5237
File paginatorsModel = new File(ClientTestModels.class.getResource("client/c2j/rest-json/paginators.json").getFile());

codegen/src/test/java/software/amazon/awssdk/codegen/poet/builder/BuilderClassTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public void asyncClientBuilderClass() throws Exception {
6969
}
7070

7171
private void validateGeneration(Function<IntermediateModel, ClassSpec> generatorConstructor, String expectedClassName) {
72-
assertThat(generatorConstructor.apply(ClientTestModels.restJsonServiceModels()), generatesTo(expectedClassName));
72+
assertThat(generatorConstructor.apply(ClientTestModels.jsonServiceModels()), generatesTo(expectedClassName));
7373
}
7474

7575
private void validateQueryGeneration(Function<IntermediateModel, ClassSpec> generatorConstructor, String expectedClassName) {

codegen/src/test/java/software/amazon/awssdk/codegen/poet/client/PoetClientFunctionalTests.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,27 @@ public class PoetClientFunctionalTests {
2828

2929
@Test
3030
public void asyncClientClass() throws Exception {
31-
AsyncClientClass asyncClientClass = createAsyncClientClass(ClientTestModels.restJsonServiceModels());
31+
AsyncClientClass asyncClientClass = new AsyncClientClass(
32+
GeneratorTaskParams.create(ClientTestModels.jsonServiceModels(), "sources/", "tests/"));
3233
assertThat(asyncClientClass, generatesTo("test-async-client-class.java"));
3334
}
3435

3536
@Test
3637
public void asyncClientInterface() throws Exception {
37-
ClassSpec asyncClientInterface = new AsyncClientInterface(ClientTestModels.restJsonServiceModels());
38+
ClassSpec asyncClientInterface = new AsyncClientInterface(ClientTestModels.jsonServiceModels());
3839
assertThat(asyncClientInterface, generatesTo("test-json-async-client-interface.java"));
3940
}
4041

4142
@Test
4243
public void simpleMethodsIntegClass() throws Exception {
4344
ClientSimpleMethodsIntegrationTests simpleMethodsClass = new ClientSimpleMethodsIntegrationTests(
44-
ClientTestModels.restJsonServiceModels());
45+
ClientTestModels.jsonServiceModels());
4546
assertThat(simpleMethodsClass, generatesTo("test-simple-methods-integ-class.java"));
4647
}
4748

4849
@Test
49-
public void syncClientClassRestJson() throws Exception {
50-
SyncClientClass syncClientClass = createSyncClientClass(ClientTestModels.restJsonServiceModels());
50+
public void syncClientClassJson() throws Exception {
51+
SyncClientClass syncClientClass = createSyncClientClass(ClientTestModels.jsonServiceModels());
5152
assertThat(syncClientClass, generatesTo("test-json-client-class.java"));
5253
}
5354

@@ -57,11 +58,6 @@ public void syncClientClassQuery() throws Exception {
5758
assertThat(syncClientClass, generatesTo("test-query-client-class.java"));
5859
}
5960

60-
@Test
61-
public void asyncClientClassAwsJson() throws Exception {
62-
AsyncClientClass asyncClientClass = createAsyncClientClass(ClientTestModels.awsJsonServiceModels());
63-
assertThat(asyncClientClass, generatesTo("test-aws-json-async-client-class.java"));
64-
}
6561

6662
@Test
6763
public void asyncClientClassQuery() throws Exception {
@@ -75,6 +71,7 @@ public void syncClientClassXml() throws Exception {
7571
assertThat(syncClientClass, generatesTo("test-xml-client-class.java"));
7672
}
7773

74+
7875
@Test
7976
public void asyncClientClassXml() throws Exception {
8077
AsyncClientClass syncClientClass = createAsyncClientClass(ClientTestModels.xmlServiceModels());
@@ -91,7 +88,7 @@ private AsyncClientClass createAsyncClientClass(IntermediateModel model) {
9188

9289
@Test
9390
public void syncClientInterface() throws Exception {
94-
ClassSpec syncClientInterface = new SyncClientInterface(ClientTestModels.restJsonServiceModels());
91+
ClassSpec syncClientInterface = new SyncClientInterface(ClientTestModels.jsonServiceModels());
9592
assertThat(syncClientInterface, generatesTo("test-json-client-interface.java"));
9693
}
9794

codegen/src/test/java/software/amazon/awssdk/codegen/poet/eventstream/EventStreamFunctionalTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public void responseHandlerBuilder() throws Exception {
4545

4646
private void runTest(BiFunction<GeneratorTaskParams, OperationModel, ClassSpec> specFactory,
4747
String expectedTestFile) {
48-
IntermediateModel model = ClientTestModels.restJsonServiceModels();
48+
IntermediateModel model = ClientTestModels.jsonServiceModels();
4949
GeneratorTaskParams dependencies = GeneratorTaskParams.create(model, "sources/", "tests/");
5050
ClassSpec classSpec = specFactory.apply(dependencies, model.getOperation("EventStreamOperation"));
5151
assertThat(classSpec, generatesTo(expectedTestFile));

codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/json/customization.config

Lines changed: 0 additions & 20 deletions
This file was deleted.

codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/c2j/json/paginators.json

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)