summaryrefslogtreecommitdiffstats
path: root/catalog-model
diff options
context:
space:
mode:
authoraribeiro <anderson.ribeiro@est.tech>2020-02-27 13:15:28 +0000
committerOfir Sonsino <ofir.sonsino@intl.att.com>2020-03-22 10:04:50 +0000
commit13a7f6743fbcc736c871d8168d2a7dcbda1daaba (patch)
treea7a71a96f74143b2bf0409c697a2f1d60dc158b4 /catalog-model
parent815674c947f970e9e57e06c8907758f88032b30a (diff)
Include derived_from types in generated csar
Issue-ID: SDC-2775 Change-Id: I7b90ff78c389e5680cacafda2065669f6baf1735 Signed-off-by: aribeiro <anderson.ribeiro@est.tech>
Diffstat (limited to 'catalog-model')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/Resource.java176
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/NodeType.java48
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java30
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java75
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceTest.java19
5 files changed, 147 insertions, 201 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Resource.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Resource.java
index 8100f988a2..a38095a3ce 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Resource.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Resource.java
@@ -20,6 +20,14 @@
package org.openecomp.sdc.be.model;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.stream.Collectors;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.utils.MapUtil;
import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition;
@@ -27,18 +35,26 @@ import org.openecomp.sdc.be.datatypes.elements.InterfaceInstanceDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
+@Getter
+@Setter
+@EqualsAndHashCode
+@ToString
public class Resource extends Component {
+ /**
+ * Please note that more than one "derivedFrom" resource is not currently supported by the app. The first list
+ * element is always addressed.
+ */
private List<String> derivedFrom;
+ /**
+ * The derivedList is a chain of derivedFrom. e.g. if resource C is derived from resource B that is derived from
+ * resource A - then A, B is the "DerivedList" of resource C
+ */
private List<String> derivedList;
+ private Map<String, String> derivedFromMapOfIdToName;
+
private List<PropertyDefinition> attributes;
private Map<String, InterfaceInstanceDataDefinition> instInterfaces;
@@ -48,7 +64,7 @@ public class Resource extends Component {
public Resource() {
super(new ResourceMetadataDefinition());
this.getComponentMetadataDefinition().getMetadataDataDefinition()
- .setComponentType(ComponentTypeEnum.RESOURCE);
+ .setComponentType(ComponentTypeEnum.RESOURCE);
}
public Resource(ComponentMetadataDefinition componentMetadataDefinition) {
@@ -59,82 +75,30 @@ public class Resource extends Component {
this.getComponentMetadataDefinition().getMetadataDataDefinition().setComponentType(ComponentTypeEnum.RESOURCE);
}
- /**
- * Please note that more than one "derivedFrom" resource is not currently
- * supported by the app. The first list element is always addressed.
- *
- * @return
- */
- public List<String> getDerivedFrom() {
- return derivedFrom;
- }
-
- public void setDerivedFrom(List<String> derivedFrom) {
- this.derivedFrom = derivedFrom;
- }
-
- /**
- * The derivedList is a chain of derivedFrom. e.g. if resource C is derived
- * from resource B that is derived from resource A - then A, B is the
- * "DerivedList" of resource C
- *
- * @return
- */
- public List<String> getDerivedList() {
- return derivedList;
- }
-
- public void setDerivedList(List<String> derivedList) {
- this.derivedList = derivedList;
- }
-
+ @Override
public List<PropertyDefinition> getProperties() {
return properties;
}
+ @Override
public void setProperties(List<PropertyDefinition> properties) {
this.properties = properties;
}
- public List<PropertyDefinition> getAttributes() {
- return attributes;
- }
-
- public void setAttributes(List<PropertyDefinition> attributes) {
- this.attributes = attributes;
- }
-
- public Map<String, InterfaceInstanceDataDefinition> getInstInterfaces() {
- return instInterfaces;
- }
-
- public void setInstInterfaces(
- Map<String, InterfaceInstanceDataDefinition> instInterfaces) {
- this.instInterfaces = instInterfaces;
- }
-
public Boolean isAbstract() {
return ((ResourceMetadataDataDefinition) getComponentMetadataDefinition()
- .getMetadataDataDefinition())
- .isAbstract();
+ .getMetadataDataDefinition())
+ .isAbstract();
}
public void setAbstract(Boolean isAbstract) {
((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .setAbstract(isAbstract);
- }
-
- public List<String> getDefaultCapabilities() {
- return defaultCapabilities;
- }
-
- public void setDefaultCapabilities(List<String> defaultCapabilities) {
- this.defaultCapabilities = defaultCapabilities;
+ .setAbstract(isAbstract);
}
public String getCost() {
return ((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .getCost();
+ .getCost();
}
public void setCost(String cost) {
@@ -143,103 +107,72 @@ public class Resource extends Component {
public String getLicenseType() {
return ((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .getLicenseType();
+ .getLicenseType();
}
public void setLicenseType(String licenseType) {
((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .setLicenseType(licenseType);
+ .setLicenseType(licenseType);
}
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + super.hashCode();
- result = prime * result + ((attributes == null) ? 0 : attributes.hashCode());
- result = prime * result + ((defaultCapabilities == null) ? 0 : defaultCapabilities.hashCode());
- result = prime * result + ((derivedFrom == null) ? 0 : derivedFrom.hashCode());
- result = prime * result + ((properties == null) ? 0 : properties.hashCode());
- result = prime * result + ((derivedList == null) ? 0 : derivedList.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- if (!super.equals(o)) return false;
- Resource resource = (Resource) o;
- return Objects.equals(derivedFrom, resource.derivedFrom) &&
- Objects.equals(derivedList, resource.derivedList) &&
- Objects.equals(properties, resource.properties) &&
- Objects.equals(attributes, resource.attributes) &&
- Objects.equals(defaultCapabilities, resource.defaultCapabilities);
- }
-
-
- @Override
- public String toString() {
- return "Resource [derivedFrom=" + derivedFrom + ", properties=" + properties + ", attributes=" + attributes
- + ", defaultCapabilities=" + defaultCapabilities + ", additionalInformation=" + additionalInformation
- + "Metadata [" + getComponentMetadataDefinition().getMetadataDataDefinition().toString() + "]";
- }
public String getToscaResourceName() {
return ((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .getToscaResourceName();
+ .getToscaResourceName();
}
public void setToscaResourceName(String toscaResourceName) {
((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .setToscaResourceName(toscaResourceName);
+ .setToscaResourceName(toscaResourceName);
}
public ResourceTypeEnum getResourceType() {
return ((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .getResourceType();
+ .getResourceType();
}
public void setResourceType(ResourceTypeEnum resourceType) {
((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .setResourceType(resourceType);
+ .setResourceType(resourceType);
}
public void setVendorName(String vendorName) {
((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .setVendorName(vendorName);
+ .setVendorName(vendorName);
}
public void setVendorRelease(String vendorRelease) {
((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .setVendorRelease(vendorRelease);
+ .setVendorRelease(vendorRelease);
}
public void setResourceVendorModelNumber(String resourceVendorModelNumber) {
((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition()).
- setResourceVendorModelNumber(resourceVendorModelNumber);
+ setResourceVendorModelNumber(resourceVendorModelNumber);
}
public String getVendorName() {
return ((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .getVendorName();
+ .getVendorName();
}
public String getVendorRelease() {
return ((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .getVendorRelease();
+ .getVendorRelease();
}
public String getResourceVendorModelNumber() {
return ((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .getResourceVendorModelNumber();
+ .getResourceVendorModelNumber();
}
@Override
public String fetchGenericTypeToscaNameFromConfig() {
String result = super.fetchGenericTypeToscaNameFromConfig();
- if (null == result)
- result = ConfigurationManager.getConfigurationManager().getConfiguration().getGenericAssetNodeTypes().get(ResourceTypeEnum.VFC.getValue());
+ if (null == result) {
+ result = ConfigurationManager.getConfigurationManager().getConfiguration().getGenericAssetNodeTypes()
+ .get(ResourceTypeEnum.VFC.getValue());
+ }
return result;
}
@@ -249,24 +182,23 @@ public class Resource extends Component {
}
@Override
- public boolean shouldGenerateInputs(){
+ public boolean shouldGenerateInputs() {
return !(this.getResourceType().isAtomicType());
}
@Override
public boolean deriveFromGeneric() {
- return this.shouldGenerateInputs() || (derivedFrom != null && derivedFrom.contains(fetchGenericTypeToscaNameFromConfig()));
+ return this.shouldGenerateInputs() || (derivedFrom != null && derivedFrom
+ .contains(fetchGenericTypeToscaNameFromConfig()));
}
public Map<String, List<RequirementCapabilityRelDef>> groupRelationsFromCsarByInstanceName(Resource resource) {
- List<RequirementCapabilityRelDef> componentInstanceRelationsFromCsar = resource.getComponentInstancesRelations().stream().filter(r->!r.isOriginUI()).collect(Collectors.toList());
- Map<String, List<RequirementCapabilityRelDef>> relationsByInstanceId = MapUtil.groupListBy(componentInstanceRelationsFromCsar, RequirementCapabilityRelDef::getFromNode);
- return MapUtil.convertMapKeys(relationsByInstanceId, instId -> getInstanceInvariantNameFromInstanceId(resource, instId));
- }
-
- private String getInstanceNameFromInstanceId(Resource resource, String instId) {
- Optional<ComponentInstance> componentInstanceById = resource.getComponentInstanceById(instId);
- return componentInstanceById.isPresent() ? componentInstanceById.get().getName() : null;
+ List<RequirementCapabilityRelDef> componentInstanceRelationsFromCsar = resource.getComponentInstancesRelations()
+ .stream().filter(r -> !r.isOriginUI()).collect(Collectors.toList());
+ Map<String, List<RequirementCapabilityRelDef>> relationsByInstanceId = MapUtil
+ .groupListBy(componentInstanceRelationsFromCsar, RequirementCapabilityRelDef::getFromNode);
+ return MapUtil
+ .convertMapKeys(relationsByInstanceId, instId -> getInstanceInvariantNameFromInstanceId(resource, instId));
}
private String getInstanceInvariantNameFromInstanceId(Resource resource, String instId) {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/NodeType.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/NodeType.java
index 9c3b76d556..296e80b674 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/NodeType.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/NodeType.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,12 +20,16 @@
package org.openecomp.sdc.be.model.jsonjanusgraph.datamodel;
-import org.openecomp.sdc.be.datatypes.elements.*;
-
import java.util.List;
import java.util.Map;
+import lombok.Getter;
+import lombok.Setter;
+import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
-public class NodeType extends ToscaElement{
+@Getter
+@Setter
+public class NodeType extends ToscaElement {
public NodeType() {
super(ToscaElementTypeEnum.NODE_TYPE);
@@ -33,39 +37,7 @@ public class NodeType extends ToscaElement{
private List<String> derivedFrom;
private List<String> derivedList;
+ private Map<String, String> derivedFromMapOfIdToName;
private Map<String, PropertyDataDefinition> attributes;
private Map<String, InterfaceDataDefinition> interfaceArtifacts;
-
- public List<String> getDerivedList() {
- return derivedList;
- }
-
- public void setDerivedList(List<String> derivedList) {
- this.derivedList = derivedList;
- }
-
- public List<String> getDerivedFrom() {
- return derivedFrom;
- }
-
- public void setDerivedFrom(List<String> derivedFrom) {
- this.derivedFrom = derivedFrom;
- }
-
- public Map<String, PropertyDataDefinition> getAttributes() {
- return attributes;
- }
-
- public void setAttributes(Map<String, PropertyDataDefinition> attributes) {
- this.attributes = attributes;
- }
-
- public Map<String, InterfaceDataDefinition> getInterfaceArtifacts() {
- return interfaceArtifacts;
- }
-
- public void setInterfaceArtifacts(Map<String, InterfaceDataDefinition> interfaceArtifacts) {
- this.interfaceArtifacts = interfaceArtifacts;
- }
-
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java
index 96242e32a3..9a70e9c837 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java
@@ -321,42 +321,48 @@ public class NodeTypeOperation extends ToscaElementOperation {
return JanusGraphOperationStatus.OK;
}
- private JanusGraphOperationStatus setResourceDerivedFromGraph(GraphVertex componentV, NodeType toscaElement) {
- List<String> derivedFromList = new ArrayList<>();
+ private JanusGraphOperationStatus setResourceDerivedFromGraph(final GraphVertex componentV,
+ final NodeType toscaElement) {
+ final List<String> derivedFromList = new ArrayList<>();
+ final Map<String, String> derivedFromMapOfIdToName = new LinkedHashMap<>();
- JanusGraphOperationStatus
- listFromGraphStatus = findResourcesPathRecursively(componentV, derivedFromList);
+ final JanusGraphOperationStatus listFromGraphStatus = findResourcesPathRecursively(componentV, derivedFromList,
+ derivedFromMapOfIdToName);
if (JanusGraphOperationStatus.OK != listFromGraphStatus) {
return listFromGraphStatus;
}
if (!derivedFromList.isEmpty()) {
if (derivedFromList.size() > 1) {
- List<String> lastDerivedFrom = new ArrayList<>();
+ final List<String> lastDerivedFrom = new ArrayList<>();
lastDerivedFrom.add(derivedFromList.get(1));
toscaElement.setDerivedFrom(lastDerivedFrom);
- toscaElement.setDerivedList(derivedFromList);
} else {
toscaElement.setDerivedFrom(null);
- toscaElement.setDerivedList(derivedFromList);
}
-
+ toscaElement.setDerivedList(derivedFromList);
+ toscaElement.setDerivedFromMapOfIdToName(derivedFromMapOfIdToName);
}
return JanusGraphOperationStatus.OK;
}
- protected JanusGraphOperationStatus findResourcesPathRecursively(GraphVertex nodeTypeV, List<String> resourcesPathList) {
+ private JanusGraphOperationStatus findResourcesPathRecursively(final GraphVertex nodeTypeV,
+ final List<String> resourcesPathList,
+ final Map<String, String> derivedFromMapOfIdToName) {
Either<GraphVertex, JanusGraphOperationStatus> parentResourceRes = janusGraphDao
.getChildVertex(nodeTypeV, EdgeLabelEnum.DERIVED_FROM, JsonParseFlagEnum.NoParse);
resourcesPathList.add((String) nodeTypeV.getMetadataProperty(GraphPropertyEnum.TOSCA_RESOURCE_NAME));
+ derivedFromMapOfIdToName.put(nodeTypeV.getUniqueId(),
+ (String) nodeTypeV.getMetadataProperty(GraphPropertyEnum.TOSCA_RESOURCE_NAME));
while (parentResourceRes.isLeft()) {
-
- GraphVertex parent = parentResourceRes.left().value();
+ final GraphVertex parent = parentResourceRes.left().value();
resourcesPathList.add((String) parent.getMetadataProperty(GraphPropertyEnum.TOSCA_RESOURCE_NAME));
+ derivedFromMapOfIdToName
+ .put(parent.getUniqueId(), (String) parent.getMetadataProperty(GraphPropertyEnum.TOSCA_RESOURCE_NAME));
parentResourceRes = janusGraphDao
.getChildVertex(parent, EdgeLabelEnum.DERIVED_FROM, JsonParseFlagEnum.NoParse);
}
- JanusGraphOperationStatus operationStatus = parentResourceRes.right().value();
+ final JanusGraphOperationStatus operationStatus = parentResourceRes.right().value();
if (operationStatus != JanusGraphOperationStatus.NOT_FOUND) {
return operationStatus;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java
index 39d3548279..c16c8a98e5 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java
@@ -22,6 +22,18 @@ package org.openecomp.sdc.be.model.jsonjanusgraph.utils;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import java.util.function.Function;
+import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.BooleanUtils;
@@ -34,14 +46,60 @@ import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionaryExtractor;
import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition;
import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition;
import org.openecomp.sdc.be.datatypes.components.ServiceMetadataDataDefinition;
-import org.openecomp.sdc.be.datatypes.elements.*;
+import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.CINodeFilterDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.CompositionDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.DataTypeDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.GroupInstanceDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.ListCapabilityDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.ListRequirementDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.MapArtifactDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.MapCapabilityProperty;
+import org.openecomp.sdc.be.datatypes.elements.MapGroupsDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapInterfaceDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.MapListCapabilityDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.MapListRequirementDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.MapPropertiesDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.PolicyDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.ProductMetadataDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.RelationshipInstDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.RequirementDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.CreatedFrom;
-import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFieldsExtractor;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
+import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFieldsExtractor;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.*;
+import org.openecomp.sdc.be.model.AdditionalInformationDefinition;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.be.model.CapabilityDefinition;
+import org.openecomp.sdc.be.model.CapabilityRequirementRelationship;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.ComponentInstanceInput;
+import org.openecomp.sdc.be.model.ComponentInstanceInterface;
+import org.openecomp.sdc.be.model.ComponentInstanceProperty;
+import org.openecomp.sdc.be.model.DataTypeDefinition;
+import org.openecomp.sdc.be.model.DistributionStatusEnum;
+import org.openecomp.sdc.be.model.GroupDefinition;
+import org.openecomp.sdc.be.model.GroupInstance;
+import org.openecomp.sdc.be.model.InputDefinition;
+import org.openecomp.sdc.be.model.InterfaceDefinition;
+import org.openecomp.sdc.be.model.MapInterfaceInstanceDataDefinition;
+import org.openecomp.sdc.be.model.PolicyDefinition;
+import org.openecomp.sdc.be.model.PropertyDefinition;
+import org.openecomp.sdc.be.model.RelationshipImpl;
+import org.openecomp.sdc.be.model.RelationshipInfo;
+import org.openecomp.sdc.be.model.RequirementCapabilityRelDef;
+import org.openecomp.sdc.be.model.RequirementDefinition;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.NodeType;
import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
@@ -54,16 +112,6 @@ import org.openecomp.sdc.be.resources.data.ResourceMetadataData;
import org.openecomp.sdc.be.resources.data.ServiceMetadataData;
import org.openecomp.sdc.common.log.wrappers.Logger;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import java.util.*;
-import java.util.Map.Entry;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
public class ModelConverter {
public static final String CAP_PROP_DELIM = "#";
private static final Logger log = Logger.getLogger(ModelConverter.class);
@@ -196,6 +244,7 @@ public class ModelConverter {
NodeType nodeType = (NodeType) toscaElement;
resource.setDerivedFrom(nodeType.getDerivedFrom());
resource.setDerivedList(nodeType.getDerivedList());
+ resource.setDerivedFromMapOfIdToName(nodeType.getDerivedFromMapOfIdToName());
resource.setAbstract((Boolean) nodeType.getMetadataValue(JsonPresentationFields.IS_ABSTRACT));
convertAttributes(nodeType, resource);
convertCapabilities(nodeType, resource);
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceTest.java
index 790ce10653..c53e4e00bb 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ResourceTest.java
@@ -20,16 +20,14 @@
package org.openecomp.sdc.be.model;
-import mockit.Deencapsulation;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
import org.junit.Assert;
import org.junit.Test;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.unittests.utils.ModelConfDependentTest;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
public class ResourceTest extends ModelConfDependentTest{
private Resource createTestSubject() {
@@ -447,15 +445,4 @@ public class ResourceTest extends ModelConfDependentTest{
result = testSubject.groupRelationsFromCsarByInstanceName(resource);
}
- @Test
- public void testGetInstanceNameFromInstanceId() throws Exception {
- Resource testSubject;
- Resource resource = new Resource();
- String instId = "mock";
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- Deencapsulation.invoke(testSubject, "getInstanceNameFromInstanceId", resource, instId);
- }
}