aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2017-04-09 15:35:41 -0700
committerGary Wu <gary.i.wu@huawei.com>2017-04-19 01:20:44 +0000
commit7b9de12e2f41a44c1a1f0941163d817a27da53c3 (patch)
treeb9e87d0b7ef197fdab48680c1002f70c5a34de8b
parenta8d6915645c780c9e0eef189fb72d45635b581a0 (diff)
Refactor CommandExecutorInput to be immutable
Change-Id: Iebaf1f35d4229426086c2f2f1a41da2511f8110b Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/CommandExecutorInput.java16
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/openecomp/appc/executor/TestCommandExecutionTask.java4
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/openecomp/appc/executor/TestCommandExecutor.java6
-rw-r--r--appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/openecomp/appc/requesthandler/impl/RequestHandlerImpl.java4
4 files changed, 10 insertions, 20 deletions
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/CommandExecutorInput.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/CommandExecutorInput.java
index 4cb5f1b99..07565a249 100644
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/CommandExecutorInput.java
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/CommandExecutorInput.java
@@ -24,26 +24,22 @@ package org.openecomp.appc.executor.objects;
import org.openecomp.appc.domainmodel.lcm.RuntimeContext;
public class CommandExecutorInput {
- private RuntimeContext runtimeContext ;
- private int ttl;
+ private final RuntimeContext runtimeContext ;
+ private final int ttl;
+ public CommandExecutorInput(RuntimeContext runtimeContext, int ttl) {
+ this.runtimeContext = runtimeContext;
+ this.ttl = ttl;
+ }
public RuntimeContext getRuntimeContext() {
return runtimeContext;
}
- public void setRuntimeContext(RuntimeContext runtimeContext) {
- this.runtimeContext = runtimeContext;
- }
-
public int getTtl() {
return ttl;
}
- public void setTtl(int ttl) {
- this.ttl = ttl;
- }
-
@Override
public String toString() {
return "CommandExecutorInput{" +
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/openecomp/appc/executor/TestCommandExecutionTask.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/openecomp/appc/executor/TestCommandExecutionTask.java
index 0504c3998..c26105b75 100644
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/openecomp/appc/executor/TestCommandExecutionTask.java
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/openecomp/appc/executor/TestCommandExecutionTask.java
@@ -275,10 +275,8 @@ public class TestCommandExecutionTask {
}
private CommandExecutorInput createCommandExecutorInputWithSubObjects() {
- CommandExecutorInput commandExecutorInput = new CommandExecutorInput();
RuntimeContext runtimeContext = createRuntimeContextWithSubObjects();
- commandExecutorInput.setRuntimeContext(runtimeContext);
- return commandExecutorInput;
+ return new CommandExecutorInput(runtimeContext, 0);
}
private RuntimeContext createRuntimeContextWithSubObjects() {
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/openecomp/appc/executor/TestCommandExecutor.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/openecomp/appc/executor/TestCommandExecutor.java
index 473e14e88..7b62bfc2d 100644
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/openecomp/appc/executor/TestCommandExecutor.java
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/openecomp/appc/executor/TestCommandExecutor.java
@@ -135,10 +135,8 @@ public class TestCommandExecutor {
}
private CommandExecutorInput createCommandExecutorInputWithSubObjects() {
- CommandExecutorInput commandExecutorInput = new CommandExecutorInput();
RuntimeContext runtimeContext = new RuntimeContext();
- commandExecutorInput.setRuntimeContext(runtimeContext);
- RequestContext requestContext = new RequestContext();
+ RequestContext requestContext = new RequestContext();
runtimeContext.setRequestContext(requestContext);
CommonHeader commonHeader = new CommonHeader();
requestContext.setCommonHeader(commonHeader);
@@ -148,7 +146,7 @@ public class TestCommandExecutor {
requestContext.setActionIdentifiers(actionIdentifiers);
VNFContext vnfContext = new VNFContext();
runtimeContext.setVnfContext(vnfContext);
- return commandExecutorInput;
+ return new CommandExecutorInput(runtimeContext, 0);
}
diff --git a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/openecomp/appc/requesthandler/impl/RequestHandlerImpl.java b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/openecomp/appc/requesthandler/impl/RequestHandlerImpl.java
index d1303605d..61e96631a 100644
--- a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/openecomp/appc/requesthandler/impl/RequestHandlerImpl.java
+++ b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/openecomp/appc/requesthandler/impl/RequestHandlerImpl.java
@@ -370,9 +370,7 @@ public class RequestHandlerImpl implements RequestHandler {
RuntimeContext clonedContext = cloneContext(runtimeContext);
- CommandExecutorInput commandExecutorInput = new CommandExecutorInput();
- commandExecutorInput.setRuntimeContext(clonedContext);
- commandExecutorInput.setTtl(remainingTTL);
+ CommandExecutorInput commandExecutorInput = new CommandExecutorInput(clonedContext, remainingTTL);
try {
commandExecutor.executeCommand(commandExecutorInput);