|
|
|
@ -37,25 +37,25 @@ public class Neo4jContainer extends Container { |
|
|
|
private static final int PORT = 7687; |
|
|
|
private static final int PORT = 7687; |
|
|
|
|
|
|
|
|
|
|
|
public Neo4jContainer() { |
|
|
|
public Neo4jContainer() { |
|
|
|
super("neo4j:3.3.1", PORT, |
|
|
|
super("neo4j:3.3.1", PORT, (container) -> container |
|
|
|
(container) -> container |
|
|
|
.waitingFor(new WaitStrategy(container)).withEnv("NEO4J_AUTH", "none")); |
|
|
|
.waitingFor(new WaitStrategy(container.getMappedPort(PORT))) |
|
|
|
|
|
|
|
.withEnv("NEO4J_AUTH", "none")); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static final class WaitStrategy extends HostPortWaitStrategy { |
|
|
|
private static final class WaitStrategy extends HostPortWaitStrategy { |
|
|
|
|
|
|
|
|
|
|
|
private final int port; |
|
|
|
private final GenericContainer<?> container; |
|
|
|
|
|
|
|
|
|
|
|
private WaitStrategy(int port) { |
|
|
|
private WaitStrategy(GenericContainer<?> container) { |
|
|
|
this.port = port; |
|
|
|
this.container = container; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void waitUntilReady() { |
|
|
|
public void waitUntilReady() { |
|
|
|
super.waitUntilReady(); |
|
|
|
super.waitUntilReady(); |
|
|
|
Configuration configuration = new Configuration.Builder() |
|
|
|
Configuration configuration = new Configuration.Builder() |
|
|
|
.uri("bolt://localhost:" + this.port).build(); |
|
|
|
.uri("bolt://localhost:" |
|
|
|
|
|
|
|
+ this.container.getMappedPort(Neo4jContainer.PORT)) |
|
|
|
|
|
|
|
.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"); |
|
|
|
try { |
|
|
|
try { |
|
|
|
|