2 * Copyright (c) 2016 Red Hat, 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.md.sal.binding.test;
10 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
12 public class DataBrokerTestModule {
14 public static DataBroker dataBroker() {
15 return new DataBrokerTestModule(false).getDataBroker();
18 private final boolean useMTDataTreeChangeListenerExecutor;
20 public DataBrokerTestModule(boolean useMTDataTreeChangeListenerExecutor) {
21 this.useMTDataTreeChangeListenerExecutor = useMTDataTreeChangeListenerExecutor;
24 // Suppress IllegalCatch because of AbstractDataBrokerTest (change later)
25 @SuppressWarnings({ "checkstyle:IllegalCatch", "checkstyle:IllegalThrows" })
26 public DataBroker getDataBroker() throws RuntimeException {
28 // This is a little bit "upside down" - in the future,
29 // we should probably put what is in AbstractDataBrokerTest
30 // into this DataBrokerTestModule, and make AbstractDataBrokerTest
31 // use it, instead of the way around it currently is (the opposite);
32 // this is just for historical reasons... and works for now.
33 ConstantSchemaAbstractDataBrokerTest dataBrokerTest
34 = new ConstantSchemaAbstractDataBrokerTest(useMTDataTreeChangeListenerExecutor);
35 dataBrokerTest.setup();
36 return dataBrokerTest.getDataBroker();
37 } catch (Exception e) {
38 throw new RuntimeException(e);