diff options
Diffstat (limited to 'catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfacesOperationTest.java')
-rw-r--r-- | catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfacesOperationTest.java | 81 |
1 files changed, 12 insertions, 69 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; - - } } |