Bug 8163: getDataTreeChangeListenerExecutor() & DataBrokerTestModule
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / test / java / org / opendaylight / controller / md / sal / binding / test / AbstractDataBrokerTestCustomizer.java
index 8d968b0a01526da6cbd6892f20d775e57f5cec31..375a9f119c3787adaec7e8b3f36f704d72ce19f7 100644 (file)
@@ -40,7 +40,6 @@ public abstract class AbstractDataBrokerTestCustomizer {
     private final MockSchemaService schemaService;
     private ImmutableMap<LogicalDatastoreType, DOMStore> datastores;
     private final BindingToNormalizedNodeCodec bindingToNormalized;
     private final MockSchemaService schemaService;
     private ImmutableMap<LogicalDatastoreType, DOMStore> datastores;
     private final BindingToNormalizedNodeCodec bindingToNormalized;
-    private ListeningExecutorService dataTreeChangeListenerExecutor = MoreExecutors.newDirectExecutorService();
 
     public ImmutableMap<LogicalDatastoreType, DOMStore> createDatastores() {
         return ImmutableMap.<LogicalDatastoreType, DOMStore>builder()
 
     public ImmutableMap<LogicalDatastoreType, DOMStore> createDatastores() {
         return ImmutableMap.<LogicalDatastoreType, DOMStore>builder()
@@ -61,13 +60,13 @@ public abstract class AbstractDataBrokerTestCustomizer {
     }
 
     public DOMStore createConfigurationDatastore() {
     }
 
     public DOMStore createConfigurationDatastore() {
-        final InMemoryDOMDataStore store = new InMemoryDOMDataStore("CFG", dataTreeChangeListenerExecutor);
+        final InMemoryDOMDataStore store = new InMemoryDOMDataStore("CFG", getDataTreeChangeListenerExecutor());
         this.schemaService.registerSchemaContextListener(store);
         return store;
     }
 
     public DOMStore createOperationalDatastore() {
         this.schemaService.registerSchemaContextListener(store);
         return store;
     }
 
     public DOMStore createOperationalDatastore() {
-        final InMemoryDOMDataStore store = new InMemoryDOMDataStore("OPER", dataTreeChangeListenerExecutor);
+        final InMemoryDOMDataStore store = new InMemoryDOMDataStore("OPER", getDataTreeChangeListenerExecutor());
         this.schemaService.registerSchemaContextListener(store);
         return store;
     }
         this.schemaService.registerSchemaContextListener(store);
         return store;
     }
@@ -86,6 +85,10 @@ public abstract class AbstractDataBrokerTestCustomizer {
 
     public abstract ListeningExecutorService getCommitCoordinatorExecutor();
 
 
     public abstract ListeningExecutorService getCommitCoordinatorExecutor();
 
+    public ListeningExecutorService getDataTreeChangeListenerExecutor() {
+        return MoreExecutors.newDirectExecutorService();
+    }
+
     public DataBroker createDataBroker() {
         return new BindingDOMDataBrokerAdapter(getDOMDataBroker(), this.bindingToNormalized);
     }
     public DataBroker createDataBroker() {
         return new BindingDOMDataBrokerAdapter(getDOMDataBroker(), this.bindingToNormalized);
     }
@@ -112,10 +115,6 @@ public abstract class AbstractDataBrokerTestCustomizer {
         return this.datastores;
     }
 
         return this.datastores;
     }
 
-    public void setDataTreeChangeListenerExecutor(ListeningExecutorService executor) {
-        this.dataTreeChangeListenerExecutor = executor;
-    }
-
     public void updateSchema(final SchemaContext ctx) {
         this.schemaService.changeSchema(ctx);
     }
     public void updateSchema(final SchemaContext ctx) {
         this.schemaService.changeSchema(ctx);
     }