From 432de9276159587bd5c813be46606c9b5016610d Mon Sep 17 00:00:00 2001 From: Gregory Woods Date: Wed, 10 Jun 2020 11:36:35 +0100 Subject: [PATCH] Correct examples for Config. Use example.com for URIs --- .../main/java/org/neo4j/driver/Config.java | 21 +++++++++---------- .../driver/ConfigCustomResolverExample.java | 4 ++-- .../org/neo4j/docs/driver/ExamplesStubIT.java | 2 +- .../resources/get_routing_table_only.script | 2 +- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/driver/src/main/java/org/neo4j/driver/Config.java b/driver/src/main/java/org/neo4j/driver/Config.java index 525d230acb..e88fcc1bbd 100644 --- a/driver/src/main/java/org/neo4j/driver/Config.java +++ b/driver/src/main/java/org/neo4j/driver/Config.java @@ -48,23 +48,22 @@ * To build a simple config with custom logging implementation: *
  * {@code
- * Config config = Config
- *                  .build()
- *                  .withLogging(new MyLogging())
- *                  .toConfig();
+ * Config config = Config.builder()
+ *                       .withLogging(new MyLogging())
+ *                       .build();
  * }
  * 
*

* To build a more complicated config with tuned connection pool options: *

  * {@code
- * Config config = Config.build()
- *                          .withEncryption()
- *                          .withConnectionTimeout(10, TimeUnit.SECONDS)
- *                          .withMaxConnectionLifetime(30, TimeUnit.MINUTES)
- *                          .withMaxConnectionPoolSize(10)
- *                          .withConnectionAcquisitionTimeout(20, TimeUnit.SECONDS)
- *                          .toConfig();
+ * Config config = Config.builder()
+ *                       .withEncryption()
+ *                       .withConnectionTimeout( 10, TimeUnit.SECONDS)
+ *                       .withMaxConnectionLifetime(30, TimeUnit.MINUTES)
+ *                       .withMaxConnectionPoolSize(10)
+ *                       .withConnectionAcquisitionTimeout(20, TimeUnit.SECONDS)
+ *                       .build();
  * }
  * 
* diff --git a/examples/src/main/java/org/neo4j/docs/driver/ConfigCustomResolverExample.java b/examples/src/main/java/org/neo4j/docs/driver/ConfigCustomResolverExample.java index 7e0b805846..e611562a39 100644 --- a/examples/src/main/java/org/neo4j/docs/driver/ConfigCustomResolverExample.java +++ b/examples/src/main/java/org/neo4j/docs/driver/ConfigCustomResolverExample.java @@ -62,8 +62,8 @@ private void addPerson( String name ) String username = "neo4j"; String password = "some password"; - try ( Driver driver = createDriver( "neo4j://x.acme.com", username, password, ServerAddress.of( "a.acme.com", 7676 ), - ServerAddress.of( "b.acme.com", 8787 ), ServerAddress.of( "c.acme.com", 9898 ) ) ) + try ( Driver driver = createDriver( "neo4j://x.example.com", username, password, ServerAddress.of( "a.example.com", 7676 ), + ServerAddress.of( "b.example.com", 8787 ), ServerAddress.of( "c.example.com", 9898 ) ) ) { try ( Session session = driver.session( builder().withDefaultAccessMode( AccessMode.WRITE ).build() ) ) { diff --git a/examples/src/test/java/org/neo4j/docs/driver/ExamplesStubIT.java b/examples/src/test/java/org/neo4j/docs/driver/ExamplesStubIT.java index d8f1fedbb5..30e9082626 100644 --- a/examples/src/test/java/org/neo4j/docs/driver/ExamplesStubIT.java +++ b/examples/src/test/java/org/neo4j/docs/driver/ExamplesStubIT.java @@ -35,7 +35,7 @@ void testShouldRunConfigCustomResolverExample() throws Exception StubServer server2 = StubServer.start( "return_1.script", 9002 ); // Given - try ( ConfigCustomResolverExample example = new ConfigCustomResolverExample( "neo4j://x.acme.com", ServerAddress.of( "localhost", 9001 ) ) ) + try ( ConfigCustomResolverExample example = new ConfigCustomResolverExample( "neo4j://x.example.com", ServerAddress.of( "localhost", 9001 ) ) ) { // Then assertTrue( example.canConnect() ); diff --git a/examples/src/test/resources/get_routing_table_only.script b/examples/src/test/resources/get_routing_table_only.script index 79c4a7a4d0..f42314646b 100644 --- a/examples/src/test/resources/get_routing_table_only.script +++ b/examples/src/test/resources/get_routing_table_only.script @@ -3,7 +3,7 @@ !: AUTO HELLO !: AUTO GOODBYE -C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": { "address": "x.acme.com:7687" }} {} +C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": { "address": "x.example.com:7687" }} {} PULL_ALL S: SUCCESS {"fields": ["ttl", "servers"]} RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9001"],"role": "WRITE"}, {"addresses": ["127.0.0.1:9002"], "role": "READ"},{"addresses": ["127.0.0.1:9001"], "role": "ROUTE"}]]