Skip to content

Commit ac08b51

Browse files
committed
Update
1 parent 9ce4ede commit ac08b51

File tree

18 files changed

+593
-167
lines changed

18 files changed

+593
-167
lines changed

bolt-api-netty/src/test/java/org/neo4j/driver/internal/bolt/basicimpl/impl/async/connection/NettyChannelInitializerTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import org.junit.jupiter.api.Test;
4444
import org.neo4j.driver.internal.bolt.api.BoltServerAddress;
4545
import org.neo4j.driver.internal.bolt.api.SecurityPlan;
46+
import org.neo4j.driver.internal.bolt.api.SecurityPlans;
4647
import org.neo4j.driver.internal.bolt.basicimpl.impl.NoopLoggingProvider;
4748

4849
class NettyChannelInitializerTest {
@@ -65,7 +66,7 @@ void shouldAddSslHandlerWhenRequiresEncryption() {
6566

6667
@Test
6768
void shouldNotAddSslHandlerWhenDoesNotRequireEncryption() {
68-
var security = SecurityPlan.INSECURE;
69+
var security = SecurityPlans.insecure();
6970
var initializer = newInitializer(security);
7071

7172
initializer.initChannel(channel);
@@ -90,7 +91,7 @@ void shouldAddSslHandlerWithHandshakeTimeout() {
9091
void shouldUpdateChannelAttributes() {
9192
var clock = mock(Clock.class);
9293
when(clock.millis()).thenReturn(42L);
93-
var security = SecurityPlan.INSECURE;
94+
var security = SecurityPlans.insecure();
9495
var initializer = newInitializer(security, Integer.MAX_VALUE, clock);
9596

9697
initializer.initChannel(channel);

bolt-api-pooled/src/test/java/org/neo4j/driver/internal/bolt/pooledimpl/PooledBoltConnectionProviderTest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
import org.neo4j.driver.internal.bolt.api.ResponseHandler;
6666
import org.neo4j.driver.internal.bolt.api.RoutingContext;
6767
import org.neo4j.driver.internal.bolt.api.SecurityPlan;
68+
import org.neo4j.driver.internal.bolt.api.SecurityPlans;
6869
import org.neo4j.driver.internal.bolt.api.exception.MinVersionAcquisitionException;
6970
import org.neo4j.driver.internal.bolt.api.summary.ResetSummary;
7071
import org.neo4j.driver.internal.bolt.api.values.Value;
@@ -104,7 +105,7 @@ class PooledBoltConnectionProviderTest {
104105
final String userAgent = "agent";
105106
final int timeout = 1000;
106107

107-
final SecurityPlan securityPlan = SecurityPlan.INSECURE;
108+
final SecurityPlan securityPlan = SecurityPlans.insecure();
108109
final DatabaseName databaseName = DatabaseNameUtil.defaultDatabase();
109110
final AccessMode mode = AccessMode.WRITE;
110111
final Set<String> bookmarks = Set.of("bookmark1", "bookmark2");
@@ -512,7 +513,7 @@ void shouldVerifyConnectivity() {
512513
boltAgent,
513514
userAgent,
514515
timeout,
515-
SecurityPlan.INSECURE,
516+
SecurityPlans.insecure(),
516517
AuthTokens.custom(Collections.emptyMap()))
517518
.toCompletableFuture()
518519
.join();
@@ -577,7 +578,7 @@ void shouldSupportMultiDb(BoltProtocolVersion boltProtocolVersion, boolean expec
577578
boltAgent,
578579
userAgent,
579580
timeout,
580-
SecurityPlan.INSECURE,
581+
SecurityPlans.insecure(),
581582
AuthTokens.custom(Collections.emptyMap()))
582583
.toCompletableFuture()
583584
.join();
@@ -649,7 +650,7 @@ void shouldSupportsSessionAuth(BoltProtocolVersion boltProtocolVersion, boolean
649650
boltAgent,
650651
userAgent,
651652
timeout,
652-
SecurityPlan.INSECURE,
653+
SecurityPlans.insecure(),
653654
AuthTokens.custom(Collections.emptyMap()))
654655
.toCompletableFuture()
655656
.join();

bolt-api-routed/src/test/java/org/neo4j/driver/internal/bolt/routedimpl/impl/cluster/RediscoveryTest.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
import org.neo4j.driver.internal.bolt.api.LoggingProvider;
7474
import org.neo4j.driver.internal.bolt.api.ResponseHandler;
7575
import org.neo4j.driver.internal.bolt.api.RoutingContext;
76-
import org.neo4j.driver.internal.bolt.api.SecurityPlan;
76+
import org.neo4j.driver.internal.bolt.api.SecurityPlans;
7777
import org.neo4j.driver.internal.bolt.api.exception.BoltFailureException;
7878
import org.neo4j.driver.internal.bolt.api.exception.BoltServiceUnavailableException;
7979
import org.neo4j.driver.internal.bolt.api.exception.BoltUnsupportedFeatureException;
@@ -99,7 +99,7 @@ void shouldUseFirstRouterInTable() {
9999

100100
var actualComposition = rediscovery
101101
.lookupClusterComposition(
102-
SecurityPlan.INSECURE,
102+
SecurityPlans.insecure(),
103103
table,
104104
connectionProviderGetter,
105105
emptySet(),
@@ -131,7 +131,7 @@ void shouldSkipFailingRouters() {
131131

132132
var actualComposition = rediscovery
133133
.lookupClusterComposition(
134-
SecurityPlan.INSECURE,
134+
SecurityPlans.insecure(),
135135
table,
136136
connectionProviderGetter,
137137
emptySet(),
@@ -168,7 +168,7 @@ void shouldFailImmediatelyOnAuthError() {
168168

169169
Throwable error = assertThrows(CompletionException.class, () -> rediscovery
170170
.lookupClusterComposition(
171-
SecurityPlan.INSECURE,
171+
SecurityPlans.insecure(),
172172
table,
173173
connectionProviderGetter,
174174
emptySet(),
@@ -206,7 +206,7 @@ void shouldUseAnotherRouterOnAuthorizationExpiredException() {
206206

207207
var actualComposition = rediscovery
208208
.lookupClusterComposition(
209-
SecurityPlan.INSECURE,
209+
SecurityPlans.insecure(),
210210
table,
211211
connectionProviderGetter,
212212
emptySet(),
@@ -248,7 +248,7 @@ void shouldFailImmediatelyOnBookmarkErrors(String code) {
248248

249249
Throwable actualError = assertThrows(CompletionException.class, () -> rediscovery
250250
.lookupClusterComposition(
251-
SecurityPlan.INSECURE,
251+
SecurityPlans.insecure(),
252252
table,
253253
connectionProviderGetter,
254254
emptySet(),
@@ -277,7 +277,7 @@ void shouldFailImmediatelyOnClosedPoolError() {
277277

278278
Throwable actualError = assertThrows(CompletionException.class, () -> rediscovery
279279
.lookupClusterComposition(
280-
SecurityPlan.INSECURE,
280+
SecurityPlans.insecure(),
281281
table,
282282
connectionProviderGetter,
283283
emptySet(),
@@ -310,7 +310,7 @@ void shouldFallbackToInitialRouterWhenKnownRoutersFail() {
310310

311311
var actualComposition = rediscovery
312312
.lookupClusterComposition(
313-
SecurityPlan.INSECURE,
313+
SecurityPlans.insecure(),
314314
table,
315315
connectionProviderGetter,
316316
emptySet(),
@@ -346,7 +346,7 @@ void shouldResolveInitialRouterAddress() {
346346

347347
var actualComposition = rediscovery
348348
.lookupClusterComposition(
349-
SecurityPlan.INSECURE,
349+
SecurityPlans.insecure(),
350350
table,
351351
connectionProviderGetter,
352352
emptySet(),
@@ -384,7 +384,7 @@ void shouldResolveInitialRouterAddressUsingCustomResolver() {
384384

385385
var actualComposition = rediscovery
386386
.lookupClusterComposition(
387-
SecurityPlan.INSECURE,
387+
SecurityPlans.insecure(),
388388
table,
389389
connectionProviderGetter,
390390
emptySet(),
@@ -418,7 +418,7 @@ void shouldPropagateFailureWhenResolverFails() {
418418

419419
Throwable error = assertThrows(CompletionException.class, () -> rediscovery
420420
.lookupClusterComposition(
421-
SecurityPlan.INSECURE,
421+
SecurityPlans.insecure(),
422422
table,
423423
connectionProviderGetter,
424424
emptySet(),
@@ -450,7 +450,7 @@ void shouldRecordAllErrorsWhenNoRouterRespond() {
450450

451451
Throwable e = assertThrows(CompletionException.class, () -> rediscovery
452452
.lookupClusterComposition(
453-
SecurityPlan.INSECURE,
453+
SecurityPlans.insecure(),
454454
table,
455455
connectionProviderGetter,
456456
emptySet(),
@@ -486,7 +486,7 @@ void shouldUseInitialRouterAfterDiscoveryReturnsNoWriters() {
486486

487487
var composition2 = rediscovery
488488
.lookupClusterComposition(
489-
SecurityPlan.INSECURE,
489+
SecurityPlans.insecure(),
490490
table,
491491
connectionProviderGetter,
492492
emptySet(),
@@ -514,7 +514,7 @@ void shouldUseInitialRouterToStartWith() {
514514

515515
var composition = rediscovery
516516
.lookupClusterComposition(
517-
SecurityPlan.INSECURE,
517+
SecurityPlans.insecure(),
518518
table,
519519
connectionProviderGetter,
520520
Collections.emptySet(),
@@ -545,7 +545,7 @@ void shouldUseKnownRoutersWhenInitialRouterFails() {
545545

546546
var composition = rediscovery
547547
.lookupClusterComposition(
548-
SecurityPlan.INSECURE,
548+
SecurityPlans.insecure(),
549549
table,
550550
connectionProviderGetter,
551551
Collections.emptySet(),
@@ -582,7 +582,7 @@ void shouldNotLogWhenSingleRetryAttemptFails() {
582582

583583
Throwable e = assertThrows(CompletionException.class, () -> rediscovery
584584
.lookupClusterComposition(
585-
SecurityPlan.INSECURE,
585+
SecurityPlans.insecure(),
586586
table,
587587
connectionProviderGetter,
588588
Collections.emptySet(),
@@ -639,7 +639,7 @@ void shouldFailImmediatelyOnAuthTokenManagerExecutionException() {
639639

640640
Throwable actualException = assertThrows(CompletionException.class, () -> rediscovery
641641
.lookupClusterComposition(
642-
SecurityPlan.INSECURE,
642+
SecurityPlans.insecure(),
643643
table,
644644
connectionProviderGetter,
645645
Collections.emptySet(),
@@ -668,7 +668,7 @@ void shouldFailImmediatelyOnUnsupportedFeatureException() {
668668

669669
Throwable actualException = assertThrows(CompletionException.class, () -> rediscovery
670670
.lookupClusterComposition(
671-
SecurityPlan.INSECURE,
671+
SecurityPlans.insecure(),
672672
table,
673673
connectionProviderGetter,
674674
Collections.emptySet(),
@@ -718,7 +718,7 @@ void shouldLogScopedIPV6AddressWithStringFormattingLogger() throws UnknownHostEx
718718
// WHEN & THEN
719719
Throwable e = assertThrows(CompletionException.class, () -> rediscovery
720720
.lookupClusterComposition(
721-
SecurityPlan.INSECURE,
721+
SecurityPlans.insecure(),
722722
table,
723723
connectionProviderGetter,
724724
Collections.emptySet(),

bolt-api-routed/src/test/java/org/neo4j/driver/internal/bolt/routedimpl/impl/cluster/RoutingTableHandlerTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
import org.neo4j.driver.internal.bolt.api.ClusterComposition;
6767
import org.neo4j.driver.internal.bolt.api.DatabaseName;
6868
import org.neo4j.driver.internal.bolt.api.SecurityPlan;
69+
import org.neo4j.driver.internal.bolt.api.SecurityPlans;
6970
import org.neo4j.driver.internal.bolt.api.exception.BoltServiceUnavailableException;
7071
import org.neo4j.driver.internal.bolt.routedimpl.ClusterCompositionLookupResult;
7172
import org.neo4j.driver.internal.bolt.routedimpl.Rediscovery;
@@ -120,7 +121,7 @@ void acquireShouldUpdateRoutingTableWhenKnownRoutingTableIsStale() {
120121

121122
var handler = newRoutingTableHandler(routingTable, rediscovery, connectionPool);
122123
assertNotNull(handler.ensureRoutingTable(
123-
SecurityPlan.INSECURE,
124+
SecurityPlans.insecure(),
124125
READ,
125126
Collections.emptySet(),
126127
() -> CompletableFuture.completedStage(AuthTokens.custom(Collections.emptyMap())),
@@ -209,7 +210,7 @@ public Optional<RoutingTableHandler> getRoutingTableHandler(DatabaseName databas
209210
newRoutingTableHandler(routingTable, rediscovery, connectionPool, registry, addressesToRetainRef::set);
210211

211212
var actual = handler.ensureRoutingTable(
212-
SecurityPlan.INSECURE,
213+
SecurityPlans.insecure(),
213214
READ,
214215
Collections.emptySet(),
215216
() -> CompletableFuture.completedStage(AuthTokens.custom(Collections.emptyMap())),
@@ -236,7 +237,7 @@ void shouldRemoveRoutingTableHandlerIfFailedToLookup() {
236237

237238
var handler = newRoutingTableHandler(routingTable, rediscovery, connectionPool, registry);
238239
assertThrows(RuntimeException.class, () -> handler.ensureRoutingTable(
239-
SecurityPlan.INSECURE,
240+
SecurityPlans.insecure(),
240241
READ,
241242
Collections.emptySet(),
242243
() -> CompletableFuture.completedStage(AuthTokens.custom(Collections.emptyMap())),
@@ -277,7 +278,7 @@ private void testRediscoveryWhenStale(AccessMode mode) {
277278

278279
var handler = newRoutingTableHandler(routingTable, rediscovery, connectionProviderGetter);
279280
var actual = handler.ensureRoutingTable(
280-
SecurityPlan.INSECURE,
281+
SecurityPlans.insecure(),
281282
mode,
282283
Collections.emptySet(),
283284
() -> CompletableFuture.completedStage(AuthTokens.custom(Collections.emptyMap())),
@@ -322,7 +323,7 @@ private void testNoRediscoveryWhenNotStale(AccessMode staleMode, AccessMode notS
322323
var handler = newRoutingTableHandler(routingTable, rediscovery, connectionProviderGetter);
323324

324325
assertNotNull(handler.ensureRoutingTable(
325-
SecurityPlan.INSECURE,
326+
SecurityPlans.insecure(),
326327
notStaleMode,
327328
Collections.emptySet(),
328329
() -> CompletableFuture.completedStage(AuthTokens.custom(Collections.emptyMap())),

bolt-api-routed/src/test/java/org/neo4j/driver/internal/bolt/routedimpl/impl/cluster/RoutingTableRegistryImplTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
import org.neo4j.driver.internal.bolt.api.BoltProtocolVersion;
5858
import org.neo4j.driver.internal.bolt.api.BoltServerAddress;
5959
import org.neo4j.driver.internal.bolt.api.DatabaseName;
60-
import org.neo4j.driver.internal.bolt.api.SecurityPlan;
60+
import org.neo4j.driver.internal.bolt.api.SecurityPlans;
6161
import org.neo4j.driver.internal.bolt.routedimpl.Rediscovery;
6262
import org.neo4j.driver.internal.bolt.routedimpl.RoutingTable;
6363
import org.neo4j.driver.internal.bolt.routedimpl.impl.NoopLoggingProvider;
@@ -100,7 +100,7 @@ void shouldCreateRoutingTableHandlerIfAbsentWhenFreshRoutingTable(String databas
100100
// When
101101
var database = database(databaseName);
102102
routingTables.ensureRoutingTable(
103-
SecurityPlan.INSECURE,
103+
SecurityPlans.insecure(),
104104
CompletableFuture.completedFuture(database),
105105
AccessMode.READ,
106106
Collections.emptySet(),
@@ -131,7 +131,7 @@ void shouldReturnExistingRoutingTableHandlerWhenFreshRoutingTable(String databas
131131
// When
132132
var actual = routingTables
133133
.ensureRoutingTable(
134-
SecurityPlan.INSECURE,
134+
SecurityPlans.insecure(),
135135
CompletableFuture.completedFuture(database),
136136
AccessMode.READ,
137137
Collections.emptySet(),
@@ -145,7 +145,7 @@ void shouldReturnExistingRoutingTableHandlerWhenFreshRoutingTable(String databas
145145
// Then it is the one we put in map that is picked up.
146146
verify(handler)
147147
.ensureRoutingTable(
148-
SecurityPlan.INSECURE,
148+
SecurityPlans.insecure(),
149149
AccessMode.READ,
150150
Collections.emptySet(),
151151
authStageSupplier,
@@ -169,7 +169,7 @@ void shouldReturnFreshRoutingTable(AccessMode mode) {
169169
// When
170170
routingTables
171171
.ensureRoutingTable(
172-
SecurityPlan.INSECURE,
172+
SecurityPlans.insecure(),
173173
CompletableFuture.completedFuture(defaultDatabase()),
174174
mode,
175175
Collections.emptySet(),
@@ -183,7 +183,7 @@ void shouldReturnFreshRoutingTable(AccessMode mode) {
183183
// Then
184184
verify(handler)
185185
.ensureRoutingTable(
186-
SecurityPlan.INSECURE,
186+
SecurityPlans.insecure(),
187187
mode,
188188
Collections.emptySet(),
189189
authStageSupplier,

bolt-api/pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@
3030
<groupId>org.junit.jupiter</groupId>
3131
<artifactId>junit-jupiter</artifactId>
3232
</dependency>
33+
<dependency>
34+
<groupId>org.bouncycastle</groupId>
35+
<artifactId>bcprov-jdk18on</artifactId>
36+
</dependency>
37+
<dependency>
38+
<groupId>org.bouncycastle</groupId>
39+
<artifactId>bcpkix-jdk18on</artifactId>
40+
</dependency>
3341
</dependencies>
3442

3543
<build>

0 commit comments

Comments
 (0)