Merge branch '2.2.x'

Closes gh-19989
pull/19995/head
Andy Wilkinson 5 years ago
commit 886e7ba38c

@ -17,15 +17,21 @@
package org.springframework.boot.autoconfigure.couchbase; package org.springframework.boot.autoconfigure.couchbase;
import java.time.Duration; import java.time.Duration;
import java.util.Collections;
import java.util.List;
import com.couchbase.client.java.Bucket; import com.couchbase.client.java.Bucket;
import com.couchbase.client.java.Cluster; import com.couchbase.client.java.Cluster;
import com.couchbase.client.java.CouchbaseBucket; import com.couchbase.client.java.CouchbaseBucket;
import com.couchbase.client.java.bucket.BucketType; import com.couchbase.client.java.bucket.BucketType;
import com.couchbase.client.java.cluster.BucketSettings;
import com.couchbase.client.java.cluster.ClusterInfo; import com.couchbase.client.java.cluster.ClusterInfo;
import com.couchbase.client.java.cluster.DefaultBucketSettings; import com.couchbase.client.java.cluster.DefaultBucketSettings;
import com.couchbase.client.java.cluster.UserRole;
import com.couchbase.client.java.cluster.UserSettings;
import com.couchbase.client.java.env.CouchbaseEnvironment; import com.couchbase.client.java.env.CouchbaseEnvironment;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.testcontainers.couchbase.CouchbaseContainer; import org.testcontainers.couchbase.CouchbaseContainer;
@ -51,12 +57,19 @@ class CouchbaseAutoConfigurationIntegrationTests {
@Container @Container
static final CouchbaseContainer couchbase = new CouchbaseContainer().withClusterAdmin("spring", "password") static final CouchbaseContainer couchbase = new CouchbaseContainer().withClusterAdmin("spring", "password")
.withNewBucket(DefaultBucketSettings.builder().enableFlush(true).name("default").password("secret")
.quota(100).replicas(0).type(BucketType.COUCHBASE).build())
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10)); .withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10));
private AnnotationConfigApplicationContext context; private AnnotationConfigApplicationContext context;
@BeforeAll
static void createBucket() {
BucketSettings bucketSettings = DefaultBucketSettings.builder().enableFlush(true).name("default")
.password("password").quota(100).replicas(0).type(BucketType.COUCHBASE).build();
List<UserRole> userSettings = Collections.singletonList(new UserRole("admin"));
couchbase.createBucket(bucketSettings,
UserSettings.build().password(bucketSettings.password()).roles(userSettings), true);
}
@BeforeEach @BeforeEach
void setUp() { void setUp() {
this.context = new AnnotationConfigApplicationContext(); this.context = new AnnotationConfigApplicationContext();

Loading…
Cancel
Save