Extract dom-serializer-api|impl from binding-broker-impl
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / test / java / org / opendaylight / controller / sal / binding / test / AbstractDataServiceTest.java
1 package org.opendaylight.controller.sal.binding.test;
2
3 import org.junit.After;
4 import org.junit.Before;
5 import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
6 import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService;
7 import org.opendaylight.controller.sal.binding.test.util.BindingBrokerTestFactory;
8 import org.opendaylight.controller.sal.binding.test.util.BindingTestContext;
9 import org.opendaylight.controller.sal.core.api.data.DataStore;
10 import org.opendaylight.controller.sal.dom.broker.impl.DataStoreStatsWrapper;
11 import org.opendaylight.controller.sal.dom.broker.impl.HashMapDataStore;
12 import org.slf4j.Logger;
13 import org.slf4j.LoggerFactory;
14
15 import com.google.common.util.concurrent.ListeningExecutorService;
16 import com.google.common.util.concurrent.MoreExecutors;
17
18 public abstract class AbstractDataServiceTest {
19     private static Logger log = LoggerFactory.getLogger(AbstractDataServiceTest.class);
20
21     protected org.opendaylight.controller.sal.core.api.data.DataProviderService biDataService;
22     protected DataProviderService baDataService;
23     protected BindingIndependentMappingService mappingService;
24     private DataStoreStatsWrapper dataStoreStats;
25     protected DataStore dataStore;
26     protected BindingTestContext testContext;
27
28     @Before
29     public void setUp() {
30         ListeningExecutorService executor = MoreExecutors.sameThreadExecutor();
31         BindingBrokerTestFactory factory = new BindingBrokerTestFactory();
32         factory.setExecutor(executor);
33         factory.setStartWithParsedSchema(getStartWithSchema());
34         testContext = factory.getTestContext();
35         testContext.start();
36
37         baDataService = testContext.getBindingDataBroker();
38         biDataService = testContext.getDomDataBroker();
39         dataStore = testContext.getDomDataStore();
40         mappingService = testContext.getBindingToDomMappingService();
41     }
42
43     protected boolean getStartWithSchema() {
44         return true;
45     }
46
47     @After
48     public void afterTest() {
49
50         testContext.logDataStoreStatistics();
51
52     }
53 }