diff options
author | 2019-02-21 18:24:20 +0000 | |
---|---|---|
committer | 2019-02-22 19:37:17 +0000 | |
commit | 3cef43b0cf7244d26aab5d9752fde518f0970d47 (patch) | |
tree | 9d1f06b09b9db803b5b58fb909a7fc2f21fc8b2e /appc-dg-util/appc-dg-util-bundle/src/main | |
parent | 57293e84a0aa7405c9688448483d811d707e199a (diff) |
Test coverage in ExecuteNodeActionImpl
Increase coverage from 42% to 92%
Issue-ID: APPC-1477
Change-Id: Ic9ef407663d0a79ccec8ed7045230c4d734a3cc4
Signed-off-by: Joss Armstrong <joss.armstrong@ericsson.com>
Diffstat (limited to 'appc-dg-util/appc-dg-util-bundle/src/main')
-rw-r--r-- | appc-dg-util/appc-dg-util-bundle/src/main/java/org/onap/appc/dg/util/impl/ExecuteNodeActionImpl.java | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/appc-dg-util/appc-dg-util-bundle/src/main/java/org/onap/appc/dg/util/impl/ExecuteNodeActionImpl.java b/appc-dg-util/appc-dg-util-bundle/src/main/java/org/onap/appc/dg/util/impl/ExecuteNodeActionImpl.java index 33b9866db..4f517d211 100644 --- a/appc-dg-util/appc-dg-util-bundle/src/main/java/org/onap/appc/dg/util/impl/ExecuteNodeActionImpl.java +++ b/appc-dg-util/appc-dg-util-bundle/src/main/java/org/onap/appc/dg/util/impl/ExecuteNodeActionImpl.java @@ -10,6 +10,8 @@ * ================================================================================ * Modifications Copyright (C) 2018 IBM. * ================================================================================ + * Modifications Copyright (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 @@ -47,7 +49,6 @@ import com.att.eelf.i18n.EELFResourceManager; public class ExecuteNodeActionImpl implements ExecuteNodeAction { - private static final EELFLogger logger = EELFManager.getInstance().getLogger(ExecuteNodeActionImpl.class); private static final String RESOURCE_TYPE_PARAM = "resourceType"; private static final String RESOURCE_KEY_PARAM = "resourceKey"; private static final String PREFIX_PARAM = "prefix"; @@ -62,6 +63,7 @@ public class ExecuteNodeActionImpl implements ExecuteNodeAction { private static final String ERROR_RETRIEVING_VNFC_HIERARCHY_PARAM = "Error Retrieving VNFC hierarchy"; private static final String RELATED_TO_PROPERTY_LEN_PARAM = "related-to-property_length"; public static final String DG_OUTPUT_STATUS_MESSAGE = "output.status.message"; + private static EELFLogger logger = EELFManager.getInstance().getLogger(ExecuteNodeActionImpl.class); private static Map<String, String> vnfHierarchyMap = new ConcurrentHashMap<>(); private static Map<String, Set<String>> vnfcHierarchyMap = new HashMap<>(); @@ -90,7 +92,8 @@ public class ExecuteNodeActionImpl implements ExecuteNodeAction { logger.info("DG waits for " + Long.parseLong(waitTime) + " milliseconds completed"); } catch (InterruptedException e) { logger.error("Error In ExecuteNodeActionImpl for waitMethod() due to InterruptedException: reason = " - + e.getMessage()); + + e.getMessage(), e); + Thread.currentThread().interrupt(); } } @@ -101,7 +104,7 @@ public class ExecuteNodeActionImpl implements ExecuteNodeAction { String resourceKey = params.get(RESOURCE_KEY_PARAM); if (logger.isDebugEnabled()) { - logger.debug("inside getResorce"); + logger.debug("inside getResource"); logger.debug("Retrieving " + resourceType + " details from A&AI for Key : " + resourceKey); } @@ -190,6 +193,7 @@ public class ExecuteNodeActionImpl implements ExecuteNodeAction { // and tenant-id String key = vnfCtx.getAttribute(vmKey + RELATIONSHIP_DATA_STR + j + "].relationship-key"); String value = vnfCtx.getAttribute(vmKey + RELATIONSHIP_DATA_STR + j + "].relationship-value"); + vnfHierarchyMap.put(VNFF_VM_STR + vmCount + "]." + key, value); if ("vserver.vserver-id".equals(key)) { vserverID = value; @@ -223,7 +227,7 @@ public class ExecuteNodeActionImpl implements ExecuteNodeAction { paramsVm.put(RESOURCE_TYPE_PARAM, "vserver"); paramsVm.put(PREFIX_PARAM, "vmRetrived"); paramsVm.put(RESOURCE_KEY_PARAM, vmRetrivalKey); - SvcLogicContext vmCtx = new SvcLogicContext(); + SvcLogicContext vmCtx = getSvcLogicContext(); logger.debug("Retrieving VM details from A&AI"); getResource(paramsVm, vmCtx); @@ -294,7 +298,7 @@ public class ExecuteNodeActionImpl implements ExecuteNodeAction { paramsVnf.put(RESOURCE_KEY_PARAM, retrivalVnfKey); logger.debug("Retrieving VNF details from A&AI"); // Retrive all the relations of VNF - SvcLogicContext vnfCtx = new SvcLogicContext(); + SvcLogicContext vnfCtx = getSvcLogicContext(); getResource(paramsVnf, vnfCtx); if (vnfCtx.getAttribute(GET_RESOURCE_RESULT).equals(SUCCESS_PARAM)) { trySetHeatStackIDAttribute(ctx, vnfCtx); @@ -389,4 +393,8 @@ public class ExecuteNodeActionImpl implements ExecuteNodeAction { vnfcCounter++; } } + + protected SvcLogicContext getSvcLogicContext() { + return new SvcLogicContext(); + } } |