2 * Copyright (c) 2014 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
9 package org.opendaylight.controller.cluster.datastore.utils;
12 import akka.actor.ActorRef;
13 import akka.actor.ActorSelection;
14 import akka.actor.ActorSystem;
15 import scala.concurrent.duration.FiniteDuration;
17 public class MockActorContext extends ActorContext {
19 private Object executeShardOperationResponse;
20 private Object executeRemoteOperationResponse;
21 private Object executeLocalOperationResponse;
23 public MockActorContext(ActorSystem actorSystem) {
24 super(actorSystem, null);
27 public MockActorContext(ActorSystem actorSystem, ActorRef shardManager) {
28 super(actorSystem, shardManager);
32 @Override public Object executeShardOperation(String shardName,
33 Object message, FiniteDuration duration) {
34 return executeShardOperationResponse;
37 @Override public Object executeRemoteOperation(ActorSelection actor,
38 Object message, FiniteDuration duration) {
39 return executeRemoteOperationResponse;
42 @Override public ActorSelection findPrimary(String shardName) {
46 public void setExecuteShardOperationResponse(Object response){
47 executeShardOperationResponse = response;
50 public void setExecuteRemoteOperationResponse(Object response){
51 executeRemoteOperationResponse = response;
54 public void setExecuteLocalOperationResponse(
55 Object executeLocalOperationResponse) {
56 this.executeLocalOperationResponse = executeLocalOperationResponse;