File tree Expand file tree Collapse file tree 2 files changed +47
-6
lines changed
riak-driver/src/test/java/org/jnosql/diana/riak/key Expand file tree Collapse file tree 2 files changed +47
-6
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2019 Otávio Santana and others
3+ * All rights reserved. This program and the accompanying materials
4+ * are made available under the terms of the Eclipse Public License v1.0
5+ * and Apache License v2.0 which accompanies this distribution.
6+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7+ * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
8+ *
9+ * You may elect to redistribute this code under either of these licenses.
10+ *
11+ * Contributors:
12+ *
13+ * Otavio Santana
14+ */
15+ package org .jnosql .diana .riak .key ;
16+
17+ import org .jnosql .diana .api .Settings ;
18+ import org .jnosql .diana .api .key .BucketManagerFactory ;
19+ import org .testcontainers .containers .GenericContainer ;
20+ import org .testcontainers .containers .wait .strategy .Wait ;
21+
22+ import java .util .function .Supplier ;
23+
24+ public enum BucketManagerFactorySupplier implements Supplier <BucketManagerFactory > {
25+
26+ INSTANCE ;
27+
28+ private final GenericContainer riak =
29+ new GenericContainer ("basho/riak-ts:latest" )
30+ .withExposedPorts (8087 )
31+ .waitingFor (Wait .forListeningPort ());
32+
33+ {
34+ riak .start ();
35+ }
36+
37+ @ Override
38+ public BucketManagerFactory get () {
39+ Settings settings = Settings .builder ()
40+ .put ("riak.host" , riak .getContainerIpAddress () + ':' + riak .getFirstMappedPort ())
41+ .build ();
42+ RiakKeyValueConfiguration configuration = new RiakKeyValueConfiguration ();
43+ return configuration .get (settings );
44+ }
45+
46+ }
Original file line number Diff line number Diff line change 1515package org .jnosql .diana .riak .key ;
1616
1717
18- import com .basho .riak .client .core .RiakNode ;
1918import org .jnosql .diana .api .key .BucketManagerFactory ;
2019
2120public final class RiakTestUtils {
2221
2322
2423 public static BucketManagerFactory get () {
25- RiakKeyValueConfiguration riakKeyValueConfiguration = new RiakKeyValueConfiguration ();
26- RiakNode node = new RiakNode .Builder ()
27- .withRemoteAddress ("localhost" ).build ();
28- riakKeyValueConfiguration .add (node );
29- return riakKeyValueConfiguration .get ();
24+ return BucketManagerFactorySupplier .INSTANCE .get ();
3025 }
3126}
You can’t perform that action at this time.
0 commit comments