forked from testcontainers/testcontainers-java
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…2491) * Rewrite couchbase module. closes testcontainers#2447 This changeset completely reworks the couchbase module and hopefully greatly improve the out-of-the-box experience. Note that this is a breaking change over the previous code because by intention it does NOT depend on SDK 2 so you can test SDK 2 and 3 with it at the same time. Highlights: - Removed the need for a SDK, so both 2 and 3 can be used with it. - Updated to 6.5.0 baseline and using alternate addresses for "proper" port exposure without having to rely on the socat proxy container like the previous version had to. - Allows to define which services should be exposed and handles states automatically (i.e. will not try to create the primary index if the query service is not enabled). Note that a bunch of tests have been removed since they are not adequate anymore. A side effect of the alternate address change is that older servers cannot be used. 6.5.0 is available in both CE and EE, and Couchbase in general allows EE versions to be used in development and testing so we should use it if we can. * Wait until query respsonds with 200 * fixes * add `getBootstrap*DirectPort()` methods, review fixes * Restore `getConnectionString()` * Apply suggestions from code review Co-Authored-By: Kevin Wittek <kiview@users.noreply.github.com> * Update docs * Update docs (2) Co-authored-by: Michael Nitschinger <michael@nitschinger.at> Co-authored-by: Kevin Wittek <kiview@users.noreply.github.com>
- Loading branch information
1 parent
631a3f4
commit c6e0cd9
Showing
13 changed files
with
530 additions
and
708 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 0 additions & 72 deletions
72
modules/couchbase/src/main/java/org/testcontainers/couchbase/AbstractCouchbaseTest.java
This file was deleted.
Oops, something went wrong.
69 changes: 69 additions & 0 deletions
69
modules/couchbase/src/main/java/org/testcontainers/couchbase/BucketDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Copyright (c) 2020 Couchbase, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.testcontainers.couchbase; | ||
|
||
/** | ||
* Allows to configure the properties of a bucket that should be created. | ||
*/ | ||
public class BucketDefinition { | ||
|
||
private final String name; | ||
private boolean queryPrimaryIndex = true; | ||
private int quota = 100; | ||
|
||
public BucketDefinition(final String name) { | ||
this.name = name; | ||
} | ||
|
||
/** | ||
* Sets a custom bucket quota (100MB by default). | ||
* | ||
* @param quota the quota to set for the bucket. | ||
* @return this {@link BucketDefinition} for chaining purposes. | ||
*/ | ||
public BucketDefinition withQuota(final int quota) { | ||
if (quota < 100) { | ||
throw new IllegalArgumentException("Bucket quota cannot be less than 100MB!"); | ||
} | ||
this.quota = quota; | ||
return this; | ||
} | ||
|
||
/** | ||
* Allows to disable creating a primary index for this bucket (enabled by default). | ||
* | ||
* @param create if false, a primary index will not be created. | ||
* @return this {@link BucketDefinition} for chaining purposes. | ||
*/ | ||
public BucketDefinition withPrimaryIndex(final boolean create) { | ||
this.queryPrimaryIndex = create; | ||
return this; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public boolean hasPrimaryIndex() { | ||
return queryPrimaryIndex; | ||
} | ||
|
||
public int getQuota() { | ||
return quota; | ||
} | ||
|
||
} |
Oops, something went wrong.