Search in sources :

Example 1 with CouchbaseContainer

use of org.testcontainers.couchbase.CouchbaseContainer in project ShedLock by lukas-krecan.

the class CouchbaseLockProviderIntegrationTest method startCouchbase.

@BeforeAll
public static void startCouchbase() {
    container = new CouchbaseContainer().withBucket(new BucketDefinition(BUCKET_NAME));
    container.start();
    Set<SeedNode> seedNodes = new HashSet<>(Arrays.asList(SeedNode.create(container.getContainerIpAddress(), Optional.of(container.getBootstrapCarrierDirectPort()), Optional.of(container.getBootstrapHttpDirectPort()))));
    ClusterOptions options = ClusterOptions.clusterOptions(container.getUsername(), container.getPassword());
    cluster = Cluster.connect(seedNodes, options);
    bucket = cluster.bucket(BUCKET_NAME);
    bucket.waitUntilReady(Duration.ofSeconds(30));
}
Also used : BucketDefinition(org.testcontainers.couchbase.BucketDefinition) SeedNode(com.couchbase.client.core.env.SeedNode) CouchbaseContainer(org.testcontainers.couchbase.CouchbaseContainer) HashSet(java.util.HashSet) ClusterOptions(com.couchbase.client.java.ClusterOptions) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 2 with CouchbaseContainer

use of org.testcontainers.couchbase.CouchbaseContainer in project couchbase-elasticsearch-connector by couchbase.

the class CustomCouchbaseContainer method newCouchbaseCluster.

public static CustomCouchbaseContainer newCouchbaseCluster(String dockerImageName) {
    CouchbaseContainer couchbase = new CustomCouchbaseContainer(dockerImageName).withEnabledServices(CouchbaseService.KV, CouchbaseService.QUERY, CouchbaseService.INDEX);
    couchbase.start();
    return (CustomCouchbaseContainer) couchbase;
}
Also used : CouchbaseContainer(org.testcontainers.couchbase.CouchbaseContainer)

Example 3 with CouchbaseContainer

use of org.testcontainers.couchbase.CouchbaseContainer in project ShedLock by lukas-krecan.

the class CouchbaseLockProviderIntegrationTest method startCouchbase.

@BeforeAll
public static void startCouchbase() {
    container = new CouchbaseContainer().withBucket(new BucketDefinition(BUCKET_NAME));
    container.start();
    CouchbaseEnvironment environment = DefaultCouchbaseEnvironment.builder().bootstrapCarrierDirectPort(container.getBootstrapCarrierDirectPort()).bootstrapHttpDirectPort(container.getBootstrapHttpDirectPort()).build();
    cluster = CouchbaseCluster.create(environment, container.getContainerIpAddress());
    cluster.authenticate(container.getUsername(), container.getPassword());
    bucket = cluster.openBucket(BUCKET_NAME);
}
Also used : BucketDefinition(org.testcontainers.couchbase.BucketDefinition) CouchbaseContainer(org.testcontainers.couchbase.CouchbaseContainer) CouchbaseEnvironment(com.couchbase.client.java.env.CouchbaseEnvironment) DefaultCouchbaseEnvironment(com.couchbase.client.java.env.DefaultCouchbaseEnvironment) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

CouchbaseContainer (org.testcontainers.couchbase.CouchbaseContainer)3 BeforeAll (org.junit.jupiter.api.BeforeAll)2 BucketDefinition (org.testcontainers.couchbase.BucketDefinition)2 SeedNode (com.couchbase.client.core.env.SeedNode)1 ClusterOptions (com.couchbase.client.java.ClusterOptions)1 CouchbaseEnvironment (com.couchbase.client.java.env.CouchbaseEnvironment)1 DefaultCouchbaseEnvironment (com.couchbase.client.java.env.DefaultCouchbaseEnvironment)1 HashSet (java.util.HashSet)1