use of org.apache.atlas.repository.graphdb.AtlasVertex in project incubator-atlas by apache.
the class GraphHelperTest method testGetOutgoingEdgesByLabel.
@Test
public void testGetOutgoingEdgesByLabel() throws Exception {
AtlasGraph graph = TestUtils.getGraph();
AtlasVertex v1 = graph.addVertex();
AtlasVertex v2 = graph.addVertex();
graph.addEdge(v1, v2, "l1");
graph.addEdge(v1, v2, "l2");
Iterator<AtlasEdge> iterator = GraphHelper.getInstance().getOutGoingEdgesByLabel(v1, "l1");
assertTrue(iterator.hasNext());
assertTrue(iterator.hasNext());
assertNotNull(iterator.next());
assertNull(iterator.next());
assertFalse(iterator.hasNext());
assertFalse(iterator.hasNext());
}
use of org.apache.atlas.repository.graphdb.AtlasVertex in project incubator-atlas by apache.
the class GraphHelperTest method testGetVerticesForGUIDSWithDuplicates.
@Test
public void testGetVerticesForGUIDSWithDuplicates() throws Exception {
ITypedReferenceableInstance hrDept = TestUtils.createDeptEg1(TypeSystem.getInstance());
List<String> result = repositoryService.createEntities(hrDept).getCreatedEntities();
String guid = result.get(0);
Map<String, AtlasVertex> verticesForGUIDs = GraphHelper.getInstance().getVerticesForGUIDs(Arrays.asList(guid, guid));
Assert.assertEquals(verticesForGUIDs.size(), 1);
Assert.assertTrue(verticesForGUIDs.containsKey(guid));
}
use of org.apache.atlas.repository.graphdb.AtlasVertex in project incubator-atlas by apache.
the class AbstractGraphDatabaseTest method removeVertices.
@AfterMethod
public void removeVertices() {
for (AtlasVertex vertex : newVertices) {
if (vertex.exists()) {
getGraph().removeVertex(vertex);
}
}
getGraph().commit();
newVertices.clear();
}
use of org.apache.atlas.repository.graphdb.AtlasVertex in project incubator-atlas by apache.
the class Titan1Graph method getVertex.
@Override
public AtlasVertex<Titan1Vertex, Titan1Edge> getVertex(String vertexId) {
Iterator<Vertex> it = getGraph().vertices(vertexId);
Vertex vertex = getSingleElement(it, vertexId);
return GraphDbObjectFactory.createVertex(this, vertex);
}
use of org.apache.atlas.repository.graphdb.AtlasVertex in project incubator-atlas by apache.
the class Titan1Graph method removeVertex.
@Override
public void removeVertex(AtlasVertex<Titan1Vertex, Titan1Edge> vertex) {
Vertex wrapped = vertex.getV().getWrappedElement();
wrapped.remove();
}
Aggregations