From 443143f685a4a45cce32bb468c279d9a700dff6f Mon Sep 17 00:00:00 2001 From: Gary Wu Date: Fri, 7 Apr 2017 21:13:53 -0700 Subject: Parameterize raw generic type CommandTask Change-Id: I935d39537b83d1daaa63cee86d6fb83c49a5011f Signed-off-by: Gary Wu --- .../java/org/openecomp/appc/executor/impl/CommandExecutorImpl.java | 6 +++--- .../java/org/openecomp/appc/executor/impl/CommandTaskFactory.java | 3 ++- .../java/org/openecomp/appc/executor/TestCommandExecutionTask.java | 3 +-- .../test/java/org/openecomp/appc/executor/TestCommandExecutor.java | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'appc-dispatcher') diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandExecutorImpl.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandExecutorImpl.java index 60a951722..e351cfe12 100644 --- a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandExecutorImpl.java +++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandExecutorImpl.java @@ -118,7 +118,7 @@ public class CommandExecutorImpl implements CommandExecutor { logger.trace("Entering to enqueRequest with CommandRequest = "+ ObjectUtils.toString(request)); } try { - CommandTask commandTask = getMessageExecutor(request.getCommandExecutorInput().getRuntimeContext().getRequestContext().getAction().name()); + CommandTask commandTask = getMessageExecutor(request.getCommandExecutorInput().getRuntimeContext().getRequestContext().getAction().name()); commandTask.setCommandRequest(request); long remainingTTL = getRemainingTTL(request); executionQueueService.putMessage(commandTask,remainingTTL, TimeUnit.MILLISECONDS); @@ -138,11 +138,11 @@ public class CommandExecutorImpl implements CommandExecutor { return ttl*1000 + requestTimestamp.getTime() - System.currentTimeMillis(); } - private CommandTask getMessageExecutor(String action){ + private CommandTask getMessageExecutor(String action){ if (logger.isTraceEnabled()) { logger.trace("Entering to getMessageExecutor with command = "+ action); } - CommandTask executionTask = executionTaskFactory.getExecutionTask(action); + CommandTask executionTask = executionTaskFactory.getExecutionTask(action); if (logger.isTraceEnabled()) { logger.trace("Exiting from getMessageExecutor"); } diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandTaskFactory.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandTaskFactory.java index 610f0bca3..d01722062 100644 --- a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandTaskFactory.java +++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandTaskFactory.java @@ -23,6 +23,7 @@ package org.openecomp.appc.executor.impl; import org.openecomp.appc.domainmodel.lcm.VNFOperation; +import org.openecomp.appc.executor.impl.objects.CommandRequest; import org.openecomp.appc.lifecyclemanager.LifecycleManager; import org.openecomp.appc.requesthandler.RequestHandler; import org.openecomp.appc.workflow.WorkFlowManager; @@ -53,7 +54,7 @@ public class CommandTaskFactory { } - public synchronized CommandTask getExecutionTask(String action){ + public synchronized CommandTask getExecutionTask(String action){ if (VNFOperation.Sync.toString().equals(action) || VNFOperation.Audit.toString().equals(action)){ return new LCMReadonlyCommandTask(requestHandler,workflowManager); }else { 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..cd0167934 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 @@ -132,8 +132,7 @@ public class TestCommandExecutionTask { @Test public void testFactory(){ - CommandTask task; - task = factory.getExecutionTask("Configure"); + CommandTask task = factory.getExecutionTask("Configure"); assertEquals(LCMCommandTask.class,task.getClass() ); task = factory.getExecutionTask("Sync"); assertEquals(LCMReadonlyCommandTask.class,task.getClass() ); 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..43e9357b1 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 @@ -78,8 +78,8 @@ public class TestCommandExecutor { commandExecutor.setExecutionQueueService(executionQueueService); LCMCommandTask lcmCommandTask = Mockito.mock(LCMCommandTask.class); LCMReadonlyCommandTask LCMReadonlyCommandTask = Mockito.mock(LCMReadonlyCommandTask.class); - Mockito.when(executionTaskFactory.getExecutionTask("Configure")).thenReturn(lcmCommandTask); - Mockito.when(executionTaskFactory.getExecutionTask("Sync")).thenReturn(LCMReadonlyCommandTask); + Mockito.doReturn(lcmCommandTask).when(executionTaskFactory).getExecutionTask("Configure"); + Mockito.doReturn(LCMReadonlyCommandTask).when(executionTaskFactory).getExecutionTask("Sync"); // Mockito.when(executionQueueService.putMessage((Runnable) Mockito.anyObject(),Mockito.anyLong(),(TimeUnit)Mockito.anyObject())).thenReturn(true); } -- cgit 1.2.3-korg