BUG-8538: do not invoke read callbacks during replay.
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / access / client / AccessClientUtil.java
index 9929b402ca94e8d1a3a924126198bfd4e7e59338..a43dc55fdcd532beca3f2d1e51d2de70ce4e6e9f 100644 (file)
@@ -7,9 +7,14 @@
  */
 package org.opendaylight.controller.cluster.access.client;
 
+import static org.mockito.Mockito.spy;
+
 import akka.actor.ActorRef;
 import akka.actor.ActorSystem;
+import java.util.function.Consumer;
 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
+import org.opendaylight.controller.cluster.access.concepts.Request;
+import org.opendaylight.controller.cluster.access.concepts.Response;
 import org.opendaylight.controller.cluster.access.concepts.ResponseEnvelope;
 
 /**
@@ -19,7 +24,7 @@ public class AccessClientUtil {
 
     public static ClientActorContext createClientActorContext(final ActorSystem system, final ActorRef actor,
                                                               final ClientIdentifier id, final String persistenceId) {
-        return new ClientActorContext(actor, system.scheduler(), system.dispatcher(), persistenceId, id);
+        return spy(new ClientActorContext(actor, system.scheduler(), system.dispatcher(), persistenceId, id));
     }
 
     public static <T extends BackendInfo> ConnectedClientConnection<T> createConnectedConnection(
@@ -32,4 +37,10 @@ public class AccessClientUtil {
         connection.receiveResponse(envelope);
     }
 
+    public static ConnectionEntry createConnectionEntry(final Request<?, ?> request,
+                                                        final Consumer<Response<?, ?>> callback,
+                                                        final long now) {
+        return new ConnectionEntry(request, callback, now);
+    }
+
 }
\ No newline at end of file