- verifyCohortInvocations(2, CanCommitTransaction.SERIALIZABLE_CLASS);
- verifyCohortInvocations(2, PreCommitTransaction.SERIALIZABLE_CLASS);
- verifyCohortInvocations(2, CommitTransaction.SERIALIZABLE_CLASS);
+ static class Builder {
+ private Class<?> expCanCommitType;
+ private Class<?> expCommitType;
+ private Class<?> expAbortType;
+ private Object canCommitReply;
+ private Object commitReply;
+ private Object abortReply;
+ private final TransactionIdentifier transactionId;
+
+ Builder(TransactionIdentifier transactionId) {
+ this.transactionId = Preconditions.checkNotNull(transactionId);
+ }
+
+ Builder expectCanCommit(Class<?> newExpCanCommitType, Object newCanCommitReply) {
+ this.expCanCommitType = newExpCanCommitType;
+ this.canCommitReply = newCanCommitReply;
+ return this;
+ }
+
+ Builder expectCanCommit(Object newCanCommitReply) {
+ return expectCanCommit(CanCommitTransaction.class, newCanCommitReply);
+ }
+
+ Builder expectCommit(Class<?> newExpCommitType, Object newCommitReply) {
+ this.expCommitType = newExpCommitType;
+ this.commitReply = newCommitReply;
+ return this;
+ }
+
+ Builder expectCommit(Object newCommitReply) {
+ return expectCommit(CommitTransaction.class, newCommitReply);
+ }
+
+ Builder expectAbort(Class<?> newExpAbortType, Object newAbortReply) {
+ this.expAbortType = newExpAbortType;
+ this.abortReply = newAbortReply;
+ return this;
+ }
+
+ Builder expectAbort(Object newAbortReply) {
+ return expectAbort(AbortTransaction.class, newAbortReply);
+ }
+
+ Props props() {
+ return Props.create(CohortActor.class, this);
+ }
+ }