From 8b8b54c7ace5d58e4d12b47a7b6fad67c56507a1 Mon Sep 17 00:00:00 2001 From: Gary Wu Date: Fri, 21 Apr 2017 10:22:36 -0700 Subject: Remove CommandRequest and subclasses From the last refactoring, CommandRequest ended up containing only a single CommandExecutorInput value. This change removes CommandRequest and subclasses and replaces their use with CommandExecutorInput directly The type parameter on CommandTask is also removed accordingly. Change-Id: I867df65f344fa58698a44c4b20815dbce382ad55 Signed-off-by: Gary Wu --- .../appc/executor/TestCommandExecutionTask.java | 28 +++++++--------------- 1 file changed, 9 insertions(+), 19 deletions(-) (limited to 'appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test') 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 1e46393d3..ca6694064 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 @@ -35,9 +35,6 @@ import org.openecomp.appc.executor.impl.CommandTask; 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.impl.objects.CommandRequest; -import org.openecomp.appc.executor.impl.objects.LCMCommandRequest; -import org.openecomp.appc.executor.impl.objects.LCMReadOnlyCommandRequest; import org.openecomp.appc.executor.objects.*; import org.openecomp.appc.lifecyclemanager.LifecycleManager; import org.openecomp.appc.requesthandler.RequestHandler; @@ -132,7 +129,7 @@ public class TestCommandExecutionTask { @Test public void testFactory(){ - CommandTask task = factory.getExecutionTask("Configure"); + CommandTask task = factory.getExecutionTask("Configure"); assertEquals(LCMCommandTask.class,task.getClass() ); task = factory.getExecutionTask("Sync"); assertEquals(LCMReadonlyCommandTask.class,task.getClass() ); @@ -144,28 +141,28 @@ public class TestCommandExecutionTask { @Test public void testOnRequestCompletion(){ Mockito.doNothing().when(requestHandler).onRequestTTLEnd((RuntimeContext) anyObject(),anyBoolean()); - LCMCommandRequest request = getLCMCommandRequest("FIREWALL",30,new Date(), "11" ,setTTLInFlags("30"), VNFOperation.Configure, "1", "1.0"); + CommandExecutorInput request = getLCMCommandRequest("FIREWALL",30,new Date(), "11" ,setTTLInFlags("30"), VNFOperation.Configure, "1", "1.0"); CommandResponse response = getCommandResponse(VNFOperation.Configure, true, "11", "","1"); executionTask.onRequestCompletion(request, response); } @Test public void testRunGetConfig(){ - LCMReadOnlyCommandRequest request = getConfigCommandRequest("FIREWALL",30,new Date(), "11" ,setTTLInFlags("30"),VNFOperation.Sync, "1", "1.0"); + CommandExecutorInput request = getConfigCommandRequest("FIREWALL",30,new Date(), "11" ,setTTLInFlags("30"),VNFOperation.Sync, "1", "1.0"); LCMReadonlyCommandTask.setCommandRequest(request); LCMReadonlyCommandTask.run(); } @Test public void testRun(){ - LCMCommandRequest request = getLCMCommandRequest("FIREWALL",30,new Date(), "11" ,setTTLInFlags("30"),VNFOperation.Sync, "1", "1.0"); + CommandExecutorInput request = getLCMCommandRequest("FIREWALL",30,new Date(), "11" ,setTTLInFlags("30"),VNFOperation.Sync, "1", "1.0"); executionTask.setCommandRequest(request); executionTask.run(); } @Test public void testRunNegative(){ - LCMCommandRequest request = getLCMCommandRequest("FIREWALL",30,new Date(), "11" ,setTTLInFlags("30"),VNFOperation.Sync, "1", "1.0"); + CommandExecutorInput request = getLCMCommandRequest("FIREWALL",30,new Date(), "11" ,setTTLInFlags("30"),VNFOperation.Sync, "1", "1.0"); executionTask.setCommandRequest(request); executionTask.run(); } @@ -208,7 +205,6 @@ public class TestCommandExecutionTask { String requestId = "1"; CommandExecutorInput commandExecutorInput = pouplateCommandExecutorInput("FIREWALL",30, "1.0", timeStamp, API_VERSION, requestId, ORIGINATOR_ID, "", VNFOperation.Configure, "33", ""); - CommandRequest request = new CommandRequest(commandExecutorInput); } @@ -221,22 +217,16 @@ public class TestCommandExecutionTask { } - private LCMReadOnlyCommandRequest getConfigCommandRequest(String vnfType , Integer ttl , Date timeStamp, String requestId, + private CommandExecutorInput getConfigCommandRequest(String vnfType , Integer ttl , Date timeStamp, String requestId, Map flags, VNFOperation command , String vnfId, String vnfVersion ){ - CommandExecutorInput commandExecutorInput = pouplateCommandExecutorInput(vnfType, ttl, vnfVersion, timeStamp, API_VERSION, requestId, ORIGINATOR_ID, "", command, vnfId, ""); - LCMReadOnlyCommandRequest request = new LCMReadOnlyCommandRequest(commandExecutorInput); - - return request; + return pouplateCommandExecutorInput(vnfType, ttl, vnfVersion, timeStamp, API_VERSION, requestId, ORIGINATOR_ID, "", command, vnfId, ""); } - private LCMCommandRequest getLCMCommandRequest(String vnfType , Integer ttl ,Date timeStamp, String requestId, + private CommandExecutorInput getLCMCommandRequest(String vnfType , Integer ttl ,Date timeStamp, String requestId, Map flags, VNFOperation command , String vnfId, String vnfVersion ){ - CommandExecutorInput commandExecutorInput = pouplateCommandExecutorInput(vnfType, ttl, vnfVersion, timeStamp, API_VERSION, requestId, ORIGINATOR_ID, "", command, vnfId, ""); - LCMCommandRequest request = new LCMCommandRequest(commandExecutorInput); - - return request; + return pouplateCommandExecutorInput(vnfType, ttl, vnfVersion, timeStamp, API_VERSION, requestId, ORIGINATOR_ID, "", command, vnfId, ""); } public WorkflowResponse getWorkflowResponse (){ -- cgit 1.2.3-korg