Skip to content

Commit

Permalink
Merge pull request #256 from neo4j/1.1-explicit-port
Browse files Browse the repository at this point in the history
Ensure all URI examples contain an explicit port
  • Loading branch information
pontusmelke authored Oct 24, 2016
2 parents c5e56fd + 33fecbf commit 60acb8a
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ available.

Connect to a Neo4j 3.0.0+ database:

Driver driver = GraphDatabase.driver( "bolt://localhost", AuthTokens.basic( "neo4j", "neo4j" ) );
Driver driver = GraphDatabase.driver( "bolt://localhost:7687", AuthTokens.basic( "neo4j", "neo4j" ) );

try ( Session session = driver.session() )
{
Expand Down
2 changes: 1 addition & 1 deletion driver/src/main/javadoc/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h3>Getting Connected</h3>

<p>Once you have the driver and a connector on your classpath, you can establish sessions with Neo4j.</p>

<pre><code>Driver driver = GraphDatabase.driver( "bolt://localhost", AuthTokens.basic( "neo4j", "p4ssw0rd" ) );
<pre><code>Driver driver = GraphDatabase.driver( "bolt://localhost:7687", AuthTokens.basic( "neo4j", "p4ssw0rd" ) );
try( Session session = driver.session() )
{
StatementResult result = session.run( "RETURN 'hello, world!'" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class DirectDriverTest
public void shouldUseDefaultPortIfMissing()
{
// Given
URI uri = URI.create( "bolt://localhost" );
URI uri = URI.create( "bolt://localhost:7687" );

// When
DirectDriver driver = (DirectDriver) GraphDatabase.driver( uri );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static void setup() throws Exception
{
server = Neo4jRunner.getOrCreateGlobalRunner();
server.ensureRunning( Neo4jSettings.TEST_SETTINGS );
driver = GraphDatabase.driver( "bolt://localhost" );
driver = GraphDatabase.driver( "bolt://localhost:7687" );
}

static class Worker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public void itThrowsAnClientException( List<String> data ) throws Throwable
@And( "^I get a session from the driver and close the driver$" )
public void iGetASessionFromTheDriver() throws Throwable
{
try ( Driver driver = GraphDatabase.driver( "bolt://localhost" ) )
try ( Driver driver = GraphDatabase.driver( "bolt://localhost:7687" ) )
{
transactionRunner = new TransactionRunner( driver.session() );
}
Expand Down Expand Up @@ -228,7 +228,7 @@ public void iSetUpADriverToAnIncorrectScheme() throws Throwable
@Given( "^I have a driver with fixed pool size of (\\d+)$" )
public void iHaveADriverWithFixedPoolSizeOf( int poolSize ) throws Throwable
{
smallDriver = GraphDatabase.driver( "bolt://localhost", Config.build().withMaxSessions( poolSize ).toConfig() );
smallDriver = GraphDatabase.driver( "bolt://localhost:7687", Config.build().withMaxSessions( poolSize ).toConfig() );
}

@And( "^I try to get a session$" )
Expand Down
12 changes: 6 additions & 6 deletions examples/src/main/java/org/neo4j/docs/driver/Examples.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class Examples
public static Driver constructDriver() throws Exception
{
// tag::construct-driver[]
Driver driver = GraphDatabase.driver( "bolt://localhost", AuthTokens.basic("neo4j", "neo4j") );
Driver driver = GraphDatabase.driver( "bolt://localhost:7687", AuthTokens.basic("neo4j", "neo4j") );
// end::construct-driver[]

return driver;
Expand All @@ -51,7 +51,7 @@ public static Driver configuration() throws Exception
{
// tag::configuration[]
Driver driver = GraphDatabase.driver(
"bolt://localhost",
"bolt://localhost:7687",
AuthTokens.basic("neo4j", "neo4j"),
Config.build().withMaxSessions( 10 ).toConfig() );
// end::configuration[]
Expand Down Expand Up @@ -215,7 +215,7 @@ public static void notifications( Session session ) throws Exception
public static Driver requireEncryption() throws Exception
{
// tag::tls-require-encryption[]
Driver driver = GraphDatabase.driver( "bolt://localhost", AuthTokens.basic("neo4j", "neo4j"),
Driver driver = GraphDatabase.driver( "bolt://localhost:7687", AuthTokens.basic("neo4j", "neo4j"),
Config.build().withEncryptionLevel( Config.EncryptionLevel.REQUIRED ).toConfig() );
// end::tls-require-encryption[]

Expand All @@ -225,7 +225,7 @@ public static Driver requireEncryption() throws Exception
public static Driver trustOnFirstUse() throws Exception
{
// tag::tls-trust-on-first-use[]
Driver driver = GraphDatabase.driver( "bolt://localhost", AuthTokens.basic("neo4j", "neo4j"), Config.build()
Driver driver = GraphDatabase.driver( "bolt://localhost:7687", AuthTokens.basic("neo4j", "neo4j"), Config.build()
.withEncryptionLevel( Config.EncryptionLevel.REQUIRED )
.withTrustStrategy( Config.TrustStrategy.trustOnFirstUse( new File( "/path/to/neo4j_known_hosts" ) ) )
.toConfig() );
Expand All @@ -237,7 +237,7 @@ public static Driver trustOnFirstUse() throws Exception
public static Driver trustSignedCertificates() throws Exception
{
// tag::tls-signed[]
Driver driver = GraphDatabase.driver( "bolt://localhost", AuthTokens.basic("neo4j", "neo4j"), Config.build()
Driver driver = GraphDatabase.driver( "bolt://localhost:7687", AuthTokens.basic("neo4j", "neo4j"), Config.build()
.withEncryptionLevel( Config.EncryptionLevel.REQUIRED )
.withTrustStrategy( Config.TrustStrategy.trustCustomCertificateSignedBy( new File( "/path/to/ca-certificate.pem") ) )
.toConfig() );
Expand All @@ -249,7 +249,7 @@ public static Driver trustSignedCertificates() throws Exception
public static Driver connectWithAuthDisabled() throws Exception
{
// tag::connect-with-auth-disabled[]
Driver driver = GraphDatabase.driver( "bolt://localhost",
Driver driver = GraphDatabase.driver( "bolt://localhost:7687",
Config.build().withEncryptionLevel( Config.EncryptionLevel.REQUIRED ).toConfig() );
// end::connect-with-auth-disabled[]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class MinimalWorkingExample
public static void minimalWorkingExample() throws Exception
{
// tag::minimal-example[]
Driver driver = GraphDatabase.driver( "bolt://localhost", AuthTokens.basic( "neo4j", "neo4j" ) );
Driver driver = GraphDatabase.driver( "bolt://localhost:7687", AuthTokens.basic( "neo4j", "neo4j" ) );
Session session = driver.session();

session.run( "CREATE (a:Person {name:'Arthur', title:'King'})" );
Expand Down
22 changes: 11 additions & 11 deletions examples/src/test/java/org/neo4j/docs/driver/ExamplesIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void statement() throws Throwable
{
StdIOCapture stdIO = new StdIOCapture();
try ( AutoCloseable captured = stdIO.capture();
Driver driver = GraphDatabase.driver( "bolt://localhost" );
Driver driver = GraphDatabase.driver( "bolt://localhost:7687" );
Session session = driver.session() )
{
Examples.statement( session );
Expand All @@ -101,7 +101,7 @@ public void statementWithoutParameters() throws Throwable
{
StdIOCapture stdIO = new StdIOCapture();
try ( AutoCloseable captured = stdIO.capture();
Driver driver = GraphDatabase.driver( "bolt://localhost" );
Driver driver = GraphDatabase.driver( "bolt://localhost:7687" );
Session session = driver.session() )
{
Examples.statementWithoutParameters( session );
Expand All @@ -116,7 +116,7 @@ public void resultTraversal() throws Throwable
{
StdIOCapture stdIO = new StdIOCapture();
try ( AutoCloseable captured = stdIO.capture();
Driver driver = GraphDatabase.driver( "bolt://localhost" );
Driver driver = GraphDatabase.driver( "bolt://localhost:7687" );
Session session = driver.session() )
{
session.run( "MATCH (n) DETACH DELETE n" );
Expand All @@ -134,7 +134,7 @@ public void accessRecord() throws Throwable
{
StdIOCapture stdIO = new StdIOCapture();
try ( AutoCloseable captured = stdIO.capture();
Driver driver = GraphDatabase.driver( "bolt://localhost" );
Driver driver = GraphDatabase.driver( "bolt://localhost:7687" );
Session session = driver.session() )
{
session.run( "MATCH (n) DETACH DELETE n" );
Expand All @@ -152,7 +152,7 @@ public void retainResultsForNestedQuerying() throws Throwable
{
StdIOCapture stdIO = new StdIOCapture();
try ( AutoCloseable captured = stdIO.capture();
Driver driver = GraphDatabase.driver( "bolt://localhost" );
Driver driver = GraphDatabase.driver( "bolt://localhost:7687" );
Session session = driver.session() )
{
session.run( "MATCH (n) DETACH DELETE n" );
Expand All @@ -172,7 +172,7 @@ public void retainResultsForLaterProcessing() throws Throwable
{
StdIOCapture stdIO = new StdIOCapture();
try ( AutoCloseable captured = stdIO.capture();
Driver driver = GraphDatabase.driver( "bolt://localhost" ) )
Driver driver = GraphDatabase.driver( "bolt://localhost:7687" ) )
{
try ( Session setup = driver.session() )
{
Expand All @@ -192,7 +192,7 @@ public void handleCypherError() throws Throwable
{
StdIOCapture stdIO = new StdIOCapture();
try ( AutoCloseable captured = stdIO.capture();
Driver driver = GraphDatabase.driver( "bolt://localhost" );
Driver driver = GraphDatabase.driver( "bolt://localhost:7687" );
Session session = driver.session() )
{
exception.expect(RuntimeException.class);
Expand All @@ -203,7 +203,7 @@ public void handleCypherError() throws Throwable
@Test
public void transactionCommit() throws Throwable
{
try ( Driver driver = GraphDatabase.driver( "bolt://localhost" );
try ( Driver driver = GraphDatabase.driver( "bolt://localhost:7687" );
Session session = driver.session() )
{
session.run( "MATCH (n) DETACH DELETE n" );
Expand All @@ -218,7 +218,7 @@ public void transactionCommit() throws Throwable
@Test
public void transactionRollback() throws Throwable
{
try ( Driver driver = GraphDatabase.driver( "bolt://localhost" );
try ( Driver driver = GraphDatabase.driver( "bolt://localhost:7687" );
Session session = driver.session() )
{
session.run( "MATCH (n) DETACH DELETE n" );
Expand All @@ -236,7 +236,7 @@ public void resultSummary() throws Throwable
{
StdIOCapture stdIO = new StdIOCapture();
try ( AutoCloseable captured = stdIO.capture();
Driver driver = GraphDatabase.driver( "bolt://localhost" );
Driver driver = GraphDatabase.driver( "bolt://localhost:7687" );
Session session = driver.session() )
{
Examples.resultSummary( session );
Expand All @@ -253,7 +253,7 @@ public void notifications() throws Throwable
{
StdIOCapture stdIO = new StdIOCapture();
try ( AutoCloseable captured = stdIO.capture();
Driver driver = GraphDatabase.driver( "bolt://localhost" );
Driver driver = GraphDatabase.driver( "bolt://localhost:7687" );
Session session = driver.session() )
{
Examples.notifications( session );
Expand Down

0 comments on commit 60acb8a

Please sign in to comment.