summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be/src/test/java/org')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java7
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/PropertyBusinessLogicTest.java8
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceDistributionBLTest.java7
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarBusinessLogicTest.java8
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarInfoTest.java4
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngineTest.java3
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactBusinessLogicTest.java32
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java22
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogicMock.java5
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogicTest.java8
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ConsumerBusinessLogicTest.java4
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogicTest.java4
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyPropertiesBusinessLogicTest.java4
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogicTest.java9
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java3
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceInstanceBusinessLogicTest.java4
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBussinessLogicBaseTestSetup.java6
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/exceptions/ComponentExceptionTest.java9
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleTestBase.java17
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabilitiesPropertiesMergeTest.java4
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogicTest.java4
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMergeTest.java4
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBLTest.java4
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathValidatorTest.java4
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PropertyConstraintsUtilsTest.java9
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ComponentValidationsTest.java4
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/UserValidationsTest.java4
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/filters/GatewayFilterTest.java2
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/impl/aaf/RoleAuthorizationHandlerTest.java11
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentPropertyServletTest.java17
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/user/UserBusinessLogicTest.java3
31 files changed, 102 insertions, 132 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java
index 883cdc4718..1b8fd42435 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java
@@ -38,7 +38,6 @@ import org.openecomp.sdc.be.components.path.ForwardingPathValidator;
import org.openecomp.sdc.be.components.utils.ComponentBusinessLogicMock;
import org.openecomp.sdc.be.components.validation.NodeFilterValidator;
import org.openecomp.sdc.be.components.validation.ServiceDistributionValidation;
-import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao;
import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
@@ -67,11 +66,9 @@ import org.openecomp.sdc.be.resources.data.auditing.ResourceAdminEvent;
import org.openecomp.sdc.be.user.Role;
import org.openecomp.sdc.be.user.UserBusinessLogic;
import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
-import org.openecomp.sdc.common.api.ConfigurationSource;
import org.openecomp.sdc.common.api.Constants;
import org.openecomp.sdc.common.datastructure.AuditingFieldsKey;
import org.openecomp.sdc.common.impl.ExternalConfiguration;
-import org.openecomp.sdc.common.impl.FSConfigurationSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.context.WebApplicationContext;
@@ -126,10 +123,6 @@ public abstract class BaseServiceBusinessLogicTest extends ComponentBusinessLogi
public void setup() {
ExternalConfiguration.setAppName("catalog-be");
- // init Configuration
- String appConfigDir = "src/test/resources/config/catalog-be";
- ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir);
- ConfigurationManager configurationManager = new ConfigurationManager(configurationSource);
componentsUtils = new ComponentsUtils(Mockito.mock(AuditingManager.class));
// Elements
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/PropertyBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/PropertyBusinessLogicTest.java
index 52fbdeed87..9fc9d3034f 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/PropertyBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/PropertyBusinessLogicTest.java
@@ -33,7 +33,6 @@ import org.openecomp.sdc.be.components.impl.BaseBusinessLogicMock;
import org.openecomp.sdc.be.components.impl.PropertyBusinessLogic;
import org.openecomp.sdc.be.components.impl.exceptions.BusinessLogicException;
import org.openecomp.sdc.be.components.validation.UserValidations;
-import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.impl.ComponentsUtils;
@@ -55,10 +54,8 @@ import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
import org.openecomp.sdc.be.user.Role;
import org.openecomp.sdc.be.user.UserBusinessLogic;
-import org.openecomp.sdc.common.api.ConfigurationSource;
import org.openecomp.sdc.common.api.Constants;
import org.openecomp.sdc.common.impl.ExternalConfiguration;
-import org.openecomp.sdc.common.impl.FSConfigurationSource;
import org.openecomp.sdc.exception.ResponseFormat;
import org.openecomp.sdc.test.utils.InterfaceOperationTestUtils;
import org.springframework.web.context.WebApplicationContext;
@@ -126,11 +123,6 @@ public class PropertyBusinessLogicTest extends BaseBusinessLogicMock {
MockitoAnnotations.initMocks(this);
ExternalConfiguration.setAppName("catalog-be");
- // init Configuration
- String appConfigDir = "src/test/resources/config/catalog-be";
- ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir);
- ConfigurationManager configurationManager = new ConfigurationManager(configurationSource);
-
// User data and management
user = new User();
user.setUserId("jh003");
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceDistributionBLTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceDistributionBLTest.java
index 6609a712cf..5c135642a5 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceDistributionBLTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceDistributionBLTest.java
@@ -39,7 +39,6 @@ import org.openecomp.sdc.be.components.path.ForwardingPathValidator;
import org.openecomp.sdc.be.components.utils.ComponentBusinessLogicMock;
import org.openecomp.sdc.be.components.validation.NodeFilterValidator;
import org.openecomp.sdc.be.components.validation.ServiceDistributionValidation;
-import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.datamodel.utils.UiComponentDataConverter;
import org.openecomp.sdc.be.externalapi.servlet.representation.ServiceDistributionReqInfo;
@@ -50,9 +49,7 @@ import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeFilterOperation;
import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
-import org.openecomp.sdc.common.api.ConfigurationSource;
import org.openecomp.sdc.common.impl.ExternalConfiguration;
-import org.openecomp.sdc.common.impl.FSConfigurationSource;
import org.openecomp.sdc.common.util.ThreadLocalsHolder;
import org.openecomp.sdc.exception.ResponseFormat;
@@ -105,10 +102,6 @@ public class ServiceDistributionBLTest extends ComponentBusinessLogicMock {
ExternalConfiguration.setAppName("catalog-be");
MockitoAnnotations.initMocks(this);
- // init Configuration
- String appConfigDir = "src/test/resources/config/catalog-be";
- ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir);
- ConfigurationManager configurationManager = new ConfigurationManager(configurationSource);
componentsUtils = new ComponentsUtils(Mockito.mock(AuditingManager.class));
bl.setComponentsUtils(componentsUtils);
serviceToActivate = new Service();
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarBusinessLogicTest.java
index ddf6284379..91ec89540c 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarBusinessLogicTest.java
@@ -36,7 +36,6 @@ import org.junit.Test;
import org.mockito.Mockito;
import org.openecomp.sdc.be.components.impl.BaseBusinessLogicMock;
import org.openecomp.sdc.be.components.impl.exceptions.ComponentException;
-import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.Resource;
@@ -45,9 +44,6 @@ import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.CsarOperation;
import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
-import org.openecomp.sdc.common.api.ConfigurationSource;
-import org.openecomp.sdc.common.impl.ExternalConfiguration;
-import org.openecomp.sdc.common.impl.FSConfigurationSource;
import org.openecomp.sdc.common.zip.ZipUtils;
import org.openecomp.sdc.common.zip.exception.ZipException;
import org.openecomp.sdc.exception.ResponseFormat;
@@ -70,10 +66,6 @@ import static org.mockito.Mockito.when;
public class CsarBusinessLogicTest extends BaseBusinessLogicMock {
- static ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(),
- "src/test/resources/config/catalog-be");
- static ConfigurationManager configurationManager = new ConfigurationManager(configurationSource);
-
private CsarOperation csarOperation = Mockito.mock(CsarOperation.class);
private ToscaOperationFacade toscaOperationFacade = Mockito.mock(ToscaOperationFacade.class);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarInfoTest.java
index 4b8d10bb72..62fd3f9e78 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarInfoTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarInfoTest.java
@@ -27,12 +27,15 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException;
+import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.config.NonManoArtifactType;
import org.openecomp.sdc.be.config.NonManoConfiguration;
import org.openecomp.sdc.be.config.NonManoFolderType;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.model.NodeTypeInfo;
import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.common.impl.ExternalConfiguration;
+import org.openecomp.sdc.common.impl.FSConfigurationSource;
import org.openecomp.sdc.common.zip.ZipUtils;
import org.openecomp.sdc.common.zip.exception.ZipException;
@@ -78,6 +81,7 @@ public class CsarInfoTest {
csarInfo = new CsarInfo(user, CSAR_UUID, payload, RESOURCE_NAME,
MAIN_TEMPLATE_NAME, mainTemplateContent, true);
+ new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be"));
}
@Test
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngineTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngineTest.java
index f73442cd8a..9ac04885b3 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngineTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngineTest.java
@@ -49,6 +49,8 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import org.openecomp.sdc.common.impl.ExternalConfiguration;
+import org.openecomp.sdc.common.impl.FSConfigurationSource;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -72,6 +74,7 @@ public class EnvironmentsEngineTest {
@Before
public void preStart() {
MockitoAnnotations.initMocks(this);
+ new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be"));
}
@Test
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactBusinessLogicTest.java
index 23e30e799d..c01f5eaccc 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactBusinessLogicTest.java
@@ -34,6 +34,7 @@ import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
import org.mockito.junit.MockitoJUnitRunner;
import org.openecomp.sdc.be.components.ArtifactsResolver;
import org.openecomp.sdc.be.components.lifecycle.LifecycleBusinessLogic;
@@ -51,7 +52,6 @@ import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.ArtifactDefinition;
-import org.openecomp.sdc.be.model.ArtifactType;
import org.openecomp.sdc.be.model.HeatParameterDefinition;
import org.openecomp.sdc.be.model.InterfaceDefinition;
import org.openecomp.sdc.be.model.Operation;
@@ -73,7 +73,6 @@ import org.openecomp.sdc.be.tosca.ToscaExportHandler;
import org.openecomp.sdc.be.user.UserBusinessLogic;
import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
import org.openecomp.sdc.common.api.ArtifactTypeEnum;
-import org.openecomp.sdc.common.api.ConfigurationSource;
import org.openecomp.sdc.common.impl.ExternalConfiguration;
import org.openecomp.sdc.common.impl.FSConfigurationSource;
import org.openecomp.sdc.exception.ResponseFormat;
@@ -100,16 +99,13 @@ import static org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.HEAT_V
public class ArtifactBusinessLogicTest extends BaseBusinessLogicMock{
public static final User USER = new User("John", "Doh", "jh0003", "jh0003@gmail.com", "ADMIN", System.currentTimeMillis());
- private final static String RESOURCE_INSTANCE_NAME = "Service-111";
- private final static String INSTANCE_ID = "S-123-444-ghghghg";
+ private static final String RESOURCE_INSTANCE_NAME = "Service-111";
+ private static final String INSTANCE_ID = "S-123-444-ghghghg";
- private final static String ARTIFACT_NAME = "service-Myservice-template.yml";
- private final static String ARTIFACT_LABEL = "assettoscatemplate";
- private final static String ES_ARTIFACT_ID = "123123dfgdfgd0";
- private final static byte[] PAYLOAD = "some payload".getBytes();
-
- static ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be");
- static ConfigurationManager configurationManager = new ConfigurationManager(configurationSource);
+ private static final String ARTIFACT_NAME = "service-Myservice-template.yml";
+ private static final String ARTIFACT_LABEL = "assettoscatemplate";
+ private static final String ES_ARTIFACT_ID = "123123dfgdfgd0";
+ private static final byte[] PAYLOAD = "some payload".getBytes();
@InjectMocks
private ArtifactsBusinessLogic artifactBL;
@@ -149,21 +145,9 @@ public class ArtifactBusinessLogicTest extends BaseBusinessLogicMock{
public static final Resource resource = Mockito.mock(Resource.class);
private Gson gson = new GsonBuilder().setPrettyPrinting().create();
-
- private static List<ArtifactType> getAllTypes() {
- List<ArtifactType> artifactTypes = new ArrayList<>();
- List<String> artifactTypesList = ConfigurationManager.getConfigurationManager().getConfiguration().getArtifactTypes();
- for (String artifactType : artifactTypesList) {
- ArtifactType artifactT = new ArtifactType();
- artifactT.setName(artifactType);
- artifactTypes.add(artifactT);
- }
- return artifactTypes;
- }
-
@Before
public void initMocks() {
-// MockitoAnnotations.initMocks(this);
+ MockitoAnnotations.initMocks(this);
Either<ArtifactDefinition, StorageOperationStatus> NotFoundResult = Either.right(StorageOperationStatus.NOT_FOUND);
Either<Map<String, ArtifactDefinition>, StorageOperationStatus> NotFoundResult2 = Either.right(StorageOperationStatus.NOT_FOUND);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java
index 0b4a30ec94..ab4c662d35 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java
@@ -36,10 +36,12 @@ import org.apache.commons.lang3.tuple.ImmutablePair;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
import org.openecomp.sdc.be.MockGenerator;
import org.openecomp.sdc.be.components.ArtifactsResolver;
import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationEnum;
@@ -99,10 +101,7 @@ import org.openecomp.sdc.be.user.Role;
import org.openecomp.sdc.be.user.UserBusinessLogic;
import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
import org.openecomp.sdc.common.api.ArtifactTypeEnum;
-import org.openecomp.sdc.common.api.ConfigurationSource;
import org.openecomp.sdc.common.datastructure.Wrapper;
-import org.openecomp.sdc.common.impl.ExternalConfiguration;
-import org.openecomp.sdc.common.impl.FSConfigurationSource;
import org.openecomp.sdc.common.util.GeneralUtility;
import org.openecomp.sdc.exception.ResponseFormat;
@@ -133,26 +132,24 @@ import static org.mockito.Mockito.when;
import static org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.HEAT_ENV_NAME;
import static org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.HEAT_VF_ENV_NAME;
+@RunWith(MockitoJUnitRunner.Silent.class)
public class ArtifactsBusinessLogicTest extends BaseBusinessLogicMock{
private static final User USER = new User("John", "Doh", "jh0003", "jh0003@gmail.com", "ADMIN",
System.currentTimeMillis());
- private final static String RESOURCE_INSTANCE_NAME = "Service-111";
- private final static String INSTANCE_ID = "S-123-444-ghghghg";
+ private static final String RESOURCE_INSTANCE_NAME = "Service-111";
+ private static final String INSTANCE_ID = "S-123-444-ghghghg";
- private final static String ARTIFACT_NAME = "service-Myservice-template.yml";
- private final static String ARTIFACT_LABEL = "assettoscatemplate";
- private final static String ES_ARTIFACT_ID = "123123dfgdfgd0";
- private final static byte[] PAYLOAD = "some payload".getBytes();
+ private static final String ARTIFACT_NAME = "service-Myservice-template.yml";
+ private static final String ARTIFACT_LABEL = "assettoscatemplate";
+ private static final String ES_ARTIFACT_ID = "123123dfgdfgd0";
+ private static final byte[] PAYLOAD = "some payload".getBytes();
private static final String RESOURCE_NAME = "My-Resource_Name with space";
private static final String RESOURCE_CATEGORY1 = "Network Layer 2-3";
private static final String RESOURCE_SUBCATEGORY = "Router";
public static final String RESOURCE_CATEGORY = "Network Layer 2-3/Router";
public static final Resource resource = Mockito.mock(Resource.class);
- static ConfigurationSource configurationSource = new FSConfigurationSource(
- ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be");
- static ConfigurationManager configurationManager = new ConfigurationManager(configurationSource);
@InjectMocks
private ArtifactsBusinessLogic artifactBL;
private static User user = null;
@@ -474,7 +471,6 @@ public class ArtifactsBusinessLogicTest extends BaseBusinessLogicMock{
.thenReturn(StorageOperationStatus.OK);
when(toscaOperationFacade.updateGroupInstancesOnComponent(eq(service),eq(ci.getUniqueId()), any(List.class)))
.thenReturn(Either.left(new ArrayList()));
-
assertThatThrownBy(() -> {
artifactBL.handleUpdate(ci.getUniqueId(),ComponentTypeEnum.RESOURCE_INSTANCE,artifactBL.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.UPDATE),
"uid2", envArtifact, null, null, null, null, null, AuditingActionEnum.ARTIFACT_METADATA_UPDATE, user, service, true);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogicMock.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogicMock.java
index e8d9ddcdf8..6fccb9aa98 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogicMock.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogicMock.java
@@ -20,6 +20,7 @@
package org.openecomp.sdc.be.components.impl;
import org.mockito.Mockito;
+import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations;
import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation;
import org.openecomp.sdc.be.model.operations.api.IElementOperation;
@@ -27,6 +28,9 @@ import org.openecomp.sdc.be.model.operations.api.IGroupInstanceOperation;
import org.openecomp.sdc.be.model.operations.api.IGroupOperation;
import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation;
import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation;
+import org.openecomp.sdc.common.api.ConfigurationSource;
+import org.openecomp.sdc.common.impl.ExternalConfiguration;
+import org.openecomp.sdc.common.impl.FSConfigurationSource;
public abstract class BaseBusinessLogicMock {
protected final IElementOperation elementDao = Mockito.mock(IElementOperation.class);
@@ -37,4 +41,5 @@ public abstract class BaseBusinessLogicMock {
protected final InterfaceOperation interfaceOperation = Mockito.mock(InterfaceOperation.class);
protected final InterfaceLifecycleOperation interfaceLifecycleTypeOperation = Mockito.mock(InterfaceLifecycleOperation.class);
protected final ArtifactsOperations artifactToscaOperation = Mockito.mock(ArtifactsOperations.class);
+ protected final ConfigurationManager configurationManager = new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be"));
} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogicTest.java
index af9aa7d660..1783b35008 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogicTest.java
@@ -28,7 +28,6 @@ import org.mockito.MockitoAnnotations;
import org.openecomp.sdc.be.auditing.impl.AuditingManager;
import org.openecomp.sdc.be.components.validation.CapabilitiesValidation;
import org.openecomp.sdc.be.components.validation.UserValidations;
-import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition;
@@ -53,9 +52,7 @@ import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.GraphLockOperation;
import org.openecomp.sdc.be.user.Role;
import org.openecomp.sdc.be.user.UserBusinessLogic;
-import org.openecomp.sdc.common.api.ConfigurationSource;
import org.openecomp.sdc.common.impl.ExternalConfiguration;
-import org.openecomp.sdc.common.impl.FSConfigurationSource;
import org.openecomp.sdc.exception.ResponseFormat;
import java.util.ArrayList;
@@ -98,11 +95,6 @@ public class CapabilitiesBusinessLogicTest extends BaseBusinessLogicMock {
MockitoAnnotations.initMocks(this);
ExternalConfiguration.setAppName("catalog-be");
- // init Configuration
- String appConfigDir = "src/test/resources/config/catalog-be";
- ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir);
- ConfigurationManager configurationManager = new ConfigurationManager(configurationSource);
-
ComponentsUtils componentsUtils = new ComponentsUtils(Mockito.mock(AuditingManager.class));
// User data and management
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ConsumerBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ConsumerBusinessLogicTest.java
index 24a9f58be1..47da86127c 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ConsumerBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ConsumerBusinessLogicTest.java
@@ -30,6 +30,7 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException;
+import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.datatypes.elements.ConsumerDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
@@ -41,6 +42,8 @@ import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.ConsumerOperation;
import org.openecomp.sdc.be.resources.data.ConsumerData;
import org.openecomp.sdc.be.user.UserBusinessLogic;
+import org.openecomp.sdc.common.impl.ExternalConfiguration;
+import org.openecomp.sdc.common.impl.FSConfigurationSource;
import org.openecomp.sdc.exception.ResponseFormat;
import java.util.HashMap;
@@ -84,6 +87,7 @@ public class ConsumerBusinessLogicTest extends BaseBusinessLogicMock {
MockitoAnnotations.initMocks(this);
user = new User("Stan", "Lee", "stan.lee",
"stan.lee@marvel.com", "ADMIN", 1542024000L);
+ new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be"));
}
@Test
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogicTest.java
index d03ebb205d..3ab235c779 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogicTest.java
@@ -29,6 +29,7 @@ import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentEx
import org.openecomp.sdc.be.components.utils.ResourceBuilder;
import org.openecomp.sdc.be.components.validation.InterfaceOperationValidation;
import org.openecomp.sdc.be.components.validation.UserValidations;
+import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus;
@@ -51,6 +52,8 @@ import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade
import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation;
+import org.openecomp.sdc.common.impl.ExternalConfiguration;
+import org.openecomp.sdc.common.impl.FSConfigurationSource;
import org.openecomp.sdc.exception.ResponseFormat;
import org.openecomp.sdc.test.utils.InterfaceOperationTestUtils;
@@ -129,6 +132,7 @@ public class InterfaceOperationBusinessLogicTest {
.validateDeleteOperationContainsNoMappedOutput(any(), any(), any()))
.thenReturn(Either.left(true));
when(janusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK);
+ new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be"));
}
private List<InputDefinition> createInputsForResource() {
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyPropertiesBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyPropertiesBusinessLogicTest.java
index 87a4fde421..0dbb69dfcb 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyPropertiesBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyPropertiesBusinessLogicTest.java
@@ -36,6 +36,7 @@ import org.openecomp.sdc.be.components.utils.PolicyDefinitionBuilder;
import org.openecomp.sdc.be.components.utils.PropertyDataDefinitionBuilder;
import org.openecomp.sdc.be.components.utils.ResourceBuilder;
import org.openecomp.sdc.be.components.validation.UserValidations;
+import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
@@ -49,6 +50,8 @@ import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
+import org.openecomp.sdc.common.impl.ExternalConfiguration;
+import org.openecomp.sdc.common.impl.FSConfigurationSource;
import org.openecomp.sdc.exception.ResponseFormat;
import javax.ws.rs.core.Response;
@@ -117,6 +120,7 @@ public class PolicyPropertiesBusinessLogicTest {
.addPolicy(policy1)
.addPolicy(policy2)
.build();
+ new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be"));
}
@After
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogicTest.java
index 3670e74268..13e8e35faf 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogicTest.java
@@ -29,7 +29,6 @@ import org.mockito.MockitoAnnotations;
import org.openecomp.sdc.be.auditing.impl.AuditingManager;
import org.openecomp.sdc.be.components.validation.RequirementValidation;
import org.openecomp.sdc.be.components.validation.UserValidations;
-import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
@@ -50,9 +49,7 @@ import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.GraphLockOperation;
import org.openecomp.sdc.be.user.Role;
import org.openecomp.sdc.be.user.UserBusinessLogic;
-import org.openecomp.sdc.common.api.ConfigurationSource;
import org.openecomp.sdc.common.impl.ExternalConfiguration;
-import org.openecomp.sdc.common.impl.FSConfigurationSource;
import org.openecomp.sdc.exception.ResponseFormat;
import java.util.ArrayList;
@@ -95,12 +92,6 @@ public class RequirementBusinessLogicTest extends BaseBusinessLogicMock {
MockitoAnnotations.initMocks(this);
ExternalConfiguration.setAppName("catalog-be");
- // init Configuration
- String appConfigDir = "src/test/resources/config/catalog-be";
- ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration
- .getChangeListener(), appConfigDir);
- ConfigurationManager configurationManager = new ConfigurationManager(configurationSource);
-
ComponentsUtils componentsUtils = new ComponentsUtils(Mockito.mock(AuditingManager.class));
// User data and management
user = new User();
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java
index 2401c7e772..9e563fc34c 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java
@@ -139,8 +139,7 @@ import org.springframework.web.context.WebApplicationContext;
public class ResourceBusinessLogicTest {
- ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be");
- ConfigurationManager configurationManager = new ConfigurationManager(configurationSource);
+ private final ConfigurationManager configurationManager = new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be"));
private static final Logger log = LoggerFactory.getLogger(ResourceBusinessLogicTest.class);
private static final String RESOURCE_CATEGORY1 = "Network Layer 2-3";
private static final String RESOURCE_SUBCATEGORY = "Router";
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceInstanceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceInstanceBusinessLogicTest.java
index 6a47044c22..f69a9dc76d 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceInstanceBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceInstanceBusinessLogicTest.java
@@ -53,9 +53,6 @@ import org.openecomp.sdc.be.resources.data.auditing.model.ResourceCommonInfo;
import org.openecomp.sdc.be.resources.data.auditing.model.ResourceVersionInfo;
import org.openecomp.sdc.be.user.UserBusinessLogic;
import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
-import org.openecomp.sdc.common.api.ConfigurationSource;
-import org.openecomp.sdc.common.impl.ExternalConfiguration;
-import org.openecomp.sdc.common.impl.FSConfigurationSource;
import org.openecomp.sdc.exception.ResponseFormat;
import java.util.ArrayList;
@@ -101,7 +98,6 @@ public class ResourceInstanceBusinessLogicTest extends BaseBusinessLogicMock {
componentInstanceOperation, artifactBusinessLogic, compInstMergeDataBL, onChangeInstanceOperationOrchestrator,
forwardingPathOperation, serviceFilterOperation, artifactToscaOperation);
- static ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be");
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBussinessLogicBaseTestSetup.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBussinessLogicBaseTestSetup.java
index c93a362096..b812fd9187 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBussinessLogicBaseTestSetup.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBussinessLogicBaseTestSetup.java
@@ -49,7 +49,6 @@ import org.openecomp.sdc.be.components.validation.service.ServiceNamingPolicyVal
import org.openecomp.sdc.be.components.validation.service.ServiceRoleValidator;
import org.openecomp.sdc.be.components.validation.service.ServiceTypeValidator;
import org.openecomp.sdc.be.components.validation.service.ServiceValidator;
-import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao;
import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
@@ -77,10 +76,7 @@ import org.openecomp.sdc.be.resources.data.auditing.ResourceAdminEvent;
import org.openecomp.sdc.be.user.Role;
import org.openecomp.sdc.be.user.UserBusinessLogic;
import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
-import org.openecomp.sdc.common.api.ConfigurationSource;
import org.openecomp.sdc.common.api.Constants;
-import org.openecomp.sdc.common.impl.ExternalConfiguration;
-import org.openecomp.sdc.common.impl.FSConfigurationSource;
import org.openecomp.sdc.exception.ResponseFormat;
import org.springframework.web.context.WebApplicationContext;
@@ -96,8 +92,6 @@ import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.when;
public class ServiceBussinessLogicBaseTestSetup extends BaseBusinessLogicMock{
- ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be");
- ConfigurationManager configurationManager = new ConfigurationManager(configurationSource);
protected ServiceBusinessLogic bl;
protected static final String SERVICE_CATEGORY = "Mobility";
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/exceptions/ComponentExceptionTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/exceptions/ComponentExceptionTest.java
index 95e5c990ae..016b44c2a2 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/exceptions/ComponentExceptionTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/exceptions/ComponentExceptionTest.java
@@ -22,8 +22,12 @@
package org.openecomp.sdc.be.components.impl.exceptions;
+import org.junit.Before;
import org.junit.Test;
+import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.common.impl.ExternalConfiguration;
+import org.openecomp.sdc.common.impl.FSConfigurationSource;
import org.openecomp.sdc.exception.ResponseFormat;
import static org.junit.Assert.assertArrayEquals;
@@ -33,6 +37,11 @@ public class ComponentExceptionTest {
private static final String[] PARAMS = {"param1", "param2"};
+ @Before
+ public void init(){
+ new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be"));
+ }
+
@Test
public void hasValidGettersForActionStatus() {
ByActionStatusComponentException componentException = new ByActionStatusComponentException(
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleTestBase.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleTestBase.java
index cb78cbaeb3..6c4d27dd40 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleTestBase.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleTestBase.java
@@ -62,7 +62,6 @@ import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
import org.openecomp.sdc.be.user.Role;
import org.openecomp.sdc.be.user.UserBusinessLogic;
-import org.openecomp.sdc.common.api.ConfigurationSource;
import org.openecomp.sdc.common.api.Constants;
import org.openecomp.sdc.common.impl.ExternalConfiguration;
import org.openecomp.sdc.common.impl.FSConfigurationSource;
@@ -91,7 +90,6 @@ public class LifecycleTestBase extends ComponentBusinessLogicMock {
protected User user = null;
protected Resource resourceResponse;
protected Service serviceResponse;
- protected static ConfigurationManager configurationManager = null;
protected ResponseFormatManager responseManager = null;
protected JanusGraphDao janusGraphDao = Mockito.mock(JanusGraphDao.class);
protected ToscaOperationFacade toscaOperationFacade = Mockito.mock(ToscaOperationFacade.class);
@@ -107,25 +105,12 @@ public class LifecycleTestBase extends ComponentBusinessLogicMock {
@BeforeClass
public static void setupClass() {
ExternalConfiguration.setAppName("catalog-be");
-
- // init Configuration
- String appConfigDir = "src/test/resources/config/catalog-be";
- ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir);
- configurationManager = new ConfigurationManager(configurationSource);
-
+ new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be"));
componentsUtils = new ComponentsUtils(Mockito.mock(AuditingManager.class));
}
public void setup() {
-// ExternalConfiguration.setAppName("catalog-be");
-//
-// // init Configuration
-// String appConfigDir = "src/test/resources/config/catalog-be";
-// ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir);
-// configurationManager = new ConfigurationManager(configurationSource);
-
-
// User data and management
user = new User();
user.setUserId("jh003");
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabilitiesPropertiesMergeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabilitiesPropertiesMergeTest.java
index 8304679ef2..d3bc590b42 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabilitiesPropertiesMergeTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabilitiesPropertiesMergeTest.java
@@ -27,6 +27,7 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.openecomp.sdc.be.components.impl.exceptions.ComponentException;
+import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.CapabilityDefinition;
@@ -38,6 +39,8 @@ import org.openecomp.sdc.be.model.User;
import java.util.Collections;
import java.util.List;
+import org.openecomp.sdc.common.impl.ExternalConfiguration;
+import org.openecomp.sdc.common.impl.FSConfigurationSource;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
@@ -66,6 +69,7 @@ public class ComponentInstanceCapabilitiesPropertiesMergeTest {
mergeHolder = new DataForMergeHolder();
mergeHolder.setOrigInstanceNode(origInstanceNode);
mergeHolder.setOrigInstanceCapabilities(origInstanceCapabilities);
+ new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be"));
}
@Test
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogicTest.java
index ab4d8118a5..bbd2467106 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogicTest.java
@@ -31,6 +31,7 @@ import org.mockito.MockitoAnnotations;
import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException;
import org.openecomp.sdc.be.components.impl.exceptions.ComponentException;
import org.openecomp.sdc.be.components.utils.ResourceBuilder;
+import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
@@ -42,6 +43,8 @@ import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
+import org.openecomp.sdc.common.impl.ExternalConfiguration;
+import org.openecomp.sdc.common.impl.FSConfigurationSource;
import org.openecomp.sdc.exception.ResponseFormat;
import java.util.Arrays;
@@ -72,6 +75,7 @@ public class ComponentInstanceMergeDataBusinessLogicTest {
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
testInstance.setComponentInstancesMergeBLs(Arrays.asList(componentInstanceMergeInterfaceMock1, componentInstanceMergeInterfaceMock2));
+ new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be"));
}
@Test
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMergeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMergeTest.java
index 925f89b5eb..c8dde95c2b 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMergeTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMergeTest.java
@@ -31,6 +31,7 @@ import org.mockito.MockitoAnnotations;
import org.openecomp.sdc.be.components.impl.exceptions.ComponentException;
import org.openecomp.sdc.be.components.utils.ObjectGenerator;
import org.openecomp.sdc.be.components.utils.ResourceBuilder;
+import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.Component;
@@ -43,6 +44,8 @@ import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
+import org.openecomp.sdc.common.impl.ExternalConfiguration;
+import org.openecomp.sdc.common.impl.FSConfigurationSource;
import org.openecomp.sdc.exception.ResponseFormat;
import java.util.List;
@@ -100,6 +103,7 @@ public class ComponentInstancePropsAndInputsMergeTest {
oldDataHolder.setOrigComponentInputs(oldInputs);
oldDataHolder.setOrigComponentInstanceProperties(oldInstProps);
oldDataHolder.setOrigComponentInstanceInputs(oldInstInputs);
+ new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be"));
}
@Test
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBLTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBLTest.java
index 767fb6a5cd..a12335c4f9 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBLTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBLTest.java
@@ -26,6 +26,7 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.openecomp.sdc.be.components.impl.exceptions.ComponentException;
+import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.User;
@@ -37,6 +38,8 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.openecomp.sdc.common.impl.ExternalConfiguration;
+import org.openecomp.sdc.common.impl.FSConfigurationSource;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
@@ -61,6 +64,7 @@ public class ExternalRefsMergeBLTest {
public void setUp() throws Exception {
externalRefsMergeBL = new ExternalRefsMergeBL(externalReferencesOperation);
externalRefs.put("a", Arrays.asList("1", "2"));
+ new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be"));
}
@Test
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathValidatorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathValidatorTest.java
index 526f9e58f5..6123561d45 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathValidatorTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathValidatorTest.java
@@ -31,12 +31,15 @@ import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.openecomp.sdc.be.components.impl.ResponseFormatManager;
import org.openecomp.sdc.be.components.impl.exceptions.ComponentException;
+import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
+import org.openecomp.sdc.common.impl.ExternalConfiguration;
+import org.openecomp.sdc.common.impl.FSConfigurationSource;
import org.openecomp.sdc.exception.ResponseFormat;
import java.util.Collection;
@@ -71,6 +74,7 @@ public class ForwardingPathValidatorTest implements ForwardingPathTestUtils {
when(mock.getResponseFormat(any(), any())).thenReturn(new ResponseFormat());
when(mock.getResponseFormat(any(), any(), any())).thenReturn(new ResponseFormat());
+ new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be"));
}
@Test
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PropertyConstraintsUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PropertyConstraintsUtilsTest.java
index 8ac4139e62..8095a6d3e7 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PropertyConstraintsUtilsTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PropertyConstraintsUtilsTest.java
@@ -21,8 +21,10 @@
package org.openecomp.sdc.be.components.property;
import com.google.common.collect.Lists;
+import org.junit.Before;
import org.junit.Test;
import org.openecomp.sdc.be.components.impl.exceptions.ComponentException;
+import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.model.PropertyConstraint;
import org.openecomp.sdc.be.model.PropertyDefinition;
@@ -34,11 +36,18 @@ import org.openecomp.sdc.be.model.tosca.constraints.ValidValuesConstraint;
import java.util.List;
import java.util.Optional;
+import org.openecomp.sdc.common.impl.ExternalConfiguration;
+import org.openecomp.sdc.common.impl.FSConfigurationSource;
import static org.assertj.core.api.Java6Assertions.assertThat;
public class PropertyConstraintsUtilsTest {
+ @Before
+ public void init(){
+ new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be"));
+ }
+
@Test
public void mergePropertiesConstraintsDeletionNotPermittedTest(){
Resource newResource = new Resource();
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ComponentValidationsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ComponentValidationsTest.java
index 1ad4433222..df4e3847e2 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ComponentValidationsTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ComponentValidationsTest.java
@@ -25,6 +25,7 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.openecomp.sdc.be.components.impl.exceptions.ComponentException;
+import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
@@ -37,6 +38,8 @@ import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade
import org.openecomp.sdc.be.model.operations.StorageException;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.GraphLockOperation;
+import org.openecomp.sdc.common.impl.ExternalConfiguration;
+import org.openecomp.sdc.common.impl.FSConfigurationSource;
public class ComponentValidationsTest {
@@ -52,6 +55,7 @@ public class ComponentValidationsTest {
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
+ new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be"));
}
@Test
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/UserValidationsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/UserValidationsTest.java
index ffbdd7ff80..ce5a3871a5 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/UserValidationsTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/UserValidationsTest.java
@@ -28,6 +28,7 @@ import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException;
import org.openecomp.sdc.be.components.impl.exceptions.ComponentException;
+import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.utils.UserStatusEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
@@ -37,6 +38,8 @@ import org.openecomp.sdc.be.user.UserBusinessLogic;
import java.util.LinkedList;
import java.util.List;
+import org.openecomp.sdc.common.impl.ExternalConfiguration;
+import org.openecomp.sdc.common.impl.FSConfigurationSource;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowable;
@@ -56,6 +59,7 @@ public class UserValidationsTest {
public void setUp() {
//TestUtilsSdc.setFinalStatic(UserValidations.class, "log", LoggerFactory.getLogger(UserValidations.class));
MockitoAnnotations.initMocks(this);
+ new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be"));
}
@Test
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/filters/GatewayFilterTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/filters/GatewayFilterTest.java
index 7a55bcbedb..08d36913ac 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/filters/GatewayFilterTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/filters/GatewayFilterTest.java
@@ -30,8 +30,6 @@ import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.openecomp.sdc.be.components.impl.ResponseFormatManager;
-import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException;
-import org.openecomp.sdc.be.components.impl.exceptions.ComponentException;
import org.openecomp.sdc.be.config.Configuration;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.servlets.exception.ComponentExceptionMapper;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/impl/aaf/RoleAuthorizationHandlerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/impl/aaf/RoleAuthorizationHandlerTest.java
index fa02a72f96..71513c36bd 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/impl/aaf/RoleAuthorizationHandlerTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/impl/aaf/RoleAuthorizationHandlerTest.java
@@ -23,9 +23,11 @@ package org.openecomp.sdc.be.impl.aaf;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.Signature;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
import org.mockito.junit.MockitoJUnitRunner;
import org.openecomp.sdc.be.components.impl.aaf.AafPermission;
import org.openecomp.sdc.be.components.impl.aaf.PermissionAllowed;
@@ -48,7 +50,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowable;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
+@RunWith(MockitoJUnitRunner.Silent.class)
public class RoleAuthorizationHandlerTest {
private RoleAuthorizationHandler roleAuthorizationHandler = new RoleAuthorizationHandler();
@@ -61,18 +63,15 @@ public class RoleAuthorizationHandlerTest {
@Mock
HttpServletRequest httpServletRequest;
-
- private static ConfigurationSource configurationSource = new FSConfigurationSource(
- ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be/auth");
- static ConfigurationManager configurationManager = new ConfigurationManager(configurationSource);
-
@Before
public void setUp() {
+ MockitoAnnotations.initMocks(this);
when(joinPoint.getSignature()).thenReturn(signature);
when(signature.toShortString()).thenReturn("methodName");
when(joinPoint.getThis()).thenReturn(beGenericServlet);
when(beGenericServlet.getServletRequest()).thenReturn(httpServletRequest);
ThreadLocalsHolder.setApiType(FilterDecisionEnum.EXTERNAL);
+ new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be/auth"));
}
@Test
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentPropertyServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentPropertyServletTest.java
index 02d273b8a9..5b2c9cbe0c 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentPropertyServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentPropertyServletTest.java
@@ -28,6 +28,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.openecomp.sdc.be.components.impl.PropertyBusinessLogic;
@@ -67,14 +68,18 @@ public class ComponentPropertyServletTest extends JerseySpringBaseTest {
private ComponentPropertyServlet componentPropertyServlet;
private static final String SERVICE_ID = "service1";
- private final static String USER_ID = "jh0003";
+ private static final String USER_ID = "jh0003";
private static final String VALID_PROPERTY_NAME = "valid_name_123";
private static final String INVALID_PROPERTY_NAME = "invalid_name_$.&";
private static final String STRING_TYPE = "string";
@Before
public void initClass() {
- initMockitoStubbings();
+ when(request.getSession()).thenReturn(session);
+ when(session.getServletContext()).thenReturn(context);
+ when(context.getAttribute(eq(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR))).thenReturn(wrapper);
+ when(wrapper.getWebAppContext(any())).thenReturn(webAppContext);
+ when(webAppContext.getBean(eq(ComponentsUtils.class))).thenReturn(componentsUtils);
}
@Test
@@ -110,14 +115,6 @@ public class ComponentPropertyServletTest extends JerseySpringBaseTest {
Assert.assertEquals(HttpStatus.BAD_REQUEST_400.getStatusCode(), propertyInService.getStatus());
}
- private static void initMockitoStubbings() {
- when(request.getSession()).thenReturn(session);
- when(session.getServletContext()).thenReturn(context);
- when(context.getAttribute(eq(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR))).thenReturn(wrapper);
- when(wrapper.getWebAppContext(any())).thenReturn(webAppContext);
- when(webAppContext.getBean(eq(ComponentsUtils.class))).thenReturn(componentsUtils);
- }
-
private String getValidProperty() {
return "{\n"
+ " \"valid_name_123\": {\n"
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/user/UserBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/user/UserBusinessLogicTest.java
index 43d2998096..d31d3b1ef6 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/user/UserBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/user/UserBusinessLogicTest.java
@@ -91,11 +91,10 @@ public class UserBusinessLogicTest {
private UserBusinessLogic testSubject;
static ResponseFormatManager responseFormatManager = new ResponseFormatManager();
- private static ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be");
- static ConfigurationManager configurationManager = new ConfigurationManager(configurationSource);
@Before
public void setUp() {
+ new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be"));
doThrow(new ByActionStatusComponentException(ActionStatus.GENERAL_ERROR)).when(componentsUtils).auditAdminUserActionAndThrowException(any(), any(), any(), any(), any(), any());
}