17
17
package org .springframework .boot .autoconfigure .couchbase ;
18
18
19
19
import java .time .Duration ;
20
+ import java .util .Collections ;
21
+ import java .util .List ;
20
22
21
23
import com .couchbase .client .java .Bucket ;
22
24
import com .couchbase .client .java .Cluster ;
23
25
import com .couchbase .client .java .CouchbaseBucket ;
24
26
import com .couchbase .client .java .bucket .BucketType ;
27
+ import com .couchbase .client .java .cluster .BucketSettings ;
25
28
import com .couchbase .client .java .cluster .ClusterInfo ;
26
29
import com .couchbase .client .java .cluster .DefaultBucketSettings ;
30
+ import com .couchbase .client .java .cluster .UserRole ;
31
+ import com .couchbase .client .java .cluster .UserSettings ;
27
32
import com .couchbase .client .java .env .CouchbaseEnvironment ;
28
33
import org .junit .jupiter .api .AfterEach ;
34
+ import org .junit .jupiter .api .BeforeAll ;
29
35
import org .junit .jupiter .api .BeforeEach ;
30
36
import org .junit .jupiter .api .Test ;
31
37
import org .testcontainers .couchbase .CouchbaseContainer ;
@@ -51,12 +57,19 @@ class CouchbaseAutoConfigurationIntegrationTests {
51
57
52
58
@ Container
53
59
static final CouchbaseContainer couchbase = new CouchbaseContainer ().withClusterAdmin ("spring" , "password" )
54
- .withNewBucket (DefaultBucketSettings .builder ().enableFlush (true ).name ("default" ).password ("secret" )
55
- .quota (100 ).replicas (0 ).type (BucketType .COUCHBASE ).build ())
56
60
.withStartupAttempts (5 ).withStartupTimeout (Duration .ofMinutes (10 ));
57
61
58
62
private AnnotationConfigApplicationContext context ;
59
63
64
+ @ BeforeAll
65
+ static void createBucket () {
66
+ BucketSettings bucketSettings = DefaultBucketSettings .builder ().enableFlush (true ).name ("default" )
67
+ .password ("password" ).quota (100 ).replicas (0 ).type (BucketType .COUCHBASE ).build ();
68
+ List <UserRole > userSettings = Collections .singletonList (new UserRole ("admin" ));
69
+ couchbase .createBucket (bucketSettings ,
70
+ UserSettings .build ().password (bucketSettings .password ()).roles (userSettings ), true );
71
+ }
72
+
60
73
@ BeforeEach
61
74
void setUp () {
62
75
this .context = new AnnotationConfigApplicationContext ();
0 commit comments