forked from couchbaselabs/blog-fit-performer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
basicPerformer.java
28 lines (25 loc) · 951 Bytes
/
basicPerformer.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
if (op.hasInsert()) {
//Some code
}
if (op.hasRemove()) {
//Some code
}
if (op.hasGet()) {
//Some code
}
// Reads the transaction object to see if the tests needs a replace operation
if (op.hasReplace()) {
final CommandReplace request = op.getReplace();
//Performer gets the new content value of the document
final JsonObject content = JsonObject.fromJson(request.getContentJson());
// Retrieve information on the location of the document
final Collection collection =
connection.getBucket(request.getDocId().getBucketName())
.scope(request.getDocId().getScopeName())
.collection(request.getDocId().getCollectionName());
String docId = request.getDocId().getDocId() // get docId of the document
//Finally execute transaction operation
final TransactionGetResult r = ctx.get(collection, );
ctx.replace(r, content);
}
});