2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.cluster.datastore.actors.client;
10 import static org.mockito.Mockito.doReturn;
11 import akka.actor.ActorRef;
12 import org.junit.Before;
13 import org.mockito.Mock;
14 import org.mockito.MockitoAnnotations;
15 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
16 import org.opendaylight.controller.cluster.access.concepts.FrontendIdentifier;
17 import org.opendaylight.controller.cluster.access.concepts.FrontendType;
18 import org.opendaylight.controller.cluster.access.concepts.MemberName;
19 import org.opendaylight.controller.cluster.common.actor.TestTicker;
22 * Abstract base class for client actors and their components.
24 * @author Robert Varga
26 public abstract class AbstractClientActorTest {
27 private static final MemberName MEMBER_NAME = MemberName.forName("member-1");
30 private ClientActorContext mockActorContext;
32 private ActorRef mockSelf;
34 protected final TestTicker ticker = new TestTicker();
38 MockitoAnnotations.initMocks(this);
40 final FrontendType frontendType = FrontendType.forName(getClass().getSimpleName());
41 final FrontendIdentifier frontendId = FrontendIdentifier.create(MEMBER_NAME, frontendType);
42 final ClientIdentifier clientId = ClientIdentifier.create(frontendId, 0);
44 doReturn(ticker).when(mockActorContext).ticker();
45 doReturn(clientId).when(mockActorContext).getIdentifier();
46 doReturn(getClass().getSimpleName()).when(mockActorContext).persistenceId();
47 doReturn(mockSelf).when(mockActorContext).self();
50 protected final ClientActorContext actorContext() {
51 return mockActorContext;
54 protected final ActorRef self() {