From e9e5a9396baf153804c6b2e18c4d669cf13d965b Mon Sep 17 00:00:00 2001 From: Zhen Li Date: Thu, 28 Feb 2019 13:53:34 +0100 Subject: [PATCH] Fix some test failures due to changes to routing table procedure on read-replica in 4.0 Removed the changes to driver API --- .../java/org/neo4j/driver/internal/BoltServerAddress.java | 1 - .../java/org/neo4j/driver/internal/util/ServerVersion.java | 1 + .../main/java/org/neo4j/driver/v1/net/ServerAddress.java | 7 ------- .../java/org/neo4j/driver/internal/util/Neo4jFeature.java | 4 +++- .../neo4j/driver/v1/integration/CausalClusteringIT.java | 4 ++++ .../neo4j/driver/v1/integration/ConnectionHandlingIT.java | 2 +- 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/driver/src/main/java/org/neo4j/driver/internal/BoltServerAddress.java b/driver/src/main/java/org/neo4j/driver/internal/BoltServerAddress.java index 0d478576a5..a6a6316103 100644 --- a/driver/src/main/java/org/neo4j/driver/internal/BoltServerAddress.java +++ b/driver/src/main/java/org/neo4j/driver/internal/BoltServerAddress.java @@ -137,7 +137,6 @@ public String host() return host; } - @Override public String originalHost() { return originalHost; diff --git a/driver/src/main/java/org/neo4j/driver/internal/util/ServerVersion.java b/driver/src/main/java/org/neo4j/driver/internal/util/ServerVersion.java index d80ecd05e2..4fa75a40c8 100644 --- a/driver/src/main/java/org/neo4j/driver/internal/util/ServerVersion.java +++ b/driver/src/main/java/org/neo4j/driver/internal/util/ServerVersion.java @@ -31,6 +31,7 @@ public class ServerVersion { public static final String NEO4J_PRODUCT = "Neo4j"; + public static final ServerVersion v4_0_0 = new ServerVersion( NEO4J_PRODUCT, 4, 0, 0 ); public static final ServerVersion v3_5_0 = new ServerVersion( NEO4J_PRODUCT, 3, 5, 0 ); public static final ServerVersion v3_4_0 = new ServerVersion( NEO4J_PRODUCT, 3, 4, 0 ); public static final ServerVersion v3_2_0 = new ServerVersion( NEO4J_PRODUCT, 3, 2, 0 ); diff --git a/driver/src/main/java/org/neo4j/driver/v1/net/ServerAddress.java b/driver/src/main/java/org/neo4j/driver/v1/net/ServerAddress.java index 4dd3f61dfb..880eef7a61 100644 --- a/driver/src/main/java/org/neo4j/driver/v1/net/ServerAddress.java +++ b/driver/src/main/java/org/neo4j/driver/v1/net/ServerAddress.java @@ -33,13 +33,6 @@ public interface ServerAddress */ String host(); - /** - * Returns the original host name of this {@link ServerAddress}. - * This value might different from {@link #host()} when the host is a resolved IP address. - * @return the original host name, never {@code null}. - */ - String originalHost(); - /** * Retrieve the port portion of this {@link ServerAddress}. * diff --git a/driver/src/test/java/org/neo4j/driver/internal/util/Neo4jFeature.java b/driver/src/test/java/org/neo4j/driver/internal/util/Neo4jFeature.java index 4c319f757a..a54522f1ba 100644 --- a/driver/src/test/java/org/neo4j/driver/internal/util/Neo4jFeature.java +++ b/driver/src/test/java/org/neo4j/driver/internal/util/Neo4jFeature.java @@ -23,6 +23,7 @@ import static org.neo4j.driver.internal.util.ServerVersion.v3_2_0; import static org.neo4j.driver.internal.util.ServerVersion.v3_4_0; import static org.neo4j.driver.internal.util.ServerVersion.v3_5_0; +import static org.neo4j.driver.internal.util.ServerVersion.v4_0_0; public enum Neo4jFeature { @@ -36,7 +37,8 @@ public enum Neo4jFeature STATEMENT_RESULT_TIMINGS( v3_1_0 ), LIST_QUERIES_PROCEDURE( v3_1_0 ), CONNECTOR_LISTEN_ADDRESS_CONFIGURATION( v3_1_0 ), - BOLT_V3( v3_5_0 ); + BOLT_V3( v3_5_0 ), + BOLT_V4( v4_0_0 ); private final ServerVersion availableFromVersion; diff --git a/driver/src/test/java/org/neo4j/driver/v1/integration/CausalClusteringIT.java b/driver/src/test/java/org/neo4j/driver/v1/integration/CausalClusteringIT.java index c569ce7887..7174c6151d 100644 --- a/driver/src/test/java/org/neo4j/driver/v1/integration/CausalClusteringIT.java +++ b/driver/src/test/java/org/neo4j/driver/v1/integration/CausalClusteringIT.java @@ -41,6 +41,7 @@ import org.neo4j.driver.internal.cluster.RoutingSettings; import org.neo4j.driver.internal.retry.RetrySettings; import org.neo4j.driver.internal.util.ChannelTrackingDriverFactory; +import org.neo4j.driver.internal.util.DisabledOnNeo4jWith; import org.neo4j.driver.internal.util.FailingConnectionDriverFactory; import org.neo4j.driver.internal.util.FakeClock; import org.neo4j.driver.internal.util.ServerVersion; @@ -86,6 +87,7 @@ import static org.neo4j.driver.internal.logging.DevNullLogging.DEV_NULL_LOGGING; import static org.neo4j.driver.internal.util.Matchers.connectionAcquisitionTimeoutError; import static org.neo4j.driver.internal.util.Neo4jFeature.BOLT_V3; +import static org.neo4j.driver.internal.util.Neo4jFeature.BOLT_V4; import static org.neo4j.driver.v1.Values.parameters; import static org.neo4j.driver.v1.util.DaemonThreadFactory.daemon; import static org.neo4j.driver.v1.util.TestUtil.await; @@ -137,6 +139,7 @@ void shouldExecuteReadAndWritesWhenDriverSuppliedWithAddressOfLeader() throws Ex } @Test + @DisabledOnNeo4jWith( BOLT_V4 ) void shouldExecuteReadAndWritesWhenRouterIsDiscovered() throws Exception { Cluster cluster = clusterRule.getCluster(); @@ -157,6 +160,7 @@ void shouldExecuteReadAndWritesWhenDriverSuppliedWithAddressOfFollower() throws } @Test + @DisabledOnNeo4jWith( BOLT_V4 ) void sessionCreationShouldFailIfCallingDiscoveryProcedureOnEdgeServer() { Cluster cluster = clusterRule.getCluster(); diff --git a/driver/src/test/java/org/neo4j/driver/v1/integration/ConnectionHandlingIT.java b/driver/src/test/java/org/neo4j/driver/v1/integration/ConnectionHandlingIT.java index 137a99f946..bf771c9c68 100644 --- a/driver/src/test/java/org/neo4j/driver/v1/integration/ConnectionHandlingIT.java +++ b/driver/src/test/java/org/neo4j/driver/v1/integration/ConnectionHandlingIT.java @@ -189,7 +189,7 @@ void connectionUsedForSessionRunReturnedToThePoolWhenServerErrorDuringResultFetc Connection connection1 = connectionPool.lastAcquiredConnectionSpy; verify( connection1, never() ).release(); - assertThrows( ClientException.class, result::hasNext ); + assertThrows( ClientException.class, result::consume ); Connection connection2 = connectionPool.lastAcquiredConnectionSpy; assertSame( connection1, connection2 );