Browse files

Merge

  • Loading branch information...
2 parents 768eb0f + 1e01b28 commit 56b7d30f82db1ed0aadfd9738d03e6adbfd65a43 @jexp jexp committed Feb 4, 2013
View
19 src/main/java/org/neo4j/kernel/impl/transaction/Neo4j18Locker.java
@@ -1,3 +1,22 @@
+/**
+ * Copyright (c) 2002-2013 "Neo Technology,"
+ * Network Engine for Objects in Lund AB [http://neotechnology.com]
+ *
+ * This file is part of Neo4j.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
package org.neo4j.kernel.impl.transaction;
import org.neo4j.graphdb.GraphDatabaseService;
View
72 src/test/java/org/neo4j/collections/indexprovider/TimelineIndexProviderTest.java
@@ -38,12 +38,6 @@
*/
package org.neo4j.collections.indexprovider;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.util.HashMap;
-import java.util.Map;
-
import org.junit.Before;
import org.junit.Test;
import org.neo4j.collections.timeline.Timeline;
@@ -58,70 +52,72 @@
import org.neo4j.visualization.graphviz.GraphvizWriter;
import org.neo4j.walk.Walker;
-public class TimelineIndexProviderTest
-{
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+public class TimelineIndexProviderTest {
private ImpermanentGraphDatabase db;
@Before
- public void setup() throws Exception
- {
+ public void setup() throws Exception {
db = new ImpermanentGraphDatabase();
- db.cleanContent( true );
+ db.cleanContent(true);
}
@Test
- public void testLoadIndex()
- {
+ public void testLoadIndex() {
Map<String, String> config = TimelineIndexProvider.CONFIG;
IndexManager indexMan = db.index();
- Index<Node> index = indexMan.forNodes( "timeline1", config );
- assertNotNull( index );
+ Index<Node> index = indexMan.forNodes("timeline1", config);
+ assertNotNull(index);
}
+
@Test
- public void testLoadIndexWithRootNode()
- {
- Map<String, String> config = new HashMap<String, String> (TimelineIndexProvider.CONFIG);
+ public void testLoadIndexWithRootNode() {
+ Map<String, String> config = new HashMap<String, String>(TimelineIndexProvider.CONFIG);
final Node startNode = db.getReferenceNode();
- config.put(TimelineNodeIndex.START_NODE_ID,String.valueOf(startNode.getId()));
+ config.put(TimelineNodeIndex.START_NODE_ID, String.valueOf(startNode.getId()));
IndexManager indexMan = db.index();
- Index<Node> index = indexMan.forNodes( "timeline1", config );
+ Index<Node> index = indexMan.forNodes("timeline1", config);
final Timeline timeline = ((TimelineNodeIndex) index).getTimeline();
assertEquals(startNode, timeline.getUnderlyingNode());
- assertNotNull( index );
+ assertNotNull(index);
}
@Test
- public void testAddToIndex() throws Exception
- {
+ public void testAddToIndex() throws Exception {
Map<String, String> config = TimelineIndexProvider.CONFIG;
IndexManager indexMan = db.index();
- Index<Node> index = indexMan.forNodes( "timeline1", config );
- assertNotNull( index );
+ Index<Node> index = indexMan.forNodes("timeline1", config);
+ assertNotNull(index);
Transaction tx = db.beginTx();
Node n1 = db.createNode();
- n1.setProperty( "time", 123 );
- index.add( n1, "timestamp", 123L );
+ n1.setProperty("time", 123);
+ index.add(n1, "timestamp", 123L);
Node n2 = db.createNode();
- n2.setProperty( "time", 123 );
- index.add( n2, "timestamp", 123L );
+ n2.setProperty("time", 123);
+ index.add(n2, "timestamp", 123L);
Node n3 = db.createNode();
- n3.setProperty( "time", 124 );
- index.add( n3, "timestamp", 124L );
+ n3.setProperty("time", 124);
+ index.add(n3, "timestamp", 124L);
tx.success();
tx.finish();
GraphvizWriter writer = new GraphvizWriter();
- writer.emit( System.out, Walker.fullGraph( db ));
- IndexHits<Node> hits = index.get( "timestamp", 123L );
+ writer.emit(System.out, Walker.fullGraph(db));
+ IndexHits<Node> hits = index.get("timestamp", 123L);
assertEquals(2, hits.size());
- hits = index.query( "[122 TO 125]" );
+ hits = index.query("[122 TO 125]");
assertEquals(3, hits.size());
-
- ExecutionEngine engine = new ExecutionEngine( db );
- ExecutionResult result = engine.execute( "start n=node:timeline1('[100 TO 200]') return n" );
- System.out.println( result.toString() );
+
+ ExecutionEngine engine = new ExecutionEngine(db);
+ ExecutionResult result = engine.execute("start n=node:timeline1('[100 TO 200]') return n");
+ System.out.println(result.toString());
}

0 comments on commit 56b7d30

Please sign in to comment.