X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=test-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Ftest%2FDataStoreContextImpl.java;h=c94230bbb2647e86e4c630654b8589dbfd774aa5;hb=b1b3bafd549bb501937cea5c976d5344608b6ed3;hp=9fea5cb4a87042b17a2b0a68bfdef43e8e6e7c0f;hpb=6fede53990d78fad5c5a52d184245aa5db43fe5f;p=transportpce.git diff --git a/test-common/src/main/java/org/opendaylight/transportpce/test/DataStoreContextImpl.java b/test-common/src/main/java/org/opendaylight/transportpce/test/DataStoreContextImpl.java index 9fea5cb4a..c94230bbb 100644 --- a/test-common/src/main/java/org/opendaylight/transportpce/test/DataStoreContextImpl.java +++ b/test-common/src/main/java/org/opendaylight/transportpce/test/DataStoreContextImpl.java @@ -9,22 +9,28 @@ package org.opendaylight.transportpce.test; import com.google.common.collect.ImmutableMap; import com.google.common.util.concurrent.MoreExecutors; -import java.util.LinkedList; -import java.util.List; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import java.util.HashSet; import java.util.Map; import java.util.ServiceLoader; +import java.util.Set; import java.util.concurrent.Executors; import org.opendaylight.mdsal.binding.api.DataBroker; import org.opendaylight.mdsal.binding.api.NotificationPublishService; import org.opendaylight.mdsal.binding.api.NotificationService; import org.opendaylight.mdsal.binding.dom.adapter.BindingAdapterFactory; import org.opendaylight.mdsal.binding.dom.adapter.ConstantAdapterContext; +import org.opendaylight.mdsal.binding.dom.adapter.spi.AdapterFactory; import org.opendaylight.mdsal.binding.dom.codec.impl.BindingCodecContext; import org.opendaylight.mdsal.binding.dom.codec.spi.BindingDOMCodecServices; import org.opendaylight.mdsal.binding.runtime.spi.BindingRuntimeHelpers; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.mdsal.dom.api.DOMDataBroker; +import org.opendaylight.mdsal.dom.api.DOMNotificationPublishService; +import org.opendaylight.mdsal.dom.api.DOMNotificationService; import org.opendaylight.mdsal.dom.broker.DOMNotificationRouter; +import org.opendaylight.mdsal.dom.broker.RouterDOMNotificationService; +import org.opendaylight.mdsal.dom.broker.RouterDOMPublishNotificationService; import org.opendaylight.mdsal.dom.broker.SerializedDOMDataBroker; import org.opendaylight.mdsal.dom.spi.FixedDOMSchemaService; import org.opendaylight.mdsal.dom.spi.store.DOMStore; @@ -43,11 +49,13 @@ public class DataStoreContextImpl implements DataStoreContext { private final NotificationPublishService notificationPublishService; private EffectiveModelContext schemaCtx; private BindingDOMCodecServices bindingDOMCodecServices; - private BindingAdapterFactory adapterFactory ; - + private AdapterFactory adapterFactory; + private DOMNotificationService domNotificationService; + private DOMNotificationPublishService domNotificationPublishService; + @SuppressFBWarnings(value = "MC_OVERRIDABLE_METHOD_CALL_IN_CONSTRUCTOR") public DataStoreContextImpl() { - List moduleInfos = new LinkedList<>(); + Set moduleInfos = new HashSet<>(); ServiceLoader yangProviderLoader = ServiceLoader.load(YangModelBindingProvider.class); for (YangModelBindingProvider yangModelBindingProvider : yangProviderLoader) { moduleInfos.add(yangModelBindingProvider.getModuleInfo()); @@ -55,7 +63,9 @@ public class DataStoreContextImpl implements DataStoreContext { schemaCtx = BindingRuntimeHelpers.createEffectiveModel(moduleInfos); bindingDOMCodecServices = new BindingCodecContext(BindingRuntimeHelpers.createRuntimeContext()); adapterFactory = new BindingAdapterFactory(new ConstantAdapterContext(bindingDOMCodecServices)); - domNotificationRouter = DOMNotificationRouter.create(16); + domNotificationRouter = new DOMNotificationRouter(16); + domNotificationService = new RouterDOMNotificationService(domNotificationRouter); + domNotificationPublishService = new RouterDOMPublishNotificationService(domNotificationRouter); datastores = createDatastores(); domDataBroker = createDOMDataBroker(); dataBroker = createDataBroker(); @@ -74,13 +84,13 @@ public class DataStoreContextImpl implements DataStoreContext { } @Override - public NotificationService createNotificationService() { - return adapterFactory.createNotificationService(domNotificationRouter); + public final NotificationService createNotificationService() { + return adapterFactory.createNotificationService(domNotificationService); } @Override - public NotificationPublishService createNotificationPublishService() { - return adapterFactory.createNotificationPublishService(domNotificationRouter); + public final NotificationPublishService createNotificationPublishService() { + return adapterFactory.createNotificationPublishService(domNotificationPublishService); } @Override @@ -114,13 +124,11 @@ public class DataStoreContextImpl implements DataStoreContext { } private DOMStore createConfigurationDatastore() { - return InMemoryDOMDataStoreFactory.create("CFG", - FixedDOMSchemaService.of(bindingDOMCodecServices.getRuntimeContext())); + return InMemoryDOMDataStoreFactory.create("DOM-CFG", new FixedDOMSchemaService(schemaCtx)); } private DOMStore createOperationalDatastore() { - return InMemoryDOMDataStoreFactory.create("OPER", - FixedDOMSchemaService.of(bindingDOMCodecServices.getRuntimeContext())); + return InMemoryDOMDataStoreFactory.create("DOM-OPER", new FixedDOMSchemaService(schemaCtx)); } @Override