Remove sal.core.api.model
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / test / java / org / opendaylight / controller / md / sal / binding / test / DataBrokerTestModule.java
index 96facbed9cdd3dbd9e95919fa91c2c6d208d55ff..f98f1a1845f3af9d9dcee044d05244bf73914266 100644 (file)
@@ -8,24 +8,59 @@
 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
 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.
-            AbstractDataBrokerTest dataBrokerTest = new AbstractDataBrokerTest();
+            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();
+    }
 }