in gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/GraphComputerTest.java [1086:1157]
public void execute(Vertex vertex, Messenger messenger, Memory memory) {
vertex.vertices(Direction.OUT).forEachRemaining(Vertex::id);
vertex.vertices(Direction.IN).forEachRemaining(Vertex::id);
vertex.vertices(Direction.BOTH).forEachRemaining(Vertex::id);
if (vertex.vertices(Direction.OUT).hasNext()) {
try {
vertex.vertices(Direction.OUT).forEachRemaining(Vertex::label);
fail("Adjacent vertex labels should not be accessible in VertexProgram.execute()");
} catch (UnsupportedOperationException e) {
assertEquals(GraphComputer.Exceptions.adjacentVertexLabelsCanNotBeRead().getMessage(), e.getMessage());
}
}
if (vertex.vertices(Direction.IN).hasNext()) {
try {
vertex.vertices(Direction.IN).forEachRemaining(Vertex::label);
fail("Adjacent vertex labels should not be accessible in VertexProgram.execute()");
} catch (UnsupportedOperationException e) {
assertEquals(GraphComputer.Exceptions.adjacentVertexLabelsCanNotBeRead().getMessage(), e.getMessage());
}
}
if (vertex.vertices(Direction.BOTH).hasNext()) {
try {
vertex.vertices(Direction.BOTH).forEachRemaining(Vertex::label);
fail("Adjacent vertex labels should not be accessible in VertexProgram.execute()");
} catch (UnsupportedOperationException e) {
assertEquals(GraphComputer.Exceptions.adjacentVertexLabelsCanNotBeRead().getMessage(), e.getMessage());
}
}
////////////////////
if (vertex.vertices(Direction.OUT).hasNext()) {
try {
vertex.vertices(Direction.OUT).forEachRemaining(v -> v.property("name"));
fail("Adjacent vertex properties should not be accessible in VertexProgram.execute()");
} catch (UnsupportedOperationException e) {
assertEquals(GraphComputer.Exceptions.adjacentVertexPropertiesCanNotBeReadOrUpdated().getMessage(), e.getMessage());
}
}
if (vertex.vertices(Direction.IN).hasNext()) {
try {
vertex.vertices(Direction.IN).forEachRemaining(v -> v.property("name"));
fail("Adjacent vertex properties should not be accessible in VertexProgram.execute()");
} catch (UnsupportedOperationException e) {
assertEquals(GraphComputer.Exceptions.adjacentVertexPropertiesCanNotBeReadOrUpdated().getMessage(), e.getMessage());
}
}
if (vertex.vertices(Direction.BOTH).hasNext()) {
try {
vertex.vertices(Direction.BOTH).forEachRemaining(v -> v.property("name"));
fail("Adjacent vertex properties should not be accessible in VertexProgram.execute()");
} catch (UnsupportedOperationException e) {
assertEquals(GraphComputer.Exceptions.adjacentVertexPropertiesCanNotBeReadOrUpdated().getMessage(), e.getMessage());
}
}
////////////////////
if (vertex.vertices(Direction.BOTH).hasNext()) {
try {
vertex.vertices(Direction.BOTH).forEachRemaining(v -> v.edges(Direction.BOTH));
fail("Adjacent vertex edges should not be accessible in VertexProgram.execute()");
} catch (UnsupportedOperationException e) {
assertEquals(GraphComputer.Exceptions.adjacentVertexEdgesAndVerticesCanNotBeReadOrUpdated().getMessage(), e.getMessage());
}
}
if (vertex.vertices(Direction.BOTH).hasNext()) {
try {
vertex.vertices(Direction.BOTH).forEachRemaining(v -> v.vertices(Direction.BOTH));
fail("Adjacent vertex vertices should not be accessible in VertexProgram.execute()");
} catch (UnsupportedOperationException e) {
assertEquals(GraphComputer.Exceptions.adjacentVertexEdgesAndVerticesCanNotBeReadOrUpdated().getMessage(), e.getMessage());
}
}
}