aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test
diff options
context:
space:
mode:
authoraribeiro <anderson.ribeiro@est.tech>2020-09-04 13:31:21 +0100
committerJulien Bertozzi <julien.bertozzi@intl.att.com>2020-09-07 17:59:49 +0000
commit7f5501ed9e9807a4e5a17c06dd9b5989cced11aa (patch)
tree739ff4525b7e48ea3148b3b60331792178a13968 /catalog-be/src/test
parent2c47b29930ee129c7a332b4339c36daf3b98cc18 (diff)
Make directives options configurable backend
Issue-ID: SDC-3277 Signed-off-by: aribeiro <anderson.ribeiro@est.tech> Change-Id: I51ece01c0b0deb93cc7ab79ce8dcb9e1c5503074
Diffstat (limited to 'catalog-be/src/test')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogicTest.java5
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentSubstitutionFilterBusinessLogicTest.java7
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/DirectivesUtilTest.java (renamed from catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/DirectivesEnumTest.java)27
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/nodeFilter/BaseServiceFilterUtilsTest.java12
4 files changed, 29 insertions, 22 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogicTest.java
index 5867c4d199..be9dd1689a 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogicTest.java
@@ -49,10 +49,10 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.junit.jupiter.MockitoExtension;
import org.openecomp.sdc.be.components.impl.exceptions.BusinessLogicException;
-import org.openecomp.sdc.be.components.impl.utils.DirectivesEnum;
import org.openecomp.sdc.be.components.impl.utils.NodeFilterConstraintAction;
import org.openecomp.sdc.be.components.validation.NodeFilterValidator;
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.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
@@ -552,7 +552,8 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock
componentInstance = new ComponentInstance();
componentInstance.setUniqueId(componentInstanceId);
componentInstance.setName("myComponentInstance");
- componentInstance.setDirectives(new LinkedList<>(Arrays.asList(DirectivesEnum.SELECT.getValue())));
+ componentInstance.setDirectives(ConfigurationManager.getConfigurationManager().getConfiguration()
+ .getDirectives());
final UIConstraint uiConstraint =
new UIConstraint(servicePropertyName, constraintOperator, sourceType, sourceName, propertyValue);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentSubstitutionFilterBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentSubstitutionFilterBusinessLogicTest.java
index 6031416dbb..eaeb5ea11a 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentSubstitutionFilterBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentSubstitutionFilterBusinessLogicTest.java
@@ -48,10 +48,10 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.junit.jupiter.MockitoExtension;
import org.openecomp.sdc.be.components.impl.exceptions.BusinessLogicException;
-import org.openecomp.sdc.be.components.impl.utils.DirectivesEnum;
import org.openecomp.sdc.be.components.impl.utils.NodeFilterConstraintAction;
import org.openecomp.sdc.be.components.validation.NodeFilterValidator;
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.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
@@ -439,7 +439,8 @@ public class ComponentSubstitutionFilterBusinessLogicTest extends BaseBusinessLo
componentInstance = new ComponentInstance();
componentInstance.setUniqueId(componentInstanceId);
componentInstance.setName("myComponentInstance");
- componentInstance.setDirectives(new LinkedList<>(Arrays.asList(DirectivesEnum.SUBSTITUTE.getValue())));
+ componentInstance.setDirectives(ConfigurationManager.getConfigurationManager().getConfiguration()
+ .getDirectives());
final UIConstraint uiConstraint =
new UIConstraint(servicePropertyName, constraintOperator, sourceType, sourceName, propertyValue);
@@ -479,4 +480,4 @@ public class ComponentSubstitutionFilterBusinessLogicTest extends BaseBusinessLo
fail(e.getMessage());
}
}
-} \ No newline at end of file
+}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/DirectivesEnumTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/DirectivesUtilTest.java
index 529625b451..412b62cb0a 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/DirectivesEnumTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/DirectivesUtilTest.java
@@ -26,36 +26,37 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
+import org.openecomp.sdc.be.config.ConfigurationManager;
+import org.openecomp.sdc.common.impl.ExternalConfiguration;
+import org.openecomp.sdc.common.impl.FSConfigurationSource;
-public class DirectivesEnumTest {
-
- private List<String> directives;
+public class DirectivesUtilTest {
@Before
public void setup() {
- directives = new ArrayList<>();
+ new ConfigurationManager(new FSConfigurationSource(
+ ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be"));
}
@Test
public void testGivenValidDirectives_returnsTrue() {
- directives.add(DirectivesEnum.SELECT.getValue());
- directives.add(DirectivesEnum.SELECTABLE.getValue());
- directives.add(DirectivesEnum.SUBSTITUTE.getValue());
- directives.add(DirectivesEnum.SUBSTITUTABLE.getValue());
- assertTrue(DirectivesEnum.isValid(directives));
+ assertTrue(DirectivesUtil.isValid(ConfigurationManager.getConfigurationManager().getConfiguration()
+ .getDirectives()));
}
@Test
public void testGivenEmptyDirectives_returnsTrue() {
- assertTrue(DirectivesEnum.isValid(directives));
+ assertTrue(DirectivesUtil.isValid(Collections.emptyList()));
}
@Test
public void testGivenInvalidDirectives_returnsFalse() {
- directives.add("Invalid");
- assertFalse(DirectivesEnum.isValid(directives));
+ final List<String> directives = new ArrayList<>();
+ directives.add("invalidValue");
+ assertFalse(DirectivesUtil.isValid(directives));
}
-} \ No newline at end of file
+}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/nodeFilter/BaseServiceFilterUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/nodeFilter/BaseServiceFilterUtilsTest.java
index adf6e4439d..68ceaca0a6 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/nodeFilter/BaseServiceFilterUtilsTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/nodeFilter/BaseServiceFilterUtilsTest.java
@@ -16,17 +16,18 @@
package org.openecomp.sdc.be.nodeFilter;
+import java.util.Arrays;
import org.junit.Assert;
import org.junit.Before;
-import org.openecomp.sdc.be.components.impl.utils.DirectivesEnum;
+import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.datatypes.elements.CINodeFilterDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.RequirementNodeFilterPropertyDataDefinition;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.PropertyDefinition;
import org.openecomp.sdc.be.model.Service;
-
-import java.util.Arrays;
+import org.openecomp.sdc.common.impl.ExternalConfiguration;
+import org.openecomp.sdc.common.impl.FSConfigurationSource;
public class BaseServiceFilterUtilsTest {
@@ -41,12 +42,15 @@ public class BaseServiceFilterUtilsTest {
@Before
public void initService() {
try {
+ new ConfigurationManager(new FSConfigurationSource(
+ ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be"));
service = new Service();
ComponentInstance componentInstance = new ComponentInstance();
componentInstance.setUniqueId(CI_NAME);
componentInstance.setName(CI_NAME);
service.setComponentInstances(Arrays.asList(componentInstance));
- componentInstance.setDirectives(Arrays.asList(DirectivesEnum.SELECTABLE.getValue()));
+ componentInstance.setDirectives(ConfigurationManager.getConfigurationManager().getConfiguration()
+ .getDirectives());
CINodeFilterDataDefinition serviceFilter = new CINodeFilterDataDefinition();
componentInstance.setNodeFilter(serviceFilter);
requirementNodeFilterPropertyDataDefinition = new RequirementNodeFilterPropertyDataDefinition();