use of org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex in project java-driver by datastax.
the class GraphNodeTest method should_check_if_node_is_vertex.
@Test
@UseDataProvider("allGraphProtocols")
public void should_check_if_node_is_vertex(GraphProtocol graphProtocol) throws IOException {
// when
GraphNode vertexNode = serdeAndCreateGraphNode(new DetachedVertex("a", "l", null), graphProtocol);
// then
assertThat(vertexNode.isVertex()).isTrue();
assertThat(vertexNode.asVertex()).isNotNull();
}
use of org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex in project java-driver by datastax.
the class GraphNodeTest method should_return_is_value_only_for_scalar_value.
@Test
@UseDataProvider(value = "allGraphProtocols")
public void should_return_is_value_only_for_scalar_value(GraphProtocol graphProtocol) throws IOException {
// when
GraphNode mapNode = serdeAndCreateGraphNode(ImmutableMap.of(12, 1234), graphProtocol);
GraphNode setNode = serdeAndCreateGraphNode(ImmutableMap.of(12, 1234), graphProtocol);
GraphNode listNode = serdeAndCreateGraphNode(ImmutableMap.of(12, 1234), graphProtocol);
GraphNode vertexNode = serdeAndCreateGraphNode(new DetachedVertex("a", "l", null), graphProtocol);
GraphNode edgeNode = serdeAndCreateGraphNode(new DetachedEdge("a", "l", Collections.emptyMap(), "v1", "l1", "v2", "l2"), graphProtocol);
GraphNode pathNode = serdeAndCreateGraphNode(EmptyPath.instance(), graphProtocol);
GraphNode propertyNode = serdeAndCreateGraphNode(new DetachedProperty<>("a", 1), graphProtocol);
GraphNode vertexPropertyNode = serdeAndCreateGraphNode(new DetachedVertexProperty<>("id", "l", "v", null, new DetachedVertex("a", "l", null)), graphProtocol);
GraphNode scalarValueNode = serdeAndCreateGraphNode(true, graphProtocol);
// then
assertThat(mapNode.isValue()).isFalse();
assertThat(setNode.isValue()).isFalse();
assertThat(listNode.isValue()).isFalse();
assertThat(vertexNode.isValue()).isFalse();
assertThat(edgeNode.isValue()).isFalse();
assertThat(pathNode.isValue()).isFalse();
assertThat(propertyNode.isValue()).isFalse();
assertThat(vertexPropertyNode.isValue()).isFalse();
assertThat(scalarValueNode.isValue()).isTrue();
}
use of org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex in project java-driver by datastax.
the class GraphNodeTest method should_check_if_node_is_vertex_property.
@Test
@UseDataProvider("allGraphProtocols")
public void should_check_if_node_is_vertex_property(GraphProtocol graphProtocol) throws IOException {
// when
GraphNode vertexPropertyNode = serdeAndCreateGraphNode(new DetachedVertexProperty<>("id", "l", "v", null, new DetachedVertex("a", "l", null)), graphProtocol);
// then
assertThat(vertexPropertyNode.isVertexProperty()).isTrue();
assertThat(vertexPropertyNode.isVertexProperty()).isNotNull();
}
Aggregations