aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraribeiro <anderson.ribeiro@est.tech>2021-08-30 15:18:40 +0100
committerMichael Morris <michael.morris@est.tech>2021-10-05 16:03:26 +0000
commit6ecc7c3e150f86528d36cdbaa94912b965619a70 (patch)
tree089180b4df1919c555f07ffd4107fec823f48ca1
parent32312ca12dc40f724d248104c16df5e46a4bc5cc (diff)
Filter categories by model name
Issue-ID: SDC-3706 Signed-off-by: aribeiro <anderson.ribeiro@est.tech> Change-Id: I457151f09ce0ed2edfa09340e9e08a126e114002
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CategoriesImportManager.java29
-rw-r--r--catalog-be/src/main/resources/import/tosca/categories/categoryTypes.yml41
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CategoriesImportManagerTest.java24
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathTest.java25
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/category/CategoryData.java5
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java4
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java3
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ToscaElementLifecycleOperationTest.java37
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/util/OperationTestsUtil.java2
-rw-r--r--catalog-ui/src/app/models/category.ts1
-rw-r--r--catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts197
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java3
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinition.java2
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/datatypes/DataTestIdEnum.java1
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceGeneralPage.java4
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ServiceCreatePage.java10
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ServiceGeneralPage.java4
17 files changed, 239 insertions, 153 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CategoriesImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CategoriesImportManager.java
index 12eb8379b2..35502aa573 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CategoriesImportManager.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CategoriesImportManager.java
@@ -55,7 +55,7 @@ public class CategoriesImportManager {
@javax.annotation.Resource
private ComponentsUtils componentsUtils;
- public Either<Map<String, List<CategoryDefinition>>, ResponseFormat> createCategories(String categoriesTypesYml) {
+ public Either<Map<String, List<CategoryDefinition>>, ResponseFormat> createCategories(final String categoriesTypesYml) {
Map<String, List<CategoryDefinition>> allCategories = createCategoriesFromYml(categoriesTypesYml);
return createCategoriesByDao(allCategories);
}
@@ -72,7 +72,7 @@ public class CategoriesImportManager {
nodeTypeCategory, nodeTypeSubCategory, nodeTypeGroup);
List<CategoryDefinition> newCategoriesvalue = new ArrayList<>();
for (CategoryDefinition category : entry.getValue()) {
- Either<CategoryDefinition, ResponseFormat> createdCategoryRes = createCategorieDeo(entry, category, nodeTypeCategory);
+ Either<CategoryDefinition, ResponseFormat> createdCategoryRes = createCategoriesDao(entry, category, nodeTypeCategory);
if (createdCategoryRes.isRight()) {
return Either.right(createdCategoryRes.right().value());
}
@@ -99,7 +99,7 @@ public class CategoriesImportManager {
NodeTypeEnum nodeTypeGroup, CategoryDefinition category, CategoryDefinition newcategory,
List<SubCategoryDefinition> newsubcategories, List<SubCategoryDefinition> subcategories) {
for (SubCategoryDefinition subcategory : subcategories) {
- Either<SubCategoryDefinition, ResponseFormat> createdSubCategory = createSubCategorieDeo(entry, newcategory, subcategory,
+ Either<SubCategoryDefinition, ResponseFormat> createdSubCategory = createSubCategoriesDao(entry, newcategory, subcategory,
nodeTypeSubCategory);
if (createdSubCategory.isRight()) {
return false;
@@ -109,7 +109,7 @@ public class CategoriesImportManager {
if (groupings != null) {
List<GroupingDefinition> newgroupings = new ArrayList<>();
for (GroupingDefinition grouping : groupings) {
- Either<GroupingDefinition, ResponseFormat> createdGrouping = createGroupingDeo(entry, grouping, subcategory, category,
+ Either<GroupingDefinition, ResponseFormat> createdGrouping = createGroupingDao(entry, grouping, subcategory, category,
nodeTypeGroup);
if (createdGrouping.isRight()) {
return false;
@@ -123,7 +123,7 @@ public class CategoriesImportManager {
return true;
}
- private Either<GroupingDefinition, ResponseFormat> createGroupingDeo(Map.Entry<String, List<CategoryDefinition>> entry,
+ private Either<GroupingDefinition, ResponseFormat> createGroupingDao(Map.Entry<String, List<CategoryDefinition>> entry,
GroupingDefinition grouping, SubCategoryDefinition subcategory,
CategoryDefinition category, NodeTypeEnum nodeTypeGroup) {
log.debug("createGroupingDeo: creating grouping {}", grouping);
@@ -148,9 +148,9 @@ public class CategoriesImportManager {
return Either.left(createdGrouping.left().value());
}
- private Either<SubCategoryDefinition, ResponseFormat> createSubCategorieDeo(Map.Entry<String, List<CategoryDefinition>> entry,
- CategoryDefinition newcategory, SubCategoryDefinition subcategory,
- NodeTypeEnum nodeTypeSubCategory) {
+ private Either<SubCategoryDefinition, ResponseFormat> createSubCategoriesDao(Map.Entry<String, List<CategoryDefinition>> entry,
+ CategoryDefinition newcategory, SubCategoryDefinition subcategory,
+ NodeTypeEnum nodeTypeSubCategory) {
log.debug("createSubCategorieDeo: creating subcategory {}", subcategory);
Either<SubCategoryDefinition, ActionStatus> createdSubCategory = elementOperation
.createSubCategory(newcategory.getUniqueId(), subcategory, nodeTypeSubCategory);
@@ -170,8 +170,8 @@ public class CategoriesImportManager {
return Either.left(createdSubCategory.left().value());
}
- private Either<CategoryDefinition, ResponseFormat> createCategorieDeo(Map.Entry<String, List<CategoryDefinition>> entry,
- CategoryDefinition category, NodeTypeEnum nodeTypeCategory) {
+ private Either<CategoryDefinition, ResponseFormat> createCategoriesDao(Map.Entry<String, List<CategoryDefinition>> entry,
+ CategoryDefinition category, NodeTypeEnum nodeTypeCategory) {
log.debug("createCategorieDeo: creating category {}", category);
Either<CategoryDefinition, ActionStatus> createdCategory = elementOperation.createCategory(category, nodeTypeCategory);
if (createdCategory.isRight() && ActionStatus.COMPONENT_CATEGORY_ALREADY_EXISTS == createdCategory.right().value()) {
@@ -187,8 +187,8 @@ public class CategoriesImportManager {
return Either.left(createdCategory.left().value());
}
- private Map<String, List<CategoryDefinition>> createCategoriesFromYml(String categoriesTypesYml) {
- Map<String, Object> toscaJson = (Map<String, Object>) new Yaml().load(categoriesTypesYml);
+ private Map<String, List<CategoryDefinition>> createCategoriesFromYml(final String categoriesTypesYml) {
+ Map<String, Object> toscaJson = new Yaml().load(categoriesTypesYml);
Map<String, List<CategoryDefinition>> allCategories = new HashMap<>();
Iterator<Entry<String, Object>> categoryEntryItr = toscaJson.entrySet().iterator();
while (categoryEntryItr.hasNext()) {
@@ -219,7 +219,7 @@ public class CategoriesImportManager {
return allCategories;
}
- private List<CategoryDefinition> createServiceCategories(Map<String, Object> categories) {
+ private List<CategoryDefinition> createServiceCategories(final Map<String, Object> categories) {
List<CategoryDefinition> categoriesDef = new ArrayList<>();
String catName = null;
List<String> icons = null;
@@ -232,6 +232,7 @@ public class CategoriesImportManager {
catDef.setIcons(icons);
String normalizedName = ValidationUtils.normalizeCategoryName4Uniqueness(catName);
catDef.setNormalizedName(normalizedName);
+ catDef.setModels((List<String>) category.get("models"));
final Object useServiceSubstitutionForNestedServicesProperty = category.get("useServiceSubstitutionForNestedServices");
final boolean useServiceSubstitutionForNestedServices =
useServiceSubstitutionForNestedServicesProperty == null ? false : (Boolean) useServiceSubstitutionForNestedServicesProperty;
@@ -262,7 +263,7 @@ public class CategoriesImportManager {
return metadataKeyDefs;
}
- private List<CategoryDefinition> createResourceCategories(Map<String, Object> categoryPerType) {
+ private List<CategoryDefinition> createResourceCategories(final Map<String, Object> categoryPerType) {
List<CategoryDefinition> categroiesDef = new ArrayList<>();
for (Map.Entry<String, Object> entry : categoryPerType.entrySet()) {
Map<String, Object> category = (Map<String, Object>) entry.getValue();
diff --git a/catalog-be/src/main/resources/import/tosca/categories/categoryTypes.yml b/catalog-be/src/main/resources/import/tosca/categories/categoryTypes.yml
index 29b8585b3d..a013264bd8 100644
--- a/catalog-be/src/main/resources/import/tosca/categories/categoryTypes.yml
+++ b/catalog-be/src/main/resources/import/tosca/categories/categoryTypes.yml
@@ -2,24 +2,45 @@ services:
Mobility:
name: "Mobility"
icons: ['mobility']
+ models: [
+ "SDC AID"
+ ]
Network_L1_3:
name: "Network L1-3"
icons: ['network_l_1-3']
+ models: [
+ "SDC AID"
+ ]
Network_L4:
name: "Network L4+"
icons: ['network_l_4']
+ models: [
+ "SDC AID"
+ ]
VoIP_Call_Control:
name: "VoIP Call Control"
icons: ['call_controll']
+ models: [
+ "SDC AID"
+ ]
E2E_Service:
name: "E2E Service"
icons: ['network_l_1-3']
+ models: [
+ "SDC AID"
+ ]
Network_Service:
name: "Network Service"
icons: ['network_l_1-3']
+ models: [
+ "SDC AID"
+ ]
Partner_Domain_Service:
name: "Partner Domain Service"
icons: ['partner_domain_service']
+ models: [
+ "SDC AID"
+ ]
ETSI_NFV_Network_Service:
name: "ETSI NFV Network Service"
icons: ['etsi_nfv_network_service']
@@ -29,10 +50,14 @@ services:
validValues: [ '3.3.1', '2.7.1', '2.5.1' ]
default: '2.5.1'
mandatory: true
+ models: [
+ "ETSI SOL001 v2.5.1",
+ "SDC AID"
+ ]
resources:
NetworkLayer23:
name: "Network L2-3"
- subcategories:
+ subcategories:
Router:
name: "Router"
icons: ['router','vRouter']
@@ -50,13 +75,13 @@ resources:
icons: ['ucpe']
NetworkLayer4:
name: "Network L4+"
- subcategories:
+ subcategories:
Common_Network_Resources:
name: "Common Network Resources"
icons: ['network']
ApplicationLayer4:
name: "Application L4+"
- subcategories:
+ subcategories:
Border_Element:
name: "Border Element"
icons: ['borderElement']
@@ -83,7 +108,7 @@ resources:
icons: ['firewall']
Generic:
name: "Generic"
- subcategories:
+ subcategories:
Infrastructure:
name: "Infrastructure"
icons: ['connector']
@@ -161,16 +186,16 @@ resources:
icons: ['allotted_resource']
TunnelXConnect:
name: "TunnelXConn"
- icons: ['tunnel_x_connect']
+ icons: ['tunnel_x_connect']
BRG:
name: "BRG"
- icons: ['brg']
+ icons: ['brg']
IpMuxDemux:
name: "IP Mux Demux"
- icons: ['ip_mux_demux']
+ icons: ['ip_mux_demux']
ServiceAdmin:
name: "Service Admin"
- icons: ['service_admin']
+ icons: ['service_admin']
ContrailRoute:
name: "Contrail Route"
icons: ['contrail_route']
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CategoriesImportManagerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CategoriesImportManagerTest.java
index 1d96272716..a42f2ef650 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CategoriesImportManagerTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CategoriesImportManagerTest.java
@@ -20,7 +20,18 @@
package org.openecomp.sdc.be.components.impl;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.when;
+
import fj.data.Either;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -37,19 +48,6 @@ import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
import org.openecomp.sdc.be.model.operations.api.IElementOperation;
import org.openecomp.sdc.exception.ResponseFormat;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.stream.Stream;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.when;
-
public class CategoriesImportManagerTest {
@InjectMocks
static CategoriesImportManager importManager = new CategoriesImportManager();
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathTest.java
index 62db6e283b..0fa7ca8cb6 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathTest.java
@@ -20,8 +20,19 @@
package org.openecomp.sdc.be.components.path;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
import com.google.common.collect.Lists;
import fj.data.Either;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
import org.junit.Before;
import org.openecomp.sdc.be.components.BeConfDependentTest;
import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
@@ -31,9 +42,9 @@ import org.openecomp.sdc.be.components.path.utils.GraphTestUtils;
import org.openecomp.sdc.be.components.validation.service.ServiceValidator;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ForwardingPathElementDataDefinition;
@@ -57,18 +68,6 @@ import org.openecomp.sdc.common.util.ValidationUtils;
import org.openecomp.sdc.exception.ResponseFormat;
import org.springframework.beans.factory.annotation.Autowired;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
public abstract class BaseForwardingPathTest extends BeConfDependentTest implements ForwardingPathTestUtils {
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/category/CategoryData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/category/CategoryData.java
index 8c4f2076ca..665e5c737d 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/category/CategoryData.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/category/CategoryData.java
@@ -58,6 +58,7 @@ public class CategoryData extends GraphNode {
}.getType();
List<String> iconsfromJson = getGson().fromJson((String) properties.get(GraphPropertiesDictionary.ICONS.getProperty()), listType);
categoryDataDefinition.setIcons(iconsfromJson);
+ categoryDataDefinition.setModels(getGson().fromJson((String) properties.get(GraphPropertiesDictionary.MODEL.getProperty()), listType));
final Type metadataKeylistType = new TypeToken<List<MetadataKeyDataDefinition>>() {
}.getType();
final List<MetadataKeyDataDefinition> metadataKeysfromJson = getGson()
@@ -80,9 +81,7 @@ public class CategoryData extends GraphNode {
addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, categoryDataDefinition.getUniqueId());
addIfExists(map, GraphPropertiesDictionary.NAME, categoryDataDefinition.getName());
addIfExists(map, GraphPropertiesDictionary.NORMALIZED_NAME, categoryDataDefinition.getNormalizedName());
- // String icons=getGson().toJson(categoryDataDefinition.getIcons());
-
- // addIfExists(map, GraphPropertiesDictionary.ICONS, icons);
+ addIfExists(map, GraphPropertiesDictionary.MODEL, categoryDataDefinition.getModels());
addIfExists(map, GraphPropertiesDictionary.ICONS, categoryDataDefinition.getIcons());
addIfExists(map, GraphPropertiesDictionary.USE_SERVICE_SUBSTITUTION_FOR_NESTED_SERVICES,
categoryDataDefinition.isUseServiceSubstitutionForNestedServices());
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java
index 61b11b3168..b45dae9c68 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java
@@ -609,7 +609,8 @@ public class TopologyTemplateOperation extends ToscaElementOperation {
private StorageOperationStatus associateServiceMetadataToCategory(GraphVertex nodeTypeVertex, TopologyTemplate topologyTemplate) {
String categoryName = topologyTemplate.getCategories().get(0).getName();
- Either<GraphVertex, StorageOperationStatus> category = categoryOperation.getCategory(categoryName, VertexTypeEnum.SERVICE_CATEGORY);
+ Either<GraphVertex, StorageOperationStatus> category = categoryOperation.getCategory(categoryName,
+ VertexTypeEnum.SERVICE_CATEGORY);
if (category.isRight()) {
log.trace("NO category {} for service {}", categoryName, topologyTemplate.getUniqueId());
return StorageOperationStatus.CATEGORY_NOT_FOUND;
@@ -1176,6 +1177,7 @@ public class TopologyTemplateOperation extends ToscaElementOperation {
}.getType();
List<String> iconsfromJsonCat = getGson().fromJson((String) metadataProperties.get(GraphPropertyEnum.ICONS.getProperty()), listTypeCat);
category.setIcons(iconsfromJsonCat);
+ category.setModels((getGson().fromJson((String) metadataProperties.get(GraphPropertyEnum.MODEL.getProperty()), listTypeCat)));
final Type metadataKeysTypeCat = new TypeToken<List<MetadataKeyDataDefinition>>() {
}.getType();
final List<MetadataKeyDataDefinition> metadataKeysfromJsonCat = getGson()
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java
index 1037935ab5..2ff3b49a00 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java
@@ -1060,6 +1060,9 @@ public abstract class ToscaElementOperation extends BaseOperation {
CategoryDefinition category = new CategoryDefinition();
category.setUniqueId((String) categoryV.property(GraphPropertyEnum.UNIQUE_ID.getProperty()).value());
category.setNormalizedName(categoryNormalizedName);
+ category.setModels(categoryV.property(GraphPropertyEnum.MODEL.getProperty()).isPresent() ? getGson()
+ .fromJson((String) categoryV.property(GraphPropertyEnum.MODEL.getProperty()).value(), new TypeToken<List<String>>() {
+ }.getType()) : Collections.emptyList());
category.setName((String) categoryV.property(GraphPropertyEnum.NAME.getProperty()).value());
category.setUseServiceSubstitutionForNestedServices(
(Boolean) categoryV.property(GraphPropertyEnum.USE_SUBSTITUTION_FOR_NESTED_SERVICES.getProperty()).orElse(false));
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ToscaElementLifecycleOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ToscaElementLifecycleOperationTest.java
index b4f61563c1..4817f7a1c4 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ToscaElementLifecycleOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ToscaElementLifecycleOperationTest.java
@@ -20,16 +20,33 @@
package org.openecomp.sdc.be.model.operations.impl;
-import org.janusgraph.core.JanusGraph;
-import org.janusgraph.core.JanusGraphVertex;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
import fj.data.Either;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.io.IoCore;
-import org.junit.*;
+import org.janusgraph.core.JanusGraph;
+import org.janusgraph.core.JanusGraphVertex;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
@@ -60,16 +77,6 @@ import org.openecomp.sdc.common.util.ValidationUtils;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.OutputStream;
-import java.util.*;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:application-context-test.xml")
public class ToscaElementLifecycleOperationTest extends ModelTestBase {
@@ -304,6 +311,7 @@ public class ToscaElementLifecycleOperationTest extends ModelTestBase {
metadataProperties.put(GraphPropertyEnum.NAME, categoryName);
metadataProperties.put(GraphPropertyEnum.NORMALIZED_NAME, ValidationUtils.normalizeCategoryName4Uniqueness(categoryName));
metadataProperties.put(GraphPropertyEnum.METADATA_KEYS, "[]");
+ metadataProperties.put(GraphPropertyEnum.MODEL, "[]");
cat.setMetadataProperties(metadataProperties);
cat.updateMetadataJsonWithCurrentMetadataProperties();
@@ -340,6 +348,7 @@ public class ToscaElementLifecycleOperationTest extends ModelTestBase {
metadataProperties.put(GraphPropertyEnum.NAME, categoryName);
metadataProperties.put(GraphPropertyEnum.NORMALIZED_NAME, ValidationUtils.normalizeCategoryName4Uniqueness(categoryName));
metadataProperties.put(GraphPropertyEnum.METADATA_KEYS, "[]");
+ metadataProperties.put(GraphPropertyEnum.MODEL, "[]");
cat.setMetadataProperties(metadataProperties);
cat.updateMetadataJsonWithCurrentMetadataProperties();
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/util/OperationTestsUtil.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/util/OperationTestsUtil.java
index 71dc5d9517..597ac1065f 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/util/OperationTestsUtil.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/util/OperationTestsUtil.java
@@ -42,7 +42,7 @@ public class OperationTestsUtil {
categoryData.getCategoryDataDefinition()
.setNormalizedName(ValidationUtils.normalizeCategoryName4Uniqueness(category));
categoryData.getCategoryDataDefinition().setUniqueId(UniqueIdBuilder.buildCategoryUid(
- ValidationUtils.normalizeCategoryName4Uniqueness(category), NodeTypeEnum.ServiceNewCategory));
+ ValidationUtils.normalizeCategoryName4Uniqueness(category), NodeTypeEnum.ServiceNewCategory));
janusGraphDao.deleteNode(categoryData, CategoryData.class);
Either<CategoryData, JanusGraphOperationStatus> createNode = janusGraphDao.createNode(categoryData, CategoryData.class);
return (String) createNode.left().value().getUniqueId();
diff --git a/catalog-ui/src/app/models/category.ts b/catalog-ui/src/app/models/category.ts
index 2c1bc217e5..7819aae2f1 100644
--- a/catalog-ui/src/app/models/category.ts
+++ b/catalog-ui/src/app/models/category.ts
@@ -27,6 +27,7 @@ export interface ICategoryBase {
name:string;
normalizedName:string;
uniqueId:string;
+ models:Array<string>;
icons:Array<string>;
metadataKeys: IMetadataKey[];
diff --git a/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts b/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts
index 6c28fae508..e766e36899 100644
--- a/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts
+++ b/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts
@@ -36,7 +36,7 @@ import {EventListenerService, ProgressService} from "app/services";
import {CacheService, ElementService, ModelService, ImportVSPService, OnboardingService} from "app/services-ng2";
import {Component, IAppConfigurtaion, ICsarComponent, IMainCategory, IMetadataKey, ISubCategory, IValidate, Resource, Service} from "app/models";
import {IWorkspaceViewModelScope} from "app/view-models/workspace/workspace-view-model";
-import {CATEGORY_SERVICE_METADATA_KEYS, PREVIOUS_CSAR_COMPONENT} from "../../../../utils/constants";
+import {CATEGORY_SERVICE_METADATA_KEYS, PREVIOUS_CSAR_COMPONENT, DEFAULT_MODEL_NAME} from "../../../../utils/constants";
import {Observable} from "rxjs";
import {Model} from "../../../../models/model";
@@ -93,9 +93,10 @@ export interface IGeneralScope extends IWorkspaceViewModelScope {
convertCategoryStringToOneArray(category:string, subcategory:string):Array<IMainCategory>;
onCategoryChange():void;
onEcompGeneratedNamingChange():void;
+ onModelChange():void;
onBaseTypeChange():void;
openOnBoardingModal():void;
- initCategoreis():void;
+ initCategories():void;
initEnvironmentContext():void;
initInstantiationTypes():void;
initBaseTypes():void;
@@ -252,7 +253,7 @@ export class GeneralViewModel {
this.$scope.component.tags = _.without(this.$scope.component.tags, this.$scope.component.name);
// Init categories
- this.$scope.initCategoreis();
+ this.$scope.initCategories();
// Init Environment Context
this.$scope.initEnvironmentContext();
@@ -298,7 +299,7 @@ export class GeneralViewModel {
if (this.$scope.component.isResource() &&
(this.$scope.component as Resource).resourceType === ResourceType.VF ||
- (this.$scope.component as Resource).resourceType === ResourceType.PNF && (this.$scope.component as Resource).csarUUID) {
+ (this.$scope.component as Resource).resourceType === ResourceType.PNF && (this.$scope.component as Resource).csarUUID) {
this.$scope.isShowOnboardingSelectionBrowse = true;
this.setImportedFileText();
} else {
@@ -413,11 +414,11 @@ export class GeneralViewModel {
});
return tempCategories;
- };
-
+ };
+
private initScopeMethods = ():void => {
- this.$scope.initCategoreis = ():void => {
+ this.$scope.initCategories = ():void => {
if (this.$scope.componentType === ComponentType.RESOURCE) {
this.$scope.categories = this.cacheService.get('resourceCategories');
@@ -431,7 +432,7 @@ export class GeneralViewModel {
//Flag to disbale category if service is created through External API
this.$scope.isHiddenCategorySelected = this.isHiddenCategory(this.$scope.component.selectedCategory);
}
-
+
}
};
@@ -453,24 +454,27 @@ export class GeneralViewModel {
this.$scope.initBaseTypes = ():void => {
if (this.$scope.componentType === ComponentType.SERVICE && this.$scope.component && this.$scope.component.categories) {
- let modelName = this.$scope.component.model ? this.$scope.component.model : null;
- this.elementService.getCategoryBasetypes(this.$scope.component.categories[0].name, modelName).subscribe((data: BaseTypeResponse[]) => {
- this.$scope.baseTypes = []
- this.$scope.baseTypeVersions = []
- data.forEach(baseType => {
- this.$scope.baseTypes.push(baseType.toscaResourceName)
- if (baseType.toscaResourceName === this.$scope.component.derivedFromGenericType){
- baseType.versions.reverse().forEach(version => this.$scope.baseTypeVersions.push(version));
- }});
- })
+ let modelName = this.$scope.component.model ? this.$scope.component.model : null;
+ this.elementService.getCategoryBasetypes(this.$scope.component.categories[0].name, modelName).subscribe((data: BaseTypeResponse[]) => {
+ this.$scope.baseTypes = []
+ this.$scope.baseTypeVersions = []
+ data.forEach(baseType => {
+ this.$scope.baseTypes.push(baseType.toscaResourceName)
+ if (baseType.toscaResourceName === this.$scope.component.derivedFromGenericType){
+ baseType.versions.reverse().forEach(version => this.$scope.baseTypeVersions.push(version));
+ }});
+ })
}
};
this.$scope.initModel = ():void => {
this.$scope.isModelRequired = false;
this.$scope.models = [];
- this.$scope.defaultModelOption = 'SDC AID';
+ this.$scope.defaultModelOption = DEFAULT_MODEL_NAME;
this.$scope.showDefaultModelOption = true;
+ if (this.$scope.componentType === ComponentType.SERVICE) {
+ this.filterCategoriesByModel(this.$scope.component.model);
+ }
if (this.$scope.isCreateMode() && this.$scope.isVspImport()) {
if (this.$scope.component.componentMetadata.models) {
this.$scope.isModelRequired = true;
@@ -542,16 +546,16 @@ export class GeneralViewModel {
this.importVSPService.openOnboardingModal(csarUUID, csarVersion).subscribe((result) => {
this.ComponentFactory.getComponentWithMetadataFromServer(result.type.toUpperCase(), result.previousComponent.uniqueId).then(
(component:Component)=> {
- if (result.componentCsar && component.isResource()){
- this.cacheService.set(PREVIOUS_CSAR_COMPONENT, angular.copy(component));
- component = this.ComponentFactory.updateComponentFromCsar(result.componentCsar, <Resource>component);
- }
- this.$scope.setComponent(component);
- this.$scope.save();
- this.setImportedFileText();
- }, ()=> {
- // ERROR
- });
+ if (result.componentCsar && component.isResource()){
+ this.cacheService.set(PREVIOUS_CSAR_COMPONENT, angular.copy(component));
+ component = this.ComponentFactory.updateComponentFromCsar(result.componentCsar, <Resource>component);
+ }
+ this.$scope.setComponent(component);
+ this.$scope.save();
+ this.setImportedFileText();
+ }, ()=> {
+ // ERROR
+ });
})
};
@@ -590,7 +594,7 @@ export class GeneralViewModel {
return;
}
-
+
let subtype:string = ComponentType.RESOURCE == this.$scope.componentType ? this.$scope.component.getComponentSubType() : undefined;
if (subtype == "SRVC") {
subtype = "VF"
@@ -712,42 +716,41 @@ export class GeneralViewModel {
this.$scope.onCategoryChange = (): void => {
this.$scope.component.selectedCategory = this.$scope.componentCategories.selectedCategory;
- this.$scope.component.categories = this.convertCategoryStringToOneArray();
- this.$scope.component.icon = DEFAULT_ICON;
- if (this.$scope.component.categories[0].metadataKeys) {
- for (let metadataKey of this.$scope.component.categories[0].metadataKeys) {
- if (!this.$scope.component.categorySpecificMetadata[metadataKey.name]) {
- this.$scope.component.categorySpecificMetadata[metadataKey.name] = metadataKey.defaultValue ? metadataKey.defaultValue : "";
- }
+ if (this.$scope.component.selectedCategory) {
+ this.$scope.component.categories = this.convertCategoryStringToOneArray();
+ this.$scope.component.icon = DEFAULT_ICON;
+ if (this.$scope.component.categories[0].metadataKeys) {
+ for (let metadataKey of this.$scope.component.categories[0].metadataKeys) {
+ if (!this.$scope.component.categorySpecificMetadata[metadataKey.name]) {
+ this.$scope.component.categorySpecificMetadata[metadataKey.name] = metadataKey.defaultValue ? metadataKey.defaultValue : "";
+ }
+ }
}
- }
- if (this.$scope.component.categories[0].subcategories && this.$scope.component.categories[0].subcategories[0].metadataKeys) {
- for (let metadataKey of this.$scope.component.categories[0].subcategories[0].metadataKeys) {
- if (!this.$scope.component.categorySpecificMetadata[metadataKey.name]) {
- this.$scope.component.categorySpecificMetadata[metadataKey.name] = metadataKey.defaultValue ? metadataKey.defaultValue : "";
- }
+ if (this.$scope.component.categories[0].subcategories && this.$scope.component.categories[0].subcategories[0].metadataKeys) {
+ for (let metadataKey of this.$scope.component.categories[0].subcategories[0].metadataKeys) {
+ if (!this.$scope.component.categorySpecificMetadata[metadataKey.name]) {
+ this.$scope.component.categorySpecificMetadata[metadataKey.name] = metadataKey.defaultValue ? metadataKey.defaultValue : "";
+ }
+ }
+ }
+ if (this.$scope.componentType === ComponentType.SERVICE && this.$scope.component.categories[0]) {
+ let modelName : string = this.$scope.component.model ? this.$scope.component.model : null;
+ this.elementService.getCategoryBasetypes(this.$scope.component.categories[0].name, modelName).subscribe((data: BaseTypeResponse[]) => {
+
+ if(this.$scope.isCreateMode()){
+ this.loadBaseTypes(data);
+ } else {
+ var isValidForBaseType:boolean = false;
+ data.forEach(baseType => {if (!this.$scope.component.derivedFromGenericType || baseType.toscaResourceName === this.$scope.component.derivedFromGenericType){
+ isValidForBaseType = true;
+ };});
+ this.$scope.editForm['category'].$setValidity('validForBaseType', isValidForBaseType);
+ }
+ });
}
+ } else {
+ this.$scope.baseTypes = [];
}
- if (this.$scope.componentType === ComponentType.SERVICE && this.$scope.component.categories[0]) {
- let modelName : string = this.$scope.component.model ? this.$scope.component.model : null;
- this.elementService.getCategoryBasetypes(this.$scope.component.categories[0].name, modelName).subscribe((data: BaseTypeResponse[]) => {
-
- if(this.$scope.isCreateMode()){
- this.$scope.baseTypes = []
- this.$scope.baseTypeVersions = []
- data.forEach(baseType => this.$scope.baseTypes.push(baseType.toscaResourceName));
- data[0].versions.reverse().forEach(version => this.$scope.baseTypeVersions.push(version));
- this.$scope.component.derivedFromGenericType = data[0].toscaResourceName;
- this.$scope.component.derivedFromGenericVersion = data[0].versions[0];
- } else {
- var isValidForBaseType:boolean = false;
- data.forEach(baseType => {if (!this.$scope.component.derivedFromGenericType || baseType.toscaResourceName === this.$scope.component.derivedFromGenericType){
- isValidForBaseType = true;
- };});
- this.$scope.editForm['category'].$setValidity('validForBaseType', isValidForBaseType);
- }
- });
- }
};
this.$scope.onEcompGeneratedNamingChange = (): void => {
@@ -757,29 +760,23 @@ export class GeneralViewModel {
};
this.$scope.onBaseTypeChange = (): void => {
- let modelName : string = this.$scope.component.model ? this.$scope.component.model : null;
+ let modelName : string = this.$scope.component.model ? this.$scope.component.model : null;
this.elementService.getCategoryBasetypes(this.$scope.component.categories[0].name, modelName).subscribe((data: BaseTypeResponse[]) => {
- this.$scope.baseTypeVersions = []
- data.forEach(baseType => {
- if(baseType.toscaResourceName === this.$scope.component.derivedFromGenericType) {
- baseType.versions.reverse().forEach(version => this.$scope.baseTypeVersions.push(version));
- this.$scope.component.derivedFromGenericVersion = baseType.versions[0];
- };
- });
- })
+ this.$scope.baseTypeVersions = []
+ data.forEach(baseType => {
+ if(baseType.toscaResourceName === this.$scope.component.derivedFromGenericType) {
+ baseType.versions.reverse().forEach(version => this.$scope.baseTypeVersions.push(version));
+ this.$scope.component.derivedFromGenericVersion = baseType.versions[0];
+ };
+ });
+ })
};
this.$scope.onModelChange = (): void => {
- if (this.$scope.componentType === ComponentType.SERVICE && this.$scope.component && this.$scope.component.categories) {
+ if (this.$scope.componentType === ComponentType.SERVICE && this.$scope.component && this.$scope.categories) {
let modelName = this.$scope.component.model ? this.$scope.component.model : null;
- this.elementService.getCategoryBasetypes(this.$scope.component.categories[0].name, modelName).subscribe((data: BaseTypeResponse[]) => {
- this.$scope.baseTypes = []
- this.$scope.baseTypeVersions = []
- data.forEach(baseType => this.$scope.baseTypes.push(baseType.toscaResourceName));
- data[0].versions.reverse().forEach(version => this.$scope.baseTypeVersions.push(version));
- this.$scope.component.derivedFromGenericType = data[0].toscaResourceName;
- this.$scope.component.derivedFromGenericVersion = data[0].versions[0];
- });
+ this.filterCategoriesByModel(modelName);
+ this.filterBaseTypesByModelAndCategory(modelName)
}
};
@@ -801,7 +798,7 @@ export class GeneralViewModel {
if (metadataKey) {
return metadataKey.validValues;
}
- return [];
+ return [];
}
this.$scope.isMetadataKeyForComponentCategory = (key: string): boolean => {
@@ -818,7 +815,36 @@ export class GeneralViewModel {
this.$scope.component[attribute] = metadatakey.defaultValue;
}
return metadatakey != null;
- }
+ }
+ }
+
+ private filterCategoriesByModel(modelName:string) {
+ // reload categories
+ this.$scope.initCategories();
+ this.$scope.categories = this.$scope.categories.filter(category =>
+ !modelName ? category.models.indexOf(DEFAULT_MODEL_NAME) !== -1 : category.models !== null && category.models.indexOf(modelName) !== -1);
+ }
+
+
+ private filterBaseTypesByModelAndCategory(modelName:string) {
+ let categories = this.$scope.component.categories;
+ if (categories) {
+ this.elementService.getCategoryBasetypes(categories[0].name, modelName).subscribe((data: BaseTypeResponse[]) => {
+ this.loadBaseTypes(data);
+ });
+ }
+ }
+
+ private loadBaseTypes(data:BaseTypeResponse[]) {
+ this.$scope.baseTypes = [];
+ this.$scope.baseTypeVersions = [];
+ data.forEach(baseType => this.$scope.baseTypes.push(baseType.toscaResourceName));
+ let baseType = data[0];
+ if (baseType) {
+ baseType.versions.reverse().forEach(version => this.$scope.baseTypeVersions.push(version));
+ this.$scope.component.derivedFromGenericType = baseType.toscaResourceName;
+ this.$scope.component.derivedFromGenericVersion = baseType.versions[0];
+ }
}
private setUnsavedChanges = (hasChanges: boolean): void => {
@@ -834,14 +860,14 @@ export class GeneralViewModel {
}
private getSubcategoryMetadataKey(categories: IMainCategory[], key: string) : IMetadataKey {
- if (categories[0].subcategories && categories[0].subcategories[0].metadataKeys && categories[0].subcategories[0].metadataKeys.some(metadataKey => metadataKey.name == key)) {
+ if (categories[0].subcategories && categories[0].subcategories[0].metadataKeys && categories[0].subcategories[0].metadataKeys.some(metadataKey => metadataKey.name == key)) {
return categories[0].subcategories[0].metadataKeys.find(metadataKey => metadataKey.name == key);
}
return null;
}
private getCategoryMetadataKey(categories: IMainCategory[], key: string) : IMetadataKey {
- if (categories[0].metadataKeys && categories[0].metadataKeys.some(metadataKey => metadataKey.name == key)) {
+ if (categories[0].metadataKeys && categories[0].metadataKeys.some(metadataKey => metadataKey.name == key)) {
return categories[0].metadataKeys.find(metadataKey => metadataKey.name == key);
}
return null;
@@ -852,4 +878,3 @@ export class GeneralViewModel {
}
}
-
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java
index d44aa3018e..d518206ed1 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java
@@ -145,6 +145,9 @@ public final class Constants {
public static final String HC_COMPONENT_ECOMP_PORTAL = "PORTAL";
//Plugin BL
public static final String PLUGIN_BL_COMPONENT = "pluginStatusBL";
+ public static final String DEFAULT_MODEL_NAME = "SDC AID";
+
+
private Constants() {
}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinition.java
index 171eb70457..2a9b2e88a2 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinition.java
@@ -36,6 +36,7 @@ public class CategoryDataDefinition extends ToscaDataDefinition {
private String name;
private String normalizedName;
+ private List<String> models;
private String uniqueId;
private List<String> icons;
private boolean useServiceSubstitutionForNestedServices = false;
@@ -44,6 +45,7 @@ public class CategoryDataDefinition extends ToscaDataDefinition {
public CategoryDataDefinition(CategoryDataDefinition c) {
this.name = c.name;
this.normalizedName = c.normalizedName;
+ this.models = c.models;
this.uniqueId = c.uniqueId;
this.icons = c.icons;
this.useServiceSubstitutionForNestedServices = c.useServiceSubstitutionForNestedServices;
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/datatypes/DataTestIdEnum.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/datatypes/DataTestIdEnum.java
index 506a686ddf..d03896689f 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/datatypes/DataTestIdEnum.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/datatypes/DataTestIdEnum.java
@@ -166,6 +166,7 @@ public final class DataTestIdEnum {
public enum ResourceMetadataEnum {
RESOURCE_NAME("name"),
DESCRIPTION("description"),
+ MODEL("selectModelName"),
CATEGORY("selectGeneralCategory"),
VENDOR_NAME("vendorName"),
VENDOR_RELEASE("vendorRelease"),
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceGeneralPage.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceGeneralPage.java
index 5fa9e04c50..f8729df266 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceGeneralPage.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ResourceGeneralPage.java
@@ -46,6 +46,10 @@ public class ResourceGeneralPage extends GeneralPageElements {
return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ServiceMetadataEnum.DESCRIPTION.getValue());
}
+ public static String getModelDataTestsIdAttribute() {
+ return DataTestIdEnum.ResourceMetadataEnum.MODEL.getValue();
+ }
+
public static String getCategoryDataTestsIdAttribute() {
return DataTestIdEnum.ResourceMetadataEnum.CATEGORY.getValue();
}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ServiceCreatePage.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ServiceCreatePage.java
index 4635d2ae01..ff7b26f671 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ServiceCreatePage.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ServiceCreatePage.java
@@ -65,6 +65,7 @@ public class ServiceCreatePage extends ComponentPage {
*/
public void fillForm(final ServiceCreateData serviceCreateData) {
fillName(serviceCreateData.getName());
+ setModel(serviceCreateData.getModel());
setCategory(serviceCreateData.getCategory());
setEtsiVersion(serviceCreateData.getEtsiVersion());
fillDescription(serviceCreateData.getDescription());
@@ -78,6 +79,14 @@ public class ServiceCreatePage extends ComponentPage {
categorySelect.selectByVisibleText(etsiVersion);
}
+ private void setModel(final String model) {
+ if (model == null) {
+ return;
+ }
+ final Select modelSelect = new Select(findElement(By.xpath(XpathSelector.MODEL_SELECT.getXpath())));
+ modelSelect.selectByVisibleText(model);
+ }
+
private void setCategory(final String category) {
if (category == null) {
return;
@@ -114,6 +123,7 @@ public class ServiceCreatePage extends ComponentPage {
@AllArgsConstructor
private enum XpathSelector {
NAME_INPUT("name", "//input[@data-tests-id='%s']"),
+ MODEL_SELECT("selectModelName", "//select[@data-tests-id='%s']"),
CATEGORY_SELECT("selectGeneralCategory", "//select[@data-tests-id='%s']"),
ETSI_VERSION_SELECT("ETSI Version", "//select[@data-tests-id='%s']"),
DESCRIPTION_TEXT_AREA("description", "//textarea[@data-tests-id='%s']");
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ServiceGeneralPage.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ServiceGeneralPage.java
index 775e599df6..101630fca7 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ServiceGeneralPage.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/ServiceGeneralPage.java
@@ -77,6 +77,10 @@ public class ServiceGeneralPage extends ResourceGeneralPage {
namingPolicyTextbox.sendKeys(namingPolicyText);
}
+ public static void defineModel(final String model) {
+ GeneralUIUtils.getSelectList(model, getModelDataTestsIdAttribute());
+ }
+
public static String getServiceFunctionText(){
return getServiceFunctionField().getAttribute("value");
}