return cohort;
}
+ public static FutureCallback<Void> coordinatedCanCommit(final ShardDataTreeCohort cohort) {
+ final FutureCallback<Void> callback = mockCallback();
+ doNothing().when(callback).onSuccess(null);
+ doNothing().when(callback).onFailure(any(Throwable.class));
+ cohort.canCommit(callback);
+ return callback;
+ }
+
public static ShardDataTreeCohort immediatePreCommit(final ShardDataTreeCohort cohort) {
final FutureCallback<DataTreeCandidate> callback = mockCallback();
doNothing().when(callback).onSuccess(any(DataTreeCandidate.class));
return cohort;
}
+ public static FutureCallback<DataTreeCandidate> coordinatedPreCommit(final ShardDataTreeCohort cohort) {
+ final FutureCallback<DataTreeCandidate> callback = mockCallback();
+ doNothing().when(callback).onSuccess(any(DataTreeCandidate.class));
+ doNothing().when(callback).onFailure(any(Throwable.class));
+ cohort.preCommit(callback);
+ return callback;
+ }
+
public static ShardDataTreeCohort immediateCommit(final ShardDataTreeCohort cohort) {
final FutureCallback<UnsignedLong> callback = mockCallback();
doNothing().when(callback).onSuccess(any(UnsignedLong.class));
return cohort;
}
+ public static FutureCallback<UnsignedLong> coordinatedCommit(final ShardDataTreeCohort cohort) {
+ final FutureCallback<UnsignedLong> callback = mockCallback();
+ doNothing().when(callback).onSuccess(any(UnsignedLong.class));
+ doNothing().when(callback).onFailure(any(Throwable.class));
+ cohort.commit(callback);
+ return callback;
+ }
+
@SuppressWarnings("unchecked")
private static <T> Object invokeSuccess(final InvocationOnMock invocation, final T value) {
invocation.getArgumentAt(0, FutureCallback.class).onSuccess(value);