diff --git a/src/main/java/com/uber/cadence/internal/replay/QueryWorkflowParameters.java b/src/main/java/com/uber/cadence/internal/replay/QueryWorkflowParameters.java index 041ae53fa..253286f59 100644 --- a/src/main/java/com/uber/cadence/internal/replay/QueryWorkflowParameters.java +++ b/src/main/java/com/uber/cadence/internal/replay/QueryWorkflowParameters.java @@ -45,11 +45,6 @@ public void setInput(byte[] input) { this.input = input; } - public QueryWorkflowParameters withInput(byte[] input) { - this.input = input; - return this; - } - public String getRunId() { return runId; } @@ -58,11 +53,6 @@ public void setRunId(String runId) { this.runId = runId; } - public QueryWorkflowParameters withRunId(String runId) { - this.runId = runId; - return this; - } - public String getQueryType() { return queryType; } @@ -71,11 +61,6 @@ public void setQueryType(String queryType) { this.queryType = queryType; } - public QueryWorkflowParameters withQueryType(String queryType) { - this.queryType = queryType; - return this; - } - public String getWorkflowId() { return workflowId; } @@ -84,11 +69,6 @@ public void setWorkflowId(String workflowId) { this.workflowId = workflowId; } - public QueryWorkflowParameters withWorkflowId(String workflowId) { - this.workflowId = workflowId; - return this; - } - public QueryRejectCondition getQueryRejectCondition() { return queryRejectCondition; } @@ -97,12 +77,6 @@ public void setQueryRejectCondition(QueryRejectCondition queryRejectCondition) { this.queryRejectCondition = queryRejectCondition; } - public QueryWorkflowParameters withQueryRejectCondition( - QueryRejectCondition queryRejectCondition) { - this.queryRejectCondition = queryRejectCondition; - return this; - } - public QueryConsistencyLevel getQueryConsistencyLevel() { return queryConsistencyLevel; } @@ -111,18 +85,15 @@ public void setQueryConsistencyLevel(QueryConsistencyLevel queryConsistencyLevel this.queryConsistencyLevel = queryConsistencyLevel; } - public QueryWorkflowParameters withQueryConsistencyLevel( - QueryConsistencyLevel queryConsistencyLevel) { - this.queryConsistencyLevel = queryConsistencyLevel; - return this; - } - @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); sb.append("QueryName: " + queryType + ", "); - sb.append("Input: " + new String(input, 0, 512, StandardCharsets.UTF_8) + ", "); + sb.append( + "Input: " + + new String(input, 0, Math.min(512, input.length), StandardCharsets.UTF_8) + + ", "); sb.append("WorkflowId: " + workflowId + ", "); sb.append("RunId: " + runId + ", "); sb.append("QueryRejectCondition: " + queryRejectCondition + ", "); diff --git a/src/test/java/com/uber/cadence/internal/replay/QueryWorkflowParametersTest.java b/src/test/java/com/uber/cadence/internal/replay/QueryWorkflowParametersTest.java new file mode 100644 index 000000000..57a893a51 --- /dev/null +++ b/src/test/java/com/uber/cadence/internal/replay/QueryWorkflowParametersTest.java @@ -0,0 +1,38 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *
Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *
Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *
http://aws.amazon.com/apache2.0 + * + *
or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.internal.replay; + +import com.uber.cadence.QueryConsistencyLevel; +import com.uber.cadence.QueryRejectCondition; +import junit.framework.TestCase; + +public class QueryWorkflowParametersTest extends TestCase { + QueryWorkflowParameters p; + + public void setUp() throws Exception { + p = new QueryWorkflowParameters(); + p.setInput("input".getBytes()); + p.setWorkflowId("workflowid"); + p.setQueryType("querytype"); + p.setRunId("runid"); + p.setQueryConsistencyLevel(QueryConsistencyLevel.EVENTUAL); + p.setQueryRejectCondition(QueryRejectCondition.NOT_OPEN); + } + + public void testCopy() { + QueryWorkflowParameters copied = p.copy(); + assertEquals(copied.toString(), p.toString()); + } +}