diff options
Diffstat (limited to 'appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/openecomp/appc/executor/TestCommandExecutor.java')
-rw-r--r-- | appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/openecomp/appc/executor/TestCommandExecutor.java | 24 |
1 files changed, 11 insertions, 13 deletions
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..bb4e39109 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 @@ -30,13 +30,13 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; import org.openecomp.appc.domainmodel.lcm.*; +import org.openecomp.appc.domainmodel.lcm.Flags.Mode; import org.openecomp.appc.exceptions.APPCException; import org.openecomp.appc.executionqueue.ExecutionQueueService; 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 +90,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 +104,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,11 +114,10 @@ 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(); - requestContext.getCommonHeader().getFlags().setTtl(ttl); + 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().setFlags(new Flags(null, false, ttl)); requestContext.getCommonHeader().setApiVer(apiVersion); requestContext.getCommonHeader().setTimestamp(timeStamp); requestContext.getCommonHeader().setRequestId(requestId); @@ -127,26 +126,25 @@ 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); CommonHeader commonHeader = new CommonHeader(); requestContext.setCommonHeader(commonHeader); - Flags flags = new Flags(); - commonHeader.setFlags(flags); + commonHeader.setFlags(new Flags(null, false, 0)); ActionIdentifiers actionIdentifiers = new ActionIdentifiers(); requestContext.setActionIdentifiers(actionIdentifiers); VNFContext vnfContext = new VNFContext(); runtimeContext.setVnfContext(vnfContext); - return new CommandExecutorInput(runtimeContext, 0); + return runtimeContext; } |