aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-model
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-model')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java43
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ComponentCache.java47
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementOperation.java29
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacade.java22
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/DaoStatusConverter.java23
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperation.java63
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfacesOperationTest.java81
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ArtifactOperationTest.java31
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperationTest.java67
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperationTest.java34
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ToscaElementLifecycleOperationTest.java63
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/util/PrintGraph.java107
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/serialize/TestResourceSerialization.java82
13 files changed, 98 insertions, 594 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java
index a9543d240f..c17c3fcb81 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java
@@ -20,7 +20,14 @@
package org.openecomp.sdc.be.model;
-import static java.util.Collections.emptyList;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import org.openecomp.sdc.be.config.ConfigurationManager;
+import org.openecomp.sdc.be.dao.utils.MapUtil;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.model.category.CategoryDefinition;
+import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
+import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum;
+import org.openecomp.sdc.common.api.ArtifactTypeEnum;
import java.io.Serializable;
import java.util.ArrayList;
@@ -32,15 +39,7 @@ import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
-import org.openecomp.sdc.be.config.ConfigurationManager;
-import org.openecomp.sdc.be.dao.utils.MapUtil;
-import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
-import org.openecomp.sdc.be.model.category.CategoryDefinition;
-import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum;
-import org.openecomp.sdc.common.api.ArtifactTypeEnum;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
+import static java.util.Collections.emptyList;
public abstract class Component implements Serializable {
@@ -477,11 +476,7 @@ public abstract class Component implements Serializable {
result = prime * result + ((artifacts == null) ? 0 : artifacts.hashCode());
result = prime * result + ((categories == null) ? 0 : categories.hashCode());
result = prime * result + ((componentMetadataDefinition == null) ? 0 : componentMetadataDefinition.hashCode());
-// result = prime * result + ((creatorUserId == null) ? 0 : creatorUserId.hashCode());
-// result = prime * result + ((creatorFullName == null) ? 0 : creatorFullName.hashCode());
result = prime * result + ((deploymentArtifacts == null) ? 0 : deploymentArtifacts.hashCode());
-// result = prime * result + ((lastUpdaterUserId == null) ? 0 : lastUpdaterUserId.hashCode());
-// result = prime * result + ((lastUpdaterFullName == null) ? 0 : lastUpdaterFullName.hashCode());
result = prime * result + ((capabilities == null) ? 0 : capabilities.hashCode());
result = prime * result + ((requirements == null) ? 0 : requirements.hashCode());
result = prime * result + ((componentInstances == null) ? 0 : componentInstances.hashCode());
@@ -522,31 +517,11 @@ public abstract class Component implements Serializable {
return false;
} else if (!componentMetadataDefinition.equals(other.componentMetadataDefinition))
return false;
-// if (creatorUserId == null) {
-// if (other.creatorUserId != null)
-// return false;
-// } else if (!creatorUserId.equals(other.creatorUserId))
-// return false;
-// if (creatorFullName == null) {
-// if (other.creatorFullName != null)
-// return false;
-// } else if (!creatorFullName.equals(other.creatorFullName))
-// return false;
if (deploymentArtifacts == null) {
if (other.deploymentArtifacts != null)
return false;
} else if (!deploymentArtifacts.equals(other.deploymentArtifacts))
return false;
-// if (lastUpdaterUserId == null) {
-// if (other.lastUpdaterUserId != null)
-// return false;
-// } else if (!lastUpdaterUserId.equals(other.lastUpdaterUserId))
-// return false;
-// if (lastUpdaterFullName == null) {
-// if (other.lastUpdaterFullName != null)
-// return false;
-// } else if (!lastUpdaterFullName.equals(other.lastUpdaterFullName))
-// return false;
if (componentInstances == null) {
if (other.componentInstances != null)
return false;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ComponentCache.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ComponentCache.java
index 439b4346ef..4fa41e5bee 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ComponentCache.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ComponentCache.java
@@ -20,22 +20,7 @@
package org.openecomp.sdc.be.model.cache;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
-import javax.annotation.PostConstruct;
-
+import fj.data.Either;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.ImmutableTriple;
import org.openecomp.sdc.be.config.BeEcompErrorManager;
@@ -65,7 +50,20 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import fj.data.Either;
+import javax.annotation.PostConstruct;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+import java.util.function.Function;
+import java.util.stream.Collectors;
@org.springframework.stereotype.Component("component-cache")
public class ComponentCache {
@@ -344,9 +342,7 @@ public class ComponentCache {
filteredComponent.setUniqueId(component.getUniqueId());
filteredComponent.setIcon(component.getIcon());
filteredComponent.setTags(component.getTags());
- // filteredComponent.setAllVersions(component.getAllVersions());
filteredComponent.setLifecycleState(component.getLifecycleState());
- // filteredComponent.setHighestVersion(component.isHighestVersion());
filteredComponent.setInvariantUUID(component.getInvariantUUID());
filteredComponent.setUUID(component.getUUID());
filteredComponent.setSystemName(component.getSystemName());
@@ -356,14 +352,7 @@ public class ComponentCache {
Resource resource = (Resource) component;
Resource filteredResource = (Resource) filteredComponent;
filteredResource.setToscaResourceName(resource.getToscaResourceName());
- // filteredResource.setAbstract(resource.isAbstract());
- // filteredResource.setVendorName(resource.getVendorName());
- // filteredResource.setVendorRelease(resource.getVendorRelease());
filteredResource.setResourceType(resource.getResourceType());
- } else if (componentTypeEnum == ComponentTypeEnum.SERVICE) {
- // Service service = (Service)component;
- // Service filteredService = (Service)filteredComponent;
- // filteredService.setDistributionStatus(service.getDistributionStatus());
}
}
@@ -377,10 +366,7 @@ public class ComponentCache {
filteredComponent.setUniqueId(component.getUniqueId());
filteredComponent.setIcon(component.getIcon());
filteredComponent.setTags(component.getTags());
- // filteredComponent.setAllVersions(component.getAllVersions());
filteredComponent.setLifecycleState(component.getLifecycleState());
- // filteredComponent.setHighestVersion(component.isHighestVersion());
- // filteredComponent.setInvariantUUID(component.getInvariantUUID());
filteredComponent.setSystemName(component.getSystemName());
filteredComponent.setName(component.getName());
filteredComponent.setLastUpdateDate(component.getLastUpdateDate());
@@ -389,9 +375,6 @@ public class ComponentCache {
Resource resource = (Resource) component;
Resource filteredResource = (Resource) filteredComponent;
filteredResource.setToscaResourceName(resource.getToscaResourceName());
- // filteredResource.setAbstract(resource.isAbstract());
- // filteredResource.setVendorName(resource.getVendorName());
- // filteredResource.setVendorRelease(resource.getVendorRelease());
filteredResource.setResourceType(resource.getResourceType());
} else if (componentTypeEnum == ComponentTypeEnum.SERVICE) {
Service service = (Service) component;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementOperation.java
index 0cb71eeab3..df7b382503 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementOperation.java
@@ -20,16 +20,9 @@
package org.openecomp.sdc.be.model.jsontitan.operations;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+import fj.data.Either;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Vertex;
@@ -71,10 +64,15 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StopWatch;
-import com.google.gson.Gson;
-import com.google.gson.reflect.TypeToken;
-
-import fj.data.Either;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
public abstract class ToscaElementOperation extends BaseOperation {
private static Logger log = LoggerFactory.getLogger(ToscaElementOperation.class.getName());
@@ -194,9 +192,6 @@ public abstract class ToscaElementOperation extends BaseOperation {
while (edgesToCopyIter.hasNext()) {
Edge currEdge = edgesToCopyIter.next();
Vertex currVertex = currEdge.inVertex();
- // if(EdgeLabelEnum.getEdgeLabelEnum(currEdge.label()).equals(EdgeLabelEnum.VERSION)){
- // continue;
- // }
status = titanDao.createEdge(createdToscaElementVertex.getVertex(), currVertex, EdgeLabelEnum.getEdgeLabelEnum(currEdge.label()), currEdge);
if (status != TitanOperationStatus.OK) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to create edge with label {} from tosca element vertex {} to vertex with label {} on graph. Status is {}. ", currEdge.label(), createdToscaElementVertex.getUniqueId(),
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacade.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacade.java
index 0ae3532169..168b127c9c 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacade.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacade.java
@@ -2040,27 +2040,6 @@ public class ToscaOperationFacade {
}
}
- // private Either<List<Service>, StorageOperationStatus> fetchServicesByCriteria(List<Service> servicesAll, Map<GraphPropertyEnum, Object> propertiesToMatch, Map<GraphPropertyEnum, Object> propertiesNotToMatch) {
- // Either<List<GraphVertex>, TitanOperationStatus> getRes = titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll);
- // if (getRes.isRight()) {
- // if (getRes.right().value() != TitanOperationStatus.NOT_FOUND) {
- // CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to fetch certified services by match properties {} not match properties {} . Status is {}. ", propertiesToMatch, propertiesNotToMatch, getRes.right().value());
- // return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getRes.right().value()));
- // }
- // } else {
- // for (GraphVertex vertex : getRes.left().value()) {
- // Either<Component, StorageOperationStatus> getServiceRes = getToscaElementByOperation(vertex);
- // if (getServiceRes.isRight()) {
- // CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to fetch certified service {}. Status is {}. ", vertex.getJsonMetadataField(JsonPresentationFields.NAME), getServiceRes.right().value());
- // return Either.right(getServiceRes.right().value());
- // } else {
- // servicesAll.add((Service) getToscaElementByOperation(vertex).left().value());
- // }
- // }
- // }
- // return Either.left(servicesAll);
- // }
-
private Either<List<Service>, StorageOperationStatus> fetchServicesByCriteria(List<Service> servicesAll, Map<GraphPropertyEnum, Object> propertiesToMatch, Map<GraphPropertyEnum, Object> propertiesNotToMatch) {
Either<List<GraphVertex>, TitanOperationStatus> getRes = titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll);
if (getRes.isRight()) {
@@ -2120,7 +2099,6 @@ public class ToscaOperationFacade {
Either<PropertyDefinition, StorageOperationStatus> result = null;
Either<Component, StorageOperationStatus> getUpdatedComponentRes = null;
newPropertyDefinition.setName(propertyName);
- // newPropertyDefinition.setParentUniqueId(resource.getUniqueId()); //todo- DELETE me after 10.18, ownerId==null => current resource is the owner. ownerId should be null since coming for the servlet => changing self resource property, assigning a null value actually means that the property has no assigned owner ,therfor current resource is the owner
StorageOperationStatus status = getToscaElementOperation(resource).addToscaDataToToscaElement(resource.getUniqueId(), EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES, newPropertyDefinition, JsonPresentationFields.NAME);
if (status != StorageOperationStatus.OK) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to add the property {} to the resource {}. Status is {}. ", propertyName, resource.getName(), status);
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/DaoStatusConverter.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/DaoStatusConverter.java
index 260763cced..3bda11641b 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/DaoStatusConverter.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/DaoStatusConverter.java
@@ -65,35 +65,12 @@ public class DaoStatusConverter {
case ILLEGAL_ARGUMENT:
return StorageOperationStatus.BAD_REQUEST;
- // case HTTP_PROTOCOL_ERROR:
- // return StorageOperationStatus.HTTP_PROTOCOL_ERROR;
- // case DB_NOT_AVAILABLE:
- // return StorageOperationStatus.STORAGE_NOT_AVAILABLE;
- // case DB_READ_ONLY:
- // return StorageOperationStatus.READ_ONLY_STORAGE;
- // case BAD_REQUEST:
- // return StorageOperationStatus.BAD_REQUEST;
- // case LEGACY_INDEX_ERROR:
- // return StorageOperationStatus.STORAGE_LEGACY_INDEX_ERROR;
- // case SCHEMA_ERROR:
- // return StorageOperationStatus.SCHEMA_ERROR;
- // case TRANSACTION_ERROR:
- // return StorageOperationStatus.TRANSACTION_ERROR;
- // case EXECUTION_FAILED:
- // return StorageOperationStatus.EXEUCTION_FAILED;
case ALREADY_EXIST:
return StorageOperationStatus.ENTITY_ALREADY_EXISTS;
case PROPERTY_NAME_ALREADY_EXISTS:
return StorageOperationStatus.PROPERTY_NAME_ALREADY_EXISTS;
case INVALID_PROPERTY:
return StorageOperationStatus.INVALID_PROPERTY;
- // case WRONG_INPUT:
- // return StorageOperationStatus.BAD_REQUEST;
- // case GENERAL_ERROR:
- // return StorageOperationStatus.GENERAL_ERROR;
- // case NOT_SUPPORTED:
- // return StorageOperationStatus.OPERATION_NOT_SUPPORTED;
-
default:
return StorageOperationStatus.GENERAL_ERROR;
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperation.java
index 53a7f39001..c86559bb59 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperation.java
@@ -20,13 +20,7 @@
package org.openecomp.sdc.be.model.operations.impl;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
+import fj.data.Either;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
@@ -50,7 +44,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
-import fj.data.Either;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
@Component("interface-operation")
public class InterfaceLifecycleOperation implements IInterfaceLifecycleOperation {
@@ -194,34 +193,6 @@ public class InterfaceLifecycleOperation implements IInterfaceLifecycleOperation
return Either.left(createNodeResult.left().value());
}
- // @Override
- // public Either<InterfaceDefinition, StorageOperationStatus> getInterface(
- // String interfaceId) {
- //
- // /*
- // * Either<InterfaceData, TitanOperationStatus> getResult =
- // * this.titanGenericDao
- // * .getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Interface),
- // * interfaceId, InterfaceData.class); if (getResult.isLeft()) {
- // * InterfaceData propertyData = getResult.left().value(); return
- // * Either.left(convertPropertyDataToPropertyDefinition(propertyData)); }
- // * else { TitanOperationStatus titanStatus = getResult.right().value();
- // * log.debug("Node with id " + propertyId +
- // * " was not found in the graph. status: " + titanStatus);
- // * StorageOperationStatus storageOperationStatus =
- // * DaoStatusConverter.convertTitanStatusToStorageStatus(titanStatus);
- // * return Either.right(storageOperationStatus); }
- // */
- // return null;
- // }
-
- // @Override
- // public Either<InterfaceDefinition, StorageOperationStatus> getInterface(
- // String interfaceId, boolean inTransaction) {
- // // TODO Auto-generated method stub
- // return null;
- // }
-
@Override
public Either<Map<String, InterfaceDefinition>, StorageOperationStatus> getAllInterfacesOfResource(String resourceIdn, boolean recursively) {
return getAllInterfacesOfResource(resourceIdn, recursively, false);
@@ -431,18 +402,6 @@ public class InterfaceLifecycleOperation implements IInterfaceLifecycleOperation
@Override
public Either<Operation, StorageOperationStatus> updateInterfaceOperation(String resourceId, String interfaceName, String operationName, Operation operation, boolean inTransaction) {
Either<Operation, StorageOperationStatus> status = updateOperationOnGraph(operation, resourceId, interfaceName, operationName);
-
- /*
- * if (status.isRight()) { if (false == inTransaction) { titanGenericDao.rollback(); }
- * log.error("Failed to update operation {} of interfaceName {} of resource {}", operationName, interfaceName, resourceId);
- * return
- * Either.right(DaoStatusConverter .convertTitanStatusToStorageStatus(status.right().value())); } else { if (false == inTransaction) { titanGenericDao.commit(); } OperationData operationData = status.left().value();
- *
- * Operation operationDefResult = convertOperationDataToOperation(operationData);
- *
- *
- * log.debug("The returned OperationDefintion is {}", operationDefResult); return Either.left(operationDefResult); }
- */
return status;
}
@@ -452,11 +411,6 @@ public class InterfaceLifecycleOperation implements IInterfaceLifecycleOperation
InterfaceData.class);
if (childrenNodes.isRight()) {
- /*
- * InterfaceDefinition intDef = new InterfaceDefinition(); intDef.setType(interfaceName); Map<String, Operation> opMap = new HashMap<String, Operation>(); opMap.put(operationName, operation); intDef.setOperations(opMap);
- * Either<InterfaceDefinition, StorageOperationStatus> statusRes = this .createInterfaceOnResource(intDef, resourceId, interfaceName, true); if (statusRes.isRight()) return Either.right(statusRes.right().value()); else {
- * InterfaceDefinition newDef = statusRes.left().value(); Operation res = newDef.getOperations().get(operationName); return Either.left(res); }
- */
return updateOperationFromParentNode(operation, resourceId, interfaceName, operationName);
} else {
@@ -634,10 +588,7 @@ public class InterfaceLifecycleOperation implements IInterfaceLifecycleOperation
}
}
}
- // if(newOperation == null)
return Either.right(StorageOperationStatus.GENERAL_ERROR);
- // else
- // return Either.left(newOperation);
}
private Either<InterfaceData, TitanOperationStatus> findInterfaceOnParentNode(String resourceId, String interfaceName) {
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfacesOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfacesOperationTest.java
index b7e6c1dc72..c3e8ce3eb6 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfacesOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfacesOperationTest.java
@@ -1,21 +1,8 @@
package org.openecomp.sdc.be.model.jsontitan.operations;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Resource;
-
-import org.apache.tinkerpop.gremlin.structure.io.IoCore;
+import com.thinkaurelius.titan.core.TitanGraph;
+import com.thinkaurelius.titan.core.TitanVertex;
+import fj.data.Either;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -41,7 +28,6 @@ import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.be.model.ModelTestBase;
import org.openecomp.sdc.be.model.Operation;
import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.model.catalog.CatalogComponent;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
import org.openecomp.sdc.be.model.jsontitan.datamodel.NodeType;
@@ -55,10 +41,15 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.thinkaurelius.titan.core.TitanVertex;
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
-import fj.data.Either;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:application-context-test.xml")
@@ -325,26 +316,8 @@ public class InterfacesOperationTest extends ModelTestBase{
List<String> derivedFrom = new ArrayList<>();
derivedFrom.add("root");
vf.setDerivedFrom(derivedFrom);
-
- // Map<String, PropertyDataDefinition> properties = new HashMap<>();
- // PropertyDataDefinition prop1 = new PropertyDataDefinition();
- // prop1.setName("prop1");
- // prop1.setDefaultValue("def1");
- //
- // properties.put("prop1", prop1);
- //
- // PropertyDataDefinition prop2 = new PropertyDataDefinition();
- // prop2.setName("prop2");
- // prop2.setDefaultValue("def2");
- // properties.put("prop2", prop2);
- //
- // PropertyDataDefinition prop3 = new PropertyDataDefinition();
- // prop3.setName("prop3");
- // prop3.setDefaultValue("def3");
- // properties.put("prop3", prop3);
- //
- // vf.setProperties(properties);
vf.setComponentType(ComponentTypeEnum.RESOURCE);
+
Either<NodeType, StorageOperationStatus> createVFRes = nodeTypeOperation.createNodeType(vf);
assertTrue(createVFRes.isLeft());
@@ -394,8 +367,6 @@ public class InterfacesOperationTest extends ModelTestBase{
Either<GraphVertex, StorageOperationStatus> res = nodeTypeOperation.assosiateElementToData(vfVertex, VertexTypeEnum.CAPABILITIES_PROPERTIES, EdgeLabelEnum.CAPABILITIES_PROPERTIES, capProps);
- // exportGraphMl(titanDao.getGraph().left().value());
-
List<String> pathKeys = new ArrayList<>();
pathKeys.add("capName");
capProp.setDefaultValue("BBBB");
@@ -496,18 +467,6 @@ public class InterfacesOperationTest extends ModelTestBase{
}
- public void verifyInCatalogData(int expected, List<String> expectedIds) {
-
- Either<List<CatalogComponent>, StorageOperationStatus> highestResourcesRes = topologyTemplateOperation.getElementCatalogData();
- assertTrue(highestResourcesRes.isLeft());
- List<CatalogComponent> highestResources = highestResourcesRes.left().value();
- // calculate expected count value
- assertEquals(expected, highestResources.stream().count());
- if (expectedIds != null) {
- highestResources.forEach(a -> assertTrue(expectedIds.contains(a.getUniqueId())));
- }
- }
-
@After
public void teardown() {
clearGraph();
@@ -528,20 +487,4 @@ public class InterfacesOperationTest extends ModelTestBase{
titanDao.commit();
}
- private String exportGraphMl(TitanGraph graph) {
- String result = null;
- String outputFile = outputDirectory + File.separator + "exportGraph." + System.currentTimeMillis() + ".graphml";
- try {
- try (final OutputStream os = new BufferedOutputStream(new FileOutputStream(outputFile))) {
- graph.io(IoCore.graphml()).writer().normalize(true).create().writeGraph(os, graph);
- }
- result = outputFile;
- graph.tx().commit();
- } catch (Exception e) {
- graph.tx().rollback();
- e.printStackTrace();
- }
- return result;
-
- }
}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ArtifactOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ArtifactOperationTest.java
index 95ae6ced49..cd4433a462 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ArtifactOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ArtifactOperationTest.java
@@ -20,16 +20,7 @@
package org.openecomp.sdc.be.model.operations.impl;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import fj.data.Either;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
@@ -61,7 +52,15 @@ import org.slf4j.LoggerFactory;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import fj.data.Either;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:application-context-test.xml")
@@ -444,9 +443,6 @@ public class ArtifactOperationTest extends ModelTestBase {
assertTrue(result.isLeft());
Service resultService = result.left().value();
- // assertEquals("check resource unique id",
- // UniqueIdBuilder.buildServiceUniqueId(serviceName, serviceVersion),
- // resultService.getUniqueId());
assertEquals("check resource state", LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT, resultService.getLifecycleState());
return resultService;
@@ -476,13 +472,6 @@ public class ArtifactOperationTest extends ModelTestBase {
String[] names = category.split("/");
OperationTestsUtil.deleteAndCreateServiceCategory(category, titanDao);
OperationTestsUtil.deleteAndCreateResourceCategory(names[0], names[1], titanDao);
-
- /*
- * CategoryData categoryData = new CategoryData(); categoryData.setName(category);
- *
- * titanDao.deleteNode(categoryData, CategoryData.class); Either<CategoryData, TitanOperationStatus> createNode = titanDao.createNode(categoryData, CategoryData.class); System.out.println("after creating caetgory " + createNode);
- */
-
}
private UserData deleteAndCreateUser(String userId, String firstName, String lastName, String role) {
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperationTest.java
index 47165133c6..79af87bc10 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/CapabilityTypeOperationTest.java
@@ -20,18 +20,7 @@
package org.openecomp.sdc.be.model.operations.impl;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.annotation.Resource;
-
+import fj.data.Either;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -49,14 +38,19 @@ import org.openecomp.sdc.be.model.tosca.constraints.LessOrEqualConstraint;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import fj.data.Either;
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:application-context-test.xml")
-// @TestExecutionListeners(listeners = {
-// DependencyInjectionTestExecutionListener.class,
-// DirtiesContextTestExecutionListener.class,
-// TransactionalTestExecutionListener.class })
public class CapabilityTypeOperationTest extends ModelTestBase {
@Resource(name = "titan-generic-dao")
@@ -67,34 +61,6 @@ public class CapabilityTypeOperationTest extends ModelTestBase {
@BeforeClass
public static void setupBeforeClass() {
- // ExternalConfiguration.setAppName("catalog-model");
- // String appConfigDir = "src/test/resources/config/catalog-model";
- // ConfigurationSource configurationSource = new
- // FSConfigurationSource(ExternalConfiguration.getChangeListener(),
- // appConfigDir);
-
- // configurationManager = new ConfigurationManager(
- // new ConfigurationSource() {
- //
- // @Override
- // public <T> T getAndWatchConfiguration(Class<T> className,
- // ConfigurationListener configurationListener) {
- // // TODO Auto-generated method stub
- // return null;
- // }
- //
- // @Override
- // public <T> void addWatchConfiguration(Class<T> className,
- // ConfigurationListener configurationListener) {
- // // TODO Auto-generated method stub
- //
- // }
- // });
- //
- // Configuration configuration = new Configuration();
- // configuration.setTitanInMemoryGraph(true);
- //
- // configurationManager.setConfiguration(configuration);
ModelTestBase.init();
}
@@ -137,10 +103,6 @@ public class CapabilityTypeOperationTest extends ModelTestBase {
capabilityTypeDefinition.setDerivedFrom("derivedFrom");
Either<CapabilityTypeDefinition, StorageOperationStatus> addCapabilityType1 = capabilityTypeOperation.addCapabilityType(capabilityTypeDefinition, true);
- // assertEquals("check capability type parent not exist",
- // StorageOperationStatus.INVALID_ID,
- // addCapabilityType1.right().value());
- // TODO: esofer change to INVALID_ID
assertEquals("check capability type parent not exist", StorageOperationStatus.INVALID_ID, addCapabilityType1.right().value());
}
@@ -315,11 +277,4 @@ public class CapabilityTypeOperationTest extends ModelTestBase {
return false;
}
}
-
- public void setOperations(TitanGenericDao titanDao, CapabilityTypeOperation capabilityTypeOperation) {
- this.titanDao = titanDao;
- this.capabilityTypeOperation = capabilityTypeOperation;
-
- }
-
}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperationTest.java
index 40f692ca41..321bc422af 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperationTest.java
@@ -24,40 +24,6 @@ public class ComponentInstanceOperationTest {
testSubject.setTitanGenericDao(titanGenericDao);
}
-
-
-
-
-
-// @Test
-// public void testValidateElementExistInGraph() throws Exception {
-// ComponentInstanceOperation testSubject;
-// String elementUniqueId = "";
-// NodeTypeEnum elementNodeType = null;
-// Supplier<Class<ElementData>> elementClassGen = null;
-// Wrapper<ElementData> elementDataWrapper = null;
-// Wrapper<TitanOperationStatus> errorWrapper = null;
-//
-// // default test
-// testSubject = createTestSubject();
-// testSubject.validateElementExistInGraph(elementUniqueId, elementNodeType, elementClassGen, elementDataWrapper,
-// errorWrapper);
-// }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@Test
public void testUpdateInputValueInResourceInstance() throws Exception {
ComponentInstanceOperation testSubject;
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ToscaElementLifecycleOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ToscaElementLifecycleOperationTest.java
index bbfdd88425..8f8baea22d 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ToscaElementLifecycleOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ToscaElementLifecycleOperationTest.java
@@ -20,20 +20,9 @@
package org.openecomp.sdc.be.model.operations.impl;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tinkerpop.gremlin.structure.io.IoCore;
+import com.thinkaurelius.titan.core.TitanGraph;
+import com.thinkaurelius.titan.core.TitanVertex;
+import fj.data.Either;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -72,10 +61,14 @@ import org.openecomp.sdc.common.util.ValidationUtils;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.thinkaurelius.titan.core.TitanVertex;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
-import fj.data.Either;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:application-context-test.xml")
@@ -435,24 +428,6 @@ public class ToscaElementLifecycleOperationTest extends ModelTestBase {
derivedFrom.add("root");
vf.setDerivedFrom(derivedFrom);
- // Map<String, PropertyDataDefinition> properties = new HashMap<>();
- // PropertyDataDefinition prop1 = new PropertyDataDefinition();
- // prop1.setName("prop1");
- // prop1.setDefaultValue("def1");
- //
- // properties.put("prop1", prop1);
- //
- // PropertyDataDefinition prop2 = new PropertyDataDefinition();
- // prop2.setName("prop2");
- // prop2.setDefaultValue("def2");
- // properties.put("prop2", prop2);
- //
- // PropertyDataDefinition prop3 = new PropertyDataDefinition();
- // prop3.setName("prop3");
- // prop3.setDefaultValue("def3");
- // properties.put("prop3", prop3);
- //
- // vf.setProperties(properties);
vf.setComponentType(ComponentTypeEnum.RESOURCE);
Either<NodeType, StorageOperationStatus> createVFRes = nodeTypeOperation.createNodeType(vf);
assertTrue(createVFRes.isLeft());
@@ -636,22 +611,4 @@ public class ToscaElementLifecycleOperationTest extends ModelTestBase {
}
titanDao.commit();
}
-
- private String exportGraphMl(TitanGraph graph) {
- String result = null;
- String outputFile = outputDirectory + File.separator + "exportGraph." + System.currentTimeMillis() + ".graphml";
- try {
- try (final OutputStream os = new BufferedOutputStream(new FileOutputStream(outputFile))) {
- graph.io(IoCore.graphml()).writer().normalize(true).create().writeGraph(os, graph);
- }
- result = outputFile;
- graph.tx().commit();
- } catch (Exception e) {
- graph.tx().rollback();
- e.printStackTrace();
- }
- return result;
-
- }
-
}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/util/PrintGraph.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/util/PrintGraph.java
index d6a760a04a..c305b12834 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/util/PrintGraph.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/util/PrintGraph.java
@@ -20,13 +20,9 @@
package org.openecomp.sdc.be.model.operations.impl.util;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
+import com.thinkaurelius.titan.core.TitanEdge;
+import com.thinkaurelius.titan.core.TitanGraph;
+import com.thinkaurelius.titan.core.TitanVertex;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Property;
@@ -36,13 +32,12 @@ import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
-import com.thinkaurelius.titan.core.TitanEdge;
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.thinkaurelius.titan.core.TitanVertex;
-//import com.tinkerpop.blueprints.Direction;
-//import com.tinkerpop.blueprints.Edge;
-//import com.tinkerpop.blueprints.Vertex;
-//import com.tinkerpop.blueprints.util.ElementHelper;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
public class PrintGraph {
@@ -54,10 +49,6 @@ public class PrintGraph {
Iterator<TitanVertex> iterator = vertices.iterator();
while (iterator.hasNext()) {
Vertex vertex = iterator.next();
-
- // System.out.println(vertex);
- // System.out.println(ElementHelper.getProperties(vertex));
- // System.out.println("=======================================");
}
}
@@ -66,7 +57,6 @@ public class PrintGraph {
}
public void printGraphEdges(TitanGraph graph) {
-
Iterable<TitanEdge> vertices = graph.query().edges();
if (vertices != null) {
@@ -74,16 +64,9 @@ public class PrintGraph {
while (iterator.hasNext()) {
Edge edge = iterator.next();
- // System.out.println(edge);
- // System.out.println("edge=" + edge.getLabel() + ",
- // properties="+ ElementHelper.getProperties(edge));
- // System.out.println("edge=" + edge.label() + ", properties="+
- // getProperties(edge));
- // System.out.println("=======================================");
}
}
- // graph.commit();
graph.tx().commit();
}
@@ -93,9 +76,6 @@ public class PrintGraph {
builder.append("digraph finite_state_machine {\n");
builder.append("rankdir=LR;\n");
builder.append("size=\"15,10\" \n");
- // node [shape = doublecircle]; LR_0 LR_3 LR_4 LR_8;
- // node [shape = circle];
-
Iterable<TitanVertex> vertices = graph.query().vertices();
if (vertices != null) {
@@ -103,11 +83,6 @@ public class PrintGraph {
while (iterator.hasNext()) {
Vertex vertex = iterator.next();
- // System.out.println(vertex);
- // System.out.println(ElementHelper.getProperties(vertex));
- // System.out.println(getProperties(vertex));
- // System.out.println("=======================================");
-
Map<String, Object> properties = getProperties(vertex);
String nodeLabel = (String) properties.get(GraphPropertiesDictionary.LABEL.getProperty());
@@ -116,22 +91,10 @@ public class PrintGraph {
String uid = getNodeIdByLabel(nodeLabel, properties);
- // System.out.println("uid=" + uid);
-
String nodeRecord = buildNodeRecord(uid, color, properties);
- // System.out.println(nodeRecord);
-
builder.append(nodeRecord);
- // if (nodeLabel.equals(NodeTypeEnum.Category)) {
- //
- // String
- //
- // } else (nodeLabel.equals(NodeTypeEnum.User)) {
- //
- // }
-
}
}
@@ -143,38 +106,18 @@ public class PrintGraph {
while (iterator.hasNext()) {
Edge edge = iterator.next();
- // Vertex vertexFrom = edge.getVertex(Direction.OUT);
- // Vertex vertexTo = edge.getVertex(Direction.IN);
Vertex vertexFrom = edge.outVertex();
Vertex vertexTo = edge.inVertex();
-
- // String fromUid =
- // getNodeIdByLabel((String)vertexFrom.getProperty(GraphPropertiesDictionary.LABEL.getProperty()),
- // ElementHelper.getProperties(vertexFrom));
- // String toUid =
- // getNodeIdByLabel((String)vertexTo.getProperty(GraphPropertiesDictionary.LABEL.getProperty()),
- // ElementHelper.getProperties(vertexTo));
String fromUid = getNodeIdByLabel(vertexFrom.value(GraphPropertiesDictionary.LABEL.getProperty()),
getProperties(vertexFrom));
String toUid = getNodeIdByLabel(vertexTo.value(GraphPropertiesDictionary.LABEL.getProperty()),
getProperties(vertexTo));
- // String edgeLabel = edge.getLabel();
String edgeLabel = edge.label();
- // String edgeRecord = buildEdgeRecord(fromUid, toUid,
- // edgeLabel, ElementHelper.getProperties(edge));
String edgeRecord = buildEdgeRecord(fromUid, toUid, edgeLabel, getProperties(edge));
builder.append(edgeRecord);
-
- // System.out.println(edge);
- // System.out.println("edge=" + edge.getLabel() + ",
- // properties="
- // + ElementHelper.getProperties(edge));
- // System.out.println("edge=" + edge.label() + ", properties="
- // + getProperties(edge));
- // System.out.println("=======================================");
}
}
@@ -185,25 +128,6 @@ public class PrintGraph {
}
- // LR_0 [ style = "bold" color = "red" shape = "Mrecord" label =
- // "hello&#92;nworld | { name | apache } | { version | 1.0 } | { uid |
- // apache.1.0 } | { state| CERTIFIED } |{ b |{c|<here> d|e}| f}| g | h"
- // ]
-
- // LR_0 -> LR_2 [ label = "SS(B)" ];
- // LR_0 -> LR_1 [ label = "SS(S)" ];
- // LR_1 -> LR_3 [ label = "S($end)" ];
- // LR_2 -> LR_6 [ label = "SS(b)" ];
- // LR_2 -> LR_5 [ label = "SS(a)" ];
- // LR_2 -> LR_4 [ label = "S(A)" ];
- // LR_5 -> LR_7 [ label = "S(b)" ];
- // LR_5 -> LR_5 [ label = "S(a)" ];
- // LR_6 -> LR_6 [ label = "S(b)" ];
- // LR_6 -> LR_5 [ label = "S(a)" ];
- // LR_7 -> LR_8 [ label = "S(b)" ];
- // LR_7 -> LR_5 [ label = "S(a)" ];
- // LR_8 -> LR_6 [ label = "S(b)" ];
- // LR_8 -> LR_5 [ label = "S(a)" ];
private String buildEdgeRecord(String fromUid, String toUid, String edgeLabel, Map<String, Object> properties) {
@@ -297,12 +221,6 @@ public class PrintGraph {
builder.append("label = \"" + label + "\" ");
builder.append(" ] ");
-
- // LR_0 [ style = "bold" color = "red" shape = "Mrecord" label =
- // "hello&#92;nworld | { name | apache } | { version | 1.0 } | { uid |
- // apache.1.0 } | { state| CERTIFIED } |{ b |{c|<here> d|e}| f}| g | h"
- // ]
-
builder.append(" \n ");
return builder.toString();
}
@@ -417,13 +335,6 @@ public class PrintGraph {
while (iterator.hasNext()) {
Vertex vertex = iterator.next();
- // System.out.println(vertex);
- // System.out.println(ElementHelper.getProperties(vertex));
- // System.out.println(getProperties(vertex));
- // System.out.println("=======================================");
-
- // Map<String, Object> properties =
- // ElementHelper.getProperties(vertex);
Map<String, Object> properties = getProperties(vertex);
String nodeLabel = (String) properties.get(GraphPropertiesDictionary.LABEL.getProperty());
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/serialize/TestResourceSerialization.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/serialize/TestResourceSerialization.java
index 80109643be..276558eafe 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/serialize/TestResourceSerialization.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/serialize/TestResourceSerialization.java
@@ -20,27 +20,20 @@
package org.openecomp.sdc.be.model.serialize;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import org.openecomp.sdc.be.model.Resource;
import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
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.Set;
import java.util.stream.Collectors;
-import org.openecomp.sdc.be.model.ComponentInstance;
-import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.common.util.SerializationUtils;
-
-import fj.data.Either;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
public class TestResourceSerialization {
@@ -102,8 +95,6 @@ public class TestResourceSerialization {
if (type.toString().contains(".List")) {
ParameterizedType stringListType = (ParameterizedType) field.getGenericType();
Class<?> stringListClass = (Class<?>) stringListType.getActualTypeArguments()[0];
- // System.out.println(stringListClass); // class
- // java.lang.String.
allClasses.add(stringListClass);
}
@@ -145,76 +136,9 @@ public class TestResourceSerialization {
}
- // System.out.println(type);
allClasses.add(type);
}
}
}
-
- private void addInternalTypeOfList(Class clazz) {
-
- // clazz.
- // ParameterizedType stringListType = (ParameterizedType)
- // field.getGenericType();
- // Class<?> stringListClass = (Class<?>)
- // stringListType.getActualTypeArguments()[0];
- // //System.out.println(stringListClass); // class java.lang.String.
- // allClasses.add(stringListClass);
- //
- }
-
- private boolean isClassImplementedSerialize(Class clazz) {
-
- Type[] genericInterfaces = clazz.getGenericInterfaces();
- if (genericInterfaces != null) {
- Type orElse = Arrays.stream(genericInterfaces).filter(p -> p.getTypeName().equals("java.io.Serializable"))
- .findAny().orElse(null);
- if (orElse != null) {
- return true;
- }
- }
-
- return false;
- }
-
- // @Test
- public void testSimpleResourceSerialize() {
-
- Resource resource = new Resource();
- String name = "res1";
- Map<String, String> allVersions = new HashMap<String, String>();
- allVersions.put("keya", "valuea");
-
- resource.setName(name);
- // all versions
- resource.setAllVersions(allVersions);
- List<ComponentInstance> resourceInstances = new ArrayList<ComponentInstance>();
- // component instances
- ComponentInstance componentInstance = new ComponentInstance();
- componentInstance.setDescription("desc1");
- componentInstance.setComponentUid("comUid");
- resourceInstances.add(componentInstance);
-
- resource.setComponentInstances(resourceInstances);
-
- Either<byte[], Boolean> serialize = SerializationUtils.serialize(resource);
- assertTrue("check object serialized", serialize.isLeft());
- byte[] value = serialize.left().value();
-
- Either<Object, Boolean> deserialize = SerializationUtils.deserialize(value);
- assertTrue("check object deserialized", deserialize.isLeft());
- Object obj = deserialize.left().value();
- Resource desResource = (Resource) obj;
- assertEquals("check name", name, desResource.getName());
- verifyAllVersions(desResource);
-
- }
-
- private void verifyAllVersions(Resource desResource) {
- assertNotNull("check all versions", desResource.getAllVersions());
- assertEquals("check all version size", 1, desResource.getAllVersions().size());
- assertEquals("check all version key", "keya", desResource.getAllVersions().keySet().iterator().next());
- assertEquals("check all version value", "valuea", desResource.getAllVersions().values().iterator().next());
- }
}