Search in sources :

Example 76 with Node

use of org.neo4j.graphdb.Node in project neo4j by neo4j.

the class TestNeo4jCacheAndPersistence method deleteTestingGraph.

@After
public void deleteTestingGraph() {
    Node node1 = getGraphDb().getNodeById(node1Id);
    Node node2 = getGraphDb().getNodeById(node2Id);
    node1.getSingleRelationship(MyRelTypes.TEST, Direction.BOTH).delete();
    node1.delete();
    node2.delete();
}
Also used : Node(org.neo4j.graphdb.Node) After(org.junit.After)

Example 77 with Node

use of org.neo4j.graphdb.Node in project neo4j by neo4j.

the class TestProperties method charRange.

@Test
public void charRange() throws Exception {
    Node node = getGraphDb().createNode();
    char stride = Character.MAX_VALUE / VALUE_RANGE_SPLIT;
    for (char i = Character.MIN_VALUE; i < Character.MAX_VALUE; ) {
        setPropertyAndAssertIt(node, i);
        i = i > 0 && Character.MAX_VALUE - i < stride ? Character.MAX_VALUE : (char) (i + stride);
    }
}
Also used : Node(org.neo4j.graphdb.Node) Test(org.junit.Test)

Example 78 with Node

use of org.neo4j.graphdb.Node in project neo4j by neo4j.

the class TestProperties method removeSomeAndSetSome.

@Test
public void removeSomeAndSetSome() throws Exception {
    Node node = getGraphDb().createNode();
    node.setProperty("remove me", "trash");
    newTransaction();
    node.removeProperty("remove me");
    node.setProperty("foo", "bar");
    node.setProperty("baz", 17);
    newTransaction();
    assertEquals("bar", node.getProperty("foo"));
    assertEquals(17, node.getProperty("baz"));
    assertNull(node.getProperty("remove me", null));
}
Also used : Node(org.neo4j.graphdb.Node) Test(org.junit.Test)

Example 79 with Node

use of org.neo4j.graphdb.Node in project neo4j by neo4j.

the class TestProperties method removeOneOfThree.

@Test
public void removeOneOfThree() throws Exception {
    Node node = getGraphDb().createNode();
    node.setProperty("1", 1);
    node.setProperty("2", 2);
    node.setProperty("3", 3);
    newTransaction();
    node.removeProperty("2");
    newTransaction();
    assertNull(node.getProperty("2", null));
}
Also used : Node(org.neo4j.graphdb.Node) Test(org.junit.Test)

Example 80 with Node

use of org.neo4j.graphdb.Node in project neo4j by neo4j.

the class TestProperties method floatRange.

@Test
public void floatRange() throws Exception {
    Node node = getGraphDb().createNode();
    float stride = 16f;
    for (float i = Float.MIN_VALUE; i < Float.MAX_VALUE; ) {
        setPropertyAndAssertIt(node, i);
        setPropertyAndAssertIt(node, -i);
        i *= stride;
    }
}
Also used : Node(org.neo4j.graphdb.Node) Test(org.junit.Test)

Aggregations

Node (org.neo4j.graphdb.Node)1281 Test (org.junit.Test)781 Transaction (org.neo4j.graphdb.Transaction)540 Relationship (org.neo4j.graphdb.Relationship)375 GraphDatabaseService (org.neo4j.graphdb.GraphDatabaseService)146 NotFoundException (org.neo4j.graphdb.NotFoundException)78 File (java.io.File)65 LinkedList (java.util.LinkedList)60 RelationshipType (org.neo4j.graphdb.RelationshipType)58 HashMap (java.util.HashMap)57 Label (org.neo4j.graphdb.Label)57 Path (org.neo4j.graphdb.Path)52 KernelTransaction (org.neo4j.kernel.api.KernelTransaction)46 HashSet (java.util.HashSet)45 Map (java.util.Map)45 WeightedPath (org.neo4j.graphalgo.WeightedPath)37 TestGraphDatabaseFactory (org.neo4j.test.TestGraphDatabaseFactory)35 ArrayList (java.util.ArrayList)30 List (java.util.List)27 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)26