use of org.neo4j.values.virtual.NodeValue 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.NodeValue 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}]-");
}
use of org.neo4j.values.virtual.NodeValue in project neo4j by neo4j.
the class ValueMapperTest method parameters.
private static Stream<AnyValue> parameters() {
NodeValue node1 = nodeValue(1, stringArray(), EMPTY_MAP);
NodeValue node2 = nodeValue(2, stringArray(), EMPTY_MAP);
NodeValue node3 = nodeValue(3, stringArray(), EMPTY_MAP);
RelationshipValue relationship1 = relationshipValue(100, node1, node2, stringValue("ONE"), EMPTY_MAP);
RelationshipValue relationship2 = relationshipValue(200, node2, node2, stringValue("TWO"), EMPTY_MAP);
return Stream.of(node1, relationship1, path(new NodeValue[] { node1, node2, node3 }, new RelationshipValue[] { relationship1, relationship2 }), map(new String[] { "alpha", "beta" }, new AnyValue[] { stringValue("one"), numberValue(2) }), NO_VALUE, list(numberValue(1), stringValue("fine"), node2), stringValue("hello world"), stringArray("hello", "brave", "new", "world"), booleanValue(false), booleanArray(new boolean[] { true, false, true }), charValue('\n'), charArray(new char[] { 'h', 'e', 'l', 'l', 'o' }), byteValue((byte) 3), byteArray(new byte[] { 0x00, (byte) 0x99, (byte) 0xcc }), shortValue((short) 42), shortArray(new short[] { 1337, (short) 0xcafe, (short) 0xbabe }), intValue(987654321), intArray(new int[] { 42, 11 }), longValue(9876543210L), longArray(new long[] { 0xcafebabe, 0x1ee7 }), floatValue(Float.MAX_VALUE), floatArray(new float[] { Float.NEGATIVE_INFINITY, Float.MIN_VALUE }), doubleValue(Double.MIN_NORMAL), doubleArray(new double[] { Double.POSITIVE_INFINITY, Double.MAX_VALUE }), datetime(2018, 1, 16, 10, 36, 43, 123456788, ZoneId.of("Europe/Stockholm")), localDateTime(2018, 1, 16, 10, 36, 43, 123456788), date(2018, 1, 16), time(10, 36, 43, 123456788, ZoneOffset.ofHours(1)), localTime(10, 36, 43, 123456788), duration(399, 4, 48424, 133701337), pointValue(Cartesian, 11, 32), pointArray(new Point[] { pointValue(Cartesian, 11, 32), pointValue(WGS84, 13, 56) }));
}
use of org.neo4j.values.virtual.NodeValue in project neo4j by neo4j.
the class AnyValueComparatorTest method shouldTernaryCompareRelationships.
@Test
void shouldTernaryCompareRelationships() {
NodeValue start = nodeValue(42, stringArray("L"), EMPTY_MAP);
NodeValue end = nodeValue(43, stringArray("L"), EMPTY_MAP);
MapValue propMap = map("foo", "bar");
RelationshipValue rel1 = relationshipValue(42, start, end, stringValue("R"), propMap);
RelationshipValue rel2 = relationshipValue(43, start, end, stringValue("R"), propMap);
assertTernaryCompare(rel1, rel1, EQUAL);
assertTernaryCompare(rel1, rel2, SMALLER_THAN);
assertTernaryCompare(rel1, relationship(rel1.id()), EQUAL);
assertTernaryCompare(rel1, intValue(42), UNDEFINED);
assertTernaryCompare(rel1, propMap, UNDEFINED);
}
use of org.neo4j.values.virtual.NodeValue in project neo4j by neo4j.
the class PrettyPrinterTest method shouldHandleRelationshipValueWithoutLabelsNorProperties.
@Test
void shouldHandleRelationshipValueWithoutLabelsNorProperties() {
// 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)");
}
Aggregations