summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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.java8
-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/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.java12
-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/lcm/util/RequestInputBuilder.java19
7 files changed, 40 insertions, 53 deletions
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 97d77a9d8..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;
@@ -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();
@@ -232,7 +232,7 @@ public class TestCommandExecutionTask {
ResponseContext responseContext = createResponseContextWithSuObjects();
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);
@@ -258,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();
@@ -271,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 ba4221509..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,6 +30,7 @@ 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;
@@ -114,9 +115,9 @@ public class TestCommandExecutor {
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();
+ RuntimeContext commandExecutorInput = createCommandExecutorInputWithSubObjects();
RequestContext requestContext = commandExecutorInput.getRequestContext();
- 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);
@@ -138,8 +139,7 @@ public class TestCommandExecutor {
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();
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/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 e1c117fe3..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,6 +28,7 @@ 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.LCMCommandStatus;
@@ -399,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());
@@ -434,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;
@@ -551,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();
@@ -564,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/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;
}