diff --git a/build.gradle b/build.gradle index ea126437..3d3bfda5 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,6 @@ plugins { id 'application' id 'maven-publish' id 'signing' - id 'groovy' id 'java-library' id "com.diffplug.spotless" version "5.0.0" id 'jacoco' @@ -23,52 +22,47 @@ plugins { ext { versions = [ - awaitility : '4.2.0', - commonsLang: '3.12.0', - conductor : '3.8.1', - eureka : '1.10.17', - groovy : '3.0.12', - jackson : '2.11.4!!', - jersey : '1.19.4', - junit : '5.9.0', - slf4j : '1.7.36', - spectator : '1.3.7', - spock : '2.2-groovy-2.5', - wiremock : '2.33.2', - awsSsm : '1.12.300', - azureSsm : '4.2.3', - azureIdentity: '1.3.7', + awaitility : '4.2.0', + commonsLang : '3.12.0', + conductor : '3.9.0-orkes-g', + jackson : '2.11.4!!', + jersey : '1.19.4', + junit : '5.9.0', + slf4j : '1.7.36', + spectator : '1.3.7', + awsSsm : '1.12.300', + azureSsm : '4.2.3', + azureIdentity : '1.3.7', + eureka : '1.10.17', + wiremock : '2.33.2', ] } group = 'io.orkes.conductor' dependencies { - implementation "com.netflix.conductor:conductor-common:${versions.conductor}" - implementation("com.netflix.conductor:conductor-client:${versions.conductor}") { - exclude group: "com.netflix.eureka", module: "eureka-client" - } - - api "com.sun.jersey:jersey-client:${versions.jersey}" - + api ("io.orkes.conductor:conductor-client:${versions.conductor}") + api ("io.orkes.conductor:conductor-common:${versions.conductor}") + implementation "com.sun.jersey:jersey-client:${versions.jersey}" + implementation "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:${versions.jackson}" implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${versions.jackson}" - + implementation "org.slf4j:slf4j-api:${versions.slf4j}" - + implementation "com.netflix.spectator:spectator-api:${versions.spectator}" implementation("com.netflix.eureka:eureka-client:${versions.eureka}") { exclude group: "javax.servlet", module: "servlet-api" } - + implementation 'com.squareup.okhttp:okhttp:2.7.5' implementation 'com.squareup.okhttp:logging-interceptor:2.7.5' - + implementation 'com.google.code.gson:gson:2.9.0' implementation 'io.gsonfire:gson-fire:1.8.5' - + implementation 'io.swagger.core.v3:swagger-annotations:2.2.2' - + implementation "org.apache.commons:commons-lang3:${versions.commonsLang}" implementation 'org.threeten:threetenbp:1.6.1' @@ -81,13 +75,6 @@ dependencies { // test dependencies testImplementation "org.junit.jupiter:junit-jupiter-api:${versions.junit}" testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${versions.junit}" - testImplementation "org.codehaus.groovy:groovy:${versions.groovy}" - testImplementation "org.codehaus.groovy:groovy-json:${versions.groovy}" - testImplementation "org.spockframework:spock-core:${versions.spock}" - testImplementation "org.awaitility:awaitility-groovy:${versions.awaitility}" - testImplementation("com.github.tomakehurst:wiremock-jre8:${versions.wiremock}") { - exclude group: 'com.fasterxml.jackson' - } testImplementation 'org.mockito:mockito-all:1.10.19' testImplementation 'org.testcontainers:localstack:1.17.1' testImplementation 'org.testcontainers:testcontainers:1.17.1' @@ -96,12 +83,6 @@ dependencies { repositories { mavenCentral() - mavenLocal() { - content { - includeGroup "com.netflix.conductor" - includeGroup "io.orkes.conductor" - } - } } java { @@ -173,6 +154,11 @@ compileJava { targetCompatibility = 11 } +configurations.implementation { + exclude(group : "com.netflix.conductor") +} + + spotless { java { googleJavaFormat().aosp() @@ -185,12 +171,17 @@ build.dependsOn(spotlessApply) signing { def signingKeyId = findProperty('signingKeyId') - def signingKey = findProperty('signingKey') - def signingPassword = findProperty('signingPassword') - if (signingKeyId && signingKey && signingPassword) { - useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) - } + if(signingKeyId) { + println 'Signing the artifact with keys' + signing { + def signingKey = findProperty('signingKey') + def signingPassword = findProperty('signingPassword') + if (signingKeyId && signingKey && signingPassword) { + useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) + } - sign publishing.publications + sign publishing.publications + } + } } sourceSets.main.java.srcDirs += ['example/java', 'example/resources'] diff --git a/deploy.gradle b/deploy.gradle deleted file mode 100644 index 9c9739a1..00000000 --- a/deploy.gradle +++ /dev/null @@ -1,76 +0,0 @@ -allprojects { - - apply plugin: 'maven-publish' - apply plugin: 'java-library' - apply plugin: 'signing' - - group = 'io.orkes.conductor' - def conductorVersion = System.getenv('CONDUCTOR_VERSION') - if (conductorVersion) { - println "Inferred version from env variable 'CONDUCTOR_VERSION': $conductorVersion" - version = conductorVersion - } - - publishing { - publications { - mavenJava(MavenPublication) { - from components.java - pom { - name = 'Orkes Conductor Client' - description = 'Netflix Conductor OSS client wrapper that provides support for Orkes Conductor features' - url = 'https://github.com/orkes-io/conductor' - scm { - connection = 'scm:git:git://github.com/orkes-io/conductor.git' - developerConnection = 'scm:git:ssh://github.com:orkes-io/conductor.git' - url = 'https://github.com/orkes-io/conductor' - } - licenses { - license { - name = 'The Apache License, Version 2.0' - url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' - } - } - developers { - developer { - organization = 'Orkes' - organizationUrl = 'https://orkes.io' - name = 'Orkes Development Team' - email = 'developers@orkes.io' - } - } - } - } - } - - repositories { - maven { - if (project.hasProperty("mavenCentral")) { - println "Publishing to Sonatype Repository" - url = "https://s01.oss.sonatype.org/${project.version.endsWith('-SNAPSHOT') ? "content/repositories/snapshots/" : "service/local/staging/deploy/maven2/"}" - credentials { - username project.properties.username - password project.properties.password - } - } else { - url = "s3://orkes-artifacts-repo/${project.version.endsWith('-SNAPSHOT') ? "snapshots" : "releases"}" - authentication { - awsIm(AwsImAuthentication) - } - } - } - } - } - - signing { - def signingKeyId = findProperty('signingKeyId') - def signingKey = findProperty('signingKey') - def signingPassword = findProperty('signingPassword') - System.out.println("signingKeyId: " + signingKeyId) - if (signingKeyId && signingKey && signingPassword) { - useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) - } - - sign publishing.publications - } - -} diff --git a/src/main/java/io/orkes/conductor/client/OrkesClients.java b/src/main/java/io/orkes/conductor/client/OrkesClients.java index 31477b57..fc9b840e 100644 --- a/src/main/java/io/orkes/conductor/client/OrkesClients.java +++ b/src/main/java/io/orkes/conductor/client/OrkesClients.java @@ -12,10 +12,7 @@ */ package io.orkes.conductor.client; -import com.netflix.conductor.client.config.DefaultConductorClientConfiguration; - import io.orkes.conductor.client.http.*; -import io.orkes.conductor.client.http.auth.AuthorizationClientFilter; import com.sun.jersey.api.client.config.ClientConfig; import com.sun.jersey.api.client.config.DefaultClientConfig; @@ -56,57 +53,6 @@ public TaskClient getTaskClient() { return new OrkesTaskClient(apiClient); } - public com.netflix.conductor.client.http.WorkflowClient getWorkflowClientLegacy() { - return getWorkflowClientLegacy(10); - } - - public com.netflix.conductor.client.http.WorkflowClient getWorkflowClientLegacy( - int threadPoolSize) { - AuthorizationClientFilter authorizationClientFilter = - new AuthorizationClientFilter(apiClient); - com.netflix.conductor.client.http.WorkflowClient workflowClient = - new com.netflix.conductor.client.http.WorkflowClient( - conductorClientConfig( - apiClient.getReadTimeout(), - apiClient.getConnectTimeout(), - threadPoolSize), - new DefaultConductorClientConfiguration(), - null, - authorizationClientFilter); - String basePath = apiClient.getBasePath(); - if (!basePath.endsWith("/")) { - basePath = basePath + "/"; - } - workflowClient.setRootURI(basePath); - - return workflowClient; - } - - public com.netflix.conductor.client.http.TaskClient getTaskClientLegacy() { - return getTaskClientLegacy(10); - } - - public com.netflix.conductor.client.http.TaskClient getTaskClientLegacy(int threadPoolSize) { - AuthorizationClientFilter authorizationClientFilter = - new AuthorizationClientFilter(apiClient); - com.netflix.conductor.client.http.TaskClient taskClient = - new com.netflix.conductor.client.http.TaskClient( - conductorClientConfig( - apiClient.getReadTimeout(), - apiClient.getConnectTimeout(), - threadPoolSize), - new DefaultConductorClientConfiguration(), - null, - authorizationClientFilter); - String basePath = apiClient.getBasePath(); - if (!basePath.endsWith("/")) { - basePath = basePath + "/"; - } - taskClient.setRootURI(basePath); - - return taskClient; - } - private ClientConfig conductorClientConfig( int readTimeout, int connectionTimeout, int threadPoolSize) { var clientConfig = new DefaultClientConfig(); diff --git a/src/main/java/io/orkes/conductor/client/automator/TaskRunner.java b/src/main/java/io/orkes/conductor/client/automator/TaskRunner.java index b8c6fb23..4eb0816f 100644 --- a/src/main/java/io/orkes/conductor/client/automator/TaskRunner.java +++ b/src/main/java/io/orkes/conductor/client/automator/TaskRunner.java @@ -41,7 +41,6 @@ import io.orkes.conductor.client.http.ApiException; import com.google.common.base.Stopwatch; -import com.sun.jersey.api.client.config.DefaultClientConfig; class TaskRunner { private static final Logger LOGGER = LoggerFactory.getLogger(TaskRunner.class); @@ -59,9 +58,6 @@ class TaskRunner { private static final String OVERRIDE_DISCOVERY = "pollOutOfDiscovery"; private static final String ALL_WORKERS = "all"; - // used or managing external payload - private com.netflix.conductor.client.http.TaskClient taskClientForExternalPayload; - TaskRunner( EurekaClient eurekaClient, TaskClient taskClient, @@ -77,9 +73,6 @@ class TaskRunner { this.taskToDomain = taskToDomain; this.threadCount = threadCount; this.taskPollTimeout = taskPollTimeout; - this.taskClientForExternalPayload = - new com.netflix.conductor.client.http.TaskClient( - new DefaultClientConfig(), conductorClientConfiguration, null); this.executorService = (ThreadPoolExecutor) Executors.newFixedThreadPool( @@ -296,15 +289,8 @@ private void updateTaskResult(int count, Task task, TaskResult result, Worker wo } private Optional upload(TaskResult result, String taskType) { - try { - return taskClientForExternalPayload.evaluateAndUploadLargePayload( - result.getOutputData(), taskType); - } catch (IllegalArgumentException iae) { - result.setReasonForIncompletion(iae.getMessage()); - result.setOutputData(null); - result.setStatus(TaskResult.Status.FAILED_WITH_TERMINAL_ERROR); - return Optional.empty(); - } + // do nothing + return Optional.empty(); } private R retryOperation(Function operation, int count, T input, String opName) { diff --git a/src/main/java/io/orkes/conductor/client/http/JSON.java b/src/main/java/io/orkes/conductor/client/http/JSON.java index 50fae450..547bb7f3 100644 --- a/src/main/java/io/orkes/conductor/client/http/JSON.java +++ b/src/main/java/io/orkes/conductor/client/http/JSON.java @@ -25,11 +25,7 @@ import org.threeten.bp.OffsetDateTime; import org.threeten.bp.format.DateTimeFormatter; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonElement; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapter; +import com.google.gson.*; import com.google.gson.internal.bind.util.ISO8601Utils; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; diff --git a/src/main/java/io/orkes/conductor/client/http/OrkesSecretClient.java b/src/main/java/io/orkes/conductor/client/http/OrkesSecretClient.java index 0478dcc7..9b5fc4b3 100644 --- a/src/main/java/io/orkes/conductor/client/http/OrkesSecretClient.java +++ b/src/main/java/io/orkes/conductor/client/http/OrkesSecretClient.java @@ -17,7 +17,7 @@ import io.orkes.conductor.client.ApiClient; import io.orkes.conductor.client.SecretClient; -import io.orkes.conductor.client.http.api.*; +import io.orkes.conductor.client.http.api.SecretResourceApi; public class OrkesSecretClient extends OrkesClient implements SecretClient { diff --git a/src/main/java/io/orkes/conductor/client/http/ProgressRequestBody.java b/src/main/java/io/orkes/conductor/client/http/ProgressRequestBody.java index 0ffd5893..a91bb837 100644 --- a/src/main/java/io/orkes/conductor/client/http/ProgressRequestBody.java +++ b/src/main/java/io/orkes/conductor/client/http/ProgressRequestBody.java @@ -16,11 +16,7 @@ import com.squareup.okhttp.MediaType; import com.squareup.okhttp.RequestBody; -import okio.Buffer; -import okio.BufferedSink; -import okio.ForwardingSink; -import okio.Okio; -import okio.Sink; +import okio.*; public class ProgressRequestBody extends RequestBody { diff --git a/src/main/java/io/orkes/conductor/client/http/ProgressResponseBody.java b/src/main/java/io/orkes/conductor/client/http/ProgressResponseBody.java index a2f98872..d7e4a3f7 100644 --- a/src/main/java/io/orkes/conductor/client/http/ProgressResponseBody.java +++ b/src/main/java/io/orkes/conductor/client/http/ProgressResponseBody.java @@ -16,11 +16,7 @@ import com.squareup.okhttp.MediaType; import com.squareup.okhttp.ResponseBody; -import okio.Buffer; -import okio.BufferedSource; -import okio.ForwardingSource; -import okio.Okio; -import okio.Source; +import okio.*; public class ProgressResponseBody extends ResponseBody { diff --git a/src/main/java/io/orkes/conductor/client/http/api/AuthorizationResourceApi.java b/src/main/java/io/orkes/conductor/client/http/api/AuthorizationResourceApi.java index 8d6b40ee..d666d4ac 100644 --- a/src/main/java/io/orkes/conductor/client/http/api/AuthorizationResourceApi.java +++ b/src/main/java/io/orkes/conductor/client/http/api/AuthorizationResourceApi.java @@ -21,7 +21,6 @@ import io.orkes.conductor.client.ApiClient; import io.orkes.conductor.client.http.*; -import io.orkes.conductor.client.http.Configuration; import io.orkes.conductor.client.model.AuthorizationRequest; import io.orkes.conductor.client.model.Subject; diff --git a/src/test/java/io/orkes/conductor/client/Examples.java b/src/test/java/io/orkes/conductor/client/Examples.java index 61dbf257..45237c98 100644 --- a/src/test/java/io/orkes/conductor/client/Examples.java +++ b/src/test/java/io/orkes/conductor/client/Examples.java @@ -12,11 +12,7 @@ */ package io.orkes.conductor.client; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; diff --git a/src/test/java/io/orkes/conductor/client/MetadataFromFiles.java b/src/test/java/io/orkes/conductor/client/MetadataFromFiles.java index c59cb3ae..df7a6e32 100644 --- a/src/test/java/io/orkes/conductor/client/MetadataFromFiles.java +++ b/src/test/java/io/orkes/conductor/client/MetadataFromFiles.java @@ -14,10 +14,8 @@ import java.io.IOException; import java.io.InputStream; -import java.nio.charset.StandardCharsets; import java.util.List; -import org.apache.commons.io.IOUtils; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @@ -37,28 +35,11 @@ public MetadataFromFiles() { metadataClient = orkesClients.getMetadataClient(); } - // @Test - // @DisplayName("load workflow from file and store definition in conductor") - // public void loadAndStoreWorkflowDefinition() throws IOException { - // InputStream inputStream = - // MetadataFromFiles.class.getResourceAsStream("/sample_workflow.json"); - // String result = IOUtils.toString(inputStream, StandardCharsets.UTF_8); - // WorkflowDef workflowDef = objectMapper.readValue(result, WorkflowDef.class); - // // Unregister workflow in case it exist - // metadataClient.unregisterWorkflowDef(workflowDef.getName(), workflowDef.getVersion()); - // metadataClient.registerWorkflowDef(workflowDef); - // Assertions.assertEquals( - // metadataClient.getWorkflowDef(workflowDef.getName(), - // workflowDef.getVersion()), - // workflowDef); - // } - @Test @DisplayName("load tasks from file and store definition in conductor") public void loadAndStoreTaskDefinitions() throws IOException { InputStream inputStream = MetadataFromFiles.class.getResourceAsStream("/sample_tasks.json"); - String result = IOUtils.toString(inputStream, StandardCharsets.UTF_8); - List taskDefs = objectMapper.readValue(result, List.class); + List taskDefs = objectMapper.readValue(inputStream, List.class); metadataClient.registerTaskDefs(taskDefs); } } diff --git a/src/test/java/io/orkes/conductor/client/api/AuthorizationClientTests.java b/src/test/java/io/orkes/conductor/client/api/AuthorizationClientTests.java index ba632fd5..ccf5d3e9 100644 --- a/src/test/java/io/orkes/conductor/client/api/AuthorizationClientTests.java +++ b/src/test/java/io/orkes/conductor/client/api/AuthorizationClientTests.java @@ -24,10 +24,7 @@ import io.orkes.conductor.client.model.UpsertGroupRequest.RolesEnum; import io.orkes.conductor.client.util.Commons; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.*; public class AuthorizationClientTests extends ClientTest { private final AuthorizationClient authorizationClient; diff --git a/src/test/java/io/orkes/conductor/client/api/LegacyClientTests.java b/src/test/java/io/orkes/conductor/client/api/LegacyClientTests.java deleted file mode 100644 index 3e389171..00000000 --- a/src/test/java/io/orkes/conductor/client/api/LegacyClientTests.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2022 Orkes, 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. - */ -package io.orkes.conductor.client.api; - -import java.util.HashMap; -import java.util.Map; - -import org.junit.jupiter.api.Test; - -import com.netflix.conductor.client.http.WorkflowClient; -import com.netflix.conductor.common.metadata.workflow.StartWorkflowRequest; -import com.netflix.conductor.common.run.Workflow; - -import io.orkes.conductor.client.util.Commons; - -import static org.junit.jupiter.api.Assertions.assertNotNull; - -public class LegacyClientTests extends ClientTest { - - private final WorkflowClient workflowClient; - - public LegacyClientTests() { - this.workflowClient = super.orkesClients.getWorkflowClientLegacy(); - } - - @Test - public void startWorkflow() { - StartWorkflowRequest startWorkflowRequest = new StartWorkflowRequest(); - startWorkflowRequest.setName(Commons.WORKFLOW_NAME); - startWorkflowRequest.setVersion(Commons.WORKFLOW_VERSION); - Map input = new HashMap<>(); - startWorkflowRequest.setInput(input); - String workflowId = workflowClient.startWorkflow(startWorkflowRequest); - Workflow workflow = workflowClient.getWorkflow(workflowId, false); - assertNotNull(workflow, "Workflow should'n be null"); - } -} diff --git a/src/test/java/io/orkes/conductor/client/api/MetadataClientTests.java b/src/test/java/io/orkes/conductor/client/api/MetadataClientTests.java index a648fbe3..f9fe6fee 100644 --- a/src/test/java/io/orkes/conductor/client/api/MetadataClientTests.java +++ b/src/test/java/io/orkes/conductor/client/api/MetadataClientTests.java @@ -26,9 +26,7 @@ import io.orkes.conductor.client.util.Commons; import io.orkes.conductor.client.util.WorkflowUtil; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertIterableEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.*; public class MetadataClientTests extends ClientTest { private final MetadataClient metadataClient; diff --git a/src/test/java/io/orkes/conductor/client/api/SchedulerClientTests.java b/src/test/java/io/orkes/conductor/client/api/SchedulerClientTests.java index 60dbdd7f..0c638de8 100644 --- a/src/test/java/io/orkes/conductor/client/api/SchedulerClientTests.java +++ b/src/test/java/io/orkes/conductor/client/api/SchedulerClientTests.java @@ -19,9 +19,7 @@ import io.orkes.conductor.client.model.WorkflowSchedule; import io.orkes.conductor.client.util.Commons; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.*; public class SchedulerClientTests extends ClientTest { private final String NAME = "test_sdk_java_scheduler_name"; diff --git a/src/test/java/io/orkes/conductor/client/api/TaskClientTests.java b/src/test/java/io/orkes/conductor/client/api/TaskClientTests.java index 66b4d6c4..1d83748d 100644 --- a/src/test/java/io/orkes/conductor/client/api/TaskClientTests.java +++ b/src/test/java/io/orkes/conductor/client/api/TaskClientTests.java @@ -20,9 +20,7 @@ import io.orkes.conductor.client.TaskClient; import io.orkes.conductor.client.util.Commons; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.*; public class TaskClientTests extends ClientTest { private final TaskClient taskClient; diff --git a/src/test/java/io/orkes/conductor/client/worker/LocalServerWorkflowExecutionTests.java b/src/test/java/io/orkes/conductor/client/worker/LocalServerWorkflowExecutionTests.java index 6eefc2b2..1ff2a342 100644 --- a/src/test/java/io/orkes/conductor/client/worker/LocalServerWorkflowExecutionTests.java +++ b/src/test/java/io/orkes/conductor/client/worker/LocalServerWorkflowExecutionTests.java @@ -12,7 +12,10 @@ */ package io.orkes.conductor.client.worker; -import java.util.*; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; import com.netflix.conductor.client.worker.Worker; import com.netflix.conductor.common.metadata.tasks.Task;