Search in sources :

Example 1 with ExecutionResult

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

the class ExportTest method testFromSimpleCypherResult.

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

Example 2 with ExecutionResult

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

the class ExportTest method testExportConstraintsViaCypherResult.

@Test
public void testExportConstraintsViaCypherResult() throws Exception {
    final Label label = Label.label("Foo");
    gdb.schema().constraintFor(label).assertPropertyIsUnique("bar").create();
    gdb.schema().constraintFor(label).assertPropertyIsUnique("bar2").create();
    commitAndStartNewTransactionAfterSchemaChanges();
    Node n = gdb.createNode(label);
    final ExecutionResult result = result("node", n);
    final SubGraph graph = CypherResultSubGraph.from(result, gdb, true);
    assertEquals("create constraint on (n:`Foo`) assert n.`bar2` is unique;" + lineSeparator() + "create constraint on (n:`Foo`) assert n.`bar` is unique;" + lineSeparator() + "create (_0:`Foo`)" + lineSeparator() + ";" + lineSeparator(), doExportGraph(graph));
}
Also used : Node(org.neo4j.graphdb.Node) Label(org.neo4j.graphdb.Label) ExecutionResult(org.neo4j.cypher.internal.javacompat.ExecutionResult) Test(org.junit.Test)

Example 3 with ExecutionResult

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

the class ExportTest method testEscapingOfNodeStringArrayPropertyValue.

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

Example 4 with ExecutionResult

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

the class ExportTest method testEscapingStringPropertyWithBackslashAndDoubleQuote.

@Test
public void testEscapingStringPropertyWithBackslashAndDoubleQuote() 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 5 with ExecutionResult

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

the class ExportTest method testSingleNode.

@Test
public void testSingleNode() throws Exception {
    Node n = gdb.createNode();
    final ExecutionResult result = result("node", n);
    final SubGraph graph = CypherResultSubGraph.from(result, gdb, false);
    assertEquals("create (_" + n.getId() + ")" + 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