aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/openecomp/appc/adapter/chef/ChefActivator.java1
-rw-r--r--appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/AppcProviderAdapterActivator.java1
-rw-r--r--appc-adapters/appc-rest-adapter/appc-rest-adapter-bundle/src/main/java/org/openecomp/appc/adapter/rest/RestActivator.java1
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/CommandExecutor.java4
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/CommandExecutorInput.java50
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandExecutorImpl.java15
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/CommandTask.java19
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/ExpiredMessageHandler.java6
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/LCMCommandTask.java34
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/LCMReadonlyCommandTask.java14
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/openecomp/appc/executor/TestCommandExecutionTask.java50
-rw-r--r--appc-dispatcher/appc-command-executor/appc-command-executor-core/src/test/java/org/openecomp/appc/executor/TestCommandExecutor.java24
-rw-r--r--appc-dispatcher/appc-dispatcher-common/domain-model-lib/src/main/java/org/openecomp/appc/domainmodel/lcm/Flags.java29
-rw-r--r--appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/openecomp/appc/requesthandler/impl/RequestHandlerImpl.java5
-rw-r--r--appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/openecomp/appc/requesthandler/TestConverter.java3
-rw-r--r--appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/openecomp/appc/requesthandler/TestRequestHandler.java13
-rw-r--r--appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/openecomp/appc/requesthandler/TestRequestValidator.java10
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProvider.java1
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProviderClient.java1
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/lcm/util/RequestInputBuilder.java19
20 files changed, 106 insertions, 194 deletions
diff --git a/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/openecomp/appc/adapter/chef/ChefActivator.java b/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/openecomp/appc/adapter/chef/ChefActivator.java
index 2def2382b..303539ed0 100644
--- a/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/openecomp/appc/adapter/chef/ChefActivator.java
+++ b/appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/openecomp/appc/adapter/chef/ChefActivator.java
@@ -65,7 +65,6 @@ public class ChefActivator implements BundleActivator {
/**
* The logger to be used
*/
- // private static final Logger LOG = LoggerFactory.getLogger(ChefActivator.class);
private static final EELFLogger logger = EELFManager.getInstance().getLogger(ChefActivator.class);
/**
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/AppcProviderAdapterActivator.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/AppcProviderAdapterActivator.java
index fa60c67a9..dec975cfb 100644
--- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/AppcProviderAdapterActivator.java
+++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/AppcProviderAdapterActivator.java
@@ -65,7 +65,6 @@ public class AppcProviderAdapterActivator implements BundleActivator {
/**
* The logger to be used
*/
- // private static final Logger LOG = LoggerFactory.getLogger(AppcProviderAdapterActivator.class);
private static final EELFLogger logger = EELFManager.getInstance().getLogger(AppcProviderAdapterActivator.class);
/**
diff --git a/appc-adapters/appc-rest-adapter/appc-rest-adapter-bundle/src/main/java/org/openecomp/appc/adapter/rest/RestActivator.java b/appc-adapters/appc-rest-adapter/appc-rest-adapter-bundle/src/main/java/org/openecomp/appc/adapter/rest/RestActivator.java
index d1515c418..4c1baeb01 100644
--- a/appc-adapters/appc-rest-adapter/appc-rest-adapter-bundle/src/main/java/org/openecomp/appc/adapter/rest/RestActivator.java
+++ b/appc-adapters/appc-rest-adapter/appc-rest-adapter-bundle/src/main/java/org/openecomp/appc/adapter/rest/RestActivator.java
@@ -65,7 +65,6 @@ public class RestActivator implements BundleActivator {
/**
* The logger to be used
*/
- // private static final Logger LOG = LoggerFactory.getLogger(RestActivator.class);
private static final EELFLogger logger = EELFManager.getInstance().getLogger(RestActivator.class);
/**
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/CommandExecutor.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/CommandExecutor.java
index ac5223b93..877f940d2 100644
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/CommandExecutor.java
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/CommandExecutor.java
@@ -25,8 +25,8 @@
package org.openecomp.appc.executor;
+import org.openecomp.appc.domainmodel.lcm.RuntimeContext;
import org.openecomp.appc.exceptions.APPCException;
-import org.openecomp.appc.executor.objects.CommandExecutorInput;
@@ -37,5 +37,5 @@ public interface CommandExecutor {
* @param commandHeaderInput Contains CommandHeader, command , target Id , payload and conf ID (optional)
* @throws APPCException in case of error.
*/
- void executeCommand(CommandExecutorInput commandHeaderInput) throws APPCException;
+ void executeCommand(RuntimeContext commandHeaderInput) throws APPCException;
}
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/CommandExecutorInput.java b/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/CommandExecutorInput.java
deleted file mode 100644
index 07565a249..000000000
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-api/src/main/java/org/openecomp/appc/executor/objects/CommandExecutorInput.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : APP-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.executor.objects;
-
-import org.openecomp.appc.domainmodel.lcm.RuntimeContext;
-
-public class CommandExecutorInput {
- private final RuntimeContext runtimeContext ;
- private final int ttl;
-
- public CommandExecutorInput(RuntimeContext runtimeContext, int ttl) {
- this.runtimeContext = runtimeContext;
- this.ttl = ttl;
- }
-
- public RuntimeContext getRuntimeContext() {
- return runtimeContext;
- }
-
- public int getTtl() {
- return ttl;
- }
-
- @Override
- public String toString() {
- return "CommandExecutorInput{" +
- "runtimeContext=" + runtimeContext +
- ", ttl=" + ttl +
- '}';
- }
-}
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 7832b517a..0948b2b4d 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
@@ -29,11 +29,12 @@ import java.util.Date;
import java.util.concurrent.TimeUnit;
import org.apache.commons.lang.ObjectUtils;
+import org.openecomp.appc.domainmodel.lcm.RuntimeContext;
import org.openecomp.appc.exceptions.APPCException;
import org.openecomp.appc.executionqueue.ExecutionQueueService;
import org.openecomp.appc.executionqueue.impl.ExecutionQueueServiceFactory;
import org.openecomp.appc.executor.CommandExecutor;
-import org.openecomp.appc.executor.objects.CommandExecutorInput;
+
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
@@ -75,7 +76,7 @@ public class CommandExecutorImpl implements CommandExecutor {
* @throws APPCException in case of error.
*/
@Override
- public void executeCommand (CommandExecutorInput commandExecutorInput) throws APPCException{
+ public void executeCommand (RuntimeContext commandExecutorInput) throws APPCException{
if (logger.isTraceEnabled()) {
logger.trace("Entering to executeCommand with CommandExecutorInput = "+ ObjectUtils.toString(commandExecutorInput));
}
@@ -86,12 +87,12 @@ public class CommandExecutorImpl implements CommandExecutor {
}
@SuppressWarnings("unchecked")
- private void enqueRequest(CommandExecutorInput request) throws APPCException{
+ private void enqueRequest(RuntimeContext request) throws APPCException{
if (logger.isTraceEnabled()) {
logger.trace("Entering to enqueRequest with CommandRequest = "+ ObjectUtils.toString(request));
}
try {
- CommandTask commandTask = getMessageExecutor(request.getRuntimeContext().getRequestContext().getAction().name());
+ CommandTask commandTask = getMessageExecutor(request.getRequestContext().getAction().name());
commandTask.setCommandRequest(request);
long remainingTTL = getRemainingTTL(request);
executionQueueService.putMessage(commandTask,remainingTTL, TimeUnit.MILLISECONDS);
@@ -105,9 +106,9 @@ public class CommandExecutorImpl implements CommandExecutor {
}
}
- private long getRemainingTTL(CommandExecutorInput request) {
- Date requestTimestamp = request.getRuntimeContext().getRequestContext().getCommonHeader().getTimeStamp();
- int ttl = request.getRuntimeContext().getRequestContext().getCommonHeader().getFlags().getTtl();
+ private long getRemainingTTL(RuntimeContext request) {
+ Date requestTimestamp = request.getRequestContext().getCommonHeader().getTimeStamp();
+ int ttl = request.getRequestContext().getCommonHeader().getFlags().getTtl();
return ttl*1000 + requestTimestamp.getTime() - System.currentTimeMillis();
}
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 be899268b..f34746b24 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
@@ -33,7 +33,6 @@ import java.net.InetAddress;
import org.openecomp.appc.domainmodel.lcm.RuntimeContext;
import org.openecomp.appc.domainmodel.lcm.Status;
-import org.openecomp.appc.executor.objects.CommandExecutorInput;
import org.openecomp.appc.executor.objects.CommandResponse;
import org.openecomp.appc.executor.objects.LCMCommandStatus;
import org.openecomp.appc.executor.objects.Params;
@@ -55,13 +54,13 @@ public abstract class CommandTask implements Runnable {
protected RequestHandler requestHandler;
protected WorkFlowManager workflowManager;
- private CommandExecutorInput commandRequest;
+ private RuntimeContext commandRequest;
- public CommandExecutorInput getCommandRequest() {
+ public RuntimeContext getCommandRequest() {
return commandRequest;
}
- public void setCommandRequest(CommandExecutorInput commandRequest) {
+ public void setCommandRequest(RuntimeContext commandRequest) {
this.commandRequest = commandRequest;
}
@@ -78,23 +77,23 @@ public abstract class CommandTask implements Runnable {
CommandTask(){
}
- public void onRequestCompletion(CommandExecutorInput request, CommandResponse response , boolean isAAIUpdated) {
+ public void onRequestCompletion(RuntimeContext request, CommandResponse response , boolean isAAIUpdated) {
logger.debug("Entry: onRequestCompletion()");
- requestHandler.onRequestExecutionEnd(request.getRuntimeContext(), isAAIUpdated);
+ requestHandler.onRequestExecutionEnd(request, isAAIUpdated);
}
- public abstract void onRequestCompletion(CommandExecutorInput request, CommandResponse response);
+ public abstract void onRequestCompletion(RuntimeContext request, CommandResponse response);
- protected CommandResponse buildCommandResponse(CommandExecutorInput request, WorkflowResponse response) {
+ protected CommandResponse buildCommandResponse(RuntimeContext request, WorkflowResponse response) {
CommandResponse commandResponse = new CommandResponse();
- commandResponse.setRuntimeContext(request.getRuntimeContext());
+ commandResponse.setRuntimeContext(request);
return commandResponse;
}
public void execute() {
- final RuntimeContext runtimeContext = commandRequest.getRuntimeContext();
+ final RuntimeContext runtimeContext = commandRequest;
MDC.put(MDC_KEY_REQUEST_ID, runtimeContext.getRequestContext().getCommonHeader().getRequestId());
if (runtimeContext.getRequestContext().getActionIdentifiers().getServiceInstanceId() != null)
MDC.put(MDC_SERVICE_INSTANCE_ID, runtimeContext.getRequestContext().getActionIdentifiers().getServiceInstanceId());
diff --git a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/ExpiredMessageHandler.java b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/ExpiredMessageHandler.java
index 500f75735..626d3dfce 100644
--- a/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/ExpiredMessageHandler.java
+++ b/appc-dispatcher/appc-command-executor/appc-command-executor-core/src/main/java/org/openecomp/appc/executor/impl/ExpiredMessageHandler.java
@@ -21,8 +21,8 @@
package org.openecomp.appc.executor.impl;
+import org.openecomp.appc.domainmodel.lcm.RuntimeContext;
import org.openecomp.appc.executionqueue.MessageExpirationListener;
-import org.openecomp.appc.executor.objects.CommandExecutorInput;
import org.openecomp.appc.requesthandler.RequestHandler;
@@ -39,7 +39,7 @@ public class ExpiredMessageHandler<M> implements MessageExpirationListener<M>{
@Override
public void onMessageExpiration(M message) {
- CommandExecutorInput commandRequest = (CommandExecutorInput)message;
- requestHandler.onRequestTTLEnd(commandRequest.getRuntimeContext(), true);
+ RuntimeContext commandRequest = (RuntimeContext)message;
+ requestHandler.onRequestTTLEnd(commandRequest, true);
}
}
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 935260a10..889bd25da 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
@@ -24,10 +24,10 @@ package org.openecomp.appc.executor.impl;
import org.apache.commons.lang3.StringUtils;
import org.openecomp.appc.domainmodel.lcm.CommonHeader;
+import org.openecomp.appc.domainmodel.lcm.RuntimeContext;
import org.openecomp.appc.domainmodel.lcm.Status;
import org.openecomp.appc.domainmodel.lcm.VNFOperation;
import org.openecomp.appc.executor.UnstableVNFException;
-import org.openecomp.appc.executor.objects.CommandExecutorInput;
import org.openecomp.appc.executor.objects.CommandResponse;
import org.openecomp.appc.executor.objects.LCMCommandStatus;
import org.openecomp.appc.executor.objects.Params;
@@ -90,12 +90,12 @@ public class LCMCommandTask extends CommandTask {
@Override
- public void onRequestCompletion(CommandExecutorInput request, CommandResponse response) {
+ public void onRequestCompletion(RuntimeContext request, CommandResponse response) {
boolean isAAIUpdated = false;
try {
- final int statusCode = request.getRuntimeContext().getResponseContext().getStatus().getCode();
+ final int statusCode = request.getResponseContext().getStatus().getCode();
if (logger.isDebugEnabled()) {
logger.debug("Workflow Execution Status = "+ statusCode);
@@ -103,13 +103,13 @@ public class LCMCommandTask extends CommandTask {
boolean isSuccess = statusCode == 100 || statusCode == 400;
- if (isSuccess && VNFOperation.Terminate == request.getRuntimeContext().getRequestContext().getAction()) {
+ if (isSuccess && VNFOperation.Terminate == request.getRequestContext().getAction()) {
SvcLogicContext ctx = new SvcLogicContext();
- ctx = getVnfdata(request.getRuntimeContext().getVnfContext().getId(), "vnf", ctx);
- isAAIUpdated = aaiService.deleteGenericVnfData(request.getRuntimeContext().getVnfContext().getId(), ctx.getAttribute("vnf.resource-version"));
+ ctx = getVnfdata(request.getVnfContext().getId(), "vnf", ctx);
+ isAAIUpdated = aaiService.deleteGenericVnfData(request.getVnfContext().getId(), ctx.getAttribute("vnf.resource-version"));
}
else{
- isAAIUpdated = updateAAI(request.getRuntimeContext().getVnfContext().getId() , false, isSuccess);
+ isAAIUpdated = updateAAI(request.getVnfContext().getId() , false, isSuccess);
}
logger.debug("isAAIUpdated = " + isAAIUpdated);
}
@@ -124,20 +124,20 @@ public class LCMCommandTask extends CommandTask {
@Override
public void run() {
- CommandExecutorInput request = getCommandRequest();
+ RuntimeContext request = getCommandRequest();
boolean isAAIUpdated;
- final String vnfId = request.getRuntimeContext().getVnfContext().getId();
- final String vnfType = request.getRuntimeContext().getVnfContext().getType();
+ final String vnfId = request.getVnfContext().getId();
+ final String vnfType = request.getVnfContext().getType();
try {
- final CommonHeader commonHeader = request.getRuntimeContext().getRequestContext().getCommonHeader();
+ final CommonHeader commonHeader = request.getRequestContext().getCommonHeader();
final boolean forceFlag = commonHeader.getFlags().isForce();
UniqueRequestIdentifier requestIdentifier = new UniqueRequestIdentifier(commonHeader.getOriginatorId(),
commonHeader.getRequestId(), commonHeader.getSubRequestId());
String requestIdentifierString = requestIdentifier.toIdentifierString();
requestHandler.onRequestExecutionStart(vnfId,false, requestIdentifierString, forceFlag);
- final String currentStatus = request.getRuntimeContext().getVnfContext().getStatus();
- final VNFOperation action = request.getRuntimeContext().getRequestContext().getAction();
+ final String currentStatus = request.getVnfContext().getStatus();
+ final VNFOperation action = request.getRequestContext().getAction();
final String nextState = lifecyclemanager.getNextState(vnfType, currentStatus, action.name());
@@ -147,18 +147,18 @@ public class LCMCommandTask extends CommandTask {
} catch (NoTransitionDefinedException e) {
logger.error("Error getting Next State for AAI Update: " + e.getMessage(), e);
Params params = new Params().addParam("actionName",e.event).addParam("currentState",e.currentState);
- request.getRuntimeContext().getResponseContext().setStatus(LCMCommandStatus.NO_TRANSITION_DEFINE_FAILURE.toStatus(params));
+ request.getResponseContext().setStatus(LCMCommandStatus.NO_TRANSITION_DEFINE_FAILURE.toStatus(params));
isAAIUpdated = false;
} catch (UnstableVNFException e) {
logger.error(e.getMessage(), e);
Params params = new Params().addParam("vnfId",vnfId);
- request.getRuntimeContext().getResponseContext().setStatus(LCMCommandStatus.UNSTABLE_VNF_FAILURE.toStatus(params));
+ request.getResponseContext().setStatus(LCMCommandStatus.UNSTABLE_VNF_FAILURE.toStatus(params));
isAAIUpdated = false;
}catch (Exception e) {
logger.error("Error before Request Execution starts.", e);
String errorMsg = StringUtils.isEmpty(e.getMessage()) ? e.toString() : e.getMessage();
Params params = new Params().addParam("errorMsg",errorMsg);
- request.getRuntimeContext().getResponseContext().setStatus(LCMCommandStatus.UNEXPECTED_FAILURE.toStatus(params));
+ request.getResponseContext().setStatus(LCMCommandStatus.UNEXPECTED_FAILURE.toStatus(params));
isAAIUpdated = false;
}
@@ -168,7 +168,7 @@ public class LCMCommandTask extends CommandTask {
String errorMsg = "Error updating A& AI before Workflow execution";
logger.error(errorMsg);
WorkflowResponse response = new WorkflowResponse();
- response.setResponseContext(request.getRuntimeContext().getResponseContext());
+ response.setResponseContext(request.getResponseContext());
CommandResponse commandResponse = super.buildCommandResponse(request, response);
this.onRequestCompletion(request,commandResponse);
}
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 755f70c31..a351c4d36 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
@@ -24,9 +24,9 @@ package org.openecomp.appc.executor.impl;
import org.apache.commons.lang3.StringUtils;
import org.openecomp.appc.domainmodel.lcm.CommonHeader;
+import org.openecomp.appc.domainmodel.lcm.RuntimeContext;
import org.openecomp.appc.domainmodel.lcm.Status;
import org.openecomp.appc.executor.UnstableVNFException;
-import org.openecomp.appc.executor.objects.CommandExecutorInput;
import org.openecomp.appc.executor.objects.CommandResponse;
import org.openecomp.appc.executor.objects.LCMCommandStatus;
import org.openecomp.appc.executor.objects.Params;
@@ -48,30 +48,30 @@ public class LCMReadonlyCommandTask extends CommandTask {
@Override
- public void onRequestCompletion(CommandExecutorInput request, CommandResponse response) {
+ public void onRequestCompletion(RuntimeContext request, CommandResponse response) {
super.onRequestCompletion(request, response, true);
}
@Override
public void run() {
- CommandExecutorInput request = getCommandRequest();
- final CommonHeader commonHeader = request.getRuntimeContext().getRequestContext().getCommonHeader();
+ RuntimeContext request = getCommandRequest();
+ final CommonHeader commonHeader = request.getRequestContext().getCommonHeader();
final boolean forceFlag = commonHeader.getFlags().isForce();
UniqueRequestIdentifier requestIdentifier = new UniqueRequestIdentifier(commonHeader.getOriginatorId(), commonHeader.getRequestId(), commonHeader.getSubRequestId());
String requestIdentifierString = requestIdentifier.toIdentifierString();
- final String vnfId = request.getRuntimeContext().getVnfContext().getId();
+ final String vnfId = request.getVnfContext().getId();
try {
requestHandler.onRequestExecutionStart(vnfId,true, requestIdentifierString, forceFlag);
super.execute();
} catch (UnstableVNFException e) {
logger.error(e.getMessage(), e);
Params params = new Params().addParam("vnfId",vnfId);
- request.getRuntimeContext().getResponseContext().setStatus(LCMCommandStatus.UNSTABLE_VNF_FAILURE.toStatus(params));
+ request.getResponseContext().setStatus(LCMCommandStatus.UNSTABLE_VNF_FAILURE.toStatus(params));
}catch (Exception e) {
logger.error("Error during runing LCMReadonlyCommandTask.", e);
String errorMsg = StringUtils.isEmpty(e.getMessage()) ? e.toString() : e.getMessage();
Params params = new Params().addParam("errorMsg",errorMsg);
- request.getRuntimeContext().getResponseContext().setStatus(LCMCommandStatus.UNEXPECTED_FAILURE.toStatus(params));
+ request.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 ca6694064..9757430d8 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
@@ -31,6 +31,7 @@ import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.openecomp.appc.domainmodel.lcm.*;
+import org.openecomp.appc.domainmodel.lcm.Flags.Mode;
import org.openecomp.appc.executor.impl.CommandTask;
import org.openecomp.appc.executor.impl.CommandTaskFactory;
import org.openecomp.appc.executor.impl.LCMCommandTask;
@@ -141,28 +142,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();
}
@@ -179,8 +180,7 @@ public class TestCommandExecutionTask {
CommonHeader commonHeader = new CommonHeader();
requestContext.setCommonHeader(commonHeader);
responseContext.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();
@@ -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,14 +226,13 @@ 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().setFlags(new Flags(null, false, ttl));
requestContext.getCommonHeader().setApiVer(apiVersion);
requestContext.getCommonHeader().setTimestamp(timeStamp);
requestContext.getCommonHeader().setRequestId(requestId);
@@ -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() {
@@ -272,8 +258,7 @@ public class TestCommandExecutionTask {
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();
@@ -285,10 +270,9 @@ public class TestCommandExecutionTask {
private ResponseContext createResponseContextWithSuObjects(){
ResponseContext responseContext = new ResponseContext();
CommonHeader commonHeader = new CommonHeader();
- Flags flags = new Flags();
responseContext.setCommonHeader(commonHeader);
responseContext.setStatus(new Status(0, null));
- commonHeader.setFlags(flags);
+ commonHeader.setFlags(new Flags(null, false, 0));
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 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;
}
diff --git a/appc-dispatcher/appc-dispatcher-common/domain-model-lib/src/main/java/org/openecomp/appc/domainmodel/lcm/Flags.java b/appc-dispatcher/appc-dispatcher-common/domain-model-lib/src/main/java/org/openecomp/appc/domainmodel/lcm/Flags.java
index 4f4ddba35..519ea34a4 100644
--- a/appc-dispatcher/appc-dispatcher-common/domain-model-lib/src/main/java/org/openecomp/appc/domainmodel/lcm/Flags.java
+++ b/appc-dispatcher/appc-dispatcher-common/domain-model-lib/src/main/java/org/openecomp/appc/domainmodel/lcm/Flags.java
@@ -24,38 +24,29 @@ package org.openecomp.appc.domainmodel.lcm;
public class Flags {
- private boolean force;
- private int ttl;
- private Mode mode;
+ private final boolean force;
+ private final int ttl;
+ private final Mode mode;
- public boolean isForce() {
- return force;
+ public Flags(Mode mode, boolean force, int ttl) {
+ super();
+ this.force = force;
+ this.ttl = ttl;
+ this.mode = mode;
}
- public void setForce(boolean force) {
- this.force = force;
+ public boolean isForce() {
+ return force;
}
public int getTtl() {
return ttl;
}
- public void setTtl(int ttl) {
- this.ttl = ttl;
- }
-
public Mode getMode() {
return mode;
}
- public void setMode(Mode mode) {
- this.mode = mode;
- }
-
- public void setMode(String mode) {
- this.mode = Mode.valueOf(mode);
- }
-
@Override
public String toString() {
return "Flags{" +
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 b1fe117b7..07a430671 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
@@ -29,7 +29,6 @@ import org.openecomp.appc.domainmodel.lcm.*;
import org.openecomp.appc.exceptions.APPCException;
import org.openecomp.appc.executor.CommandExecutor;
import org.openecomp.appc.executor.UnstableVNFException;
-import org.openecomp.appc.executor.objects.CommandExecutorInput;
import org.openecomp.appc.executor.objects.LCMCommandStatus;
import org.openecomp.appc.executor.objects.Params;
import org.openecomp.appc.executor.objects.UniqueRequestIdentifier;
@@ -368,9 +367,7 @@ public class RequestHandlerImpl implements RequestHandler {
logger.debug("Calling command Executor with remaining TTL value: " + remainingTTL);
}
- RuntimeContext clonedContext = cloneContext(runtimeContext);
-
- CommandExecutorInput commandExecutorInput = new CommandExecutorInput(clonedContext, remainingTTL);
+ RuntimeContext commandExecutorInput = cloneContext(runtimeContext);
try {
commandExecutor.executeCommand(commandExecutorInput);
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 aaf17fba9..87fda3930 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
@@ -337,10 +337,9 @@ public class TestConverter {
ResponseContext responseContext = new ResponseContext();
CommonHeader commonHeader = new CommonHeader();
- Flags flags = new Flags();
responseContext.setCommonHeader(commonHeader);
responseContext.setStatus(new Status(0, null));
- commonHeader.setFlags(flags);
+ commonHeader.setFlags(new Flags(null, false, 0));
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 e060775ce..0c7ded71a 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
@@ -28,9 +28,9 @@ import org.junit.runner.RunWith;
import org.mockito.Matchers;
import org.mockito.Mockito;
import org.openecomp.appc.domainmodel.lcm.*;
+import org.openecomp.appc.domainmodel.lcm.Flags.Mode;
import org.openecomp.appc.executor.CommandExecutor;
import org.openecomp.appc.executor.UnstableVNFException;
-import org.openecomp.appc.executor.objects.CommandExecutorInput;
import org.openecomp.appc.executor.objects.LCMCommandStatus;
import org.openecomp.appc.lifecyclemanager.LifecycleManager;
import org.openecomp.appc.lifecyclemanager.objects.LifecycleException;
@@ -400,7 +400,7 @@ public class TestRequestHandler {
requestHandler.onRequestTTLEnd(response,true);
input1 = this.getRequestHandlerInput("138", VNFOperation.Configure, 1200,
false,UUID.randomUUID().toString(),UUID.randomUUID().toString(),UUID.randomUUID().toString(),new Date());
- input1.getRequestContext().getCommonHeader().getFlags().setForce(true);
+ input1.getRequestContext().getCommonHeader().setFlags(new Flags(null, true, 1200));
mockRuntimeContextAndVnfContext(input1);
output = requestHandler.handleRequest(input1);
Assert.assertEquals(LCMCommandStatus.ACCEPTED.getResponseCode(),output.getResponseContext().getStatus().getCode());
@@ -435,8 +435,7 @@ public class TestRequestHandler {
requestContext.getCommonHeader().setRequestId(requestId);
requestContext.getCommonHeader().setSubRequestId(subRequestId);
requestContext.getCommonHeader().setOriginatorId(originatorId);
- requestContext.getCommonHeader().getFlags().setTtl(ttl);
- requestContext.getCommonHeader().getFlags().setForce(force);
+ requestContext.getCommonHeader().setFlags(new Flags(null, force, ttl));
requestContext.getCommonHeader().setTimestamp(timeStamp);
requestContext.getCommonHeader().setApiVer(API_VERSION);
return input;
@@ -552,8 +551,7 @@ public class TestRequestHandler {
runtimeContext.setResponseContext(responseContext);
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();
@@ -565,10 +563,9 @@ public class TestRequestHandler {
private ResponseContext createResponseContextWithSuObjects(){
ResponseContext responseContext = new ResponseContext();
CommonHeader commonHeader = new CommonHeader();
- Flags flags = new Flags();
responseContext.setCommonHeader(commonHeader);
responseContext.setStatus(new Status(0, null));
- commonHeader.setFlags(flags);
+ commonHeader.setFlags(new Flags(null, false, 0));
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 becd95d46..1298aa542 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
@@ -30,6 +30,7 @@ import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.openecomp.appc.domainmodel.lcm.*;
+import org.openecomp.appc.domainmodel.lcm.Flags.Mode;
import org.openecomp.appc.executor.UnstableVNFException;
import org.openecomp.appc.lifecyclemanager.LifecycleManager;
import org.openecomp.appc.lifecyclemanager.objects.LifecycleException;
@@ -230,8 +231,7 @@ public class TestRequestValidator {
requestContext.getCommonHeader().setRequestId(requestId);
requestContext.getCommonHeader().setSubRequestId(subRequestId);
requestContext.getCommonHeader().setOriginatorId(originatorId);
- requestContext.getCommonHeader().getFlags().setTtl(ttl);
- requestContext.getCommonHeader().getFlags().setForce(force);
+ requestContext.getCommonHeader().setFlags(new Flags(null, force, ttl));
requestContext.getCommonHeader().getTimeStamp();
requestContext.getCommonHeader().setApiVer(API_VERSION);
requestContext.getCommonHeader().setTimestamp(timeStamp);
@@ -587,8 +587,7 @@ public class TestRequestValidator {
runtimeContext.setResponseContext(responseContext);
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();
@@ -600,10 +599,9 @@ public class TestRequestValidator {
private ResponseContext createResponseContextWithSuObjects(){
ResponseContext responseContext = new ResponseContext();
CommonHeader commonHeader = new CommonHeader();
- Flags flags = new Flags();
responseContext.setCommonHeader(commonHeader);
responseContext.setStatus(new Status(0, null));
- commonHeader.setFlags(flags);
+ commonHeader.setFlags(new Flags(null, false, 0));
return responseContext;
}
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProvider.java b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProvider.java
index b24742d70..bdfb4fe56 100644
--- a/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProvider.java
+++ b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProvider.java
@@ -103,7 +103,6 @@ import java.util.concurrent.Future;
*/
public class AppcProvider implements AutoCloseable, AppcProviderService {
- // private final Logger logger = LoggerFactory.getLogger(AppcProvider.class);
private final EELFLogger logger = EELFManager.getInstance().getLogger(AppcProviderClient.class);
private final ExecutorService executor;
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProviderClient.java b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProviderClient.java
index f294fd98f..713f3dcbe 100644
--- a/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProviderClient.java
+++ b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/AppcProviderClient.java
@@ -37,7 +37,6 @@ import java.util.Properties;
public class AppcProviderClient {
- //private static final Logger LOG = LoggerFactory.getLogger(AppcProviderClient.class);
private static EELFLogger LOG = EELFManager.getInstance().getApplicationLogger();
private static EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/lcm/util/RequestInputBuilder.java b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/lcm/util/RequestInputBuilder.java
index 7af5f073d..f45748de2 100644
--- a/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/lcm/util/RequestInputBuilder.java
+++ b/appc-provider/appc-provider-bundle/src/main/java/org/openecomp/appc/provider/lcm/util/RequestInputBuilder.java
@@ -28,6 +28,7 @@ import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.Payload;
import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.action.identifiers.ActionIdentifiers;
import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.common.header.CommonHeader;
import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev160108.common.header.common.header.Flags;
+import org.openecomp.appc.domainmodel.lcm.Flags.Mode;
import org.openecomp.appc.domainmodel.lcm.RequestContext;
import org.openecomp.appc.domainmodel.lcm.VNFOperation;
import org.openecomp.appc.requesthandler.objects.RequestHandlerInput;
@@ -105,21 +106,23 @@ public class RequestInputBuilder {
header.setSubRequestId(commonHeader.getSubRequestId());
Flags inFlags = commonHeader.getFlags();
- org.openecomp.appc.domainmodel.lcm.Flags flags = new org.openecomp.appc.domainmodel.lcm.Flags();
+ boolean force = false;
+ Mode mode = null;
+ int ttl = 0;
if (inFlags != null) {
- if(null != inFlags.getForce()) {
- flags.setForce(Boolean.parseBoolean(inFlags.getForce().toString().toLowerCase()));
+ if (null != inFlags.getForce()) {
+ force = Boolean.parseBoolean(inFlags.getForce().toString().toLowerCase());
}
- if(null!=inFlags.getMode()) {
- flags.setMode(inFlags.getMode().name());
+ if (null != inFlags.getMode()) {
+ mode = Mode.valueOf(inFlags.getMode().name());
}
- if(null!= inFlags.getTtl()) {
- flags.setTtl(inFlags.getTtl());
+ if (null != inFlags.getTtl()) {
+ ttl = inFlags.getTtl();
}
}
- this.requestContext.getCommonHeader().setFlags(flags);
+ this.requestContext.getCommonHeader().setFlags(new org.openecomp.appc.domainmodel.lcm.Flags(mode, force, ttl));
return this;
}