Commit 9c7612e6 authored by Madhura Bhave's avatar Madhura Bhave

Fix NPE in WaitStrategy used for test containers

parent 3f34f25d
...@@ -44,7 +44,7 @@ public class CassandraContainer extends Container { ...@@ -44,7 +44,7 @@ public class CassandraContainer extends Container {
private static class WaitStrategy extends HostPortWaitStrategy { private static class WaitStrategy extends HostPortWaitStrategy {
@Override @Override
protected void waitUntilReady() { public void waitUntilReady(GenericContainer container) {
super.waitUntilReady(); super.waitUntilReady();
try { try {
...@@ -59,7 +59,7 @@ public class CassandraContainer extends Container { ...@@ -59,7 +59,7 @@ public class CassandraContainer extends Container {
private Callable<Boolean> checkConnection() { private Callable<Boolean> checkConnection() {
return () -> { return () -> {
try (Cluster cluster = Cluster.builder() try (Cluster cluster = Cluster.builder()
.withPort(this.container.getMappedPort(PORT)) .withPort(container.getMappedPort(PORT))
.addContactPoint("localhost").build()) { .addContactPoint("localhost").build()) {
cluster.connect(); cluster.connect();
return true; return true;
......
...@@ -42,10 +42,10 @@ public class Neo4jContainer extends Container { ...@@ -42,10 +42,10 @@ public class Neo4jContainer extends Container {
private static class WaitStrategy extends HostPortWaitStrategy { private static class WaitStrategy extends HostPortWaitStrategy {
@Override @Override
protected void waitUntilReady() { public void waitUntilReady(GenericContainer container) {
super.waitUntilReady(); super.waitUntilReady();
Configuration configuration = new Configuration.Builder() Configuration configuration = new Configuration.Builder()
.uri("bolt://localhost:" + this.container.getMappedPort(7687)) .uri("bolt://localhost:" + container.getMappedPort(7687))
.build(); .build();
SessionFactory sessionFactory = new SessionFactory(configuration, SessionFactory sessionFactory = new SessionFactory(configuration,
"org.springframework.boot.test.autoconfigure.data.neo4j"); "org.springframework.boot.test.autoconfigure.data.neo4j");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment