use of com.couchbase.client.java.manager.collection.CollectionSpec in project couchbase-jvm-clients by couchbase.
the class AnalyticsCollectionIntegrationTest method setup.
@BeforeAll
static void setup() {
cluster = Cluster.connect(seedNodes(), clusterOptions());
bucket = cluster.bucket(config().bucketname());
analytics = cluster.analyticsIndexes();
collectionManager = bucket.collections();
bucket.waitUntilReady(Duration.ofSeconds(5));
waitForService(bucket, ServiceType.ANALYTICS);
collectionManager.createScope(scopeName);
CollectionSpec collSpec = CollectionSpec.create(collectionName, scopeName);
collectionManager.createCollection(collSpec);
waitUntilCondition(() -> collectionExists(collectionManager, collSpec));
waitForQueryIndexerToHaveKeyspace(cluster, config().bucketname());
// this inserts two documents in bucket.scope.collection and creates a primary index.
// then inserts one document in bucket._default._default and creates a primary index.
cluster.query("insert into `" + config().bucketname() + "`.`" + scopeName + "`.`" + collectionName + "` (key, value ) values ( '123', { \"test\" : \"hello\" })");
insertDoc(bucket.scope(scopeName).collection(collectionName), FOO_CONTENT);
cluster.query("create primary index on `" + config().bucketname() + "`.`" + scopeName + "`.`" + collectionName + "`");
insertDoc(bucket.defaultCollection(), DEFAULT_CONTENT);
try {
cluster.query("create primary index on `" + config().bucketname() + "`.`" + "_default" + "`." + "_default");
} catch (IndexExistsException e) {
// Primary index is already created, ignore
}
delimitedDataverseName = "`" + config().bucketname() + "`.`" + scopeName + "`";
}
Aggregations