use of org.neo4j.values.virtual.RelationshipValue 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.RelationshipValue 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)");
}
use of org.neo4j.values.virtual.RelationshipValue in project neo4j by neo4j.
the class PrettyPrinterTest method shouldHandleRelationshipValueWithoutProperties.
@Test
void shouldHandleRelationshipValueWithoutProperties() {
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);
PrettyPrinter printer = new PrettyPrinter();
// When
rel.writeTo(printer);
// Then
assertThat(printer.value()).isEqualTo("-[id=42 :R]-");
}
use of org.neo4j.values.virtual.RelationshipValue in project neo4j by neo4j.
the class PrettyPrinterTest method shouldHandleRelationshipValueAsReference.
@Test
void shouldHandleRelationshipValueAsReference() {
// 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"), props("foo", intValue(42), "bar", list(intValue(1337), stringValue("baz"))));
PrettyPrinter printer = new PrettyPrinter(REFERENCE);
// When
rel.writeTo(printer);
// Then
assertThat(printer.value()).isEqualTo("-[id=42]-");
}
use of org.neo4j.values.virtual.RelationshipValue in project neo4j by neo4j.
the class PrettyPrinterTest method shouldHandleRelationshipValue.
@Test
void shouldHandleRelationshipValue() {
// 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"), props("foo", intValue(42), "bar", list(intValue(1337), stringValue("baz"))));
PrettyPrinter printer = new PrettyPrinter();
// When
rel.writeTo(printer);
// Then
assertThat(printer.value()).isEqualTo("-[id=42 :R {bar: [1337, \"baz\"], foo: 42}]-");
}
Aggregations