summaryrefslogtreecommitdiffstats
path: root/catalog-model
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2022-09-15 14:27:20 +0100
committerMichael Morris <michael.morris@est.tech>2022-09-19 08:39:08 +0000
commit3935993a90fe768585ab5e908d6334567c1823de (patch)
tree6539da2e6809e0faa6859e5b9deb2ce6cdd93181 /catalog-model
parent0d38a72c022fa93dba0bf052f893e51fb73d3552 (diff)
Import unknown group types during Service import
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Change-Id: Ic435ee0c440dd8ed64339bab08e921687d23b9c0 Issue-ID: SDC-4176
Diffstat (limited to 'catalog-model')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArtifactsOperations.java4
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/BaseOperation.java46
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperation.java4
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/InterfaceOperation.java8
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java60
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java6
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementLifecycleOperation.java38
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java18
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/normatives/ToscaTypeMetadata.java32
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/AttributeOperation.java15
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupTypeOperation.java33
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/UniqueIdBuilder.java93
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupTypeDefinitionTest.java90
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/normatives/ToscaTypeMetadataTest.java32
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/UniqueIdBuilderTest.java306
15 files changed, 477 insertions, 308 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArtifactsOperations.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArtifactsOperations.java
index c1045e6746..4da57ab444 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArtifactsOperations.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArtifactsOperations.java
@@ -725,8 +725,8 @@ public class ArtifactsOperations extends BaseOperation {
if (triple.getMiddle()) {
List<String> pathKeys = new ArrayList<>();
pathKeys.add(instanceId);
- status = deleteToscaDataDeepElement(componentId, edgeLabelEnum, vertexTypeEnum, artifactFromGraph.getArtifactLabel(), pathKeys,
- JsonPresentationFields.ARTIFACT_LABEL);
+ status = deleteToscaDataDeepElement(componentId, edgeLabelEnum, artifactFromGraph.getArtifactLabel(), pathKeys
+ );
} else {
status = deleteToscaDataElement(componentId, edgeLabelEnum, vertexTypeEnum, artifactFromGraph.getArtifactLabel(),
JsonPresentationFields.ARTIFACT_LABEL);
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/BaseOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/BaseOperation.java
index 054ed9fe7e..af8414dc81 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/BaseOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/BaseOperation.java
@@ -46,7 +46,6 @@ 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;
import org.openecomp.sdc.be.dao.jsongraph.utils.IdBuilderUtils;
-import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.GroupInstanceDataDefinition;
@@ -597,7 +596,6 @@ public abstract class BaseOperation {
public <T extends ToscaDataDefinition> StorageOperationStatus deleteToscaDataDeepElementsBlockOfToscaElement(String toscaElementUid,
EdgeLabelEnum edgeLabel,
- VertexTypeEnum vertexLabel,
String key) {
StorageOperationStatus statusRes = null;
Either<GraphVertex, JanusGraphOperationStatus> getToscaElementRes;
@@ -609,7 +607,7 @@ public abstract class BaseOperation {
statusRes = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
if (statusRes == null) {
- statusRes = deleteToscaDataDeepElementsBlockToToscaElement(getToscaElementRes.left().value(), edgeLabel, vertexLabel, key);
+ statusRes = deleteToscaDataDeepElementsBlockToToscaElement(getToscaElementRes.left().value(), edgeLabel, key);
}
if (statusRes == null) {
statusRes = StorageOperationStatus.OK;
@@ -619,7 +617,6 @@ public abstract class BaseOperation {
public <T extends ToscaDataDefinition> StorageOperationStatus deleteToscaDataDeepElementsBlockToToscaElement(GraphVertex toscaElement,
EdgeLabelEnum edgeLabel,
- VertexTypeEnum vertexLabel,
String key) {
StorageOperationStatus result = null;
GraphVertex toscaDataVertex = null;
@@ -1081,10 +1078,9 @@ public abstract class BaseOperation {
*
* @param toscaElementUid
* @param edgeLabel
- * @param vertexLabel
* @return
*/
- public StorageOperationStatus removeToscaData(String toscaElementUid, EdgeLabelEnum edgeLabel, VertexTypeEnum vertexLabel) {
+ public StorageOperationStatus removeToscaData(String toscaElementUid, EdgeLabelEnum edgeLabel) {
StorageOperationStatus statusRes = StorageOperationStatus.OK;
Either<GraphVertex, JanusGraphOperationStatus> getToscaElementRes;
getToscaElementRes = janusGraphDao.getVertexById(toscaElementUid, JsonParseFlagEnum.NoParse);
@@ -1095,7 +1091,7 @@ public abstract class BaseOperation {
statusRes = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
if (statusRes == StorageOperationStatus.OK) {
- statusRes = removeToscaDataVertex(getToscaElementRes.left().value(), edgeLabel, vertexLabel);
+ statusRes = removeToscaDataVertex(getToscaElementRes.left().value(), edgeLabel);
}
return statusRes;
}
@@ -1105,10 +1101,9 @@ public abstract class BaseOperation {
*
* @param toscaElement
* @param edgeLabel
- * @param vertexLabel
* @return
*/
- public StorageOperationStatus removeToscaDataVertex(GraphVertex toscaElement, EdgeLabelEnum edgeLabel, VertexTypeEnum vertexLabel) {
+ private StorageOperationStatus removeToscaDataVertex(GraphVertex toscaElement, EdgeLabelEnum edgeLabel) {
StorageOperationStatus result = null;
GraphVertex toscaDataVertex = null;
Iterator<Edge> edges = null;
@@ -1208,7 +1203,7 @@ public abstract class BaseOperation {
statusRes = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
if (statusRes == StorageOperationStatus.OK) {
- statusRes = deleteToscaDataElement(getToscaElementRes.left().value(), edgeLabel, vertexLabel, uniqueKey, mapKeyField);
+ statusRes = deleteToscaDataElement(getToscaElementRes.left().value(), edgeLabel, uniqueKey);
}
return statusRes;
}
@@ -1218,14 +1213,12 @@ public abstract class BaseOperation {
*
* @param toscaElementUid
* @param edgeLabel
- * @param vertexLabel
* @param uniqueKey
* @param pathKeys
- * @param mapKeyField
* @return
*/
- public StorageOperationStatus deleteToscaDataDeepElement(String toscaElementUid, EdgeLabelEnum edgeLabel, VertexTypeEnum vertexLabel,
- String uniqueKey, List<String> pathKeys, JsonPresentationFields mapKeyField) {
+ public StorageOperationStatus deleteToscaDataDeepElement(String toscaElementUid, EdgeLabelEnum edgeLabel,
+ String uniqueKey, List<String> pathKeys) {
StorageOperationStatus statusRes = StorageOperationStatus.OK;
Either<GraphVertex, JanusGraphOperationStatus> getToscaElementRes;
getToscaElementRes = janusGraphDao.getVertexById(toscaElementUid, JsonParseFlagEnum.NoParse);
@@ -1236,7 +1229,7 @@ public abstract class BaseOperation {
statusRes = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status);
}
if (statusRes == StorageOperationStatus.OK) {
- statusRes = deleteToscaDataDeepElement(getToscaElementRes.left().value(), edgeLabel, vertexLabel, uniqueKey, pathKeys, mapKeyField);
+ statusRes = deleteToscaDataDeepElement(getToscaElementRes.left().value(), edgeLabel, uniqueKey, pathKeys);
}
return statusRes;
}
@@ -1246,21 +1239,19 @@ public abstract class BaseOperation {
*
* @param toscaElement
* @param edgeLabel
- * @param vertexLabel
* @param uniqueKey
* @param pathKeys
- * @param mapKeyField
* @return
*/
- public StorageOperationStatus deleteToscaDataDeepElement(GraphVertex toscaElement, EdgeLabelEnum edgeLabel, VertexTypeEnum vertexLabel,
- String uniqueKey, List<String> pathKeys, JsonPresentationFields mapKeyField) {
+ public StorageOperationStatus deleteToscaDataDeepElement(GraphVertex toscaElement, EdgeLabelEnum edgeLabel,
+ String uniqueKey, List<String> pathKeys) {
List<String> uniqueKeys = new ArrayList<>();
uniqueKeys.add(uniqueKey);
- return deleteToscaDataDeepElements(toscaElement, edgeLabel, vertexLabel, uniqueKeys, pathKeys, mapKeyField);
+ return deleteToscaDataDeepElements(toscaElement, edgeLabel, uniqueKeys, pathKeys);
}
- public StorageOperationStatus deleteToscaDataDeepElements(GraphVertex toscaElement, EdgeLabelEnum edgeLabel, VertexTypeEnum vertexLabel,
- List<String> uniqueKeys, List<String> pathKeys, JsonPresentationFields mapKeyField) {
+ public StorageOperationStatus deleteToscaDataDeepElements(GraphVertex toscaElement, EdgeLabelEnum edgeLabel,
+ List<String> uniqueKeys, List<String> pathKeys) {
StorageOperationStatus result = null;
GraphVertex toscaDataVertex;
Map<String, ToscaDataDefinition> existingToscaDataMap = null;
@@ -1304,13 +1295,11 @@ public abstract class BaseOperation {
*
* @param toscaElement
* @param edgeLabel
- * @param vertexLabel
* @param uniqueKey
- * @param mapKeyField
* @return
*/
- public StorageOperationStatus deleteToscaDataElement(GraphVertex toscaElement, EdgeLabelEnum edgeLabel, VertexTypeEnum vertexLabel,
- String uniqueKey, JsonPresentationFields mapKeyField) {
+ public StorageOperationStatus deleteToscaDataElement(GraphVertex toscaElement, EdgeLabelEnum edgeLabel,
+ String uniqueKey) {
List<String> uniqueKeys = new ArrayList<>();
uniqueKeys.add(uniqueKey);
return deleteToscaDataElements(toscaElement, edgeLabel, uniqueKeys);
@@ -1470,8 +1459,7 @@ public abstract class BaseOperation {
}
protected GroupInstanceDataDefinition buildGroupInstanceDataDefinition(GroupDataDefinition group,
- ComponentInstanceDataDefinition componentInstance,
- Map<String, ArtifactDataDefinition> instDeplArtifMap) {
+ ComponentInstanceDataDefinition componentInstance) {
String componentInstanceName = componentInstance.getName();
Long creationDate = System.currentTimeMillis();
GroupInstanceDataDefinition groupInstance = new GroupInstanceDataDefinition();
@@ -1485,7 +1473,7 @@ public abstract class BaseOperation {
groupInstance.setGroupName(group.getName());
groupInstance.setNormalizedName(ValidationUtils.normalizeComponentInstanceName(groupInstance.getName()));
groupInstance
- .setUniqueId(UniqueIdBuilder.buildResourceInstanceUniuqeId(componentInstance.getUniqueId(), groupUid, groupInstance.getNormalizedName()));
+ .setUniqueId(UniqueIdBuilder.buildResourceInstanceUniqueId(componentInstance.getUniqueId(), groupUid, groupInstance.getNormalizedName()));
groupInstance.setArtifacts(group.getArtifacts());
groupInstance.setArtifactsUuid(group.getArtifactsUuid());
groupInstance.setProperties(group.getProperties());
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperation.java
index 67eaae74ea..184e337e9b 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperation.java
@@ -143,12 +143,12 @@ public class GroupsOperation extends BaseOperation {
private StorageOperationStatus removeCalculatedCapabilityFromComponent(String componentId, String groupId) {
return deleteToscaDataDeepElementsBlockOfToscaElement(componentId, EdgeLabelEnum.CALCULATED_CAPABILITIES,
- VertexTypeEnum.CALCULATED_CAPABILITIES, groupId);
+ groupId);
}
private StorageOperationStatus removeCalculatedCapabilityPropertiesFromComponent(String componentId, String groupId) {
return deleteToscaDataDeepElementsBlockOfToscaElement(componentId, EdgeLabelEnum.CALCULATED_CAP_PROPERTIES,
- VertexTypeEnum.CALCULATED_CAP_PROPERTIES, groupId);
+ groupId);
}
public Either<List<GroupDefinition>, StorageOperationStatus> createGroups(Component component, Map<String, GroupDataDefinition> groups) {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/InterfaceOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/InterfaceOperation.java
index 786c98d1a7..0de48b7d77 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/InterfaceOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/InterfaceOperation.java
@@ -87,9 +87,9 @@ public class InterfaceOperation extends BaseOperation {
public Either<String, StorageOperationStatus> deleteInterface(final Component component, final String interfacesToDelete) {
final String componentId = component.getUniqueId();
if (isVfc(component)) {
- return deleteInterface(componentId, interfacesToDelete, EdgeLabelEnum.INTERFACE_ARTIFACTS, VertexTypeEnum.INTERFACE_ARTIFACTS);
+ return deleteInterface(componentId, interfacesToDelete, EdgeLabelEnum.INTERFACE_ARTIFACTS);
} else {
- return deleteInterface(componentId, interfacesToDelete, EdgeLabelEnum.INTERFACE, VertexTypeEnum.INTERFACE);
+ return deleteInterface(componentId, interfacesToDelete, EdgeLabelEnum.INTERFACE);
}
}
@@ -98,7 +98,7 @@ public class InterfaceOperation extends BaseOperation {
}
private Either<String, StorageOperationStatus> deleteInterface(final String componentId, final String interfacesToDelete,
- final EdgeLabelEnum edgeLabel, final VertexTypeEnum vertexType) {
+ final EdgeLabelEnum edgeLabel) {
StorageOperationStatus statusRes = deleteToscaDataElements(componentId, edgeLabel, Collections.singletonList(interfacesToDelete));
if (!statusRes.equals(StorageOperationStatus.OK)) {
return Either.right(statusRes);
@@ -109,7 +109,7 @@ public class InterfaceOperation extends BaseOperation {
}
final Map<String, InterfaceDataDefinition> interfaceDataDefinitionMap = interfaceEither.left().value();
if (MapUtils.isEmpty(interfaceDataDefinitionMap)) {
- statusRes = removeToscaData(componentId, edgeLabel, vertexType);
+ statusRes = removeToscaData(componentId, edgeLabel);
if (!statusRes.equals(StorageOperationStatus.OK)) {
return Either.right(statusRes);
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java
index 910b9e3afa..901da1dd73 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java
@@ -154,7 +154,7 @@ public class NodeTemplateOperation extends BaseOperation {
}
public static String createCapPropertyKey(String key, String instanceId) {
- StringBuffer sb = new StringBuffer(instanceId);
+ StringBuilder sb = new StringBuilder(instanceId);
sb.append(ModelConverter.CAP_PROP_DELIM).append(instanceId).append(ModelConverter.CAP_PROP_DELIM).append(key);
return sb.toString();
}
@@ -189,7 +189,7 @@ public class NodeTemplateOperation extends BaseOperation {
componentInstanceData = buildComponentInstanceDataDefinition(componentInstance, container.getUniqueId(),
newInstanceNameRes.left().value(), true, originToscaElement);
addComponentInstanceRes = addComponentInstanceToTopologyTemplate(container, originToscaElement, componentInstanceData,
- metadataVertex.left().value(), allowDeleted, user);
+ metadataVertex.left().value(), allowDeleted);
if (addComponentInstanceRes.isRight()) {
StorageOperationStatus status = addComponentInstanceRes.right().value();
if (status == StorageOperationStatus.NOT_FOUND) {
@@ -240,7 +240,7 @@ public class NodeTemplateOperation extends BaseOperation {
: calcCap.get(componentInstanceData.getUniqueId());
/******** capability ****************************/
StorageOperationStatus status = deleteToscaDataDeepElementsBlockOfToscaElement(updatedContainer.getUniqueId(),
- EdgeLabelEnum.CALCULATED_CAPABILITIES, VertexTypeEnum.CALCULATED_CAPABILITIES, componentInstanceData.getUniqueId());
+ EdgeLabelEnum.CALCULATED_CAPABILITIES, componentInstanceData.getUniqueId());
if (status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to remove calculated capabilty for instance {} in container {}. error {] ",
componentInstanceData.getUniqueId(), updatedContainer.getUniqueId(), status);
@@ -263,7 +263,7 @@ public class NodeTemplateOperation extends BaseOperation {
/******** capability property ****************************/
status = deleteToscaDataDeepElementsBlockOfToscaElement(updatedContainer.getUniqueId(), EdgeLabelEnum.CALCULATED_CAP_PROPERTIES,
- VertexTypeEnum.CALCULATED_CAP_PROPERTIES, componentInstanceData.getUniqueId());
+ componentInstanceData.getUniqueId());
if (status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG,
"Failed to remove calculated capabilty properties for instance {} in container {}. error {] ",
@@ -302,7 +302,7 @@ public class NodeTemplateOperation extends BaseOperation {
calcReg == null || !calcReg.containsKey(componentInstanceData.getUniqueId()) ? new MapListRequirementDataDefinition()
: calcReg.get(componentInstanceData.getUniqueId());
status = deleteToscaDataDeepElementsBlockOfToscaElement(updatedContainer.getUniqueId(), EdgeLabelEnum.CALCULATED_REQUIREMENTS,
- VertexTypeEnum.CALCULATED_REQUIREMENTS, componentInstanceData.getUniqueId());
+ componentInstanceData.getUniqueId());
if (status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND) {
CommonUtility
.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to remove calculated Requirements for instance {} in container {}. error {] ",
@@ -372,7 +372,7 @@ public class NodeTemplateOperation extends BaseOperation {
.getVertexById(updatedContainer.getUniqueId(), JsonParseFlagEnum.NoParse);
if (getToscaElementRes.isLeft()) {
deleteToscaDataDeepElementsBlockToToscaElement(getToscaElementRes.left().value(), EdgeLabelEnum.INST_PROPERTIES,
- VertexTypeEnum.INST_PROPERTIES, componentInstance.getUniqueId());
+ componentInstance.getUniqueId());
}
StorageOperationStatus status = addToscaDataDeepElementsBlockToToscaElement(updatedContainer.getUniqueId(),
EdgeLabelEnum.INST_PROPERTIES, VertexTypeEnum.INST_PROPERTIES, instProperties,
@@ -439,8 +439,7 @@ public class NodeTemplateOperation extends BaseOperation {
public Either<TopologyTemplate, StorageOperationStatus> addComponentInstanceToTopologyTemplate(
TopologyTemplate container, ToscaElement originToscaElement,
- ComponentInstanceDataDefinition componentInstance, GraphVertex metadataVertex, boolean allowDeleted,
- User user) {
+ ComponentInstanceDataDefinition componentInstance, GraphVertex metadataVertex, boolean allowDeleted) {
Either<TopologyTemplate, StorageOperationStatus> result = null;
Either<ToscaElement, StorageOperationStatus> updateContainerComponentRes = null;
@@ -728,14 +727,14 @@ public class NodeTemplateOperation extends BaseOperation {
private StorageOperationStatus deleteComponentInstanceToscaDataFromContainerComponent(GraphVertex containerV, String componentInstanceId) {
StorageOperationStatus status = deleteToscaDataDeepElementsBlockToToscaElement(containerV, EdgeLabelEnum.CALCULATED_CAPABILITIES,
- VertexTypeEnum.CALCULATED_CAPABILITIES, componentInstanceId);
+ componentInstanceId);
if (status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to remove calculated capabilty for instance {} in container {}. error {] ",
componentInstanceId, containerV.getUniqueId(), status);
return status;
}
status = deleteToscaDataDeepElementsBlockToToscaElement(containerV, EdgeLabelEnum.CALCULATED_CAP_PROPERTIES,
- VertexTypeEnum.CALCULATED_CAP_PROPERTIES, componentInstanceId);
+ componentInstanceId);
if (status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG,
"Failed to remove calculated capabilty properties for instance {} in container {}. error {] ", componentInstanceId,
@@ -743,7 +742,7 @@ public class NodeTemplateOperation extends BaseOperation {
return status;
}
status = deleteToscaDataDeepElementsBlockToToscaElement(containerV, EdgeLabelEnum.CALCULATED_REQUIREMENTS,
- VertexTypeEnum.CALCULATED_REQUIREMENTS, componentInstanceId);
+ componentInstanceId);
if (status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND) {
CommonUtility
.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to remove calculated requirement for instance {} in container {}. error {] ",
@@ -751,7 +750,7 @@ public class NodeTemplateOperation extends BaseOperation {
return status;
}
status = deleteToscaDataDeepElementsBlockToToscaElement(containerV, EdgeLabelEnum.FULLFILLED_CAPABILITIES,
- VertexTypeEnum.FULLFILLED_CAPABILITIES, componentInstanceId);
+ componentInstanceId);
if (status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND) {
CommonUtility
.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to remove fullfilled capabilities for instance {} in container {}. error {] ",
@@ -759,35 +758,35 @@ public class NodeTemplateOperation extends BaseOperation {
return status;
}
status = deleteToscaDataDeepElementsBlockToToscaElement(containerV, EdgeLabelEnum.FULLFILLED_REQUIREMENTS,
- VertexTypeEnum.FULLFILLED_REQUIREMENTS, componentInstanceId);
+ componentInstanceId);
if (status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND) {
CommonUtility
.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to remove fullfilled requirement for instance {} in container {}. error {] ",
componentInstanceId, containerV.getUniqueId(), status);
return status;
}
- status = deleteToscaDataDeepElementsBlockToToscaElement(containerV, EdgeLabelEnum.INST_ATTRIBUTES, VertexTypeEnum.INST_ATTRIBUTES,
+ status = deleteToscaDataDeepElementsBlockToToscaElement(containerV, EdgeLabelEnum.INST_ATTRIBUTES,
componentInstanceId);
if (status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to remove attributes for instance {} in container {}. error {] ",
componentInstanceId, containerV.getUniqueId(), status);
return status;
}
- status = deleteToscaDataDeepElementsBlockToToscaElement(containerV, EdgeLabelEnum.INST_PROPERTIES, VertexTypeEnum.INST_PROPERTIES,
+ status = deleteToscaDataDeepElementsBlockToToscaElement(containerV, EdgeLabelEnum.INST_PROPERTIES,
componentInstanceId);
if (status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to remove properties for instance {} in container {}. error {] ",
componentInstanceId, containerV.getUniqueId(), status);
return status;
}
- status = deleteToscaDataDeepElementsBlockToToscaElement(containerV, EdgeLabelEnum.INST_INPUTS, VertexTypeEnum.INST_INPUTS,
+ status = deleteToscaDataDeepElementsBlockToToscaElement(containerV, EdgeLabelEnum.INST_INPUTS,
componentInstanceId);
if (status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to remove instance inputs for instance {} in container {}. error {] ",
componentInstanceId, containerV.getUniqueId(), status);
return status;
}
- status = deleteToscaDataDeepElementsBlockToToscaElement(containerV, EdgeLabelEnum.INST_GROUPS, VertexTypeEnum.INST_GROUPS,
+ status = deleteToscaDataDeepElementsBlockToToscaElement(containerV, EdgeLabelEnum.INST_GROUPS,
componentInstanceId);
if (status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND) {
CommonUtility
@@ -796,21 +795,21 @@ public class NodeTemplateOperation extends BaseOperation {
return status;
}
status = deleteToscaDataDeepElementsBlockToToscaElement(containerV, EdgeLabelEnum.INST_DEPLOYMENT_ARTIFACTS,
- VertexTypeEnum.INST_DEPLOYMENT_ARTIFACTS, componentInstanceId);
+ componentInstanceId);
if (status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND) {
CommonUtility
.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to remove instance deployment artifacts for instance {} in container {}. error {] ",
componentInstanceId, containerV.getUniqueId(), status);
return status;
}
- status = deleteToscaDataDeepElementsBlockToToscaElement(containerV, EdgeLabelEnum.INSTANCE_ARTIFACTS, VertexTypeEnum.INSTANCE_ARTIFACTS,
+ status = deleteToscaDataDeepElementsBlockToToscaElement(containerV, EdgeLabelEnum.INSTANCE_ARTIFACTS,
componentInstanceId);
if (status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to remove instance artifacts for instance {} in container {}. error {] ",
componentInstanceId, containerV.getUniqueId(), status);
return status;
}
- status = deleteToscaDataDeepElementsBlockToToscaElement(containerV, EdgeLabelEnum.EXTERNAL_REFS, VertexTypeEnum.EXTERNAL_REF,
+ status = deleteToscaDataDeepElementsBlockToToscaElement(containerV, EdgeLabelEnum.EXTERNAL_REFS,
componentInstanceId);
if (status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND) {
CommonUtility
@@ -819,7 +818,7 @@ public class NodeTemplateOperation extends BaseOperation {
return status;
}
status = deleteToscaDataDeepElementsBlockToToscaElement(containerV, EdgeLabelEnum.INST_INTERFACES,
- VertexTypeEnum.INST_INTERFACES, componentInstanceId);
+ componentInstanceId);
if (status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG,
"Failed to remove service instance interfaces for instance {} in container {}. " +
@@ -1191,7 +1190,10 @@ public class NodeTemplateOperation extends BaseOperation {
listRequirementDataDefinition.getListToscaDataDefinition().stream()
.filter(e -> requirementDataDefinition.getOwnerId().equals(e.getOwnerId()) && requirementDataDefinition.getName().equals(e.getName()))
- .forEach(r -> {r.setExternal(requirementDataDefinition.isExternal()); r.setExternalName(requirementDataDefinition.getExternalName());});
+ .forEach(r -> {
+ r.setExternal(requirementDataDefinition.isExternal());
+ r.setExternalName(requirementDataDefinition.getExternalName());
+ });
return updateCalculatedReqOnGraph(componentId, containerV, existingReqs);
}
@@ -1474,7 +1476,7 @@ public class NodeTemplateOperation extends BaseOperation {
Optional<GroupDefinition> groupOptional = groups.stream().filter(g -> g.getUniqueId().equals(groupArtifacts.getKey())).findFirst();
if (groupOptional.isPresent()) {
GroupInstanceDataDefinition groupInstance = buildGroupInstanceDataDefinition((GroupDataDefinition) groupOptional.get(),
- (ComponentInstanceDataDefinition) componentInstance, null);
+ (ComponentInstanceDataDefinition) componentInstance);
groupInstance.setGroupInstanceArtifacts(
groupArtifacts.getValue().stream().map(ArtifactDataDefinition::getUniqueId).collect(Collectors.toList()));
groupInstance.setGroupInstanceArtifactsUuid(
@@ -1522,7 +1524,7 @@ public class NodeTemplateOperation extends BaseOperation {
dataDefinition.setIcon(resourceInstance.getIcon());
if (generateUid) {
dataDefinition.setUniqueId(
- UniqueIdBuilder.buildResourceInstanceUniuqeId(containerComponentId, ciOriginComponentUid, dataDefinition.getNormalizedName()));
+ UniqueIdBuilder.buildResourceInstanceUniqueId(containerComponentId, ciOriginComponentUid, dataDefinition.getNormalizedName()));
resourceInstance.setUniqueId(dataDefinition.getUniqueId());
}
if (StringUtils.isEmpty(dataDefinition.getComponentVersion()) && originToscaElement != null) {
@@ -1560,17 +1562,17 @@ public class NodeTemplateOperation extends BaseOperation {
private String buildComponentInstanceName(String instanceSuffixNumber, String instanceName) {
String delimiter = ConfigurationManager.getConfigurationManager().getConfiguration().getComponentInstanceCounterDelimiter();
- if(delimiter == null){
+ if (delimiter == null) {
delimiter = " ";
}
return instanceName + delimiter + (instanceSuffixNumber == null ? 0 : instanceSuffixNumber);
}
- public Either<RequirementCapabilityRelDef, StorageOperationStatus> associateResourceInstances(Component component, String componentId,
+ public Either<RequirementCapabilityRelDef, StorageOperationStatus> associateResourceInstances(String componentId,
RequirementCapabilityRelDef relation) {
List<RequirementCapabilityRelDef> relations = new ArrayList<>();
relations.add(relation);
- Either<List<RequirementCapabilityRelDef>, StorageOperationStatus> associateResourceInstances = associateResourceInstances(component,
+ Either<List<RequirementCapabilityRelDef>, StorageOperationStatus> associateResourceInstances = associateResourceInstances(
componentId, relations);
if (associateResourceInstances.isRight()) {
return Either.right(associateResourceInstances.right().value());
@@ -1580,7 +1582,7 @@ public class NodeTemplateOperation extends BaseOperation {
@SuppressWarnings({"unchecked"})
public <T extends ToscaDataDefinition> Either<List<RequirementCapabilityRelDef>, StorageOperationStatus> associateResourceInstances(
- Component component, String componentId, List<RequirementCapabilityRelDef> relations) {
+ String componentId, List<RequirementCapabilityRelDef> relations) {
Either<GraphVertex, JanusGraphOperationStatus> containerVEither = janusGraphDao.getVertexById(componentId, JsonParseFlagEnum.ParseAll);
if (containerVEither.isRight()) {
JanusGraphOperationStatus error = containerVEither.right().value();
@@ -2409,7 +2411,7 @@ public class NodeTemplateOperation extends BaseOperation {
private RelationshipInstDataDefinition buildRelationshipInstData(String fromResInstanceUid, String toInstId, RelationshipInfo relationPair,
boolean originUI) {
RelationshipInstDataDefinition relationshipInstData = new RelationshipInstDataDefinition();
- relationshipInstData.setUniqueId(UniqueIdBuilder.buildRelationsipInstInstanceUid(fromResInstanceUid, toInstId));
+ relationshipInstData.setUniqueId(UniqueIdBuilder.buildRelationshipInstInstanceUid());
relationshipInstData.setType(relationPair.getRelationship().getType());
Long creationDate = System.currentTimeMillis();
relationshipInstData.setCreationTime(creationDate);
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 4995bdc642..c450457855 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
@@ -419,8 +419,8 @@ public class TopologyTemplateOperation extends ToscaElementOperation {
List<String> uniqueKeys = new ArrayList<>(i.getValue().getMapToscaDataDefinition().keySet());
List<String> pathKeys = new ArrayList<>();
pathKeys.add(i.getKey());
- StorageOperationStatus status = deleteToscaDataDeepElements(nodeTypeVertex, EdgeLabelEnum.INST_INPUTS, VertexTypeEnum.INST_INPUTS,
- uniqueKeys, pathKeys, JsonPresentationFields.NAME);
+ StorageOperationStatus status = deleteToscaDataDeepElements(nodeTypeVertex, EdgeLabelEnum.INST_INPUTS,
+ uniqueKeys, pathKeys);
if (status != StorageOperationStatus.OK) {
return;
}
@@ -1576,7 +1576,7 @@ public class TopologyTemplateOperation extends ToscaElementOperation {
}
public StorageOperationStatus removePolicyFromToscaElement(GraphVertex componentV, String policyId) {
- return deleteToscaDataElement(componentV, EdgeLabelEnum.POLICIES, VertexTypeEnum.POLICIES, policyId, JsonPresentationFields.UNIQUE_ID);
+ return deleteToscaDataElement(componentV, EdgeLabelEnum.POLICIES, policyId);
}
public StorageOperationStatus updateGroupOfToscaElement(GraphVertex componentV, GroupDefinition groupDefinition) {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementLifecycleOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementLifecycleOperation.java
index cf2db79871..3ee79e73ef 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementLifecycleOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementLifecycleOperation.java
@@ -62,7 +62,6 @@ import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
import org.openecomp.sdc.be.datatypes.enums.ModelTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum;
-import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
import org.openecomp.sdc.be.model.DistributionStatusEnum;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.be.model.Model;
@@ -88,7 +87,6 @@ public class ToscaElementLifecycleOperation extends BaseOperation {
public static final String VERSION_DELIMITER = ".";
public static final String VERSION_DELIMITER_REGEXP = "\\.";
- private static final String FAILED_TO_DELETE_LAST_STATE_EDGE_STATUS_IS = "Failed to delete last state edge. Status is {}. ";
private static final String FAILED_TO_GET_VERTICES = "Failed to get vertices by id {}. Status is {}. ";
private static final Logger log = Logger.getLogger(ToscaElementLifecycleOperation.class);
private final ModelOperation modelOperation;
@@ -132,7 +130,7 @@ public class ToscaElementLifecycleOperation extends BaseOperation {
try {
return janusGraphDao.getVerticesByUniqueIdAndParseFlag(prepareParametersToGetVerticesForCheckin(toscaElementId, modifierId, ownerId))
.right().map(status -> handleFailureToPrepareParameters(status, toscaElementId)).left().bind(
- verticesMap -> checkinToscaELement(currState, verticesMap.get(toscaElementId), verticesMap.get(ownerId),
+ verticesMap -> checkinToscaELement(verticesMap.get(toscaElementId), verticesMap.get(ownerId),
verticesMap.get(modifierId), LifecycleStateEnum.NOT_CERTIFIED_CHECKIN).left().bind(checkinResult -> {
//We retrieve the operation
ToscaElementOperation operation = getToscaElementOperation(verticesMap.get(toscaElementId).getLabel());
@@ -236,9 +234,10 @@ public class ToscaElementLifecycleOperation extends BaseOperation {
public Either<ToscaElement, StorageOperationStatus> undoCheckout(String toscaElementId, String model) {
try {
return janusGraphDao.getVertexById(toscaElementId, JsonParseFlagEnum.ParseMetadata).right().map(errorStatus -> {
- CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_VERTICES, toscaElementId);
- return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(errorStatus);
- }).left().bind(this::retrieveAndUpdatePreviousVersion).left().bind(tuple -> updateEdgeToCatalogRootAndReturnPreVersionElement(tuple, model));
+ CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_VERTICES, toscaElementId);
+ return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(errorStatus);
+ }).left().bind(this::retrieveAndUpdatePreviousVersion).left()
+ .bind(tuple -> updateEdgeToCatalogRootAndReturnPreVersionElement(tuple, model));
} catch (Exception e) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Exception occurred during undo checkout tosca element {}. {}", toscaElementId,
e.getMessage());
@@ -324,7 +323,7 @@ public class ToscaElementLifecycleOperation extends BaseOperation {
private Either<ToscaElement, StorageOperationStatus> handleRelationsBeforeCertifyingAndProcessClone(GraphVertex toscaElement,
GraphVertex modifier, Integer majorVersion) {
- StorageOperationStatus status = handleRelationsOfPreviousToscaElementBeforeCertifying(toscaElement, modifier, majorVersion);
+ StorageOperationStatus status = handleRelationsOfPreviousToscaElementBeforeCertifying(toscaElement, majorVersion);
if (status != StorageOperationStatus.OK) {
return Either.right(logDebugMessageAndReturnStorageOperationStatus(status,
"Failed to handle relations of previous tosca element before certifying {}. Status is {}. ", toscaElement.getUniqueId(), status));
@@ -384,7 +383,7 @@ public class ToscaElementLifecycleOperation extends BaseOperation {
return result;
}
- private StorageOperationStatus handleRelationsOfPreviousToscaElementBeforeCertifying(GraphVertex toscaElement, GraphVertex modifier,
+ private StorageOperationStatus handleRelationsOfPreviousToscaElementBeforeCertifying(GraphVertex toscaElement,
Integer majorVersion) {
StorageOperationStatus result = null;
if (majorVersion > 0) {
@@ -440,10 +439,7 @@ public class ToscaElementLifecycleOperation extends BaseOperation {
private boolean isCertifiedVersion(String version) {
String[] versionParts = version.split(VERSION_DELIMITER_REGEXP);
- if (Integer.parseInt(versionParts[0]) > 0 && Integer.parseInt(versionParts[1]) == 0) {
- return true;
- }
- return false;
+ return Integer.parseInt(versionParts[0]) > 0 && Integer.parseInt(versionParts[1]) == 0;
}
private StorageOperationStatus updateOldToscaElementBeforeUndoCheckout(Vertex previousVersionToscaElement) {
@@ -783,7 +779,7 @@ public class ToscaElementLifecycleOperation extends BaseOperation {
Map<String, GroupInstanceDataDefinition> groupInstanceToCreate = new HashMap<>();
for (GroupDataDefinition group : filteredGroups) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "create new groupInstance {} ", group.getName());
- GroupInstanceDataDefinition groupInstance = buildGroupInstanceDataDefinition(group, vfInst, instDeplArtifMap);
+ GroupInstanceDataDefinition groupInstance = buildGroupInstanceDataDefinition(group, vfInst);
List<String> artifactsUid = new ArrayList<>();
List<String> artifactsId = new ArrayList<>();
if (instDeplArtifMap != null) {
@@ -842,7 +838,7 @@ public class ToscaElementLifecycleOperation extends BaseOperation {
ConfigurationManager.getConfigurationManager().getConfiguration().getToscaConformanceLevel());
}
if (!MapUtils.isEmpty(toscaElementVertex.getJson())) {
- nextVersionToscaElementVertex.setJson(new HashMap<String, ToscaDataDefinition>(toscaElementVertex.getJson()));
+ nextVersionToscaElementVertex.setJson(new HashMap<>(toscaElementVertex.getJson()));
}
return nextVersionToscaElementVertex;
}
@@ -899,7 +895,9 @@ public class ToscaElementLifecycleOperation extends BaseOperation {
if (status != JanusGraphOperationStatus.OK) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG,
"Failed to create edge with label {} from vertex {} to tosca element vertex {} on graph. Status is {}. ",
- EdgeLabelEnum.VERSION, null != previousCertifiedToscaElement ? previousCertifiedToscaElement.property(GraphPropertyEnum.UNIQUE_ID.getProperty()) : null,
+ EdgeLabelEnum.VERSION,
+ null != previousCertifiedToscaElement ? previousCertifiedToscaElement.property(GraphPropertyEnum.UNIQUE_ID.getProperty())
+ : null,
clonedToscaElement.getUniqueId(), status);
result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
@@ -978,16 +976,16 @@ public class ToscaElementLifecycleOperation extends BaseOperation {
nextVersionToscaElementVertex.updateMetadataJsonWithCurrentMetadataProperties();
}
if (!MapUtils.isEmpty(toscaElementVertex.getJson())) {
- nextVersionToscaElementVertex.setJson(new HashMap<String, ToscaDataDefinition>(toscaElementVertex.getJson()));
+ nextVersionToscaElementVertex.setJson(new HashMap<>(toscaElementVertex.getJson()));
}
return nextVersionToscaElementVertex;
}
- private Either<GraphVertex, StorageOperationStatus> checkinToscaELement(LifecycleStateEnum currState, GraphVertex toscaElementVertex,
+ private Either<GraphVertex, StorageOperationStatus> checkinToscaELement(GraphVertex toscaElementVertex,
GraphVertex ownerVertex, GraphVertex modifierVertex,
LifecycleStateEnum nextState) {
Either<GraphVertex, StorageOperationStatus> updateRelationsRes;
- Either<GraphVertex, StorageOperationStatus> result = changeStateToCheckedIn(currState, toscaElementVertex, ownerVertex, modifierVertex);
+ Either<GraphVertex, StorageOperationStatus> result = changeStateToCheckedIn(toscaElementVertex, ownerVertex, modifierVertex);
if (result.isLeft()) {
toscaElementVertex.addMetadataProperty(GraphPropertyEnum.STATE, nextState.name());
toscaElementVertex.setJsonMetadataField(JsonPresentationFields.LAST_UPDATE_DATE, System.currentTimeMillis());
@@ -1016,7 +1014,7 @@ public class ToscaElementLifecycleOperation extends BaseOperation {
return result;
}
- private Either<GraphVertex, StorageOperationStatus> changeStateToCheckedIn(LifecycleStateEnum currState, GraphVertex toscaElementVertex,
+ private Either<GraphVertex, StorageOperationStatus> changeStateToCheckedIn(GraphVertex toscaElementVertex,
GraphVertex ownerVertex, GraphVertex modifierVertex) {
Either<GraphVertex, StorageOperationStatus> result = null;
LifecycleStateEnum nextState = LifecycleStateEnum.NOT_CERTIFIED_CHECKIN;
@@ -1201,7 +1199,7 @@ public class ToscaElementLifecycleOperation extends BaseOperation {
if (preV == null) {
return updateEdgeToCatalogRoot(null, curV);
}
- String uniqueIdPreVer = (String) janusGraphDao.getProperty((JanusGraphVertex) preV, GraphPropertyEnum.UNIQUE_ID.getProperty());
+ String uniqueIdPreVer = (String) janusGraphDao.getProperty(preV, GraphPropertyEnum.UNIQUE_ID.getProperty());
LifecycleStateEnum state = LifecycleStateEnum.findState((String) janusGraphDao.getProperty(preV, GraphPropertyEnum.STATE.getProperty()));
if (state == LifecycleStateEnum.CERTIFIED) {
return updateEdgeToCatalogRoot(null, curV);
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java
index b35ae1ec8c..ceb505ac3c 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java
@@ -44,7 +44,6 @@ import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.DataTypeDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition;
-import org.openecomp.sdc.be.datatypes.elements.InputDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ListCapabilityDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ListRequirementDataDefinition;
@@ -55,7 +54,6 @@ 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.OperationDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.RequirementDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
@@ -92,7 +90,6 @@ 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.UploadInterfaceInfo;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.catalog.CatalogComponent;
import org.openecomp.sdc.be.model.jsonjanusgraph.config.ContainerInstanceTypesData;
@@ -684,7 +681,7 @@ public class ToscaOperationFacade {
public Either<List<RequirementCapabilityRelDef>, StorageOperationStatus> associateResourceInstances(Component component, String componentId,
List<RequirementCapabilityRelDef> relations) {
Either<List<RequirementCapabilityRelDef>, StorageOperationStatus> reqAndCapListEither = nodeTemplateOperation
- .associateResourceInstances(component, componentId, relations);
+ .associateResourceInstances(componentId, relations);
if (component != null) {
updateInstancesCapAndReqOnComponentFromDB(component);
}
@@ -1347,7 +1344,6 @@ public class ToscaOperationFacade {
maxCounter = currCounter;
}
} catch (NumberFormatException e) {
- continue;
}
}
return currCounter == null ? null : maxCounter;
@@ -1355,7 +1351,7 @@ public class ToscaOperationFacade {
public Either<RequirementCapabilityRelDef, StorageOperationStatus> associateResourceInstances(Component component, String componentId,
RequirementCapabilityRelDef requirementDef) {
- return nodeTemplateOperation.associateResourceInstances(component, componentId, requirementDef);
+ return nodeTemplateOperation.associateResourceInstances(componentId, requirementDef);
}
public Either<List<InputDefinition>, StorageOperationStatus> createAndAssociateInputs(Map<String, InputDefinition> inputs, String componentId) {
@@ -3172,7 +3168,7 @@ public class ToscaOperationFacade {
String componentInstanceId) {
String uniqueId = componentInstance.getUniqueId();
StorageOperationStatus status = nodeTemplateOperation
- .deleteToscaDataDeepElementsBlockOfToscaElement(containerComponent.getUniqueId(), EdgeLabelEnum.INST_GROUPS, VertexTypeEnum.INST_GROUPS,
+ .deleteToscaDataDeepElementsBlockOfToscaElement(containerComponent.getUniqueId(), EdgeLabelEnum.INST_GROUPS,
uniqueId);
if (status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND) {
CommonUtility
@@ -3335,7 +3331,7 @@ public class ToscaOperationFacade {
final Component component) {
final boolean match = component.getInterfaces().keySet().stream().anyMatch(s -> s.equals(interfaceName));
- StorageOperationStatus status = StorageOperationStatus.OK;
+ StorageOperationStatus status;
final ToscaElementOperation toscaElementOperation = getToscaElementOperation(component);
if (match) {
status = toscaElementOperation.updateToscaDataOfToscaElement(component.getUniqueId(), EdgeLabelEnum.INTERFACE_ARTIFACTS,
@@ -3382,14 +3378,14 @@ public class ToscaOperationFacade {
public StorageOperationStatus deleteAllCalculatedCapabilitiesRequirements(String topologyTemplateId) {
StorageOperationStatus status = topologyTemplateOperation
- .removeToscaData(topologyTemplateId, EdgeLabelEnum.CALCULATED_CAPABILITIES, VertexTypeEnum.CALCULATED_CAPABILITIES);
+ .removeToscaData(topologyTemplateId, EdgeLabelEnum.CALCULATED_CAPABILITIES);
if (status == StorageOperationStatus.OK) {
status = topologyTemplateOperation
- .removeToscaData(topologyTemplateId, EdgeLabelEnum.CALCULATED_REQUIREMENTS, VertexTypeEnum.CALCULATED_REQUIREMENTS);
+ .removeToscaData(topologyTemplateId, EdgeLabelEnum.CALCULATED_REQUIREMENTS);
}
if (status == StorageOperationStatus.OK) {
status = topologyTemplateOperation
- .removeToscaData(topologyTemplateId, EdgeLabelEnum.CALCULATED_CAP_PROPERTIES, VertexTypeEnum.CALCULATED_CAP_PROPERTIES);
+ .removeToscaData(topologyTemplateId, EdgeLabelEnum.CALCULATED_CAP_PROPERTIES);
}
return status;
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/normatives/ToscaTypeMetadata.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/normatives/ToscaTypeMetadata.java
index 161e901b7b..ce6b1f4392 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/normatives/ToscaTypeMetadata.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/normatives/ToscaTypeMetadata.java
@@ -19,32 +19,18 @@
*/
package org.openecomp.sdc.be.model.normatives;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+@Getter
+@Setter
+@NoArgsConstructor
+@AllArgsConstructor
public class ToscaTypeMetadata {
private String icon;
private String displayName;
- public ToscaTypeMetadata() {
- }
-
- public ToscaTypeMetadata(String icon, String displayName) {
- this.icon = icon;
- this.displayName = displayName;
- }
-
- public String getIcon() {
- return icon;
- }
-
- public void setIcon(String icon) {
- this.icon = icon;
- }
-
- public String getDisplayName() {
- return displayName;
- }
-
- public void setDisplayName(String displayName) {
- this.displayName = displayName;
- }
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/AttributeOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/AttributeOperation.java
index 685dc85675..2aabee4102 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/AttributeOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/AttributeOperation.java
@@ -109,12 +109,14 @@ public class AttributeOperation extends AbstractOperation {
return Either.right(propertiesStatus);
}
final Either<ImmutablePair<DataTypeData, GraphEdge>, JanusGraphOperationStatus> parentNode = janusGraphGenericDao
- .getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.DataType), uniqueId, GraphEdgeLabels.DERIVED_FROM, NodeTypeEnum.DataType, DataTypeData.class);
+ .getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.DataType), uniqueId, GraphEdgeLabels.DERIVED_FROM, NodeTypeEnum.DataType,
+ DataTypeData.class);
log.debug("After retrieving DERIVED_FROM node of {}. status is {}", uniqueId, parentNode);
if (parentNode.isRight()) {
final JanusGraphOperationStatus janusGraphOperationStatus = parentNode.right().value();
if (janusGraphOperationStatus != JanusGraphOperationStatus.NOT_FOUND) {
- log.error(EcompLoggerErrorCode.BUSINESS_PROCESS_ERROR, "Failed to find the parent data type of data type {}. status is {}", uniqueId, janusGraphOperationStatus);
+ log.error(EcompLoggerErrorCode.BUSINESS_PROCESS_ERROR, "Failed to find the parent data type of data type {}. status is {}", uniqueId,
+ janusGraphOperationStatus);
return Either.right(janusGraphOperationStatus);
}
} else {
@@ -133,7 +135,8 @@ public class AttributeOperation extends AbstractOperation {
}
private JanusGraphOperationStatus fillProperties(final String uniqueId, final DataTypeDefinition dataTypeDefinition) {
- final Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> findPropertiesOfNode = this.findPropertiesOfNode(NodeTypeEnum.DataType, uniqueId);
+ final Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> findPropertiesOfNode = findPropertiesOfNode(NodeTypeEnum.DataType,
+ uniqueId);
if (findPropertiesOfNode.isRight()) {
final JanusGraphOperationStatus janusGraphOperationStatus = findPropertiesOfNode.right().value();
log.debug("After looking for properties of vertex {}. status is {}", uniqueId, janusGraphOperationStatus);
@@ -163,7 +166,8 @@ public class AttributeOperation extends AbstractOperation {
final String uniqueId) {
final Map<String, PropertyDefinition> resourceProps = new HashMap<>();
final Either<List<ImmutablePair<PropertyData, GraphEdge>>, JanusGraphOperationStatus> childrenNodes = janusGraphGenericDao
- .getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(nodeType), uniqueId, GraphEdgeLabels.PROPERTY, NodeTypeEnum.Property, PropertyData.class);
+ .getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(nodeType), uniqueId, GraphEdgeLabels.PROPERTY, NodeTypeEnum.Property,
+ PropertyData.class);
if (childrenNodes.isRight()) {
final JanusGraphOperationStatus operationStatus = childrenNodes.right().value();
return Either.right(operationStatus);
@@ -300,7 +304,8 @@ public class AttributeOperation extends AbstractOperation {
return StorageOperationStatus.INVALID_VALUE;
}
final JsonElement jsonElement = validateResult.left;
- log.trace("Going to update value in attribute definition {} {}", attributeDefinition.getName(), (jsonElement != null ? jsonElement.toString() : null));
+ log.trace("Going to update value in attribute definition {} {}", attributeDefinition.getName(),
+ (jsonElement != null ? jsonElement.toString() : null));
updateAttributeValue(attributeDefinition, jsonElement);
return StorageOperationStatus.OK;
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupTypeOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupTypeOperation.java
index 621ba97cb3..4b198046d0 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupTypeOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupTypeOperation.java
@@ -70,7 +70,7 @@ import org.springframework.stereotype.Component;
@Component("group-type-operation")
public class GroupTypeOperation implements IGroupTypeOperation {
- private static final Logger log = Logger.getLogger(GroupTypeOperation.class.getName());
+ private static final Logger log = Logger.getLogger(GroupTypeOperation.class);
private static final String CREATE_FLOW_CONTEXT = "CreateGroupType";
private final PropertyOperation propertyOperation;
private final JanusGraphGenericDao janusGraphGenericDao;
@@ -146,10 +146,11 @@ public class GroupTypeOperation implements IGroupTypeOperation {
return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(error));
}
- private Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> getAllGroupTypePropertiesFromAllDerivedFrom(String firstParentType, String modelName) {
- return janusGraphGenericDao.getNode(GraphPropertiesDictionary.TYPE.getProperty(), firstParentType, GroupTypeData.class, modelName).left().bind(
- parentGroup -> propertyOperation
- .getAllTypePropertiesFromAllDerivedFrom(parentGroup.getUniqueId(), NodeTypeEnum.GroupType, GroupTypeData.class));
+ private Either<Map<String, PropertyDefinition>, JanusGraphOperationStatus> getAllGroupTypePropertiesFromAllDerivedFrom(String firstParentType,
+ String modelName) {
+ return janusGraphGenericDao.getNode(GraphPropertiesDictionary.TYPE.getProperty(), firstParentType, GroupTypeData.class, modelName).left()
+ .bind(parentGroup ->
+ propertyOperation.getAllTypePropertiesFromAllDerivedFrom(parentGroup.getUniqueId(), NodeTypeEnum.GroupType, GroupTypeData.class));
}
private StorageOperationStatus mergeCapabilities(GroupTypeDefinition groupTypeDef) {
@@ -313,14 +314,14 @@ public class GroupTypeOperation implements IGroupTypeOperation {
}
public Either<GroupTypeDefinition, StorageOperationStatus> getLatestGroupTypeByType(String type, String model) {
- return getLatestGroupTypeByType(type, model, true);
+ return getLatestGroupTypeByType(type, model, true);
}
public Either<GroupTypeDefinition, StorageOperationStatus> getLatestGroupTypeByType(String type, String model, boolean inTransaction) {
Map<String, Object> mapCriteria = new HashMap<>();
mapCriteria.put(GraphPropertiesDictionary.TYPE.getProperty(), type);
mapCriteria.put(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty(), true);
- return getGroupTypeByCriteria(type, mapCriteria, model, inTransaction);
+ return getGroupTypeByCriteria(type, mapCriteria, model, inTransaction);
}
public Either<GroupTypeDefinition, StorageOperationStatus> getGroupTypeByCriteria(String type, Map<String, Object> properties,
@@ -333,7 +334,7 @@ public class GroupTypeOperation implements IGroupTypeOperation {
result = Either.right(StorageOperationStatus.INVALID_ID);
return result;
}
- Either<List<GroupTypeData>, StorageOperationStatus> groupTypeEither = janusGraphGenericDao
+ Either<List<GroupTypeData>, StorageOperationStatus> groupTypeEither = janusGraphGenericDao
.getByCriteriaForModel(NodeTypeEnum.GroupType, properties, model, GroupTypeData.class).right()
.map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus);
if (groupTypeEither.isRight()) {
@@ -352,7 +353,7 @@ public class GroupTypeOperation implements IGroupTypeOperation {
private Either<GroupTypeDefinition, StorageOperationStatus> buildGroupTypeDefinition(String uniqueId, GroupTypeData groupTypeNode) {
GroupTypeDefinition groupType = new GroupTypeDefinition(groupTypeNode.getGroupTypeDataDefinition());
Optional<String> modelName = getAssociatedModelName(uniqueId);
- if(modelName.isPresent()) {
+ if (modelName.isPresent()) {
groupType.setModel(modelName.get());
}
return fillDerivedFrom(uniqueId, groupType).left().map(derivedFrom -> fillProperties(uniqueId, groupType, derivedFrom)).left()
@@ -363,7 +364,7 @@ public class GroupTypeOperation implements IGroupTypeOperation {
final Either<ImmutablePair<ModelData, GraphEdge>, JanusGraphOperationStatus> modelName = janusGraphGenericDao.getParentNode(
UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.GroupType), uniqueId, GraphEdgeLabels.MODEL_ELEMENT,
NodeTypeEnum.Model, ModelData.class);
- if(modelName.isRight()) {
+ if (modelName.isRight()) {
return Optional.empty();
}
return Optional.ofNullable(modelName.left().value().getLeft().getName());
@@ -432,7 +433,8 @@ public class GroupTypeOperation implements IGroupTypeOperation {
return getGroupTypeByTypeAndVersion(type, version, model, false);
}
- public Either<GroupTypeDefinition, StorageOperationStatus> getGroupTypeByTypeAndVersion(String type, String version, String model, boolean inTransaction) {
+ public Either<GroupTypeDefinition, StorageOperationStatus> getGroupTypeByTypeAndVersion(String type, String version, String model,
+ boolean inTransaction) {
Map<String, Object> mapCriteria = new HashMap<>();
mapCriteria.put(GraphPropertiesDictionary.TYPE.getProperty(), type);
mapCriteria.put(GraphPropertiesDictionary.VERSION.getProperty(), version);
@@ -454,7 +456,7 @@ public class GroupTypeOperation implements IGroupTypeOperation {
private Either<GroupTypeData, StorageOperationStatus> addGroupTypeToGraph(GroupTypeDefinition groupTypeDefinition) {
log.debug("Got group type {}", groupTypeDefinition);
String gtUniqueId = UniqueIdBuilder.buildGroupTypeUid(groupTypeDefinition.getModel(), groupTypeDefinition.getType(),
- groupTypeDefinition.getVersion(), "grouptype");
+ groupTypeDefinition.getVersion());
GroupTypeData groupTypeData = buildGroupTypeData(groupTypeDefinition, gtUniqueId);
log.debug("Before adding group type to graph. groupTypeData = {}", groupTypeData);
Either<GroupTypeData, JanusGraphOperationStatus> createGTResult = janusGraphGenericDao.createNode(groupTypeData, GroupTypeData.class);
@@ -501,7 +503,7 @@ public class GroupTypeOperation implements IGroupTypeOperation {
final GraphNode from = new UniqueIdData(NodeTypeEnum.Model, UniqueIdBuilder.buildModelUid(model));
final GraphNode to = new UniqueIdData(NodeTypeEnum.GroupType, groupTypeDefinition.getUniqueId());
log.info("Connecting model {} to type {}", from, to);
- return janusGraphGenericDao.createRelation(from , to, GraphEdgeLabels.MODEL_ELEMENT, Collections.emptyMap());
+ return janusGraphGenericDao.createRelation(from, to, GraphEdgeLabels.MODEL_ELEMENT, Collections.emptyMap());
}
private Either<GraphRelation, JanusGraphOperationStatus> connectToDerivedFrom(String ctUniqueId, String derivedFrom) {
@@ -620,7 +622,8 @@ public class GroupTypeOperation implements IGroupTypeOperation {
log.debug(
"#updateGroupDerivedFrom - updating group derived from relation for group type with id {}. old derived type {}. new derived type {}",
groupTypeId, currDerivedFromGroupType, updatedGroupType.getDerivedFrom());
- StorageOperationStatus deleteDerivedRelationStatus = deleteDerivedFromGroupType(groupTypeId, currDerivedFromGroupType, updatedGroupType.getModel());
+ StorageOperationStatus deleteDerivedRelationStatus = deleteDerivedFromGroupType(groupTypeId, currDerivedFromGroupType,
+ updatedGroupType.getModel());
if (deleteDerivedRelationStatus != StorageOperationStatus.OK) {
return Either.right(deleteDerivedRelationStatus);
}
@@ -649,7 +652,7 @@ public class GroupTypeOperation implements IGroupTypeOperation {
}
log.debug("#deleteDerivedFromGroupType - deleting derivedFrom relation for group type with id {} and its derived type {}", groupTypeId,
derivedFromType);
- return getLatestGroupTypeByType(derivedFromType, model).either(
+ return getLatestGroupTypeByType(derivedFromType, model).either(
derivedFromNode -> derivedFromOperation.removeDerivedFromRelation(groupTypeId, derivedFromNode.getUniqueId(), NodeTypeEnum.GroupType),
err -> err);
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/UniqueIdBuilder.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/UniqueIdBuilder.java
index 225fe6c656..871afe6fa3 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/UniqueIdBuilder.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/UniqueIdBuilder.java
@@ -19,39 +19,36 @@
*/
package org.openecomp.sdc.be.model.operations.impl;
-import java.util.HashMap;
+import java.util.EnumMap;
import java.util.Map;
import java.util.UUID;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
import org.apache.commons.lang.StringUtils;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
-import org.openecomp.sdc.be.resources.data.ResourceCategoryData;
-import org.openecomp.sdc.be.resources.data.ServiceCategoryData;
import org.openecomp.sdc.be.resources.data.TagData;
import org.openecomp.sdc.be.resources.data.UserData;
import org.openecomp.sdc.common.api.Constants;
import org.openecomp.sdc.common.util.ValidationUtils;
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class UniqueIdBuilder {
- private static final String HEAT_PARAM_PREFIX = "heat_";
- private static String DOT = ".";
- private static UserData userData = new UserData();
- private static TagData tagData = new TagData();
- private static ResourceCategoryData resCategoryData = new ResourceCategoryData();
- private static ServiceCategoryData serCategoryData = new ServiceCategoryData();
- private static Map<NodeTypeEnum, String> nodeTypeToUniqueKeyMapper = new HashMap<>();
+ static final String HEAT_PARAM_PREFIX = "heat_";
+ static final String DOT = ".";
+ private static final UserData userData = new UserData();
+ private static final TagData tagData = new TagData();
+ private static final Map<NodeTypeEnum, String> nodeTypeToUniqueKeyMapper = new EnumMap<>(NodeTypeEnum.class);
static {
nodeTypeToUniqueKeyMapper.put(NodeTypeEnum.User, userData.getUniqueIdKey());
nodeTypeToUniqueKeyMapper.put(NodeTypeEnum.Tag, tagData.getUniqueIdKey());
- nodeTypeToUniqueKeyMapper.put(NodeTypeEnum.ResourceCategory, resCategoryData.getUniqueIdKey());
- nodeTypeToUniqueKeyMapper.put(NodeTypeEnum.ServiceCategory, serCategoryData.getUniqueIdKey());
}
public static String buildPropertyUniqueId(String resourceId, String propertyName) {
- return resourceId + DOT + propertyName;
+ return buildUid(resourceId, propertyName);
}
static String buildHeatParameterUniqueId(String resourceId, String propertyName) {
@@ -90,15 +87,15 @@ public class UniqueIdBuilder {
}
public static String buildCapabilityTypeUid(final String modelName, String type) {
- return StringUtils.isEmpty(modelName) ? type : modelName + DOT + type;
+ return StringUtils.isEmpty(modelName) ? type : buildUid(modelName, type);
}
public static String buildRelationshipTypeUid(final String modelName, final String type) {
- return StringUtils.isEmpty(modelName) ? type : modelName + DOT + type;
+ return StringUtils.isEmpty(modelName) ? type : buildUid(modelName, type);
}
public static String buildInterfaceTypeUid(final String modelName, String type) {
- return StringUtils.isEmpty(modelName) ? type : modelName + DOT + type;
+ return StringUtils.isEmpty(modelName) ? type : buildUid(modelName, type);
}
public static String buildAttributeUid(String resourceId, String attName) {
@@ -106,7 +103,7 @@ public class UniqueIdBuilder {
}
public static String buildRequirementUid(String resourceId, String reqName) {
- return resourceId + DOT + reqName;
+ return buildUid(resourceId, reqName);
}
public static String buildCapabilityUid(String resourceId, String capabilityName) {
@@ -121,11 +118,11 @@ public class UniqueIdBuilder {
return buildTypeUid(parentId, instanceId, artifactLabel);
}
- public static String buildResourceInstanceUniuqeId(String serviceId, String resourceId, String logicalName) {
+ public static String buildResourceInstanceUniqueId(String serviceId, String resourceId, String logicalName) {
return buildTypeUid(serviceId, resourceId, logicalName);
}
- public static String buildRelationsipInstInstanceUid(String resourceInstUid, String requirement) {
+ public static String buildRelationshipInstInstanceUid() {
return generateUUID();
}
@@ -140,28 +137,28 @@ public class UniqueIdBuilder {
* TODO Pavel To be removed when new category logic comes in
*/
static String buildServiceCategoryUid(String categoryName, NodeTypeEnum type) {
- return type.getName() + DOT + categoryName;
+ return buildUid(type.getName(), categoryName);
}
// New logic
public static String buildCategoryUid(String categoryName, NodeTypeEnum type) {
- return type.getName() + DOT + categoryName;
+ return buildUid(type.getName(), categoryName);
}
public static String buildComponentCategoryUid(String categoryName, VertexTypeEnum type) {
- return type.getName() + DOT + ValidationUtils.normalizeCategoryName4Uniqueness(categoryName);
+ return buildUid(type.getName(), ValidationUtils.normalizeCategoryName4Uniqueness(categoryName));
}
public static String buildSubCategoryUid(String categoryUid, String subCategoryName) {
- return categoryUid + DOT + subCategoryName;
+ return buildUid(categoryUid, subCategoryName);
}
public static String buildGroupingUid(String subCategoryUid, String groupingName) {
- return subCategoryUid + DOT + groupingName;
+ return buildUid(subCategoryUid, groupingName);
}
static String buildResourceInstancePropertyValueUid(String resourceInstanceUniqueId, Integer index) {
- return resourceInstanceUniqueId + DOT + "property" + DOT + index;
+ return buildUid(resourceInstanceUniqueId, NodeTypeEnum.Property, index);
}
public static String buildComponentPropertyUniqueId(String resourceId, String propertyName) {
@@ -169,57 +166,67 @@ public class UniqueIdBuilder {
}
static String buildResourceInstanceAttributeValueUid(String resourceInstanceUniqueId, Integer index) {
- return resourceInstanceUniqueId + DOT + "attribute" + DOT + index;
+ return buildUid(resourceInstanceUniqueId, NodeTypeEnum.Attribute, index);
}
static String buildResourceInstanceInputValueUid(String resourceInstanceUniqueId, Integer index) {
- return resourceInstanceUniqueId + DOT + "input" + DOT + index;
+ return buildUid(resourceInstanceUniqueId, NodeTypeEnum.Input, index);
}
static String buildAdditionalInformationUniqueId(String resourceUniqueId) {
- return resourceUniqueId + DOT + "additionalinformation";
+ return buildUid(resourceUniqueId, "additionalinformation");
}
public static String buildDataTypeUid(final String modelName, final String name) {
- return StringUtils.isEmpty(modelName) ? name + DOT + "datatype" : modelName + DOT + name + DOT + "datatype";
+ return buildTypeUidWithModel(modelName, name, "datatype");
}
public static String buildInvariantUUID() {
return generateUUID();
}
- public static String buildGroupTypeUid(String modelName, String type, String version, String resourceName) {
- return buildTypeUidWithModel(modelName, type, version, resourceName);
+ public static String buildGroupTypeUid(final String modelName, final String type, final String version) {
+ return buildTypeUidWithModel(modelName, type, version, "grouptype");
}
public static String buildPolicyTypeUid(String modelName, String type, String version, String resourceName) {
return buildTypeUidWithModel(modelName, type, version, resourceName);
}
- static String buildTypeUidWithModel(String modelName, String type, String version, String resourceName) {
- if (StringUtils.isEmpty(modelName)){
- return buildTypeUid(type, version, resourceName);
- }
- return modelName + DOT + buildTypeUid(type, version, resourceName);
+ private static String buildTypeUidWithModel(String modelName, String type, String version, String resourceName) {
+ return StringUtils.isEmpty(modelName) ?
+ buildTypeUid(type, version, resourceName) : modelName + DOT + buildTypeUid(type, version, resourceName);
}
static String buildTypeUid(String type, String version, String resourceName) {
- return type + DOT + version + DOT + resourceName;
+ return type + DOT + buildUid(version, resourceName);
}
public static String buildPolicyUniqueId(String componentId, String name) {
- return componentId + DOT + name + Constants.POLICY_UID_POSTFIX;
+ return buildUid(componentId, name) + Constants.POLICY_UID_POSTFIX;
}
public static String buildGroupPropertyValueUid(String groupUniqueId, Integer index) {
- return groupUniqueId + DOT + "property" + DOT + index;
+ return buildUid(groupUniqueId, NodeTypeEnum.Property, index);
+ }
+
+ static String buildModelUid(final String modelName) {
+ return buildUid(NodeTypeEnum.Model.getName(), modelName);
+ }
+
+ public static String buildArtifactTypeUid(final String modelName, final String name) {
+ return buildTypeUidWithModel(modelName, name, "artifactype");
+ }
+
+ private static String buildTypeUidWithModel(final String modelName, final String name, final String nodeType) {
+ return StringUtils.isEmpty(modelName) ? buildUid(name, nodeType) : modelName + DOT + buildUid(name, nodeType);
}
- public static String buildModelUid(final String modelName) {
- return NodeTypeEnum.Model.getName() + DOT + modelName;
+ private static String buildUid(final String first, final String second) {
+ return first + DOT + second;
}
- public static String buildArtifactTypeUid(final String modelName, final String name) {
- return StringUtils.isEmpty(modelName) ? name + DOT + "artifactype" : modelName + DOT + name + DOT + "artifactype";
+ private static String buildUid(final String first, final NodeTypeEnum nodeType, final Integer index) {
+ return first + DOT + nodeType.getName() + DOT + index;
}
}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupTypeDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupTypeDefinitionTest.java
deleted file mode 100644
index bc1922448e..0000000000
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupTypeDefinitionTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.be.model;
-
-import org.junit.Test;
-import org.openecomp.sdc.be.datatypes.elements.GroupTypeDataDefinition;
-
-import java.util.HashMap;
-import java.util.List;
-
-
-public class GroupTypeDefinitionTest {
-
- private GroupTypeDefinition createTestSubject() {
- return new GroupTypeDefinition();
- }
-
- @Test
- public void testCtor() throws Exception {
- new GroupTypeDefinition(new GroupTypeDataDefinition());
- }
-
- @Test
- public void testGetProperties() throws Exception {
- GroupTypeDefinition testSubject;
- List<PropertyDefinition> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getProperties();
- }
-
-
- @Test
- public void testSetProperties() throws Exception {
- GroupTypeDefinition testSubject;
- List<PropertyDefinition> properties = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setProperties(properties);
- }
-
- @Test
- public void testGetCapabilityTypes() throws Exception {
- GroupTypeDefinition testSubject;
- List<PropertyDefinition> properties = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.getCapabilities();
- }
-
- @Test
- public void testSetCapabilityTypes() throws Exception {
- GroupTypeDefinition testSubject;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setCapabilities(new HashMap<>());
- }
-
- @Test
- public void testToString() throws Exception {
- GroupTypeDefinition testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.toString();
- }
-}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/normatives/ToscaTypeMetadataTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/normatives/ToscaTypeMetadataTest.java
deleted file mode 100644
index bcbdbfa0c8..0000000000
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/normatives/ToscaTypeMetadataTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2019 Nokia. All rights reserved.
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.openecomp.sdc.be.model.normatives;
-
-import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
-import static org.junit.Assert.assertThat;
-
-import org.junit.Test;
-
-public class ToscaTypeMetadataTest {
- @Test
- public void shouldHaveValidGettersAndSetters() {
- assertThat(ToscaTypeMetadata.class, hasValidGettersAndSetters());
- }
-} \ No newline at end of file
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/UniqueIdBuilderTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/UniqueIdBuilderTest.java
new file mode 100644
index 0000000000..ca7d0f5818
--- /dev/null
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/UniqueIdBuilderTest.java
@@ -0,0 +1,306 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2022 Nordix Foundation
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ *
+ */
+
+package org.openecomp.sdc.be.model.operations.impl;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder.DOT;
+import static org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder.HEAT_PARAM_PREFIX;
+
+import java.util.regex.Pattern;
+import org.junit.jupiter.api.Test;
+import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
+import org.openecomp.sdc.common.api.Constants;
+
+class UniqueIdBuilderTest {
+
+ private static final String resourceId = "resourceId";
+ private static final String propertyName = "propertyName";
+ private static final String modelName = "modelName";
+ private static final String version = "version";
+ private static final String name = "name";
+ private static final String componentId = "componentId";
+ private static final String groupUniqueId = "groupUniqueId";
+ private static final String attName = "attName";
+ private static final String reqName = "reqName";
+ private static final String capabilityName = "capabilityName";
+ private static final String interfaceName = "interfaceName";
+ private static final String operation = "operation";
+ private static final String type = "type";
+ private static final String artifactLabel = "artifactLabel";
+ private static final String parentId = "parentId";
+ private static final String instanceId = "instanceId";
+ private static final String serviceId = "serviceId";
+ private static final String logicalName = "logicalName";
+ private static final String categoryName = "categoryName";
+ private static final String subcategoryName = "subcategoryName";
+ private static final String groupingName = "groupingName";
+ private static final String resourceInstanceUniqueId = "resourceInstanceUniqueId";
+ private static final String pattern = "\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}";
+
+ @Test
+ void test_buildPropertyUniqueId() {
+ final String result = UniqueIdBuilder.buildPropertyUniqueId(resourceId, propertyName);
+ assertEquals(resourceId + DOT + propertyName, result);
+ }
+
+ @Test
+ void test_buildHeatParameterUniqueId() {
+ final String result = UniqueIdBuilder.buildHeatParameterUniqueId(resourceId, propertyName);
+ assertEquals(resourceId + DOT + HEAT_PARAM_PREFIX + propertyName, result);
+ }
+
+ @Test
+ void test_buildHeatParameterValueUniqueId() {
+ final String result = UniqueIdBuilder.buildHeatParameterValueUniqueId(resourceId, artifactLabel, propertyName);
+ assertEquals(resourceId + DOT + artifactLabel + DOT + propertyName, result);
+ }
+
+ @Test
+ void test_getKeyByNodeType() {
+ for (final NodeTypeEnum value : NodeTypeEnum.values()) {
+ switch (value) {
+ case User:
+ assertEquals("userId", UniqueIdBuilder.getKeyByNodeType(value));
+ break;
+ case Tag:
+ assertEquals("name", UniqueIdBuilder.getKeyByNodeType(value));
+ break;
+ default:
+ assertEquals("uid", UniqueIdBuilder.getKeyByNodeType(value));
+ break;
+ }
+ }
+ }
+
+ @Test
+ void test_buildResourceUniqueId() {
+ final String result = UniqueIdBuilder.buildResourceUniqueId();
+ assertTrue(Pattern.matches(pattern, result));
+ }
+
+ @Test
+ void test_generateUUID() {
+ final String result = UniqueIdBuilder.generateUUID();
+ assertTrue(Pattern.matches(pattern, result));
+ }
+
+ @Test
+ void test_buildComponentUniqueId() {
+ final String result = UniqueIdBuilder.buildComponentUniqueId();
+ assertTrue(Pattern.matches(pattern, result));
+ }
+
+ @Test
+ void test_buildCapabilityTypeUid() {
+ String result = UniqueIdBuilder.buildCapabilityTypeUid(modelName, type);
+ assertEquals(modelName + DOT + type, result);
+ result = UniqueIdBuilder.buildCapabilityTypeUid(null, type);
+ assertEquals(type, result);
+ }
+
+ @Test
+ void test_buildRelationshipTypeUid() {
+ String result = UniqueIdBuilder.buildRelationshipTypeUid(modelName, type);
+ assertEquals(modelName + DOT + type, result);
+ result = UniqueIdBuilder.buildRelationshipTypeUid(null, type);
+ assertEquals(type, result);
+ }
+
+ @Test
+ void test_buildInterfaceTypeUid() {
+ String result = UniqueIdBuilder.buildInterfaceTypeUid(modelName, type);
+ assertEquals(modelName + DOT + type, result);
+ result = UniqueIdBuilder.buildInterfaceTypeUid(null, type);
+ assertEquals(type, result);
+ }
+
+ @Test
+ void test_buildAttributeUid() {
+ final String result = UniqueIdBuilder.buildAttributeUid(resourceId, attName);
+ assertEquals(NodeTypeEnum.Attribute.getName() + DOT + resourceId + DOT + attName, result);
+ }
+
+ @Test
+ void test_buildRequirementUid() {
+ final String result = UniqueIdBuilder.buildRequirementUid(resourceId, reqName);
+ assertEquals(resourceId + DOT + reqName, result);
+ }
+
+ @Test
+ void test_buildCapabilityUid() {
+ final String result = UniqueIdBuilder.buildCapabilityUid(resourceId, capabilityName);
+ assertEquals(NodeTypeEnum.Capability.getName() + DOT + resourceId + DOT + capabilityName, result);
+ }
+
+ @Test
+ void test_buildArtifactByInterfaceUniqueId() {
+ final String result = UniqueIdBuilder.buildArtifactByInterfaceUniqueId(resourceId, interfaceName, operation, artifactLabel);
+ assertEquals(resourceId + DOT + interfaceName + DOT + operation + DOT + artifactLabel, result);
+ }
+
+ @Test
+ void test_buildInstanceArtifactUniqueId() {
+ final String result = UniqueIdBuilder.buildInstanceArtifactUniqueId(parentId, instanceId, artifactLabel);
+ assertEquals(parentId + DOT + instanceId + DOT + artifactLabel, result);
+ }
+
+ @Test
+ void test_buildResourceInstanceUniqueId() {
+ final String result = UniqueIdBuilder.buildResourceInstanceUniqueId(serviceId, resourceId, logicalName);
+ assertEquals(serviceId + DOT + resourceId + DOT + logicalName, result);
+ }
+
+ @Test
+ void test_buildRelationshipInstInstanceUid() {
+ final String result = UniqueIdBuilder.buildRelationshipInstInstanceUid();
+ assertTrue(Pattern.matches(pattern, result));
+ }
+
+ @Test
+ void test_buildResourceCategoryUid() {
+ final String result = UniqueIdBuilder.buildResourceCategoryUid(categoryName, subcategoryName, NodeTypeEnum.Product);
+ assertEquals(NodeTypeEnum.Product.getName() + DOT + categoryName + DOT + subcategoryName, result);
+ }
+
+ @Test
+ void test_buildServiceCategoryUid() {
+ final String result = UniqueIdBuilder.buildServiceCategoryUid(categoryName, NodeTypeEnum.Service);
+ assertEquals(NodeTypeEnum.Service.getName() + DOT + categoryName, result);
+ }
+
+ @Test
+ void test_buildCategoryUid() {
+ final String result = UniqueIdBuilder.buildCategoryUid(categoryName, NodeTypeEnum.Requirement);
+ assertEquals(NodeTypeEnum.Requirement.getName() + DOT + categoryName, result);
+ }
+
+ @Test
+ void test_buildComponentCategoryUid() {
+ final String result = UniqueIdBuilder.buildComponentCategoryUid(categoryName, VertexTypeEnum.TOPOLOGY_TEMPLATE);
+ assertEquals(VertexTypeEnum.TOPOLOGY_TEMPLATE.getName() + DOT + categoryName.toLowerCase(), result);
+ }
+
+ @Test
+ void test_buildSubCategoryUid() {
+ final String result = UniqueIdBuilder.buildSubCategoryUid(categoryName, subcategoryName);
+ assertEquals(categoryName + DOT + subcategoryName, result);
+ }
+
+ @Test
+ void test_buildGroupingUid() {
+ final String result = UniqueIdBuilder.buildGroupingUid(subcategoryName, groupingName);
+ assertEquals(subcategoryName + DOT + groupingName, result);
+ }
+
+ @Test
+ void test_buildResourceInstancePropertyValueUid() {
+ final String result = UniqueIdBuilder.buildResourceInstancePropertyValueUid(resourceInstanceUniqueId, 99);
+ assertEquals(resourceInstanceUniqueId + DOT + NodeTypeEnum.Property.getName() + DOT + 99, result);
+ }
+
+ @Test
+ void test_buildComponentPropertyUniqueId() {
+ final String result = UniqueIdBuilder.buildComponentPropertyUniqueId(resourceId, propertyName);
+ assertEquals(NodeTypeEnum.Property.getName() + DOT + resourceId + DOT + propertyName, result);
+ }
+
+ @Test
+ void test_buildResourceInstanceAttributeValueUid() {
+ final String result = UniqueIdBuilder.buildResourceInstanceAttributeValueUid(resourceInstanceUniqueId, 88);
+ assertEquals(resourceInstanceUniqueId + DOT + NodeTypeEnum.Attribute.getName() + DOT + 88, result);
+ }
+
+ @Test
+ void test_buildResourceInstanceInputValueUid() {
+ final String result = UniqueIdBuilder.buildResourceInstanceInputValueUid(resourceInstanceUniqueId, 77);
+ assertEquals(resourceInstanceUniqueId + DOT + NodeTypeEnum.Input.getName() + DOT + 77, result);
+ }
+
+ @Test
+ void test_buildAdditionalInformationUniqueId() {
+ final String result = UniqueIdBuilder.buildAdditionalInformationUniqueId(resourceId);
+ assertEquals(resourceId + DOT + "additionalinformation", result);
+ }
+
+ @Test
+ void test_buildDataTypeUid() {
+ String result = UniqueIdBuilder.buildDataTypeUid(modelName, name);
+ assertEquals(modelName + DOT + name + DOT + "datatype", result);
+ result = UniqueIdBuilder.buildDataTypeUid(null, name);
+ assertEquals(name + DOT + "datatype", result);
+ }
+
+ @Test
+ void test_buildInvariantUUID() {
+ final String result = UniqueIdBuilder.buildInvariantUUID();
+ assertTrue(Pattern.matches(pattern, result));
+ }
+
+ @Test
+ void test_buildGroupTypeUid() {
+ String result = UniqueIdBuilder.buildGroupTypeUid(modelName, type, version);
+ assertEquals(modelName + DOT + type + DOT + version + DOT + "grouptype", result);
+ result = UniqueIdBuilder.buildGroupTypeUid(null, type, version);
+ assertEquals(type + DOT + version + DOT + "grouptype", result);
+ }
+
+ @Test
+ void test_buildPolicyTypeUid() {
+ String result = UniqueIdBuilder.buildPolicyTypeUid(modelName, type, version, "policytype");
+ assertEquals(modelName + DOT + type + DOT + version + DOT + "policytype", result);
+ result = UniqueIdBuilder.buildPolicyTypeUid(null, type, version, "policytype");
+ assertEquals(type + DOT + version + DOT + "policytype", result);
+ }
+
+ @Test
+ void test_buildTypeUid() {
+ final String result = UniqueIdBuilder.buildTypeUid(type, version, NodeTypeEnum.HeatParameterValue.getName());
+ assertEquals(type + DOT + version + DOT + "heatParameterValue", result);
+ }
+
+ @Test
+ void test_buildPolicyUniqueId() {
+ final String result = UniqueIdBuilder.buildPolicyUniqueId(componentId, name);
+ assertEquals(componentId + DOT + name + Constants.POLICY_UID_POSTFIX, result);
+ }
+
+ @Test
+ void test_buildGroupPropertyValueUid() {
+ final String result = UniqueIdBuilder.buildGroupPropertyValueUid(groupUniqueId, 55);
+ assertEquals(groupUniqueId + DOT + NodeTypeEnum.Property.getName() + DOT + 55, result);
+ }
+
+ @Test
+ void test_buildModelUid() {
+ final String result = UniqueIdBuilder.buildModelUid(modelName);
+ assertEquals(NodeTypeEnum.Model.getName() + DOT + modelName, result);
+ }
+
+ @Test
+ void test_buildArtifactTypeUid() {
+ String result = UniqueIdBuilder.buildArtifactTypeUid(modelName, name);
+ assertEquals(modelName + DOT + name + DOT + "artifactype", result);
+ result = UniqueIdBuilder.buildArtifactTypeUid(null, name);
+ assertEquals(name + DOT + "artifactype", result);
+ }
+}