diff --git a/it/pom.xml b/it/pom.xml
index 23ad1112a6..1b9a397927 100644
--- a/it/pom.xml
+++ b/it/pom.xml
@@ -18,6 +18,7 @@
tasks/dependency-manager-test
tasks/serialization-test
tasks/suspend-test
+ tasks/client1-test
common
server
diff --git a/it/runtime-v1/src/test/filtered-resources/version.properties b/it/runtime-v1/src/test/filtered-resources/version.properties
new file mode 100644
index 0000000000..7e48b881dd
--- /dev/null
+++ b/it/runtime-v1/src/test/filtered-resources/version.properties
@@ -0,0 +1 @@
+project.version = ${project.version}
\ No newline at end of file
diff --git a/it/runtime-v1/src/test/java/com/walmartlabs/concord/it/runtime/v1/ITConstants.java b/it/runtime-v1/src/test/java/com/walmartlabs/concord/it/runtime/v1/ITConstants.java
index 192d6b0852..2d12545b88 100644
--- a/it/runtime-v1/src/test/java/com/walmartlabs/concord/it/runtime/v1/ITConstants.java
+++ b/it/runtime-v1/src/test/java/com/walmartlabs/concord/it/runtime/v1/ITConstants.java
@@ -20,10 +20,29 @@
* =====
*/
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
public final class ITConstants {
+ public static final String PROJECT_VERSION;
public static final long DEFAULT_TEST_TIMEOUT = 120000;
+ static {
+ PROJECT_VERSION = getProperties("version.properties").getProperty("project.version");
+ }
+
+ private static Properties getProperties(String path) {
+ try (InputStream in = ClassLoader.getSystemResourceAsStream(path)) {
+ Properties props = new Properties();
+ props.load(in);
+ return props;
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
private ITConstants() {
}
}
diff --git a/it/runtime-v1/src/test/java/com/walmartlabs/concord/it/runtime/v1/ProcessIT.java b/it/runtime-v1/src/test/java/com/walmartlabs/concord/it/runtime/v1/ProcessIT.java
index b8e9f63405..5fbf46b5c9 100644
--- a/it/runtime-v1/src/test/java/com/walmartlabs/concord/it/runtime/v1/ProcessIT.java
+++ b/it/runtime-v1/src/test/java/com/walmartlabs/concord/it/runtime/v1/ProcessIT.java
@@ -24,8 +24,11 @@
import ca.ibodrov.concord.testcontainers.Payload;
import ca.ibodrov.concord.testcontainers.ProcessListQuery;
import ca.ibodrov.concord.testcontainers.junit5.ConcordRule;
+import com.google.common.base.Charsets;
+import com.google.common.io.Resources;
import com.walmartlabs.concord.client.FormListEntry;
import com.walmartlabs.concord.client.FormSubmitResponse;
+import com.walmartlabs.concord.client.ProcessCheckpointEntry;
import com.walmartlabs.concord.client.ProcessEntry;
import com.walmartlabs.concord.client.ProcessEntry.StatusEnum;
import com.walmartlabs.concord.it.common.JGitUtils;
@@ -35,8 +38,10 @@
import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.api.extension.RegisterExtension;
+import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
+import java.net.URL;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -517,6 +522,22 @@ public void testEmptyExclusiveGroup() throws Exception {
proc.assertLog(".*Invalid exclusive mode.*");
}
+ @Test
+ public void testTaskWithClient1() throws Exception {
+ String concordYml = resourceToString(ProcessIT.class.getResource("client1Task/concord.yml"))
+ .replaceAll("PROJECT_VERSION", ITConstants.PROJECT_VERSION);
+
+ Payload payload = new Payload().concordYml(concordYml);
+
+ ConcordProcess proc = concord.processes().start(payload);
+ proc.expectStatus(StatusEnum.FINISHED);
+
+ // ---
+
+ proc.assertLog(".*process entry: RUNNING.*");
+ proc.assertLog(".*Works!.*");
+ }
+
@SuppressWarnings("unchecked")
private static void assertProcessErrorMessage(ProcessEntry p, String expected) {
assertNotNull(p);
@@ -536,4 +557,8 @@ private static void assertProcessErrorMessage(ProcessEntry p, String expected) {
private static URI resource(String name) throws URISyntaxException {
return ProcessIT.class.getResource(name).toURI();
}
+
+ private static String resourceToString(URL resource) throws IOException {
+ return Resources.toString(resource, Charsets.UTF_8);
+ }
}
diff --git a/it/runtime-v1/src/test/resources/com/walmartlabs/concord/it/runtime/v1/client1Task/concord.yml b/it/runtime-v1/src/test/resources/com/walmartlabs/concord/it/runtime/v1/client1Task/concord.yml
new file mode 100644
index 0000000000..b66dff02df
--- /dev/null
+++ b/it/runtime-v1/src/test/resources/com/walmartlabs/concord/it/runtime/v1/client1Task/concord.yml
@@ -0,0 +1,8 @@
+configuration:
+ dependencies:
+ - "mvn://com.walmartlabs.concord.it.tasks:client1-test:PROJECT_VERSION"
+
+flows:
+ default:
+ - task: client1Test
+ - log: "Works!"
\ No newline at end of file
diff --git a/it/runtime-v2/src/test/java/com/walmartlabs/concord/it/runtime/v2/ProcessIT.java b/it/runtime-v2/src/test/java/com/walmartlabs/concord/it/runtime/v2/ProcessIT.java
index 9748625836..24fbb7798d 100644
--- a/it/runtime-v2/src/test/java/com/walmartlabs/concord/it/runtime/v2/ProcessIT.java
+++ b/it/runtime-v2/src/test/java/com/walmartlabs/concord/it/runtime/v2/ProcessIT.java
@@ -496,4 +496,20 @@ public void testForkVariablesAfterForm() throws Exception {
fork.assertLog(".*parentInstanceId: " + proc.instanceId() + ".*");
fork.assertLog(".*txId: " + fork.instanceId() + ".*");
}
+
+ @Test
+ public void testTaskWithClient1() throws Exception {
+ String concordYml = resourceToString(ProcessIT.class.getResource("client1Task/concord.yml"))
+ .replaceAll("PROJECT_VERSION", ITConstants.PROJECT_VERSION);
+
+ Payload payload = new Payload().concordYml(concordYml);
+
+ ConcordProcess proc = concord.processes().start(payload);
+ expectStatus(proc, ProcessEntry.StatusEnum.FINISHED);
+
+ // ---
+
+ proc.assertLog(".*process entry: RUNNING.*");
+ proc.assertLog(".*Works!.*");
+ }
}
diff --git a/it/runtime-v2/src/test/resources/com/walmartlabs/concord/it/runtime/v2/client1Task/concord.yml b/it/runtime-v2/src/test/resources/com/walmartlabs/concord/it/runtime/v2/client1Task/concord.yml
new file mode 100644
index 0000000000..29d3e6f7d4
--- /dev/null
+++ b/it/runtime-v2/src/test/resources/com/walmartlabs/concord/it/runtime/v2/client1Task/concord.yml
@@ -0,0 +1,9 @@
+configuration:
+ runtime: concord-v2
+ dependencies:
+ - "mvn://com.walmartlabs.concord.it.tasks:client1-test:PROJECT_VERSION"
+
+flows:
+ default:
+ - task: client1Test
+ - log: "Works!"
\ No newline at end of file
diff --git a/it/tasks/client1-test/pom.xml b/it/tasks/client1-test/pom.xml
new file mode 100644
index 0000000000..b9bf7233b2
--- /dev/null
+++ b/it/tasks/client1-test/pom.xml
@@ -0,0 +1,52 @@
+
+
+ 4.0.0
+
+
+ com.walmartlabs.concord.it
+ parent
+ 2.1.1-SNAPSHOT
+ ../../pom.xml
+
+
+ com.walmartlabs.concord.it.tasks
+ client1-test
+ jar
+
+
+
+ com.walmartlabs.concord
+ concord-sdk
+ provided
+
+
+ com.walmartlabs.concord.runtime.v2
+ concord-runtime-sdk-v2
+ provided
+
+
+ com.walmartlabs.concord
+ concord-client
+ provided
+
+
+ javax.inject
+ javax.inject
+ provided
+
+
+ org.slf4j
+ slf4j-api
+ provided
+
+
+
+
+
+
+ org.eclipse.sisu
+ sisu-maven-plugin
+
+
+
+
diff --git a/it/tasks/client1-test/src/main/java/com/walmartlabs/concord/it/tasks/suspendtest/Client1TestTask.java b/it/tasks/client1-test/src/main/java/com/walmartlabs/concord/it/tasks/suspendtest/Client1TestTask.java
new file mode 100644
index 0000000000..95fc7d15d1
--- /dev/null
+++ b/it/tasks/client1-test/src/main/java/com/walmartlabs/concord/it/tasks/suspendtest/Client1TestTask.java
@@ -0,0 +1,55 @@
+package com.walmartlabs.concord.it.tasks.suspendtest;
+
+/*-
+ * *****
+ * Concord
+ * -----
+ * Copyright (C) 2017 - 2023 Walmart Inc.
+ * -----
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License 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.
+ * =====
+ */
+
+import com.walmartlabs.concord.ApiClient;
+import com.walmartlabs.concord.client.ApiClientConfiguration;
+import com.walmartlabs.concord.client.ApiClientFactory;
+import com.walmartlabs.concord.client.ProcessApi;
+import com.walmartlabs.concord.client.ProcessEntry;
+import com.walmartlabs.concord.sdk.Context;
+import com.walmartlabs.concord.sdk.ContextUtils;
+import com.walmartlabs.concord.sdk.Task;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@Named("client1Test")
+public class Client1TestTask implements Task {
+
+ private static final Logger log = LoggerFactory.getLogger(Client1TestTask.class);
+
+ private final ApiClientFactory factory;
+
+ @Inject
+ public Client1TestTask(ApiClientFactory factory) {
+ this.factory = factory;
+ }
+
+ @Override
+ public void execute(Context ctx) throws Exception {
+ ProcessApi api = new ProcessApi(factory.create(ApiClientConfiguration.builder().context(ctx).build()));
+ ProcessEntry p = api.get(ContextUtils.getTxId(ctx));
+ log.info("process entry: {}", p.getStatus());
+ }
+}
diff --git a/it/tasks/client1-test/src/main/java/com/walmartlabs/concord/it/tasks/suspendtest/Client1TestTaskV2.java b/it/tasks/client1-test/src/main/java/com/walmartlabs/concord/it/tasks/suspendtest/Client1TestTaskV2.java
new file mode 100644
index 0000000000..8545d8b881
--- /dev/null
+++ b/it/tasks/client1-test/src/main/java/com/walmartlabs/concord/it/tasks/suspendtest/Client1TestTaskV2.java
@@ -0,0 +1,62 @@
+package com.walmartlabs.concord.it.tasks.suspendtest;
+
+/*-
+ * *****
+ * Concord
+ * -----
+ * Copyright (C) 2017 - 2023 Walmart Inc.
+ * -----
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License 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.
+ * =====
+ */
+
+import com.walmartlabs.concord.ApiClient;
+import com.walmartlabs.concord.client.ApiClientFactory;
+import com.walmartlabs.concord.client.ProcessApi;
+import com.walmartlabs.concord.client.ProcessEntry;
+import com.walmartlabs.concord.runtime.v2.sdk.Context;
+import com.walmartlabs.concord.runtime.v2.sdk.Task;
+import com.walmartlabs.concord.runtime.v2.sdk.TaskResult;
+import com.walmartlabs.concord.runtime.v2.sdk.Variables;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@Named("client1Test")
+public class Client1TestTaskV2 implements Task {
+
+ private static final Logger log = LoggerFactory.getLogger(Client1TestTaskV2.class);
+
+ private final Context ctx;
+ private final ApiClient apiClient;
+ private final ApiClientFactory factory;
+
+ @Inject
+ public Client1TestTaskV2(Context ctx, ApiClient apiClient, ApiClientFactory factory) {
+ this.ctx = ctx;
+ this.apiClient = apiClient;
+ this.factory = factory;
+ }
+
+ @Override
+ public TaskResult execute(Variables input) throws Exception {
+ ProcessApi api = new ProcessApi(apiClient);
+
+ ProcessEntry p = api.get(ctx.processInstanceId());
+ log.info("process entry: {}", p.getStatus());
+
+ return TaskResult.success();
+ }
+}