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.mdsal.binding.testutils;
10 import org.opendaylight.mdsal.binding.api.DataBroker;
13 public class DataBrokerTestModule {
15 // Suppress IllegalCatch because of AbstractDataBrokerTest (change later)
16 @SuppressWarnings({ "checkstyle:IllegalCatch", "checkstyle:IllegalThrows" })
17 public static /* @Provides @Singleton */ DataBroker dataBroker() throws RuntimeException {
19 // This is a little bit "upside down" - in the future,
20 // we should probably put what is in AbstractDataBrokerTest
21 // into this DataBrokerTestModule, and make AbstractDataBrokerTest
22 // use it, instead of the way around it currently is (the opposite);
23 // this is just for historical reasons... and works for now.
24 AbstractDataBrokerTest dataBrokerTest = new AbstractDataBrokerTest();
25 dataBrokerTest.setup();
26 return dataBrokerTest.getDataBroker();
27 } catch (Exception e) {
28 throw new RuntimeException(e);