Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite Couchbase module. closes #2447 #2491

Merged
merged 9 commits into from Apr 12, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions modules/couchbase/build.gradle
Expand Up @@ -2,7 +2,6 @@ description = "Testcontainers :: Couchbase"

dependencies {
compile project(':testcontainers')
compile 'com.couchbase.client:java-client:2.7.13'

testCompile project(':test-support')
testCompile 'com.couchbase.client:java-client:2.7.13'
}

This file was deleted.

@@ -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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, we add the original source of this file, for future reference.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this comment is invalid ;)

*/

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;
}

}