atomic-storage: remove type dependency at segment level I/O
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / databroker / TestClientBackedDataStore.java
1 /*
2  * Copyright (c) 2019 PANTHEON.tech, 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.databroker;
9
10 import akka.actor.ActorSystem;
11 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
12 import org.opendaylight.controller.cluster.databroker.actors.dds.DataStoreClient;
13 import org.opendaylight.controller.cluster.datastore.ClusterWrapper;
14 import org.opendaylight.controller.cluster.datastore.DatastoreContextFactory;
15 import org.opendaylight.controller.cluster.datastore.LocalShardStore;
16 import org.opendaylight.controller.cluster.datastore.config.Configuration;
17 import org.opendaylight.controller.cluster.datastore.persisted.DatastoreSnapshot;
18 import org.opendaylight.controller.cluster.datastore.shardmanager.AbstractShardManagerCreator;
19 import org.opendaylight.controller.cluster.datastore.shardmanager.TestShardManager;
20 import org.opendaylight.controller.cluster.datastore.shardmanager.TestShardManager.GetLocalShards;
21 import org.opendaylight.controller.cluster.datastore.shardmanager.TestShardManager.GetLocalShardsReply;
22 import org.opendaylight.controller.cluster.datastore.utils.ActorUtils;
23
24 public class TestClientBackedDataStore extends ClientBackedDataStore implements LocalShardStore {
25
26     public TestClientBackedDataStore(final ActorSystem actorSystem, final ClusterWrapper cluster,
27                                      final Configuration configuration,
28                                      final DatastoreContextFactory datastoreContextFactory,
29                                      final DatastoreSnapshot restoreFromSnapshot) {
30         super(actorSystem, cluster, configuration, datastoreContextFactory, restoreFromSnapshot);
31     }
32
33     TestClientBackedDataStore(final ActorUtils actorUtils, final ClientIdentifier identifier,
34                               final DataStoreClient clientActor) {
35         super(actorUtils, identifier, clientActor);
36     }
37
38     @Override
39     protected AbstractShardManagerCreator<?> getShardManagerCreator() {
40         return new TestShardManager.TestShardManagerCreator();
41     }
42
43     @Override
44     public GetLocalShardsReply getLocalShards() {
45         final ActorUtils utils = getActorUtils();
46         return (GetLocalShardsReply) utils.executeOperation(utils.getShardManager(), GetLocalShards.INSTANCE);
47     }
48 }