aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--appc-dg-util/appc-dg-util-bundle/src/main/java/org/openecomp/appc/dg/util/impl/InputParameterValidationImpl.java2
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/LCMCommandStatus.java5
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandExecutorImpl.java6
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandTask.java4
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandTaskFactory.java3
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/LCMCommandTask.java9
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/LCMReadonlyCommandTask.java6
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/openecomp/appc/executor/TestCommandExecutionTask.java12
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/openecomp/appc/executor/TestCommandExecutor.java4
-rw-r--r--appc-dispatcher/appc-dispatcher-common/domain-model-lib/src/main/java/org/openecomp/appc/domainmodel/lcm/Status.java17
-rw-r--r--appc-dispatcher/appc-dispatcher-common/execution-queue-management-lib/src/main/java/org/openecomp/appc/executionqueue/impl/ExecutionQueueServiceImpl.java5
-rw-r--r--appc-dispatcher/appc-dispatcher-common/execution-queue-management-lib/src/main/java/org/openecomp/appc/executionqueue/impl/QueueManager.java10
-rw-r--r--appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/openecomp/appc/requesthandler/impl/RequestHandlerImpl.java14
-rw-r--r--appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/openecomp/appc/requesthandler/TestConverter.java6
-rw-r--r--appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/openecomp/appc/requesthandler/TestRequestHandler.java9
-rw-r--r--appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/openecomp/appc/requesthandler/TestRequestValidator.java3
-rw-r--r--appc-dispatcher/appc-workflow-management/appc-workflow-management-core/src/main/java/org/openecomp/appc/workflow/impl/WorkFlowManagerImpl.java5
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProviderLcm.java8
18 files changed, 51 insertions, 77 deletions
diff --git a/appc-dg-util/appc-dg-util-bundle/src/main/java/org/openecomp/appc/dg/util/impl/InputParameterValidationImpl.java b/appc-dg-util/appc-dg-util-bundle/src/main/java/org/openecomp/appc/dg/util/impl/InputParameterValidationImpl.java
index aec1ac220..c59e22b51 100644
--- a/appc-dg-util/appc-dg-util-bundle/src/main/java/org/openecomp/appc/dg/util/impl/InputParameterValidationImpl.java
+++ b/appc-dg-util/appc-dg-util-bundle/src/main/java/org/openecomp/appc/dg/util/impl/InputParameterValidationImpl.java
@@ -113,7 +113,7 @@ public class InputParameterValidationImpl implements InputParameterValidation
}
- private Map getValueFromContext(SvcLogicContext context) {
+ private Map<String, String> getValueFromContext(SvcLogicContext context) {
Set<String> keys = context.getAttributeKeySet();
Map<String, String> params = new HashMap<String, String>();
StringBuilder builder = new StringBuilder();
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/LCMCommandStatus.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/LCMCommandStatus.java
index 4e3a40e75..14bd8152c 100644
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/LCMCommandStatus.java
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/LCMCommandStatus.java
@@ -23,6 +23,7 @@ package org.openecomp.appc.executor.objects;
import org.apache.commons.lang3.StringUtils;
+import org.openecomp.appc.domainmodel.lcm.Status;
import org.openecomp.appc.util.MessageFormatter;
import java.util.Map;
@@ -108,5 +109,9 @@ public enum LCMCommandStatus {
", responseMessage='" + responseMessage + '\'' +
'}';
}
+
+ public Status toStatus(Params params) {
+ return new Status(responseCode, getFormattedMessage(params));
+ }
}
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<? extends CommandRequest> 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<? extends CommandRequest> getMessageExecutor(String action){
if (logger.isTraceEnabled()) {
logger.trace("Entering to getMessageExecutor with command = "+ action);
}
- CommandTask executionTask = executionTaskFactory.getExecutionTask(action);
+ CommandTask<? extends CommandRequest> 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/CommandTask.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandTask.java
index 6418002c2..0037434ff 100644
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandTask.java
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandTask.java
@@ -119,8 +119,4 @@ public abstract class CommandTask<M> implements Runnable {
this.onRequestCompletion(commandRequest,commandResponse);
}
- public static void fillStatus(Status status, LCMCommandStatus lcmCommandStatus, Params params) {
- status.setCode(lcmCommandStatus.getResponseCode());
- status.setMessage(lcmCommandStatus.getFormattedMessage(params));
- }
}
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<? extends CommandRequest> 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/main/java/org/openecomp/appc/executor/impl/LCMCommandTask.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/LCMCommandTask.java
index 6e64a546b..9f7c13513 100644
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/LCMCommandTask.java
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/LCMCommandTask.java
@@ -147,22 +147,19 @@ public class LCMCommandTask extends CommandTask<LCMCommandRequest> {
isAAIUpdated= postVnfdata(vnfId, nextState,"onRequestExecutionStart",ctx);
} catch (NoTransitionDefinedException e) {
logger.error("Error getting Next State for AAI Update: " + e.getMessage(), e);
- Status status = request.getCommandExecutorInput().getRuntimeContext().getResponseContext().getStatus();
Params params = new Params().addParam("actionName",e.event).addParam("currentState",e.currentState);
- fillStatus(status, LCMCommandStatus.NO_TRANSITION_DEFINE_FAILURE, params);
+ request.getCommandExecutorInput().getRuntimeContext().getResponseContext().setStatus(LCMCommandStatus.NO_TRANSITION_DEFINE_FAILURE.toStatus(params));
isAAIUpdated = false;
} catch (UnstableVNFException e) {
logger.error(e.getMessage(), e);
- Status status = request.getCommandExecutorInput().getRuntimeContext().getResponseContext().getStatus();
Params params = new Params().addParam("vnfId",vnfId);
- fillStatus(status, LCMCommandStatus.UNSTABLE_VNF_FAILURE, params);
+ request.getCommandExecutorInput().getRuntimeContext().getResponseContext().setStatus(LCMCommandStatus.UNSTABLE_VNF_FAILURE.toStatus(params));
isAAIUpdated = false;
}catch (Exception e) {
logger.error("Error before Request Execution starts.", e);
- Status status = request.getCommandExecutorInput().getRuntimeContext().getResponseContext().getStatus();
String errorMsg = StringUtils.isEmpty(e.getMessage()) ? e.toString() : e.getMessage();
Params params = new Params().addParam("errorMsg",errorMsg);
- fillStatus(status, LCMCommandStatus.UNEXPECTED_FAILURE, params);
+ request.getCommandExecutorInput().getRuntimeContext().getResponseContext().setStatus(LCMCommandStatus.UNEXPECTED_FAILURE.toStatus(params));
isAAIUpdated = false;
}
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/LCMReadonlyCommandTask.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/LCMReadonlyCommandTask.java
index 137a2e4b5..201662a6c 100644
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/LCMReadonlyCommandTask.java
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/LCMReadonlyCommandTask.java
@@ -67,15 +67,13 @@ public class LCMReadonlyCommandTask extends CommandTask<LCMReadOnlyCommandReques
super.execute();
} catch (UnstableVNFException e) {
logger.error(e.getMessage(), e);
- Status status = request.getCommandExecutorInput().getRuntimeContext().getResponseContext().getStatus();
Params params = new Params().addParam("vnfId",vnfId);
- fillStatus(status, LCMCommandStatus.UNSTABLE_VNF_FAILURE, params);
+ request.getCommandExecutorInput().getRuntimeContext().getResponseContext().setStatus(LCMCommandStatus.UNSTABLE_VNF_FAILURE.toStatus(params));
}catch (Exception e) {
logger.error("Error during runing LCMReadonlyCommandTask.", e);
- Status status = request.getCommandExecutorInput().getRuntimeContext().getResponseContext().getStatus();
String errorMsg = StringUtils.isEmpty(e.getMessage()) ? e.toString() : e.getMessage();
Params params = new Params().addParam("errorMsg",errorMsg);
- fillStatus(status, LCMCommandStatus.UNEXPECTED_FAILURE, params);
+ request.getCommandExecutorInput().getRuntimeContext().getResponseContext().setStatus(LCMCommandStatus.UNEXPECTED_FAILURE.toStatus(params));
}
}
}
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 c26105b75..1e46393d3 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<? extends CommandRequest> task = factory.getExecutionTask("Configure");
assertEquals(LCMCommandTask.class,task.getClass() );
task = factory.getExecutionTask("Sync");
assertEquals(LCMReadonlyCommandTask.class,task.getClass() );
@@ -192,9 +191,7 @@ public class TestCommandExecutionTask {
requestContext.setAction(action);
runtimeContext.setRpcName(action.name().toLowerCase());
commonHeader.setApiVer(API_VERSION);
- Status status = new Status();
- status.setCode(100);
- responseContext.setStatus(status);
+ responseContext.setStatus(new Status(100, null));
commonHeader.setRequestId(responseId);
responseContext.setPayload(payload);
commonHeader.setTimestamp(new Date());
@@ -247,7 +244,7 @@ public class TestCommandExecutionTask {
ResponseContext responseContext = createResponseContextWithSuObjects();
wfResponse.setResponseContext(responseContext);
responseContext.setPayload("");
- wfResponse.getResponseContext().getStatus().setCode(100);
+ wfResponse.getResponseContext().setStatus(new Status(100, null));
return wfResponse;
}
@@ -299,9 +296,8 @@ public class TestCommandExecutionTask {
ResponseContext responseContext = new ResponseContext();
CommonHeader commonHeader = new CommonHeader();
Flags flags = new Flags();
- Status status = new Status();
responseContext.setCommonHeader(commonHeader);
- responseContext.setStatus(status);
+ responseContext.setStatus(new Status(0, null));
commonHeader.setFlags(flags);
return responseContext;
}
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 7b62bfc2d..ae8755226 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);
}
diff --git a/appc-dispatcher/appc-dispatcher-common/domain-model-lib/src/main/java/org/openecomp/appc/domainmodel/lcm/Status.java b/appc-dispatcher/appc-dispatcher-common/domain-model-lib/src/main/java/org/openecomp/appc/domainmodel/lcm/Status.java
index a5fbefa9c..978e570f3 100644
--- a/appc-dispatcher/appc-dispatcher-common/domain-model-lib/src/main/java/org/openecomp/appc/domainmodel/lcm/Status.java
+++ b/appc-dispatcher/appc-dispatcher-common/domain-model-lib/src/main/java/org/openecomp/appc/domainmodel/lcm/Status.java
@@ -24,25 +24,22 @@ package org.openecomp.appc.domainmodel.lcm;
public class Status {
- private int code;
- private String message;
+ private final int code;
+ private final String message;
- public int getCode() {
- return code;
+ public Status(int code, String message) {
+ this.code = code;
+ this.message = message;
}
- public void setCode(int code) {
- this.code = code;
+ public int getCode() {
+ return code;
}
public String getMessage() {
return message;
}
- public void setMessage(String value) {
- this.message = value;
- }
-
@Override
public String toString() {
return "Status{" +
diff --git a/appc-dispatcher/appc-dispatcher-common/execution-queue-management-lib/src/main/java/org/openecomp/appc/executionqueue/impl/ExecutionQueueServiceImpl.java b/appc-dispatcher/appc-dispatcher-common/execution-queue-management-lib/src/main/java/org/openecomp/appc/executionqueue/impl/ExecutionQueueServiceImpl.java
index c2be1b4ac..2ac383696 100644
--- a/appc-dispatcher/appc-dispatcher-common/execution-queue-management-lib/src/main/java/org/openecomp/appc/executionqueue/impl/ExecutionQueueServiceImpl.java
+++ b/appc-dispatcher/appc-dispatcher-common/execution-queue-management-lib/src/main/java/org/openecomp/appc/executionqueue/impl/ExecutionQueueServiceImpl.java
@@ -48,13 +48,10 @@ public class ExecutionQueueServiceImpl<M extends Runnable> implements ExecutionQ
@Override
public void putMessage(M message, long timeout, TimeUnit unit) throws APPCException{
- QueueMessage queueMessage = null;
-
try {
Date expirationTime = calculateExpirationTime(timeout,unit);
- queueMessage = new QueueMessage(message,expirationTime);
QueueManager queueManager = QueueManager.getInstance();
- boolean enqueueTask = queueManager.enqueueTask(queueMessage);
+ boolean enqueueTask = queueManager.enqueueTask(new QueueMessage<M>(message,expirationTime));
if(!enqueueTask){
throw new APPCException("failed to put message in queue");
}
diff --git a/appc-dispatcher/appc-dispatcher-common/execution-queue-management-lib/src/main/java/org/openecomp/appc/executionqueue/impl/QueueManager.java b/appc-dispatcher/appc-dispatcher-common/execution-queue-management-lib/src/main/java/org/openecomp/appc/executionqueue/impl/QueueManager.java
index 2d4907fa1..cf625b4d5 100644
--- a/appc-dispatcher/appc-dispatcher-common/execution-queue-management-lib/src/main/java/org/openecomp/appc/executionqueue/impl/QueueManager.java
+++ b/appc-dispatcher/appc-dispatcher-common/execution-queue-management-lib/src/main/java/org/openecomp/appc/executionqueue/impl/QueueManager.java
@@ -33,7 +33,7 @@ import com.att.eelf.configuration.EELFManager;
public class QueueManager {
- private LinkedBlockingQueue<QueueMessage> queue;
+ private LinkedBlockingQueue<QueueMessage<? extends Runnable>> queue;
private MessageExpirationListener listener;
@@ -59,7 +59,7 @@ public class QueueManager {
}
private void init(){
- queue = new LinkedBlockingQueue(MAX_QUEUE_SIZE);
+ queue = new LinkedBlockingQueue<QueueMessage<? extends Runnable>>(MAX_QUEUE_SIZE);
messageExecutor = Executors.newFixedThreadPool(MAX_THREAD_SIZE,Util.getThreadFactory(true));
for(int i=0;i<MAX_THREAD_SIZE;i++){
@@ -68,7 +68,7 @@ public class QueueManager {
public void run() {
while (true){
try{
- QueueMessage queueMessage = queue.take();
+ QueueMessage<? extends Runnable> queueMessage = queue.take();
if(messageExpired(queueMessage)){
logger.debug("Message expired "+ queueMessage.getMessage());
if(listener != null){
@@ -94,11 +94,11 @@ public class QueueManager {
this.listener = listener;
}
- public boolean enqueueTask(QueueMessage queueMessage) {
+ public boolean enqueueTask(QueueMessage<? extends Runnable> queueMessage) {
return queue.offer(queueMessage);
}
- private boolean messageExpired(QueueMessage queueMessage) {
+ private boolean messageExpired(QueueMessage<? extends Runnable> queueMessage) {
if(queueMessage.getExpirationTime() != null){
return queueMessage.getExpirationTime().getTime() < System.currentTimeMillis();
}
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 61e96631a..b1fe117b7 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
@@ -175,11 +175,11 @@ public class RequestHandlerImpl implements RequestHandler {
runtimeContext.setRpcName(input.getRpcName());
final ResponseContext responseContext = new ResponseContext();
- responseContext.setStatus(new Status());
+ responseContext.setStatus(new Status(0, null));
responseContext.setAdditionalContext(new HashMap<String, String>(4));
responseContext.setCommonHeader(input.getRequestContext().getCommonHeader());
runtimeContext.setResponseContext(responseContext);
- runtimeContext.getResponseContext().setStatus(new Status());
+ runtimeContext.getResponseContext().setStatus(new Status(0, null));
vnfId = runtimeContext.getRequestContext().getActionIdentifiers().getVnfId();
@@ -400,8 +400,7 @@ public class RequestHandlerImpl implements RequestHandler {
}
private void fillStatus(RuntimeContext runtimeContext, LCMCommandStatus lcmCommandStatus, Params params) {
- runtimeContext.getResponseContext().getStatus().setCode(lcmCommandStatus.getResponseCode());
- runtimeContext.getResponseContext().getStatus().setMessage(lcmCommandStatus.getFormattedMessage(params));
+ runtimeContext.getResponseContext().setStatus(lcmCommandStatus.toStatus(params));
}
/*
@@ -412,7 +411,7 @@ public class RequestHandlerImpl implements RequestHandler {
RuntimeContext other = new RuntimeContext();
other.setRequestContext(runtimeContext.getRequestContext());
other.setResponseContext(new ResponseContext());
- other.getResponseContext().setStatus(new Status());
+ other.getResponseContext().setStatus(new Status(0, null));
other.getResponseContext().setCommonHeader(runtimeContext.getRequestContext().getCommonHeader());
other.setVnfContext(runtimeContext.getVnfContext());
other.setRpcName(runtimeContext.getRpcName());
@@ -567,10 +566,7 @@ public class RequestHandlerImpl implements RequestHandler {
private static RequestHandlerOutput buildRequestHandlerOutput(LCMCommandStatus response, Params params) {
RequestHandlerOutput output = new RequestHandlerOutput();
ResponseContext responseContext = new ResponseContext();
- org.openecomp.appc.domainmodel.lcm.Status status = new org.openecomp.appc.domainmodel.lcm.Status();
- status.setCode(response.getResponseCode());
- status.setMessage(response.getFormattedMessage(params));
- responseContext.setStatus(status);
+ responseContext.setStatus(response.toStatus(params));
output.setResponseContext(responseContext);
return output;
}
diff --git a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/openecomp/appc/requesthandler/TestConverter.java b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/openecomp/appc/requesthandler/TestConverter.java
index 46875a269..aaf17fba9 100644
--- a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/openecomp/appc/requesthandler/TestConverter.java
+++ b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/openecomp/appc/requesthandler/TestConverter.java
@@ -324,8 +324,7 @@ public class TestConverter {
private ResponseContext buildAsyncResponse() {
ResponseContext asyncResponse = createResponseContextWithSubObjects();
- asyncResponse.getStatus().setCode(LCMCommandStatus.SUCCESS.getResponseCode());
- asyncResponse.getStatus().setMessage(LCMCommandStatus.SUCCESS.getResponseMessage());
+ asyncResponse.setStatus(LCMCommandStatus.SUCCESS.toStatus(null));
asyncResponse.getCommonHeader().setOriginatorId("oid");
asyncResponse.getCommonHeader().setApiVer("2.0.0");
asyncResponse.getCommonHeader().setRequestId("reqid");
@@ -339,9 +338,8 @@ public class TestConverter {
ResponseContext responseContext = new ResponseContext();
CommonHeader commonHeader = new CommonHeader();
Flags flags = new Flags();
- Status status = new Status();
responseContext.setCommonHeader(commonHeader);
- responseContext.setStatus(status);
+ responseContext.setStatus(new Status(0, null));
commonHeader.setFlags(flags);
return responseContext;
}
diff --git a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/openecomp/appc/requesthandler/TestRequestHandler.java b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/openecomp/appc/requesthandler/TestRequestHandler.java
index e4c1e92d3..e060775ce 100644
--- a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/openecomp/appc/requesthandler/TestRequestHandler.java
+++ b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/openecomp/appc/requesthandler/TestRequestHandler.java
@@ -302,12 +302,12 @@ public class TestRequestHandler {
ResponseContext responseContext = new ResponseContext();
- responseContext.setStatus(new Status());
+ responseContext.setStatus(new Status(0, null));
responseContext.setAdditionalContext(new HashMap<String, String>(4));
responseContext.setCommonHeader(input1.getRequestContext().getCommonHeader());
runtimeContext.setResponseContext(responseContext);
when(runtimeContext.getResponseContext()).thenReturn(responseContext);
- responseContext.setStatus(new Status());
+ responseContext.setStatus(new Status(0, null));
runtimeContext.setResponseContext(responseContext);
PowerMockito.whenNew(RuntimeContext.class).withAnyArguments().thenReturn(runtimeContext);
@@ -451,7 +451,7 @@ public class TestRequestHandler {
output.getVnfContext().setId(vnfId);
output.getResponseContext().getCommonHeader().setApiVer("2.0.0");
output.getResponseContext().getCommonHeader().setTimestamp(new Date());
- output.getResponseContext().getStatus().setCode(LCMCommandStatus.SUCCESS.getResponseCode());
+ output.getResponseContext().setStatus(LCMCommandStatus.SUCCESS.toStatus(null));
output.setTimeStart(new Date());
output.getResponseContext().getCommonHeader().setOriginatorId(originatorId);
output.getResponseContext().getCommonHeader().setRequestId(requestId);
@@ -566,9 +566,8 @@ public class TestRequestHandler {
ResponseContext responseContext = new ResponseContext();
CommonHeader commonHeader = new CommonHeader();
Flags flags = new Flags();
- Status status = new Status();
responseContext.setCommonHeader(commonHeader);
- responseContext.setStatus(status);
+ responseContext.setStatus(new Status(0, null));
commonHeader.setFlags(flags);
return responseContext;
}
diff --git a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/openecomp/appc/requesthandler/TestRequestValidator.java b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/openecomp/appc/requesthandler/TestRequestValidator.java
index 344f20478..becd95d46 100644
--- a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/openecomp/appc/requesthandler/TestRequestValidator.java
+++ b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/openecomp/appc/requesthandler/TestRequestValidator.java
@@ -601,9 +601,8 @@ public class TestRequestValidator {
ResponseContext responseContext = new ResponseContext();
CommonHeader commonHeader = new CommonHeader();
Flags flags = new Flags();
- Status status = new Status();
responseContext.setCommonHeader(commonHeader);
- responseContext.setStatus(status);
+ responseContext.setStatus(new Status(0, null));
commonHeader.setFlags(flags);
return responseContext;
}
diff --git a/appc-dispatcher/appc-workflow-management/appc-workflow-management-core/src/main/java/org/openecomp/appc/workflow/impl/WorkFlowManagerImpl.java b/appc-dispatcher/appc-workflow-management/appc-workflow-management-core/src/main/java/org/openecomp/appc/workflow/impl/WorkFlowManagerImpl.java
index 6b197ef19..4ed575567 100644
--- a/appc-dispatcher/appc-workflow-management/appc-workflow-management-core/src/main/java/org/openecomp/appc/workflow/impl/WorkFlowManagerImpl.java
+++ b/appc-dispatcher/appc-workflow-management/appc-workflow-management-core/src/main/java/org/openecomp/appc/workflow/impl/WorkFlowManagerImpl.java
@@ -33,6 +33,7 @@ import org.openecomp.appc.configuration.Configuration;
import org.openecomp.appc.configuration.ConfigurationFactory;
import org.openecomp.appc.domainmodel.lcm.RequestContext;
import org.openecomp.appc.domainmodel.lcm.ResponseContext;
+import org.openecomp.appc.domainmodel.lcm.Status;
import org.openecomp.appc.util.ObjectMapper;
import org.openecomp.appc.workflow.WorkFlowManager;
import org.openecomp.appc.workflow.objects.WorkflowExistsOutput;
@@ -335,9 +336,7 @@ public class WorkFlowManagerImpl implements WorkFlowManager{
* @param responceContext response context which will be store status code and status message
*/
private void fillStatus(int code, String message, ResponseContext responceContext) {
- responceContext.getStatus().setCode(code);
- responceContext.getStatus().setMessage(message);
+ responceContext.setStatus(new Status(code, message));
}
-
}
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProviderLcm.java b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProviderLcm.java
index 5fe174e55..6d186ab5f 100644
--- a/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProviderLcm.java
+++ b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProviderLcm.java
@@ -462,14 +462,10 @@ public class AppcProviderLcm implements AutoCloseable, AppcProviderLcmService {
requestHandlerOutput = new RequestHandlerOutput();
requestHandlerOutput.setResponseContext(responseContext);
responseContext.setCommonHeader(request.getRequestContext().getCommonHeader());
- final org.openecomp.appc.domainmodel.lcm.Status status = new org.openecomp.appc.domainmodel.lcm.Status();
-
- responseContext.setStatus(status);
-
String errorMessage = e.getMessage() != null ? e.getMessage() : e.toString();
Params params = new Params().addParam("errorMsg", errorMessage);
- status.setCode(LCMCommandStatus.UNEXPECTED_ERROR.getResponseCode());
- status.setMessage(LCMCommandStatus.UNEXPECTED_ERROR.getFormattedMessage(params));
+ responseContext.setStatus(LCMCommandStatus.UNEXPECTED_ERROR.toStatus(params));
+
LoggingUtils.logErrorMessage(
LoggingConstants.TargetNames.APPC_PROVIDER,
reason,