Add AbstractTransactionCommitCohort unit tests
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / access / client / AccessClientUtil.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies s.r.o. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.cluster.access.client;
9
10 import akka.actor.ActorRef;
11 import akka.actor.ActorSystem;
12 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
13 import org.opendaylight.controller.cluster.access.concepts.ResponseEnvelope;
14
15 /**
16  * Util class to access package private members in cds-access-client for test purposes.
17  */
18 public class AccessClientUtil {
19
20     public static ClientActorContext createClientActorContext(final ActorSystem system, final ActorRef actor,
21                                                               final ClientIdentifier id, final String persistenceId) {
22         return new ClientActorContext(actor, system.scheduler(), system.dispatcher(), persistenceId, id);
23     }
24
25     public static <T extends BackendInfo> ConnectedClientConnection<T> createConnectedConnection(
26             final ClientActorContext context, final Long cookie, final T backend) {
27         return new ConnectedClientConnection<>(context, cookie, backend);
28     }
29
30     public static void completeRequest(final AbstractClientConnection<? extends BackendInfo> connection,
31                                        final ResponseEnvelope<?> envelope) {
32         connection.receiveResponse(envelope);
33     }
34
35 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.