aboutsummaryrefslogtreecommitdiffstats
path: root/appc-dg
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-dg
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-dg')
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-aai/src/main/java/org/onap/appc/dg/aai/impl/AAIPluginImpl.java83
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/impl/AAIPluginImplTest.java26
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/impl/TestConstants.java30
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/onap/appc/dg/common/impl/IntermediateMessageSenderImpl.java7
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/impl/JsonDgUtilImplTest.java11
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/impl/TestDgResolverPluginImpl.java114
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/impl/TestVNFConfiguratorImpl.java55
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/impl/TestVNFResolverDataReader.java7
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/impl/VnfExecutionFlowImplTest.java261
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/utils/JSONUtilTest.java18
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-dependency-model/src/main/java/org/onap/appc/dg/dependencymanager/helper/DependencyModelParser.java69
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-dependency-model/src/main/java/org/onap/appc/dg/dependencymanager/impl/DependencyManagerImpl.java20
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-dependency-model/src/main/java/org/onap/appc/dg/dependencymanager/impl/ResourceDependency.java20
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-dependency-model/src/test/java/org/onap/appc/dg/dependencymanager/helper/DependencyModelParserTest.java62
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-dependency-model/src/test/java/org/onap/appc/dg/flowbuilder/TestFlowBuilder.java170
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/test/java/org/onap/appc/domainmodel/TestVnf.java26
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-license-manager/src/test/java/org/onap/appc/dg/licmgr/impl/LicenseManagerPluginImplTest.java5
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/impl/MDSALStoreImpl.java103
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/operation/ConfigOperationRequestFormatter.java23
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/test/java/org/onap/appc/mdsal/MDSALStoreTest.java13
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/test/java/org/onap/appc/mdsal/impl/MDSALStoreImplTest.java26
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-netconf/src/main/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImpl.java48
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientFactoryMock.java11
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImplTest.java97
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfDBPluginImplTest.java34
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-ssh/src/main/java/org/onap/appc/dg/ssh/impl/SshServiceImpl.java22
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-ssh/src/test/java/org/onap/appc/dg/ssh/impl/SshDBPluginImplTest.java10
27 files changed, 713 insertions, 658 deletions
diff --git a/appc-dg/appc-dg-shared/appc-dg-aai/src/main/java/org/onap/appc/dg/aai/impl/AAIPluginImpl.java b/appc-dg/appc-dg-shared/appc-dg-aai/src/main/java/org/onap/appc/dg/aai/impl/AAIPluginImpl.java
index 3044236b2..a98b01ddb 100644
--- a/appc-dg/appc-dg-shared/appc-dg-aai/src/main/java/org/onap/appc/dg/aai/impl/AAIPluginImpl.java
+++ b/appc-dg/appc-dg-shared/appc-dg-aai/src/main/java/org/onap/appc/dg/aai/impl/AAIPluginImpl.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=========================================================
*/
@@ -42,11 +41,11 @@ import org.onap.appc.domainmodel.Vnfc;
import org.onap.appc.domainmodel.Vserver;
import org.onap.appc.exceptions.APPCException;
import org.onap.appc.i18n.Msg;
-import org.onap.ccsdk.sli.adaptors.aai.AAIClient;
-import org.onap.ccsdk.sli.adaptors.aai.AAIService;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.sli.SvcLogicResource;
+import org.onap.ccsdk.sli.adaptors.aai.AAIClient;
+import org.onap.ccsdk.sli.adaptors.aai.AAIService;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.ServiceReference;
@@ -117,8 +116,8 @@ public class AAIPluginImpl implements AAIPlugin {
ctx.setAttribute(Constants.ATTRIBUTE_ERROR_MESSAGE, msg);
throw new APPCException(msg);
}
- String msg = EELFResourceManager
- .format(Msg.SUCCESS_EVENT_MESSAGE, "PostGenericVnfData", STR_VNF_ID + vnfId);
+ String msg =
+ EELFResourceManager.format(Msg.SUCCESS_EVENT_MESSAGE, "PostGenericVnfData", STR_VNF_ID + vnfId);
ctx.setAttribute(org.onap.appc.Constants.ATTRIBUTE_SUCCESS_MESSAGE, msg);
} catch (SvcLogicException e) {
@@ -136,8 +135,8 @@ public class AAIPluginImpl implements AAIPlugin {
String key = "vnf-id = '" + vnfId + "'";
try {
- SvcLogicResource.QueryStatus response = aaiClient
- .query(PARAM_GENERIC_VNF, false, null, key, prefix, null, ctx);
+ SvcLogicResource.QueryStatus response =
+ aaiClient.query(PARAM_GENERIC_VNF, false, null, key, prefix, null, ctx);
if (SvcLogicResource.QueryStatus.NOT_FOUND.equals(response)) {
String msg = EELFResourceManager.format(Msg.VNF_NOT_FOUND, vnfId);
ctx.setAttribute(Constants.ATTRIBUTE_ERROR_MESSAGE, msg);
@@ -157,7 +156,7 @@ public class AAIPluginImpl implements AAIPlugin {
}
ctx.setAttribute(Constants.IS_RELEASE_ENTITLEMENT_REQUIRE,
- Boolean.toString(!aaiEntitlementPoolUuid.isEmpty()));
+ Boolean.toString(!aaiEntitlementPoolUuid.isEmpty()));
ctx.setAttribute(Constants.IS_RELEASE_LICENSE_REQUIRE, Boolean.toString(!aaiLicenseKeyGroupUuid.isEmpty()));
String msg = EELFResourceManager.format(Msg.SUCCESS_EVENT_MESSAGE, "GetGenericVnfData", STR_VNF_ID + vnfId);
ctx.setAttribute(org.onap.appc.Constants.ATTRIBUTE_SUCCESS_MESSAGE, msg);
@@ -213,8 +212,9 @@ public class AAIPluginImpl implements AAIPlugin {
Vnfc newVnfc = createVnfc(vnfcName, vnfcType);
if (vnfcSet.contains(newVnfc)) {
- Vnfc vnfcFromSet = vnfcSet.stream().filter(vnfc -> vnfc.equals(newVnfc))
- .collect(Collectors.toList()).get(0);
+ Vnfc vnfcFromSet =
+ vnfcSet.stream().filter(vnfc -> vnfc.equals(newVnfc))
+ .collect(Collectors.toList()).get(0);
vnfcFromSet.addVserver(vm);
vm.setVnfc(vnfcFromSet);
} else {
@@ -232,8 +232,8 @@ public class AAIPluginImpl implements AAIPlugin {
ctx.setAttribute("getVnfHierarchy_result", "FAILURE");
String msg = EELFResourceManager.format(Msg.AAI_QUERY_FAILED, vnfId);
ctx.setAttribute(Constants.ATTRIBUTE_ERROR_MESSAGE, msg);
- logger.error("Failed in getVnfHierarchy, Error retrieving VNF details. Error message: " + ctx
- .getAttribute("getResource_result"), e);
+ logger.error("Failed in getVnfHierarchy, Error retrieving VNF details. Error message: "
+ + ctx.getAttribute("getResource_result"), e);
logger.warn("Incorrect or Incomplete VNF Hierarchy");
throw new APPCException("Error Retrieving VNF hierarchy");
}
@@ -291,22 +291,22 @@ public class AAIPluginImpl implements AAIPlugin {
String resourceType = "vnfc";
SvcLogicContext vnfContext = readResource(query, prefix, resourceType);
String[] additionalProperties = new String[]{PROPERTY_VNFC_TYPE, PROPERTY_VNFC_NAME,
- PROPERTY_VNFC_FUNC_CODE, PROPERTY_IN_MAINT, PROPERTY_PROV_STATUS,
- PROPERTY_LOOP_DISABLED, PROPERTY_ORCHESTRATION_STATUS, PROPERTY_RESOURCE_VERSION};
+ PROPERTY_VNFC_FUNC_CODE, PROPERTY_IN_MAINT, PROPERTY_PROV_STATUS,
+ PROPERTY_LOOP_DISABLED, PROPERTY_ORCHESTRATION_STATUS, PROPERTY_RESOURCE_VERSION};
return readRelationDataAndProperties(prefix, vnfContext, additionalProperties);
}
protected AAIQueryResult readVM(String vmId, String tenantId, String cloudOwner, String cloudRegionId)
throws AAIQueryException {
String query = "vserver.vserver-id = '" + vmId + "' AND tenant.tenant_id = '" + tenantId
- + "' AND cloud-region.cloud-owner = '"
- + cloudOwner + "' AND cloud-region.cloud-region-id = '" + cloudRegionId + "'";
+ + "' AND cloud-region.cloud-owner = '" + cloudOwner
+ + "' AND cloud-region.cloud-region-id = '" + cloudRegionId + "'";
String prefix = "VM";
String resourceType = "vserver";
SvcLogicContext vnfContext = readResource(query, prefix, resourceType);
String[] additionalProperties = new String[]{PROPERTY_VSERVER_ID, PROPERTY_VSERVER_SLINK,
- PROPERTY_VSERVER_NAME, PROPERTY_IN_MAINT, PROPERTY_PROV_STATUS, PROPERTY_LOOP_DISABLED,
- PROPERTY_VSERVER_NAME_2, PROPERTY_RESOURCE_VERSION,};
+ PROPERTY_VSERVER_NAME, PROPERTY_IN_MAINT, PROPERTY_PROV_STATUS, PROPERTY_LOOP_DISABLED,
+ PROPERTY_VSERVER_NAME_2, PROPERTY_RESOURCE_VERSION,};
return readRelationDataAndProperties(prefix, vnfContext, additionalProperties);
}
@@ -317,18 +317,19 @@ public class AAIPluginImpl implements AAIPlugin {
SvcLogicContext vnfContext = readResource(query, prefix, PARAM_GENERIC_VNF);
String[] additionalProperties = new String[]{PROPERTY_VNF_TYPE, PROPERTY_VNF_NEM,
- PROPERTY_IN_MAINT, PROPERTY_PROV_STATUS, PROPERTY_HEAT_STACK_ID,
- PROPERTY_LOOP_DISABLED, PROPERTY_ORCHESTRATION_STATUS, PROPERTY_RESOURCE_VERSION, Constants.AAI_VNF_MODEL_VERSION_ID};
+ PROPERTY_IN_MAINT, PROPERTY_PROV_STATUS, PROPERTY_HEAT_STACK_ID,
+ PROPERTY_LOOP_DISABLED, PROPERTY_ORCHESTRATION_STATUS, PROPERTY_RESOURCE_VERSION,
+ Constants.AAI_VNF_MODEL_VERSION_ID};
return readRelationDataAndProperties(prefix, vnfContext, additionalProperties);
}
private AAIQueryResult readRelationDataAndProperties(String prefix, SvcLogicContext context,
- String[] additionalProperties) {
+ String[] additionalProperties) {
AAIQueryResult result = new AAIQueryResult();
if (context != null && context.getAttribute(prefix + ".relationship-list.relationship_length") != null) {
- Integer relationsCount = Integer.parseInt(context.getAttribute(
- prefix + ".relationship-list.relationship_length"));
+ Integer relationsCount =
+ Integer.parseInt(context.getAttribute(prefix + ".relationship-list.relationship_length"));
for (int i = 0; i < relationsCount; i++) {
String rsKey = prefix + ".relationship-list.relationship[" + i + "]";
Relationship relationShip = new Relationship();
@@ -360,7 +361,7 @@ public class AAIPluginImpl implements AAIPlugin {
}
} else {
logger.error("Relationship-list not present in the SvcLogicContext attributes set."
- + (context == null ? "" : "Attribute KeySet = " + context.getAttributeKeySet()));
+ + (context == null ? "" : " Attribute KeySet = " + context.getAttributeKeySet()));
}
if (context != null) {
@@ -374,8 +375,8 @@ public class AAIPluginImpl implements AAIPlugin {
protected SvcLogicContext readResource(String query, String prefix, String resourceType) throws AAIQueryException {
SvcLogicContext resourceContext = new SvcLogicContext();
try {
- SvcLogicResource.QueryStatus response = aaiClient
- .query(resourceType, false, null, query, prefix, null, resourceContext);
+ SvcLogicResource.QueryStatus response =
+ aaiClient.query(resourceType, false, null, query, prefix, null, resourceContext);
logger.info(STR_AAI_RESPONSE + response.toString());
if (!SvcLogicResource.QueryStatus.SUCCESS.equals(response)) {
throw new AAIQueryException("Error Retrieving VNF hierarchy from A&AI");
@@ -393,20 +394,18 @@ public class AAIPluginImpl implements AAIPlugin {
String ctxPrefix = params.get("prefix");
String resourceKey = params.get(PARAM_RESOURCE_KEY);
if (logger.isDebugEnabled()) {
- logger.debug("inside getResorce");
- logger.debug("Retrieving " + resourceType + " details from A&AI for Key : " + resourceKey);
+ logger.debug("inside getResource");
+ logger.debug("Retrieving " + resourceType + " details from A&AI for Key: " + resourceKey);
}
try {
SvcLogicResource.QueryStatus response =
- aaiClient.query(resourceType, false, null, resourceKey, ctxPrefix, null, ctx);
+ aaiClient.query(resourceType, false, null, resourceKey, ctxPrefix, null, ctx);
logger.info(STR_AAI_RESPONSE + response.toString());
ctx.setAttribute("getResource_result", response.toString());
} catch (SvcLogicException e) {
logger.error(EELFResourceManager.format(Msg.AAI_GET_DATA_FAILED, resourceKey), e);
}
- if (logger.isDebugEnabled()) {
- logger.debug("exiting getResource======");
- }
+ logger.debug("exiting getResource======");
}
@Override
@@ -418,8 +417,8 @@ public class AAIPluginImpl implements AAIPlugin {
String attributeValue = params.get("attributeValue");
if (logger.isDebugEnabled()) {
logger.debug("inside postResource");
- logger.debug("Updating " + resourceType + " details in A&AI for Key : " + resourceKey);
- logger.debug("Updating " + attributeName + " to : " + attributeValue);
+ logger.debug("Updating " + resourceType + " details in A&AI for Key: " + resourceKey);
+ logger.debug("Updating " + attributeName + " to: " + attributeValue);
}
Map<String, String> data = new HashMap<>();
data.put(attributeName, attributeValue);
@@ -431,9 +430,7 @@ public class AAIPluginImpl implements AAIPlugin {
} catch (SvcLogicException e) {
logger.error(EELFResourceManager.format(Msg.AAI_UPDATE_FAILED, resourceKey, attributeValue), e);
}
- if (logger.isDebugEnabled()) {
- logger.debug("exiting postResource======");
- }
+ logger.debug("exiting postResource======");
}
@Override
@@ -443,7 +440,7 @@ public class AAIPluginImpl implements AAIPlugin {
if (logger.isDebugEnabled()) {
logger.debug("inside deleteResource");
- logger.debug("Deleting " + resourceType + " details From A&AI for Key : " + resourceKey);
+ logger.debug("Deleting " + resourceType + " details from A&AI for Key: " + resourceKey);
}
try {
SvcLogicResource.QueryStatus response = aaiClient.delete(resourceType, resourceKey, ctx);
@@ -452,8 +449,6 @@ public class AAIPluginImpl implements AAIPlugin {
} catch (SvcLogicException e) {
logger.error(EELFResourceManager.format(Msg.AAI_DELETE_FAILED, resourceKey), e);
}
- if (logger.isDebugEnabled()) {
- logger.debug("exiting deleteResource======");
- }
+ logger.debug("exiting deleteResource======");
}
}
diff --git a/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/impl/AAIPluginImplTest.java b/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/impl/AAIPluginImplTest.java
index d89bd4730..12dde3141 100644
--- a/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/impl/AAIPluginImplTest.java
+++ b/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/impl/AAIPluginImplTest.java
@@ -3,6 +3,8 @@
* ONAP : APPC
* ================================================================================
* Copyright (C) 2018 Ericsson
+ * ================================================================================
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -111,8 +113,8 @@ public class AAIPluginImplTest {
AAIPluginImpl impl = new AAIPluginImpl();
impl.initialize();
impl.postGenericVnfData(params, ctx);
- Assert.assertThat(ctx.getAttribute(org.onap.appc.Constants.ATTRIBUTE_SUCCESS_MESSAGE), CoreMatchers.containsString(
- "Operation PostGenericVnfData succeed for VNF ID null"));
+ Assert.assertThat(ctx.getAttribute(org.onap.appc.Constants.ATTRIBUTE_SUCCESS_MESSAGE),
+ CoreMatchers.containsString("Operation PostGenericVnfData succeed for VNF ID null"));
}
@Test
@@ -162,14 +164,15 @@ public class AAIPluginImplTest {
AAIPluginImpl impl = new AAIPluginImpl();
impl.initialize();
impl.getGenericVnfData(params, ctx);
- Assert.assertThat(ctx.getAttribute(org.onap.appc.Constants.ATTRIBUTE_SUCCESS_MESSAGE), CoreMatchers.containsString(
- "Operation GetGenericVnfData succeed for VNF ID null"));
+ Assert.assertThat(ctx.getAttribute(org.onap.appc.Constants.ATTRIBUTE_SUCCESS_MESSAGE),
+ CoreMatchers.containsString("Operation GetGenericVnfData succeed for VNF ID null"));
}
@Test
public void testGetGenericVnfDataFailureThrownExeption() throws APPCException, SvcLogicException {
- Mockito.doThrow(new SvcLogicException()).when(aaiClient).query(Mockito.anyString(), Mockito.anyBoolean(), Mockito.anyString(),
- Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.any(SvcLogicContext.class));
+ Mockito.doThrow(new SvcLogicException()).when(aaiClient).query(Mockito.anyString(), Mockito.anyBoolean(),
+ Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(),
+ Mockito.any(SvcLogicContext.class));
ctx = new SvcLogicContext();
AAIPluginImpl impl = new AAIPluginImpl();
impl.initialize();
@@ -194,8 +197,9 @@ public class AAIPluginImplTest {
@Test
public void testGetVnfHierarchyAaiExceptionFlow2() throws APPCException, SvcLogicException {
- Mockito.doThrow(new SvcLogicException()).when(aaiClient).query(Mockito.anyString(), Mockito.anyBoolean(), Mockito.anyString(),
- Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.any(SvcLogicContext.class));
+ Mockito.doThrow(new SvcLogicException()).when(aaiClient).query(Mockito.anyString(), Mockito.anyBoolean(),
+ Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(),
+ Mockito.any(SvcLogicContext.class));
ctx = new SvcLogicContext();
params.put(Constants.RESOURCEKEY, "TEST_RESOURCE_KEY");
AAIPluginImpl impl = new AAIPluginImpl();
@@ -268,7 +272,7 @@ public class AAIPluginImplTest {
AAIPluginImpl impl = new AAIPluginImpl();
impl.initialize();
impl.getResource(params, ctx);
- Assert.assertEquals("SUCCESS",ctx.getAttribute("getResource_result"));
+ Assert.assertEquals("SUCCESS", ctx.getAttribute("getResource_result"));
}
@Test
@@ -281,7 +285,7 @@ public class AAIPluginImplTest {
AAIPluginImpl impl = new AAIPluginImpl();
impl.initialize();
impl.postResource(params, ctx);
- Assert.assertEquals("SUCCESS",ctx.getAttribute("postResource_result"));
+ Assert.assertEquals("SUCCESS", ctx.getAttribute("postResource_result"));
}
@Test
@@ -294,6 +298,6 @@ public class AAIPluginImplTest {
AAIPluginImpl impl = new AAIPluginImpl();
impl.initialize();
impl.deleteResource(params, ctx);
- Assert.assertEquals("SUCCESS",ctx.getAttribute("deleteResource_result"));
+ Assert.assertEquals("SUCCESS", ctx.getAttribute("deleteResource_result"));
}
}
diff --git a/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/impl/TestConstants.java b/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/impl/TestConstants.java
index ec562f0a0..1d269a985 100644
--- a/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/impl/TestConstants.java
+++ b/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/impl/TestConstants.java
@@ -5,6 +5,8 @@
* Copyright 2018 TechMahindra
* ================================================================================
* Modifications Copyright (C) 2019 Ericsson
+* ================================================================================
+* Modifications Copyright (C) 2019 AT&T Intellectual Property
*=================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,21 +29,21 @@ import org.junit.Test;
import org.onap.appc.dg.aai.impl.Constants.SDC_ARTIFACTS_FIELDS;
public class TestConstants {
- private SDC_ARTIFACTS_FIELDS c=SDC_ARTIFACTS_FIELDS.SERVICE_NAME;
+ private SDC_ARTIFACTS_FIELDS c = SDC_ARTIFACTS_FIELDS.SERVICE_NAME;
- @Test
- public void testConstants() {
- Assert.assertEquals("sdnctl",Constants.NETCONF_SCHEMA);
- }
+ @Test
+ public void testConstants() {
+ Assert.assertEquals("sdnctl", Constants.NETCONF_SCHEMA);
+ }
- @Test
- public void testName() {
- Assert.assertEquals("SERVICE_NAME",c.name());
- }
+ @Test
+ public void testName() {
+ Assert.assertEquals("SERVICE_NAME", c.name());
+ }
- @Test
- public void testEqual() {
- Assert.assertTrue(c.equals(SDC_ARTIFACTS_FIELDS.SERVICE_NAME));
- Assert.assertFalse(c.equals(null));
- }
+ @Test
+ public void testEqual() {
+ Assert.assertTrue(c.equals(SDC_ARTIFACTS_FIELDS.SERVICE_NAME));
+ Assert.assertFalse(c.equals(null));
+ }
}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/onap/appc/dg/common/impl/IntermediateMessageSenderImpl.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/onap/appc/dg/common/impl/IntermediateMessageSenderImpl.java
index 3efbc02e3..c72cab750 100644
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/onap/appc/dg/common/impl/IntermediateMessageSenderImpl.java
+++ b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/onap/appc/dg/common/impl/IntermediateMessageSenderImpl.java
@@ -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=========================================================
*/
@@ -77,7 +76,7 @@ public class IntermediateMessageSenderImpl implements IntermediateMessageSender
try {
validateInputs(params, context);
String jsonMessage = getJsonMessage(params, context);
- logger.debug("Constructed JSON Message : " + jsonMessage);
+ logger.debug("Constructed JSON Message: " + jsonMessage);
messageService.publishMessage(PROPERTIES_PREFIX, "", jsonMessage);
context.setAttribute(prefix + STATUS, SUCCESS);
} catch (Exception e) {
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/impl/JsonDgUtilImplTest.java b/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/impl/JsonDgUtilImplTest.java
index 950cb2f1a..803058b79 100644
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/impl/JsonDgUtilImplTest.java
+++ b/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/impl/JsonDgUtilImplTest.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=========================================================
*/
@@ -38,8 +37,8 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
public class JsonDgUtilImplTest {
- private static final ThreadLocal<SimpleDateFormat> DATE_TIME_PARSER_THREAD_LOCAL = ThreadLocal
- .withInitial(() -> new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
+ private static final ThreadLocal<SimpleDateFormat> DATE_TIME_PARSER_THREAD_LOCAL =
+ ThreadLocal.withInitial(() -> new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
private JsonDgUtilImpl jsonDgUtil;
@Before
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/impl/TestDgResolverPluginImpl.java b/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/impl/TestDgResolverPluginImpl.java
index 4f0779067..5c71bc52b 100644
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/impl/TestDgResolverPluginImpl.java
+++ b/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/impl/TestDgResolverPluginImpl.java
@@ -2,6 +2,8 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Ericsson. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property
+ * ================================================================================
* 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
*
@@ -36,65 +38,65 @@ import org.powermock.modules.junit4.PowerMockRunner;
@PrepareForTest(ResolverFactory.class)
public class TestDgResolverPluginImpl {
- private DgResolverPluginImpl dgResolverPluginImpl;
- private Map<String, String> params;
- private SvcLogicContext ctx;
- private AbstractResolver abstractResolver;
- private FlowKey flowKey;
+ private DgResolverPluginImpl dgResolverPluginImpl;
+ private Map<String, String> params;
+ private SvcLogicContext ctx;
+ private AbstractResolver abstractResolver;
+ private FlowKey flowKey;
- @Before
- public void setUp() {
- params = new HashMap<>();
- ctx = new SvcLogicContext();
- PowerMockito.mockStatic(ResolverFactory.class);
- flowKey = Mockito.mock(FlowKey.class);
- abstractResolver = Mockito.mock(AbstractResolver.class);
- PowerMockito.when(ResolverFactory.createResolver(anyString())).thenReturn(abstractResolver);
- dgResolverPluginImpl = new DgResolverPluginImpl();
- PowerMockito.when(flowKey.name()).thenReturn("flowName");
- }
+ @Before
+ public void setUp() {
+ params = new HashMap<>();
+ ctx = new SvcLogicContext();
+ PowerMockito.mockStatic(ResolverFactory.class);
+ flowKey = Mockito.mock(FlowKey.class);
+ abstractResolver = Mockito.mock(AbstractResolver.class);
+ PowerMockito.when(ResolverFactory.createResolver(anyString())).thenReturn(abstractResolver);
+ dgResolverPluginImpl = new DgResolverPluginImpl();
+ PowerMockito.when(flowKey.name()).thenReturn("flowName");
+ }
- @Test
- public void testResolveDgVNF() throws APPCException {
- params.put("action", "healthcheck");
- params.put("vnfVersion", "1");
- params.put("api-ver", "1.0");
- params.put("DGResolutionType", "VNF");
- params.put("vnfType", "vnfType");
- PowerMockito.when(abstractResolver.resolve("healthcheck", "vnfType", "1", "1.0"))
- .thenReturn(flowKey);
- dgResolverPluginImpl.resolveDg(params, ctx);
- assertEquals("flowName", ctx.getAttribute("dg_name"));
- }
+ @Test
+ public void testResolveDgVNF() throws APPCException {
+ params.put("action", "healthcheck");
+ params.put("vnfVersion", "1");
+ params.put("api-ver", "1.0");
+ params.put("DGResolutionType", "VNF");
+ params.put("vnfType", "vnfType");
+ PowerMockito.when(abstractResolver.resolve("healthcheck", "vnfType", "1", "1.0"))
+ .thenReturn(flowKey);
+ dgResolverPluginImpl.resolveDg(params, ctx);
+ assertEquals("flowName", ctx.getAttribute("dg_name"));
+ }
- @Test
- public void testResolveDgVNFC() throws APPCException {
- params.put("action", "healthcheck");
- params.put("vnfcType", "vnfcType");
- params.put("api-ver", "1.0");
- params.put("DGResolutionType", "VNFC");
- params.put("vnfType", "vnfType");
- PowerMockito.when(abstractResolver.resolve("healthcheck", "vnfType", "vnfcType", "1.0"))
- .thenReturn(flowKey);
- dgResolverPluginImpl.resolveDg(params, ctx);
- assertEquals("flowName", ctx.getAttribute("dg_name"));
- }
+ @Test
+ public void testResolveDgVNFC() throws APPCException {
+ params.put("action", "healthcheck");
+ params.put("vnfcType", "vnfcType");
+ params.put("api-ver", "1.0");
+ params.put("DGResolutionType", "VNFC");
+ params.put("vnfType", "vnfType");
+ PowerMockito.when(abstractResolver.resolve("healthcheck", "vnfType", "vnfcType", "1.0"))
+ .thenReturn(flowKey);
+ dgResolverPluginImpl.resolveDg(params, ctx);
+ assertEquals("flowName", ctx.getAttribute("dg_name"));
+ }
- @Test(expected = DgResolverException.class)
- public void testResolveDgWithException() throws APPCException {
- params.put("action", "healthcheck");
- params.put("vnfcType", "vnfcType");
- params.put("api-ver", "1.0");
- params.put("DGResolutionType", "VNFC");
- params.put("vnfType", "vnfType1");
- PowerMockito.when(abstractResolver.resolve("healthcheck", "vnfType", "vnfcType", "1.0"))
- .thenReturn(flowKey);
- dgResolverPluginImpl.resolveDg(params, ctx);
- }
+ @Test(expected = DgResolverException.class)
+ public void testResolveDgWithException() throws APPCException {
+ params.put("action", "healthcheck");
+ params.put("vnfcType", "vnfcType");
+ params.put("api-ver", "1.0");
+ params.put("DGResolutionType", "VNFC");
+ params.put("vnfType", "vnfType1");
+ PowerMockito.when(abstractResolver.resolve("healthcheck", "vnfType", "vnfcType", "1.0"))
+ .thenReturn(flowKey);
+ dgResolverPluginImpl.resolveDg(params, ctx);
+ }
- @Test(expected = DgResolverException.class)
- public void testResolveDgResolverNull() throws APPCException {
- PowerMockito.when(ResolverFactory.createResolver(anyString())).thenReturn(null);
- dgResolverPluginImpl.resolveDg(params, ctx);
- }
+ @Test(expected = DgResolverException.class)
+ public void testResolveDgResolverNull() throws APPCException {
+ PowerMockito.when(ResolverFactory.createResolver(anyString())).thenReturn(null);
+ dgResolverPluginImpl.resolveDg(params, ctx);
+ }
}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/impl/TestVNFConfiguratorImpl.java b/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/impl/TestVNFConfiguratorImpl.java
index 8b08fc288..49bc43d28 100644
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/impl/TestVNFConfiguratorImpl.java
+++ b/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/impl/TestVNFConfiguratorImpl.java
@@ -2,22 +2,22 @@
* ============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
* =============================================================================
* 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=========================================================
*/
@@ -44,7 +44,7 @@ import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
@RunWith(PowerMockRunner.class)
-@PrepareForTest({MDSALStoreImpl.class,MDSALStoreFactory.class})
+@PrepareForTest({MDSALStoreImpl.class, MDSALStoreFactory.class})
public class TestVNFConfiguratorImpl {
private static final EELFLogger logger = EELFManager.getInstance().getLogger(TestVNFConfiguratorImpl.class);
@@ -57,11 +57,11 @@ public class TestVNFConfiguratorImpl {
@Test(expected = APPCException.class)
public void testValidations() throws APPCException {
VNFConfigurator configurator = new VNFConfiguratorImpl();
- Map<String,String> params = new HashMap<String, String>();
- params.put("uniqueId","uniqueId");
- params.put("yang","yang");
- params.put("configJSON","configJSON");
- configurator.storeConfig(params,new SvcLogicContext());
+ Map<String, String> params = new HashMap<String, String>();
+ params.put("uniqueId", "uniqueId");
+ params.put("yang", "yang");
+ params.put("configJSON", "configJSON");
+ configurator.storeConfig(params, new SvcLogicContext());
}
@Test
@@ -71,14 +71,15 @@ public class TestVNFConfiguratorImpl {
PowerMockito.mockStatic(MDSALStoreFactory.class);
MDSALStore mdsalStore = PowerMockito.mock(MDSALStoreImpl.class);
PowerMockito.when(MDSALStoreFactory.createMDSALStore()).thenReturn(mdsalStore);
- PowerMockito.when(mdsalStore.isModulePresent(Matchers.anyString(),(Date) Matchers.anyObject())).thenReturn(true);
-
- Map<String,String> params = new HashMap<String, String>();
- params.put("uniqueId","uniqueId");
- params.put("yang","yang");
- params.put("configJSON","configJSON");
- params.put("requestId","requestId");
- configurator.storeConfig(params,new SvcLogicContext());
+ PowerMockito.when(mdsalStore.isModulePresent(Matchers.anyString(), (Date) Matchers.anyObject()))
+ .thenReturn(true);
+
+ Map<String, String> params = new HashMap<String, String>();
+ params.put("uniqueId", "uniqueId");
+ params.put("yang", "yang");
+ params.put("configJSON", "configJSON");
+ params.put("requestId", "requestId");
+ configurator.storeConfig(params, new SvcLogicContext());
}
@Test
@@ -91,16 +92,18 @@ public class TestVNFConfiguratorImpl {
PowerMockito.when(MDSALStoreFactory.createMDSALStore()).thenReturn(mdsalStore);
- PowerMockito.when(mdsalStore.isModulePresent(Matchers.anyString(),(Date) Matchers.anyObject())).thenReturn(false);
+ PowerMockito.when(mdsalStore.isModulePresent(Matchers.anyString(), (Date) Matchers.anyObject()))
+ .thenReturn(false);
- PowerMockito.doNothing().when(mdsalStore).storeYangModule(Matchers.anyString(),(BundleInfo)Matchers.anyObject());
+ PowerMockito.doNothing()
+ .when(mdsalStore).storeYangModule(Matchers.anyString(), (BundleInfo) Matchers.anyObject());
- Map<String,String> params = new HashMap<>();
- params.put("uniqueId","uniqueId");
- params.put("yang","yang");
- params.put("configJSON","configJSON");
- params.put("requestId","requestId");
- configurator.storeConfig(params,new SvcLogicContext());
+ Map<String, String> params = new HashMap<String, String>();
+ params.put("uniqueId", "uniqueId");
+ params.put("yang", "yang");
+ params.put("configJSON", "configJSON");
+ params.put("requestId", "requestId");
+ configurator.storeConfig(params, new SvcLogicContext());
}
}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/impl/TestVNFResolverDataReader.java b/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/impl/TestVNFResolverDataReader.java
index 6a560ce85..84f90b0b4 100644
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/impl/TestVNFResolverDataReader.java
+++ b/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/impl/TestVNFResolverDataReader.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2019 IBM.
* ================================================================================
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property
+ * ================================================================================
* 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
@@ -28,10 +30,11 @@ import org.junit.Before;
import org.junit.Test;
public class TestVNFResolverDataReader {
-
+
VNFResolverDataReader vNFResolverDataReader;
Collection<String> list = Arrays.asList("action", "api_version", "vnf_type", "vnf_version");
- String queryStatement = "select vnf_type,vnf_version,api_version,action,dg_name,dg_version,dg_module FROM VNF_DG_MAPPING";
+ String queryStatement =
+ "select vnf_type,vnf_version,api_version,action,dg_name,dg_version,dg_module FROM VNF_DG_MAPPING";
@Before
public void setUp() {
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/impl/VnfExecutionFlowImplTest.java b/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/impl/VnfExecutionFlowImplTest.java
index 2efda6b53..3f8c1818b 100644
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/impl/VnfExecutionFlowImplTest.java
+++ b/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/impl/VnfExecutionFlowImplTest.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=========================================================
*/
@@ -51,7 +50,7 @@ import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
@RunWith(PowerMockRunner.class)
-@PrepareForTest({FrameworkUtil.class,DependencyManager.class,DependencyModelFactory.class})
+@PrepareForTest({FrameworkUtil.class, DependencyManager.class, DependencyModelFactory.class})
@SuppressWarnings("unchecked")
public class VnfExecutionFlowImplTest {
@@ -77,7 +76,7 @@ public class VnfExecutionFlowImplTest {
VnfExecutionFlow vnfExecutionFlow = new VnfExecutionFlowImpl();
Whitebox.setInternalState(vnfExecutionFlow, "logger", logger);
- vnfExecutionFlow.getVnfExecutionFlowData(params,context);
+ vnfExecutionFlow.getVnfExecutionFlowData(params, context);
}
@Test
@@ -95,7 +94,7 @@ public class VnfExecutionFlowImplTest {
VnfExecutionFlow vnfExecutionFlow = new VnfExecutionFlowImpl();
Whitebox.setInternalState(vnfExecutionFlow, "logger", logger);
- vnfExecutionFlow.getVnfExecutionFlowData(params,context);
+ vnfExecutionFlow.getVnfExecutionFlowData(params, context);
}
@Test(expected = RuntimeException.class)
@@ -112,18 +111,18 @@ public class VnfExecutionFlowImplTest {
VnfExecutionFlow vnfExecutionFlow = new VnfExecutionFlowImpl();
Whitebox.setInternalState(vnfExecutionFlow, "logger", logger);
- vnfExecutionFlow.getVnfExecutionFlowData(params,context);
+ vnfExecutionFlow.getVnfExecutionFlowData(params, context);
}
private VnfcDependencyModel readCyclicDependencyModel() {
- Vnfc a = createVnfc("A","Active-Passive",null,false);
- Vnfc b = createVnfc("B","Active-Active",null,false);
- Vnfc c = createVnfc("C","Active-Active",null,false);
- Vnfc d = createVnfc("D","Active-Active",null,false);
- Vnfc e = createVnfc("E","Active-Active",null,false);
- Vnfc f = createVnfc("F","Active-Active",null,false);
- Vnfc g = createVnfc("G","Active-Active",null,false);
+ Vnfc a = createVnfc("A", "Active-Passive", null, false);
+ Vnfc b = createVnfc("B", "Active-Active", null, false);
+ Vnfc c = createVnfc("C", "Active-Active", null, false);
+ Vnfc d = createVnfc("D", "Active-Active", null, false);
+ Vnfc e = createVnfc("E", "Active-Active", null, false);
+ Vnfc f = createVnfc("F", "Active-Active", null, false);
+ Vnfc g = createVnfc("G", "Active-Active", null, false);
Node aNode = new Node(a);
Node bNode = new Node(b);
@@ -153,7 +152,7 @@ public class VnfExecutionFlowImplTest {
}
- private Vnfc createVnfc(String vnfcType,String resilienceType,String vnfcName,boolean mandatory) {
+ private Vnfc createVnfc(String vnfcType, String resilienceType, String vnfcName, boolean mandatory) {
Vnfc vnfc = new Vnfc();
vnfc.setVnfcType(vnfcType);
vnfc.setResilienceType(resilienceType);
@@ -164,69 +163,67 @@ public class VnfExecutionFlowImplTest {
private SvcLogicContext prepareContextForComplexDependency() {
SvcLogicContext context = new SvcLogicContext();
- context.setAttribute("input.action-identifiers.vnf-id","1");
- context.setAttribute("vnf.type","vSCP");
- context.setAttribute("vnf.vnfcCount","7");
-
- context.setAttribute("vnf.vnfc[0].name","A");
- context.setAttribute("vnf.vnfc[0].type","A");
- context.setAttribute("vnf.vnfc[0].vm_count","2");
- context.setAttribute("vnf.vnfc[0].vm[0].url","A1");
- context.setAttribute("vnf.vnfc[0].vm[1].url","A2");
-
- context.setAttribute("vnf.vnfc[1].name","B");
- context.setAttribute("vnf.vnfc[1].type","B");
- context.setAttribute("vnf.vnfc[1].vm_count","5");
- context.setAttribute("vnf.vnfc[1].vm[0].url","B1");
- context.setAttribute("vnf.vnfc[1].vm[1].url","B2");
- context.setAttribute("vnf.vnfc[1].vm[2].url","B3");
- context.setAttribute("vnf.vnfc[1].vm[3].url","B4");
- context.setAttribute("vnf.vnfc[1].vm[4].url","B5");
-
- context.setAttribute("vnf.vnfc[2].name","C");
- context.setAttribute("vnf.vnfc[2].type","C");
- context.setAttribute("vnf.vnfc[2].vm_count","4");
- context.setAttribute("vnf.vnfc[2].vm[0].url","C1");
- context.setAttribute("vnf.vnfc[2].vm[1].url","C2");
- context.setAttribute("vnf.vnfc[2].vm[2].url","C3");
- context.setAttribute("vnf.vnfc[2].vm[3].url","C4");
-
- context.setAttribute("vnf.vnfc[3].name","D");
- context.setAttribute("vnf.vnfc[3].type","D");
- context.setAttribute("vnf.vnfc[3].vm_count","3");
- context.setAttribute("vnf.vnfc[3].vm[0].url","D1");
- context.setAttribute("vnf.vnfc[3].vm[1].url","D2");
- context.setAttribute("vnf.vnfc[3].vm[2].url","D3");
-
- context.setAttribute("vnf.vnfc[4].name","E");
- context.setAttribute("vnf.vnfc[4].type","E");
- context.setAttribute("vnf.vnfc[4].vm_count","2");
- context.setAttribute("vnf.vnfc[4].vm[0].url","E1");
- context.setAttribute("vnf.vnfc[4].vm[1].url","E2");
-
- context.setAttribute("vnf.vnfc[5].name","F");
- context.setAttribute("vnf.vnfc[5].type","F");
- context.setAttribute("vnf.vnfc[5].vm_count","1");
- context.setAttribute("vnf.vnfc[5].vm[0].url","F1");
-
- context.setAttribute("vnf.vnfc[6].name","G");
- context.setAttribute("vnf.vnfc[6].type","G");
- context.setAttribute("vnf.vnfc[6].vm_count","1");
- context.setAttribute("vnf.vnfc[6].vm[0].url","G1");
-
+ context.setAttribute("input.action-identifiers.vnf-id", "1");
+ context.setAttribute("vnf.type", "vSCP");
+ context.setAttribute("vnf.vnfcCount", "7");
+
+ context.setAttribute("vnf.vnfc[0].name", "A");
+ context.setAttribute("vnf.vnfc[0].type", "A");
+ context.setAttribute("vnf.vnfc[0].vm_count", "2");
+ context.setAttribute("vnf.vnfc[0].vm[0].url", "A1");
+ context.setAttribute("vnf.vnfc[0].vm[1].url", "A2");
+
+ context.setAttribute("vnf.vnfc[1].name", "B");
+ context.setAttribute("vnf.vnfc[1].type", "B");
+ context.setAttribute("vnf.vnfc[1].vm_count", "5");
+ context.setAttribute("vnf.vnfc[1].vm[0].url", "B1");
+ context.setAttribute("vnf.vnfc[1].vm[1].url", "B2");
+ context.setAttribute("vnf.vnfc[1].vm[2].url", "B3");
+ context.setAttribute("vnf.vnfc[1].vm[3].url", "B4");
+ context.setAttribute("vnf.vnfc[1].vm[4].url", "B5");
+
+ context.setAttribute("vnf.vnfc[2].name", "C");
+ context.setAttribute("vnf.vnfc[2].type", "C");
+ context.setAttribute("vnf.vnfc[2].vm_count", "4");
+ context.setAttribute("vnf.vnfc[2].vm[0].url", "C1");
+ context.setAttribute("vnf.vnfc[2].vm[1].url", "C2");
+ context.setAttribute("vnf.vnfc[2].vm[2].url", "C3");
+ context.setAttribute("vnf.vnfc[2].vm[3].url", "C4");
+
+ context.setAttribute("vnf.vnfc[3].name", "D");
+ context.setAttribute("vnf.vnfc[3].type", "D");
+ context.setAttribute("vnf.vnfc[3].vm_count", "3");
+ context.setAttribute("vnf.vnfc[3].vm[0].url", "D1");
+ context.setAttribute("vnf.vnfc[3].vm[1].url", "D2");
+ context.setAttribute("vnf.vnfc[3].vm[2].url", "D3");
+
+ context.setAttribute("vnf.vnfc[4].name", "E");
+ context.setAttribute("vnf.vnfc[4].type", "E");
+ context.setAttribute("vnf.vnfc[4].vm_count", "2");
+ context.setAttribute("vnf.vnfc[4].vm[0].url", "E1");
+ context.setAttribute("vnf.vnfc[4].vm[1].url", "E2");
+
+ context.setAttribute("vnf.vnfc[5].name", "F");
+ context.setAttribute("vnf.vnfc[5].type", "F");
+ context.setAttribute("vnf.vnfc[5].vm_count", "1");
+ context.setAttribute("vnf.vnfc[5].vm[0].url", "F1");
+
+ context.setAttribute("vnf.vnfc[6].name", "G");
+ context.setAttribute("vnf.vnfc[6].type", "G");
+ context.setAttribute("vnf.vnfc[6].vm_count", "1");
+ context.setAttribute("vnf.vnfc[6].vm[0].url", "G1");
return context;
}
private VnfcDependencyModel readComplexDependencyModel() {
- Vnfc a = createVnfc("A","Active-Passive",null,false);
- Vnfc b = createVnfc("B","Active-Active",null,false);
- Vnfc c = createVnfc("C","Active-Active",null,false);
- Vnfc d = createVnfc("D","Active-Active",null,false);
- Vnfc e = createVnfc("E","Active-Active",null,false);
- Vnfc f = createVnfc("F","Active-Active",null,false);
- Vnfc g = createVnfc("G","Active-Active",null,false);
-
+ Vnfc a = createVnfc("A", "Active-Passive", null, false);
+ Vnfc b = createVnfc("B", "Active-Active", null, false);
+ Vnfc c = createVnfc("C", "Active-Active", null, false);
+ Vnfc d = createVnfc("D", "Active-Active", null, false);
+ Vnfc e = createVnfc("E", "Active-Active", null, false);
+ Vnfc f = createVnfc("F", "Active-Active", null, false);
+ Vnfc g = createVnfc("G", "Active-Active", null, false);
Node aNode = new Node(a);
Node bNode = new Node(b);
@@ -261,10 +258,9 @@ public class VnfExecutionFlowImplTest {
private VnfcDependencyModel readDependencyModel() {
- Vnfc smp = createVnfc("SMP","Active-Passive",null,false);
- Vnfc be = createVnfc("BE","Active-Active",null,false);
- Vnfc fe = createVnfc("FE","Active-Active",null,false);
-
+ Vnfc smp = createVnfc("SMP", "Active-Passive", null, false);
+ Vnfc be = createVnfc("BE", "Active-Active", null, false);
+ Vnfc fe = createVnfc("FE", "Active-Active", null, false);
Node smpNode = new Node(smp);
Node beNode = new Node(be);
@@ -283,41 +279,41 @@ public class VnfExecutionFlowImplTest {
}
private Map<String, String> prepareParams() {
- Map<String,String> params = new HashMap<>();
- params.put(Constants.DEPENDENCY_TYPE,"RESOURCE");
- params.put(Constants.FLOW_STRATEGY,"FORWARD");
+ Map<String, String> params = new HashMap<>();
+ params.put(Constants.DEPENDENCY_TYPE, "RESOURCE");
+ params.put(Constants.FLOW_STRATEGY, "FORWARD");
- params.put(Constants.VNF_TYPE,"vSCP");
- params.put(Constants.VNF_VERION,"1.00");
+ params.put(Constants.VNF_TYPE, "vSCP");
+ params.put(Constants.VNF_VERION, "1.00");
return params;
}
private SvcLogicContext prepareContext() {
SvcLogicContext context = new SvcLogicContext();
- context.setAttribute("input.action-identifiers.vnf-id","1");
- context.setAttribute("vnf.type","vSCP");
- context.setAttribute("vnf.vnfcCount","3");
-
- context.setAttribute("vnf.vnfc[0].name","SMPname");
- context.setAttribute("vnf.vnfc[0].type","SMP");
- context.setAttribute("vnf.vnfc[0].vm_count","2");
- context.setAttribute("vnf.vnfc[0].vm[0].url","SMP_URL1");
- context.setAttribute("vnf.vnfc[0].vm[1].url","SMP_URL2");
-
- context.setAttribute("vnf.vnfc[1].name","BEname");
- context.setAttribute("vnf.vnfc[1].type","BE");
- context.setAttribute("vnf.vnfc[1].vm_count","5");
- context.setAttribute("vnf.vnfc[1].vm[0].url","BE_URL1");
- context.setAttribute("vnf.vnfc[1].vm[1].url","BE_URL2");
- context.setAttribute("vnf.vnfc[1].vm[2].url","BE_URL3");
- context.setAttribute("vnf.vnfc[1].vm[3].url","BE_URL4");
- context.setAttribute("vnf.vnfc[1].vm[4].url","BE_URL5");
-
- context.setAttribute("vnf.vnfc[2].name","FEname");
- context.setAttribute("vnf.vnfc[2].type","FE");
- context.setAttribute("vnf.vnfc[2].vm_count","2");
- context.setAttribute("vnf.vnfc[2].vm[0].url","FE_URL1");
- context.setAttribute("vnf.vnfc[2].vm[1].url","FE_URL2");
+ context.setAttribute("input.action-identifiers.vnf-id", "1");
+ context.setAttribute("vnf.type", "vSCP");
+ context.setAttribute("vnf.vnfcCount", "3");
+
+ context.setAttribute("vnf.vnfc[0].name", "SMPname");
+ context.setAttribute("vnf.vnfc[0].type", "SMP");
+ context.setAttribute("vnf.vnfc[0].vm_count", "2");
+ context.setAttribute("vnf.vnfc[0].vm[0].url", "SMP_URL1");
+ context.setAttribute("vnf.vnfc[0].vm[1].url", "SMP_URL2");
+
+ context.setAttribute("vnf.vnfc[1].name", "BEname");
+ context.setAttribute("vnf.vnfc[1].type", "BE");
+ context.setAttribute("vnf.vnfc[1].vm_count", "5");
+ context.setAttribute("vnf.vnfc[1].vm[0].url", "BE_URL1");
+ context.setAttribute("vnf.vnfc[1].vm[1].url", "BE_URL2");
+ context.setAttribute("vnf.vnfc[1].vm[2].url", "BE_URL3");
+ context.setAttribute("vnf.vnfc[1].vm[3].url", "BE_URL4");
+ context.setAttribute("vnf.vnfc[1].vm[4].url", "BE_URL5");
+
+ context.setAttribute("vnf.vnfc[2].name", "FEname");
+ context.setAttribute("vnf.vnfc[2].type", "FE");
+ context.setAttribute("vnf.vnfc[2].vm_count", "2");
+ context.setAttribute("vnf.vnfc[2].vm[0].url", "FE_URL1");
+ context.setAttribute("vnf.vnfc[2].vm[1].url", "FE_URL2");
return context;
}
@@ -326,12 +322,12 @@ public class VnfExecutionFlowImplTest {
public void testMissingVnfcTypeInDependencyModel() throws DependencyModelNotFound, InvalidDependencyModelException {
Map<String, String> params = prepareParams();
SvcLogicContext context = prepareContext();
- context.setAttribute("vnf.vnfc[3].name","XEname");
- context.setAttribute("vnf.vnfc[3].type","XE");
- context.setAttribute("vnf.vnfc[3].vm_count","2");
- context.setAttribute("vnf.vnfc[3].vm[0].url","XE_URL1");
- context.setAttribute("vnf.vnfc[3].vm[1].url","XE_URL2");
- context.setAttribute("vnf.vnfcCount","4");
+ context.setAttribute("vnf.vnfc[3].name", "XEname");
+ context.setAttribute("vnf.vnfc[3].type", "XE");
+ context.setAttribute("vnf.vnfc[3].vm_count", "2");
+ context.setAttribute("vnf.vnfc[3].vm[0].url", "XE_URL1");
+ context.setAttribute("vnf.vnfc[3].vm[1].url", "XE_URL2");
+ context.setAttribute("vnf.vnfcCount", "4");
VnfcDependencyModel dependencyModel = readDependencyModel();
@@ -343,16 +339,17 @@ public class VnfExecutionFlowImplTest {
.thenReturn(dependencyModel);
VnfExecutionFlow vnfExecutionFlow = new VnfExecutionFlowImpl();
- vnfExecutionFlow.getVnfExecutionFlowData(params,context);
+ vnfExecutionFlow.getVnfExecutionFlowData(params, context);
}
@Test(expected = RuntimeException.class)
- public void testMissingMandatoryVnfcTypeInInventoryModel() throws DependencyModelNotFound, InvalidDependencyModelException {
+ public void testMissingMandatoryVnfcTypeInInventoryModel()
+ throws DependencyModelNotFound, InvalidDependencyModelException {
Map<String, String> params = prepareParams();
SvcLogicContext context = prepareContext();
VnfcDependencyModel dependencyModel = readDependencyModel();
- Vnfc xe = createVnfc("XE","Active-Active",null, true);
+ Vnfc xe = createVnfc("XE", "Active-Active", null, true);
Node xeNode = new Node(xe);
dependencyModel.getDependencies().add(xeNode);
@@ -364,16 +361,17 @@ public class VnfExecutionFlowImplTest {
.thenReturn(dependencyModel);
VnfExecutionFlow vnfExecutionFlow = new VnfExecutionFlowImpl();
- vnfExecutionFlow.getVnfExecutionFlowData(params,context);
+ vnfExecutionFlow.getVnfExecutionFlowData(params, context);
}
@Test
- public void testMissingOptionalVnfcTypeInInventoryModel() throws DependencyModelNotFound, InvalidDependencyModelException {
+ public void testMissingOptionalVnfcTypeInInventoryModel()
+ throws DependencyModelNotFound, InvalidDependencyModelException {
Map<String, String> params = prepareParams();
SvcLogicContext context = prepareContext();
VnfcDependencyModel dependencyModel = readDependencyModel();
- Vnfc xe = createVnfc("XE","Active-Active",null, false);
+ Vnfc xe = createVnfc("XE", "Active-Active", null, false);
Node xeNode = new Node(xe);
dependencyModel.getDependencies().add(xeNode);
@@ -385,24 +383,25 @@ public class VnfExecutionFlowImplTest {
.thenReturn(dependencyModel);
VnfExecutionFlow vnfExecutionFlow = new VnfExecutionFlowImpl();
- vnfExecutionFlow.getVnfExecutionFlowData(params,context);
+ vnfExecutionFlow.getVnfExecutionFlowData(params, context);
}
@Test
- public void testMissingOptionalVnfcTypeInInventoryModelWithDependentChild() throws DependencyModelNotFound, InvalidDependencyModelException {
+ public void testMissingOptionalVnfcTypeInInventoryModelWithDependentChild()
+ throws DependencyModelNotFound, InvalidDependencyModelException {
Map<String, String> params = prepareParams();
SvcLogicContext context = prepareContext();
- context.setAttribute("vnf.vnfc[3].name","YEname");
- context.setAttribute("vnf.vnfc[3].type","YE");
- context.setAttribute("vnf.vnfc[3].vm_count","2");
- context.setAttribute("vnf.vnfc[3].vm[0].url","YE_URL1");
- context.setAttribute("vnf.vnfc[3].vm[1].url","YE_URL2");
- context.setAttribute("vnf.vnfcCount","4");
+ context.setAttribute("vnf.vnfc[3].name", "YEname");
+ context.setAttribute("vnf.vnfc[3].type", "YE");
+ context.setAttribute("vnf.vnfc[3].vm_count", "2");
+ context.setAttribute("vnf.vnfc[3].vm[0].url", "YE_URL1");
+ context.setAttribute("vnf.vnfc[3].vm[1].url", "YE_URL2");
+ context.setAttribute("vnf.vnfcCount", "4");
VnfcDependencyModel dependencyModel = readDependencyModel();
- Vnfc xe = createVnfc("XE","Active-Active",null, false);
- Vnfc ye = createVnfc("YE","Active-Active",null, true);
+ Vnfc xe = createVnfc("XE", "Active-Active", null, false);
+ Vnfc ye = createVnfc("YE", "Active-Active", null, true);
Node xeNode = new Node(xe);
Node yeNode = new Node(ye);
yeNode.addParent(xe);
@@ -418,8 +417,6 @@ public class VnfExecutionFlowImplTest {
.thenReturn(dependencyModel);
VnfExecutionFlow vnfExecutionFlow = new VnfExecutionFlowImpl();
- vnfExecutionFlow.getVnfExecutionFlowData(params,context);
+ vnfExecutionFlow.getVnfExecutionFlowData(params, context);
}
-
-
}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/utils/JSONUtilTest.java b/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/utils/JSONUtilTest.java
index 50429f680..a80e8ccba 100644
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/utils/JSONUtilTest.java
+++ b/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/utils/JSONUtilTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
-* Copyright 2018 AT&T
+* Copyright 2018-2019 AT&T
*=================================================================================
* Modifications Copyright 2018 IBM.
*=================================================================================
@@ -43,7 +43,8 @@ public class JSONUtilTest {
public void testFromJsonReader() {
try {
- JSONUtilVnfTest jOut = JSONUtil.fromJson(new FileReader("src/test/resources/data/input.json"), JSONUtilVnfTest.class);
+ JSONUtilVnfTest jOut =
+ JSONUtil.fromJson(new FileReader("src/test/resources/data/input.json"), JSONUtilVnfTest.class);
assertEquals("I1", jOut.getVnfId());
assertEquals("T1", jOut.getVnfType());
} catch (UncheckedIOException uioe) {
@@ -97,9 +98,9 @@ public class JSONUtilTest {
Map<String, String> map = JSONUtil.extractPlainValues(refJson, "vnfId", "vnfType");
HashMap<String, String> hashMap =
- (map instanceof HashMap)
- ? (HashMap) map
- : new HashMap<String, String>(map);
+ (map instanceof HashMap)
+ ? (HashMap) map
+ : new HashMap<String, String>(map);
assertEquals(hashMap.get("vnfId"), "I2");
assertEquals(hashMap.get("vnfType"), "T2");
@@ -108,10 +109,9 @@ public class JSONUtilTest {
fail(uioe.getMessage() + " Unchecked IO exception encountered");
}
}
-
+
@Test(expected=UncheckedIOException.class)
- public void testCatchSectionOfToJson() throws IOException
- {
- JSONUtil.toJson(new Object());
+ public void testCatchSectionOfToJson() throws IOException {
+ JSONUtil.toJson(new Object());
}
}
diff --git a/appc-dg/appc-dg-shared/appc-dg-dependency-model/src/main/java/org/onap/appc/dg/dependencymanager/helper/DependencyModelParser.java b/appc-dg/appc-dg-shared/appc-dg-dependency-model/src/main/java/org/onap/appc/dg/dependencymanager/helper/DependencyModelParser.java
index 48d1a05b6..4b40ba27a 100644
--- a/appc-dg/appc-dg-shared/appc-dg-dependency-model/src/main/java/org/onap/appc/dg/dependencymanager/helper/DependencyModelParser.java
+++ b/appc-dg/appc-dg-shared/appc-dg-dependency-model/src/main/java/org/onap/appc/dg/dependencymanager/helper/DependencyModelParser.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=========================================================
*/
@@ -51,7 +50,7 @@ public class DependencyModelParser {
private static final String PROPERTIES = "properties";
private static final String ACTIVE_ACTIVE = "Active-Active";
private static final String ACTIVE_PASSIVE = "Active-Passive";
- private static final String HIGH_AVAILABLITY = "high_availablity";
+ private static final String HIGH_AVAILABLITY = "high_availablity"; // Deprecated original spelling
private static final String HIGH_AVAILABILITY = "high_availability";
private static final String MANDATORY = "mandatory";
private static final String TOPOLOGY_TEMPLATE = "topology_template";
@@ -69,7 +68,7 @@ public class DependencyModelParser {
}
public VnfcDependencyModel generateDependencyModel(String vnfModel, String vnfType)
- throws InvalidDependencyModelException {
+ throws InvalidDependencyModelException {
Set<Node<Vnfc>> dependencies = new HashSet<>();
ObjectMapper mapper = getMapper();
boolean mandatory;
@@ -78,13 +77,15 @@ public class DependencyModelParser {
try {
ObjectNode root = (ObjectNode) mapper.readTree(vnfModel);
- if (root.get(TOPOLOGY_TEMPLATE) == null || root.get(TOPOLOGY_TEMPLATE).get("node_templates") == null) {
+ JsonNode topologyTemplateNode = root.get(TOPOLOGY_TEMPLATE);
+ JsonNode nodeTemplateNode;
+
+ if (topologyTemplateNode == null
+ || (nodeTemplateNode = topologyTemplateNode.get("node_templates")) == null) {
throw new InvalidDependencyModelException(
- "Dependency model is missing 'topology_template' or 'node_templates' elements");
+ "Dependency model is missing 'topology_template' or 'node_templates' elements");
}
- JsonNode topologyTemplateNode = root.get(TOPOLOGY_TEMPLATE);
- JsonNode nodeTemplateNode = topologyTemplateNode.get("node_templates");
Iterator<Map.Entry<String, JsonNode>> iterator = nodeTemplateNode.fields();
for (JsonNode yamlNode : nodeTemplateNode) {
logger.debug("Processing node: " + yamlNode);
@@ -92,7 +93,7 @@ public class DependencyModelParser {
String vnfcType = getQualifiedVnfcType(fullvnfcType);
String type = yamlNode.get("type").textValue();
type = type.substring(0, type.lastIndexOf('.') + 1);
- if (type.concat(vnfcType).toLowerCase().startsWith(prefix.concat(vnfcType).toLowerCase())) {
+ if (type.toLowerCase().startsWith(prefix.toLowerCase())) {
resilienceType = resolveResilienceType(yamlNode);
mandatory = resolveMandatory(yamlNode);
@@ -103,23 +104,23 @@ public class DependencyModelParser {
logger.debug("Dependency node already exists for vnfc Type: " + vnfcType);
if (StringUtils.isEmpty(vnfcNode.getChild().getResilienceType())) {
logger.debug("Updating resilience type, "
- + "dependencies and mandatory attribute for VNFC type: " + vnfcType);
+ + "dependencies and mandatory attribute for VNFC type: " + vnfcType);
vnfcNode.getChild().setResilienceType(resilienceType);
tryFillNode(dependencies, parentList, vnfcNode);
vnfcNode.getChild().setMandatory(mandatory);
}
} else {
- logger.debug("Creating dependency node for : " + vnfcType);
+ logger.debug("Creating dependency node for: " + vnfcType);
vnfcNode = new Node<>(createVnfc(mandatory, resilienceType, vnfcType));
tryFillNode(dependencies, parentList, vnfcNode);
- logger.debug("Adding VNFC to dependency model : " + vnfcNode);
+ logger.debug("Adding VNFC to dependency model: " + vnfcNode);
dependencies.add(vnfcNode);
}
}
}
} catch (IOException e) {
- logger.error("Error parsing dependency model : " + vnfModel);
- logger.error("Error message : " + e);
+ logger.error("Error parsing dependency model: " + vnfModel);
+ logger.error("Error message: " + e);
throw new InvalidDependencyModelException("Error parsing dependency model. " + e.getMessage());
}
return new VnfcDependencyModel(dependencies);
@@ -136,8 +137,8 @@ public class DependencyModelParser {
}
private boolean mandatoryDoesNotExist(JsonNode yamlNode) {
- return yamlNode.get(PROPERTIES).findValue(MANDATORY) == null ||
- yamlNode.get(PROPERTIES).findValue(MANDATORY).asText().isEmpty();
+ return yamlNode.get(PROPERTIES).findValue(MANDATORY) == null
+ || yamlNode.get(PROPERTIES).findValue(MANDATORY).asText().isEmpty();
}
private String resolveResilienceType(JsonNode yamlNode) {
@@ -148,10 +149,10 @@ public class DependencyModelParser {
resilienceType = dependencyMap
.get(yamlNode.get(PROPERTIES).findValue(HIGH_AVAILABILITY).textValue());
}
- // The property name "high_availability" was misspelled in the code so leaving in the code to check for the
+ // The property name "high_availability" was misspelled in the code so leaving in the code to check for the
// incorrectly spelled version to avoid breaking existing configurations using the misspelled version
- else if (yamlNode.get(PROPERTIES).findValue(HIGH_AVAILABLITY) == null ||
- yamlNode.get(PROPERTIES).findValue(HIGH_AVAILABLITY).asText().isEmpty()) {
+ else if (yamlNode.get(PROPERTIES).findValue(HIGH_AVAILABLITY) == null
+ || yamlNode.get(PROPERTIES).findValue(HIGH_AVAILABLITY).asText().isEmpty()) {
resilienceType = ACTIVE_ACTIVE;
} else {
resilienceType = dependencyMap
@@ -177,25 +178,27 @@ public class DependencyModelParser {
String parentType = getVnfcType(type);
Node<Vnfc> parentNode = getNode(nodes, parentType);
if (parentNode != null) {
- logger.debug("VNFC already exists for VNFC type: " + parentType + ". Adding it to parent list ");
+ logger.debug("VNFC already exists for VNFC type: " + parentType + ". Adding it to parent list");
node.addParent(parentNode.getChild());
} else {
- logger.debug("VNFC does not exist for VNFC type: " + parentType + ". Creating new VNFC ");
+ logger.debug("VNFC does not exist for VNFC type: " + parentType + ". Creating new VNFC");
parentNode = new Node<>(createVnfc(false, null, parentType));
node.addParent(parentNode.getChild());
- logger.debug("Adding VNFC to dependency model : " + parentNode);
+ logger.debug("Adding VNFC to dependency model: " + parentNode);
nodes.add(parentNode);
}
}
}
private String[] getDependencyArray(JsonNode node, JsonNode nodeTemplateNode)
- throws InvalidDependencyModelException {
+ throws InvalidDependencyModelException {
JsonNode requirementsNode = node.get("requirements");
Set<String> dependencyList = new HashSet<>();
if (requirementsNode != null) {
for (JsonNode internalNode : requirementsNode) {
- //TODO : In this release we are supporting both relationship = tosca.capabilities.Node and relationship =tosca.relationships.DependsOn we need to remove one of them in next release post confirming with SDC team
+ /* TODO: In this release we are supporting both relationship = tosca.capabilities.Node
+ and relationship = tosca.relationships.DependsOn
+ we need to remove one of them in next release post confirming with SDC team */
if (verifyNode(internalNode)) {
parseDependencyModel(node, nodeTemplateNode, dependencyList, internalNode);
}
@@ -207,7 +210,7 @@ public class DependencyModelParser {
}
private void parseDependencyModel(JsonNode node, JsonNode nodeTemplateNode, Set<String> dependencyList,
- JsonNode internalNode) throws InvalidDependencyModelException {
+ JsonNode internalNode) throws InvalidDependencyModelException {
if (internalNode.findValue("node") != null) {
String nodeName = internalNode.findValue("node").asText();
@@ -215,20 +218,20 @@ public class DependencyModelParser {
dependencyList.add(getQualifiedVnfcType(fullVnfcName));
} else {
throw new InvalidDependencyModelException(
- "Error parsing dependency model. " + "Dependent Node not found for " + node.get("type"));
+ "Error parsing dependency model. Dependent Node not found for " + node.get("type"));
}
}
private boolean verifyNode(JsonNode internalNode) {
- return nodeNullCheck(internalNode) &&
- "tosca.capabilities.Node".equalsIgnoreCase(internalNode.findValue("capability").asText()) &&
- ("tosca.relationships.DependsOn".equalsIgnoreCase(internalNode.findValue(RELATIONSHIP).asText()) ||
- "tosca.capabilities.Node".equalsIgnoreCase(internalNode.findValue(RELATIONSHIP).asText()));
+ return nodeNullCheck(internalNode)
+ && "tosca.capabilities.Node".equalsIgnoreCase(internalNode.findValue("capability").asText())
+ && ("tosca.relationships.DependsOn".equalsIgnoreCase(internalNode.findValue(RELATIONSHIP).asText())
+ || "tosca.capabilities.Node".equalsIgnoreCase(internalNode.findValue(RELATIONSHIP).asText()));
}
private boolean nodeNullCheck(JsonNode internalNode) {
return internalNode.get("dependency") != null && internalNode.findValue("capability") != null
- && internalNode.findValue(RELATIONSHIP) != null;
+ && internalNode.findValue(RELATIONSHIP) != null;
}
protected Node<Vnfc> getNode(Set<Node<Vnfc>> nodes, String vnfcType) {
diff --git a/appc-dg/appc-dg-shared/appc-dg-dependency-model/src/main/java/org/onap/appc/dg/dependencymanager/impl/DependencyManagerImpl.java b/appc-dg/appc-dg-shared/appc-dg-dependency-model/src/main/java/org/onap/appc/dg/dependencymanager/impl/DependencyManagerImpl.java
index e9404dd41..60f5f0e30 100644
--- a/appc-dg/appc-dg-shared/appc-dg-dependency-model/src/main/java/org/onap/appc/dg/dependencymanager/impl/DependencyManagerImpl.java
+++ b/appc-dg/appc-dg-shared/appc-dg-dependency-model/src/main/java/org/onap/appc/dg/dependencymanager/impl/DependencyManagerImpl.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=========================================================
*/
@@ -44,17 +43,18 @@ public class DependencyManagerImpl implements DependencyManager {
MetadataCache<DependencyModelIdentifier,VnfcDependencyModel> cache;
- DependencyManagerImpl(){
+ DependencyManagerImpl() {
cache = MetadataCacheFactory.getInstance().getMetadataCache();
}
- public VnfcDependencyModel getVnfcDependencyModel(DependencyModelIdentifier modelIdentifier,DependencyTypes dependencyType) throws InvalidDependencyModelException, DependencyModelNotFound {
+ public VnfcDependencyModel getVnfcDependencyModel(DependencyModelIdentifier modelIdentifier,
+ DependencyTypes dependencyType) throws InvalidDependencyModelException, DependencyModelNotFound {
if (logger.isTraceEnabled()) {
- logger.trace("Entering to getVnfcDependencyModel with DependencyModelIdentifier = "+ modelIdentifier
+ logger.trace("Entering to getVnfcDependencyModel with DependencyModelIdentifier = " + modelIdentifier
+ " , DependencyTypes = " + dependencyType);
}
VnfcDependencyModel dependencyModel = cache.getObject(modelIdentifier);
- if(dependencyModel == null){
+ if (dependencyModel == null) {
logger.debug("Dependency model not found in cache, creating strategy for reading it");
DependencyType strategy = getStrategy(dependencyType);
// Throw exception if strategy could not be created because it is required
@@ -65,13 +65,13 @@ public class DependencyManagerImpl implements DependencyManager {
dependencyModel = strategy.getVnfcDependencyModel(modelIdentifier);
}
if (logger.isTraceEnabled()) {
- logger.trace("Returning getVnfcDependencyModel with dependency model = "+ dependencyModel);
+ logger.trace("Returning getVnfcDependencyModel with dependency model = " + dependencyModel);
}
return dependencyModel;
}
private DependencyType getStrategy(DependencyTypes dependencyType) {
- switch (dependencyType){
+ switch (dependencyType) {
case RESOURCE:
return new ResourceDependency();
}
diff --git a/appc-dg/appc-dg-shared/appc-dg-dependency-model/src/main/java/org/onap/appc/dg/dependencymanager/impl/ResourceDependency.java b/appc-dg/appc-dg-shared/appc-dg-dependency-model/src/main/java/org/onap/appc/dg/dependencymanager/impl/ResourceDependency.java
index 167d23909..603ba3707 100644
--- a/appc-dg/appc-dg-shared/appc-dg-dependency-model/src/main/java/org/onap/appc/dg/dependencymanager/impl/ResourceDependency.java
+++ b/appc-dg/appc-dg-shared/appc-dg-dependency-model/src/main/java/org/onap/appc/dg/dependencymanager/impl/ResourceDependency.java
@@ -2,22 +2,21 @@
* ============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
* =============================================================================
* 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=========================================================
*/
@@ -38,14 +37,14 @@ import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.ServiceReference;
-public class ResourceDependency implements DependencyType{
+public class ResourceDependency implements DependencyType {
private static final EELFLogger logger = EELFManager.getInstance().getLogger(ResourceDependency.class);
private MetadataService metadataService;
- public ResourceDependency(){
+ public ResourceDependency() {
getMetadataServiceRef();
}
@@ -67,12 +66,13 @@ public class ResourceDependency implements DependencyType{
this.metadataService = metadataService;
}
- public VnfcDependencyModel getVnfcDependencyModel(DependencyModelIdentifier modelIdentifier) throws InvalidDependencyModelException, DependencyModelNotFound {
+ public VnfcDependencyModel getVnfcDependencyModel(DependencyModelIdentifier modelIdentifier)
+ throws InvalidDependencyModelException, DependencyModelNotFound {
if (logger.isTraceEnabled()) {
- logger.trace("Entering to getVnfcDependencyModel with DependencyModelIdentifier = "+ modelIdentifier);
+ logger.trace("Entering to getVnfcDependencyModel with DependencyModelIdentifier = " + modelIdentifier);
}
String vnfModel = metadataService.getVnfModel(modelIdentifier);
- if(vnfModel ==null){
+ if (vnfModel == null) {
logger.debug("Vnf model not found from metadata service");
throw new DependencyModelNotFound("Invalid or Empty VNF Model");
}
@@ -80,6 +80,6 @@ public class ResourceDependency implements DependencyType{
logger.trace("Building dependency model for Vnf Model : " + vnfModel);
}
DependencyModelParser modelParser = new DependencyModelParser();
- return modelParser.generateDependencyModel(vnfModel,modelIdentifier.getVnfType());
+ return modelParser.generateDependencyModel(vnfModel, modelIdentifier.getVnfType());
}
}
diff --git a/appc-dg/appc-dg-shared/appc-dg-dependency-model/src/test/java/org/onap/appc/dg/dependencymanager/helper/DependencyModelParserTest.java b/appc-dg/appc-dg-shared/appc-dg-dependency-model/src/test/java/org/onap/appc/dg/dependencymanager/helper/DependencyModelParserTest.java
index e7951c61d..36a7210ff 100644
--- a/appc-dg/appc-dg-shared/appc-dg-dependency-model/src/test/java/org/onap/appc/dg/dependencymanager/helper/DependencyModelParserTest.java
+++ b/appc-dg/appc-dg-shared/appc-dg-dependency-model/src/test/java/org/onap/appc/dg/dependencymanager/helper/DependencyModelParserTest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2019 Ericsson
* =============================================================================
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property
+ * =============================================================================
* 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
@@ -27,7 +29,9 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
import org.onap.appc.dg.flowbuilder.exception.InvalidDependencyModelException;
import org.onap.appc.dg.objects.VnfcDependencyModel;
import org.onap.appc.dg.objects.Node;
@@ -37,6 +41,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
+@RunWith(MockitoJUnitRunner.class)
public class DependencyModelParserTest {
@Rule
@@ -54,7 +59,8 @@ public class DependencyModelParserTest {
}
@Test
- public void testGenerateDependencyModel() throws InvalidDependencyModelException, JsonProcessingException, IOException {
+ public void testGenerateDependencyModel()
+ throws InvalidDependencyModelException, JsonProcessingException, IOException {
ObjectNode topologyTemplate = new ObjectNode(JsonNodeFactory.instance);
topologyTemplate = (ObjectNode) new ObjectMapper().readTree(jsonString);
Mockito.doReturn(topologyTemplate).when(mockMapper).readTree("VNF_MODEL");
@@ -63,7 +69,8 @@ public class DependencyModelParserTest {
}
@Test
- public void testGenerateDependencyModelWithNode() throws InvalidDependencyModelException, JsonProcessingException, IOException {
+ public void testGenerateDependencyModelWithNode()
+ throws InvalidDependencyModelException, JsonProcessingException, IOException {
ObjectNode topologyTemplate = new ObjectNode(JsonNodeFactory.instance);
topologyTemplate = (ObjectNode) new ObjectMapper().readTree(jsonString);
Node<Vnfc> vnfc = new Node(new Vnfc());
@@ -76,32 +83,33 @@ public class DependencyModelParserTest {
@Test
public void testGenerateDependencyModelExceptionFlow() throws InvalidDependencyModelException {
expectedEx.expect(InvalidDependencyModelException.class);
- expectedEx.expectMessage("Dependency model is missing 'topology_template' or 'node_templates' elements");
+ expectedEx.expectMessage("Dependency model is missing 'topology_template' or 'node_templates' elements");
VnfcDependencyModel model = parser.generateDependencyModel("VNF_MODEL", "VNF_TYPE");
}
- private String jsonString = "{\"topology_template\": {" +
- " \"node_templates\": {" +
- " \"Property Definition_Template\": {" +
- " \"type\": \"org.onap.resource.vfc.vnf_type.abstract.nodes.property definition\"," +
- " \"properties\": {" +
- " \"mandatory\": \"true\"," +
- " \"high_availablity\": \"Active-Passive\"" +
- " },\"requirements\": [" +
- " {" +
- " \"dependency\": {" +
- " \"capability\": \"tosca.capabilities.Node\"," +
- " \"node\": \"tosca.nodes.Root\"," +
- " \"relationship\": \"tosca.relationships.DependsOn\"," +
- " \"occurrences\": [" +
- " 0," +
- " \"UNBOUNDED\"" +
- " ]" +
- " }" +
- " }" +
- " ]" +
- " },\"tosca.nodes.Root\": {\"type\": \"VNFC_NAME\"}" +
- " }" +
- " }" +
- "}";
+ private String jsonString =
+ "{\"topology_template\": {"
+ + " \"node_templates\": {"
+ + " \"Property Definition_Template\": {"
+ + " \"type\": \"org.onap.resource.vfc.vnf_type.abstract.nodes.property definition\","
+ + " \"properties\": {"
+ + " \"mandatory\": \"true\","
+ + " \"high_availability\": \"Active-Passive\""
+ + " },\"requirements\": ["
+ + " {"
+ + " \"dependency\": {"
+ + " \"capability\": \"tosca.capabilities.Node\","
+ + " \"node\": \"tosca.nodes.Root\","
+ + " \"relationship\": \"tosca.relationships.DependsOn\","
+ + " \"occurrences\": ["
+ + " 0,"
+ + " \"UNBOUNDED\""
+ + " ]"
+ + " }"
+ + " }"
+ + " ]"
+ + " },\"tosca.nodes.Root\": {\"type\": \"VNFC_NAME\"}"
+ + " }"
+ + " }"
+ + "}";
}
diff --git a/appc-dg/appc-dg-shared/appc-dg-dependency-model/src/test/java/org/onap/appc/dg/flowbuilder/TestFlowBuilder.java b/appc-dg/appc-dg-shared/appc-dg-dependency-model/src/test/java/org/onap/appc/dg/flowbuilder/TestFlowBuilder.java
index ef3a1af7b..07ca83a10 100644
--- a/appc-dg/appc-dg-shared/appc-dg-dependency-model/src/test/java/org/onap/appc/dg/flowbuilder/TestFlowBuilder.java
+++ b/appc-dg/appc-dg-shared/appc-dg-dependency-model/src/test/java/org/onap/appc/dg/flowbuilder/TestFlowBuilder.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
* ================================================================================
@@ -13,15 +13,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=========================================================
*/
@@ -50,20 +49,20 @@ public class TestFlowBuilder {
FlowBuilder builder = FlowBuilderFactory.getInstance().getFlowBuilder(FlowStrategies.FORWARD);
VnfcDependencyModel dependencyModel = readDependencyModel();
InventoryModel inventoryModel = readInventoryModel();
- VnfcFlowModel flowModel = builder.buildFlowModel(dependencyModel,inventoryModel);
+ VnfcFlowModel flowModel = builder.buildFlowModel(dependencyModel, inventoryModel);
Iterator<List<Vnfc>> itr = flowModel.getModelIterator();
List<Vnfc> list = itr.next();
- Assert.assertTrue(list.contains(createVnfc("SMP","Active-Passive","SMP_Name")));
+ Assert.assertTrue(list.contains(createVnfc("SMP", "Active-Passive", "SMP_Name")));
list = itr.next();
- Assert.assertTrue(list.contains(createVnfc("BE","Active-Active","BE_Name")));
+ Assert.assertTrue(list.contains(createVnfc("BE", "Active-Active", "BE_Name")));
list = itr.next();
- Assert.assertTrue(list.contains(createVnfc("FE","Active-Active","FE_Name")));
+ Assert.assertTrue(list.contains(createVnfc("FE", "Active-Active", "FE_Name")));
}
- private Vnfc createVnfc(String vnfcType,String resilienceType,String vnfcName) {
+ private Vnfc createVnfc(String vnfcType, String resilienceType, String vnfcName) {
Vnfc vnfc = new Vnfc();
vnfc.setVnfcType(vnfcType);
vnfc.setVnfcName(vnfcName);
@@ -76,17 +75,17 @@ public class TestFlowBuilder {
FlowBuilder builder = FlowBuilderFactory.getInstance().getFlowBuilder(FlowStrategies.REVERSE);
VnfcDependencyModel dependencyModel = readDependencyModel();
InventoryModel inventoryModel = readInventoryModel();
- VnfcFlowModel flowModel = builder.buildFlowModel(dependencyModel,inventoryModel);
+ VnfcFlowModel flowModel = builder.buildFlowModel(dependencyModel, inventoryModel);
Iterator<List<Vnfc>> itr = flowModel.getModelIterator();
List<Vnfc> list = itr.next();
- Assert.assertTrue(list.contains(createVnfc("FE","Active-Active","FE_Name")));
+ Assert.assertTrue(list.contains(createVnfc("FE", "Active-Active", "FE_Name")));
list = itr.next();
- Assert.assertTrue(list.contains(createVnfc("BE","Active-Active","BE_Name")));
+ Assert.assertTrue(list.contains(createVnfc("BE", "Active-Active", "BE_Name")));
list = itr.next();
- Assert.assertTrue(list.contains(createVnfc("SMP","Active-Passive","SMP_Name")));
+ Assert.assertTrue(list.contains(createVnfc("SMP", "Active-Passive", "SMP_Name")));
Assert.assertThat(flowModel.toString(), CoreMatchers.containsString("Flow Model : Vnfc : vnfcType = FE"));
}
@@ -96,25 +95,24 @@ public class TestFlowBuilder {
FlowBuilder builder = FlowBuilderFactory.getInstance().getFlowBuilder(FlowStrategies.FORWARD);
VnfcDependencyModel dependencyModel = readComplexDependencyModel();
InventoryModel inventoryModel = readComplexInventoryModel();
- VnfcFlowModel flowModel = builder.buildFlowModel(dependencyModel,inventoryModel);
+ VnfcFlowModel flowModel = builder.buildFlowModel(dependencyModel, inventoryModel);
Iterator<List<Vnfc>> itr = flowModel.getModelIterator();
- try{
+ try {
List<Vnfc> list = itr.next();
- Assert.assertTrue(list.contains(createVnfc("A","Active-Active","A_Name")));
- Assert.assertTrue(list.contains(createVnfc("E","Active-Active","E_Name")));
+ Assert.assertTrue(list.contains(createVnfc("A", "Active-Active", "A_Name")));
+ Assert.assertTrue(list.contains(createVnfc("E", "Active-Active", "E_Name")));
list = itr.next();
- Assert.assertTrue(list.contains(createVnfc("B","Active-Active","B_Name")));
- Assert.assertTrue(list.contains(createVnfc("C","Active-Active","C_Name")));
+ Assert.assertTrue(list.contains(createVnfc("B", "Active-Active", "B_Name")));
+ Assert.assertTrue(list.contains(createVnfc("C", "Active-Active", "C_Name")));
list = itr.next();
- Assert.assertTrue(list.contains(createVnfc("D","Active-Active","D_Name")));
- Assert.assertTrue(list.contains(createVnfc("F","Active-Active","F_Name")));
+ Assert.assertTrue(list.contains(createVnfc("D", "Active-Active", "D_Name")));
+ Assert.assertTrue(list.contains(createVnfc("F", "Active-Active", "F_Name")));
list = itr.next();
- Assert.assertTrue(list.contains(createVnfc("G","Active-Active","G_Name")));
- }
- catch (Exception e){
+ Assert.assertTrue(list.contains(createVnfc("G", "Active-Active", "G_Name")));
+ } catch (Exception e) {
e.printStackTrace();
}
}
@@ -124,24 +122,24 @@ public class TestFlowBuilder {
FlowBuilder builder = FlowBuilderFactory.getInstance().getFlowBuilder(FlowStrategies.REVERSE);
VnfcDependencyModel dependencyModel = readComplexDependencyModel();
InventoryModel inventoryModel = readComplexInventoryModel();
- VnfcFlowModel flowModel = builder.buildFlowModel(dependencyModel,inventoryModel);
+ VnfcFlowModel flowModel = builder.buildFlowModel(dependencyModel, inventoryModel);
Iterator<List<Vnfc>> itr = flowModel.getModelIterator();
List<Vnfc> list = itr.next();
- Assert.assertTrue(list.contains(createVnfc("D","Active-Active","D_Name")));
+ Assert.assertTrue(list.contains(createVnfc("D", "Active-Active", "D_Name")));
- Assert.assertTrue(list.contains(createVnfc("G","Active-Active","G_Name")));
+ Assert.assertTrue(list.contains(createVnfc("G", "Active-Active", "G_Name")));
list = itr.next();
- Assert.assertTrue(list.contains(createVnfc("B","Active-Active","B_Name")));
- Assert.assertTrue(list.contains(createVnfc("F","Active-Active","F_Name")));
+ Assert.assertTrue(list.contains(createVnfc("B", "Active-Active", "B_Name")));
+ Assert.assertTrue(list.contains(createVnfc("F", "Active-Active", "F_Name")));
list = itr.next();
- Assert.assertTrue(list.contains(createVnfc("C","Active-Active","C_Name")));
+ Assert.assertTrue(list.contains(createVnfc("C", "Active-Active", "C_Name")));
list = itr.next();
- Assert.assertTrue(list.contains(createVnfc("E","Active-Active","E_Name")));
- Assert.assertTrue(list.contains(createVnfc("A","Active-Active","A_Name")));
+ Assert.assertTrue(list.contains(createVnfc("E", "Active-Active", "E_Name")));
+ Assert.assertTrue(list.contains(createVnfc("A", "Active-Active", "A_Name")));
}
@@ -150,7 +148,7 @@ public class TestFlowBuilder {
FlowBuilder builder = FlowBuilderFactory.getInstance().getFlowBuilder(FlowStrategies.findByString("FORWARD"));
VnfcDependencyModel dependencyModel = readCyclicDependencyModel();
InventoryModel inventoryModel = readInventoryModel();
- builder.buildFlowModel(dependencyModel,inventoryModel);
+ builder.buildFlowModel(dependencyModel, inventoryModel);
}
@Test(expected = InvalidDependencyModelException.class)
@@ -158,20 +156,20 @@ public class TestFlowBuilder {
FlowBuilder builder = FlowBuilderFactory.getInstance().getFlowBuilder(FlowStrategies.FORWARD);
VnfcDependencyModel dependencyModel = readCyclicDependencyModelWithRootNode();
InventoryModel inventoryModel = readInventoryModel();
- builder.buildFlowModel(dependencyModel,inventoryModel);
+ builder.buildFlowModel(dependencyModel, inventoryModel);
}
-
+
@Test
- public void testInventoryModelToString(){
- Vnf vnf = createVnf("vnf_1","vABCD","1");
+ public void testInventoryModelToString() {
+ Vnf vnf = createVnf("vnf_1", "vABCD", "1");
InventoryModel inventoryModel = new InventoryModel(vnf);
Assert.assertEquals("InventoryModel = Vnf : vnfId = vnf_1 , vnfType = vABCD", inventoryModel.toString());
}
private VnfcDependencyModel readCyclicDependencyModelWithRootNode() {
- Vnfc a = createVnfc("A","Active-Passive",null);
- Vnfc b = createVnfc("B","Active-Active",null);
- Vnfc c = createVnfc("C","Active-Active",null);
+ Vnfc a = createVnfc("A", "Active-Passive", null);
+ Vnfc b = createVnfc("B", "Active-Active", null);
+ Vnfc c = createVnfc("C", "Active-Active", null);
Node aNode = new Node(a);
@@ -194,28 +192,28 @@ public class TestFlowBuilder {
}
private InventoryModel readComplexInventoryModel() {
- Vnf vnf = createVnf("vnf_1","vABCD","1");
-
- Vnfc vnfcA = createVnfc("A","Active-Active","A_Name");
- Vnfc vnfcB = createVnfc("B","Active-Active","B_Name");
- Vnfc vnfcC = createVnfc("C","Active-Active","C_Name");
- Vnfc vnfcD = createVnfc("D","Active-Active","D_Name");
- Vnfc vnfcE = createVnfc("E","Active-Active","E_Name");
- Vnfc vnfcF = createVnfc("F","Active-Active","F_Name");
- Vnfc vnfcG = createVnfc("G","Active-Active","G_Name");
-
- vnf.addVserver(createVserver("VM_URL_A1",vnfcA));
- vnf.addVserver(createVserver("VM_URL_B1",vnfcB));
- vnf.addVserver(createVserver("VM_URL_C1",vnfcC));
- vnf.addVserver(createVserver("VM_URL_D1",vnfcD));
- vnf.addVserver(createVserver("VM_URL_E1",vnfcE));
- vnf.addVserver(createVserver("VM_URL_F1",vnfcF));
- vnf.addVserver(createVserver("VM_URL_G1",vnfcG));
+ Vnf vnf = createVnf("vnf_1", "vABCD", "1");
+
+ Vnfc vnfcA = createVnfc("A", "Active-Active", "A_Name");
+ Vnfc vnfcB = createVnfc("B", "Active-Active", "B_Name");
+ Vnfc vnfcC = createVnfc("C", "Active-Active", "C_Name");
+ Vnfc vnfcD = createVnfc("D", "Active-Active", "D_Name");
+ Vnfc vnfcE = createVnfc("E", "Active-Active", "E_Name");
+ Vnfc vnfcF = createVnfc("F", "Active-Active", "F_Name");
+ Vnfc vnfcG = createVnfc("G", "Active-Active", "G_Name");
+
+ vnf.addVserver(createVserver("VM_URL_A1", vnfcA));
+ vnf.addVserver(createVserver("VM_URL_B1", vnfcB));
+ vnf.addVserver(createVserver("VM_URL_C1", vnfcC));
+ vnf.addVserver(createVserver("VM_URL_D1", vnfcD));
+ vnf.addVserver(createVserver("VM_URL_E1", vnfcE));
+ vnf.addVserver(createVserver("VM_URL_F1", vnfcF));
+ vnf.addVserver(createVserver("VM_URL_G1", vnfcG));
return new InventoryModel(vnf);
}
- private Vnf createVnf(String vnfId,String vnfType,String vnfVersion) {
+ private Vnf createVnf(String vnfId, String vnfType, String vnfVersion) {
Vnf vnf = new Vnf();
vnf.setVnfId(vnfId);
vnf.setVnfType(vnfType);
@@ -224,13 +222,13 @@ public class TestFlowBuilder {
}
private VnfcDependencyModel readComplexDependencyModel() {
- Vnfc a = createVnfc("A","Active-Active",null);
- Vnfc b = createVnfc("B","Active-Active",null);
- Vnfc c = createVnfc("C","Active-Active",null);
- Vnfc d = createVnfc("D","Active-Active",null);
- Vnfc e = createVnfc("E","Active-Active",null);
- Vnfc f = createVnfc("F","Active-Active",null);
- Vnfc g = createVnfc("G","Active-Active",null);
+ Vnfc a = createVnfc("A", "Active-Active", null);
+ Vnfc b = createVnfc("B", "Active-Active", null);
+ Vnfc c = createVnfc("C", "Active-Active", null);
+ Vnfc d = createVnfc("D", "Active-Active", null);
+ Vnfc e = createVnfc("E", "Active-Active", null);
+ Vnfc f = createVnfc("F", "Active-Active", null);
+ Vnfc g = createVnfc("G", "Active-Active", null);
Node aNode = new Node(a);
@@ -268,10 +266,10 @@ public class TestFlowBuilder {
private VnfcDependencyModel readCyclicDependencyModel() {
- Vnfc a = createVnfc("A","Active-Passive",null);
- Vnfc b = createVnfc("B","Active-Active",null);
- Vnfc c = createVnfc("C","Active-Active",null);
- Vnfc d = createVnfc("D","Active-Active",null);
+ Vnfc a = createVnfc("A", "Active-Passive", null);
+ Vnfc b = createVnfc("B", "Active-Active", null);
+ Vnfc c = createVnfc("C", "Active-Active", null);
+ Vnfc d = createVnfc("D", "Active-Active", null);
Node aNode = new Node(a);
@@ -297,22 +295,22 @@ public class TestFlowBuilder {
}
private InventoryModel readInventoryModel() {
- Vnf vnf = createVnf("vnf_1","vSCP","1");
+ Vnf vnf = createVnf("vnf_1", "vSCP", "1");
- Vnfc smp = createVnfc("SMP",null,"SMP_Name");
- Vserver smpVm1 = createVserver("SMP_URL1",smp);
- Vserver smpVm2 = createVserver("SMP_URL2",smp);
+ Vnfc smp = createVnfc("SMP", null, "SMP_Name");
+ Vserver smpVm1 = createVserver("SMP_URL1", smp);
+ Vserver smpVm2 = createVserver("SMP_URL2", smp);
vnf.addVserver(smpVm1);
vnf.addVserver(smpVm2);
- Vnfc be = createVnfc("BE",null,"BE_Name");
+ Vnfc be = createVnfc("BE", null, "BE_Name");
- Vserver beVm1 = createVserver("BE_URL1",be);
- Vserver beVm2 = createVserver("BE_URL2",be);
- Vserver beVm3 = createVserver("BE_URL3",be);
- Vserver beVm4 = createVserver("BE_URL4",be);
- Vserver beVm5 = createVserver("BE_URL5",be);
+ Vserver beVm1 = createVserver("BE_URL1", be);
+ Vserver beVm2 = createVserver("BE_URL2", be);
+ Vserver beVm3 = createVserver("BE_URL3", be);
+ Vserver beVm4 = createVserver("BE_URL4", be);
+ Vserver beVm5 = createVserver("BE_URL5", be);
vnf.addVserver(beVm1);
vnf.addVserver(beVm2);
@@ -320,10 +318,10 @@ public class TestFlowBuilder {
vnf.addVserver(beVm4);
vnf.addVserver(beVm5);
- Vnfc fe = createVnfc("FE",null,"FE_Name");
+ Vnfc fe = createVnfc("FE", null, "FE_Name");
- Vserver feVm1 = createVserver("FE_URL1",fe);
- Vserver feVm2 = createVserver("FE_URL2",fe);
+ Vserver feVm1 = createVserver("FE_URL1", fe);
+ Vserver feVm2 = createVserver("FE_URL2", fe);
vnf.addVserver(feVm1);
vnf.addVserver(feVm2);
@@ -331,7 +329,7 @@ public class TestFlowBuilder {
return new InventoryModel(vnf);
}
- private Vserver createVserver(String url,Vnfc vnfc) {
+ private Vserver createVserver(String url, Vnfc vnfc) {
Vserver vserver = new Vserver();
vserver.setUrl(url);
vserver.setVnfc(vnfc);
@@ -340,9 +338,9 @@ public class TestFlowBuilder {
}
private VnfcDependencyModel readDependencyModel() {
- Vnfc smp = createVnfc("SMP","Active-Passive",null);
- Vnfc be = createVnfc("BE","Active-Active",null);
- Vnfc fe = createVnfc("FE","Active-Active",null);
+ Vnfc smp = createVnfc("SMP", "Active-Passive", null);
+ Vnfc be = createVnfc("BE", "Active-Active", null);
+ Vnfc fe = createVnfc("FE", "Active-Active", null);
Node smpNode = new Node(smp);
diff --git a/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/test/java/org/onap/appc/domainmodel/TestVnf.java b/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/test/java/org/onap/appc/domainmodel/TestVnf.java
index 6ddb37ba1..176900a34 100644
--- a/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/test/java/org/onap/appc/domainmodel/TestVnf.java
+++ b/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/test/java/org/onap/appc/domainmodel/TestVnf.java
@@ -6,6 +6,8 @@
*=================================================================================
* Modifications Copyright 2018 IBM.
*=================================================================================
+* Modifications Copyright (C) 2019 AT&T Intellectual Property
+*=================================================================================
* 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
@@ -37,28 +39,28 @@ public class TestVnf {
@Before
public void SetUp() {
- vnf=new Vnf();
+ vnf = new Vnf();
}
@Test
public void testGetVnfId() {
vnf.setVnfId("Z");
assertNotNull(vnf.getVnfId());
- assertEquals(vnf.getVnfId(),"Z");
+ assertEquals(vnf.getVnfId(), "Z");
}
@Test
public void testGetvnfType() {
vnf.setVnfType("A");
assertNotNull(vnf.getVnfType());
- assertEquals(vnf.getVnfType(),"A");
+ assertEquals(vnf.getVnfType(), "A");
}
@Test
public void testGetVnfVersion() {
vnf.setVnfVersion("1.0");
assertNotNull(vnf.getVnfVersion());
- assertEquals(vnf.getVnfVersion(),"1.0");
+ assertEquals(vnf.getVnfVersion(), "1.0");
}
@Test
@@ -66,8 +68,8 @@ public class TestVnf {
List<Vserver> vservers = new LinkedList<>();
vnf.setVservers(vservers);
assertNotNull(vnf.getVservers());
- assertEquals(vnf.getVservers(),vservers);
-
+ assertEquals(vnf.getVservers(), vservers);
+
}
@Test
@@ -88,7 +90,7 @@ public class TestVnf {
vnfc.setVnfcType("B");
vnfc.setResilienceType("RS1");
vnfc.setMandatory(true);
- List<Vserver> vserverList=new LinkedList<>();
+ List<Vserver> vserverList = new LinkedList<>();
Vserver vserver = new Vserver();
vserver.setId("V1");
vserver.setName("V1-Name");
@@ -99,16 +101,16 @@ public class TestVnf {
vserverList.add(vserver);
vnfc.addVservers(vserverList);
vnf.setVservers(vserverList);
- assertTrue(vnf.getVnfcs()!=null);
+ assertTrue(vnf.getVnfcs() != null);
}
-
+
@Test
public void testGetSetIdentityUrl()
{
- vnf.setIdentityUrl("testIdentityUrl");
- assertEquals("testIdentityUrl", vnf.getIdentityUrl());
+ vnf.setIdentityUrl("testIdentityUrl");
+ assertEquals("testIdentityUrl", vnf.getIdentityUrl());
}
-
+
@Test
public void testAddVserver()
{
diff --git a/appc-dg/appc-dg-shared/appc-dg-license-manager/src/test/java/org/onap/appc/dg/licmgr/impl/LicenseManagerPluginImplTest.java b/appc-dg/appc-dg-shared/appc-dg-license-manager/src/test/java/org/onap/appc/dg/licmgr/impl/LicenseManagerPluginImplTest.java
index cee75ba47..14094d77e 100644
--- a/appc-dg/appc-dg-shared/appc-dg-license-manager/src/test/java/org/onap/appc/dg/licmgr/impl/LicenseManagerPluginImplTest.java
+++ b/appc-dg/appc-dg-shared/appc-dg-license-manager/src/test/java/org/onap/appc/dg/licmgr/impl/LicenseManagerPluginImplTest.java
@@ -3,6 +3,8 @@
* ONAP : APPC
* ================================================================================
* Copyright (C) 2019 Ericsson
+ * ================================================================================
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,7 +48,8 @@ public class LicenseManagerPluginImplTest {
public void testRetrieveLicenseModel() throws APPCException {
LicenseManagerPluginImpl lmImpl = new LicenseManagerPluginImpl();
lmImpl.setLicenseManager(licenseManagerMock);
- Mockito.doReturn(licenseModelMock).when(licenseManagerMock).retrieveLicenseModel(Mockito.anyString(), Mockito.anyString());
+ Mockito.doReturn(licenseModelMock).when(licenseManagerMock)
+ .retrieveLicenseModel(Mockito.anyString(), Mockito.anyString());
Map<String, String> params = new HashMap<>();
SvcLogicContext ctx = new SvcLogicContext();
lmImpl.retrieveLicenseModel(params, ctx);
diff --git a/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/impl/MDSALStoreImpl.java b/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/impl/MDSALStoreImpl.java
index babf59577..91252240d 100644
--- a/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/impl/MDSALStoreImpl.java
+++ b/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/impl/MDSALStoreImpl.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=========================================================
*/
@@ -135,12 +134,13 @@ public class MDSALStoreImpl implements MDSALStore {
@Override
public void storeYangModuleOnLeader(String yang, String moduleName) throws MDSALStoreException {
+ String msg;
try {
String leader = getLeaderNode();
- if (Constants.SELF.equals(leader)){
+ if (Constants.SELF.equals(leader)) {
logger.debug("Current node is a leader.");
- }else{
- logger.debug("Attempting to load yang module on Leader: " + leader );
+ } else {
+ logger.debug("Attempting to load yang module on Leader: " + leader);
String inputJson = createInputJson(yang, moduleName);
RestClientInvoker remoteClient = getRemoteClient(leader);
HttpResponse response = remoteClient.doPost(Constants.YANG_LOADER_PATH, inputJson);
@@ -154,11 +154,13 @@ public class MDSALStoreImpl implements MDSALStore {
}
}
} catch (APPCException e) {
- logger.error("Error loading Yang on Leader. Error message: " + e.getMessage());
- throw new MDSALStoreException("Error loading Yang on Leader. Error message: " + e.getMessage(), e);
+ msg = "Error loading Yang on Leader. Error message: " + e.getMessage();
+ logger.error(msg);
+ throw new MDSALStoreException(msg, e);
} catch (IOException e) {
- logger.error("Error reading response from remote client. Error message: " + e.getMessage());
- throw new MDSALStoreException("Error reading response from remote client. Error message: " + e.getMessage(), e);
+ msg = "Error reading response from remote client. Error message: " + e.getMessage();
+ logger.error(msg);
+ throw new MDSALStoreException(msg, e);
}
}
@@ -170,11 +172,13 @@ public class MDSALStoreImpl implements MDSALStore {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.addMixIn(StoreYangInput.class, MixIn.class);
String inputJson = objectMapper.writer().withRootName("input").writeValueAsString(input);
- logger.debug("Input JSON :" + inputJson);
+ logger.debug("Input JSON: " + inputJson);
return inputJson;
} catch (JsonProcessingException e) {
- logger.error(String.format("Error creating JSON input using yang: %s. Error message: %s",yang ,e.getMessage()));
- throw new MDSALStoreException(String.format("Error creating JSON input using yang: %s. Error message: %s",yang ,e.getMessage()), e);
+ String msg = String.format("Error creating JSON input using yang: %s. Error message: %s",
+ yang, e.getMessage());
+ logger.error(msg);
+ throw new MDSALStoreException(msg, e);
}
}
@@ -182,24 +186,30 @@ public class MDSALStoreImpl implements MDSALStore {
if (remoteClientMap.containsKey(leader)) {
return remoteClientMap.get(leader);
} else {
+ String msg;
Configuration configuration = ConfigurationFactory.getConfiguration();
Properties properties = configuration.getProperties();
if (properties != null) {
try {
- URL configUrl = new URL(properties.getProperty(Constants.CONFIG_URL_PROPERTY, Constants.CONFIG_URL_DEFAULT));
+ URL configUrl =
+ new URL(properties.getProperty(Constants.CONFIG_URL_PROPERTY,
+ Constants.CONFIG_URL_DEFAULT));
String user = properties.getProperty(Constants.CONFIG_USER_PROPERTY);
String password = properties.getProperty(Constants.CONFIG_PASS_PROPERTY);
- RestClientInvoker remoteClient = getRestClientInvoker(new URL(configUrl.getProtocol(), leader, configUrl.getPort(), ""));
+ RestClientInvoker remoteClient =
+ getRestClientInvoker(new URL(configUrl.getProtocol(), leader, configUrl.getPort(), ""));
remoteClient.setAuthentication(user, password);
remoteClientMap.put(leader, remoteClient);
return remoteClient;
} catch (MalformedURLException e) {
- logger.error("Error initializing remote RestConf client: " + e.getMessage(), e);
- throw new MDSALStoreException("Error initializing Remote RestConf client: " + e.getMessage(), e);
+ msg = "Error initializing remote RestConf client: " + e.getMessage();
+ logger.error(msg, e);
+ throw new MDSALStoreException(msg, e);
}
} else {
- logger.error("Error initializing Remote RestConf client. Could not read appc properties");
- throw new MDSALStoreException("Error initializing Remote RestConf client. Could not read appc properties");
+ msg = "Error initializing remote RestConf client. Could not read appc properties";
+ logger.error(msg);
+ throw new MDSALStoreException(msg);
}
}
}
@@ -224,7 +234,7 @@ public class MDSALStoreImpl implements MDSALStore {
try {
String path = requestFormatter.buildPath(module, org.onap.appc.Constants.YANG_BASE_CONTAINER,
org.onap.appc.Constants.YANG_VNF_CONFIG_LIST, requestId, org.onap.appc.Constants.YANG_VNF_CONFIG);
- logger.debug("Configuration Path : " + path);
+ logger.debug("Configuration Path: " + path);
HttpResponse response = client.doPut(path, configJson);
int httpCode = response.getStatusLine().getStatusCode();
String respBody = IOUtils.toString(response.getEntity().getContent());
@@ -252,7 +262,8 @@ public class MDSALStoreImpl implements MDSALStore {
}
}
logger.error("Failed to load config JSON to MD SAL store. " + errorMessage.toString());
- throw new MDSALStoreException("Failed to load config JSON to MD SAL store. Error Message: " + errorMessage.toString());
+ throw new MDSALStoreException("Failed to load config JSON to MD SAL store. Error Message: "
+ + errorMessage.toString());
} catch (IOException e) {
logger.error("Failed to process error response from RestConf: " + e.getMessage());
throw new MDSALStoreException("Failed to process RestConf response. Error Message: " + e.toString(), e);
@@ -263,17 +274,23 @@ public class MDSALStoreImpl implements MDSALStore {
Manifest manifest = new Manifest();
manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, Constants.MANIFEST_VALUE_VERSION);
- manifest.getMainAttributes().put(new Attributes.Name(Constants.MANIFEST_ATTR_BUNDLE_NAME), bundleInfo.getName());
- manifest.getMainAttributes().put(new Attributes.Name(Constants.MANIFEST_ATTR_BUNDLE_SYMBOLIC_NAME), bundleInfo.getName());
- manifest.getMainAttributes().put(new Attributes.Name(Constants.MANIFEST_ATTR_BUNDLE_DESCRIPTION), bundleInfo.getDescription());
- manifest.getMainAttributes().put(new Attributes.Name(Constants.MANIFEST_ATTR_BUNDLE_MANIFEST_VERSION), Constants.MANIFEST_VALUE_BUNDLE_MAN_VERSION);
- manifest.getMainAttributes().put(new Attributes.Name(Constants.MANIFEST_ATTR_BUNDLE_VERSION), String.valueOf(bundleInfo.getVersion()));
- manifest.getMainAttributes().put(new Attributes.Name(Constants.MANIFEST_ATTR_BUNDLE_BLUEPRINT), Constants.MANIFEST_VALUE_BUNDLE_BLUEPRINT);
+ manifest.getMainAttributes().put(new Attributes.Name(Constants.MANIFEST_ATTR_BUNDLE_NAME),
+ bundleInfo.getName());
+ manifest.getMainAttributes().put(new Attributes.Name(Constants.MANIFEST_ATTR_BUNDLE_SYMBOLIC_NAME),
+ bundleInfo.getName());
+ manifest.getMainAttributes().put(new Attributes.Name(Constants.MANIFEST_ATTR_BUNDLE_DESCRIPTION),
+ bundleInfo.getDescription());
+ manifest.getMainAttributes().put(new Attributes.Name(Constants.MANIFEST_ATTR_BUNDLE_MANIFEST_VERSION),
+ Constants.MANIFEST_VALUE_BUNDLE_MAN_VERSION);
+ manifest.getMainAttributes().put(new Attributes.Name(Constants.MANIFEST_ATTR_BUNDLE_VERSION),
+ String.valueOf(bundleInfo.getVersion()));
+ manifest.getMainAttributes().put(new Attributes.Name(Constants.MANIFEST_ATTR_BUNDLE_BLUEPRINT),
+ Constants.MANIFEST_VALUE_BUNDLE_BLUEPRINT);
byte[] retunValue;
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- JarOutputStream jarOutputStream = new JarOutputStream(outputStream, manifest)) {
+ JarOutputStream jarOutputStream = new JarOutputStream(outputStream, manifest)) {
jarOutputStream.putNextEntry(new JarEntry("META-INF/yang/"));
jarOutputStream.putNextEntry(new JarEntry("META-INF/yang/" + bundleInfo.getName() + ".yang"));
jarOutputStream.write(yang.getBytes());
@@ -287,7 +304,8 @@ public class MDSALStoreImpl implements MDSALStore {
retunValue = outputStream.toByteArray();
} catch (Exception e) {
logger.error("Error creating bundle jar: " + bundleInfo.getName() + ". Error message: " + e.getMessage());
- throw new MDSALStoreException("Error creating bundle jar: " + bundleInfo.getName() + " " + e.getMessage(), e);
+ throw new MDSALStoreException("Error creating bundle jar: " + bundleInfo.getName() + " " + e.getMessage(),
+ e);
}
return retunValue;
}
@@ -299,7 +317,7 @@ public class MDSALStoreImpl implements MDSALStore {
int httpCode = response.getStatusLine().getStatusCode();
String respBody = IOUtils.toString(response.getEntity().getContent());
logger.debug(String.format("Get node status returned Code: %s. Response: %s ", httpCode, respBody));
- if (httpCode == 200 && mapper.readTree(respBody).get(Constants.JSON_RESPONSE_VALUE) !=null ) {
+ if (httpCode == 200 && mapper.readTree(respBody).get(Constants.JSON_RESPONSE_VALUE) != null) {
JsonNode responseValue = mapper.readTree(respBody).get(Constants.JSON_RESPONSE_VALUE);
String leaderShard = responseValue.get("Leader").asText();
if (shardName.equals(leaderShard)) {
@@ -309,7 +327,8 @@ public class MDSALStoreImpl implements MDSALStore {
String[] peers = responseValue.get("PeerAddresses").asText().split(",");
for (String peer : peers) {
if (peer.trim().startsWith(leaderShard)) {
- String leader = peer.substring(peer.indexOf('@') + 1, peer.indexOf(':', peer.indexOf('@')));
+ String leader =
+ peer.substring(peer.indexOf('@') + 1, peer.indexOf(':', peer.indexOf('@')));
logger.debug(String.format("Node %s is a leader", leader));
return leader;
}
@@ -322,7 +341,7 @@ public class MDSALStoreImpl implements MDSALStore {
throw new MDSALStoreException("Error while retrieving leader node.");
}
} catch (IOException | APPCException e) {
- logger.error(String.format("Error while retrieving leader Node. Error message : %s ", e.getMessage()), e);
+ logger.error(String.format("Error while retrieving leader Node. Error message: %s ", e.getMessage()), e);
throw new MDSALStoreException(e);
}
}
@@ -337,18 +356,22 @@ public class MDSALStoreImpl implements MDSALStore {
JsonNode responseValue = mapper.readTree(respBody).get(Constants.JSON_RESPONSE_VALUE);
if (responseValue != null && responseValue.get(Constants.JSON_RESPONSE_MEMBER_NAME) != null) {
String name = responseValue.get(Constants.JSON_RESPONSE_MEMBER_NAME).asText();
- logger.debug("Node name : " + name);
+ logger.debug("Node name: " + name);
return name;
- }else{
- logger.error(String.format("Error while retrieving node name from response. Response body: %s.", respBody));
- throw new MDSALStoreException(String.format("Error while retrieving node name from response. Response body: %s.", respBody));
+ } else {
+ String msg = String.format("Error while retrieving node name from response. Response body: %s.",
+ respBody);
+ logger.error(msg);
+ throw new MDSALStoreException(msg);
}
} else {
- logger.error(String.format("Error while retrieving node name. Error code: %s. Error response: %s.", httpCode, respBody));
- throw new MDSALStoreException(String.format("Error while retrieving node name. Error code: %s. Error response: %s.", httpCode, respBody));
+ String msg = String.format("Error while retrieving node name. Error code: %s. Error response: %s.",
+ httpCode, respBody);
+ logger.error(msg);
+ throw new MDSALStoreException(msg);
}
} catch (IOException | APPCException e) {
- logger.error("Error while getting node name " + e.getMessage(), e);
+ logger.error("Error while getting node name: " + e.getMessage(), e);
throw new MDSALStoreException(e);
}
}
diff --git a/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/operation/ConfigOperationRequestFormatter.java b/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/operation/ConfigOperationRequestFormatter.java
index e565f2052..0e7474635 100644
--- a/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/operation/ConfigOperationRequestFormatter.java
+++ b/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/operation/ConfigOperationRequestFormatter.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=========================================================
*/
@@ -28,7 +27,8 @@ package org.onap.appc.mdsal.operation;
import org.onap.appc.mdsal.impl.Constants;
/**
- * Creates request url path for config actions based on parameter like module name , container-name and sub modules if any.
+ * Creates request url path for config actions based on parameter like module name, container name,
+ * and sub modules if any.
*/
public class ConfigOperationRequestFormatter {
@@ -39,15 +39,16 @@ public class ConfigOperationRequestFormatter {
* @param subModules - sub module /container names as string in varargs ( String ) format
* @return - resultant path in String format
*/
- public String buildPath(String module, String containerName , String... subModules ) {
-
- StringBuilder path = new StringBuilder( Constants.CONFIG_PATH + Constants.URL_BACKSLASH + module + ":" + containerName + Constants.URL_BACKSLASH);
- if(subModules.length >0){
- for(String subModule : subModules){
+ public String buildPath(String module, String containerName, String... subModules) {
+ StringBuilder path =
+ new StringBuilder(Constants.CONFIG_PATH + Constants.URL_BACKSLASH + module
+ + ":" + containerName + Constants.URL_BACKSLASH);
+ if (subModules.length > 0) {
+ for (String subModule : subModules) {
path.append(subModule);
path.append("/");
}
}
- return path.toString();
+ return path.toString();
}
}
diff --git a/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/test/java/org/onap/appc/mdsal/MDSALStoreTest.java b/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/test/java/org/onap/appc/mdsal/MDSALStoreTest.java
index 2229eff9d..973bf3d42 100644
--- a/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/test/java/org/onap/appc/mdsal/MDSALStoreTest.java
+++ b/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/test/java/org/onap/appc/mdsal/MDSALStoreTest.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=========================================================
*/
@@ -48,9 +47,9 @@ import java.net.URL;
* MDSALStore Tests
*/
@RunWith(PowerMockRunner.class)
-@PrepareForTest({FrameworkUtil.class,BundleContext.class,ServiceReference.class,
- BundleReference.class,Bundle.class,Filter.class,BundleListener.class,InvalidSyntaxException.class,
- BundleException.class,FrameworkListener.class,ServiceRegistration.class,ServiceListener.class,
+@PrepareForTest({FrameworkUtil.class, BundleContext.class, ServiceReference.class,
+ BundleReference.class, Bundle.class, Filter.class, BundleListener.class, InvalidSyntaxException.class,
+ BundleException.class, FrameworkListener.class, ServiceRegistration.class, ServiceListener.class,
Version.class})
public class MDSALStoreTest {
diff --git a/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/test/java/org/onap/appc/mdsal/impl/MDSALStoreImplTest.java b/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/test/java/org/onap/appc/mdsal/impl/MDSALStoreImplTest.java
index fa1146237..dbb302e9e 100644
--- a/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/test/java/org/onap/appc/mdsal/impl/MDSALStoreImplTest.java
+++ b/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/test/java/org/onap/appc/mdsal/impl/MDSALStoreImplTest.java
@@ -3,6 +3,8 @@
* ONAP : APPC
* ================================================================================
* Copyright (C) 2019 Ericsson
+ * ================================================================================
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,8 +59,8 @@ import java.net.URL;
@PrepareForTest(FrameworkUtil.class)
public class MDSALStoreImplTest {
- private final BundleContext bundleContext= Mockito.mock(BundleContext.class);
- private final Bundle bundleService=Mockito.mock(Bundle.class);
+ private final BundleContext bundleContext = Mockito.mock(BundleContext.class);
+ private final Bundle bundleService = Mockito.mock(Bundle.class);
private MDSALStoreImpl mdsalStore;
@Rule
@@ -86,7 +88,8 @@ public class MDSALStoreImplTest {
}
@Test
- public void testStoreYangModuleOnLeader() throws MDSALStoreException, APPCException, IllegalStateException, IOException {
+ public void testStoreYangModuleOnLeader()
+ throws MDSALStoreException, APPCException, IllegalStateException, IOException {
RestClientInvoker mockInvoker = Mockito.mock(RestClientInvoker.class);
Whitebox.setInternalState(mdsalStore, "client", mockInvoker);
HttpResponse mockResponse = Mockito.mock(HttpResponse.class);
@@ -100,7 +103,8 @@ public class MDSALStoreImplTest {
Mockito.doReturn(mockStatusLine).when(mockResponse).getStatusLine();
Mockito.doReturn(200).when(mockStatusLine).getStatusCode();
HttpResponse mockLeaderResponse = Mockito.mock(HttpResponse.class);
- Mockito.doReturn(mockLeaderResponse).when(mockInvoker).doGet(String.format(Constants.GET_NODE_STATUS_PATH_FORMAT, "NodeName-shard-default-config"));
+ Mockito.doReturn(mockLeaderResponse).when(mockInvoker)
+ .doGet(String.format(Constants.GET_NODE_STATUS_PATH_FORMAT, "NodeName-shard-default-config"));
String httpLeaderString = "{\"value\":{\"Leader\":\"NodeName-shard-default-config\"}}";
InputStream isLeader = new ByteArrayInputStream(httpLeaderString.getBytes(Charset.defaultCharset()));
HttpEntity mockLeaderEntity = Mockito.mock(HttpEntity.class);
@@ -114,9 +118,10 @@ public class MDSALStoreImplTest {
mdsalStore.storeYangModuleOnLeader("", "");
Mockito.verify(mockLogger).debug("Current node is a leader.");
}
-
+
@Test
- public void testStoreYangModuleOnLeaderNotLeader() throws MDSALStoreException, APPCException, IllegalStateException, IOException {
+ public void testStoreYangModuleOnLeaderNotLeader()
+ throws MDSALStoreException, APPCException, IllegalStateException, IOException {
RestClientInvoker mockInvoker = Mockito.mock(RestClientInvoker.class);
Whitebox.setInternalState(mdsalStore, "client", mockInvoker);
HttpResponse mockResponse = Mockito.mock(HttpResponse.class);
@@ -130,8 +135,10 @@ public class MDSALStoreImplTest {
Mockito.doReturn(mockStatusLine).when(mockResponse).getStatusLine();
Mockito.doReturn(200).when(mockStatusLine).getStatusCode();
HttpResponse mockLeaderResponse = Mockito.mock(HttpResponse.class);
- Mockito.doReturn(mockLeaderResponse).when(mockInvoker).doGet(String.format(Constants.GET_NODE_STATUS_PATH_FORMAT, "NodeName-shard-default-config"));
- String httpLeaderString = "{\"value\":{\"Leader\":\"OtherShardName\",\"PeerAddresses\":\"OtherShardName@adf:a\"}}";
+ Mockito.doReturn(mockLeaderResponse).when(mockInvoker)
+ .doGet(String.format(Constants.GET_NODE_STATUS_PATH_FORMAT, "NodeName-shard-default-config"));
+ String httpLeaderString =
+ "{\"value\":{\"Leader\":\"OtherShardName\",\"PeerAddresses\":\"OtherShardName@adf:a\"}}";
InputStream isLeader = new ByteArrayInputStream(httpLeaderString.getBytes(Charset.defaultCharset()));
HttpEntity mockLeaderEntity = Mockito.mock(HttpEntity.class);
Mockito.doReturn(isLeader).when(mockLeaderEntity).getContent();
@@ -174,7 +181,8 @@ public class MDSALStoreImplTest {
}
@Test
- public void testStoreJsonRestconfResponse() throws MDSALStoreException, APPCException, IllegalStateException, IOException {
+ public void testStoreJsonRestconfResponse()
+ throws MDSALStoreException, APPCException, IllegalStateException, IOException {
RestClientInvoker mockInvoker = Mockito.mock(RestClientInvoker.class);
Whitebox.setInternalState(mdsalStore, "client", mockInvoker);
HttpResponse mockResponse = Mockito.mock(HttpResponse.class);
diff --git a/appc-dg/appc-dg-shared/appc-dg-netconf/src/main/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImpl.java b/appc-dg/appc-dg-shared/appc-dg-netconf/src/main/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImpl.java
index 7b9d5d802..f31383b02 100644
--- a/appc-dg/appc-dg-shared/appc-dg-netconf/src/main/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImpl.java
+++ b/appc-dg/appc-dg-shared/appc-dg-netconf/src/main/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImpl.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=========================================================
*/
@@ -68,8 +67,8 @@ public class NetconfClientPluginImpl implements NetconfClientPlugin {
public NetconfClientPluginImpl() {
BundleContext bctx = FrameworkUtil.getBundle(this.getClass()).getBundleContext();
- ServiceReference<NetconfClientFactory> srefNetconfClientFactory = bctx
- .getServiceReference(NetconfClientFactory.class);
+ ServiceReference<NetconfClientFactory> srefNetconfClientFactory =
+ bctx.getServiceReference(NetconfClientFactory.class);
clientFactory = bctx.getService(srefNetconfClientFactory);
}
@@ -79,9 +78,9 @@ public class NetconfClientPluginImpl implements NetconfClientPlugin {
}
public void configure(Map<String, String> params, SvcLogicContext ctx) throws APPCException {
-
try {
- // by default, it uses the jsch Netconf Adapter implementation by calling getNetconfClient(NetconfClientType.SSH).
+ // by default, it uses the jsch Netconf Adapter implementation by calling
+ // getNetconfClient(NetconfClientType.SSH).
NetconfClient client = clientFactory.getNetconfClient(NetconfClientType.SSH);
connect(params, client);
} catch (Exception e) {
@@ -93,8 +92,8 @@ public class NetconfClientPluginImpl implements NetconfClientPlugin {
private void connect(Map<String, String> params, NetconfClient client) throws APPCException {
try {
- NetconfConnectionDetails connectionDetails = mapper
- .readValue(params.get(CONNECTION_DETAILS_PARAM), NetconfConnectionDetails.class);
+ NetconfConnectionDetails connectionDetails =
+ mapper.readValue(params.get(CONNECTION_DETAILS_PARAM), NetconfConnectionDetails.class);
String netconfMessage = params.get("file-content");
client.connect(connectionDetails);
client.configure(netconfMessage);
@@ -110,7 +109,7 @@ public class NetconfClientPluginImpl implements NetconfClientPlugin {
public void operationStateValidation(Map<String, String> params, SvcLogicContext ctx) throws APPCException {
if (logger.isTraceEnabled()) {
logger.trace("Entering to operationStateValidation with params = " + ObjectUtils.toString(params)
- + ", SvcLogicContext = " + ObjectUtils.toString(ctx));
+ + ", SvcLogicContext = " + ObjectUtils.toString(ctx));
}
try {
String paramName = Constants.VNF_TYPE_FIELD_NAME;
@@ -125,15 +124,15 @@ public class NetconfClientPluginImpl implements NetconfClientPlugin {
//get connectionDetails
String connectionDetailsStr = params.get(Constants.CONNECTION_DETAILS_FIELD_NAME);
NetconfConnectionDetails connectionDetails =
- resolveConnectionDetails(ctx, vnfType, vnfHostIpAddress, connectionDetailsStr);
+ resolveConnectionDetails(ctx, vnfType, vnfHostIpAddress, connectionDetailsStr);
if (connectionDetails == null) {
throw new IllegalStateException("missing connectionDetails for VnfType:" + vnfType.name());
}
//get operationsStateNetconfMessage
- OperationalStateValidator operationalStateValidator = OperationalStateValidatorFactory
- .getOperationalStateValidator(vnfType);
+ OperationalStateValidator operationalStateValidator =
+ OperationalStateValidatorFactory.getOperationalStateValidator(vnfType);
String configurationFileName = operationalStateValidator.getConfigurationFileName();
String operationsStateNetconfMessage = null;
if (!StringUtils.isEmpty(configurationFileName)) {
@@ -164,8 +163,7 @@ public class NetconfClientPluginImpl implements NetconfClientPlugin {
}
private NetconfConnectionDetails resolveConnectionDetails(SvcLogicContext ctx, VnfType vnfType,
- String vnfHostIpAddress, String connectionDetailsStr) throws APPCException, IOException {
-
+ String vnfHostIpAddress, String connectionDetailsStr) throws APPCException, IOException {
NetconfConnectionDetails connectionDetails;
if (StringUtils.isEmpty(connectionDetailsStr)) {
connectionDetails = retrieveConnectionDetails(vnfType);
@@ -184,15 +182,14 @@ public class NetconfClientPluginImpl implements NetconfClientPlugin {
@Override
public void backupConfiguration(Map<String, String> params, SvcLogicContext ctx) throws APPCException {
-
NetconfClient client = null;
try {
logger.debug("Entered backup to DEVICE_INTERFACE_LOG");
client = clientFactory.getNetconfClient(NetconfClientType.SSH);
//get connection details
- NetconfConnectionDetails connectionDetails = mapper
- .readValue(params.get(CONNECTION_DETAILS_PARAM), NetconfConnectionDetails.class);
+ NetconfConnectionDetails connectionDetails =
+ mapper.readValue(params.get(CONNECTION_DETAILS_PARAM), NetconfConnectionDetails.class);
//connect the client and get configuration
client.connect(connectionDetails);
String configuration = client.getConfiguration();
@@ -225,8 +222,8 @@ public class NetconfClientPluginImpl implements NetconfClientPlugin {
NetconfClientFactory clientFact = (NetconfClientFactory) bctx.getService(sref);
client = clientFact.getNetconfClient(NetconfClientType.SSH);
//get connection details
- NetconfConnectionDetails connectionDetails = mapper
- .readValue(params.get(CONNECTION_DETAILS_PARAM), NetconfConnectionDetails.class);
+ NetconfConnectionDetails connectionDetails =
+ mapper.readValue(params.get(CONNECTION_DETAILS_PARAM), NetconfConnectionDetails.class);
//connect the client and get configuration
client.connect(connectionDetails);
String configuration = client.getConfiguration();
@@ -264,7 +261,6 @@ public class NetconfClientPluginImpl implements NetconfClientPlugin {
}
}
-
@Override
public void getRunningConfig(Map<String, String> params, SvcLogicContext ctx) throws APPCException {
NetconfClient client = null;
@@ -281,8 +277,9 @@ public class NetconfClientPluginImpl implements NetconfClientPlugin {
connectionDetails.setUsername(params.get("user-name"));
connectionDetails.setPassword(params.get("password"));
connectionDetails.setPort(
- !("".equalsIgnoreCase(params.get("port-number"))) ? Integer.parseInt(params.get("port-number"))
- : NetconfConnectionDetails.DEFAULT_PORT);
+ !("".equalsIgnoreCase(params.get("port-number")))
+ ? Integer.parseInt(params.get("port-number"))
+ : NetconfConnectionDetails.DEFAULT_PORT);
//connect the client and get configuration
client.connect(connectionDetails);
String configuration = client.getConfiguration();
@@ -307,7 +304,6 @@ public class NetconfClientPluginImpl implements NetconfClientPlugin {
}
private String getCurrentDateTime() {
-
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Date date = new Date();
return dateFormat.format(date);
@@ -325,7 +321,7 @@ public class NetconfClientPluginImpl implements NetconfClientPlugin {
if (!dao.retrieveNetconfConnectionDetails(vnfType.getFamilyType().name(), connectionDetails)) {
logger.error("Missing configuration for " + vnfType.getFamilyType().name());
throw new APPCException("Missing configuration for " + vnfType.getFamilyType().name() + " in "
- + Constants.DEVICE_AUTHENTICATION_TABLE_NAME);
+ + Constants.DEVICE_AUTHENTICATION_TABLE_NAME);
}
return connectionDetails;
}
diff --git a/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientFactoryMock.java b/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientFactoryMock.java
index da42e8e3d..531f51dbb 100644
--- a/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientFactoryMock.java
+++ b/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientFactoryMock.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=========================================================
*/
@@ -35,9 +34,7 @@ public class NetconfClientFactoryMock extends NetconfClientFactory {
private final NetconfClientJschMock jschClient = new NetconfClientJschMock();
@Override
- public NetconfClient getNetconfClient(NetconfClientType type){
+ public NetconfClient getNetconfClient(NetconfClientType type) {
return jschClient;
}
}
-
-
diff --git a/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImplTest.java b/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImplTest.java
index 9e2384e91..bdbd27684 100644
--- a/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImplTest.java
+++ b/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfClientPluginImplTest.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=========================================================
*/
@@ -60,7 +59,6 @@ import java.util.Map;
import static org.powermock.api.mockito.PowerMockito.when;
-
@RunWith(PowerMockRunner.class)
@PrepareForTest({OperationalStateValidatorFactory.class, FrameworkUtil.class, ObjectMapper.class})
@@ -84,36 +82,40 @@ public class NetconfClientPluginImplTest {
int port = 8080;
String username = "test";
String password = "test";
- String connectionDetails = "{\"host\":\"" + host + "\",\"port\":" + port + ",\"username\":\"" + username + "\",\"password\":\"" + password + "\",\"capabilities\":null,\"additionalProperties\":null}";
- String fileContent = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<rpc message-id=\"101\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n" +
- "\t<get-config>\n" +
- "\t\t<source>\n" +
- "\t\t\t<running/>\n" +
- "\t\t </source>\n" +
- "\t</get-config>\n" +
- "</rpc>'";
- String operationalState = "<rpc message-id=\"101\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n" +
- " <get>\n" +
- " <filter>\n" +
- " <ManagedElement xmlns=\"urn:org:onap:appc:Test\">\n" +
- " <VnfFunction xmlns=\"urn:org:openecomop:appc:Test\">\n" +
- " <ProcessorManagement>\n" +
- " <MatedPair>\n" +
- " <operationalState/>\n" +
- " <PayloadProcessor>\n" +
- " <operationalState/>\n" +
- " </PayloadProcessor>\n" +
- " </MatedPair>\n" +
- " <SystemController>\n" +
- " <operationalState/>\n" +
- " </SystemController>\n" +
- " </ProcessorManagement>\n" +
- " </VnfFunction>\n" +
- " </ManagedElement>\n" +
- " </filter>\n" +
- " </get>\n" +
- "</rpc>\n";
+ String connectionDetails =
+ "{\"host\":\"" + host + "\",\"port\":" + port + ",\"username\":\"" + username
+ + "\",\"password\":\"" + password + "\",\"capabilities\":null,\"additionalProperties\":null}";
+ String fileContent =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ + "<rpc message-id=\"101\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n"
+ + "\t<get-config>\n"
+ + "\t\t<source>\n"
+ + "\t\t\t<running/>\n"
+ + "\t\t </source>\n"
+ + "\t</get-config>\n"
+ + "</rpc>'";
+ String operationalState =
+ "<rpc message-id=\"101\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n"
+ + " <get>\n"
+ + " <filter>\n"
+ + " <ManagedElement xmlns=\"urn:org:onap:appc:Test\">\n"
+ + " <VnfFunction xmlns=\"urn:org:openecomop:appc:Test\">\n"
+ + " <ProcessorManagement>\n"
+ + " <MatedPair>\n"
+ + " <operationalState/>\n"
+ + " <PayloadProcessor>\n"
+ + " <operationalState/>\n"
+ + " </PayloadProcessor>\n"
+ + " </MatedPair>\n"
+ + " <SystemController>\n"
+ + " <operationalState/>\n"
+ + " </SystemController>\n"
+ + " </ProcessorManagement>\n"
+ + " </VnfFunction>\n"
+ + " </ManagedElement>\n"
+ + " </filter>\n"
+ + " </get>\n"
+ + "</rpc>\n";
@Before
@@ -143,7 +145,7 @@ public class NetconfClientPluginImplTest {
Assert.assertEquals("wrong password", password, client.getLastConnectionDetails().getPassword());
Assert.assertFalse(client.isConnection());
} catch (Exception e) {
- Assert.fail("failed with because of " + e.getCause());
+ Assert.fail("failed because of " + e.getCause());
}
}
@@ -186,7 +188,8 @@ public class NetconfClientPluginImplTest {
validatorMock.setConfigurationFileName("VnfGetRunningConfig");
PowerMockito.mockStatic(OperationalStateValidatorFactory.class);
- when(OperationalStateValidatorFactory.getOperationalStateValidator(Matchers.any(VnfType.class))).thenReturn(validatorMock);
+ when(OperationalStateValidatorFactory.getOperationalStateValidator(Matchers.any(VnfType.class)))
+ .thenReturn(validatorMock);
netconfClientPlugin.operationStateValidation(params, ctx);
@@ -212,7 +215,8 @@ public class NetconfClientPluginImplTest {
validatorMock.setConfigurationFileName("VnfGetRunningConfig");
PowerMockito.mockStatic(OperationalStateValidatorFactory.class);
- when(OperationalStateValidatorFactory.getOperationalStateValidator(Matchers.any(VnfType.class))).thenReturn(validatorMock);
+ when(OperationalStateValidatorFactory.getOperationalStateValidator(Matchers.any(VnfType.class)))
+ .thenReturn(validatorMock);
substituteMapper(true);
try {
@@ -244,7 +248,8 @@ public class NetconfClientPluginImplTest {
validatorMock.setConfigurationFileName("VnfGetRunningConfig");
PowerMockito.mockStatic(OperationalStateValidatorFactory.class);
- when(OperationalStateValidatorFactory.getOperationalStateValidator(Matchers.any(VnfType.class))).thenReturn(validatorMock);
+ when(OperationalStateValidatorFactory.getOperationalStateValidator(Matchers.any(VnfType.class)))
+ .thenReturn(validatorMock);
ObjectMapper mapper = PowerMockito.mock(ObjectMapper.class);
final NetconfConnectionDetails netconfConnectionDetails = null;
when(mapper.readValue(Matchers.anyString(), Matchers.any(Class.class))).thenReturn(netconfConnectionDetails);
@@ -277,7 +282,8 @@ public class NetconfClientPluginImplTest {
validatorMock.setConfigurationFileName("VnfGetRunningConfig");
PowerMockito.mockStatic(OperationalStateValidatorFactory.class);
- when(OperationalStateValidatorFactory.getOperationalStateValidator(Matchers.any(VnfType.class))).thenReturn(validatorMock);
+ when(OperationalStateValidatorFactory.getOperationalStateValidator(Matchers.any(VnfType.class)))
+ .thenReturn(validatorMock);
try {
netconfClientPlugin.operationStateValidation(params, ctx);
@@ -308,7 +314,8 @@ public class NetconfClientPluginImplTest {
validatorMock.setConfigurationFileName("VnfGetRunningConfig");
PowerMockito.mockStatic(OperationalStateValidatorFactory.class);
- when(OperationalStateValidatorFactory.getOperationalStateValidator(Matchers.any(VnfType.class))).thenReturn(validatorMock);
+ when(OperationalStateValidatorFactory.getOperationalStateValidator(Matchers.any(VnfType.class)))
+ .thenReturn(validatorMock);
netconfClientPlugin.operationStateValidation(params, ctx);
@@ -335,7 +342,8 @@ public class NetconfClientPluginImplTest {
validatorMock.setConfigurationFileName("VnfGetRunningConfig");
PowerMockito.mockStatic(OperationalStateValidatorFactory.class);
- when(OperationalStateValidatorFactory.getOperationalStateValidator(Matchers.any(VnfType.class))).thenReturn(validatorMock);
+ when(OperationalStateValidatorFactory.getOperationalStateValidator(Matchers.any(VnfType.class)))
+ .thenReturn(validatorMock);
netconfClientPlugin.operationStateValidation(params, ctx);
@@ -554,7 +562,7 @@ public class NetconfClientPluginImplTest {
Assert.assertEquals("wrong host", connectionDetails1.getHost(), connectionDetailsActual.getHost());
Assert.assertEquals("wrong password", connectionDetails1.getPassword(), connectionDetailsActual.getPassword());
Assert.assertEquals("wrong port", connectionDetails1.getPort(), connectionDetailsActual.getPort());
- Assert.assertEquals("wrong usename", connectionDetails1.getUsername(), connectionDetailsActual.getUsername());
+ Assert.assertEquals("wrong username", connectionDetails1.getUsername(), connectionDetailsActual.getUsername());
}
@@ -582,7 +590,8 @@ public class NetconfClientPluginImplTest {
DAOServiceMock daoServiceMock = (DAOServiceMock) dao;
daoServiceMock.setConfigFile(fileContent);
- Assert.assertEquals("wrong config in a database", fileContent, netconfClientPlugin.retrieveConfigurationFileContent("VnfGetRunningConfig"));
+ Assert.assertEquals("wrong config in a database",
+ fileContent, netconfClientPlugin.retrieveConfigurationFileContent("VnfGetRunningConfig"));
}
private ConnectionDetails getConnectionDetails() {
diff --git a/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfDBPluginImplTest.java b/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfDBPluginImplTest.java
index 95672194d..ece368502 100644
--- a/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfDBPluginImplTest.java
+++ b/appc-dg/appc-dg-shared/appc-dg-netconf/src/test/java/org/onap/appc/dg/netconf/impl/NetconfDBPluginImplTest.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=========================================================
*/
@@ -52,15 +51,15 @@ public class NetconfDBPluginImplTest {
int port = 8080;
String username = "test";
String password = "test";
- String configContent = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<rpc message-id=\"101\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n" +
- "\t<get-config>\n" +
- "\t\t<source>\n" +
- "\t\t\t<running/>\n" +
- "\t\t </source>\n" +
- "\t</get-config>\n" +
- "</rpc>'";
-
+ String configContent =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ + "<rpc message-id=\"101\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n"
+ + "\t<get-config>\n"
+ + "\t\t<source>\n"
+ + "\t\t\t<running/>\n"
+ + "\t\t </source>\n"
+ + "\t</get-config>\n"
+ + "</rpc>'";
@Test
public void testRetrieveDSConfiguration() throws Exception {
@@ -98,7 +97,8 @@ public class NetconfDBPluginImplTest {
SvcLogicContext ctx = new SvcLogicContext();
netconfDBPlugin.retrieveVMDSConfiguration(params, ctx);
- Assert.assertEquals("lack of success of retrieveVMDSConfiguration_Result", "success", ctx.getAttribute("retrieveVMDSConfiguration_Result"));
+ Assert.assertEquals("lack of success of retrieveVMDSConfiguration_Result",
+ "success", ctx.getAttribute("retrieveVMDSConfiguration_Result"));
Assert.assertEquals("wrong entity", "VNF", ctx.getAttribute("entity"));
assertConnectionDetails(ctx, host);
}
@@ -118,7 +118,6 @@ public class NetconfDBPluginImplTest {
}
}
-
@Test
public void testRetrieveVMDSConfigurationNegativeJsonProcessingException() throws Exception {
@@ -180,7 +179,6 @@ public class NetconfDBPluginImplTest {
}
}
-
@Test
public void testRetrieveConnectionDetailsNegativeMissingConfiguration() throws Exception {
init();
@@ -204,7 +202,8 @@ public class NetconfDBPluginImplTest {
private void assertConnectionDetails(SvcLogicContext ctx, String host) throws IOException {
String sConnectionDetails = ctx.getAttribute("connection-details");
- NetconfConnectionDetails connectionDetails = new ObjectMapper().readValue(sConnectionDetails, NetconfConnectionDetails.class);
+ NetconfConnectionDetails connectionDetails =
+ new ObjectMapper().readValue(sConnectionDetails, NetconfConnectionDetails.class);
Assert.assertEquals(host, connectionDetails.getHost());
Assert.assertEquals(port, connectionDetails.getPort());
Assert.assertEquals(username, connectionDetails.getUsername());
@@ -220,7 +219,6 @@ public class NetconfDBPluginImplTest {
daoMock = (DAOServiceMock) daoService;
daoMock.setConfigFile(configContent);
daoMock.setConnection(getConnectionDetails());
-
}
private ConnectionDetails getConnectionDetails() {
diff --git a/appc-dg/appc-dg-shared/appc-dg-ssh/src/main/java/org/onap/appc/dg/ssh/impl/SshServiceImpl.java b/appc-dg/appc-dg-shared/appc-dg-ssh/src/main/java/org/onap/appc/dg/ssh/impl/SshServiceImpl.java
index e758f36a2..1c7cc1b95 100644
--- a/appc-dg/appc-dg-shared/appc-dg-ssh/src/main/java/org/onap/appc/dg/ssh/impl/SshServiceImpl.java
+++ b/appc-dg/appc-dg-shared/appc-dg-ssh/src/main/java/org/onap/appc/dg/ssh/impl/SshServiceImpl.java
@@ -2,24 +2,21 @@
* ============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
- * ================================================================================
- * Modifications (C) 2019 Ericsson
* =============================================================================
* 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=========================================================
*/
@@ -48,6 +45,11 @@ public class SshServiceImpl implements SshService {
private SshAdapter sshAdapter;
+ /**
+ * Set sshAdapter.
+ * <p>Used through blueprint.
+ * @param sshAdapter the SshAdapter
+ */
public void setSshAdapter(SshAdapter sshAdapter) {
this.sshAdapter = sshAdapter;
}
@@ -57,7 +59,9 @@ public class SshServiceImpl implements SshService {
SshConnectionDetails connectionDetails = resolveConnectionDetails(params.get(PARAM_IN_connection_details));
String command = params.get(PARAM_IN_command);
logger.debug("=> Connecting to SSH server...");
- SshConnection sshConnection = sshAdapter.getConnection(connectionDetails.getHost(), connectionDetails.getPort(), connectionDetails.getUsername(), connectionDetails.getPassword());
+ SshConnection sshConnection =
+ sshAdapter.getConnection(connectionDetails.getHost(), connectionDetails.getPort(),
+ connectionDetails.getUsername(), connectionDetails.getPassword());
sshConnection.connect();
try {
logger.debug("=> Connected to SSH server...");
@@ -97,11 +101,11 @@ public class SshServiceImpl implements SshService {
public void execWithStatusCheck(Map<String, String> params, SvcLogicContext ctx) throws APPCException {
exec(params, ctx);
int status = Integer.parseInt(ctx.getAttribute(PARAM_OUT_status));
- if(status != DEF_SUCCESS_STATUS) {
+ if (status != DEF_SUCCESS_STATUS) {
StringBuilder errmsg = new StringBuilder();
errmsg.append("SSH command returned error status [").append(status).append(']');
String stderr = ctx.getAttribute(PARAM_OUT_stderr);
- if((stderr != null) && !stderr.isEmpty()) {
+ if ((stderr != null) && !stderr.isEmpty()) {
errmsg.append(". Error: [").append(stderr).append(']');
}
throw new APPCException(errmsg.toString());
diff --git a/appc-dg/appc-dg-shared/appc-dg-ssh/src/test/java/org/onap/appc/dg/ssh/impl/SshDBPluginImplTest.java b/appc-dg/appc-dg-shared/appc-dg-ssh/src/test/java/org/onap/appc/dg/ssh/impl/SshDBPluginImplTest.java
index 20d602cbb..49c1a5044 100644
--- a/appc-dg/appc-dg-shared/appc-dg-ssh/src/test/java/org/onap/appc/dg/ssh/impl/SshDBPluginImplTest.java
+++ b/appc-dg/appc-dg-shared/appc-dg-ssh/src/test/java/org/onap/appc/dg/ssh/impl/SshDBPluginImplTest.java
@@ -3,6 +3,8 @@
* ONAP : APPC
* ================================================================================
* Copyright (C) 2019 Ericsson
+ * ================================================================================
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,8 +46,8 @@ public class SshDBPluginImplTest {
public void testRetrieveConnectionDetails() throws APPCException {
SshDBPluginImpl impl = new SshDBPluginImpl();
SshDataAccessService dataAccessServiceMock = Mockito.mock(SshDataAccessService.class);
- Mockito.doReturn(true).when(dataAccessServiceMock).retrieveConnectionDetails(Mockito.anyString(),
- Mockito.any(SshConnectionDetails.class));
+ Mockito.doReturn(true).when(dataAccessServiceMock)
+ .retrieveConnectionDetails(Mockito.anyString(), Mockito.any(SshConnectionDetails.class));
impl.setDataAccessService(dataAccessServiceMock);
Map<String, String> params = new HashMap<>();
SvcLogicContext ctx = new SvcLogicContext();
@@ -68,8 +70,8 @@ public class SshDBPluginImplTest {
public void testRetrieveConnectionDetailsSshDataAccessException() throws APPCException {
SshDBPluginImpl impl = new SshDBPluginImpl();
SshDataAccessService dataAccessServiceMock = Mockito.mock(SshDataAccessService.class);
- Mockito.doThrow(new SshDataAccessException()).when(dataAccessServiceMock).retrieveConnectionDetails(Mockito.anyString(),
- Mockito.any(SshConnectionDetails.class));
+ Mockito.doThrow(new SshDataAccessException()).when(dataAccessServiceMock)
+ .retrieveConnectionDetails(Mockito.anyString(), Mockito.any(SshConnectionDetails.class));
impl.setDataAccessService(dataAccessServiceMock);
Map<String, String> params = new HashMap<>();
SvcLogicContext ctx = new SvcLogicContext();