summaryrefslogtreecommitdiffstats
path: root/appc-inbound/appc-artifact-handler/provider/src/test/java
diff options
context:
space:
mode:
authorDunietz, Irwin <id1681@att.com>2020-01-16 15:13:14 -0500
committerTakamune Cho <takamune.cho@att.com>2020-01-29 19:44:48 +0000
commitb5fe8a69e90b950c07dc11af481eab7e9bab52c6 (patch)
tree3da81ce60554e65b93776b9aea647f3c6d8679ab /appc-inbound/appc-artifact-handler/provider/src/test/java
parent9b32cb60360a2a2973c621053510718de0072111 (diff)
Change code in appc dispatcher for new LCMs in R6
Also introduce some minor improvements to robustness, efficiency, & formatting. Issue-ID: APPC-1789 Signed-off-by: Dunietz, Irwin <id1681@att.com> Change-Id: I82d970c2f7cde6c8dab1222af86ea70ce93b7e50
Diffstat (limited to 'appc-inbound/appc-artifact-handler/provider/src/test/java')
-rw-r--r--appc-inbound/appc-artifact-handler/provider/src/test/java/org/onap/appc/artifact/handler/node/ArtifactHandlerNodeTest.java305
-rw-r--r--appc-inbound/appc-artifact-handler/provider/src/test/java/org/onap/appc/artifact/handler/utils/ArtifactHandlerProviderUtilTest.java24
2 files changed, 194 insertions, 135 deletions
diff --git a/appc-inbound/appc-artifact-handler/provider/src/test/java/org/onap/appc/artifact/handler/node/ArtifactHandlerNodeTest.java b/appc-inbound/appc-artifact-handler/provider/src/test/java/org/onap/appc/artifact/handler/node/ArtifactHandlerNodeTest.java
index cb3a4625d..98df4d299 100644
--- a/appc-inbound/appc-artifact-handler/provider/src/test/java/org/onap/appc/artifact/handler/node/ArtifactHandlerNodeTest.java
+++ b/appc-inbound/appc-artifact-handler/provider/src/test/java/org/onap/appc/artifact/handler/node/ArtifactHandlerNodeTest.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
* ================================================================================
@@ -76,7 +76,8 @@ public class ArtifactHandlerNodeTest {
artifactHandlerNode = Mockito.spy(new ArtifactHandlerNode());
PowerMockito.mockStatic(DBService.class);
dbServiceMock = Mockito.mock(DBService.class);
- Mockito.doReturn("12345").when(dbServiceMock).getInternalVersionNumber(Mockito.any(), Mockito.anyString(), Mockito.anyString());
+ Mockito.doReturn("12345")
+ .when(dbServiceMock).getInternalVersionNumber(Mockito.any(), Mockito.anyString(), Mockito.anyString());
PowerMockito.when(DBService.initialise()).thenReturn(dbServiceMock);
PowerMockito.mockStatic(YANGGeneratorFactory.class);
YANGGenerator yangGeneratorMock = Mockito.mock(YANGGenerator.class);
@@ -97,7 +98,7 @@ public class ArtifactHandlerNodeTest {
JSONObject documentInfo = getDocumentInfo("templates/reference_template");
documentInfo.put(SdcArtifactHandlerConstants.ARTIFACT_NAME, "reference_Junit.json");
requestInfo.put("RequestInfo", "testValue");
- requestInfo.put("request-id","testREQUEST_ID");
+ requestInfo.put("request-id", "testREQUEST_ID");
input.put(SdcArtifactHandlerConstants.DOCUMENT_PARAMETERS, documentInfo);
input.put(SdcArtifactHandlerConstants.REQUEST_INFORMATION, requestInfo);
postData.put("input", input);
@@ -139,25 +140,39 @@ public class ArtifactHandlerNodeTest {
String artifactId = "1";
String yangContents = "SomeContent";
Whitebox.invokeMethod(artifactHandlerNode, "updateYangContents", artifactId, yangContents);
- Mockito.verify(dbServiceMock).updateYangContents(Mockito.any(SvcLogicContext.class),
- Mockito.anyString(), Mockito.anyString());
+ Mockito.verify(dbServiceMock)
+ .updateYangContents(Mockito.any(SvcLogicContext.class), Mockito.anyString(), Mockito.anyString());
}
@Test
public void testProcessVmList() throws Exception{
String contentStr = "{\r\n\t\"action\": \"ConfigScaleOut\",\r\n\t\"action-level\": \"VNF\",\r\n\t\"scope\": "
- + "{\r\n\t\t\"vnf-type\": \"ScaleOutVNF\",\r\n\t\t\"vnfc-type\": \"\"\r\n\t},\r\n\t\"template\": \"Y\",\r\n\t\"vm\": "
- + "[\r\n\t{ \r\n\t\t\"vm-instance\": 1,\r\n\t\t\"template-id\":\"id1\",\r\n\t\t\r\n\t\t\"vnfc\": [{\r\n\t\t\t\"vnfc-instance\": 1,\r\n\t\t\t\"vnfc-type\": \"t1\",\r\n\t\t\t\"vnfc-function-code\": "
- + "\"Testdbg\",\r\n\t\t\t\"group-notation-type\": \"GNType\",\r\n\t\t\t\"ipaddress-v4-oam-vip\": \"N\",\r\n\t\t\t\"group-notation-value\": "
- + "\"GNValue\"\r\n\t\t}]\r\n\t},\r\n\t{ \r\n\t\t\"vm-instance\": 1,\r\n\t\t\"template-id\":\"id2\",\r\n\t\t\r\n\t\t\"vnfc\": [{\r\n\t\t\t\"vnfc-instance\": 1,\r\n\t\t\t\"vnfc-type\": "
- + "\"t1\",\r\n\t\t\t\"vnfc-function-code\": \"Testdbg\",\r\n\t\t\t\"group-notation-type\": \"GNType\",\r\n\t\t\t\"ipaddress-v4-oam-vip\": \"N\",\r\n\t\t\t\"group-notation-value\": "
- + "\"GNValue\"\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"vnfc-instance\": 2,\r\n\t\t\t\"vnfc-type\": \"t2\",\r\n\t\t\t\"vnfc-function-code\": \"Testdbg\",\r\n\t\t\t\"group-notation-type\": "
- + "\"GNType\",\r\n\t\t\t\"ipaddress-v4-oam-vip\": \"Y\",\r\n\t\t\t\"group-notation-value\": \"GNValue\"\r\n\t\t}]\r\n\t},\r\n\t{\r\n\t\t\"vm-instance\": 2,\r\n\t\t\"template-id\":\"id3\",\r\n\t\t\"vnfc\": "
- + "[{\r\n\t\t\t\"vnfc-instance\": 1,\r\n\t\t\t\"vnfc-type\": \"t3\",\r\n\t\t\t\"vnfc-function-code\": \"Testdbg\",\r\n\t\t\t\"group-notation-type\": "
- + "\"GNType\",\r\n\t\t\t\"ipaddress-v4-oam-vip\": \"Y\",\r\n\t\t\t\"group-notation-value\": \"GNValue\"\r\n\t\t}]\r\n\t}],\r\n\t\"device-protocol\": "
- + "\"TEST-PROTOCOL\",\r\n\t\"user-name\": \"Testnetconf\",\r\n\t\"port-number\": \"22\",\r\n\t\"artifact-list\": [{\r\n\t\t\"artifact-name\": \"Testv_template.json\",\r\n\t\t\"artifact-type\": "
- + "\"Testconfig_template\"\r\n\t},\r\n\t{\r\n\t\t\"artifact-name\": \"TESTv_parameter_definitions.json\",\r\n\t\t\"artifact-type\": \"Testparameter_definitions\"\r\n\t},\r\n\t{\r\n\t\t\"artifact-name\": "
- + "\"PD_JunitTESTv_parameter_yang.json\",\r\n\t\t\"artifact-type\": \"PD_definations\"\r\n\t}]\r\n}";
+ + "{\r\n\t\t\"vnf-type\": \"ScaleOutVNF\",\r\n\t\t\"vnfc-type\": \"\"\r\n\t},\r\n"
+ + "\t\"template\": \"Y\",\r\n\t\"vm\": "
+ + "[\r\n\t{ \r\n\t\t\"vm-instance\": 1,\r\n\t\t\"template-id\":\"id1\",\r\n\t\t\r\n\t\t\"vnfc\": "
+ + "[{\r\n\t\t\t\"vnfc-instance\": 1,\r\n\t\t\t\"vnfc-type\": \"t1\",\r\n\t\t\t\"vnfc-function-code\": "
+ + "\"Testdbg\",\r\n\t\t\t\"group-notation-type\": \"GNType\",\r\n"
+ + "\t\t\t\"ipaddress-v4-oam-vip\": \"N\",\r\n"
+ + "\t\t\t\"group-notation-value\": \"GNValue\"\r\n\t\t}]\r\n\t},\r\n"
+ + "\t{ \r\n\t\t\"vm-instance\": 1,\r\n\t\t\"template-id\":\"id2\",\r\n"
+ + "\t\t\r\n\t\t\"vnfc\": [{\r\n\t\t\t\"vnfc-instance\": 1,\r\n\t\t\t\"vnfc-type\": \"t1\",\r\n"
+ + "\t\t\t\"vnfc-function-code\": \"Testdbg\",\r\n\t\t\t\"group-notation-type\": \"GNType\",\r\n"
+ + "\t\t\t\"ipaddress-v4-oam-vip\": \"N\",\r\n\t\t\t\"group-notation-value\": \"GNValue\"\r\n\t\t},\r\n"
+ + "\t\t{\r\n\t\t\t\"vnfc-instance\": 2,\r\n\t\t\t\"vnfc-type\": \"t2\",\r\n"
+ + "\t\t\t\"vnfc-function-code\": \"Testdbg\",\r\n\t\t\t\"group-notation-type\": \"GNType\",\r\n"
+ + "\t\t\t\"ipaddress-v4-oam-vip\": \"Y\",\r\n\t\t\t\"group-notation-value\": \"GNValue\"\r\n\t\t}]\r\n"
+ + "\t},\r\n\t{\r\n\t\t\"vm-instance\": 2,\r\n\t\t\"template-id\":\"id3\",\r\n"
+ + "\t\t\"vnfc\": [{\r\n\t\t\t\"vnfc-instance\": 1,\r\n\t\t\t\"vnfc-type\": \"t3\",\r\n"
+ + "\t\t\t\"vnfc-function-code\": \"Testdbg\",\r\n\t\t\t\"group-notation-type\": \"GNType\",\r\n"
+ + "\t\t\t\"ipaddress-v4-oam-vip\": \"Y\",\r\n\t\t\t\"group-notation-value\": \"GNValue\"\r\n\t\t}]\r\n"
+ + "\t}],\r\n\t\"device-protocol\": \"TEST-PROTOCOL\",\r\n\t\"user-name\": \"Testnetconf\",\r\n"
+ + "\t\"port-number\": \"22\",\r\n\t\"artifact-list\": [{\r\n"
+ + "\t\t\"artifact-name\": \"Testv_template.json\",\r\n"
+ + "\t\t\"artifact-type\": \"Testconfig_template\"\r\n\t},\r\n"
+ + "\t{\r\n\t\t\"artifact-name\": \"TESTv_parameter_definitions.json\",\r\n"
+ + "\t\t\"artifact-type\": \"Testparameter_definitions\"\r\n\t},\r\n\t{\r\n"
+ + "\t\t\"artifact-name\": \"PD_JunitTESTv_parameter_yang.json\",\r\n"
+ + "\t\t\"artifact-type\": \"PD_definations\"\r\n\t}]\r\n}";
JSONObject content=new JSONObject(contentStr);
MockDBService dbService = MockDBService.initialise();
SvcLogicContext context = new SvcLogicContext();
@@ -165,20 +180,20 @@ public class ArtifactHandlerNodeTest {
}
@Test
- public void testProcessConfigTypeActions() throws Exception{
+ public void testProcessConfigTypeActions() throws Exception {
String contentStr = "{\"action\": \"ConfigScaleOut\"}";
- JSONObject content=new JSONObject(contentStr);
+ JSONObject content = new JSONObject(contentStr);
MockDBService dbService = MockDBService.initialise();
SvcLogicContext context = new SvcLogicContext();
- context.setAttribute(SdcArtifactHandlerConstants.DEVICE_PROTOCOL,"Test");
+ context.setAttribute(SdcArtifactHandlerConstants.DEVICE_PROTOCOL, "Test");
artifactHandlerNode.processConfigTypeActions(content, dbService, context);
}
@Test
public void testProcessActionLists() throws Exception {
String contentStr = "{\r\n\t\"action\": \"HealthCheck\",\r\n\t\"action-level\": \"vm\",\r\n\t\"scope\":"
- + " {\r\n\t\t\"vnf-type\": \"vDBE-I\",\r\n\t\t\"vnfc-type\": null\r\n\t},\r\n\t\"template\": "
- + "\"N\",\r\n\t\"device-protocol\": \"REST\",\r\n\t\"vnfc-function-code-list\": [\"SSC\", \"MMSC\"]\r\n}";
+ + " {\r\n\t\t\"vnf-type\": \"vDBE-I\",\r\n\t\t\"vnfc-type\": null\r\n\t},\r\n\t\"template\": \"N\",\r\n"
+ + "\t\"device-protocol\": \"REST\",\r\n\t\"vnfc-function-code-list\": [\"SSC\", \"MMSC\"]\r\n}";
JSONObject content = new JSONObject(contentStr);
JSONArray vmActionVnfcFunctionCodesList = new JSONArray();
JSONArray vnfActionList = new JSONArray();
@@ -193,8 +208,8 @@ public class ArtifactHandlerNodeTest {
@Test
public void testIsCapabilityArtifactNeeded() throws Exception {
- String scopeObjStr1= "{\"vnf-type\":\"someVnf\",\"vnfc-type\":\"somVnfc\"}";
- String scopeObjStr2= "{\"vnf-type\":\"someVnf\",\"vnfc-type\":\"\"}";
+ String scopeObjStr1 = "{\"vnf-type\":\"someVnf\",\"vnfc-type\":\"somVnfc\"}";
+ String scopeObjStr2 = "{\"vnf-type\":\"someVnf\",\"vnfc-type\":\"\"}";
JSONObject scope1 = new JSONObject(scopeObjStr1);
JSONObject scope2 = new JSONObject(scopeObjStr2);
SvcLogicContext context = new SvcLogicContext();
@@ -206,20 +221,30 @@ public class ArtifactHandlerNodeTest {
@Test
public void testProcessArtifactListsWithMultipleTemplates() throws Exception {
- String contentStr = "{\r\n\t\t\"action\": \"ConfigScaleOut\",\r\n\t\t\"action-level\": \"vnf\",\r\n\t\t\"scope\": {\r\n\t\t\t\"vnf-type\": "
- + "\"vCfgSO-0405\",\r\n\t\t\t\"vnfc-type\": \"\"\r\n\t\t},\r\n\t\t\"template\": \"Y\",\r\n\t\t\"vm\": [{\r\n\t\t\t\"template-id\": "
- + "\"TID-0405-EZ\",\r\n\t\t\t\"vm-instance\": 1,\r\n\t\t\t\"vnfc\": [{\r\n\t\t\t\t\"vnfc-instance\": \"1\",\r\n\t\t\t\t\"vnfc-function-code\": "
- + "\"Cfg-ez\",\r\n\t\t\t\t\"ipaddress-v4-oam-vip\": \"Y\",\r\n\t\t\t\t\"group-notation-type\": \"first-vnfc-name\",\r\n\t\t\t\t\"group-notation-value\":"
- + " \"pair\",\r\n\t\t\t\t\"vnfc-type\": \"vCfg-0405-ez\"\r\n\t\t\t}]\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"template-id\": "
- + "\"TID-0405-EZ\",\r\n\t\t\t\"vm-instance\": 2,\r\n\t\t\t\"vnfc\": [{\r\n\t\t\t\t\"vnfc-instance\": \"1\",\r\n\t\t\t\t\"vnfc-function-code\": "
- + "\"Cfg-ez\",\r\n\t\t\t\t\"ipaddress-v4-oam-vip\": \"Y\",\r\n\t\t\t\t\"group-notation-type\": \"first-vnfc-name\",\r\n\t\t\t\t\"group-notation-value\":"
- + " \"pair\",\r\n\t\t\t\t\"vnfc-type\": \"vCfg-0405-ez\"\r\n\t\t\t}]\r\n\t\t}],\r\n\t\t\"device-protocol\": \"ANSIBLE\",\r\n\t\t\"user-name\": \"root\","
- + "\r\n\t\t\"port-number\": \"22\",\r\n\t\t\"artifact-list\": [{\r\n\t\t\t\"artifact-name\": \"template_ConfigScaleOut_vCfgSO-0405_0.0.1V_TID-0405-EZ.json\","
- + "\r\n\t\t\t\"artifact-type\": \"config_template\"\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"artifact-name\": \"pd_ConfigScaleOut_vCfgSO-0405_0.0.1V_TID-0405-EZ.yaml\","
- + "\r\n\t\t\t\"artifact-type\": \"parameter_definitions\"\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"artifact-name\": "
- + "\"template_ConfigScaleOut_vCfgSO-0405_0.0.1V_TID-0405-EZ-2.json\",\r\n\t\t\t\"artifact-type\": \"config_template\"\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"artifact-name\": "
- + "\"pd_ConfigScaleOut_vCfgSO-0405_0.0.1V_TID-0405-EZ-2.yaml\",\r\n\t\t\t\"artifact-type\": \"parameter_definitions\"\r\n\t\t}],\r\n\t\t\"template-id-list\":"
- + " [\"TID-0405-EZ\",\r\n\t\t\"TID-0405-EZ-2\"],\r\n\t\t\"scopeType\": \"vnf-type\"\r\n\t}";
+ String contentStr = "{\r\n\t\t\"action\": \"ConfigScaleOut\",\r\n\t\t\"action-level\": \"vnf\",\r\n"
+ + "\t\t\"scope\": {\r\n\t\t\t\"vnf-type\": \"vCfgSO-0405\",\r\n\t\t\t\"vnfc-type\": \"\"\r\n\t\t},\r\n"
+ + "\t\t\"template\": \"Y\",\r\n\t\t\"vm\": [{\r\n\t\t\t\"template-id\": \"TID-0405-EZ\",\r\n"
+ + "\t\t\t\"vm-instance\": 1,\r\n\t\t\t\"vnfc\": [{\r\n\t\t\t\t\"vnfc-instance\": \"1\",\r\n"
+ + "\t\t\t\t\"vnfc-function-code\": \"Cfg-ez\",\r\n\t\t\t\t\"ipaddress-v4-oam-vip\": \"Y\",\r\n"
+ + "\t\t\t\t\"group-notation-type\": \"first-vnfc-name\",\r\n"
+ + "\t\t\t\t\"group-notation-value\": \"pair\",\r\n\t\t\t\t\"vnfc-type\": \"vCfg-0405-ez\"\r\n"
+ + "\t\t\t}]\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"template-id\": \"TID-0405-EZ\",\r\n"
+ + "\t\t\t\"vm-instance\": 2,\r\n\t\t\t\"vnfc\": [{\r\n\t\t\t\t\"vnfc-instance\": \"1\",\r\n"
+ + "\t\t\t\t\"vnfc-function-code\": \"Cfg-ez\",\r\n\t\t\t\t\"ipaddress-v4-oam-vip\": \"Y\",\r\n"
+ + "\t\t\t\t\"group-notation-type\": \"first-vnfc-name\",\r\n"
+ + "\t\t\t\t\"group-notation-value\": \"pair\",\r\n\t\t\t\t\"vnfc-type\": \"vCfg-0405-ez\"\r\n"
+ + "\t\t\t}]\r\n\t\t}],\r\n\t\t\"device-protocol\": \"ANSIBLE\",\r\n\t\t\"user-name\": \"root\",\r\n"
+ + "\t\t\"port-number\": \"22\",\r\n\t\t\"artifact-list\": [{\r\n"
+ + "\t\t\t\"artifact-name\": \"template_ConfigScaleOut_vCfgSO-0405_0.0.1V_TID-0405-EZ.json\",\r\n"
+ + "\t\t\t\"artifact-type\": \"config_template\"\r\n\t\t},\r\n\t\t{\r\n"
+ + "\t\t\t\"artifact-name\": \"pd_ConfigScaleOut_vCfgSO-0405_0.0.1V_TID-0405-EZ.yaml\",\r\n"
+ + "\t\t\t\"artifact-type\": \"parameter_definitions\"\r\n\t\t},\r\n\t\t{\r\n"
+ + "\t\t\t\"artifact-name\": \"template_ConfigScaleOut_vCfgSO-0405_0.0.1V_TID-0405-EZ-2.json\",\r\n"
+ + "\t\t\t\"artifact-type\": \"config_template\"\r\n\t\t},\r\n\t\t{\r\n"
+ + "\t\t\t\"artifact-name\": \"pd_ConfigScaleOut_vCfgSO-0405_0.0.1V_TID-0405-EZ-2.yaml\",\r\n"
+ + "\t\t\t\"artifact-type\": \"parameter_definitions\"\r\n\t\t}],\r\n"
+ + "\t\t\"template-id-list\": [\"TID-0405-EZ\",\r\n\t\t\"TID-0405-EZ-2\"],\r\n"
+ + "\t\t\"scopeType\": \"vnf-type\"\r\n\t}";
JSONObject content = new JSONObject(contentStr);
MockDBService dbService = MockDBService.initialise();
SvcLogicContext context = new SvcLogicContext();
@@ -230,24 +255,35 @@ public class ArtifactHandlerNodeTest {
@Test
public void testProcessArtifactListsWithVnfcTypeList() throws Exception {
- String contentStr = "{\r\n\t\"action\": \"Configure\",\r\n\t\"action-level\": \"vnf\",\r\n\t\"scope\": {\r\n\t\t\"vnf-type\": "
- + "\"newtypeofvnf\",\r\n\t\t\"vnfc-type-list\": [\"vnfctype1\",\"vnfctype2\"]\r\n\t},\r\n\t\"template\": \"Y\",\r\n\t\"vm\":"
- + " [{\r\n\t\t\t\"vm-instance\": 1,\r\n\t\t\t\"template-id\": \"vnfctype1\",\r\n\t\t\t\"vnfc\": [{\r\n\t\t\t\t\"vnfc-instance\": "
- + "\"1\",\r\n\t\t\t\t\"vnfc-function-code\": \"fcx\",\r\n\t\t\t\t\"ipaddress-v4-oam-vip\": \"Y\",\r\n\t\t\t\t\"group-notation-type\": "
- + "\"first-vnfc-name\",\r\n\t\t\t\t\"group-notation-value\": \"pair\",\r\n\t\t\t\t\"vnfc-type\": \"vDBE\"\r\n\t\t\t}]\r\n\t\t},"
- + "\r\n\t\t{\r\n\t\t\t\"vm-instance\": 1,\r\n\t\t\t\"template-id\": \"vnfctype2\",\r\n\t\t\t\"vnfc\": [{\r\n\t\t\t\t\"vnfc-instance\": "
- + "\"1\",\r\n\t\t\t\t\"vnfc-function-code\": \"fcx\",\r\n\t\t\t\t\"ipaddress-v4-oam-vip\": \"Y\",\r\n\t\t\t\t\"group-notation-type\": "
- + "\"first-vnfc-name\",\r\n\t\t\t\t\"group-notation-value\": \"pair\",\r\n\t\t\t\t\"vnfc-type\": \"vDBE\"\r\n\t\t\t}]\r\n\t\t},"
- + "\r\n\t\t{\r\n\t\t\t\"vm-instance\": 2,\r\n\t\t\t\"template-id\": \"vnfctype2\",\r\n\t\t\t\"vnfc\": [{\r\n\t\t\t\t\"vnfc-instance\": "
- + "\"1\",\r\n\t\t\t\t\"vnfc-function-code\": \"fcx\",\r\n\t\t\t\t\"ipaddress-v4-oam-vip\": \"Y\",\r\n\t\t\t\t\"group-notation-type\": "
- + "\"first-vnfc-name\",\r\n\t\t\t\t\"group-notation-value\": \"pair\",\r\n\t\t\t\t\"vnfc-type\": \"vDBE\"\r\n\t\t\t}]\r\n\t\t}\r\n\t],"
- + "\r\n\t\"device-protocol\": \"NETCONF-XML\",\r\n\t\"user-name\": \"netconf\",\r\n\t\"port-number\": \"20\",\r\n\t\"artifact-list\": "
- + "[{\r\n\t\t\t\"artifact-name\": \"template_ConfigScaleOut_newtypeofvnf_0.0.1V_vnfctype1.xml\",\r\n\t\t\t\"artifact-type\": "
- + "\"config_template\"\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"artifact-name\": \"pd_ConfigScaleOut_newtypeofvnf_0.0.1V_vnfctype1.yaml\","
- + "\r\n\t\t\t\"artifact-type\": \"parameter_definitions\"\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"artifact-name\": "
- + "\"template_ConfigScaleOut_newtypeofvnf_0.0.1V_vnfctype2.xml\",\r\n\t\t\t\"artifact-type\": "
- + "\"config_template\"\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"artifact-name\": \"pd_ConfigScaleOut_newtypeofvnf_0.0.1V_vnfctype2.yaml\","
- + "\r\n\t\t\t\"artifact-type\": \"parameter_definitions\"\r\n\t\t}\r\n\t],\r\n\t\"scopeType\": \"vnf-type\"\r\n}";
+ String contentStr = "{\r\n\t\"action\": \"Configure\",\r\n\t\"action-level\": \"vnf\",\r\n\t\"scope\": {\r\n"
+ + "\t\t\"vnf-type\": \"newtypeofvnf\",\r\n\t\t\"vnfc-type-list\": [\"vnfctype1\",\"vnfctype2\"]\r\n"
+ + "\t},\r\n\t\"template\": \"Y\",\r\n\t\"vm\": [{\r\n\t\t\t\"vm-instance\": 1,\r\n"
+ + "\t\t\t\"template-id\": \"vnfctype1\",\r\n\t\t\t\"vnfc\": [{\r\n"
+ + "\t\t\t\t\"vnfc-instance\": \"1\",\r\n\t\t\t\t\"vnfc-function-code\": \"fcx\",\r\n"
+ + "\t\t\t\t\"ipaddress-v4-oam-vip\": \"Y\",\r\n"
+ + "\t\t\t\t\"group-notation-type\": \"first-vnfc-name\",\r\n"
+ + "\t\t\t\t\"group-notation-value\": \"pair\",\r\n\t\t\t\t\"vnfc-type\": \"vDBE\"\r\n\t\t\t}]\r\n"
+ + "\t\t},\r\n\t\t{\r\n\t\t\t\"vm-instance\": 1,\r\n\t\t\t\"template-id\": \"vnfctype2\",\r\n"
+ + "\t\t\t\"vnfc\": [{\r\n\t\t\t\t\"vnfc-instance\": \"1\",\r\n"
+ + "\t\t\t\t\"vnfc-function-code\": \"fcx\",\r\n\t\t\t\t\"ipaddress-v4-oam-vip\": \"Y\",\r\n"
+ + "\t\t\t\t\"group-notation-type\": \"first-vnfc-name\",\r\n"
+ + "\t\t\t\t\"group-notation-value\": \"pair\",\r\n\t\t\t\t\"vnfc-type\": \"vDBE\"\r\n\t\t\t}]\r\n"
+ + "\t\t},\r\n\t\t{\r\n\t\t\t\"vm-instance\": 2,\r\n\t\t\t\"template-id\": \"vnfctype2\",\r\n"
+ + "\t\t\t\"vnfc\": [{\r\n\t\t\t\t\"vnfc-instance\": \"1\",\r\n"
+ + "\t\t\t\t\"vnfc-function-code\": \"fcx\",\r\n\t\t\t\t\"ipaddress-v4-oam-vip\": \"Y\",\r\n"
+ + "\t\t\t\t\"group-notation-type\": \"first-vnfc-name\",\r\n"
+ + "\t\t\t\t\"group-notation-value\": \"pair\",\r\n\t\t\t\t\"vnfc-type\": \"vDBE\"\r\n\t\t\t}]\r\n"
+ + "\t\t}\r\n\t],\r\n\t\"device-protocol\": \"NETCONF-XML\",\r\n\t\"user-name\": \"netconf\",\r\n"
+ + "\t\"port-number\": \"20\",\r\n\t\"artifact-list\": [{\r\n"
+ + "\t\t\t\"artifact-name\": \"template_ConfigScaleOut_newtypeofvnf_0.0.1V_vnfctype1.xml\",\r\n"
+ + "\t\t\t\"artifact-type\": \"config_template\"\r\n\t\t},\r\n\t\t{\r\n"
+ + "\t\t\t\"artifact-name\": \"pd_ConfigScaleOut_newtypeofvnf_0.0.1V_vnfctype1.yaml\",\r\n"
+ + "\t\t\t\"artifact-type\": \"parameter_definitions\"\r\n\t\t},\r\n"
+ + "\t\t{\r\n\t\t\t\"artifact-name\": \"template_ConfigScaleOut_newtypeofvnf_0.0.1V_vnfctype2.xml\",\r\n"
+ + "\t\t\t\"artifact-type\": \"config_template\"\r\n\t\t},\r\n"
+ + "\t\t{\r\n\t\t\t\"artifact-name\": \"pd_ConfigScaleOut_newtypeofvnf_0.0.1V_vnfctype2.yaml\",\r\n"
+ + "\t\t\t\"artifact-type\": \"parameter_definitions\"\r\n\t\t}\r\n\t],\r\n"
+ + "\t\"scopeType\": \"vnf-type\"\r\n}";
JSONObject content = new JSONObject(contentStr);
MockDBService dbService = MockDBService.initialise();
SvcLogicContext context = new SvcLogicContext();
@@ -256,9 +292,9 @@ public class ArtifactHandlerNodeTest {
JSONObject scope = (JSONObject)content.get("scope");
JSONArray vnfcTypeList = artifactHandlerNode.setVnfcTypeInformation(scope, context);
artifactHandlerNode.processArtifactList(content, dbService, context, vnfcTypeList);
- JSONArray vnfcLists = scope.getJSONArray("vnfc-type-list");
+ JSONArray vnfcLists = scope.getJSONArray("vnfc-type-list");
assertEquals(vnfcLists.toString(), "[\"vnfctype1\",\"vnfctype2\"]");
- assertEquals(context.getAttribute("vnfc-type"),"vnfctype2");
+ assertEquals(context.getAttribute("vnfc-type"), "vnfctype2");
assertNotNull (vnfcTypeList);
}
@@ -274,7 +310,7 @@ public class ArtifactHandlerNodeTest {
JSONObject documentInfo = getDocumentInfo("templates/pd_template");
documentInfo.put(SdcArtifactHandlerConstants.ARTIFACT_NAME, "pd_Junit.json");
requestInfo.put("RequestInfo", "testValue");
- requestInfo.put("request-id","testREQUEST_ID");
+ requestInfo.put("request-id", "testREQUEST_ID");
input.put(SdcArtifactHandlerConstants.DOCUMENT_PARAMETERS, documentInfo);
input.put(SdcArtifactHandlerConstants.REQUEST_INFORMATION, requestInfo);
postData.put("input", input);
@@ -285,15 +321,17 @@ public class ArtifactHandlerNodeTest {
private JSONObject getDocumentInfo(String filename) throws IOException {
JSONObject documentInfo = new JSONObject();
- String artifactContent = IOUtils.toString(ArtifactHandlerProviderUtilTest.class.getClassLoader()
- .getResourceAsStream(filename), Charset.defaultCharset());
+ String artifactContent = IOUtils.toString(
+ ArtifactHandlerProviderUtilTest.class.getClassLoader().getResourceAsStream(filename),
+ Charset.defaultCharset());
documentInfo.put(SdcArtifactHandlerConstants.ARTIFACT_CONTENTS, artifactContent);
documentInfo.put(SdcArtifactHandlerConstants.SERVICE_UUID, "12345");
documentInfo.put(SdcArtifactHandlerConstants.DISTRIBUTION_ID, "12345");
documentInfo.put(SdcArtifactHandlerConstants.SERVICE_NAME, "12345");
documentInfo.put(SdcArtifactHandlerConstants.SERVICE_DESCRIPTION, "12345");
- documentInfo.put(SdcArtifactHandlerConstants.RESOURCE_UUID, "12345");
+ documentInfo.put(SdcArtifactHandlerConstants.RESOURCE_UUID, "12345");
documentInfo.put(SdcArtifactHandlerConstants.RESOURCE_INSTANCE_NAME, "12345");
+ documentInfo.put(SdcArtifactHandlerConstants.RESOURCE_NAME, "12345");
documentInfo.put(SdcArtifactHandlerConstants.RESOURCE_VERSION, "12345");
documentInfo.put(SdcArtifactHandlerConstants.RESOURCE_TYPE, "12345");
documentInfo.put(SdcArtifactHandlerConstants.ARTIFACT_UUID, "12345");
@@ -302,70 +340,81 @@ public class ArtifactHandlerNodeTest {
documentInfo.put(SdcArtifactHandlerConstants.ARTIFACT_DESRIPTION, "12345");
return documentInfo;
}
-
-
+
+
@Test
public void testValidateAnsibleAdminArtifact() throws Exception {
- String contentStr = "{\"fqdn-list\":[{\"vnf-management-server-fqdn\":\"fqdn-value1 url:port\",\"cloud-owner-list\":[{\"cloud-owner\":\"aic3.0\","
- + "\"region-id-list\":[{\"region-id\":\"san4a\",\"tenant-id-list\":[\"tenantuuid1\",\"tenantuuid2\"]},{\"region-id\":\"san4b\","
- + "\"tenant-id-list\":[\"tenantuuid1\",\"tenantuuid2\"]}]},{\"cloud-owner\":\"nc1.0\",\"region-id-list\":[{\"region-id\":\"san4a\","
- + "\"tenant-id-list\":[\"tenantuuid3\",\"tenantuuid4\"]}]}],\"description\":\"fqdn for east zone Production\",\"username\":\"attuid\","
- + "\"create-date\":\"\",\"modify-username\":\"\",\"modify-date\":\"\"},{\"vnf-management-server-fqdn\":\"fqdn-value2 url:port\","
- + "\"cloud-owner-list\":[{\"cloud-owner\":\"aic3.0\",\"region-id-list\":[{\"region-id\":\"san4a\",\"tenant-id-list\":[\"tenantuuid5\","
- + "\"tenantuuid6\"]},{\"region-id\":\"san4b\",\"tenant-id-list\":[\"tenantuuid5\",\"tenantuuid6\"]}]},{\"cloud-owner\":\"nc1.0\","
- + "\"region-id-list\":[{\"region-id\":\"san4a\",\"tenant-id-list\":[\"tenantuuid7\",\"tenantuuid8\"]}]}],"
- + "\"description\":\"fqdn for east zone Test\",\"username\":\"attuid\",\"create-date\":\"\","
- + "\"modify-username\":\"\",\"modify-date\":\"\"}]}";
-
- JSONObject documentInfo = new JSONObject();
+ String contentStr = "{\"fqdn-list\":[{\"vnf-management-server-fqdn\":\"fqdn-value1 url:port\","
+ + "\"cloud-owner-list\":[{\"cloud-owner\":\"aic3.0\",\"region-id-list\":[{\"region-id\":\"san4a\","
+ + "\"tenant-id-list\":[\"tenantuuid1\",\"tenantuuid2\"]},{\"region-id\":\"san4b\","
+ + "\"tenant-id-list\":[\"tenantuuid1\",\"tenantuuid2\"]}]},{\"cloud-owner\":\"nc1.0\","
+ + "\"region-id-list\":[{\"region-id\":\"san4a\",\"tenant-id-list\":[\"tenantuuid3\","
+ + "\"tenantuuid4\"]}]}],\"description\":\"fqdn for east zone Production\",\"username\":\"attuid\","
+ + "\"create-date\":\"\",\"modify-username\":\"\",\"modify-date\":\"\"},"
+ + "{\"vnf-management-server-fqdn\":\"fqdn-value2 url:port\","
+ + "\"cloud-owner-list\":[{\"cloud-owner\":\"aic3.0\",\"region-id-list\":[{\"region-id\":\"san4a\","
+ + "\"tenant-id-list\":[\"tenantuuid5\",\"tenantuuid6\"]},{\"region-id\":\"san4b\","
+ + "\"tenant-id-list\":[\"tenantuuid5\",\"tenantuuid6\"]}]},{\"cloud-owner\":\"nc1.0\","
+ + "\"region-id-list\":[{\"region-id\":\"san4a\","
+ + "\"tenant-id-list\":[\"tenantuuid7\",\"tenantuuid8\"]}]}],"
+ + "\"description\":\"fqdn for east zone Test\",\"username\":\"attuid\",\"create-date\":\"\","
+ + "\"modify-username\":\"\",\"modify-date\":\"\"}]}";
+
+ JSONObject documentInfo = new JSONObject();
documentInfo.put(SdcArtifactHandlerConstants.ARTIFACT_CONTENTS, contentStr);
documentInfo.put(SdcArtifactHandlerConstants.ARTIFACT_NAME, "ansible_admin_FQDN_Artifact_0.0.1V.json");
artifactHandlerNode.validateAnsibleAdminArtifact(documentInfo);
}
-
+
@Test
public void testValidateAnsibleAdminArtifactWithException() throws Exception {
- String contentStrOne = "{\"fqdn-list\":[{\"vnf-management-server-fqdn\":\"fqdn-value1 url:port\",\"cloud-owner-list\":[{\"cloud-owner\":\"aic3.0\","
- + "\"region-id-list\":[{\"region-id\":\"san4a\",\"tenant-id-list\":[\"tenantuuid1\",\"tenantuuid2\"]},{\"region-id\":\"san4b\","
- + "\"tenant-id-list\":[\"tenantuuid1\",\"tenantuuid2\"]}]},{\"cloud-owner\":\"nc1.0\",\"region-id-list\":[{\"region-id\":\"san4a\","
- + "\"tenant-id-list\":[\"tenantuuid3\",\"tenantuuid4\"]}]}],\"description\":\"fqdn for east zone Production\",\"username\":\"attuid\","
- + "\"create-date\":\"\",\"modify-username\":\"\",\"modify-date\":\"\"},{\"vnf-management-server-fqdn\":\"fqdn-value2 url:port\","
- + "\"cloud-owner-list\":[{\"cloud-owner\":\"aic3.0\",\"region-id-list\":[{\"region-id\":\"san4a\",\"tenant-id-list\":[\"tenantuuid1\","
- + "\"tenantuuid6\"]},{\"region-id\":\"san4b\",\"tenant-id-list\":[\"tenantuuid5\",\"tenantuuid6\"]}]},{\"cloud-owner\":\"nc1.0\","
- + "\"region-id-list\":[{\"region-id\":\"san4a\",\"tenant-id-list\":[\"tenantuuid7\",\"tenantuuid8\"]}]}],"
- + "\"description\":\"fqdn for east zone Test\",\"username\":\"attuid\",\"create-date\":\"\","
- + "\"modify-username\":\"\",\"modify-date\":\"\"}]}";
- JSONObject documentInfoOne = new JSONObject();
- documentInfoOne.put(SdcArtifactHandlerConstants.ARTIFACT_CONTENTS, contentStrOne);
- documentInfoOne.put(SdcArtifactHandlerConstants.ARTIFACT_NAME, "ansible_admin_FQDN_Artifact_0.0.1V.json");
-
- try {
- artifactHandlerNode.validateAnsibleAdminArtifact(documentInfoOne);
- fail("Missing exception");
- }catch(ArtifactHandlerInternalException e) {
+ String contentStrOne = "{\"fqdn-list\":[{\"vnf-management-server-fqdn\":\"fqdn-value1 url:port\","
+ + "\"cloud-owner-list\":[{\"cloud-owner\":\"aic3.0\",\"region-id-list\":[{\"region-id\":\"san4a\","
+ + "\"tenant-id-list\":[\"tenantuuid1\",\"tenantuuid2\"]},{\"region-id\":\"san4b\","
+ + "\"tenant-id-list\":[\"tenantuuid1\",\"tenantuuid2\"]}]},{\"cloud-owner\":\"nc1.0\","
+ + "\"region-id-list\":[{\"region-id\":\"san4a\","
+ + "\"tenant-id-list\":[\"tenantuuid3\",\"tenantuuid4\"]}]}],"
+ + "\"description\":\"fqdn for east zone Production\",\"username\":\"attuid\",\"create-date\":\"\","
+ + "\"modify-username\":\"\",\"modify-date\":\"\"},"
+ + "{\"vnf-management-server-fqdn\":\"fqdn-value2 url:port\","
+ + "\"cloud-owner-list\":[{\"cloud-owner\":\"aic3.0\",\"region-id-list\":[{\"region-id\":\"san4a\","
+ + "\"tenant-id-list\":[\"tenantuuid1\",\"tenantuuid6\"]},{\"region-id\":\"san4b\","
+ + "\"tenant-id-list\":[\"tenantuuid5\",\"tenantuuid6\"]}]},{\"cloud-owner\":\"nc1.0\","
+ + "\"region-id-list\":[{\"region-id\":\"san4a\","
+ + "\"tenant-id-list\":[\"tenantuuid7\",\"tenantuuid8\"]}]}],"
+ + "\"description\":\"fqdn for east zone Test\",\"username\":\"attuid\",\"create-date\":\"\","
+ + "\"modify-username\":\"\",\"modify-date\":\"\"}]}";
+ JSONObject documentInfoOne = new JSONObject();
+ documentInfoOne.put(SdcArtifactHandlerConstants.ARTIFACT_CONTENTS, contentStrOne);
+ documentInfoOne.put(SdcArtifactHandlerConstants.ARTIFACT_NAME, "ansible_admin_FQDN_Artifact_0.0.1V.json");
+
+ try {
+ artifactHandlerNode.validateAnsibleAdminArtifact(documentInfoOne);
+ fail("Missing exception");
+ } catch (ArtifactHandlerInternalException e) {
assertTrue(e.getMessage().contains("Validation Failure"));
- }
-
+ }
+
}
-
+
@Test
public void testValidateAnsibleAdminArtifactWithJSONException() throws Exception {
- String contentStrOne = "{\"fqdn-list\":[{\"vnf-management-server-fqdn\":\"fqdn-value1 url:port\",\"cloud-owner-list\":[{\"cloud-owner\":\"aic3.0\"}";
-
- JSONObject documentInfoOne = new JSONObject();
+ String contentStrOne =
+ "{\"fqdn-list\":[{\"vnf-management-server-fqdn\":\"fqdn-value1 url:port\",\"cloud-owner-list\":[{\"cloud-owner\":\"aic3.0\"}";
+
+ JSONObject documentInfoOne = new JSONObject();
documentInfoOne.put(SdcArtifactHandlerConstants.ARTIFACT_CONTENTS, contentStrOne);
documentInfoOne.put(SdcArtifactHandlerConstants.ARTIFACT_NAME, "ansible_admin_FQDN_Artifact_0.0.1V.json");
-
+
try {
artifactHandlerNode.validateAnsibleAdminArtifact(documentInfoOne);
fail("Missing exception");
- }catch(ArtifactHandlerInternalException je) {
- assertTrue(je.getMessage().contains("JSON Exception"));
-
- }
-
- }
-
+ } catch (ArtifactHandlerInternalException je) {
+ assertTrue(je.getMessage().contains("JSON Exception"));
+ }
+
+ }
+
@Test
public void testProcessArtifactWithException() throws Exception {
SvcLogicContext ctx = new SvcLogicContext();
@@ -376,12 +425,13 @@ public class ArtifactHandlerNodeTest {
inParams.put("response_prefix", "prefix");
JSONObject requestInfo = new JSONObject();
JSONObject documentInfo = new JSONObject();
- String artifactContent = IOUtils.toString(ArtifactHandlerProviderUtilTest.class.getClassLoader()
- .getResourceAsStream("templates/reference_template"), Charset.defaultCharset());
+ String artifactContent = IOUtils.toString(
+ ArtifactHandlerProviderUtilTest.class.getClassLoader().getResourceAsStream("templates/reference_template"),
+ Charset.defaultCharset());
documentInfo.put(SdcArtifactHandlerConstants.ARTIFACT_CONTENTS, artifactContent);
documentInfo.put(SdcArtifactHandlerConstants.ARTIFACT_NAME, "");
requestInfo.put("RequestInfo", "testValue");
- requestInfo.put("request-id","testREQUEST_ID");
+ requestInfo.put("request-id", "testREQUEST_ID");
input.put(SdcArtifactHandlerConstants.DOCUMENT_PARAMETERS, documentInfo);
input.put(SdcArtifactHandlerConstants.REQUEST_INFORMATION, requestInfo);
postData.put("input", input);
@@ -389,11 +439,12 @@ public class ArtifactHandlerNodeTest {
try {
artifactHandlerNode.processArtifact(inParams, ctx);
fail("Missing exception");
- }catch(Exception e) {
- assertTrue(e.getMessage().contains("Missing Artifact Name"));
+ } catch (Exception e) {
+ assertTrue(e.getMessage().contains("Missing Artifact Name"));
}
-
+
}
+
@Test
public void testProcessArtifactWithExceptionforAnsible() throws Exception {
SvcLogicContext ctx = new SvcLogicContext();
@@ -404,25 +455,26 @@ public class ArtifactHandlerNodeTest {
inParams.put("response_prefix", "prefix");
JSONObject requestInfo = new JSONObject();
JSONObject documentInfo = new JSONObject();
- String artifactContent = IOUtils.toString(ArtifactHandlerProviderUtilTest.class.getClassLoader()
- .getResourceAsStream("templates/reference_template"), Charset.defaultCharset());
+ String artifactContent = IOUtils.toString(
+ ArtifactHandlerProviderUtilTest.class.getClassLoader().getResourceAsStream("templates/reference_template"),
+ Charset.defaultCharset());
documentInfo.put(SdcArtifactHandlerConstants.ARTIFACT_CONTENTS, artifactContent);
documentInfo.put(SdcArtifactHandlerConstants.ARTIFACT_NAME, "ansible_admin_FQDN_Artifact_0.0.2V.json");
requestInfo.put("RequestInfo", "testValue");
- requestInfo.put("request-id","testREQUEST_ID");
+ requestInfo.put("request-id", "testREQUEST_ID");
input.put(SdcArtifactHandlerConstants.DOCUMENT_PARAMETERS, documentInfo);
input.put(SdcArtifactHandlerConstants.REQUEST_INFORMATION, requestInfo);
postData.put("input", input);
inParams.put("postData", postData.toString());
-
+
try {
- artifactHandlerNode.processArtifact(inParams, ctx);
- fail("Missing exception");
- }catch(Exception e) {
- assertTrue(e.getMessage().contains("JSON Exception:ansible admin"));
+ artifactHandlerNode.processArtifact(inParams, ctx);
+ fail("Missing exception");
+ } catch (Exception e) {
+ assertTrue(e.getMessage().contains("JSON Exception:ansible admin"));
}
- }
-
+ }
+
@Test
public void testProcessAndStoreCapablitiesArtifact() throws Exception {
ArtifactHandlerNode ah = new ArtifactHandlerNode();
@@ -435,6 +487,7 @@ public class ArtifactHandlerNodeTest {
documentInfo.put(SdcArtifactHandlerConstants.SERVICE_DESCRIPTION, "testDesc");
documentInfo.put(SdcArtifactHandlerConstants.RESOURCE_UUID, "testRes");
documentInfo.put(SdcArtifactHandlerConstants.RESOURCE_INSTANCE_NAME, "testResIns");
+ documentInfo.put(SdcArtifactHandlerConstants.RESOURCE_NAME, "testResName");
documentInfo.put(SdcArtifactHandlerConstants.RESOURCE_VERSION, "testVers");
documentInfo.put(SdcArtifactHandlerConstants.RESOURCE_TYPE, "testResType");
documentInfo.put(SdcArtifactHandlerConstants.ARTIFACT_UUID, "testArtifactUuid");
@@ -443,6 +496,6 @@ public class ArtifactHandlerNodeTest {
Whitebox.invokeMethod(ah, "processAndStoreCapabilitiesArtifact", dbService, documentInfo, capabilities,
"artifactName", "someVnf");
}
-
+
}
diff --git a/appc-inbound/appc-artifact-handler/provider/src/test/java/org/onap/appc/artifact/handler/utils/ArtifactHandlerProviderUtilTest.java b/appc-inbound/appc-artifact-handler/provider/src/test/java/org/onap/appc/artifact/handler/utils/ArtifactHandlerProviderUtilTest.java
index cf27dce63..529fa368b 100644
--- a/appc-inbound/appc-artifact-handler/provider/src/test/java/org/onap/appc/artifact/handler/utils/ArtifactHandlerProviderUtilTest.java
+++ b/appc-inbound/appc-artifact-handler/provider/src/test/java/org/onap/appc/artifact/handler/utils/ArtifactHandlerProviderUtilTest.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=========================================================
*/
@@ -32,8 +31,8 @@ import java.io.IOException;
import java.nio.charset.Charset;
import org.apache.commons.io.IOUtils;
import org.json.JSONObject;
-import org.junit.Test;
import org.junit.Ignore;
+import org.junit.Test;
import org.mockito.Mockito;
import org.opendaylight.yang.gen.v1.org.onap.appc.artifacthandler.rev170321.UploadartifactInput;
import org.opendaylight.yang.gen.v1.org.onap.appc.artifacthandler.rev170321.UploadartifactInputBuilder;
@@ -57,7 +56,7 @@ public class ArtifactHandlerProviderUtilTest {
ahprovider.processTemplate(obj.toString());
}
- @Ignore
+ // @Ignore
@Test(expected = Exception.class)
public void testcreateDummyRequestData() throws Exception {
String artifact_conetent = IOUtils.toString(ArtifactHandlerProviderUtilTest.class.getClassLoader()
@@ -67,7 +66,7 @@ public class ArtifactHandlerProviderUtilTest {
obj.put("artifact-version", "0.01");
obj.put("artifact-contents", artifact_conetent);
ArtifactHandlerProviderUtil ahprovider = new ArtifactHandlerProviderUtil();
- ahprovider.createDummyRequestData();
+ String requestInfo = ahprovider.createDummyRequestData();
}
@Test
@@ -78,6 +77,13 @@ public class ArtifactHandlerProviderUtilTest {
}
@Test
+ public void testGetRandom() throws Exception {
+ ArtifactHandlerProviderUtil ahprovider = new ArtifactHandlerProviderUtil();
+ Whitebox.invokeMethod(ahprovider, "getRandom");
+ assertTrue(true);
+ }
+
+ @Test
public void testEscapeUtils() throws Exception {
String str = "The Test string is 'test'";
assertEquals("The Test string is ''test''", EscapeUtils.escapeSql(str));
@@ -105,7 +111,8 @@ public class ArtifactHandlerProviderUtilTest {
builder.setRequestInformation(mockRequestInformation);
UploadartifactInput uploadArtifactInput = builder.build();
Whitebox.setInternalState(ahprovider, "templateData", uploadArtifactInput);
- assertTrue(ahprovider.createDummyRequestData().startsWith("{\"input\": {\"document-parameters\":{\"service-uuid\":\"TLSUUIDREQUEST ID\""));
+ assertTrue(ahprovider.createDummyRequestData()
+ .startsWith("{\"input\": {\"document-parameters\":{\"service-uuid\":\"TLSUUIDREQUEST ID\""));
}
@Test
@@ -125,4 +132,3 @@ public class ArtifactHandlerProviderUtilTest {
ahProvider.createRequestData());
}
}
-