Skip to content

Commit 6d99353

Browse files
committed
Update sample file headers
1 parent 9cdf420 commit 6d99353

File tree

2 files changed

+61
-44
lines changed

2 files changed

+61
-44
lines changed
Lines changed: 53 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
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+
118
package com.uber.cadence.samples.shadowing;
219

20+
import static com.uber.cadence.samples.common.SampleConstants.DOMAIN;
21+
322
import com.google.common.collect.Lists;
423
import com.uber.cadence.client.WorkflowClient;
524
import com.uber.cadence.client.WorkflowClientOptions;
@@ -12,48 +31,44 @@
1231
import com.uber.cadence.worker.ShadowingWorker;
1332
import com.uber.cadence.worker.WorkerOptions;
1433
import com.uber.cadence.worker.WorkflowStatus;
15-
1634
import java.util.concurrent.CountDownLatch;
1735

18-
import static com.uber.cadence.samples.common.SampleConstants.DOMAIN;
19-
2036
public class ShadowTraffic {
21-
public static void main(String[] args) throws InterruptedException {
22-
// Get a new client
23-
// NOTE: to set a different options, you can do like this:
24-
// ClientOptions.newBuilder().setRpcTimeout(5 * 1000).build();
25-
WorkflowClient workflowClient =
26-
WorkflowClient.newInstance(
27-
new WorkflowServiceTChannel(ClientOptions.defaultInstance()),
28-
WorkflowClientOptions.newBuilder().setDomain(DOMAIN).build());
29-
ShadowingOptions options = ShadowingOptions
30-
.newBuilder()
31-
.setDomain(DOMAIN)
32-
.setShadowMode(Mode.Normal)
33-
.setWorkflowTypes(Lists.newArrayList("GreetingWorkflow::getGreeting"))
34-
.setWorkflowStatuses(Lists.newArrayList(WorkflowStatus.OPEN, WorkflowStatus.CLOSED))
35-
.setExitCondition(new ExitCondition().setExpirationIntervalInSeconds(60))
36-
.build();
37+
public static void main(String[] args) throws InterruptedException {
38+
// Get a new client
39+
// NOTE: to set a different options, you can do like this:
40+
// ClientOptions.newBuilder().setRpcTimeout(5 * 1000).build();
41+
WorkflowClient workflowClient =
42+
WorkflowClient.newInstance(
43+
new WorkflowServiceTChannel(ClientOptions.defaultInstance()),
44+
WorkflowClientOptions.newBuilder().setDomain(DOMAIN).build());
45+
ShadowingOptions options =
46+
ShadowingOptions.newBuilder()
47+
.setDomain(DOMAIN)
48+
.setShadowMode(Mode.Normal)
49+
.setWorkflowTypes(Lists.newArrayList("GreetingWorkflow::getGreeting"))
50+
.setWorkflowStatuses(Lists.newArrayList(WorkflowStatus.OPEN, WorkflowStatus.CLOSED))
51+
.setExitCondition(new ExitCondition().setExpirationIntervalInSeconds(60))
52+
.build();
3753

38-
ShadowingWorker shadowingWorker = new ShadowingWorker(
39-
workflowClient,
40-
"HelloActivity",
41-
WorkerOptions.defaultInstance(),
42-
options);
43-
shadowingWorker.registerWorkflowImplementationTypes(HelloActivity.GreetingWorkflowImpl.class);
54+
ShadowingWorker shadowingWorker =
55+
new ShadowingWorker(
56+
workflowClient, "HelloActivity", WorkerOptions.defaultInstance(), options);
57+
shadowingWorker.registerWorkflowImplementationTypes(HelloActivity.GreetingWorkflowImpl.class);
4458

45-
CountDownLatch latch = new CountDownLatch(1);
46-
// Execute a workflow waiting for it to complete.
47-
Runnable runnable = () -> {
48-
try {
49-
shadowingWorker.start();
50-
} catch (Exception e) {
51-
System.out.println("Failed to start shadowing workflow");
52-
System.out.println(e);
53-
latch.countDown();
54-
}
59+
CountDownLatch latch = new CountDownLatch(1);
60+
// Execute a workflow waiting for it to complete.
61+
Runnable runnable =
62+
() -> {
63+
try {
64+
shadowingWorker.start();
65+
} catch (Exception e) {
66+
System.out.println("Failed to start shadowing workflow");
67+
System.out.println(e);
68+
latch.countDown();
69+
}
5570
};
56-
runnable.run();
57-
latch.await();
58-
}
71+
runnable.run();
72+
latch.await();
73+
}
5974
}

src/test/java/com/uber/cadence/samples/hello/HelloWorkflowShadowingTest.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
*
4-
* Modifications copyright (C) 2017-2021 Uber Technologies, Inc.
4+
* Modifications copyright (C) 2017 Uber Technologies, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
77
* use this file except in compliance with the License. A copy of the License is
@@ -17,6 +17,9 @@
1717

1818
package com.uber.cadence.samples.hello;
1919

20+
import static com.uber.cadence.samples.common.SampleConstants.DOMAIN;
21+
import static com.uber.cadence.samples.hello.HelloActivity.TASK_LIST;
22+
2023
import com.google.common.collect.Lists;
2124
import com.uber.cadence.serviceclient.ClientOptions;
2225
import com.uber.cadence.serviceclient.IWorkflowService;
@@ -26,18 +29,17 @@
2629
import com.uber.cadence.testing.WorkflowShadower;
2730
import com.uber.cadence.worker.ShadowingOptions;
2831
import com.uber.cadence.worker.WorkflowStatus;
32+
import org.junit.Ignore;
2933
import org.junit.Test;
3034

31-
import static com.uber.cadence.samples.common.SampleConstants.DOMAIN;
32-
import static com.uber.cadence.samples.hello.HelloActivity.TASK_LIST;
33-
3435
public class HelloWorkflowShadowingTest {
36+
@Ignore
3537
@Test
3638
public void testShadowing() throws Throwable {
3739
IWorkflowService service = new WorkflowServiceTChannel(ClientOptions.defaultInstance());
3840

39-
ShadowingOptions options = ShadowingOptions
40-
.newBuilder()
41+
ShadowingOptions options =
42+
ShadowingOptions.newBuilder()
4143
.setDomain(DOMAIN)
4244
.setShadowMode(Mode.Normal)
4345
.setWorkflowTypes(Lists.newArrayList("GreetingWorkflow::getGreeting"))

0 commit comments

Comments
 (0)