X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-binding-broker%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fbinding%2Ftest%2FDataBrokerTestModule.java;h=384f3dfb278be2485769a661336613cbf0390f69;hb=8da08c9f008d371c491cf6b35494ca36c2ebdcb9;hp=c71049e444041e53a131f9877637f88a82a97bba;hpb=a12683b9e6445f48216ce0ca357dfcf359c8e3b3;p=controller.git diff --git a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/DataBrokerTestModule.java b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/DataBrokerTestModule.java index c71049e444..384f3dfb27 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/DataBrokerTestModule.java +++ b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/DataBrokerTestModule.java @@ -8,24 +8,60 @@ package org.opendaylight.controller.md.sal.binding.test; import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec; +import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; +import org.opendaylight.controller.md.sal.dom.broker.impl.DOMNotificationRouter; +import org.opendaylight.mdsal.dom.api.DOMSchemaService; +import org.opendaylight.yangtools.yang.model.api.SchemaContextProvider; -// @Module +@Deprecated public class DataBrokerTestModule { + public static DataBroker dataBroker() { + return new DataBrokerTestModule(false).getDataBroker(); + } + + private final boolean useMTDataTreeChangeListenerExecutor; + private ConstantSchemaAbstractDataBrokerTest dataBrokerTest; + + public DataBrokerTestModule(boolean useMTDataTreeChangeListenerExecutor) { + this.useMTDataTreeChangeListenerExecutor = useMTDataTreeChangeListenerExecutor; + } + // Suppress IllegalCatch because of AbstractDataBrokerTest (change later) @SuppressWarnings({ "checkstyle:IllegalCatch", "checkstyle:IllegalThrows" }) - public static /* @Provides @Singleton */ DataBroker dataBroker() throws RuntimeException { + public DataBroker getDataBroker() throws RuntimeException { try { // This is a little bit "upside down" - in the future, // we should probably put what is in AbstractDataBrokerTest // into this DataBrokerTestModule, and make AbstractDataBrokerTest // use it, instead of the way around it currently is (the opposite); // this is just for historical reasons... and works for now. - ConstantSchemaAbstractDataBrokerTest dataBrokerTest = new ConstantSchemaAbstractDataBrokerTest(); + dataBrokerTest = new ConstantSchemaAbstractDataBrokerTest(useMTDataTreeChangeListenerExecutor); dataBrokerTest.setup(); return dataBrokerTest.getDataBroker(); } catch (Exception e) { throw new RuntimeException(e); } } + + public DOMDataBroker getDOMDataBroker() { + return dataBrokerTest.getDomBroker(); + } + + public BindingToNormalizedNodeCodec getBindingToNormalizedNodeCodec() { + return dataBrokerTest.getDataBrokerTestCustomizer().getBindingToNormalized(); + } + + public DOMNotificationRouter getDOMNotificationRouter() { + return dataBrokerTest.getDataBrokerTestCustomizer().getDomNotificationRouter(); + } + + public DOMSchemaService getSchemaService() { + return dataBrokerTest.getDataBrokerTestCustomizer().getSchemaService(); + } + + public SchemaContextProvider getSchemaContextProvider() { + return (SchemaContextProvider) dataBrokerTest.getDataBrokerTestCustomizer().getSchemaService(); + } }