summaryrefslogtreecommitdiffstats
path: root/catalog-model/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-model/src/test')
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/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
7 files changed, 55 insertions, 410 deletions
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());
- }
}