use of org.neo4j.values.virtual.NodeValue in project neo4j by neo4j.
the class PathValueBuilderTest method shouldHandleNoValueInMultiRel.
@Test
void shouldHandleNoValueInMultiRel() {
// Given (n1)<--(n2)-->(n3)
NodeValue node1 = node(42);
NodeValue node2 = node(43);
NodeValue node3 = node(44);
RelationshipValue relationship1 = relationship(1337, node2, node1);
RelationshipValue relationship2 = relationship(1338, node2, node3);
PathValueBuilder builder = builder(node1, node2, node3, relationship1, relationship2);
// When (n1)<--(n2)--(n3)
builder.addNode(node1);
builder.addMultipleUndirected(list(relationship1, relationship2, NO_VALUE));
// Then
assertEquals(NO_VALUE, builder.build());
}
use of org.neo4j.values.virtual.NodeValue in project neo4j by neo4j.
the class PathValueBuilderTest method shouldHandleLongerPath.
@Test
void shouldHandleLongerPath() {
// Given (n1)<--(n2)-->(n3)
NodeValue n1 = node(42);
NodeValue n2 = node(43);
NodeValue n3 = node(44);
RelationshipValue r1 = relationship(1337, n2, n1);
RelationshipValue r2 = relationship(1338, n2, n3);
PathValueBuilder builder = builder(n1, n2, n3, r1, r2);
// When (n1)<--(n2)--(n3)
builder.addNode(n1);
builder.addIncoming(r1);
builder.addUndirected(r2);
// Then
assertEquals(path(n1, r1, n2, r2, n3), builder.build());
}
use of org.neo4j.values.virtual.NodeValue in project neo4j by neo4j.
the class PathValueBuilderTest method shouldHandleLongerPathWithMultiRel.
@Test
void shouldHandleLongerPathWithMultiRel() {
// Given (n1)<--(n2)-->(n3)
NodeValue n1 = node(42);
NodeValue n2 = node(43);
NodeValue n3 = node(44);
RelationshipValue r1 = relationship(1337, n2, n1);
RelationshipValue r2 = relationship(1338, n2, n3);
PathValueBuilder builder = builder(n1, n2, n3, r1, r2);
// When (n1)<--(n2)--(n3)
builder.addNode(n1);
builder.addMultipleUndirected(list(r1, r2));
// Then
assertEquals(path(n1, r1, n2, r2, n3), builder.build());
}
use of org.neo4j.values.virtual.NodeValue in project neo4j by neo4j.
the class PrettyPrinterTest method shouldHandleNodeValueWithoutLabelsNorProperties.
@Test
void shouldHandleNodeValueWithoutLabelsNorProperties() {
// Given
NodeValue node = VirtualValues.nodeValue(42L, Values.stringArray(), EMPTY_MAP);
PrettyPrinter printer = new PrettyPrinter();
// When
node.writeTo(printer);
// Then
assertThat(printer.value()).isEqualTo("(id=42)");
}
use of org.neo4j.values.virtual.NodeValue in project neo4j by neo4j.
the class PrettyPrinterTest method shouldHandlePaths.
@Test
void shouldHandlePaths() {
// Given
NodeValue startNode = VirtualValues.nodeValue(1L, Values.stringArray("L"), EMPTY_MAP);
NodeValue endNode = VirtualValues.nodeValue(2L, Values.stringArray("L"), EMPTY_MAP);
RelationshipValue rel = VirtualValues.relationshipValue(42L, startNode, endNode, stringValue("R"), EMPTY_MAP);
PathValue path = VirtualValues.path(new NodeValue[] { startNode, endNode }, new RelationshipValue[] { rel });
PrettyPrinter printer = new PrettyPrinter();
// When
path.writeTo(printer);
// Then
assertThat(printer.value()).isEqualTo("(id=1 :L)-[id=42 :R]->(id=2 :L)");
}
Aggregations