Skip to content

Commit 9f3876a

Browse files
committed
Merge pull request neo4j#176 from zhenlineo/1.0-move-server-control-to-py
Change the java driver to use neokit to manage server start
2 parents bd0ad3a + 90b52f3 commit 9f3876a

15 files changed

+188
-472
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "neokit"]
2+
path = neokit
3+
url = https://github.com/neo-technology/neokit.git

README.md

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Neo4j Java Driver
22

3-
A database driver for a new Neo4j remoting protocol.
3+
This is the first official Neo4j java driver for connecting to Neo4j-the-database via the newly designed remoting
4+
protocol BOLT.
45

56
## Minimum viable snippet
67

@@ -10,27 +11,37 @@ Add the driver to your project:
1011
<dependency>
1112
<groupId>org.neo4j.driver</groupId>
1213
<artifactId>neo4j-java-driver</artifactId>
13-
<version>1.0.0-RC1</version>
14+
<version>x.y.z</version>
1415
</dependency>
1516
</dependencies>
1617

17-
Connect to a Neo4j 3.0.0+ database
18+
*Please check the [Releases](https://github.com/neo4j/neo4j-java-driver/releases) for the newest driver version
19+
available.
1820

19-
Driver driver = GraphDatabase.driver( "bolt://localhost" );
21+
Connect to a Neo4j 3.0.0+ database:
22+
23+
Driver driver = ( "bolt://localhost", AuthTokens.basic( "neo4j", "neo4j" ) );
2024

2125
Session session = driver.session();
2226

23-
StatementResult rs = session.run("CREATE (n) RETURN n");
27+
StatementResult rs = session.run( "CREATE (n) RETURN n" );
2428

2529
session.close();
2630

2731
driver.close();
2832

29-
# Building
33+
For more examples and details of usage, please refer to the [Driver Manual] (http://neo4j.com/docs/developer-manual/3
34+
.0/index.html#driver-manual-index).
35+
36+
## Binding
3037

31-
## Java version
38+
The source code here reflects the current development status of a new driver version.
39+
If you want to use the driver in your products, please use the released driver via maven central or check out the
40+
code with git tags instead.
3241

33-
If you are running Java 8:
42+
### Java version
43+
44+
To compile the code and run all tests, if you are running Java 8:
3445

3546
mvn clean install
3647

@@ -43,7 +54,15 @@ Java 8, because Neo4j-the-database needs it to run.
4354
# For instance
4455
export NEO4J_JAVA=$(/usr/libexec/java_home -v 1.8)
4556

46-
## Windows
57+
### Windows
58+
59+
If you are building on windows, you need to have Python (v2.7) installed and have Python.exe to be added in your system `PATH` variables.
60+
Then run install as admin, so that Neo4j-the-database could be installed and started with Python scripts for integration tests.
61+
62+
Or you could choose to ignore integration tests by running:
63+
64+
mvn clean install -DskipITs
65+
66+
Without integration tests, there is no need to install Python or run as admin.
4767

48-
If you are building on windows, you need to run install as admin so that Neo4j-the-database could be registered as a
49-
windows service and then be started and stopped correctly using its powershell scripts for windows.
68+
For more information such as manual, driver API documentations, changelogs, please refer to [wiki](https://github.com/neo4j/neo4j-java-driver/wiki).

driver/src/test/java/org/neo4j/driver/v1/integration/CredentialsIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public void shouldGetHelpfulErrorOnInvalidCredentials() throws Throwable
8787

8888
private void enableAuth( String password ) throws Exception
8989
{
90-
neo4j.restartServerOnEmptyDatabase( Neo4jSettings.DEFAULT
90+
neo4j.restart( Neo4jSettings.TEST_SETTINGS
9191
.updateWith( Neo4jSettings.AUTH_ENABLED, "true" )
9292
.updateWith( Neo4jSettings.DATA_DIR, tempDir.getRoot().getAbsolutePath().replace("\\", "/") ));
9393

driver/src/test/java/org/neo4j/driver/v1/integration/LoadCSVIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
public class LoadCSVIT
3939
{
4040
@Rule
41-
public TestNeo4j neo4j = new TestNeo4j( Neo4jSettings.DEFAULT.without( Neo4jSettings.IMPORT_DIR ));
41+
public TestNeo4j neo4j = new TestNeo4j( Neo4jSettings.TEST_SETTINGS.without( Neo4jSettings.IMPORT_DIR ));
4242

4343
@Test
4444
public void shouldLoadCSV() throws Throwable

driver/src/test/java/org/neo4j/driver/v1/integration/TLSSocketChannelIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public void shouldPerformTLSHandshakeWithTrustedCert() throws Throwable
138138
finally
139139
{
140140
// always restore the db default settings
141-
neo4j.restartServerOnEmptyDatabase( Neo4jSettings.DEFAULT );
141+
neo4j.restart();
142142
}
143143
}
144144

@@ -197,8 +197,8 @@ private void createFakeServerCertPairInKnownCerts( String host, int port, File k
197197
public void shouldFailTLSHandshakeDueToServerCertNotSignedByKnownCA() throws Throwable
198198
{
199199
// Given
200-
neo4j.restartServerOnEmptyDatabase(
201-
Neo4jSettings.DEFAULT.updateWith(
200+
neo4j.restart(
201+
Neo4jSettings.TEST_SETTINGS.updateWith(
202202
Neo4jSettings.CERT_DIR,
203203
folder.getRoot().getAbsolutePath().replace("\\", "/") ) );
204204
SocketChannel channel = SocketChannel.open();

driver/src/test/java/org/neo4j/driver/v1/stress/DriverStresser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public static void main( String... args ) throws Throwable
5757
public static void setup() throws Exception
5858
{
5959
server = Neo4jRunner.getOrCreateGlobalRunner();
60-
server.ensureRunning( Neo4jSettings.DEFAULT );
60+
server.ensureRunning( Neo4jSettings.TEST_SETTINGS );
6161
driver = GraphDatabase.driver( "bolt://localhost" );
6262
}
6363

@@ -88,7 +88,7 @@ public int operation()
8888
public static void tearDown() throws Exception
8989
{
9090
driver.close();
91-
server.stop();
91+
server.stopNeo4j();
9292
}
9393

9494

driver/src/test/java/org/neo4j/driver/v1/tck/DriverAuthSteps.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public void reset()
6363
{
6464
driver.close();
6565
}
66-
neo4j.useDefaultEncryptionKeyAndCert();
66+
neo4j.restart();
6767
}
6868
catch ( Exception e )
6969
{
@@ -121,7 +121,7 @@ public void aProtocolErrorIsRaised() throws Throwable
121121

122122
private Driver configureCredentials( String name, String oldPassword, String newPassword ) throws Exception
123123
{
124-
neo4j.restartServerOnEmptyDatabase( Neo4jSettings.DEFAULT
124+
neo4j.restart( Neo4jSettings.TEST_SETTINGS
125125
.updateWith( Neo4jSettings.AUTH_ENABLED, "true" )
126126
.updateWith( Neo4jSettings.DATA_DIR, tempDir.getAbsolutePath().replace("\\", "/") ));
127127

driver/src/test/java/org/neo4j/driver/v1/tck/DriverSecurityComplianceSteps.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ public void clearAfterEachScenario() throws Throwable
268268
@After("@modifies_db_config")
269269
public void resetDbWithDefaultSettings() throws Throwable
270270
{
271-
neo4j.useDefaultEncryptionKeyAndCert();
271+
neo4j.restart();
272272
}
273273

274274
private File tempFile(String prefix, String suffix) throws Throwable

driver/src/test/java/org/neo4j/driver/v1/util/Neo4jDefaultInstaller.java

Lines changed: 0 additions & 77 deletions
This file was deleted.

driver/src/test/java/org/neo4j/driver/v1/util/Neo4jInstaller.java

Lines changed: 0 additions & 138 deletions
This file was deleted.

0 commit comments

Comments
 (0)