|
14 | 14 | */ |
15 | 15 | package org.eclipse.jnosql.databases.tinkerpop.communication; |
16 | 16 |
|
| 17 | +import org.apache.commons.configuration2.BaseConfiguration; |
| 18 | +import org.apache.commons.configuration2.Configuration; |
17 | 19 | import org.apache.tinkerpop.gremlin.structure.Graph; |
18 | 20 | import org.apache.tinkerpop.gremlin.structure.util.GraphFactory; |
| 21 | +import org.testcontainers.containers.GenericContainer; |
| 22 | +import org.testcontainers.containers.wait.strategy.Wait; |
19 | 23 |
|
20 | 24 | import java.util.function.Supplier; |
21 | 25 | import java.util.logging.Logger; |
22 | 26 |
|
23 | 27 | public enum GraphSupplier implements Supplier<Graph> { |
24 | 28 | INSTANCE; |
25 | 29 |
|
26 | | - private static final Logger LOGGER = Logger.getLogger(GraphSupplier.class.getName()); |
27 | | - |
28 | | - private final Graph graph; |
| 30 | + private final GenericContainer<?> arangodb = |
| 31 | + new GenericContainer<>("arangodb/arangodb:latest") |
| 32 | + .withExposedPorts(8529) |
| 33 | + .withEnv("ARANGO_NO_AUTH", "1") |
| 34 | + .waitingFor(Wait.forHttp("/") |
| 35 | + .forStatusCode(200)); |
29 | 36 |
|
30 | 37 | { |
31 | | - graph = GraphFactory.open("src/test/resources/adb.yaml"); |
| 38 | + arangodb.start(); |
32 | 39 | } |
33 | 40 |
|
| 41 | + private static final Logger LOGGER = Logger.getLogger(GraphSupplier.class.getName()); |
| 42 | + |
34 | 43 | @Override |
35 | 44 | public Graph get() { |
36 | 45 | LOGGER.info("Starting Graph database"); |
37 | | - return graph; |
| 46 | + Configuration configuration = new BaseConfiguration(); |
| 47 | + configuration.addProperty("gremlin.graph", "com.arangodb.tinkerpop.gremlin.structure.ArangoDBGraph"); |
| 48 | + configuration.addProperty("gremlin.arangodb.conf.graph.enableDataDefinition", true); |
| 49 | + configuration.addProperty("gremlin.arangodb.conf.driver.hosts", arangodb.getHost() + ":" + arangodb.getFirstMappedPort()); |
| 50 | + return GraphFactory.open(configuration); |
38 | 51 | } |
39 | 52 | } |
0 commit comments