Search in sources :

Example 11 with ExecutionResult

use of org.neo4j.cypher.internal.javacompat.ExecutionResult in project neo4j by neo4j.

the class ExportTest method testEscapingStringPropertyWithBackslash.

@Test
public void testEscapingStringPropertyWithBackslash() throws Exception {
    Node n = gdb.createNode();
    n.setProperty("name", "Some\\thing");
    final ExecutionResult result = result("node", n);
    final SubGraph graph = CypherResultSubGraph.from(result, gdb, false);
    assertEquals("create (_" + n.getId() + " {`name`:\"Some\\\\thing\"})" + lineSeparator() + ";" + lineSeparator(), doExportGraph(graph));
}
Also used : Node(org.neo4j.graphdb.Node) ExecutionResult(org.neo4j.cypher.internal.javacompat.ExecutionResult) Test(org.junit.Test)

Example 12 with ExecutionResult

use of org.neo4j.cypher.internal.javacompat.ExecutionResult in project neo4j by neo4j.

the class ExportTest method testFromPathCypherResult.

@Test
public void testFromPathCypherResult() throws Exception {
    Node n1 = gdb.createNode();
    Node n2 = gdb.createNode();
    final Relationship rel = n1.createRelationshipTo(n2, RelationshipType.withName("REL"));
    final Path path = new PathImpl.Builder(n1).push(rel).build();
    final ExecutionResult result = result("path", path);
    final SubGraph graph = CypherResultSubGraph.from(result, gdb, true);
    assertEquals("create (_0)" + lineSeparator() + "create (_1)" + lineSeparator() + "create (_0)-[:`REL`]->(_1)" + lineSeparator() + ";" + lineSeparator(), doExportGraph(graph));
}
Also used : Path(org.neo4j.graphdb.Path) Node(org.neo4j.graphdb.Node) Relationship(org.neo4j.graphdb.Relationship) ExecutionResult(org.neo4j.cypher.internal.javacompat.ExecutionResult) Test(org.junit.Test)

Example 13 with ExecutionResult

use of org.neo4j.cypher.internal.javacompat.ExecutionResult in project neo4j by neo4j.

the class ExportTest method testEscapingOfRelationshipStringArrayPropertyValue.

@Test
public void testEscapingOfRelationshipStringArrayPropertyValue() throws Exception {
    Node n = gdb.createNode();
    final Relationship rel = n.createRelationshipTo(n, RelationshipType.withName("REL"));
    rel.setProperty("name", new String[] { "Brutus \"Brutal\" Howell", "Dr." });
    final ExecutionResult result = result("rel", rel);
    final SubGraph graph = CypherResultSubGraph.from(result, gdb, true);
    assertEquals("create (_0)" + lineSeparator() + "create (_0)-[:`REL` {`name`:[\"Brutus \\\"Brutal\\\" Howell\", \"Dr.\"]}]->(_0)" + lineSeparator() + ";" + lineSeparator(), doExportGraph(graph));
}
Also used : Node(org.neo4j.graphdb.Node) Relationship(org.neo4j.graphdb.Relationship) ExecutionResult(org.neo4j.cypher.internal.javacompat.ExecutionResult) Test(org.junit.Test)

Example 14 with ExecutionResult

use of org.neo4j.cypher.internal.javacompat.ExecutionResult in project neo4j by neo4j.

the class ExportTest method testSingleNodeLabels.

@Test
public void testSingleNodeLabels() throws Exception {
    Node n = gdb.createNode();
    n.addLabel(Label.label("Foo"));
    n.addLabel(Label.label("Bar"));
    final ExecutionResult result = result("node", n);
    final SubGraph graph = CypherResultSubGraph.from(result, gdb, false);
    assertEquals("create (_" + n.getId() + ":`Foo`:`Bar`)" + lineSeparator() + ";" + lineSeparator(), doExportGraph(graph));
}
Also used : Node(org.neo4j.graphdb.Node) ExecutionResult(org.neo4j.cypher.internal.javacompat.ExecutionResult) Test(org.junit.Test)

Example 15 with ExecutionResult

use of org.neo4j.cypher.internal.javacompat.ExecutionResult in project neo4j by neo4j.

the class ExportTest method testSingleNodeWithArrayProperties.

@Test
public void testSingleNodeWithArrayProperties() throws Exception {
    Node n = gdb.createNode();
    n.setProperty("name", new String[] { "a", "b" });
    n.setProperty("age", new int[] { 1, 2 });
    final ExecutionResult result = result("node", n);
    final SubGraph graph = CypherResultSubGraph.from(result, gdb, false);
    assertEquals("create (_" + n.getId() + " {`age`:[1, 2], `name`:[\"a\", \"b\"]})" + lineSeparator() + ";" + lineSeparator(), doExportGraph(graph));
}
Also used : Node(org.neo4j.graphdb.Node) ExecutionResult(org.neo4j.cypher.internal.javacompat.ExecutionResult) Test(org.junit.Test)

Aggregations

ExecutionResult (org.neo4j.cypher.internal.javacompat.ExecutionResult)16 Test (org.junit.Test)15 Node (org.neo4j.graphdb.Node)15 Relationship (org.neo4j.graphdb.Relationship)4 Label (org.neo4j.graphdb.Label)2 Collections.singletonMap (java.util.Collections.singletonMap)1 Map (java.util.Map)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1 Path (org.neo4j.graphdb.Path)1 ResourceIterator (org.neo4j.graphdb.ResourceIterator)1