BUG-7033: Implement pipe-lining in ShardDataTree
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / ShardDataTreeMocking.java
index 1c71b79625cc012f33a46b26f11dfd2f778bb51d..d273910b6dea0498348c824d79798ed96f6ee7fc 100644 (file)
@@ -43,6 +43,14 @@ public final class ShardDataTreeMocking {
         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));
@@ -53,6 +61,14 @@ public final class ShardDataTreeMocking {
         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));
@@ -63,6 +79,14 @@ public final class ShardDataTreeMocking {
         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);