Skip to content

Commit

Permalink
feat: Add postfix increment to ServiceStubSettings batch desc (#283)
Browse files Browse the repository at this point in the history
  • Loading branch information
miraleung committed Sep 12, 2020
1 parent 26a0582 commit 333458a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import com.google.api.generator.engine.ast.ScopeNode;
import com.google.api.generator.engine.ast.Statement;
import com.google.api.generator.engine.ast.TypeNode;
import com.google.api.generator.engine.ast.UnaryOperationExpr;
import com.google.api.generator.engine.ast.ValueExpr;
import com.google.api.generator.engine.ast.Variable;
import com.google.api.generator.engine.ast.VariableExpr;
Expand Down Expand Up @@ -333,7 +334,7 @@ private static MethodDefinition createSplitResponseMethod(
MethodInvocationExpr.builder()
.setExprReferenceExpr(batchResponseVarExpr)
.setMethodName(getSubresponseFieldMethodName)
.setArguments(batchMessageIndexVarExpr)
.setArguments(UnaryOperationExpr.postfixIncrementWithExpr(batchMessageIndexVarExpr))
.build();
innerSubresponseForExprs.add(
MethodInvocationExpr.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public void batchingDescriptor_hasSubresponseField() {
"List<String> subresponseElements = new ArrayList<>();\n",
"long subresponseCount = responder.getMessageCount();\n",
"for (int i = 0; i < subresponseCount; i++) {\n",
"subresponseElements.add(batchResponse.getMessageIds(batchMessageIndex));\n",
"subresponseElements.add(batchResponse.getMessageIds(batchMessageIndex++));\n",
"}\n",
"PublishResponse response ="
+ " PublishResponse.newBuilder().addAllMessageIds(subresponseElements).build();\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1820,7 +1820,7 @@ private static List<Service> parseServices(
+ " long subresponseCount = responder.getMessageCount();\n"
+ " for (int i = 0; i < subresponseCount; i++) {\n"
+ " "
+ " subresponseElements.add(batchResponse.getMessageIds(batchMessageIndex));\n"
+ " subresponseElements.add(batchResponse.getMessageIds(batchMessageIndex++));\n"
+ " }\n"
+ " PublishResponse response =\n"
+ " "
Expand Down

0 comments on commit 333458a

Please sign in to comment.