com.couchbase.mock.CouchbaseMock Java Examples
The following examples show how to use
com.couchbase.mock.CouchbaseMock.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestProperties.java From couchbase-jvm-core with Apache License 2.0 | 6 votes |
private static void createMock() { BucketConfiguration bucketConfiguration = new BucketConfiguration(); bucketConfiguration.numNodes = mockNodeCount; bucketConfiguration.numReplicas = mockNodeCount; bucketConfiguration.numVBuckets = 1024; bucketConfiguration.name = bucket; bucketConfiguration.type = bucketType; bucketConfiguration.password = password; ArrayList<BucketConfiguration> configList = new ArrayList<BucketConfiguration>(); configList.add(bucketConfiguration); try { mock = new CouchbaseMock(0, configList); mock.start(); mock.waitForStartup(); } catch (Exception ex) { throw new RuntimeException("Unable to initialize mock" + ex.getMessage(), ex); } }
Example #2
Source File: CouchbaseClientTest.java From java-specialagent with Apache License 2.0 | 5 votes |
@BeforeClass public static void startCouchbaseMock() throws Exception { couchbaseMock = new CouchbaseMock("localhost", 8091, 2, 1); final BucketConfiguration bucketConfiguration = new BucketConfiguration(); bucketConfiguration.name = bucketName; bucketConfiguration.numNodes = 1; bucketConfiguration.numReplicas = 1; bucketConfiguration.password = ""; couchbaseMock.start(); couchbaseMock.waitForStartup(); couchbaseMock.createBucket(bucketConfiguration); }
Example #3
Source File: CouchbaseClientITest.java From java-specialagent with Apache License 2.0 | 5 votes |
public static void main(final String[] args) throws BucketAlreadyExistsException, InterruptedException, IOException { final CouchbaseMock couchbaseMock = new CouchbaseMock("localhost", 8091, 2, 1); final BucketConfiguration bucketConfiguration = new BucketConfiguration(); bucketConfiguration.name = bucketName; bucketConfiguration.numNodes = 1; bucketConfiguration.numReplicas = 1; bucketConfiguration.password = ""; couchbaseMock.start(); couchbaseMock.waitForStartup(); couchbaseMock.createBucket(bucketConfiguration); final Cluster cluster = CouchbaseCluster.create(DefaultCouchbaseEnvironment.builder().connectTimeout(TimeUnit.SECONDS.toMillis(60)).build()); final Bucket bucket = cluster.openBucket(bucketName); final JsonObject arthur = JsonObject .create().put("name", "Arthur") .put("email", "[email protected]") .put("interests", JsonArray.from("Holy Grail", "African Swallows")); bucket.upsert(JsonDocument.create("u:king_arthur", arthur)); System.out.println(bucket.get("u:king_arthur")); cluster.disconnect(60, TimeUnit.SECONDS); couchbaseMock.stop(); TestUtil.checkSpan(new ComponentSpanCount("couchbase-java-client.*", 2)); }
Example #4
Source File: TestCouchbaseRemoteTableEndToEnd.java From samza with Apache License 2.0 | 5 votes |
protected void createMockBuckets(List<String> bucketNames) throws Exception { ArrayList<BucketConfiguration> configList = new ArrayList<>(); bucketNames.forEach(name -> configList.add(configBucket(name))); couchbaseMock = new CouchbaseMock(0, configList); couchbaseMock.start(); couchbaseMock.waitForStartup(); }
Example #5
Source File: CouchbaseMockConfiguration.java From tutorials with MIT License | 5 votes |
public CouchbaseMockConfiguration(final CouchbaseProperties couchbaseProperties) { final BucketConfiguration bucketConfiguration = new BucketConfiguration(); bucketConfiguration.numNodes = 1; bucketConfiguration.numReplicas = 1; bucketConfiguration.numVBuckets = 1024; bucketConfiguration.name = couchbaseProperties.getBucketName(); bucketConfiguration.type = Bucket.BucketType.COUCHBASE; bucketConfiguration.password = couchbaseProperties.getBucketPassword(); try { couchbaseMock = new CouchbaseMock(couchbaseProperties.getPort(), Collections.singletonList(bucketConfiguration)); } catch (final IOException ex) { throw new UncheckedIOException(ex); } }
Example #6
Source File: TestProperties.java From couchbase-jvm-core with Apache License 2.0 | 2 votes |
/** * Mock node count * * @return node count configured for mock */ public static CouchbaseMock couchbaseMock() { return mock; }
Example #7
Source File: MockDependentTest.java From couchbase-jvm-core with Apache License 2.0 | votes |
public static CouchbaseMock mock() { return couchbaseMock; }
Example #8
Source File: ClusterDependentTest.java From couchbase-jvm-core with Apache License 2.0 | votes |
public static CouchbaseMock mock() { return couchbaseMock; }