From cb8cac3cc746e5e4f24b47ec1c02042a7426e4e8 Mon Sep 17 00:00:00 2001
From: Aravindan Ramkumar <1028385+aravindanr@users.noreply.github.com>
Date: Fri, 9 Apr 2021 09:49:48 -0700
Subject: [PATCH] removed Task NAME constants and used constants from TaskType
---
.../common/metadata/tasks/TaskDef.java | 70 ++++++++--------
.../contribs/tasks/http/HttpTask.java | 10 +--
.../tasks/kafka/KafkaPublishTask.java | 29 +++----
.../sqs/DefaultEventQueueProcessorTest.java | 28 +++----
.../queue/DefaultEventQueueProcessor.java | 34 ++++----
.../core/execution/WorkflowExecutor.java | 7 +-
.../execution/mapper/EventTaskMapper.java | 25 +++---
.../execution/mapper/LambdaTaskMapper.java | 25 +++---
.../mapper/SubWorkflowTaskMapper.java | 25 +++---
.../execution/mapper/TerminateTaskMapper.java | 24 +++---
.../core/execution/mapper/WaitTaskMapper.java | 24 +++---
.../core/execution/tasks/Decision.java | 30 ++++---
.../core/execution/tasks/DoWhile.java | 29 ++++---
.../conductor/core/execution/tasks/Event.java | 27 +++---
.../core/execution/tasks/ExclusiveJoin.java | 30 +++----
.../conductor/core/execution/tasks/Fork.java | 31 ++++---
.../conductor/core/execution/tasks/Join.java | 30 ++++---
.../core/execution/tasks/Lambda.java | 28 +++----
.../core/execution/tasks/SetVariable.java | 30 ++++---
.../core/execution/tasks/SubWorkflow.java | 26 +++---
.../core/execution/tasks/Terminate.java | 37 ++++-----
.../conductor/core/execution/tasks/Wait.java | 30 ++++---
.../execution/tasks/WorkflowSystemTask.java | 2 +-
.../conductor/core/utils/ParametersUtils.java | 3 +-
.../WorkflowTaskTypeConstraint.java | 26 +++---
.../core/execution/TestDeciderOutcomes.java | 5 +-
.../core/execution/TestDeciderService.java | 6 +-
.../core/execution/TestWorkflowExecutor.java | 11 ++-
.../execution/TestWorkflowRepairService.java | 12 +--
.../mapper/SubWorkflowTaskMapperTest.java | 26 +++---
.../execution/mapper/WaitTaskMapperTest.java | 24 +++---
.../TestSystemTaskWorkerCoordinator.java | 32 ++++----
...hicalForkJoinSubworkflowRestartSpec.groovy | 28 +++----
...rchicalForkJoinSubworkflowRetrySpec.groovy | 54 ++++++------
.../NestedForkJoinSubWorkflowSpec.groovy | 82 +++++++++----------
35 files changed, 467 insertions(+), 473 deletions(-)
diff --git a/common/src/main/java/com/netflix/conductor/common/metadata/tasks/TaskDef.java b/common/src/main/java/com/netflix/conductor/common/metadata/tasks/TaskDef.java
index 7cf456caf3..29b57e3b3c 100644
--- a/common/src/main/java/com/netflix/conductor/common/metadata/tasks/TaskDef.java
+++ b/common/src/main/java/com/netflix/conductor/common/metadata/tasks/TaskDef.java
@@ -1,14 +1,14 @@
/*
- * Copyright 2020 Netflix, 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.
+ * Copyright 2021 Netflix, 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 com.netflix.conductor.common.metadata.tasks;
@@ -90,24 +90,24 @@ public enum RetryLogic {FIXED, EXPONENTIAL_BACKOFF}
// @ProtoField(id = 13)
// private Integer rateLimitPerSecond;
- @ProtoField(id = 14)
+ @ProtoField(id = 14)
private Integer rateLimitPerFrequency;
- @ProtoField(id = 15)
+ @ProtoField(id = 15)
private Integer rateLimitFrequencyInSeconds;
- @ProtoField(id = 16)
+ @ProtoField(id = 16)
private String isolationGroupId;
- @ProtoField(id = 17)
+ @ProtoField(id = 17)
private String executionNameSpace;
- @ProtoField(id = 18)
+ @ProtoField(id = 18)
@OwnerEmailMandatoryConstraint
@Email(message = "ownerEmail should be valid email address")
private String ownerEmail;
- @ProtoField(id = 19)
+ @ProtoField(id = 19)
@Min(value = 0, message = "TaskDef pollTimeoutSeconds: {value} must be >= 0")
private Integer pollTimeoutSeconds;
@@ -131,7 +131,7 @@ public TaskDef(String name, String description, int retryCount, long timeoutSeco
}
public TaskDef(String name, String description, String ownerEmail, int retryCount,
- long timeoutSeconds, long responseTimeoutSeconds) {
+ long timeoutSeconds, long responseTimeoutSeconds) {
this.name = name;
this.description = description;
this.ownerEmail = ownerEmail;
@@ -411,29 +411,29 @@ public boolean equals(Object o) {
}
TaskDef taskDef = (TaskDef) o;
return getRetryCount() == taskDef.getRetryCount() &&
- getTimeoutSeconds() == taskDef.getTimeoutSeconds() &&
- getRetryDelaySeconds() == taskDef.getRetryDelaySeconds() &&
- getResponseTimeoutSeconds() == taskDef.getResponseTimeoutSeconds() &&
- Objects.equals(getName(), taskDef.getName()) &&
- Objects.equals(getDescription(), taskDef.getDescription()) &&
- Objects.equals(getInputKeys(), taskDef.getInputKeys()) &&
- Objects.equals(getOutputKeys(), taskDef.getOutputKeys()) &&
- getTimeoutPolicy() == taskDef.getTimeoutPolicy() &&
- getRetryLogic() == taskDef.getRetryLogic() &&
- Objects.equals(getConcurrentExecLimit(), taskDef.getConcurrentExecLimit()) &&
- Objects.equals(getRateLimitPerFrequency(), taskDef.getRateLimitPerFrequency()) &&
- Objects.equals(getInputTemplate(), taskDef.getInputTemplate()) &&
- Objects.equals(getIsolationGroupId(), taskDef.getIsolationGroupId()) &&
- Objects.equals(getExecutionNameSpace(), taskDef.getExecutionNameSpace()) &&
- Objects.equals(getOwnerEmail(), taskDef.getOwnerEmail());
+ getTimeoutSeconds() == taskDef.getTimeoutSeconds() &&
+ getRetryDelaySeconds() == taskDef.getRetryDelaySeconds() &&
+ getResponseTimeoutSeconds() == taskDef.getResponseTimeoutSeconds() &&
+ Objects.equals(getName(), taskDef.getName()) &&
+ Objects.equals(getDescription(), taskDef.getDescription()) &&
+ Objects.equals(getInputKeys(), taskDef.getInputKeys()) &&
+ Objects.equals(getOutputKeys(), taskDef.getOutputKeys()) &&
+ getTimeoutPolicy() == taskDef.getTimeoutPolicy() &&
+ getRetryLogic() == taskDef.getRetryLogic() &&
+ Objects.equals(getConcurrentExecLimit(), taskDef.getConcurrentExecLimit()) &&
+ Objects.equals(getRateLimitPerFrequency(), taskDef.getRateLimitPerFrequency()) &&
+ Objects.equals(getInputTemplate(), taskDef.getInputTemplate()) &&
+ Objects.equals(getIsolationGroupId(), taskDef.getIsolationGroupId()) &&
+ Objects.equals(getExecutionNameSpace(), taskDef.getExecutionNameSpace()) &&
+ Objects.equals(getOwnerEmail(), taskDef.getOwnerEmail());
}
@Override
public int hashCode() {
return Objects.hash(getName(), getDescription(), getRetryCount(), getTimeoutSeconds(), getInputKeys(),
- getOutputKeys(), getTimeoutPolicy(), getRetryLogic(), getRetryDelaySeconds(),
- getResponseTimeoutSeconds(), getConcurrentExecLimit(), getRateLimitPerFrequency(), getInputTemplate(),
- getIsolationGroupId(), getExecutionNameSpace(), getOwnerEmail());
+ getOutputKeys(), getTimeoutPolicy(), getRetryLogic(), getRetryDelaySeconds(),
+ getResponseTimeoutSeconds(), getConcurrentExecLimit(), getRateLimitPerFrequency(), getInputTemplate(),
+ getIsolationGroupId(), getExecutionNameSpace(), getOwnerEmail());
}
}
diff --git a/contribs/src/main/java/com/netflix/conductor/contribs/tasks/http/HttpTask.java b/contribs/src/main/java/com/netflix/conductor/contribs/tasks/http/HttpTask.java
index 018162c122..db4c967cd0 100644
--- a/contribs/src/main/java/com/netflix/conductor/contribs/tasks/http/HttpTask.java
+++ b/contribs/src/main/java/com/netflix/conductor/contribs/tasks/http/HttpTask.java
@@ -23,7 +23,6 @@
import com.netflix.conductor.core.utils.Utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
@@ -40,10 +39,12 @@
import java.util.List;
import java.util.Map;
+import static com.netflix.conductor.common.metadata.tasks.TaskType.TASK_TYPE_HTTP;
+
/**
* Task that enables calling another HTTP endpoint as part of its execution
*/
-@Component(HttpTask.NAME)
+@Component(TASK_TYPE_HTTP)
public class HttpTask extends WorkflowSystemTask {
private static final Logger LOGGER = LoggerFactory.getLogger(HttpTask.class);
@@ -53,8 +54,6 @@ public class HttpTask extends WorkflowSystemTask {
static final String MISSING_REQUEST = "Missing HTTP request. Task input MUST have a '" + REQUEST_PARAMETER_NAME
+ "' key with HttpTask.Input as value. See documentation for HttpTask for required input parameters";
- public static final String NAME = "HTTP";
-
private final TypeReference