Skip to content

Instantly share code, notes, and snippets.

View programmatix's full-sized avatar

Graham Pople programmatix

View GitHub Profile
/*
* Copyright (c) 2021 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
# This file declaratively says what performance tests should be run, and where they should be run.
# The tools will work out all permutations of runs from this.
# They will interrogate the database and see what runs already exist.
# Any runs that need running, will be.
servers:
# This is where the performers should run. If not "localhost" they will be scp-ed to here, in the form of a tarred Docker image.
performer: localhost
driver:
String docId = UUID.randomUUID().toString();
collection.mutateIn(docId, Arrays.asList(
MutateInSpec.upsert("txn.id.txn", UUID.randomUUID().toString()).xattr().createPath(),
MutateInSpec.upsert("txn.id.atmpt", UUID.randomUUID().toString()).xattr().createPath(),
MutateInSpec.upsert("txn.atr.id", "some-atr-id").xattr().createPath(),
MutateInSpec.upsert("txn.op.stgd", JsonObject.create().put("foo", "bar")).xattr().createPath(),
MutateInSpec.upsert("txn.atr.bkt", "default").xattr(),
MutateInSpec.upsert("txn.atr.coll", "_default._default").xattr().createPath(),
MutateInSpec.upsert("txn.op.type", "insert").xattr()
// Cluster as normal
CouchbaseCluster cluster = CouchbaseCluster.create("localhost");
cluster.authenticate("Administrator", "password");
Bucket bucket = cluster.openBucket("default");
// Collection from bucket
Collection collection = bucket.collection("users");
// These options are ones we'll apply to EVERY set - e.g. no key, cas, expiry
public static SetOptions getSetOpts() {