summaryrefslogtreecommitdiffstats
path: root/adapters/mso-vnf-adapter/src/main/java/org/openecomp
diff options
context:
space:
mode:
authorKalkere Ramesh, Sharan (sk720x) <sk720x@att.com>2018-03-28 21:38:10 -0400
committerKalkere Ramesh, Sharan (sk720x) <sk720x@att.com>2018-03-28 22:27:33 -0400
commit089e3eb2ac652a7af34449d0e1e667da8844a804 (patch)
tree83832fb0f0d5202a45dacc051b194d37e380fac8 /adapters/mso-vnf-adapter/src/main/java/org/openecomp
parent6f025dbcb86fe48f83c2a3214d0db3d4dcb13bbd (diff)
Junits added by Anthony W for MsoVnfAdapterImpl
Change-Id: I6d4236f0d002193f6594839b605ceb0eccd71c06 Issue-ID: SO-543 Signed-off-by: Kalkere Ramesh, Sharan (sk720x) <sk720x@att.com>
Diffstat (limited to 'adapters/mso-vnf-adapter/src/main/java/org/openecomp')
-rw-r--r--adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java25
1 files changed, 9 insertions, 16 deletions
diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java
index 32720e53db..2fec3f8b43 100644
--- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java
+++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java
@@ -30,10 +30,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
-import java.util.Scanner;
import java.util.concurrent.TimeUnit;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import javax.jws.WebService;
import javax.xml.ws.Holder;
@@ -80,6 +77,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+ protected MsoHeatUtils heat;
+
private static final String MSO_PROP_VNF_ADAPTER = "MSO_PROP_VNF_ADAPTER";
private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError";
private static final String VNF_ADAPTER_SERVICE_NAME = "MSO-BPMN:MSO-VnfAdapter.";
@@ -106,6 +105,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
public MsoVnfAdapterImpl(MsoPropertiesFactory msoPropFactory, CloudConfigFactory cloudConfigFact) {
this.msoPropertiesFactory = msoPropFactory;
this.cloudConfigFactory = cloudConfigFact;
+ heat = new MsoHeatUtils(MSO_PROP_VNF_ADAPTER, this.msoPropertiesFactory, this.cloudConfigFactory);
}
/**
@@ -278,8 +278,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// Will capture execution time for metrics
long startTime = System.currentTimeMillis();
- MsoHeatUtils heat = new MsoHeatUtils(MSO_PROP_VNF_ADAPTER, msoPropertiesFactory, cloudConfigFactory);
-
StackInfo heatStack = null;
long subStartTime = System.currentTimeMillis();
try {
@@ -339,8 +337,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// Will capture execution time for metrics
long startTime = System.currentTimeMillis();
- MsoHeatUtils heat = new MsoHeatUtils(MSO_PROP_VNF_ADAPTER, msoPropertiesFactory, cloudConfigFactory);
-
// Use the MsoHeatUtils to delete the stack. Set the polling flag to true.
// The possible outcomes of deleteStack are a StackInfo object with status
// of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException
@@ -390,8 +386,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
LOGGER.debug("Rolling Back VNF " + vnfId + " in " + cloudSiteId + "/" + tenantId);
- MsoHeatUtils heat = new MsoHeatUtils(MSO_PROP_VNF_ADAPTER, msoPropertiesFactory, cloudConfigFactory);
-
// Use the MsoHeatUtils to delete the stack. Set the polling flag to true.
// The possible outcomes of deleteStack are a StackInfo object with status
// of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException
@@ -701,8 +695,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
callHeatbridge(baseVfHeatStackId);
// First, look up to see if the VF already exists.
- MsoHeatUtils heat = new MsoHeatUtils(MSO_PROP_VNF_ADAPTER, msoPropertiesFactory, cloudConfigFactory);
-
StackInfo heatStack = null;
long subStartTime1 = System.currentTimeMillis();
try {
@@ -839,7 +831,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// Ready to deploy the new VNF
- try (CatalogDatabase db = CatalogDatabase.getInstance()) {
+ try (CatalogDatabase db = getCatalogDatabase()) {
// Retrieve the VF
VfModule vf = null;
VnfResource vnfResource = null;
@@ -1375,8 +1367,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// Will capture execution time for metrics
long startTime = System.currentTimeMillis();
- MsoHeatUtils heat = new MsoHeatUtils(MSO_PROP_VNF_ADAPTER, msoPropertiesFactory, cloudConfigFactory);
-
// 1702 capture the output parameters on a delete
// so we'll need to query first
Map<String, Object> stackOutputs = null;
@@ -1519,7 +1509,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
vfRollback.setModelCustomizationUuid(mcu);
// First, look up to see if the VNF already exists.
- MsoHeatUtils heat = new MsoHeatUtils(MSO_PROP_VNF_ADAPTER, msoPropertiesFactory, cloudConfigFactory);
MsoHeatUtilsWithUpdate heatU = new MsoHeatUtilsWithUpdate(MSO_PROP_VNF_ADAPTER, msoPropertiesFactory, cloudConfigFactory);
StackInfo heatStack = null;
@@ -1633,7 +1622,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// Get a handle to the Catalog Database
// Make sure DB session is closed
- try (CatalogDatabase db = CatalogDatabase.getInstance()) {
+ try (CatalogDatabase db = this.getCatalogDatabase()) {
// Retrieve the VF definition
VnfResource vnfResource = null;
VfModule vf = null;
@@ -2169,5 +2158,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
return vfModuleName;
}
+
+ private CatalogDatabase getCatalogDatabase(){
+ return CatalogDatabase.getInstance();
+ }
}