aboutsummaryrefslogtreecommitdiffstats
path: root/appc-dispatcher/appc-request-handler/appc-request-handler-core/src
diff options
context:
space:
mode:
authorKeighron, Lori (lk2924) <lk2924@att.com>2019-11-25 14:17:57 -0500
committerKeighron, Lori (lk2924) <lk2924@att.com>2019-11-26 15:47:49 -0500
commitcea67fafd905f169b8db5c4be0b47959b66c32e3 (patch)
tree0b9020fc88d106916bb1e4b66667dea74ef6e701 /appc-dispatcher/appc-request-handler/appc-request-handler-core/src
parent0f9c0df9e651bbcbdb3e4b8133f57abe2482cbec (diff)
Add new LCM actions GetConfig, StartTraffic, StopTraffic, etc
New LCM actions Change-Id: Ic59607f2a7fc515bdd01be162018aaf695668f82 Issue-ID: APPC-1790 Signed-off-by: Keighron, Lori (lk2924) <lk2924@att.com>
Diffstat (limited to 'appc-dispatcher/appc-request-handler/appc-request-handler-core/src')
-rw-r--r--appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/requesthandler/conv/Converter.java161
-rw-r--r--appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/ConverterTest.java412
2 files changed, 476 insertions, 97 deletions
diff --git a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/requesthandler/conv/Converter.java b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/requesthandler/conv/Converter.java
index 73a2de6db..6d62c107b 100644
--- a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/requesthandler/conv/Converter.java
+++ b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/requesthandler/conv/Converter.java
@@ -69,20 +69,20 @@ public class Converter {
public static Builder<?> convAsyncResponseToBuilder(VNFOperation vnfOperation, String rpcName, ResponseContext response) {
Builder<?> outObj = null;
- if(response == null){
+ if (response == null) {
throw new IllegalArgumentException("empty asyncResponse");
}
- if(vnfOperation == null){
+ if (vnfOperation == null) {
throw new IllegalArgumentException("empty asyncResponse.action");
}
- logger.debug("Entered Converter.convAsyncResponseToBuilder() : Operation Name "+ vnfOperation.name());
+ logger.debug("Entered Converter.convAsyncResponseToBuilder(): Operation Name " + vnfOperation.name());
org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.Action action = org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.Action.valueOf(vnfOperation.name());
logger.debug("After resolving action");
CommonHeader commonHeader = convAsyncResponseTorev160108CommonHeader(response);
Status status = convAsyncResponseTorev160108Status(response);
Payload payload = convAsyncResponseTorev160108Payload(response);
- logger.debug("Extracted action, status, payload ");
- switch (action){
+ logger.debug("Extracted action, status, payload");
+ switch (action) {
case Rollback:
outObj = new RollbackOutputBuilder();
((RollbackOutputBuilder)outObj).setCommonHeader(commonHeader);
@@ -93,7 +93,8 @@ public class Converter {
((SnapshotOutputBuilder)outObj).setCommonHeader(commonHeader);
((SnapshotOutputBuilder)outObj).setStatus(status);
try {
- ((SnapshotOutputBuilder) outObj).setSnapshotId(response.getAdditionalContext().get("output.snapshot-id"));
+ ((SnapshotOutputBuilder) outObj)
+ .setSnapshotId(response.getAdditionalContext().get("output.snapshot-id"));
} catch (NullPointerException ignored) {
// in case of negative response, snapshotID does not populated, so just ignore NPL
}
@@ -109,7 +110,7 @@ public class Converter {
((HealthCheckOutputBuilder)outObj).setCommonHeader(commonHeader);
((HealthCheckOutputBuilder)outObj).setStatus(status);
((HealthCheckOutputBuilder)outObj).setPayload(payload);
- logger.debug("In HealthCheck case- created outObj, returning");
+ logger.debug("In HealthCheck case: created outObj, returning");
return outObj;
case LiveUpgrade:
outObj = new LiveUpgradeOutputBuilder();
@@ -227,26 +228,31 @@ public class Converter {
outObj = new StopApplicationOutputBuilder();
((StopApplicationOutputBuilder)outObj).setCommonHeader(commonHeader);
((StopApplicationOutputBuilder)outObj).setStatus(status);
+ ((StopApplicationOutputBuilder)outObj).setPayload(payload);
return outObj;
case StartApplication:
outObj = new StartApplicationOutputBuilder();
((StartApplicationOutputBuilder)outObj).setCommonHeader(commonHeader);
((StartApplicationOutputBuilder)outObj).setStatus(status);
+ ((StartApplicationOutputBuilder)outObj).setPayload(payload);
return outObj;
- case QuiesceTraffic:
+ case QuiesceTraffic:
outObj = new QuiesceTrafficOutputBuilder();
((QuiesceTrafficOutputBuilder)outObj).setCommonHeader(commonHeader);
((QuiesceTrafficOutputBuilder)outObj).setStatus(status);
+ ((QuiesceTrafficOutputBuilder)outObj).setPayload(payload);
return outObj;
case ResumeTraffic:
outObj = new ResumeTrafficOutputBuilder();
((ResumeTrafficOutputBuilder)outObj).setCommonHeader(commonHeader);
((ResumeTrafficOutputBuilder)outObj).setStatus(status);
+ ((ResumeTrafficOutputBuilder)outObj).setPayload(payload);
return outObj;
case UpgradeSoftware:
outObj = new UpgradeSoftwareOutputBuilder();
((UpgradeSoftwareOutputBuilder)outObj).setCommonHeader(commonHeader);
((UpgradeSoftwareOutputBuilder)outObj).setStatus(status);
+ ((UpgradeSoftwareOutputBuilder)outObj).setPayload(payload);
return outObj;
case UpgradePostCheck:
outObj = new UpgradePostCheckOutputBuilder();
@@ -258,11 +264,13 @@ public class Converter {
outObj = new UpgradeBackupOutputBuilder();
((UpgradeBackupOutputBuilder)outObj).setCommonHeader(commonHeader);
((UpgradeBackupOutputBuilder)outObj).setStatus(status);
+ ((UpgradeBackupOutputBuilder)outObj).setPayload(payload);
return outObj;
case UpgradeBackout:
outObj = new UpgradeBackoutOutputBuilder();
((UpgradeBackoutOutputBuilder)outObj).setCommonHeader(commonHeader);
((UpgradeBackoutOutputBuilder)outObj).setStatus(status);
+ ((UpgradeBackoutOutputBuilder)outObj).setPayload(payload);
return outObj;
case UpgradePreCheck:
outObj = new UpgradePreCheckOutputBuilder();
@@ -290,28 +298,106 @@ public class Converter {
((DistributeTrafficCheckOutputBuilder) outObj).setCommonHeader(commonHeader);
((DistributeTrafficCheckOutputBuilder)outObj).setStatus(status);
return outObj;
+ case PreConfigure:
+ outObj = new PreConfigureOutputBuilder();
+ ((PreConfigureOutputBuilder)outObj).setCommonHeader(commonHeader);
+ ((PreConfigureOutputBuilder)outObj).setStatus(status);
+ ((PreConfigureOutputBuilder)outObj).setPayload(payload);
+ return outObj;
+ case GetConfig:
+ outObj = new GetConfigOutputBuilder();
+ ((GetConfigOutputBuilder)outObj).setCommonHeader(commonHeader);
+ ((GetConfigOutputBuilder)outObj).setStatus(status);
+ ((GetConfigOutputBuilder)outObj).setPayload(payload);
+ return outObj;
+ case PostEvacuate:
+ outObj = new PostEvacuateOutputBuilder();
+ ((PostEvacuateOutputBuilder)outObj).setCommonHeader(commonHeader);
+ ((PostEvacuateOutputBuilder)outObj).setStatus(status);
+ ((PostEvacuateOutputBuilder)outObj).setPayload(payload);
+ return outObj;
+ case PreMigrate:
+ outObj = new PreMigrateOutputBuilder();
+ ((PreMigrateOutputBuilder)outObj).setCommonHeader(commonHeader);
+ ((PreMigrateOutputBuilder)outObj).setStatus(status);
+ ((PreMigrateOutputBuilder)outObj).setPayload(payload);
+ return outObj;
+ case PostMigrate:
+ outObj = new PostMigrateOutputBuilder();
+ ((PostMigrateOutputBuilder)outObj).setCommonHeader(commonHeader);
+ ((PostMigrateOutputBuilder)outObj).setStatus(status);
+ ((PostMigrateOutputBuilder)outObj).setPayload(payload);
+ return outObj;
+ case PreRebuild:
+ outObj = new PreRebuildOutputBuilder();
+ ((PreRebuildOutputBuilder)outObj).setCommonHeader(commonHeader);
+ ((PreRebuildOutputBuilder)outObj).setStatus(status);
+ ((PreRebuildOutputBuilder)outObj).setPayload(payload);
+ return outObj;
+ case Provisioning:
+ outObj = new ProvisioningOutputBuilder();
+ ((ProvisioningOutputBuilder)outObj).setCommonHeader(commonHeader);
+ ((ProvisioningOutputBuilder)outObj).setStatus(status);
+ ((ProvisioningOutputBuilder)outObj).setPayload(payload);
+ return outObj;
+ case PostRebuild:
+ outObj = new PostRebuildOutputBuilder();
+ ((PostRebuildOutputBuilder)outObj).setCommonHeader(commonHeader);
+ ((PostRebuildOutputBuilder)outObj).setStatus(status);
+ ((PostRebuildOutputBuilder)outObj).setPayload(payload);
+ return outObj;
+ case PreEvacuate:
+ outObj = new PreEvacuateOutputBuilder();
+ ((PreEvacuateOutputBuilder)outObj).setCommonHeader(commonHeader);
+ ((PreEvacuateOutputBuilder)outObj).setStatus(status);
+ ((PreEvacuateOutputBuilder)outObj).setPayload(payload);
+ return outObj;
+ case StartTraffic:
+ outObj = new StartTrafficOutputBuilder();
+ ((StartTrafficOutputBuilder)outObj).setCommonHeader(commonHeader);
+ ((StartTrafficOutputBuilder)outObj).setStatus(status);
+ ((StartTrafficOutputBuilder)outObj).setPayload(payload);
+ return outObj;
+ case StatusTraffic:
+ outObj = new StatusTrafficOutputBuilder();
+ ((StatusTrafficOutputBuilder)outObj).setCommonHeader(commonHeader);
+ ((StatusTrafficOutputBuilder)outObj).setStatus(status);
+ ((StatusTrafficOutputBuilder)outObj).setPayload(payload);
+ return outObj;
+ case StopTraffic:
+ outObj = new StopTrafficOutputBuilder();
+ ((StopTrafficOutputBuilder)outObj).setCommonHeader(commonHeader);
+ ((StopTrafficOutputBuilder)outObj).setStatus(status);
+ ((StopTrafficOutputBuilder)outObj).setPayload(payload);
+ return outObj;
+ case LicenseManagement:
+ outObj = new LicenseManagementOutputBuilder();
+ ((LicenseManagementOutputBuilder)outObj).setCommonHeader(commonHeader);
+ ((LicenseManagementOutputBuilder)outObj).setStatus(status);
+ ((LicenseManagementOutputBuilder)outObj).setPayload(payload);
+ return outObj;
default:
throw new IllegalArgumentException(action+" action is not supported");
}
}
public static Payload convAsyncResponseTorev160108Payload(ResponseContext inObj) {
- logger.debug("Entering convAsyncResponseTorev160108Payload" );
+ logger.debug("Entering convAsyncResponseTorev160108Payload");
Payload payload = null;
- if(inObj.getPayload() != null) {
+ if (inObj.getPayload() != null) {
payload = new Payload(inObj.getPayload());
}
- logger.debug("Exiting convAsyncResponseTorev160108Payload" );
+ logger.debug("Exiting convAsyncResponseTorev160108Payload");
return payload;
}
public static String convPayloadObjectToJsonString(Object inObj) throws ParseException {
String payloadAsString = null;
- if(inObj != null) {
+ if (inObj != null) {
- if(inObj instanceof String){
+ if (inObj instanceof String) {
payloadAsString = (String)inObj;
- }else {
+ } else {
try {
ObjectMapper objectMapper = new ObjectMapper();
payloadAsString = objectMapper.writeValueAsString(inObj);
@@ -336,13 +422,13 @@ public class Converter {
public static CommonHeader convAsyncResponseTorev160108CommonHeader(ResponseContext inObj) {
logger.debug("Entered into convAsyncResponseTorev160108CommonHeader");
CommonHeader outObj = null;
- if(inObj == null){
+ if (inObj == null) {
throw new IllegalArgumentException("empty asyncResponse");
}
CommonHeaderBuilder commonHeaderBuilder = new CommonHeaderBuilder();
org.opendaylight.yang.gen.v1.org.onap.appc.lcm.rev160108.common.header.common.header.Flags commonHeaderFlags;
- if(inObj.getCommonHeader().getFlags() != null){
+ if (inObj.getCommonHeader().getFlags() != null) {
commonHeaderFlags = Converter.convFlagsMapTorev160108Flags(inObj.getCommonHeader().getFlags());
commonHeaderBuilder.setFlags(commonHeaderFlags);
}
@@ -350,15 +436,15 @@ public class Converter {
logger.debug("Before setApiVer");
commonHeaderBuilder.setApiVer(inObj.getCommonHeader().getApiVer());
commonHeaderBuilder.setRequestId(inObj.getCommonHeader().getRequestId());
- if(inObj.getCommonHeader().getSubRequestId() != null){
+ if (inObj.getCommonHeader().getSubRequestId() != null) {
commonHeaderBuilder.setSubRequestId(inObj.getCommonHeader().getSubRequestId());
}
logger.debug("Before getOriginatorId");
- if(inObj.getCommonHeader().getOriginatorId() != null){
+ if (inObj.getCommonHeader().getOriginatorId() != null) {
commonHeaderBuilder.setOriginatorId(inObj.getCommonHeader().getOriginatorId());
}
logger.debug("Before getTimeStamp");
- if(inObj.getCommonHeader().getTimeStamp() != null){
+ if (inObj.getCommonHeader().getTimeStamp() != null) {
String zuluTimestampStr = Converter.convDateToZuluString(inObj.getCommonHeader().getTimeStamp());
logger.debug("After invoking convDateToZuluString()");
ZULU zuluTimestamp = new ZULU(zuluTimestampStr);
@@ -366,7 +452,7 @@ public class Converter {
commonHeaderBuilder.setTimestamp(zuluTimestamp);
}
outObj = commonHeaderBuilder.build();
- logger.debug("Exiting from convAsyncResponseTorev160108CommonHeader: Returning outObj::"+outObj.toString());
+ logger.debug("Exiting from convAsyncResponseTorev160108CommonHeader: Returning outObj::"+ outObj.toString());
return outObj;
}
@@ -409,7 +495,9 @@ public class Converter {
return rev160108flags;
}
- public static String convAsyncResponseToJsonStringBody(VNFOperation vnfOperation, String rpcName, ResponseContext asyncResponse) throws JsonProcessingException {
+ public static String convAsyncResponseToJsonStringBody(
+ VNFOperation vnfOperation, String rpcName, ResponseContext asyncResponse)
+ throws JsonProcessingException {
Builder<?> builder = Converter.convAsyncResponseToBuilder(vnfOperation, rpcName, asyncResponse);
Object message = builder.build();
ObjectMapper objectMapper = new ObjectMapper();
@@ -421,14 +509,21 @@ public class Converter {
objectMapper.addMixIn(ZULU.class, MixIn.class);
// .configure(SerializationConfig.Feature.SORT_PROPERTIES_ALPHABETICALLY,true)
- ObjectWriter writer = objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL).configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY,true)
- .writer(SerializationFeature.WRAP_ROOT_VALUE).withRootName(DMaaP_ROOT_VALUE).withoutFeatures(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS);
+ ObjectWriter writer = objectMapper
+ .setSerializationInclusion(JsonInclude.Include.NON_NULL)
+ .configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true)
+ .writer(SerializationFeature.WRAP_ROOT_VALUE)
+ .withRootName(DMaaP_ROOT_VALUE)
+ .withoutFeatures(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS);
return writer.writeValueAsString(message);
}
- public static String convAsyncResponseToDmaapOutgoingMessageJsonString(VNFOperation vnfOperation, String rpcName, ResponseContext asyncResponse) throws JsonProcessingException {
+ public static String convAsyncResponseToDmaapOutgoingMessageJsonString(
+ VNFOperation vnfOperation, String rpcName, ResponseContext asyncResponse)
+ throws JsonProcessingException {
logger.debug("Entered Converter.convAsyncResponseToDmaapOutgoingMessageJsonString()");
- DmaapOutgoingMessage dmaapOutgoingMessage = convAsyncResponseToDmaapOutgoingMessage(vnfOperation, rpcName, asyncResponse);
+ DmaapOutgoingMessage dmaapOutgoingMessage =
+ convAsyncResponseToDmaapOutgoingMessage(vnfOperation, rpcName, asyncResponse);
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.addMixIn(dmaapOutgoingMessage.getBody().getOutput().getClass(), MixInFlagsMessage.class);
objectMapper.addMixIn(CommonHeader.class, MixInCommonHeader.class);
@@ -438,31 +533,37 @@ public class Converter {
objectMapper.addMixIn(ZULU.class, MixIn.class);
// .configure(SerializationConfig.Feature.SORT_PROPERTIES_ALPHABETICALLY,true)
- ObjectWriter writer = objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL).configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY,true).writer();
+ ObjectWriter writer = objectMapper
+ .setSerializationInclusion(JsonInclude.Include.NON_NULL)
+ .configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true)
+ .writer();
logger.debug("Exiting Converter.convAsyncResponseToDmaapOutgoingMessageJsonString()");
return writer.writeValueAsString(dmaapOutgoingMessage);
}
- public static DmaapOutgoingMessage convAsyncResponseToDmaapOutgoingMessage(VNFOperation vnfOperation, String rpcName, ResponseContext asyncResponse) throws JsonProcessingException {
+ public static DmaapOutgoingMessage convAsyncResponseToDmaapOutgoingMessage(
+ VNFOperation vnfOperation, String rpcName, ResponseContext asyncResponse)
+ throws JsonProcessingException {
logger.debug("Entered Converter.convAsyncResponseToDmaapOutgoingMessage()");
DmaapOutgoingMessage outObj = new DmaapOutgoingMessage();
String correlationID = getCorrelationID(asyncResponse);
outObj.setCorrelationID(correlationID);
outObj.setType("response");
outObj.setRpcName(rpcName);
- logger.debug("In onverter.convAsyncResponseToDmaapOutgoingMessage() before invoking convAsyncResponseToBuilder");
+ logger.debug("In Converter.convAsyncResponseToDmaapOutgoingMessage()"
+ + " before invoking convAsyncResponseToBuilder");
Builder<?> builder = Converter.convAsyncResponseToBuilder(vnfOperation, rpcName, asyncResponse);
Object messageBody = builder.build();
DmaapOutgoingMessage.Body body = new DmaapOutgoingMessage.Body(messageBody);
outObj.setBody(body);
- logger.debug("Exiting Converter.convAsyncResponseToDmaapOutgoingMessage():messageBody is :::"+body.toString());
+ logger.debug("Exiting Converter.convAsyncResponseToDmaapOutgoingMessage(): messageBody is:" + body.toString());
return outObj;
}
private static String getCorrelationID(ResponseContext context) {
return context.getCommonHeader().getRequestId()
+ (context.getCommonHeader().getSubRequestId() == null ?
- "":"-" + context.getCommonHeader().getSubRequestId());
+ "" : "-" + context.getCommonHeader().getSubRequestId());
}
abstract class MixIn {
diff --git a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/ConverterTest.java b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/ConverterTest.java
index 0bfd4d6ad..dbba6caa1 100644
--- a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/ConverterTest.java
+++ b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/ConverterTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
* ================================================================================
@@ -11,15 +11,14 @@
* 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=========================================================
*/
@@ -54,16 +53,27 @@ public class ConverterTest {
private String expectedDmaapOutgoingMessageJsonStringUnlock ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"unlock\",\"type\":\"response\"}";
private String expectedDmaapOutgoingMessageJsonStringUpgradePreCheck ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"payload\":\"{}\",\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"upgrade-pre-check\",\"type\":\"response\"}";
private String expectedDmaapOutgoingMessageJsonStringUpgradePostCheck ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"payload\":\"{}\",\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"upgrade-post-check\",\"type\":\"response\"}";
- private String expectedDmaapOutgoingMessageJsonStringUpgradeSoftware ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"upgradesoftware\",\"type\":\"response\"}";
- private String expectedDmaapOutgoingMessageJsonStringUpgradeBackout ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"upgradebackout\",\"type\":\"response\"}";
- private String expectedDmaapOutgoingMessageJsonStringUpgradeBackup ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"upgradebackup\",\"type\":\"response\"}";
-
- private String expectedJsonBodyStrwithPayload ="{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"payload\":\"{}\",\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}}";
+ private String expectedDmaapOutgoingMessageJsonStringUpgradeSoftware ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"payload\":\"{}\",\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"upgradesoftware\",\"type\":\"response\"}";
+ private String expectedDmaapOutgoingMessageJsonStringUpgradeBackout ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"payload\":\"{}\",\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"upgradebackout\",\"type\":\"response\"}";
+ private String expectedDmaapOutgoingMessageJsonStringUpgradeBackup ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"payload\":\"{}\",\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"upgradebackup\",\"type\":\"response\"}";
private String expectedDmaapOutgoingMessageJsonStringReboot ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"reboot\",\"type\":\"response\"}";
+ private String expectedDmaapOutgoingMessageJsonStringPreConfigure ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"payload\":\"{}\",\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"pre-configure\",\"type\":\"response\"}";
+ private String expectedDmaapOutgoingMessageJsonStringGetConfig ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"payload\":\"{}\",\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"get-config\",\"type\":\"response\"}";
+ private String expectedJsonBodyStrwithPayload ="{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"payload\":\"{}\",\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}}";
private String expectedDmaapOutgoingMessageJsonStringDistributeTraffic = "{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"distribute-traffic\",\"type\":\"response\"}";
private String expectedDmaapOutgoingMessageJsonStringDistributeTrafficCheck = "{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"distribute-traffic-check\",\"type\":\"response\"}";
-
-
+ private String expectedDmaapOutgoingMessageJsonStringPreRebuild ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"payload\":\"{}\",\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"pre-rebuild\",\"type\":\"response\"}";
+ private String expectedDmaapOutgoingMessageJsonStringPostRebuild ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"payload\":\"{}\",\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"post-rebuild\",\"type\":\"response\"}";
+ private String expectedDmaapOutgoingMessageJsonStringPreEvacuate ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"payload\":\"{}\",\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"pre-evacuate\",\"type\":\"response\"}";
+ private String expectedDmaapOutgoingMessageJsonStringPreMigrate ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"payload\":\"{}\",\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"pre-migrate\",\"type\":\"response\"}";
+ private String expectedDmaapOutgoingMessageJsonStringPostMigrate ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"payload\":\"{}\",\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"post-migrate\",\"type\":\"response\"}";
+ private String expectedDmaapOutgoingMessageJsonStringPostEvacuate ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"payload\":\"{}\",\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"post-evacuate\",\"type\":\"response\"}";
+ private String expectedDmaapOutgoingMessageJsonStringLicenseManagement ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"payload\":\"{}\",\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"license-management\",\"type\":\"response\"}";
+ private String expectedDmaapOutgoingMessageJsonStringStartTraffic ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"payload\":\"{}\",\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"start-traffic\",\"type\":\"response\"}";
+ private String expectedDmaapOutgoingMessageJsonStringStatusTraffic ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"payload\":\"{}\",\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"status-traffic\",\"type\":\"response\"}";
+ private String expectedDmaapOutgoingMessageJsonStringStopTraffic ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"payload\":\"{}\",\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"stop-traffic\",\"type\":\"response\"}";
+ private String expectedDmaapOutgoingMessageJsonStringProvisioning ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"payload\":\"{}\",\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"provisioning\",\"type\":\"response\"}";
+
@Test
public void convDateToZuluStringTest(){
String dateToZuluString = Converter.convDateToZuluString(new Date(0L));
@@ -76,7 +86,7 @@ public class ConverterTest {
VNFOperation action = VNFOperation.Test;
String rpcName = action.name().toLowerCase();
String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
- Assert.assertEquals(expectedJsonBodyStr,jsonStr);
+ Assert.assertEquals(expectedJsonBodyStr, jsonStr);
}
@Test
@@ -86,7 +96,7 @@ public class ConverterTest {
String rpcName = action.name().toLowerCase();
String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
System.out.println("jsonStr = " + jsonStr);
- Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringTest,jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringTest, jsonStr);
}
@Test
@@ -106,7 +116,7 @@ public class ConverterTest {
VNFOperation action = VNFOperation.Rollback;
String rpcName = action.name().toLowerCase();
String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
- Assert.assertEquals(expectedJsonBodyStr,jsonStr);
+ Assert.assertEquals(expectedJsonBodyStr, jsonStr);
}
@Test
@@ -116,7 +126,7 @@ public class ConverterTest {
String rpcName = action.name().toLowerCase();
String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
System.out.println("jsonStr = " + jsonStr);
- Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringRollback,jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringRollback, jsonStr);
}
@Test
@@ -125,7 +135,7 @@ public class ConverterTest {
VNFOperation action = VNFOperation.Snapshot;
String rpcName = action.name().toLowerCase();
String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
- Assert.assertEquals(expectedJsonBodyStr,jsonStr);
+ Assert.assertEquals(expectedJsonBodyStr, jsonStr);
}
@Test
@@ -135,7 +145,7 @@ public class ConverterTest {
String rpcName = action.name().toLowerCase();
String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
System.out.println("jsonStr = " + jsonStr);
- Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringSnapshot,jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringSnapshot, jsonStr);
}
@Test
public void convAsyncResponseToBuilderAuditTest() throws JsonProcessingException {
@@ -143,7 +153,7 @@ public class ConverterTest {
VNFOperation action = VNFOperation.Audit;
String rpcName = action.name().toLowerCase();
String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
- Assert.assertEquals(expectedJsonBodyStrwithPayload,jsonStr);
+ Assert.assertEquals(expectedJsonBodyStrwithPayload, jsonStr);
}
@Test
@@ -153,7 +163,7 @@ public class ConverterTest {
String rpcName = action.name().toLowerCase();
String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
System.out.println("jsonStr = " + jsonStr);
- Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringAudit,jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringAudit, jsonStr);
}
@Test
public void convAsyncResponseToBuilderHealthCheckTest() throws JsonProcessingException {
@@ -161,7 +171,7 @@ public class ConverterTest {
VNFOperation action = VNFOperation.HealthCheck;
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
- Assert.assertEquals(expectedJsonBodyStrwithPayload,jsonStr);
+ Assert.assertEquals(expectedJsonBodyStrwithPayload, jsonStr);
}
@Test
@@ -171,7 +181,7 @@ public class ConverterTest {
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
System.out.println("jsonStr = " + jsonStr);
- Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringHealthCheck,jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringHealthCheck, jsonStr);
}
@Test
public void convAsyncResponseToBuilderLiveUpgradeTest() throws JsonProcessingException {
@@ -179,7 +189,7 @@ public class ConverterTest {
VNFOperation action = VNFOperation.LiveUpgrade;
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
- Assert.assertEquals(expectedJsonBodyStr,jsonStr);
+ Assert.assertEquals(expectedJsonBodyStr, jsonStr);
}
@Test
@@ -189,7 +199,7 @@ public class ConverterTest {
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
System.out.println("jsonStr = " + jsonStr);
- Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringLiveUpgrade,jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringLiveUpgrade, jsonStr);
}
@Test
public void convAsyncResponseToBuilderLockTest() throws JsonProcessingException {
@@ -198,7 +208,7 @@ public class ConverterTest {
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
- Assert.assertEquals(expectedJsonBodyStr,jsonStr);
+ Assert.assertEquals(expectedJsonBodyStr, jsonStr);
}
@Test
@@ -208,7 +218,7 @@ public class ConverterTest {
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
System.out.println("jsonStr = " + jsonStr);
- Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringLock,jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringLock, jsonStr);
}
@Test
public void convAsyncResponseToBuilderModifyConfigTest() throws JsonProcessingException {
@@ -216,7 +226,7 @@ public class ConverterTest {
VNFOperation action = VNFOperation.ConfigModify;
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
- Assert.assertEquals(expectedJsonBodyStrwithPayload,jsonStr);
+ Assert.assertEquals(expectedJsonBodyStrwithPayload, jsonStr);
}
@Test
@@ -226,7 +236,7 @@ public class ConverterTest {
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
System.out.println("jsonStr = " + jsonStr);
- Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringModifyConfig,jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringModifyConfig, jsonStr);
}
@Test
public void convAsyncResponseToBuilderSoftwareUploadTest() throws JsonProcessingException {
@@ -235,7 +245,7 @@ public class ConverterTest {
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
- Assert.assertEquals(expectedJsonBodyStr,jsonStr);
+ Assert.assertEquals(expectedJsonBodyStr, jsonStr);
}
@Test
@@ -245,15 +255,16 @@ public class ConverterTest {
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
System.out.println("jsonStr = " + jsonStr);
- Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringSoftwareUpload,jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringSoftwareUpload, jsonStr);
}
+
@Test
public void convAsyncResponseToBuilderStopTest() throws JsonProcessingException {
ResponseContext asyncResponse = buildAsyncResponse();
VNFOperation action = VNFOperation.Stop;
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
- Assert.assertEquals(expectedJsonBodyStr,jsonStr);
+ Assert.assertEquals(expectedJsonBodyStr, jsonStr);
}
@Test
@@ -263,8 +274,9 @@ public class ConverterTest {
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
System.out.println("jsonStr = " + jsonStr);
- Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringStop,jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringStop, jsonStr);
}
+
@Test
public void convAsyncResponseToBuilderSync() throws JsonProcessingException {
ResponseContext asyncResponse = buildAsyncResponsewithPayload();
@@ -272,7 +284,7 @@ public class ConverterTest {
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
- Assert.assertEquals(expectedJsonBodyStrwithPayload,jsonStr);
+ Assert.assertEquals(expectedJsonBodyStrwithPayload, jsonStr);
}
@Test
@@ -282,7 +294,7 @@ public class ConverterTest {
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
System.out.println("jsonStr = " + jsonStr);
- Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringSync,jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringSync, jsonStr);
}
@Test
public void convAsyncResponseToBuilderTerminateTest() throws JsonProcessingException {
@@ -290,7 +302,7 @@ public class ConverterTest {
VNFOperation action = VNFOperation.Sync;
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
- Assert.assertEquals(expectedJsonBodyStrwithPayload,jsonStr);
+ Assert.assertEquals(expectedJsonBodyStrwithPayload, jsonStr);
}
@Test
@@ -300,15 +312,16 @@ public class ConverterTest {
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
System.out.println("jsonStr = " + jsonStr);
- Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringTerminate,jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringTerminate, jsonStr);
}
+
@Test
public void convAsyncResponseToBuilderUnlockTest() throws JsonProcessingException {
ResponseContext asyncResponse = buildAsyncResponse();
VNFOperation action = VNFOperation.Unlock;
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
- Assert.assertEquals(expectedJsonBodyStr,jsonStr);
+ Assert.assertEquals(expectedJsonBodyStr, jsonStr);
}
@Test
@@ -318,8 +331,9 @@ public class ConverterTest {
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
System.out.println("jsonStr = " + jsonStr);
- Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringUnlock,jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringUnlock, jsonStr);
}
+
@Test
public void convAsyncResponseToBuilderRebootTest() throws JsonProcessingException {
ResponseContext asyncResponse = buildAsyncResponse();
@@ -327,7 +341,7 @@ public class ConverterTest {
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
- Assert.assertEquals(expectedJsonBodyStr,jsonStr);
+ Assert.assertEquals(expectedJsonBodyStr, jsonStr);
}
@Test
@@ -337,15 +351,16 @@ public class ConverterTest {
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
System.out.println("jsonStr = " + jsonStr);
- Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringReboot,jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringReboot, jsonStr);
}
+
@Test
public void convAsyncResponseToBuilderUpgradePreCheckTest() throws JsonProcessingException {
ResponseContext asyncResponse = buildAsyncResponsewithPayload();
VNFOperation action = VNFOperation.UpgradePreCheck;
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
- Assert.assertEquals(expectedJsonBodyStrwithPayload,jsonStr);
+ Assert.assertEquals(expectedJsonBodyStrwithPayload, jsonStr);
}
@Test
@@ -355,7 +370,7 @@ public class ConverterTest {
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
System.out.println("jsonStr = " + jsonStr);
- Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringUpgradePreCheck,jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringUpgradePreCheck, jsonStr);
}
@Test
@@ -364,7 +379,7 @@ public class ConverterTest {
VNFOperation action = VNFOperation.UpgradePostCheck;
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
- Assert.assertEquals(expectedJsonBodyStrwithPayload,jsonStr);
+ Assert.assertEquals(expectedJsonBodyStrwithPayload, jsonStr);
}
@Test
@@ -374,62 +389,101 @@ public class ConverterTest {
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
System.out.println("jsonStr = " + jsonStr);
- Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringUpgradePostCheck,jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringUpgradePostCheck, jsonStr);
}
+
@Test
public void convAsyncResponseToBuilderUpgradeSoftwareTest() throws JsonProcessingException {
- ResponseContext asyncResponse = buildAsyncResponse();
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
VNFOperation action = VNFOperation.UpgradeSoftware;
String rpcName = action.name().toLowerCase();
String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
- Assert.assertEquals(expectedJsonBodyStr,jsonStr);
+ Assert.assertEquals(expectedJsonBodyStrwithPayload, jsonStr);
}
@Test
public void convAsyncResponseToDmaapOutgoingMessageJsonStringUpgradeSoftwareTest() throws JsonProcessingException {
- ResponseContext asyncResponse = buildAsyncResponse();
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
VNFOperation action = VNFOperation.UpgradeSoftware;
String rpcName = action.name().toLowerCase();
String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
System.out.println("jsonStr = " + jsonStr);
- Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringUpgradeSoftware,jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringUpgradeSoftware, jsonStr);
}
-
@Test
public void convAsyncResponseToBuilderUpgradeBackoutTest() throws JsonProcessingException {
- ResponseContext asyncResponse = buildAsyncResponse();
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
VNFOperation action = VNFOperation.UpgradeBackout;
String rpcName = action.name().toLowerCase();
String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
- Assert.assertEquals(expectedJsonBodyStr,jsonStr);
+ Assert.assertEquals(expectedJsonBodyStrwithPayload, jsonStr);
}
@Test
public void convAsyncResponseToDmaapOutgoingMessageJsonStringUpgradeBackoutTest() throws JsonProcessingException {
- ResponseContext asyncResponse = buildAsyncResponse();
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
VNFOperation action = VNFOperation.UpgradeBackout;
String rpcName = action.name().toLowerCase();
String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
System.out.println("jsonStr = " + jsonStr);
- Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringUpgradeBackout,jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringUpgradeBackout, jsonStr);
}
@Test
public void convAsyncResponseToBuilderUpgradeBackupTest() throws JsonProcessingException {
- ResponseContext asyncResponse = buildAsyncResponse();
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
VNFOperation action = VNFOperation.UpgradeBackup;
String rpcName = action.name().toLowerCase();
String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
- Assert.assertEquals(expectedJsonBodyStr,jsonStr);
+ Assert.assertEquals(expectedJsonBodyStrwithPayload, jsonStr);
}
@Test
public void convAsyncResponseToDmaapOutgoingMessageJsonStringUpgradeBackupTest() throws JsonProcessingException {
- ResponseContext asyncResponse = buildAsyncResponse();
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
VNFOperation action = VNFOperation.UpgradeBackup;
String rpcName = action.name().toLowerCase();
String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
System.out.println("jsonStr = " + jsonStr);
- Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringUpgradeBackup,jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringUpgradeBackup, jsonStr);
+ }
+ @Test
+ public void convAsyncResponseToBuilderPreConfigureTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.PreConfigure;
+ String rpcName = convertActionNameToUrl(action.name());
+
+ String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
+ Assert.assertEquals(expectedJsonBodyStrwithPayload, jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToDmaapOutgoingMessageJsonStringPreConfigureTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.PreConfigure;
+ String rpcName = convertActionNameToUrl(action.name());
+ String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
+ System.out.println("jsonStr = " + jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringPreConfigure, jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToBuilderGetConfigTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.GetConfig;
+ String rpcName = convertActionNameToUrl(action.name());
+
+ String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
+ Assert.assertEquals(expectedJsonBodyStrwithPayload, jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToDmaapOutgoingMessageJsonStringGetConfigTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.GetConfig;
+ String rpcName = convertActionNameToUrl(action.name());
+ String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
+ System.out.println("jsonStr = " + jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringGetConfig, jsonStr);
}
@Test
@@ -438,33 +492,259 @@ public class ConverterTest {
VNFOperation action = VNFOperation.DistributeTraffic;
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
- Assert.assertEquals(expectedJsonBodyStr,jsonStr);
+ Assert.assertEquals(expectedJsonBodyStr, jsonStr);
}
@Test
- public void convAsyncResponseToDmaapOutgoingMessageJsonStringDistributeTrafficTest() throws JsonProcessingException {
+ public void convAsyncResponseToDmaapOutgoingMessageJsonStringDistributeTrafficTest()
+ throws JsonProcessingException {
ResponseContext asyncResponse = buildAsyncResponse();
VNFOperation action = VNFOperation.DistributeTraffic;
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
System.out.println("jsonStr = " + jsonStr);
- Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringDistributeTraffic,jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringDistributeTraffic, jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToBuilderDistributeTrafficCheckTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponse();
+ VNFOperation action = VNFOperation.DistributeTrafficCheck;
+ String rpcName = convertActionNameToUrl(action.name());
+ String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
+ Assert.assertEquals(expectedJsonBodyStr, jsonStr);
}
@Test
- public void convAsyncResponseToDmaapOutgoingMessageJsonStringDistributeTrafficCheckTest() throws JsonProcessingException {
+ public void convAsyncResponseToDmaapOutgoingMessageJsonStringDistributeTrafficCheckTest()
+ throws JsonProcessingException {
ResponseContext asyncResponse = buildAsyncResponse();
VNFOperation action = VNFOperation.DistributeTrafficCheck;
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
- Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringDistributeTrafficCheck,jsonStr);
+ System.out.println("jsonStr = " + jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringDistributeTrafficCheck, jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToBuilderPreRebuildTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.PreRebuild;
+ String rpcName = convertActionNameToUrl(action.name());
+
+ String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
+ Assert.assertEquals(expectedJsonBodyStrwithPayload, jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToDmaapOutgoingMessageJsonStringPreRebuildTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.PreRebuild;
+ String rpcName = convertActionNameToUrl(action.name());
+ String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
+ System.out.println("jsonStr = " + jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringPreRebuild, jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToBuilderPostRebuildTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.PostRebuild;
+ String rpcName = convertActionNameToUrl(action.name());
+
+ String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
+ Assert.assertEquals(expectedJsonBodyStrwithPayload, jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToDmaapOutgoingMessageJsonStringPostRebuildTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.PostRebuild;
+ String rpcName = convertActionNameToUrl(action.name());
+ String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
+ System.out.println("jsonStr = " + jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringPostRebuild, jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToBuilderPreEvacuateTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.PreEvacuate;
+ String rpcName = convertActionNameToUrl(action.name());
+ String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
+ Assert.assertEquals(expectedJsonBodyStrwithPayload, jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToDmaapOutgoingMessageJsonStringPreEvacuateTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.PreEvacuate;
+ String rpcName = convertActionNameToUrl(action.name());
+ String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
+ System.out.println("jsonStr = " + jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringPreEvacuate, jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToBuilderPreMigrateTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.PreMigrate;
+ String rpcName = convertActionNameToUrl(action.name());
+
+ String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
+ Assert.assertEquals(expectedJsonBodyStrwithPayload, jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToDmaapOutgoingMessageJsonStringPreMigrateTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.PreMigrate;
+ String rpcName = convertActionNameToUrl(action.name());
+ String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
+ System.out.println("jsonStr = " + jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringPreMigrate, jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToBuilderPostMigrateTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.PostMigrate;
+ String rpcName = convertActionNameToUrl(action.name());
+
+ String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
+ Assert.assertEquals(expectedJsonBodyStrwithPayload, jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToDmaapOutgoingMessageJsonStringPostMigrateTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.PostMigrate;
+ String rpcName = convertActionNameToUrl(action.name());
+ String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
+ System.out.println("jsonStr = " + jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringPostMigrate, jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToBuilderPostEvacuateTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.PostEvacuate;
+ String rpcName = convertActionNameToUrl(action.name());
+
+ String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
+ Assert.assertEquals(expectedJsonBodyStrwithPayload, jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToDmaapOutgoingMessageJsonStringPostEvacuateTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.PostEvacuate;
+ String rpcName = convertActionNameToUrl(action.name());
+ String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
+ System.out.println("jsonStr = " + jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringPostEvacuate, jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToBuilderStartTrafficTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.StartTraffic;
+ String rpcName = convertActionNameToUrl(action.name());
+
+ String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
+ Assert.assertEquals(expectedJsonBodyStrwithPayload, jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToDmaapOutgoingMessageJsonStringStartTrafficTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.StartTraffic;
+ String rpcName = convertActionNameToUrl(action.name());
+ String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
+ System.out.println("jsonStr = " + jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringStartTraffic, jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToBuilderStatusTrafficTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.StatusTraffic;
+ String rpcName = convertActionNameToUrl(action.name());
+ String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
+ Assert.assertEquals(expectedJsonBodyStrwithPayload, jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToDmaapOutgoingMessageJsonStringStatusTrafficTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.StatusTraffic;
+ String rpcName = convertActionNameToUrl(action.name());
+ String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
+ System.out.println("jsonStr = " + jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringStatusTraffic, jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToDmaapOutgoingMessageJsonStringLicenseManagementTest()
+ throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.LicenseManagement;
+ String rpcName = convertActionNameToUrl(action.name());
+ String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
+ System.out.println("jsonStr = " + jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringLicenseManagement,jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToBuilderLicenseManagementTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.LicenseManagement;
+ String rpcName = convertActionNameToUrl(action.name());
+ String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
+ Assert.assertEquals(expectedJsonBodyStrwithPayload,jsonStr);
+ }
+ @Test
+ public void convAsyncResponseToDmaapOutgoingMessageJsonStringProvisioningTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.Provisioning;
+ String rpcName = convertActionNameToUrl(action.name());
+ String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
+ System.out.println("jsonStr = " + jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringProvisioning,jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToBuilderProvisioningTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.Provisioning;
+ String rpcName = convertActionNameToUrl(action.name());
+ String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
+ Assert.assertEquals(expectedJsonBodyStrwithPayload,jsonStr);
+ }
+ @Test
+ public void convAsyncResponseToBuilderStopTrafficTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.StopTraffic;
+ String rpcName = convertActionNameToUrl(action.name());
+ String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
+ Assert.assertEquals(expectedJsonBodyStrwithPayload, jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToDmaapOutgoingMessageJsonStringStopTrafficTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.StopTraffic;
+ String rpcName = convertActionNameToUrl(action.name());
+ String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
+ System.out.println("jsonStr = " + jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringStopTraffic, jsonStr);
}
/*@Test
public void convAsyncResponseToBuilderTest() throws JsonProcessingException {
AsyncResponse asyncResponse = buildAsyncResponse();
String jsonStr = Converter.convAsyncResponseToJsonStringBody(asyncResponse);
- Assert.assertEquals(expectedJsonBodyStr,jsonStr);
+ Assert.assertEquals(expectedJsonBodyStr, jsonStr);
}
@Test
@@ -472,7 +752,7 @@ public class ConverterTest {
AsyncResponse asyncResponse = buildAsyncResponse();
String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(asyncResponse);
System.out.println("jsonStr = " + jsonStr);
- Assert.assertEquals(expectedDmaapOutgoingMessageJsonString,jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonString, jsonStr);
}*/
@@ -484,7 +764,8 @@ public class ConverterTest {
asyncResponse.getCommonHeader().setApiVer("2.0.0");
asyncResponse.getCommonHeader().setRequestId("reqid");
asyncResponse.getCommonHeader().setTimestamp(new Date(1000L));
- asyncResponse.setPayload("any valid JSON string value. Json escape characters need to be added to make it a valid json string value");
+ asyncResponse.setPayload(
+ "any valid JSON string value. Json escape characters need to be added to make it a valid json string value");
return asyncResponse;
}
@@ -521,6 +802,3 @@ public class ConverterTest {
}
-
-
-