|
| 1 | +/* |
| 2 | + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 3 | + * |
| 4 | + * Modifications copyright (C) 2017 Uber Technologies, Inc. |
| 5 | + * |
| 6 | + * Licensed under the Apache License, Version 2.0 (the "License"). You may not |
| 7 | + * use this file except in compliance with the License. A copy of the License is |
| 8 | + * located at |
| 9 | + * |
| 10 | + * http://aws.amazon.com/apache2.0 |
| 11 | + * |
| 12 | + * or in the "license" file accompanying this file. This file is distributed on |
| 13 | + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
| 14 | + * express or implied. See the License for the specific language governing |
| 15 | + * permissions and limitations under the License. |
| 16 | + */ |
| 17 | + |
| 18 | +package com.uber.cadence.samples.calculation; |
| 19 | + |
| 20 | +import com.uber.cadence.testing.WorkflowReplayer; |
| 21 | +import org.junit.Test; |
| 22 | + |
| 23 | +// This replay test is the recommended way to make sure changing workflow code is backward |
| 24 | +// compatible without non-deterministic errors. |
| 25 | +// "HelloActivity.json" can be downloaded from cadence CLI: |
| 26 | +// cadence --do samples-domain wf show -w helloworld_d002cd3a-aeee-4a11-aa30-1c62385b4d87 |
| 27 | +// --output_filename ~/tmp/HelloActivity.json |
| 28 | +// Or from Cadence Web UI. (You may need to put history file in resources folder; and change |
| 29 | +// workflowType in the first event of history). |
| 30 | +public class ReplayTest { |
| 31 | + @Test |
| 32 | + public void testReplay() throws Exception { |
| 33 | + WorkflowReplayer.replayWorkflowExecutionFromResource( |
| 34 | + "calculation.workflow.history.json", WorkflowMethodsImpl.class); |
| 35 | + } |
| 36 | +} |
0 commit comments