From fa68917a405125b75c6b23ca68310aab8c94a79a Mon Sep 17 00:00:00 2001 From: Gary Wu Date: Fri, 21 Apr 2017 12:34:25 -0700 Subject: Make Flags immutable Change-Id: Ib2e06d41d4e1eb6fb40144258067d2c71ac1d620 Signed-off-by: Gary Wu --- .../org/openecomp/appc/requesthandler/TestConverter.java | 3 +-- .../openecomp/appc/requesthandler/TestRequestHandler.java | 12 +++++------- .../openecomp/appc/requesthandler/TestRequestValidator.java | 10 ++++------ 3 files changed, 10 insertions(+), 15 deletions(-) (limited to 'appc-dispatcher/appc-request-handler') 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; } -- cgit 1.2.3-korg