Couchbase Module
Testcontainers module for Couchbase. Couchbase is a document oriented NoSQL database.
Usage example
Running Couchbase as a stand-in in a test:
-
Define a bucket:
BucketDefinition bucketDefinition = new BucketDefinition("mybucket");
-
define a container:
CouchbaseContainer container = new CouchbaseContainer() .withBucket(bucketDefinition)
-
create an environment & cluster:
CouchbaseEnvironment environment = DefaultCouchbaseEnvironment .builder() .bootstrapCarrierDirectPort(container.getBootstrapCarrierDirectPort()) .bootstrapHttpDirectPort(container.getBootstrapHttpDirectPort()) .build(); Cluster cluster = CouchbaseCluster.create( environment, container.getContainerIpAddress() );
-
authenticate:
cluster.authenticate(container.getUsername(), container.getPassword());
Adding this module to your project dependencies
Add the following dependency to your pom.xml
/build.gradle
file:
testCompile "org.testcontainers:couchbase:1.14.1"
<dependency> <groupId>org.testcontainers</groupId> <artifactId>couchbase</artifactId> <version>1.14.1</version> <scope>test</scope> </dependency>