Skip to content

Commit 0d977f8

Browse files
committed
Remove remaining stub tests and dependency on legacy stub server (neo4j#1088)
* Remove remaining stub tests and dependency on legacy stub server Reactive Testkit backend enabled a lot of Testkit tests to run on reactive driver. This update removes dependency on legacy stub server that is no longer maintained. The remaining stub tests have been removed since there are similar tests in Testkit already, the tests and their respective Testkit alternatives are provided below: - `DirectDriverBoltKitIT.shouldStreamingRecordsInBatchesRx` -> `TestIterationSessionRun.test_half_batch` - Both test result consumption in batches. - `DirectDriverBoltKitIT.shouldDiscardIfPullNotFinished` -> `TestIterationSessionRun.test_discards_on_session_close` - Unlike the original, Testkit test consumes one record and discards the rest using session `run` intead of tx function. Based on its name, the original test purpose was to check if discard happens when result stream is not consumed in full and the suggested test covers this. - `RoutingDriverBoltKitIT.shouldHandleLeaderSwitchAndRetryWhenWritingInTxFunctionRX` -> `RoutingV4x4.test_should_write_successfully_on_leader_switch_using_tx_function` - Both check leader failure handling. One of examples that dependended on stub server has been brought in line with the rest of examples and uses `DatabaseExtension` to manage server. * Renamed RoutingDriverBoltKitIT to ResolverIT
1 parent a3961b1 commit 0d977f8

File tree

15 files changed

+100
-583
lines changed

15 files changed

+100
-583
lines changed

driver/src/test/java/org/neo4j/driver/GraphDatabaseTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,16 @@
5050
import static org.mockito.Mockito.mock;
5151
import static org.mockito.Mockito.verify;
5252
import static org.mockito.Mockito.when;
53+
import static org.neo4j.driver.Logging.none;
5354
import static org.neo4j.driver.internal.logging.DevNullLogging.DEV_NULL_LOGGING;
54-
import static org.neo4j.driver.util.StubServer.INSECURE_CONFIG;
5555

5656
class GraphDatabaseTest
5757
{
58+
private static final Config INSECURE_CONFIG = Config.builder()
59+
.withoutEncryption()
60+
.withLogging( none() )
61+
.build();
62+
5863
@Test
5964
void throwsWhenBoltSchemeUsedWithRoutingParams()
6065
{
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* Copyright (c) "Neo4j"
3+
* Neo4j Sweden AB [http://neo4j.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
package org.neo4j.driver.integration;
20+
21+
import org.junit.jupiter.api.Test;
22+
23+
import org.neo4j.driver.Config;
24+
import org.neo4j.driver.Driver;
25+
import org.neo4j.driver.GraphDatabase;
26+
import org.neo4j.driver.net.ServerAddress;
27+
import org.neo4j.driver.net.ServerAddressResolver;
28+
29+
import static org.junit.jupiter.api.Assertions.assertEquals;
30+
import static org.junit.jupiter.api.Assertions.assertThrows;
31+
import static org.mockito.ArgumentMatchers.any;
32+
import static org.mockito.Mockito.mock;
33+
import static org.mockito.Mockito.verify;
34+
import static org.mockito.Mockito.when;
35+
import static org.neo4j.driver.Logging.none;
36+
37+
class ResolverIT
38+
{
39+
@Test
40+
void shouldFailInitialDiscoveryWhenConfiguredResolverThrows()
41+
{
42+
ServerAddressResolver resolver = mock( ServerAddressResolver.class );
43+
when( resolver.resolve( any( ServerAddress.class ) ) ).thenThrow( new RuntimeException( "Resolution failure!" ) );
44+
45+
Config config = Config.builder()
46+
.withoutEncryption()
47+
.withLogging( none() )
48+
.withResolver( resolver )
49+
.build();
50+
final Driver driver = GraphDatabase.driver( "neo4j://my.server.com:9001", config );
51+
52+
RuntimeException error = assertThrows( RuntimeException.class, driver::verifyConnectivity );
53+
assertEquals( "Resolution failure!", error.getMessage() );
54+
verify( resolver ).resolve( ServerAddress.of( "my.server.com", 9001 ) );
55+
}
56+
}

driver/src/test/java/org/neo4j/driver/integration/RoutingDriverBoltKitIT.java

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

driver/src/test/java/org/neo4j/driver/internal/DirectDriverBoltKitIT.java

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

0 commit comments

Comments
 (0)