@@ -74,6 +74,10 @@ public class CouchbaseContainer extends GenericContainer<CouchbaseContainer> {
7474
7575 private static final int ANALYTICS_SSL_PORT = 18095 ;
7676
77+ private static final int EVENTING_PORT = 8096 ;
78+
79+ private static final int EVENTING_SSL_PORT = 18096 ;
80+
7781 private static final int KV_PORT = 11210 ;
7882
7983 private static final int KV_SSL_PORT = 11207 ;
@@ -196,6 +200,17 @@ public CouchbaseContainer withAnalyticsService() {
196200 return this ;
197201 }
198202
203+ /**
204+ * Enables the eventing service which is not enabled by default.
205+ *
206+ * @return this {@link CouchbaseContainer} for chaining purposes.
207+ */
208+ public CouchbaseContainer withEventingService () {
209+ checkNotRunning ();
210+ this .enabledServices .add (CouchbaseService .EVENTING );
211+ return this ;
212+ }
213+
199214 public final String getUsername () {
200215 return username ;
201216 }
@@ -232,7 +247,9 @@ protected void configure() {
232247 ANALYTICS_PORT ,
233248 ANALYTICS_SSL_PORT ,
234249 KV_PORT ,
235- KV_SSL_PORT
250+ KV_SSL_PORT ,
251+ EVENTING_PORT ,
252+ EVENTING_SSL_PORT
236253 );
237254
238255 WaitAllStrategy waitStrategy = new WaitAllStrategy ();
@@ -278,6 +295,16 @@ protected void configure() {
278295 );
279296 }
280297
298+ if (enabledServices .contains (CouchbaseService .EVENTING )) {
299+ waitStrategy = waitStrategy .withStrategy (
300+ new HttpWaitStrategy ()
301+ .forPath ("/api/v1/config" )
302+ .forPort (EVENTING_PORT )
303+ .withBasicCredentials (username , password )
304+ .forStatusCode (200 )
305+ );
306+ }
307+
281308 waitingFor (waitStrategy );
282309 }
283310
@@ -328,8 +355,13 @@ private void initializeIsEnterprise() {
328355 throw new IllegalStateException ("Couchbase /pools did not return valid JSON" );
329356 }
330357
331- if (!isEnterprise && enabledServices .contains (CouchbaseService .ANALYTICS )) {
332- throw new IllegalStateException ("The Analytics Service is only supported with the Enterprise version" );
358+ if (!isEnterprise ) {
359+ if (enabledServices .contains (CouchbaseService .ANALYTICS )) {
360+ throw new IllegalStateException ("The Analytics Service is only supported with the Enterprise version" );
361+ }
362+ if (enabledServices .contains (CouchbaseService .EVENTING )) {
363+ throw new IllegalStateException ("The Eventing Service is only supported with the Enterprise version" );
364+ }
333365 }
334366 }
335367
@@ -452,6 +484,11 @@ private void configureExternalPorts() {
452484 builder .add ("cbasSSL" , Integer .toString (getMappedPort (ANALYTICS_SSL_PORT )));
453485 }
454486
487+ if (enabledServices .contains (CouchbaseService .EVENTING )) {
488+ builder .add ("eventingAdminPort" , Integer .toString (getMappedPort (EVENTING_PORT )));
489+ builder .add ("eventingSSL" , Integer .toString (getMappedPort (EVENTING_SSL_PORT )));
490+ }
491+
455492 @ Cleanup Response response = doHttpRequest (
456493 MGMT_PORT ,
457494 "/node/controller/setupAlternateAddresses/external" ,
0 commit comments