2 * Copyright (c) 2019 Ericsson India Global Services Pvt Ltd. 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.genius.cloudscaler.tests;
10 import com.google.common.util.concurrent.ListeningExecutorService;
11 import com.google.common.util.concurrent.MoreExecutors;
12 import java.util.concurrent.Executors;
13 import org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker;
14 import org.opendaylight.infrautils.caches.CacheProvider;
15 import org.opendaylight.infrautils.caches.baseimpl.CacheManagersRegistry;
16 import org.opendaylight.infrautils.caches.baseimpl.internal.CacheManagersRegistryImpl;
17 import org.opendaylight.infrautils.caches.guava.internal.GuavaCacheProvider;
18 import org.opendaylight.infrautils.inject.guice.testutils.AbstractGuiceJsr250Module;
19 import org.opendaylight.mdsal.binding.api.DataBroker;
20 import org.opendaylight.mdsal.binding.dom.adapter.test.AbstractBaseDataBrokerTest;
21 import org.opendaylight.mdsal.binding.dom.adapter.test.AbstractDataBrokerTestCustomizer;
23 public class CloudScalerServiceTestModule extends AbstractGuiceJsr250Module {
26 protected void configureBindings() throws Exception {
27 AbstractBaseDataBrokerTest test = new AbstractBaseDataBrokerTest() {
29 protected AbstractDataBrokerTestCustomizer createDataBrokerTestCustomizer() {
30 return new AbstractDataBrokerTestCustomizer() {
32 public ListeningExecutorService getCommitCoordinatorExecutor() {
33 return MoreExecutors.listeningDecorator(Executors.newCachedThreadPool());
39 DataBroker dataBroker = test.getDataBroker();
40 bind(DataBroker.class).toInstance(dataBroker);
41 bind(CacheManagersRegistry.class).to(CacheManagersRegistryImpl.class);
42 bind(CacheProvider.class).to(GuavaCacheProvider.class);
43 SingleTransactionDataBroker singleTransactionDataBroker = new SingleTransactionDataBroker(dataBroker);
44 bind(SingleTransactionDataBroker.class).toInstance(singleTransactionDataBroker);