summaryrefslogtreecommitdiffstats
path: root/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test')
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/openecomp/appc/executor/TestCommandExecutionTask.java38
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/openecomp/appc/executor/TestCommandExecutor.java18
2 files changed, 20 insertions, 36 deletions
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 ca6694064..97d77a9d8 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
@@ -141,28 +141,28 @@ public class TestCommandExecutionTask {
@Test
public void testOnRequestCompletion(){
Mockito.doNothing().when(requestHandler).onRequestTTLEnd((RuntimeContext) anyObject(),anyBoolean());
- CommandExecutorInput request = getLCMCommandRequest("FIREWALL",30,new Date(), "11" ,setTTLInFlags("30"), VNFOperation.Configure, "1", "1.0");
+ RuntimeContext request = pouplateCommandExecutorInput("FIREWALL", 30, "1.0", new Date(), API_VERSION, "11", ORIGINATOR_ID, "", VNFOperation.Configure, "1", "");
CommandResponse response = getCommandResponse(VNFOperation.Configure, true, "11", "","1");
executionTask.onRequestCompletion(request, response);
}
@Test
public void testRunGetConfig(){
- CommandExecutorInput request = getConfigCommandRequest("FIREWALL",30,new Date(), "11" ,setTTLInFlags("30"),VNFOperation.Sync, "1", "1.0");
+ RuntimeContext request = pouplateCommandExecutorInput("FIREWALL", 30, "1.0", new Date(), API_VERSION, "11", ORIGINATOR_ID, "", VNFOperation.Sync, "1", "");
LCMReadonlyCommandTask.setCommandRequest(request);
LCMReadonlyCommandTask.run();
}
@Test
public void testRun(){
- CommandExecutorInput request = getLCMCommandRequest("FIREWALL",30,new Date(), "11" ,setTTLInFlags("30"),VNFOperation.Sync, "1", "1.0");
+ RuntimeContext request = pouplateCommandExecutorInput("FIREWALL", 30, "1.0", new Date(), API_VERSION, "11", ORIGINATOR_ID, "", VNFOperation.Sync, "1", "");
executionTask.setCommandRequest(request);
executionTask.run();
}
@Test
public void testRunNegative(){
- CommandExecutorInput request = getLCMCommandRequest("FIREWALL",30,new Date(), "11" ,setTTLInFlags("30"),VNFOperation.Sync, "1", "1.0");
+ RuntimeContext request = pouplateCommandExecutorInput("FIREWALL", 30, "1.0", new Date(), API_VERSION, "11", ORIGINATOR_ID, "", VNFOperation.Sync, "1", "");
executionTask.setCommandRequest(request);
executionTask.run();
}
@@ -204,7 +204,7 @@ public class TestCommandExecutionTask {
Date timeStamp = new Date();
String requestId = "1";
- CommandExecutorInput commandExecutorInput = pouplateCommandExecutorInput("FIREWALL",30, "1.0", timeStamp, API_VERSION, requestId, ORIGINATOR_ID, "", VNFOperation.Configure, "33", "");
+ RuntimeContext commandExecutorInput = pouplateCommandExecutorInput("FIREWALL",30, "1.0", timeStamp, API_VERSION, requestId, ORIGINATOR_ID, "", VNFOperation.Configure, "33", "");
}
@@ -217,18 +217,6 @@ public class TestCommandExecutionTask {
}
- private CommandExecutorInput getConfigCommandRequest(String vnfType , Integer ttl , Date timeStamp, String requestId,
- Map<String,Object> flags, VNFOperation command , String vnfId, String vnfVersion ){
-
- return pouplateCommandExecutorInput(vnfType, ttl, vnfVersion, timeStamp, API_VERSION, requestId, ORIGINATOR_ID, "", command, vnfId, "");
- }
-
- private CommandExecutorInput getLCMCommandRequest(String vnfType , Integer ttl ,Date timeStamp, String requestId,
- Map<String,Object> flags, VNFOperation command , String vnfId, String vnfVersion ){
-
- return pouplateCommandExecutorInput(vnfType, ttl, vnfVersion, timeStamp, API_VERSION, requestId, ORIGINATOR_ID, "", command, vnfId, "");
- }
-
public WorkflowResponse getWorkflowResponse (){
WorkflowResponse wfResponse = new WorkflowResponse();
ResponseContext responseContext = createResponseContextWithSuObjects();
@@ -238,12 +226,11 @@ public class TestCommandExecutionTask {
return wfResponse;
}
- private CommandExecutorInput pouplateCommandExecutorInput(String vnfType, int ttl, String vnfVersion, Date timeStamp, String apiVersion, String requestId, String originatorID, String subRequestID, VNFOperation action, String vnfId , String payload){
- CommandExecutorInput commandExecutorInput = createCommandExecutorInputWithSubObjects();
- RuntimeContext runtimeContext = commandExecutorInput.getRuntimeContext();
- RequestContext requestContext = runtimeContext.getRequestContext();
+ private RuntimeContext pouplateCommandExecutorInput(String vnfType, int ttl, String vnfVersion, Date timeStamp, String apiVersion, String requestId, String originatorID, String subRequestID, VNFOperation action, String vnfId , String payload){
+ RuntimeContext commandExecutorInput = createCommandExecutorInputWithSubObjects();
+ RequestContext requestContext = commandExecutorInput.getRequestContext();
ResponseContext responseContext = createResponseContextWithSuObjects();
- runtimeContext.setResponseContext(responseContext);
+ commandExecutorInput.setResponseContext(responseContext);
requestContext.getCommonHeader().getFlags().setTtl(ttl);
requestContext.getCommonHeader().setApiVer(apiVersion);
@@ -254,16 +241,15 @@ public class TestCommandExecutionTask {
requestContext.setAction(action);
requestContext.setPayload(payload);
requestContext.getActionIdentifiers().setVnfId(vnfId);
- VNFContext vnfContext = runtimeContext.getVnfContext();
+ VNFContext vnfContext = commandExecutorInput.getVnfContext();
vnfContext.setType(vnfType);
vnfContext.setId(vnfId);
vnfContext.setVersion(vnfVersion);
return commandExecutorInput;
}
- private CommandExecutorInput createCommandExecutorInputWithSubObjects() {
- RuntimeContext runtimeContext = createRuntimeContextWithSubObjects();
- return new CommandExecutorInput(runtimeContext, 0);
+ private RuntimeContext createCommandExecutorInputWithSubObjects() {
+ return createRuntimeContextWithSubObjects();
}
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 ae8755226..ba4221509 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
@@ -36,7 +36,6 @@ import org.openecomp.appc.executor.impl.CommandExecutorImpl;
import org.openecomp.appc.executor.impl.CommandTaskFactory;
import org.openecomp.appc.executor.impl.LCMCommandTask;
import org.openecomp.appc.executor.impl.LCMReadonlyCommandTask;
-import org.openecomp.appc.executor.objects.CommandExecutorInput;
import org.openecomp.appc.lifecyclemanager.LifecycleManager;
import org.openecomp.appc.requesthandler.RequestHandler;
import org.openecomp.appc.workflow.WorkFlowManager;
@@ -90,7 +89,7 @@ public class TestCommandExecutor {
//Map <String,Object> flags = setTTLInFlags("30");
Date timeStamp = new Date();
String requestId = "1";
- CommandExecutorInput commandExecutorInput = pouplateCommandExecutorInput("FIREWALL", 30, "1.0", timeStamp, API_VERSION, requestId, ORIGINATOR_ID, "2", VNFOperation.Configure, "15", "") ;
+ RuntimeContext commandExecutorInput = pouplateCommandExecutorInput("FIREWALL", 30, "1.0", timeStamp, API_VERSION, requestId, ORIGINATOR_ID, "2", VNFOperation.Configure, "15", "") ;
try {
commandExecutor.executeCommand(commandExecutorInput);
} catch (APPCException e) {
@@ -104,7 +103,7 @@ public class TestCommandExecutor {
Date timeStamp = new Date();
String requestId = "1";
- CommandExecutorInput commandExecutorInput = pouplateCommandExecutorInput("FIREWALL", 30, "1.0", timeStamp, API_VERSION, requestId, ORIGINATOR_ID, "2", VNFOperation.Sync,"15","") ;
+ RuntimeContext commandExecutorInput = pouplateCommandExecutorInput("FIREWALL", 30, "1.0", timeStamp, API_VERSION, requestId, ORIGINATOR_ID, "2", VNFOperation.Sync,"15","") ;
try {
commandExecutor.executeCommand(commandExecutorInput);
} catch (APPCException e) {
@@ -114,10 +113,9 @@ public class TestCommandExecutor {
}
- private CommandExecutorInput pouplateCommandExecutorInput(String vnfType, int ttl, String vnfVersion, Date timeStamp, String apiVersion, String requestId, String originatorID, String subRequestID, VNFOperation action, String vnfId , String payload){
- CommandExecutorInput commandExecutorInput = createCommandExecutorInputWithSubObjects();
- RuntimeContext runtimeContext = commandExecutorInput.getRuntimeContext();
- RequestContext requestContext = runtimeContext.getRequestContext();
+ private RuntimeContext pouplateCommandExecutorInput(String vnfType, int ttl, String vnfVersion, Date timeStamp, String apiVersion, String requestId, String originatorID, String subRequestID, VNFOperation action, String vnfId , String payload){
+ RuntimeContext commandExecutorInput = createCommandExecutorInputWithSubObjects();
+ RequestContext requestContext = commandExecutorInput.getRequestContext();
requestContext.getCommonHeader().getFlags().setTtl(ttl);
requestContext.getCommonHeader().setApiVer(apiVersion);
requestContext.getCommonHeader().setTimestamp(timeStamp);
@@ -127,14 +125,14 @@ public class TestCommandExecutor {
requestContext.setAction(action);
requestContext.setPayload(payload);
requestContext.getActionIdentifiers().setVnfId(vnfId);
- VNFContext vnfContext = runtimeContext.getVnfContext();
+ VNFContext vnfContext = commandExecutorInput.getVnfContext();
vnfContext.setType(vnfType);
vnfContext.setId(vnfId);
vnfContext.setVersion(vnfVersion);
return commandExecutorInput;
}
- private CommandExecutorInput createCommandExecutorInputWithSubObjects() {
+ private RuntimeContext createCommandExecutorInputWithSubObjects() {
RuntimeContext runtimeContext = new RuntimeContext();
RequestContext requestContext = new RequestContext();
runtimeContext.setRequestContext(requestContext);
@@ -146,7 +144,7 @@ public class TestCommandExecutor {
requestContext.setActionIdentifiers(actionIdentifiers);
VNFContext vnfContext = new VNFContext();
runtimeContext.setVnfContext(vnfContext);
- return new CommandExecutorInput(runtimeContext, 0);
+ return runtimeContext;
}