Bug 8163: getDataTreeChangeListenerExecutor() & DataBrokerTestModule
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / test / java / org / opendaylight / controller / md / sal / binding / test / DataBrokerTestModule.java
index c71049e444041e53a131f9877637f88a82a97bba..990d75a91708ce8d9b0c2c7e701eeca5ba1a79b1 100644 (file)
@@ -9,19 +9,29 @@ package org.opendaylight.controller.md.sal.binding.test;
 
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 
-// @Module
 public class DataBrokerTestModule {
 
+    public static DataBroker dataBroker() {
+        return new DataBrokerTestModule(false).getDataBroker();
+    }
+
+    private final boolean useMTDataTreeChangeListenerExecutor;
+
+    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();
+            ConstantSchemaAbstractDataBrokerTest dataBrokerTest
+                = new ConstantSchemaAbstractDataBrokerTest(useMTDataTreeChangeListenerExecutor);
             dataBrokerTest.setup();
             return dataBrokerTest.getDataBroker();
         } catch (Exception e) {