summaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test
diff options
context:
space:
mode:
authorDivesh Mirchandani <Divesh.Mirchandani@amdocs.com>2017-09-14 19:14:21 +0530
committerDivesh Mirchandani <Divesh.Mirchandani@amdocs.com>2017-09-18 17:26:38 +0530
commit396cb378ab8940b1adb8ba1adc656d0b4ad66f99 (patch)
treeb4f6ddc8e7cdfe39bfcbdc75cff7e85c284c5b65 /openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test
parent27f5c2b105676eebb477714fd7323467151965d2 (diff)
Fixed SONAR issues
Fixed blocker, critical, major & minor SONAR issues. Issue-ID: SDC-343 Change-Id: I72e5a3a7fa7d7407a92f98f77e4334827f70f926 Signed-off-by: dd4616 <Divesh.Mirchandani@amdocs.com>
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test')
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorTest.java2
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelTest.java18
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImplTest.java13
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImplTest.java38
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImplTest.java15
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImplTest.java19
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImplTest.java28
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImplTest.java9
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerImplTest.java9
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImplTest.java26
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImplTest.java8
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java25
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImplTest.java7
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/TreeBaseTest.java25
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java5
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VSPCommon.java6
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/utils/ZipFileUtils.java6
17 files changed, 190 insertions, 69 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorTest.java
index e3fa0a8480..45ba4fb434 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorTest.java
@@ -14,7 +14,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity;
import org.openecomp.sdc.vendorsoftwareproduct.impl.VendorSoftwareProductManagerImpl;
-import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator;
+
import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentComputeAssociation;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelTest.java
index c6374375f9..c3f78b6cb0 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentDependencyModelTest.java
@@ -5,24 +5,17 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
-import org.openecomp.core.utilities.CommonMethods;
import org.openecomp.sdc.common.errors.CoreException;
-import org.openecomp.sdc.vendorsoftwareproduct.ComponentDependencyModelManager;
-import org.openecomp.sdc.vendorsoftwareproduct.ComponentDependencyModelManagerFactory;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.ComponentManager;
import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager;
-import org.openecomp.sdc.vendorsoftwareproduct.VspManagerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModelEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.errors.ComponentDependencyModelErrorBuilder;
-import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData;
import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.errors.VersioningErrorCodes;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -31,10 +24,10 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import static org.mockito.Mockito.doReturn;
-
public class ComponentDependencyModelTest {
+ private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
+
@Spy
@InjectMocks
private ComponentDependencyModelManagerImpl componentDependencyModelManager;
@@ -90,7 +83,7 @@ public class ComponentDependencyModelTest {
ComponentDependencyModelErrorBuilder.getNoSourceComponentErrorBuilder().id(),
ComponentDependencyModelErrorBuilder.getNoSourceComponentErrorBuilder().message());
- entities.removeAll(entities);
+ entities.clear();
entities.add(createModelEntity("", sourceComp2Id));
testCreate_negative(entities, vsp1Id, VERSION01, USER1,
ComponentDependencyModelErrorBuilder.getNoSourceComponentErrorBuilder().id(),
@@ -142,6 +135,7 @@ public class ComponentDependencyModelTest {
user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
Assert.assertEquals(exception.getMessage(), expectedErrorMsg);
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImplTest.java
index 7cfcb05589..ee8295cafc 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImplTest.java
@@ -6,6 +6,8 @@ import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.NicManager;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
@@ -35,6 +37,9 @@ import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
public class ComponentManagerImplTest {
+
+ private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
+
private static final String COMP_NOT_EXIST_MSG =
"Vendor Software Product Component with Id 1 does not exist for Vendor Software Product with id VSP_ID and version 0.1";
private static final String USER = "componentsTestUser";
@@ -140,6 +145,7 @@ public class ComponentManagerImplTest {
try {
ComponentEntity created = componentManager.createComponent(expected, USER);
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals("Creation of only one VFC per VSP allowed.", exception.code().message());
Assert.assertEquals(VendorSoftwareProductErrorCodes.VSP_VFC_COUNT_EXCEED,
exception.code().id());
@@ -189,6 +195,7 @@ public class ComponentManagerImplTest {
try {
CompositionEntityValidationData created = componentManager.updateComponent(expected, USER);
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals("VFC with specified name already present in given VSP.",
exception.code().message());
Assert.assertEquals(VendorSoftwareProductErrorCodes.VSP_VFC_DUPLICATE_NAME,
@@ -426,6 +433,7 @@ public class ComponentManagerImplTest {
componentManager.createComponent(component, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
@@ -436,6 +444,7 @@ public class ComponentManagerImplTest {
componentManager.getComponent(vspId, version, componentId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
@@ -447,6 +456,7 @@ public class ComponentManagerImplTest {
.updateComponent(new ComponentEntity(vspId, version, componentId), user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
@@ -457,6 +467,7 @@ public class ComponentManagerImplTest {
componentManager.listComponents(vspId, version, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
@@ -467,6 +478,7 @@ public class ComponentManagerImplTest {
componentManager.deleteComponents(vspId, version, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
@@ -477,6 +489,7 @@ public class ComponentManagerImplTest {
componentManager.deleteComponent(vspId, version, componentId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImplTest.java
index bda77d0aa1..eda5693cce 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComputeManagerImplTest.java
@@ -1,30 +1,33 @@
package org.openecomp.sdc.vendorsoftwareproduct.impl;
-import org.junit.runner.RunWith;
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.openecomp.sdc.common.errors.CoreException;
-import org.openecomp.sdc.common.errors.ValidationErrorBuilder;
-import org.openecomp.sdc.vendorsoftwareproduct.ComputeManager;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.NetworkManager;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
-import org.openecomp.sdc.vendorsoftwareproduct.errors.DuplicateComputeInComponentErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity;
import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes;
import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
-import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator;
import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.ListComputeResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse;
-import org.openecomp.sdc.vendorsoftwareproduct.types.composition.*;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentComputeAssociation;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComputeData;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.errors.VersioningErrorCodes;
import org.testng.Assert;
@@ -36,14 +39,10 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.List;
-import static org.mockito.Matchers.anyObject;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
public class ComputeManagerImplTest {
+ private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
+
private static final String COMPUTE_NOT_EXIST_MSG =
"Vendor Software Product COMPUTE with Id compute1 does not exist for Vendor Software Product with " +
"id VSP_ID and version 0.1";
@@ -153,6 +152,7 @@ public class ComputeManagerImplTest {
Assert.fail();
}
catch (CoreException ex) {
+ log.debug("",ex);
Assert.assertEquals(VendorSoftwareProductErrorCodes.DUPLICATE_COMPUTE_NAME_NOT_ALLOWED,
ex.code().id());
}
@@ -227,6 +227,7 @@ public class ComputeManagerImplTest {
computeManager.updateCompute(computeEntity, USER);
}
catch (CoreException ex) {
+ log.debug("",ex);
Assert.assertEquals(ex.code().id(), VendorSoftwareProductErrorCodes.UPDATE_COMPUTE_NOT_ALLOWED);
}
@@ -315,6 +316,7 @@ public class ComputeManagerImplTest {
computeManager.deleteCompute(vspId, version, componentId, computeId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
@@ -325,6 +327,7 @@ public class ComputeManagerImplTest {
computeManager.getCompute(vspId, version, componentId, computeId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
@@ -335,6 +338,7 @@ public class ComputeManagerImplTest {
computeManager.listCompute(vspId, version, componentId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
Assert.assertEquals(exception.getMessage(), expectedErrorMsg);
}
@@ -348,6 +352,7 @@ public class ComputeManagerImplTest {
computeManager.updateCompute(new ComputeEntity(vspId, version, componentId, computeId), user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
@@ -357,6 +362,7 @@ public class ComputeManagerImplTest {
computeManager.createCompute(computeEntity1, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImplTest.java
index 804af537df..82715d3fe6 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/DeploymentFlavorManagerImplTest.java
@@ -11,6 +11,8 @@ import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.openecomp.core.utilities.json.JsonUtil;
import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao;
@@ -38,6 +40,9 @@ import java.util.Collection;
import java.util.List;
public class DeploymentFlavorManagerImplTest {
+
+ private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
+
private static final String USER = "depFlavorTestUser";
private static final String VSP_ID = "VSP_ID";
private static final Version VERSION = new Version(0, 1);
@@ -108,6 +113,7 @@ public class DeploymentFlavorManagerImplTest {
Assert.fail();
}
catch (CoreException ex) {
+ log.debug("",ex);
Assert.assertEquals(VendorSoftwareProductErrorCodes.DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED,
ex.code().id());
}
@@ -137,6 +143,7 @@ public class DeploymentFlavorManagerImplTest {
Assert.fail();
}
catch (CoreException ex) {
+ log.debug("",ex);
Assert.assertEquals(VendorSoftwareProductErrorCodes.FEATURE_GROUP_NOT_EXIST_FOR_VSP,
ex.code().id());
}
@@ -164,6 +171,7 @@ public class DeploymentFlavorManagerImplTest {
deploymentFlavorManager.createDeploymentFlavor(expected, USER);
}
catch (CoreException ex) {
+ log.debug("",ex);
Assert.assertEquals(VendorSoftwareProductErrorCodes.INVALID_COMPONENT_COMPUTE_ASSOCIATION,
ex.code().id());
Assert.assertEquals("Invalid request,for valid association please provide ComponentId for Compute Flavor",
@@ -198,6 +206,7 @@ public class DeploymentFlavorManagerImplTest {
deploymentFlavorManager.createDeploymentFlavor(expected, USER);
}
catch (CoreException ex) {
+ log.debug("",ex);
Assert.assertEquals(VendorSoftwareProductErrorCodes.INVALID_COMPUTE_FLAVOR_ID,
ex.code().id());
}
@@ -232,6 +241,7 @@ public class DeploymentFlavorManagerImplTest {
deploymentFlavorManager.createDeploymentFlavor(expected, USER);
}
catch (CoreException ex) {
+ log.debug("",ex);
Assert.assertEquals(VendorSoftwareProductErrorCodes.SAME_VFC_ASSOCIATION_MORE_THAN_ONCE_NOT_ALLOWED,
ex.code().id());
}
@@ -347,6 +357,7 @@ public class DeploymentFlavorManagerImplTest {
deploymentFlavorManager.listDeploymentFlavors(vspId, version, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
Assert.assertEquals(exception.getMessage(), expectedErrorMsg);
}
@@ -358,6 +369,7 @@ public class DeploymentFlavorManagerImplTest {
deploymentFlavorManager.createDeploymentFlavor(deploymentFlavorEntity, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
@@ -369,6 +381,7 @@ public class DeploymentFlavorManagerImplTest {
deploymentFlavorManager.deleteDeploymentFlavor(vspId, version, deploymentFlavorId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
@@ -395,6 +408,7 @@ public class DeploymentFlavorManagerImplTest {
.updateDeploymentFlavor(deploymentFlavorEntity, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
@@ -405,6 +419,7 @@ public class DeploymentFlavorManagerImplTest {
deploymentFlavorManager.getDeploymentFlavor(vspId, version, deploymentFlavorId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImplTest.java
index 741b1bf2ea..9f932b9fdf 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ImageManagerImplTest.java
@@ -3,16 +3,19 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl;
import static org.mockito.Matchers.anyObject;
import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes;
import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
@@ -31,11 +34,10 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.List;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
-
public class ImageManagerImplTest {
+ private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
+
private static final String IMAGE_NOT_EXIST_MSG =
"Vendor Software Product Image with Id image1 does not exist for Vendor Software Product with" +
" " +
@@ -194,6 +196,7 @@ public class ImageManagerImplTest {
imageManager.updateImage(imageEntity, USER);
}
catch (CoreException ex) {
+ log.debug("",ex);
Assert.assertEquals(ex.code().id(), VendorSoftwareProductErrorCodes.UPDATE_IMAGE_NOT_ALLOWED);
}
@@ -267,7 +270,6 @@ public class ImageManagerImplTest {
String json = "{\"md5\" :\"FFDSD33SS\"}";
doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
doReturn(new ImageEntity()).when(imageDao).get(anyObject());
-
imageManager.updateImageQuestionnaire(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID, json, USER);
verify(imageDao).updateQuestionnaireData(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID, json);
}
@@ -292,6 +294,7 @@ public class ImageManagerImplTest {
imageManager.updateImageQuestionnaire(VSP_ID, VERSION, COMPONENT_ID, IMAGE1_ID, json, USER);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), VendorSoftwareProductErrorCodes.DUPLICATE_IMAGE_VERSION_NOT_ALLOWED);
}
@@ -318,6 +321,7 @@ public class ImageManagerImplTest {
Assert.fail();
}
catch(CoreException ex) {
+ log.debug("",ex);
Assert.assertEquals(ex.code().id(), VendorSoftwareProductErrorCodes.UPDATE_IMAGE_NOT_ALLOWED);
}
}
@@ -338,6 +342,7 @@ public class ImageManagerImplTest {
Assert.fail();
}
catch(CoreException ex) {
+ log.debug("",ex);
Assert.assertEquals(ex.code().id(), VendorSoftwareProductErrorCodes.VFC_IMAGE_INVALID_FORMAT);
}
}
@@ -348,6 +353,7 @@ public class ImageManagerImplTest {
imageManager.listImages(vspId, version, componentId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
Assert.assertEquals(exception.getMessage(), expectedErrorMsg);
}
@@ -358,6 +364,7 @@ public class ImageManagerImplTest {
imageManager.createImage(image, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
@@ -369,6 +376,7 @@ public class ImageManagerImplTest {
imageManager.deleteImage(vspId, version, componentId, nicId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
@@ -388,6 +396,7 @@ public class ImageManagerImplTest {
imageManager.updateImage(new ImageEntity(vspId, version, componentId, imageId), user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImplTest.java
index b65071ac51..ecfe0e6372 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ManualVspToscaManagerImplTest.java
@@ -47,6 +47,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.services.ManualVspDataCollectionS
import org.openecomp.sdc.versioning.dao.types.Version;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -95,6 +96,15 @@ public class ManualVspToscaManagerImplTest {
private ManualVspDataCollectionService manualVspDataCollectionServiceMock;
/*
+ private static List<String> supportedCapabilities = new ArrayList<>();
+ private static List<String> supportedRequirements = new ArrayList<>();
+
+ static {
+ //TODO : Read from configuration
+ supportedCapabilities.addAll(Arrays.asList("host", "os", "endpoint", "scalable"));
+ supportedRequirements.addAll(Arrays.asList("link"));
+ }
+
@Test
public void testGatherVspInformationInvalidVsp() {
MockitoAnnotations.initMocks(this);
@@ -439,9 +449,9 @@ public class ManualVspToscaManagerImplTest {
private void validateSubstitutionCapabilities(Map<String, List<String>> capabilities,
String componentName) {
- List<String> supportedCapabilities = GeneratorUtils.supportedCapabilities;
- Assert.assertEquals(supportedCapabilities.size(), capabilities.size());
- for (String capability : supportedCapabilities) {
+ List<String> SupportedCapabilities = supportedCapabilities;
+ Assert.assertEquals(SupportedCapabilities.size(), capabilities.size());
+ for (String capability : SupportedCapabilities) {
String expectedCapabilityId = capability + "_" + componentName;
Assert.assertEquals(true, capabilities.containsKey(expectedCapabilityId));
List<String> expectedCapabilityValue = new ArrayList<>(2);
@@ -454,10 +464,10 @@ public class ManualVspToscaManagerImplTest {
private void validateSubstitutionRequirements(Map<String, List<String>> requirements,
List<Nic> nics) {
- List<String> supportedRequirements = GeneratorUtils.supportedRequirements;
+ List<String> SupportedRequirements = supportedRequirements;
for(Nic nic : nics) {
String nicNodeTemplateId = nic.getName() + PORT_NODE_TEMPLATE_ID_SUFFIX;
- for (String requirement : supportedRequirements) {
+ for (String requirement : SupportedRequirements) {
String expectedRequirementId = requirement + "_" + nicNodeTemplateId;
Assert.assertEquals(true, requirements.containsKey(expectedRequirementId));
List<String> expectedRequirementValue = new ArrayList<>(2);
@@ -498,11 +508,11 @@ public class ManualVspToscaManagerImplTest {
List<Map<String, RequirementDefinition>> requirements =
deploymentFlavorNodeType.getRequirements();
- List<String> supportedRequirements = GeneratorUtils.supportedRequirements;
+ List<String> SupportedRequirements = supportedRequirements;
for (Nic nic : nics) {
boolean found = false;
String nicNodeTemplateId = nic.getName() + PORT_NODE_TEMPLATE_ID_SUFFIX;
- for (String requirementId : supportedRequirements) {
+ for (String requirementId : SupportedRequirements) {
String expectedRequirementId = requirementId + "_" + nicNodeTemplateId;
for (Map<String, RequirementDefinition> requirement : requirements) {
if (requirement.containsKey(expectedRequirementId)) {
@@ -515,8 +525,8 @@ public class ManualVspToscaManagerImplTest {
}
Map<String, CapabilityDefinition> capabilities = deploymentFlavorNodeType.getCapabilities();
- List<String> supportedCapabilities = GeneratorUtils.supportedCapabilities;
- for (String capabilityId : supportedCapabilities) {
+ List<String> SupportedCapabilities = supportedCapabilities;
+ for (String capabilityId : SupportedCapabilities) {
String expectedCapabilityId = capabilityId + "_" + componentName;
Assert.assertEquals (true, capabilities.containsKey(expectedCapabilityId));
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImplTest.java
index 534c630e40..e4dd39cfda 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImplTest.java
@@ -5,6 +5,8 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.openecomp.core.enrichment.types.MonitoringUploadType;
import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity;
import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.MonitoringUploadStatus;
@@ -27,6 +29,8 @@ import static org.mockito.Mockito.verify;
public class MonitoringUploadsManagerImplTest {
+ private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
+
private static final String USER1 = "ComponentsUploadTestUser";
private static final String COMPONENT_ID = "COMPONENT_ID";
private static final String VSP_ID = "vspId";
@@ -66,6 +70,7 @@ public class MonitoringUploadsManagerImplTest {
MonitoringUploadType.VES_EVENTS, USER1);
Assert.fail();
} catch (Exception exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.getMessage(), "Invalid zip file");
}
}
@@ -80,6 +85,7 @@ public class MonitoringUploadsManagerImplTest {
MonitoringUploadType.SNMP_TRAP, USER1);
Assert.fail();
} catch (Exception exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.getMessage(), "Zip file should not contain folders");
}
}
@@ -94,6 +100,7 @@ public class MonitoringUploadsManagerImplTest {
MonitoringUploadType.VES_EVENTS, USER1);
Assert.fail();
} catch (Exception exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.getMessage(),
"Wrong VES EVENT Artifact was uploaded - all files contained in Artifact must be YAML " +
"files (using .yaml/.yml extensions)");
@@ -157,7 +164,7 @@ public class MonitoringUploadsManagerImplTest {
try {
return url.openStream();
} catch (IOException exception) {
- exception.printStackTrace();
+ log.debug("",exception);
return null;
}
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerImplTest.java
index f8710b8cc6..ebdbc6af7d 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NetworkManagerImplTest.java
@@ -25,6 +25,8 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity;
import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes;
@@ -49,6 +51,8 @@ import static org.mockito.Mockito.verify;
public class NetworkManagerImplTest {
+ private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
+
private static final String USER1 = "networksTestUser1";
private static final String USER2 = "networksTestUser2";
private static final String VSP_ID = "vsp";
@@ -239,6 +243,7 @@ public class NetworkManagerImplTest {
networkManager.createNetwork(network, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
@@ -249,6 +254,7 @@ public class NetworkManagerImplTest {
networkManager.getNetwork(vspId, version, networkId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
@@ -259,6 +265,7 @@ public class NetworkManagerImplTest {
networkManager.updateNetwork(new NetworkEntity(vspId, version, networkId), user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
@@ -269,6 +276,7 @@ public class NetworkManagerImplTest {
networkManager.listNetworks(vspId, version, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
@@ -279,6 +287,7 @@ public class NetworkManagerImplTest {
networkManager.deleteNetwork(vspId, version, networkId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImplTest.java
index fe275e9d68..ba04e91c63 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/NicManagerImplTest.java
@@ -1,16 +1,22 @@
package org.openecomp.sdc.vendorsoftwareproduct.impl;
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.NetworkManager;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes;
import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse;
@@ -29,13 +35,10 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
-import static org.mockito.Matchers.anyObject;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
public class NicManagerImplTest {
+
+ private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
+
private static final String NIC_NOT_EXIST_MSG =
"Vendor Software Product NIC with Id nic1 does not exist for Vendor Software Product with " +
"id VSP_ID and version 0.1";
@@ -129,6 +132,7 @@ public class NicManagerImplTest {
try {
NicEntity created = nicManager.createNic(nicEntity,USER);
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(VendorSoftwareProductErrorCodes.NIC_NAME_FORMAT_NOT_ALLOWED,
exception.code().id());
}
@@ -154,6 +158,7 @@ public class NicManagerImplTest {
try {
NicEntity created = nicManager.createNic(nicEntity,USER);
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals("Invalid request, NIC with name "+ nic.getName() +
" already exist for component with ID "+ nicEntity.getComponentId() +".",
exception.code().message());
@@ -176,6 +181,7 @@ public class NicManagerImplTest {
try {
NicEntity created = nicManager.createNic(nicEntity,USER);
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals("Invalid request,NetworkId not allowed for External Networks",
exception.code().message());
Assert.assertEquals(VendorSoftwareProductErrorCodes.NETWORKID_NOT_ALLOWED_FOR_EXTERNAL_NETWORK,
@@ -198,6 +204,7 @@ public class NicManagerImplTest {
try {
NicEntity created = nicManager.createNic(nicEntity,USER);
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals("Invalid request, Network Description not allowed for Internal Networks",
exception.code().message());
Assert.assertEquals(VendorSoftwareProductErrorCodes
@@ -344,6 +351,7 @@ public class NicManagerImplTest {
Assert.fail();
}
catch (CoreException ex) {
+ log.debug("",ex);
Assert.assertEquals(VendorSoftwareProductErrorCodes.NIC_NAME_FORMAT_NOT_ALLOWED,
ex.code().id());
}
@@ -442,6 +450,7 @@ public class NicManagerImplTest {
nicManager.createNic(nic, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
@@ -452,6 +461,7 @@ public class NicManagerImplTest {
nicManager.getNic(vspId, version, componentId, nicId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
@@ -462,6 +472,7 @@ public class NicManagerImplTest {
nicManager.updateNic(new NicEntity(vspId, version, componentId, nicId), user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
@@ -473,6 +484,7 @@ public class NicManagerImplTest {
nicManager.deleteNic(vspId, version, componentId, nicId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImplTest.java
index f756e44776..478bdfbbba 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ProcessManagerImplTest.java
@@ -11,6 +11,8 @@ import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessType;
@@ -35,6 +37,7 @@ import static org.mockito.Matchers.eq;
public class ProcessManagerImplTest {
+ private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
private static final String USER1 = "processesTestUser";
private static final String VSP_ID = "vsp";
@@ -315,6 +318,7 @@ public class ProcessManagerImplTest {
processManager.getProcess(vspId, version, componentId, processId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
@@ -327,6 +331,7 @@ public class ProcessManagerImplTest {
.updateProcess(new ProcessEntity(vspId, version, componentId, processId), user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
@@ -337,6 +342,7 @@ public class ProcessManagerImplTest {
processManager.getProcessArtifact(vspId, version, componentId, processId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
@@ -350,6 +356,7 @@ public class ProcessManagerImplTest {
vspId, version, componentId, processId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.error("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
@@ -360,6 +367,7 @@ public class ProcessManagerImplTest {
processManager.deleteProcessArtifact(vspId, VERSION, componentId, processId, user);
Assert.fail();
} catch (CoreException exception) {
+ log.debug("",exception);
Assert.assertEquals(exception.code().id(), expectedErrorCode);
}
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java
index e0e00f8d9d..77a847a2af 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java
@@ -40,6 +40,8 @@ import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
import org.openecomp.sdc.common.errors.Messages;
import org.openecomp.sdc.healing.api.HealingManager;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
import org.openecomp.sdc.tosca.datatypes.model.CapabilityDefinition;
import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
@@ -101,6 +103,9 @@ import static org.mockito.Mockito.verify;
public class VendorSoftwareProductManagerImplTest {
+
+ private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
+
private static final String INVALID_VERSION_MSG = "Invalid requested version.";
private static String VSP_ID = "vspId";
@@ -669,6 +674,7 @@ public class VendorSoftwareProductManagerImplTest {
url.openStream(), USER1, "zip", "notZipFile");
candidateManager.process(VSP_ID, VERSION01, USER1);
} catch (Exception ce) {
+ log.debug("",ce);
Assert.assertEquals(ce.getMessage(), Messages.CREATE_MANIFEST_FROM_ZIP.getErrorMessage());
}
@@ -688,14 +694,19 @@ public class VendorSoftwareProductManagerImplTest {
throws IOException {
List<String> fileNames = new ArrayList<>();
- ZipInputStream zip = new ZipInputStream(new FileInputStream(csar));
- ZipEntry ze;
-
- while ((ze = zip.getNextEntry()) != null) {
- String name = ze.getName();
- if (name.contains(folderName)) {
- fileNames.add(name);
+ FileInputStream fileInputStream = new FileInputStream(csar);
+ try {
+ ZipInputStream zip = new ZipInputStream(fileInputStream);
+ ZipEntry ze;
+
+ while ((ze = zip.getNextEntry()) != null) {
+ String name = ze.getName();
+ if (name.contains(folderName)) {
+ fileNames.add(name);
+ }
}
+ }finally {
+ fileInputStream.close();
}
return fileNames;
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImplTest.java
index a85153ecef..2f85f30dc5 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImplTest.java
@@ -23,6 +23,8 @@ package org.openecomp.sdc.vendorsoftwareproduct.services.impl.composition;
import org.apache.commons.io.FileUtils;
import org.mockito.InjectMocks;
import org.mockito.MockitoAnnotations;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
import org.openecomp.sdc.tosca.services.ToscaUtil;
@@ -52,6 +54,10 @@ import java.util.Map;
*/
public class CompositionDataExtractorImplTest {
+
+ private static final Logger log = (Logger) LoggerFactory.getLogger
+ (CompositionDataExtractorImplTest.class.getName());
+
@InjectMocks
private static CompositionDataExtractorImpl compositionDataExtractor;
@@ -108,6 +114,7 @@ public class CompositionDataExtractorImplTest {
try {
yamlFile.close();
} catch (IOException ignore) {
+ log.debug("",ignore);
}
} catch (FileNotFoundException exception) {
throw exception;
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/TreeBaseTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/TreeBaseTest.java
index 42eee1fb10..2174a6894a 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/TreeBaseTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/TreeBaseTest.java
@@ -22,6 +22,8 @@ package org.openecomp.sdc.vendorsoftwareproduct.tree;
import org.openecomp.core.utilities.file.FileUtils;
import org.openecomp.sdc.heat.services.tree.HeatTreeManager;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import java.io.File;
import java.net.URISyntaxException;
@@ -32,6 +34,8 @@ import java.net.URL;
*/
public class TreeBaseTest {
+ private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
+
String INPUT_DIR;
@@ -44,18 +48,21 @@ public class TreeBaseTest {
try {
inputDir = new File(url.toURI());
} catch (URISyntaxException exception) {
- exception.printStackTrace();
+ log.debug("",exception);
}
- File[] files = inputDir.listFiles();
- for (File inputFile : files) {
- try {
- heatTreeManager.addFile(inputFile.getName(), FileUtils.loadFileToInputStream(
- INPUT_DIR.replace("/", File.separator) + File.separator + inputFile.getName()));
- } catch (Exception e) {
- e.printStackTrace();
- throw e;
+
+ if(inputDir != null) {
+ File[] files = inputDir.listFiles();
+ for (File inputFile : files) {
+ try {
+ heatTreeManager.addFile(inputFile.getName(), FileUtils.loadFileToInputStream(
+ INPUT_DIR.replace("/", File.separator) + File.separator + inputFile.getName()));
+ } catch (Exception e) {
+ throw e;
+ }
}
}
return heatTreeManager;
+
}
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java
index dfb7409bd0..df386b12cd 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java
@@ -21,6 +21,9 @@
package org.openecomp.sdc.vendorsoftwareproduct.tree;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doReturn;
+
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@@ -29,6 +32,8 @@ import org.openecomp.core.model.dao.ServiceModelDao;
import org.openecomp.core.model.types.ServiceElement;
import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.healing.api.HealingManager;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VSPCommon.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VSPCommon.java
index 6bfe9e5eac..947f33922e 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VSPCommon.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VSPCommon.java
@@ -21,6 +21,8 @@
package org.openecomp.sdc.vendorsoftwareproduct.utils;
import org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.versioning.dao.types.Version;
@@ -35,6 +37,8 @@ import java.util.zip.ZipOutputStream;
public class VSPCommon {
+ private static final Logger log = (Logger) LoggerFactory.getLogger(VSPCommon.class.getName());
+
public static VspDetails createVspDetails(String id, Version version, String name, String desc,
String vendorName, String vlm, String icon,
String category, String subCategory,
@@ -92,7 +96,7 @@ public class VSPCommon {
zos.write(data);
zos.closeEntry();
} catch (IOException exception) {
- exception.printStackTrace();
+ log.debug("",exception);
}
}
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/utils/ZipFileUtils.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/utils/ZipFileUtils.java
index 12324ed777..b2a6f2fe87 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/utils/ZipFileUtils.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/utils/ZipFileUtils.java
@@ -20,6 +20,9 @@
package org.openecomp.sdc.vendorsoftwareproduct.utils;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -33,6 +36,7 @@ import java.util.zip.ZipOutputStream;
* @since November 08, 2016
*/
public class ZipFileUtils {
+ private static final Logger log = (Logger) LoggerFactory.getLogger(ZipFileUtils.class.getName());
public InputStream getZipInputStream(String name) {
URL url = getClass().getResource(name);
File templateDir = new File(url.getFile());
@@ -44,7 +48,7 @@ public class ZipFileUtils {
try {
zos.close();
} catch (IOException exception) {
- exception.printStackTrace();
+ log.debug("",exception);
}
return new ByteArrayInputStream(baos.toByteArray());
}