summaryrefslogtreecommitdiffstats
path: root/catalog-model/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-model/src/test')
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ElementOperationTest.java96
-rw-r--r--catalog-model/src/test/resources/config/catalog-model/configuration.yaml275
-rw-r--r--catalog-model/src/test/resources/config/configuration.yaml267
3 files changed, 33 insertions, 605 deletions
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ElementOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ElementOperationTest.java
index 17e2430d82..3597d02834 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ElementOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ElementOperationTest.java
@@ -25,6 +25,7 @@ import org.apache.tinkerpop.gremlin.structure.T;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.openecomp.sdc.be.config.ArtifactConfiguration;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
@@ -47,6 +48,7 @@ import java.util.List;
import java.util.Map;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@RunWith(SpringJUnit4ClassRunner.class)
@@ -64,52 +66,44 @@ public class ElementOperationTest extends ModelTestBase {
@BeforeClass
public static void setupBeforeClass() {
- // ExternalConfiguration.setAppName("catalog-model");
- // String appConfigDir = "src/test/resources/config/catalog-model";
- // ConfigurationSource configurationSource = new
- // FSConfigurationSource(ExternalConfiguration.getChangeListener(),
- // appConfigDir);
-
ModelTestBase.init();
-
}
@Test
public void testGetArtifactsTypes() {
-
- List<String> artifactTypesCfg = new ArrayList<>();
- artifactTypesCfg.add("type1");
- artifactTypesCfg.add("type2");
- artifactTypesCfg.add("type3");
- artifactTypesCfg.add("type4");
- configurationManager.getConfiguration().setArtifactTypes(artifactTypesCfg);
- Either<List<ArtifactType>, ActionStatus> allArtifactTypes = elementOperation.getAllArtifactTypes();
- assertTrue(allArtifactTypes.isLeft());
- assertEquals(artifactTypesCfg.size(), allArtifactTypes.left().value().size());
-
- artifactTypesCfg.remove(0);
- allArtifactTypes = elementOperation.getAllArtifactTypes();
- assertTrue(allArtifactTypes.isLeft());
- assertEquals(artifactTypesCfg.size(), allArtifactTypes.left().value().size());
-
- artifactTypesCfg.add("type5");
+ final List<ArtifactConfiguration> expectedArtifactConfigurationList = new ArrayList<>();
+ final ArtifactConfiguration artifactConfiguration1 = new ArtifactConfiguration();
+ artifactConfiguration1.setType("type1");
+ expectedArtifactConfigurationList.add(artifactConfiguration1);
+ final ArtifactConfiguration artifactConfiguration2 = new ArtifactConfiguration();
+ artifactConfiguration2.setType("type2");
+ expectedArtifactConfigurationList.add(artifactConfiguration2);
+ final ArtifactConfiguration artifactConfiguration3 = new ArtifactConfiguration();
+ artifactConfiguration3.setType("type3");
+ expectedArtifactConfigurationList.add(artifactConfiguration3);
+ configurationManager.getConfiguration().setArtifacts(expectedArtifactConfigurationList);
+
+ List<ArtifactType> actualArtifactTypes = elementOperation.getAllArtifactTypes();
+ assertNotNull(actualArtifactTypes);
+ assertEquals(expectedArtifactConfigurationList.size(), actualArtifactTypes.size());
+ boolean allMatch = actualArtifactTypes.stream().allMatch(artifactType ->
+ expectedArtifactConfigurationList.stream()
+ .anyMatch(artifactConfiguration -> artifactConfiguration.getType().equals(artifactType.getName()))
+ );
+ assertTrue(allMatch);
+
+ expectedArtifactConfigurationList.remove(0);
+ actualArtifactTypes = elementOperation.getAllArtifactTypes();
+ assertNotNull(actualArtifactTypes);
+ assertEquals(expectedArtifactConfigurationList.size(), actualArtifactTypes.size());
+
+ allMatch = actualArtifactTypes.stream().allMatch(artifactType ->
+ expectedArtifactConfigurationList.stream()
+ .anyMatch(artifactConfiguration -> artifactConfiguration.getType().equals(artifactType.getName()))
+ );
+ assertTrue(allMatch);
}
- @Test
- public void testAllDeploymentArtifactTypes() {
-
- List<String> artifactTypesCfg = new ArrayList<String>();
- artifactTypesCfg.add("type1");
- artifactTypesCfg.add("type2");
- artifactTypesCfg.add("type3");
- configurationManager.getConfiguration().setArtifactTypes(artifactTypesCfg);
- Either<Map<String, Object>, ActionStatus> allDeploymentArtifactTypes = elementOperation
- .getAllDeploymentArtifactTypes();
- assertTrue(allDeploymentArtifactTypes.isLeft());
- assertEquals(artifactTypesCfg.size(), allDeploymentArtifactTypes.left().value().size());
-
- }
-
// @Test
public void testGetResourceAndServiceCategoty() {
String id = OperationTestsUtil.deleteAndCreateResourceCategory(CATEGORY, SUBCATEGORY, janusGraphDao);
@@ -431,29 +425,6 @@ public class ElementOperationTest extends ModelTestBase {
testSubject = createTestSubject();
result = testSubject.getAllPropertyScopes();
}
-
-
- @Test
- public void testGetAllArtifactTypes() throws Exception {
- ElementOperation testSubject;
- Either<List<ArtifactType>, ActionStatus> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getAllArtifactTypes();
- }
-
-
- @Test
- public void testGetAllDeploymentArtifactTypes() throws Exception {
- ElementOperation testSubject;
- Either<Map<String, Object>, ActionStatus> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getAllDeploymentArtifactTypes();
- }
-
@Test
public void testGetResourceTypesMap() throws Exception {
@@ -465,7 +436,6 @@ public class ElementOperationTest extends ModelTestBase {
result = testSubject.getResourceTypesMap();
}
-
@Test
public void testGetNewCategoryData() throws Exception {
ElementOperation testSubject;
diff --git a/catalog-model/src/test/resources/config/catalog-model/configuration.yaml b/catalog-model/src/test/resources/config/catalog-model/configuration.yaml
index 052add6a28..8f7f0f8cf8 100644
--- a/catalog-model/src/test/resources/config/catalog-model/configuration.yaml
+++ b/catalog-model/src/test/resources/config/catalog-model/configuration.yaml
@@ -86,31 +86,6 @@ cassandraConfig:
- { name: sdccomponent, replicationStrategy: SimpleStrategy, replicationInfo: ['1']}
- { name: sdcrepository, replicationStrategy: SimpleStrategy, replicationInfo: ['1']}
-
-artifactTypes:
- - CHEF
- - PUPPET
- - SHELL
- - YANG
- - YANG_XML
- - HEAT
- - BPEL
- - DG_XML
- - MURANO_PKG
- - WORKFLOW
- - NETWORK_CALL_FLOW
- - TOSCA_TEMPLATE
- - TOSCA_CSAR
- - AAI_SERVICE_MODEL
- - AAI_VF_MODEL
- - AAI_VF_MODULE_MODEL
- - AAI_VF_INSTANCE_MODEL
- - OTHER
- - SNMP_POLL
- - SNMP_TRAP
- - GUIDE
- - PNF_SW_INFORMATION
-
licenseTypes:
- User
- Installation
@@ -273,256 +248,6 @@ heatArtifactDeploymentTimeout:
minMinutes: 1
maxMinutes: 120
-serviceDeploymentArtifacts:
- YANG_XML:
- acceptedTypes:
- - xml
- VNF_CATALOG:
- acceptedTypes:
- - xml
- MODEL_INVENTORY_PROFILE:
- acceptedTypes:
- - xml
- MODEL_QUERY_SPEC:
- acceptedTypes:
- - xml
- UCPE_LAYER_2_CONFIGURATION:
- acceptedTypes:
- - xml
-
-#AAI Artifacts
- AAI_SERVICE_MODEL:
- acceptedTypes:
- - xml
- AAI_VF_MODULE_MODEL:
- acceptedTypes:
- - xml
- AAI_VF_INSTANCE_MODEL:
- acceptedTypes:
- - xml
- OTHER:
- acceptedTypes:
-
-resourceDeploymentArtifacts:
- HEAT:
- acceptedTypes:
- - yaml
- - yml
- validForResourceTypes: *allResourceTypes
- HEAT_VOL:
- acceptedTypes:
- - yaml
- - yml
- validForResourceTypes: *allResourceTypes
- HEAT_NET:
- acceptedTypes:
- - yaml
- - yml
- validForResourceTypes: *allResourceTypes
- HEAT_NESTED:
- acceptedTypes:
- - yaml
- - yml
- validForResourceTypes: *allResourceTypes
- HEAT_ARTIFACT:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- YANG_XML:
- acceptedTypes:
- - xml
- validForResourceTypes: *allResourceTypes
- VNF_CATALOG:
- acceptedTypes:
- - xml
- validForResourceTypes: *allResourceTypes
- VF_LICENSE:
- acceptedTypes:
- - xml
- validForResourceTypes: *allResourceTypes
- VENDOR_LICENSE:
- acceptedTypes:
- - xml
- validForResourceTypes: *allResourceTypes
- MODEL_INVENTORY_PROFILE:
- acceptedTypes:
- - xml
- validForResourceTypes: *allResourceTypes
- MODEL_QUERY_SPEC:
- acceptedTypes:
- - xml
- validForResourceTypes: *allResourceTypes
- LIFECYCLE_OPERATIONS:
- acceptedTypes:
- - yaml
- - yml
- validForResourceTypes:
- - VF
- - VFC
- VES_EVENTS:
- acceptedTypes:
- - yaml
- - yml
- validForResourceTypes: *allResourceTypes
- PERFORMANCE_COUNTER:
- acceptedTypes:
- - csv
- validForResourceTypes: *allResourceTypes
- APPC_CONFIG:
- acceptedTypes:
- validForResourceTypes:
- - VF
- DCAE_TOSCA:
- acceptedTypes:
- - yml
- - yaml
- validForResourceTypes:
- - VF
- - VFCMT
- DCAE_JSON:
- acceptedTypes:
- - json
- validForResourceTypes:
- - VF
- - VFCMT
- DCAE_POLICY:
- acceptedTypes:
- - emf
- validForResourceTypes:
- - VF
- - VFCMT
- DCAE_DOC:
- acceptedTypes:
- validForResourceTypes:
- - VF
- - VFCMT
- DCAE_EVENT:
- acceptedTypes:
- validForResourceTypes:
- - VF
- - VFCMT
- AAI_VF_MODEL:
- acceptedTypes:
- - xml
- validForResourceTypes:
- - VF
- AAI_VF_MODULE_MODEL:
- acceptedTypes:
- - xml
- validForResourceTypes:
- - VF
- OTHER:
- acceptedTypes:
- validForResourceTypes:
- - VFC
- - CVFC
- - CP
- - VL
- - VF
- - VFCMT
- - Abstract
- - PNF
- SNMP_POLL:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- SNMP_TRAP:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
-
-resourceInstanceDeploymentArtifacts:
- HEAT_ENV:
- acceptedTypes:
- - env
- VF_MODULES_METADATA:
- acceptedTypes:
- - json
- VES_EVENTS:
- acceptedTypes:
- - yaml
- - yml
- PERFORMANCE_COUNTER:
- acceptedTypes:
- - csv
- DCAE_INVENTORY_TOSCA:
- acceptedTypes:
- - yml
- - yaml
- DCAE_INVENTORY_JSON:
- acceptedTypes:
- - json
- DCAE_INVENTORY_POLICY:
- acceptedTypes:
- - emf
- DCAE_INVENTORY_DOC:
- acceptedTypes:
- DCAE_INVENTORY_BLUEPRINT:
- acceptedTypes:
- DCAE_INVENTORY_EVENT:
- acceptedTypes:
- SNMP_POLL:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- SNMP_TRAP:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
-
-resourceInformationalArtifacts:
- CHEF:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- PUPPET:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- SHELL:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- YANG:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- YANG_XML:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- HEAT:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- BPEL:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- DG_XML:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- MURANO_PKG:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- OTHER:
- acceptedTypes:
- validForResourceTypes:
- - VFC
- - CVFC
- - CP
- - VL
- - VF
- - VFCMT
- - Abstract
- - PNF
- PNF_SW_INFORMATION:
- acceptedTypes:
- - yml
- - yaml
- validForResourceTypes:
- - PNF
- SNMP_POLL:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- SNMP_TRAP:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- GUIDE:
- acceptedTypes:
- validForResourceTypes:
- - VF
- - VFC
- - CVFC
-
unLoggedUrls:
- /sdc2/rest/healthCheck
diff --git a/catalog-model/src/test/resources/config/configuration.yaml b/catalog-model/src/test/resources/config/configuration.yaml
index adf065ca41..8f7f0f8cf8 100644
--- a/catalog-model/src/test/resources/config/configuration.yaml
+++ b/catalog-model/src/test/resources/config/configuration.yaml
@@ -86,31 +86,6 @@ cassandraConfig:
- { name: sdccomponent, replicationStrategy: SimpleStrategy, replicationInfo: ['1']}
- { name: sdcrepository, replicationStrategy: SimpleStrategy, replicationInfo: ['1']}
-
-artifactTypes:
- - CHEF
- - PUPPET
- - SHELL
- - YANG
- - YANG_XML
- - HEAT
- - BPEL
- - DG_XML
- - MURANO_PKG
- - WORKFLOW
- - NETWORK_CALL_FLOW
- - TOSCA_TEMPLATE
- - TOSCA_CSAR
- - AAI_SERVICE_MODEL
- - AAI_VF_MODEL
- - AAI_VF_MODULE_MODEL
- - AAI_VF_INSTANCE_MODEL
- - OTHER
- - SNMP_POLL
- - SNMP_TRAP
- - GUIDE
- - PNF_SW_INFORMATION
-
licenseTypes:
- User
- Installation
@@ -273,248 +248,6 @@ heatArtifactDeploymentTimeout:
minMinutes: 1
maxMinutes: 120
-serviceDeploymentArtifacts:
- YANG_XML:
- acceptedTypes:
- - xml
- VNF_CATALOG:
- acceptedTypes:
- - xml
- MODEL_INVENTORY_PROFILE:
- acceptedTypes:
- - xml
- MODEL_QUERY_SPEC:
- acceptedTypes:
- - xml
- UCPE_LAYER_2_CONFIGURATION:
- acceptedTypes:
- - xml
-
-#AAI Artifacts
- AAI_SERVICE_MODEL:
- acceptedTypes:
- - xml
- AAI_VF_MODULE_MODEL:
- acceptedTypes:
- - xml
- AAI_VF_INSTANCE_MODEL:
- acceptedTypes:
- - xml
- OTHER:
- acceptedTypes:
-
-resourceDeploymentArtifacts:
- HEAT:
- acceptedTypes:
- - yaml
- - yml
- validForResourceTypes: *allResourceTypes
- HEAT_VOL:
- acceptedTypes:
- - yaml
- - yml
- validForResourceTypes: *allResourceTypes
- HEAT_NET:
- acceptedTypes:
- - yaml
- - yml
- validForResourceTypes: *allResourceTypes
- HEAT_NESTED:
- acceptedTypes:
- - yaml
- - yml
- validForResourceTypes: *allResourceTypes
- HEAT_ARTIFACT:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- YANG_XML:
- acceptedTypes:
- - xml
- validForResourceTypes: *allResourceTypes
- VNF_CATALOG:
- acceptedTypes:
- - xml
- validForResourceTypes: *allResourceTypes
- VF_LICENSE:
- acceptedTypes:
- - xml
- validForResourceTypes: *allResourceTypes
- VENDOR_LICENSE:
- acceptedTypes:
- - xml
- validForResourceTypes: *allResourceTypes
- MODEL_INVENTORY_PROFILE:
- acceptedTypes:
- - xml
- validForResourceTypes: *allResourceTypes
- MODEL_QUERY_SPEC:
- acceptedTypes:
- - xml
- validForResourceTypes: *allResourceTypes
- LIFECYCLE_OPERATIONS:
- acceptedTypes:
- - yaml
- - yml
- validForResourceTypes:
- - VF
- - VFC
- VES_EVENTS:
- acceptedTypes:
- - yaml
- - yml
- validForResourceTypes: *allResourceTypes
- PERFORMANCE_COUNTER:
- acceptedTypes:
- - csv
- validForResourceTypes: *allResourceTypes
- APPC_CONFIG:
- acceptedTypes:
- validForResourceTypes:
- - VF
- DCAE_TOSCA:
- acceptedTypes:
- - yml
- - yaml
- validForResourceTypes:
- - VF
- - VFCMT
- DCAE_JSON:
- acceptedTypes:
- - json
- validForResourceTypes:
- - VF
- - VFCMT
- DCAE_POLICY:
- acceptedTypes:
- - emf
- validForResourceTypes:
- - VF
- - VFCMT
- DCAE_DOC:
- acceptedTypes:
- validForResourceTypes:
- - VF
- - VFCMT
- DCAE_EVENT:
- acceptedTypes:
- validForResourceTypes:
- - VF
- - VFCMT
- AAI_VF_MODEL:
- acceptedTypes:
- - xml
- validForResourceTypes:
- - VF
- AAI_VF_MODULE_MODEL:
- acceptedTypes:
- - xml
- validForResourceTypes:
- - VF
- OTHER:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- SNMP_POLL:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- SNMP_TRAP:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
-
-resourceInstanceDeploymentArtifacts:
- HEAT_ENV:
- acceptedTypes:
- - env
- VF_MODULES_METADATA:
- acceptedTypes:
- - json
- VES_EVENTS:
- acceptedTypes:
- - yaml
- - yml
- PERFORMANCE_COUNTER:
- acceptedTypes:
- - csv
- DCAE_INVENTORY_TOSCA:
- acceptedTypes:
- - yml
- - yaml
- DCAE_INVENTORY_JSON:
- acceptedTypes:
- - json
- DCAE_INVENTORY_POLICY:
- acceptedTypes:
- - emf
- DCAE_INVENTORY_DOC:
- acceptedTypes:
- DCAE_INVENTORY_BLUEPRINT:
- acceptedTypes:
- DCAE_INVENTORY_EVENT:
- acceptedTypes:
- SNMP_POLL:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- SNMP_TRAP:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
-
-resourceInformationalArtifacts:
- CHEF:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- PUPPET:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- SHELL:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- YANG:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- YANG_XML:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- HEAT:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- BPEL:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- DG_XML:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- MURANO_PKG:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- OTHER:
- acceptedTypes:
- validForResourceTypes:
- - VFC
- - CVFC
- - CP
- - VL
- - VF
- - VFCMT
- - Abstract
- - PNF
- PNF_SW_INFORMATION:
- acceptedTypes:
- - yml
- - yaml
- validForResourceTypes:
- - PNF
- SNMP_POLL:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- SNMP_TRAP:
- acceptedTypes:
- validForResourceTypes: *allResourceTypes
- GUIDE:
- acceptedTypes:
- validForResourceTypes:
- - VF
- - VFC
- - CVFC
-
unLoggedUrls:
- /sdc2/rest/healthCheck