Skip to content

Commit cd68261

Browse files
authored
0.27.0 release merge from develop (#27)
1 parent 76713f2 commit cd68261

24 files changed

+92
-53
lines changed

build.gradle

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
// Run 'gradle checkUpdates' to find out which dependencies have newer versions
2+
13
plugins {
24
id 'net.minecrell.licenser' version '0.4.1'
3-
id 'com.github.sherter.google-java-format' version '0.8'
4-
id "net.ltgt.errorprone" version "0.6"
5+
id 'com.github.sherter.google-java-format' version '0.9'
6+
id "net.ltgt.errorprone" version "1.2.1"
7+
id 'name.remal.check-updates' version '1.0.201'
58
}
69

710
apply plugin: 'java'
@@ -27,16 +30,16 @@ repositories {
2730
}
2831

2932
dependencies {
30-
implementation group: 'io.temporal', name: 'temporal-sdk', version: '0.26.0'
31-
implementation group: 'commons-configuration', name: 'commons-configuration', version: '1.9'
32-
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
33+
implementation group: 'io.temporal', name: 'temporal-sdk', version: '0.27.0'
34+
implementation group: 'commons-configuration', name: 'commons-configuration', version: '1.10'
35+
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
3336

34-
testImplementation group: 'junit', name: 'junit', version: '4.12'
37+
testImplementation group: 'junit', name: 'junit', version: '4.13'
3538
testImplementation group: 'org.mockito', name: 'mockito-all', version: '1.10.19'
36-
testImplementation group: 'org.powermock', name: 'powermock-api-mockito', version: '1.7.3'
39+
testImplementation group: 'org.powermock', name: 'powermock-api-mockito', version: '1.7.4'
3740

3841
errorproneJavac("com.google.errorprone:javac:9+181-r4173-1")
39-
errorprone("com.google.errorprone:error_prone_core:2.3.1")
42+
errorprone("com.google.errorprone:error_prone_core:2.4.0")
4043
}
4144

4245
compileJava {
@@ -51,3 +54,28 @@ task execute(type: JavaExec) {
5154
license {
5255
header rootProject.file('license-header.txt')
5356
}
57+
58+
task runHello {
59+
doLast {
60+
// Cron and Periodic are not in the list as they take long time to stop
61+
["io.temporal.samples.hello.HelloActivity",
62+
"io.temporal.samples.hello.HelloActivityRetry",
63+
"io.temporal.samples.hello.HelloAsync",
64+
"io.temporal.samples.hello.HelloAsyncActivityCompletion",
65+
"io.temporal.samples.hello.HelloAsyncLambda",
66+
"io.temporal.samples.hello.HelloChild",
67+
"io.temporal.samples.hello.HelloException",
68+
"io.temporal.samples.hello.HelloPolymorphicActivity",
69+
"io.temporal.samples.hello.HelloQuery",
70+
"io.temporal.samples.hello.HelloSaga",
71+
"io.temporal.samples.hello.HelloSearchAttributes",
72+
"io.temporal.samples.hello.HelloSignal"
73+
].each { mainClass ->
74+
println mainClass
75+
javaexec {
76+
classpath = sourceSets.main.runtimeClasspath
77+
main = mainClass
78+
}
79+
}
80+
}
81+
}

gradle/wrapper/gradle-wrapper.jar

-8 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

gradlew.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
2929
set APP_BASE_NAME=%~n0
3030
set APP_HOME=%DIRNAME%
3131

32+
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
33+
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34+
3235
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
3336
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
3437

src/main/java/io/temporal/samples/bookingsaga/TripBookingActivities.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,38 +25,50 @@
2525
public interface TripBookingActivities {
2626

2727
/**
28+
* Request a car rental reservation.
29+
*
2830
* @param name customer name
2931
* @return reservationID
3032
*/
3133
String reserveCar(String name);
3234

3335
/**
36+
* Request a flight reservation.
37+
*
3438
* @param name customer name
3539
* @return reservationID
3640
*/
3741
String bookFlight(String name);
3842

3943
/**
44+
* Request a hotel reservation.
45+
*
4046
* @param name customer name
4147
* @return reservationID
4248
*/
4349
String bookHotel(String name);
4450

4551
/**
52+
* Cancel a flight reservation.
53+
*
4654
* @param name customer name
4755
* @param reservationID id returned by bookFlight
4856
* @return cancellationConfirmationID
4957
*/
5058
String cancelFlight(String reservationID, String name);
5159

5260
/**
61+
* Cancel a hotel reservation.
62+
*
5363
* @param name customer name
5464
* @param reservationID id returned by bookHotel
5565
* @return cancellationConfirmationID
5666
*/
5767
String cancelHotel(String reservationID, String name);
5868

5969
/**
70+
* Cancel a car rental reservation.
71+
*
6072
* @param name customer name
6173
* @param reservationID id returned by reserveCar
6274
* @return cancellationConfirmationID

src/main/java/io/temporal/samples/common/QueryWorkflowExecution.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919

2020
package io.temporal.samples.common;
2121

22+
import io.temporal.api.common.v1.WorkflowExecution;
2223
import io.temporal.client.WorkflowClient;
2324
import io.temporal.client.WorkflowStub;
24-
import io.temporal.common.v1.WorkflowExecution;
2525
import io.temporal.serviceclient.WorkflowServiceStubs;
2626
import java.util.Optional;
2727

@@ -33,7 +33,7 @@
3333
*/
3434
public class QueryWorkflowExecution {
3535

36-
public static void main(String[] args) throws Exception {
36+
public static void main(String[] args) {
3737
if (args.length < 2 || args.length > 3) {
3838
System.err.println(
3939
"Usage: java "

src/main/java/io/temporal/samples/hello/HelloActivity.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ public class HelloActivity {
4343
/** Workflow interface has to have at least one method annotated with @WorkflowMethod. */
4444
@WorkflowInterface
4545
public interface GreetingWorkflow {
46-
/** @return greeting string */
4746
@WorkflowMethod
4847
String getGreeting(String name);
4948
}

src/main/java/io/temporal/samples/hello/HelloActivityRetry.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ public class HelloActivityRetry {
4343

4444
@WorkflowInterface
4545
public interface GreetingWorkflow {
46-
/** @return greeting string */
4746
@WorkflowMethod
4847
String getGreeting(String name);
4948
}

src/main/java/io/temporal/samples/hello/HelloAsyncActivityCompletion.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ public class HelloAsyncActivityCompletion {
4747

4848
@WorkflowInterface
4949
public interface GreetingWorkflow {
50-
/** @return greeting string */
5150
@WorkflowMethod
5251
String getGreeting(String name);
5352
}

src/main/java/io/temporal/samples/hello/HelloAsyncLambda.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ public class HelloAsyncLambda {
4343

4444
@WorkflowInterface
4545
public interface GreetingWorkflow {
46-
/** @return greeting string */
4746
@WorkflowMethod
4847
String getGreeting(String name);
4948
}

src/main/java/io/temporal/samples/hello/HelloChild.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public class HelloChild {
4040
/** The parent workflow interface. */
4141
@WorkflowInterface
4242
public interface GreetingWorkflow {
43-
/** @return greeting string */
4443
@WorkflowMethod
4544
String getGreeting(String name);
4645
}

src/main/java/io/temporal/samples/hello/HelloCron.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
import io.temporal.activity.Activity;
2323
import io.temporal.activity.ActivityInterface;
2424
import io.temporal.activity.ActivityOptions;
25+
import io.temporal.api.common.v1.WorkflowExecution;
2526
import io.temporal.client.WorkflowClient;
2627
import io.temporal.client.WorkflowExecutionAlreadyStarted;
2728
import io.temporal.client.WorkflowOptions;
28-
import io.temporal.common.v1.WorkflowExecution;
2929
import io.temporal.serviceclient.WorkflowServiceStubs;
3030
import io.temporal.worker.Worker;
3131
import io.temporal.worker.WorkerFactory;
@@ -67,12 +67,6 @@ public static class GreetingWorkflowImpl implements GreetingWorkflow {
6767
GreetingActivities.class,
6868
ActivityOptions.newBuilder().setScheduleToCloseTimeout(Duration.ofSeconds(10)).build());
6969

70-
/**
71-
* Stub used to terminate this workflow run and create the next one with the same ID atomically.
72-
*/
73-
private final GreetingWorkflow continueAsNew =
74-
Workflow.newContinueAsNewStub(GreetingWorkflow.class);
75-
7670
@Override
7771
public void greet(String name) {
7872
activities.greet("Hello " + name + "!");
@@ -87,7 +81,7 @@ public void greet(String greeting) {
8781
}
8882
}
8983

90-
public static void main(String[] args) throws InterruptedException {
84+
public static void main(String[] args) {
9185
// gRPC stubs wrapper that talks to the local docker instance of temporal service.
9286
WorkflowServiceStubs service = WorkflowServiceStubs.newInstance();
9387
// client that can be used to start and signal workflows

src/main/java/io/temporal/samples/hello/HelloPeriodic.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
import io.temporal.activity.Activity;
2424
import io.temporal.activity.ActivityInterface;
2525
import io.temporal.activity.ActivityOptions;
26+
import io.temporal.api.common.v1.WorkflowExecution;
2627
import io.temporal.client.WorkflowClient;
2728
import io.temporal.client.WorkflowException;
2829
import io.temporal.client.WorkflowExecutionAlreadyStarted;
2930
import io.temporal.client.WorkflowOptions;
3031
import io.temporal.client.WorkflowStub;
31-
import io.temporal.common.v1.WorkflowExecution;
3232
import io.temporal.serviceclient.WorkflowServiceStubs;
3333
import io.temporal.worker.Worker;
3434
import io.temporal.worker.WorkerFactory;

src/main/java/io/temporal/samples/hello/HelloSearchAttributes.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,24 @@
2222
import io.temporal.activity.ActivityInterface;
2323
import io.temporal.activity.ActivityMethod;
2424
import io.temporal.activity.ActivityOptions;
25+
import io.temporal.api.common.v1.Payload;
26+
import io.temporal.api.common.v1.SearchAttributes;
27+
import io.temporal.api.common.v1.WorkflowExecution;
28+
import io.temporal.api.workflowservice.v1.DescribeWorkflowExecutionRequest;
29+
import io.temporal.api.workflowservice.v1.DescribeWorkflowExecutionResponse;
2530
import io.temporal.client.WorkflowClient;
2631
import io.temporal.client.WorkflowOptions;
2732
import io.temporal.common.converter.DataConverter;
28-
import io.temporal.common.v1.Payload;
29-
import io.temporal.common.v1.SearchAttributes;
30-
import io.temporal.common.v1.WorkflowExecution;
3133
import io.temporal.serviceclient.WorkflowServiceStubs;
3234
import io.temporal.worker.Worker;
3335
import io.temporal.worker.WorkerFactory;
3436
import io.temporal.workflow.Workflow;
3537
import io.temporal.workflow.WorkflowInterface;
3638
import io.temporal.workflow.WorkflowMethod;
37-
import io.temporal.workflowservice.v1.DescribeWorkflowExecutionRequest;
38-
import io.temporal.workflowservice.v1.DescribeWorkflowExecutionResponse;
39-
import java.text.SimpleDateFormat;
4039
import java.time.Duration;
41-
import java.util.Date;
40+
import java.time.ZoneId;
41+
import java.time.ZonedDateTime;
42+
import java.time.format.DateTimeFormatter;
4243
import java.util.HashMap;
4344
import java.util.Map;
4445
import java.util.UUID;
@@ -53,7 +54,6 @@ public class HelloSearchAttributes {
5354
/** Workflow interface has to have at least one method annotated with @WorkflowMethod. */
5455
@WorkflowInterface
5556
public interface GreetingWorkflow {
56-
/** @return greeting string */
5757
@WorkflowMethod
5858
String getGreeting(String name);
5959
}
@@ -161,7 +161,8 @@ private static Map<String, Object> generateSearchAttributes() {
161161

162162
// CustomDatetimeField takes times encoded in the RFC 3339 format.
163163
private static String generateDateTimeFieldValue() {
164-
return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX").format(new Date());
164+
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX");
165+
return ZonedDateTime.now(ZoneId.systemDefault()).format(formatter);
165166
}
166167

167168
// example for extract value from search attributes

src/main/java/io/temporal/samples/hello/HelloSignal.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ public class HelloSignal {
4545
@WorkflowInterface
4646
public interface GreetingWorkflow {
4747
/**
48-
* @return list of greeting strings that were received through the waitForNameMethod. This
49-
* method will block until the number of greetings specified are received.
48+
* list of greeting strings that were received through the waitForNameMethod. This method will
49+
* block until the number of greetings specified are received.
5050
*/
5151
@WorkflowMethod
5252
List<String> getGreetings();

src/main/java/io/temporal/samples/updatabletimer/DynamicSleepWorkflowStarter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
import static io.temporal.samples.updatabletimer.DynamicSleepWorkflowWorker.DYNAMIC_SLEEP_WORKFLOW_ID;
2323
import static io.temporal.samples.updatabletimer.DynamicSleepWorkflowWorker.TASK_QUEUE;
2424

25+
import io.temporal.api.common.v1.WorkflowExecution;
26+
import io.temporal.api.enums.v1.WorkflowIdReusePolicy;
2527
import io.temporal.client.WorkflowClient;
2628
import io.temporal.client.WorkflowExecutionAlreadyStarted;
2729
import io.temporal.client.WorkflowOptions;
28-
import io.temporal.common.v1.WorkflowExecution;
29-
import io.temporal.enums.v1.WorkflowIdReusePolicy;
3030
import io.temporal.serviceclient.WorkflowServiceStubs;
3131
import org.slf4j.Logger;
3232
import org.slf4j.LoggerFactory;

src/main/java/io/temporal/samples/updatabletimer/UpdatableTimer.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121

2222
import io.temporal.workflow.Workflow;
2323
import java.time.Duration;
24-
import java.util.Date;
24+
import java.time.Instant;
25+
import java.time.LocalDateTime;
26+
import java.time.ZoneId;
2527
import org.slf4j.Logger;
2628

2729
public final class UpdatableTimer {
@@ -32,7 +34,9 @@ public final class UpdatableTimer {
3234
private boolean wakeUpTimeUpdated;
3335

3436
public void sleepUntil(long wakeUpTime) {
35-
logger.info("sleepUntil: " + new Date(wakeUpTime));
37+
Instant wakeUpInstant = Instant.ofEpochMilli(wakeUpTime);
38+
LocalDateTime date = wakeUpInstant.atZone(ZoneId.systemDefault()).toLocalDateTime();
39+
logger.info("sleepUntil: " + date);
3640
this.wakeUpTime = wakeUpTime;
3741
while (true) {
3842
wakeUpTimeUpdated = false;

src/test/java/io/temporal/samples/fileprocessing/FileProcessingTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
import static org.mockito.Matchers.anyObject;
2424
import static org.mockito.Mockito.*;
2525

26+
import io.temporal.api.enums.v1.TimeoutType;
2627
import io.temporal.client.WorkflowClient;
2728
import io.temporal.client.WorkflowOptions;
28-
import io.temporal.enums.v1.TimeoutType;
2929
import io.temporal.failure.TimeoutFailure;
3030
import io.temporal.samples.fileprocessing.StoreActivities.TaskQueueFileNamePair;
3131
import io.temporal.testing.TestWorkflowEnvironment;

src/test/java/io/temporal/samples/hello/HelloChildTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import java.util.concurrent.atomic.AtomicReference;
3636
import org.junit.After;
3737
import org.junit.Before;
38+
import org.junit.Ignore;
3839
import org.junit.Rule;
3940
import org.junit.Test;
4041
import org.junit.rules.TestWatcher;
@@ -89,11 +90,12 @@ public void testChild() {
8990
}
9091

9192
@Test
93+
@Ignore // TODO: Find out how to deal with cglib based mocks
9294
public void testMockedChild() {
9395
worker.registerWorkflowImplementationTypes(GreetingWorkflowImpl.class);
94-
// As new mock is created on each decision the only last one is useful to verify calls.
96+
// As new mock is created on each workflow task the only last one is useful to verify calls.
9597
AtomicReference<GreetingChild> lastChildMock = new AtomicReference<>();
96-
// Factory is called to create a new workflow object on each decision.
98+
// Factory is called to create a new workflow object on each workflow task.
9799
worker.addWorkflowImplementationFactory(
98100
GreetingChild.class,
99101
() -> {

src/test/java/io/temporal/samples/hello/HelloCronTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
import static org.mockito.Matchers.anyString;
2626
import static org.mockito.Mockito.*;
2727

28+
import io.temporal.api.common.v1.WorkflowExecution;
2829
import io.temporal.client.WorkflowClient;
2930
import io.temporal.client.WorkflowOptions;
30-
import io.temporal.common.v1.WorkflowExecution;
3131
import io.temporal.samples.hello.HelloCron.GreetingActivities;
3232
import io.temporal.samples.hello.HelloCron.GreetingWorkflow;
3333
import io.temporal.samples.hello.HelloCron.GreetingWorkflowImpl;

src/test/java/io/temporal/samples/hello/HelloExceptionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
import static org.powermock.api.mockito.PowerMockito.mock;
2727
import static org.powermock.api.mockito.PowerMockito.when;
2828

29+
import io.temporal.api.enums.v1.TimeoutType;
2930
import io.temporal.client.WorkflowClient;
3031
import io.temporal.client.WorkflowException;
3132
import io.temporal.client.WorkflowOptions;
32-
import io.temporal.enums.v1.TimeoutType;
3333
import io.temporal.failure.ActivityFailure;
3434
import io.temporal.failure.ApplicationFailure;
3535
import io.temporal.failure.ChildWorkflowFailure;

0 commit comments

Comments
 (0)