Fix checkstyle violations in sal-inmemory-datastore 07/69107/3
authorTom Pantelis <tompantelis@gmail.com>
Tue, 6 Mar 2018 04:23:21 +0000 (23:23 -0500)
committerMichael Vorburger <vorburger@redhat.com>
Wed, 7 Mar 2018 12:50:01 +0000 (12:50 +0000)
Change-Id: I4e8dec800b8e5a2871e51ec4cd150f06c8af1bd1
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
29 files changed:
opendaylight/md-sal/sal-dom-config/src/main/java/org/opendaylight/controller/config/yang/config/legacy_entity_ownership_service_provider/LegacyEntityOwnershipServiceProviderModule.java
opendaylight/md-sal/sal-dom-config/src/main/java/org/opendaylight/controller/config/yang/config/legacy_entity_ownership_service_provider/LegacyEntityOwnershipServiceProviderModuleFactory.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/config/yang/inmemory_datastore_provider/InMemoryConfigDataStoreProviderModule.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/config/yang/inmemory_datastore_provider/InMemoryConfigDataStoreProviderModuleFactory.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/config/yang/inmemory_datastore_provider/InMemoryOperationalDataStoreProviderModule.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/config/yang/inmemory_datastore_provider/InMemoryOperationalDataStoreProviderModuleFactory.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/DOMImmutableDataChangeEvent.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/DataChangeListenerRegistration.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMDataStore.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMDataStoreConfigProperties.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMDataStoreFactory.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMStoreThreePhaseCommitCohort.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMStoreTreeChangePublisher.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/ResolveDataChangeEventsTask.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/ResolveDataChangeState.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/jmx/InMemoryDataStoreStats.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/DataChangeListenerRegistrationImpl.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/ListenerTree.java
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/AbstractDataChangeListenerTest.java
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/DatastoreTestTask.java
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/DefaultDataChangeListenerTestSuite.java
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDataStoreTest.java
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/RootScopeSubtreeTest.java
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/SchemaUpdateForTransactionTest.java
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/TestDCLExecutorService.java
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/TestModel.java
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/WildcardedScopeBaseTest.java
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/WildcardedScopeOneTest.java
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/WildcardedScopeSubtreeTest.java

index 5fe9ff99def3f8ab626b9d01e85cf0a8856beefc..1d65c3bd925bb43549baa4bce68a9fc84d0c4407 100644 (file)
@@ -18,17 +18,21 @@ import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipS
 import org.osgi.framework.BundleContext;
 
 /**
+ * Deprecated.
+ *
  * @deprecated Replaced by blueprint wiring
  */
 @Deprecated
 public class LegacyEntityOwnershipServiceProviderModule extends AbstractLegacyEntityOwnershipServiceProviderModule {
     private BundleContext bundleContext;
 
-    public LegacyEntityOwnershipServiceProviderModule(ModuleIdentifier identifier, DependencyResolver dependencyResolver) {
+    public LegacyEntityOwnershipServiceProviderModule(ModuleIdentifier identifier,
+            DependencyResolver dependencyResolver) {
         super(identifier, dependencyResolver);
     }
 
-    public LegacyEntityOwnershipServiceProviderModule(ModuleIdentifier identifier, DependencyResolver dependencyResolver,
+    public LegacyEntityOwnershipServiceProviderModule(ModuleIdentifier identifier,
+            DependencyResolver dependencyResolver,
             LegacyEntityOwnershipServiceProviderModule oldModule, java.lang.AutoCloseable oldInstance) {
         super(identifier, dependencyResolver, oldModule, oldInstance);
     }
@@ -46,6 +50,7 @@ public class LegacyEntityOwnershipServiceProviderModule extends AbstractLegacyEn
 
         return Reflection.newProxy(AutoCloseableEntityOwnershipService.class, new AbstractInvocationHandler() {
             @Override
+            @SuppressWarnings("checkstyle:AvoidHidingCauseException")
             protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable {
                 if (method.getName().equals("close")) {
                     tracker.close();
index fe1a0bf94d31a652919562732a1daa304306f28e..f24b7b6da8cb457c97de96638ccde5c7f9c7b9b4 100644 (file)
@@ -13,20 +13,27 @@ import org.opendaylight.controller.config.spi.Module;
 import org.osgi.framework.BundleContext;
 
 /**
+ * Deprecated.
+ *
  * @deprecated Replaced by blueprint wiring
  */
 @Deprecated
-public class LegacyEntityOwnershipServiceProviderModuleFactory extends AbstractLegacyEntityOwnershipServiceProviderModuleFactory {
+public class LegacyEntityOwnershipServiceProviderModuleFactory
+        extends AbstractLegacyEntityOwnershipServiceProviderModuleFactory {
     @Override
-    public Module createModule(String instanceName, DependencyResolver dependencyResolver, BundleContext bundleContext) {
-        LegacyEntityOwnershipServiceProviderModule module = (LegacyEntityOwnershipServiceProviderModule) super.createModule(instanceName, dependencyResolver, bundleContext);
+    public Module createModule(String instanceName, DependencyResolver dependencyResolver,
+            BundleContext bundleContext) {
+        LegacyEntityOwnershipServiceProviderModule module = (LegacyEntityOwnershipServiceProviderModule)
+                super.createModule(instanceName, dependencyResolver, bundleContext);
         module.setBundleContext(bundleContext);
         return module;
     }
 
     @Override
-    public Module createModule(String instanceName, DependencyResolver dependencyResolver, DynamicMBeanWithInstance old, BundleContext bundleContext) throws Exception {
-        LegacyEntityOwnershipServiceProviderModule module = (LegacyEntityOwnershipServiceProviderModule) super.createModule(instanceName, dependencyResolver, old, bundleContext);
+    public Module createModule(String instanceName, DependencyResolver dependencyResolver,
+            DynamicMBeanWithInstance old, BundleContext bundleContext) throws Exception {
+        LegacyEntityOwnershipServiceProviderModule module = (LegacyEntityOwnershipServiceProviderModule)
+                super.createModule(instanceName, dependencyResolver, old, bundleContext);
         module.setBundleContext(bundleContext);
         return module;
     }
index 35ea03d70e9d0bbf72e6c6ceef38f9900e9e7ea7..2d1f04178500799c41ed87d898e430105f689d6c 100644 (file)
@@ -8,6 +8,8 @@
 
 package org.opendaylight.controller.config.yang.inmemory_datastore_provider;
 
+import org.opendaylight.controller.config.api.DependencyResolver;
+import org.opendaylight.controller.config.api.ModuleIdentifier;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStoreConfigProperties;
@@ -18,13 +20,16 @@ import org.opendaylight.controller.md.sal.dom.store.impl.jmx.InMemoryDataStoreSt
  * The in-memory data store isn't used anymore. Deprecation notice in Carbon. Removal plan in Nitrogen.
  */
 @Deprecated
-public class InMemoryConfigDataStoreProviderModule extends org.opendaylight.controller.config.yang.inmemory_datastore_provider.AbstractInMemoryConfigDataStoreProviderModule {
+public class InMemoryConfigDataStoreProviderModule extends AbstractInMemoryConfigDataStoreProviderModule {
 
-    public InMemoryConfigDataStoreProviderModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+    public InMemoryConfigDataStoreProviderModule(final ModuleIdentifier identifier,
+            final DependencyResolver dependencyResolver) {
         super(identifier, dependencyResolver);
     }
 
-    public InMemoryConfigDataStoreProviderModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final org.opendaylight.controller.config.yang.inmemory_datastore_provider.InMemoryConfigDataStoreProviderModule oldModule, final java.lang.AutoCloseable oldInstance) {
+    public InMemoryConfigDataStoreProviderModule(final ModuleIdentifier identifier,
+            final DependencyResolver dependencyResolver, final InMemoryConfigDataStoreProviderModule oldModule,
+            final AutoCloseable oldInstance) {
         super(identifier, dependencyResolver, oldModule, oldInstance);
     }
 
@@ -46,5 +51,4 @@ public class InMemoryConfigDataStoreProviderModule extends org.opendaylight.cont
 
         return dataStore;
     }
-
 }
index 8116708bb65827fd7e082c55478d7eaa27e6a45a..9c439b6069a8d4baf683f2715e0a43f9621dd1dd 100644 (file)
@@ -5,22 +5,12 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
-/*
-* Generated file
-*
-* Generated from: yang module name: opendaylight-inmemory-datastore-provider yang module local name: inmemory-config-datastore-provider
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Thu Jun 19 17:10:42 PDT 2014
-*
-* Do not modify this file unless it is present under src/main directory
-*/
 package org.opendaylight.controller.config.yang.inmemory_datastore_provider;
 
 /**
  * The in-memory data store isn't used anymore. Deprecation notice in Carbon. Removal plan in Nitrogen.
  */
 @Deprecated
-public class InMemoryConfigDataStoreProviderModuleFactory extends org.opendaylight.controller.config.yang.inmemory_datastore_provider.AbstractInMemoryConfigDataStoreProviderModuleFactory {
+public class InMemoryConfigDataStoreProviderModuleFactory extends AbstractInMemoryConfigDataStoreProviderModuleFactory {
 
 }
index bf323902aa0205cbce8a9a34bf53a8aa6d6f6ef8..af81254ee56b7301b6782fa78abd04bcc538a096 100644 (file)
@@ -8,6 +8,8 @@
 
 package org.opendaylight.controller.config.yang.inmemory_datastore_provider;
 
+import org.opendaylight.controller.config.api.DependencyResolver;
+import org.opendaylight.controller.config.api.ModuleIdentifier;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStoreConfigProperties;
@@ -18,13 +20,16 @@ import org.opendaylight.controller.md.sal.dom.store.impl.jmx.InMemoryDataStoreSt
  * The in-memory data store isn't used anymore. Deprecation notice in Carbon. Removal plan in Nitrogen.
  */
 @Deprecated
-public class InMemoryOperationalDataStoreProviderModule extends org.opendaylight.controller.config.yang.inmemory_datastore_provider.AbstractInMemoryOperationalDataStoreProviderModule {
+public class InMemoryOperationalDataStoreProviderModule extends AbstractInMemoryOperationalDataStoreProviderModule {
 
-    public InMemoryOperationalDataStoreProviderModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+    public InMemoryOperationalDataStoreProviderModule(final ModuleIdentifier identifier,
+            final DependencyResolver dependencyResolver) {
         super(identifier, dependencyResolver);
     }
 
-    public InMemoryOperationalDataStoreProviderModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final org.opendaylight.controller.config.yang.inmemory_datastore_provider.InMemoryOperationalDataStoreProviderModule oldModule, final java.lang.AutoCloseable oldInstance) {
+    public InMemoryOperationalDataStoreProviderModule(final ModuleIdentifier identifier,
+            final DependencyResolver dependencyResolver, final InMemoryOperationalDataStoreProviderModule oldModule,
+            final AutoCloseable oldInstance) {
         super(identifier, dependencyResolver, oldModule, oldInstance);
     }
 
index ec576a01761e3299ee5a0a435367c09288f858d9..535c0c8965048770ac835744373547e8ddfc5d10 100644 (file)
@@ -5,22 +5,12 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
-/*
-* Generated file
-*
-* Generated from: yang module name: opendaylight-inmemory-datastore-provider yang module local name: inmemory-operational-datastore-provider
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Thu Jun 19 17:10:42 PDT 2014
-*
-* Do not modify this file unless it is present under src/main directory
-*/
 package org.opendaylight.controller.config.yang.inmemory_datastore_provider;
 
 /**
  * The in-memory data store isn't used anymore. Deprecation notice in Carbon. Removal plan in Nitrogen.
  */
 @Deprecated
-public class InMemoryOperationalDataStoreProviderModuleFactory extends org.opendaylight.controller.config.yang.inmemory_datastore_provider.AbstractInMemoryOperationalDataStoreProviderModuleFactory {
-
+public class InMemoryOperationalDataStoreProviderModuleFactory
+        extends AbstractInMemoryOperationalDataStoreProviderModuleFactory {
 }
index f457e3b9e9603bb2d409ac1d8b3d6fe8b1ea35eb..43b1c636e491f678e0550f25b3bef84e46f2206f 100644 (file)
@@ -8,13 +8,11 @@
 package org.opendaylight.controller.md.sal.dom.store.impl;
 
 import com.google.common.base.Preconditions;
-
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
-
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -24,7 +22,6 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 public final class DOMImmutableDataChangeEvent implements
         AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> {
 
-
     private static final RemoveEventFactory REMOVE_EVENT_FACTORY = new RemoveEventFactory();
     private static final CreateEventFactory CREATE_EVENT_FACTORY = new CreateEventFactory();
 
@@ -36,8 +33,6 @@ public final class DOMImmutableDataChangeEvent implements
     private final Set<YangInstanceIdentifier> removedPaths;
     private final DataChangeScope scope;
 
-
-
     private DOMImmutableDataChangeEvent(final Builder change) {
         original = change.before;
         updated = change.after;
@@ -48,7 +43,7 @@ public final class DOMImmutableDataChangeEvent implements
         scope = change.scope;
     }
 
-    public static final Builder builder(final DataChangeScope scope) {
+    public static Builder builder(final DataChangeScope scope) {
         return new Builder(scope);
     }
 
@@ -93,9 +88,7 @@ public final class DOMImmutableDataChangeEvent implements
     }
 
     /**
-     * Simple event factory which creates event based on path and data
-     *
-     *
+     * Simple event factory which creates event based on path and data.
      */
     public interface SimpleEventFactory {
         DOMImmutableDataChangeEvent create(YangInstanceIdentifier path, NormalizedNode<PathArgument,?> data);
@@ -104,30 +97,31 @@ public final class DOMImmutableDataChangeEvent implements
     /**
      * Event factory which takes after state and creates event for it.
      *
+     * <p>
      * Factory for events based on path and after state.
      * After state is set as {@link #getUpdatedSubtree()} and is path,
      * state mapping is also present in {@link #getUpdatedData()}.
-     *
-     * @return
      */
-    public static final SimpleEventFactory getCreateEventFactory() {
+    public static SimpleEventFactory getCreateEventFactory() {
         return CREATE_EVENT_FACTORY;
     }
 
     /**
      * Event factory which takes before state and creates event for it.
      *
+     * <p>
      * Factory for events based on path and after state.
      * After state is set as {@link #getOriginalSubtree()} and is path,
      * state mapping is also present in {@link #getOriginalSubtree()}.
      *
+     * <p>
      * Path is present in {@link #getRemovedPaths()}.
-     * @return
      */
-    public static final SimpleEventFactory getRemoveEventFactory() {
+    public static SimpleEventFactory getRemoveEventFactory() {
         return REMOVE_EVENT_FACTORY;
     }
-    public static class Builder {
+
+    public static final class Builder {
 
         public DataChangeScope scope;
         private NormalizedNode<?, ?> after;
@@ -178,10 +172,10 @@ public final class DOMImmutableDataChangeEvent implements
             return this;
         }
 
-        public Builder addUpdated(final YangInstanceIdentifier path, final NormalizedNode<?, ?> before,
-                final NormalizedNode<?, ?> after) {
-            original.put(path, before);
-            updated.put(path, after);
+        public Builder addUpdated(final YangInstanceIdentifier path, final NormalizedNode<?, ?> nodeBefore,
+                final NormalizedNode<?, ?> nodeAfter) {
+            original.put(path, nodeBefore);
+            updated.put(path, nodeAfter);
             return this;
         }
 
@@ -193,7 +187,8 @@ public final class DOMImmutableDataChangeEvent implements
     private static final class RemoveEventFactory implements SimpleEventFactory {
 
         @Override
-        public DOMImmutableDataChangeEvent create(final YangInstanceIdentifier path, final NormalizedNode<PathArgument, ?> data) {
+        public DOMImmutableDataChangeEvent create(final YangInstanceIdentifier path,
+                final NormalizedNode<PathArgument, ?> data) {
             return builder(DataChangeScope.BASE) //
                     .setBefore(data) //
                     .addRemoved(path, data) //
@@ -205,12 +200,12 @@ public final class DOMImmutableDataChangeEvent implements
     private static final class CreateEventFactory implements SimpleEventFactory {
 
         @Override
-        public DOMImmutableDataChangeEvent create(final YangInstanceIdentifier path, final NormalizedNode<PathArgument, ?> data) {
+        public DOMImmutableDataChangeEvent create(final YangInstanceIdentifier path,
+                final NormalizedNode<PathArgument, ?> data) {
             return builder(DataChangeScope.BASE) //
                     .setAfter(data) //
                     .addCreated(path, data) //
                     .build();
         }
     }
-
 }
index b26f43b2b73eb723f8116039b42fc650276606e5..7e8ee187e5ae1954909db20ac9a4567850acc499 100644 (file)
@@ -13,7 +13,8 @@ import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
-public interface DataChangeListenerRegistration<L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> extends ListenerRegistration<L> {
+public interface DataChangeListenerRegistration<L extends AsyncDataChangeListener<YangInstanceIdentifier,
+        NormalizedNode<?, ?>>> extends ListenerRegistration<L> {
     @Override
     L getInstance();
 
index 3582ff6ef1061749f1649cc58aed21def801d002..af20e14c1cad589d8bbceecf2f49ce7677524cbd 100644 (file)
@@ -50,18 +50,23 @@ import org.slf4j.LoggerFactory;
 /**
  * In-memory DOM Data Store
  *
+ * <p>
  * Implementation of {@link DOMStore} which uses {@link DataTree} and other
  * classes such as {@link SnapshotBackedWriteTransaction}.
- * {@link org.opendaylight.controller.sal.core.spi.data.SnapshotBackedReadTransaction} and {@link ResolveDataChangeEventsTask}
+ * {@link org.opendaylight.controller.sal.core.spi.data.SnapshotBackedReadTransaction} and
+ * {@link ResolveDataChangeEventsTask}
  * to implement {@link DOMStore} contract.
  *
  */
-public class InMemoryDOMDataStore extends TransactionReadyPrototype<String> implements DOMStore, Identifiable<String>, SchemaContextListener, AutoCloseable, DOMStoreTreeChangePublisher {
+public class InMemoryDOMDataStore extends TransactionReadyPrototype<String>
+        implements DOMStore, Identifiable<String>, SchemaContextListener, AutoCloseable, DOMStoreTreeChangePublisher {
     private static final Logger LOG = LoggerFactory.getLogger(InMemoryDOMDataStore.class);
 
-    private static final Invoker<DataChangeListenerRegistration<?>, DOMImmutableDataChangeEvent> DCL_NOTIFICATION_MGR_INVOKER =
+    private static final Invoker<DataChangeListenerRegistration<?>, DOMImmutableDataChangeEvent>
+        DCL_NOTIFICATION_MGR_INVOKER =
             (listener, notification) -> {
-                final AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> inst = listener.getInstance();
+                final AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> inst =
+                        listener.getInstance();
                 if (inst != null) {
                     inst.onDataChanged(notification);
                 }
@@ -71,7 +76,8 @@ public class InMemoryDOMDataStore extends TransactionReadyPrototype<String> impl
     private final ListenerTree listenerTree = ListenerTree.create();
     private final AtomicLong txCounter = new AtomicLong(0);
 
-    private final QueuedNotificationManager<DataChangeListenerRegistration<?>, DOMImmutableDataChangeEvent> dataChangeListenerNotificationManager;
+    private final QueuedNotificationManager<DataChangeListenerRegistration<?>, DOMImmutableDataChangeEvent>
+            dataChangeListenerNotificationManager;
     private final InMemoryDOMStoreTreeChangePublisher changePublisher;
     private final ExecutorService dataChangeListenerExecutor;
     private final boolean debugTransactions;
@@ -95,7 +101,8 @@ public class InMemoryDOMDataStore extends TransactionReadyPrototype<String> impl
                 new QueuedNotificationManager<>(this.dataChangeListenerExecutor,
                         DCL_NOTIFICATION_MGR_INVOKER, maxDataChangeListenerQueueSize,
                         "DataChangeListenerQueueMgr");
-        changePublisher = new InMemoryDOMStoreTreeChangePublisher(this.dataChangeListenerExecutor, maxDataChangeListenerQueueSize);
+        changePublisher = new InMemoryDOMStoreTreeChangePublisher(this.dataChangeListenerExecutor,
+                maxDataChangeListenerQueueSize);
 
         switch (type) {
             case CONFIGURATION:
@@ -124,17 +131,20 @@ public class InMemoryDOMDataStore extends TransactionReadyPrototype<String> impl
 
     @Override
     public DOMStoreReadTransaction newReadOnlyTransaction() {
-        return SnapshotBackedTransactions.newReadTransaction(nextIdentifier(), debugTransactions, dataTree.takeSnapshot());
+        return SnapshotBackedTransactions.newReadTransaction(nextIdentifier(), debugTransactions,
+                dataTree.takeSnapshot());
     }
 
     @Override
     public DOMStoreReadWriteTransaction newReadWriteTransaction() {
-        return SnapshotBackedTransactions.newReadWriteTransaction(nextIdentifier(), debugTransactions, dataTree.takeSnapshot(), this);
+        return SnapshotBackedTransactions.newReadWriteTransaction(nextIdentifier(), debugTransactions,
+                dataTree.takeSnapshot(), this);
     }
 
     @Override
     public DOMStoreWriteTransaction newWriteOnlyTransaction() {
-        return SnapshotBackedTransactions.newWriteTransaction(nextIdentifier(), debugTransactions, dataTree.takeSnapshot(), this);
+        return SnapshotBackedTransactions.newWriteTransaction(nextIdentifier(), debugTransactions,
+                dataTree.takeSnapshot(), this);
     }
 
     @Override
@@ -148,13 +158,14 @@ public class InMemoryDOMDataStore extends TransactionReadyPrototype<String> impl
     }
 
     @Override
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public void close() {
         ExecutorServiceUtil.tryGracefulShutdown(dataChangeListenerExecutor, 30, TimeUnit.SECONDS);
 
-        if(closeable != null) {
+        if (closeable != null) {
             try {
                 closeable.close();
-            } catch(Exception e) {
+            } catch (Exception e) {
                 LOG.debug("Error closing instance", e);
             }
         }
@@ -169,8 +180,8 @@ public class InMemoryDOMDataStore extends TransactionReadyPrototype<String> impl
     }
 
     @Override
-    public <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> ListenerRegistration<L> registerChangeListener(
-            final YangInstanceIdentifier path, final L listener, final DataChangeScope scope) {
+    public <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> ListenerRegistration<L>
+            registerChangeListener(final YangInstanceIdentifier path, final L listener, final DataChangeScope scope) {
 
         /*
          * Make sure commit is not occurring right now. Listener has to be
@@ -209,7 +220,8 @@ public class InMemoryDOMDataStore extends TransactionReadyPrototype<String> impl
     }
 
     @Override
-    public synchronized <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerTreeChangeListener(final YangInstanceIdentifier treeId, final L listener) {
+    public synchronized <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerTreeChangeListener(
+            final YangInstanceIdentifier treeId, final L listener) {
         /*
          * Make sure commit is not occurring right now. Listener has to be
          * registered and its state capture enqueued at a consistent point.
index be89d53a69b2b99b442c0820781959f30832666f..20e4f4089f6393f0790c421da9ca08c682a4fbfc 100644 (file)
@@ -10,12 +10,12 @@ package org.opendaylight.controller.md.sal.dom.store.impl;
 
 /**
  * Holds configuration properties when creating an {@link InMemoryDOMDataStore} instance via the
- * {@link InMemoryDOMDataStoreFactory}
+ * {@link InMemoryDOMDataStoreFactory}.
  *
  * @author Thomas Pantelis
  * @see InMemoryDOMDataStoreFactory
  */
-public class InMemoryDOMDataStoreConfigProperties {
+public final class InMemoryDOMDataStoreConfigProperties {
 
     public static final int DEFAULT_MAX_DATA_CHANGE_EXECUTOR_QUEUE_SIZE = 1000;
     public static final int DEFAULT_MAX_DATA_CHANGE_EXECUTOR_POOL_SIZE = 20;
index dde694207c82f0d52917a99d94c95d0980ec38f9..aad39987fa9d5bb244319584ce27978d3cda7294 100644 (file)
@@ -25,6 +25,8 @@ public final class InMemoryDOMDataStoreFactory {
     }
 
     /**
+     * Deprecated.
+     *
      * @deprecated Use {@link #create(String, DOMSchemaService)} instead.
      */
     @Deprecated
@@ -81,8 +83,8 @@ public final class InMemoryDOMDataStoreFactory {
      *                   default property values are used.
      * @return an InMemoryDOMDataStore instance
      *
-     * @deprecated Use {@link #create(String, LogicalDatastoreType, SchemaService, boolean, InMemoryDOMDataStoreConfigProperties)}
-     *             instead.
+     * @deprecated Use {@link #create(String, LogicalDatastoreType, SchemaService, boolean,
+     *     InMemoryDOMDataStoreConfigProperties)} instead.
      */
     @Deprecated
     public static InMemoryDOMDataStore create(final String name,
index a77732a11ffad421b48e96adab86122dde4c2926..deab29dc9c14df2fc2454b61903a2a253e4667bb 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.controller.md.sal.dom.store.impl;
 
 import static com.google.common.base.Preconditions.checkState;
+
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
@@ -34,10 +35,9 @@ class InMemoryDOMStoreThreePhaseCommitCohort implements DOMStoreThreePhaseCommit
     private DataTreeCandidate candidate;
     private final Exception operationError;
 
-    public InMemoryDOMStoreThreePhaseCommitCohort(final InMemoryDOMDataStore store,
-                                                  final SnapshotBackedWriteTransaction<String> writeTransaction,
-                                                  final DataTreeModification modification,
-                                                  final Exception operationError) {
+    InMemoryDOMStoreThreePhaseCommitCohort(final InMemoryDOMDataStore store,
+            final SnapshotBackedWriteTransaction<String> writeTransaction, final DataTreeModification modification,
+            final Exception operationError) {
         this.transaction = Preconditions.checkNotNull(writeTransaction);
         this.modification = Preconditions.checkNotNull(modification);
         this.store = Preconditions.checkNotNull(store);
@@ -52,6 +52,7 @@ class InMemoryDOMStoreThreePhaseCommitCohort implements DOMStoreThreePhaseCommit
     }
 
     @Override
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public final ListenableFuture<Boolean> canCommit() {
         if (operationError != null) {
             return Futures.immediateFailedFuture(operationError);
@@ -75,19 +76,21 @@ class InMemoryDOMStoreThreePhaseCommitCohort implements DOMStoreThreePhaseCommit
             // precondition log, it should allow us to understand what went on.
             LOG.trace("Store Tx: {} modifications: {} tree: {}", modification, store);
 
-            return Futures.immediateFailedFuture(new TransactionCommitFailedException("Data did not pass validation.", e));
-        } catch (Exception e) {
+            return Futures.immediateFailedFuture(new TransactionCommitFailedException(
+                    "Data did not pass validation.", e));
+        } catch (RuntimeException e) {
             LOG.warn("Unexpected failure in validation phase", e);
             return Futures.immediateFailedFuture(e);
         }
     }
 
     @Override
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public final ListenableFuture<Void> preCommit() {
         try {
             candidate = store.prepare(modification);
             return SUCCESSFUL_FUTURE;
-        } catch (Exception e) {
+        } catch (RuntimeException e) {
             LOG.warn("Unexpected failure in pre-commit phase", e);
             return Futures.immediateFailedFuture(e);
         }
index e469a159585543c7d7322a1487d06c995c1c8e07..bf125cf33c2cc14329556a343f225f7f730a80f0 100644 (file)
@@ -29,18 +29,21 @@ import org.slf4j.LoggerFactory;
 
 final class InMemoryDOMStoreTreeChangePublisher extends AbstractDOMStoreTreeChangePublisher {
     private static final Invoker<AbstractDOMDataTreeChangeListenerRegistration<?>, DataTreeCandidate> MANAGER_INVOKER =
-            (listener, notification) -> {
-                // FIXME: this is inefficient, as we could grab the entire queue for the listener and post it
-                final DOMDataTreeChangeListener inst = listener.getInstance();
-                if (inst != null) {
-                    inst.onDataTreeChanged(Collections.singletonList(notification));
-                }
-            };
+        (listener, notification) -> {
+            // FIXME: this is inefficient, as we could grab the entire queue for the listener and post it
+            final DOMDataTreeChangeListener inst = listener.getInstance();
+            if (inst != null) {
+                inst.onDataTreeChanged(Collections.singletonList(notification));
+            }
+        };
+
     private static final Logger LOG = LoggerFactory.getLogger(InMemoryDOMStoreTreeChangePublisher.class);
-    private final QueuedNotificationManager<AbstractDOMDataTreeChangeListenerRegistration<?>, DataTreeCandidate> notificationManager;
+    private final QueuedNotificationManager<AbstractDOMDataTreeChangeListenerRegistration<?>, DataTreeCandidate>
+            notificationManager;
 
     InMemoryDOMStoreTreeChangePublisher(final ExecutorService listenerExecutor, final int maxQueueSize) {
-        notificationManager = new QueuedNotificationManager<>(listenerExecutor, MANAGER_INVOKER, maxQueueSize, "DataTreeChangeListenerQueueMgr");
+        notificationManager = new QueuedNotificationManager<>(listenerExecutor, MANAGER_INVOKER, maxQueueSize,
+                "DataTreeChangeListenerQueueMgr");
     }
 
     private InMemoryDOMStoreTreeChangePublisher(QueuedNotificationManager<
@@ -49,7 +52,8 @@ final class InMemoryDOMStoreTreeChangePublisher extends AbstractDOMStoreTreeChan
     }
 
     @Override
-    protected void notifyListeners(final Collection<AbstractDOMDataTreeChangeListenerRegistration<?>> registrations, final YangInstanceIdentifier path, final DataTreeCandidateNode node) {
+    protected void notifyListeners(final Collection<AbstractDOMDataTreeChangeListenerRegistration<?>> registrations,
+            final YangInstanceIdentifier path, final DataTreeCandidateNode node) {
         final DataTreeCandidate candidate = DataTreeCandidates.newDataTreeCandidate(path, node);
 
         for (AbstractDOMDataTreeChangeListenerRegistration<?> reg : registrations) {
@@ -59,13 +63,15 @@ final class InMemoryDOMStoreTreeChangePublisher extends AbstractDOMStoreTreeChan
     }
 
     @Override
-    protected synchronized void registrationRemoved(final AbstractDOMDataTreeChangeListenerRegistration<?> registration) {
+    protected synchronized void registrationRemoved(
+            final AbstractDOMDataTreeChangeListenerRegistration<?> registration) {
         LOG.debug("Closing registration {}", registration);
 
         // FIXME: remove the queue for this registration and make sure we clear it
     }
 
-    <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerTreeChangeListener(final YangInstanceIdentifier treeId, final L listener, final DataTreeSnapshot snapshot) {
+    <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerTreeChangeListener(
+            final YangInstanceIdentifier treeId, final L listener, final DataTreeSnapshot snapshot) {
         final AbstractDOMDataTreeChangeListenerRegistration<L> reg = registerTreeChangeListener(treeId, listener);
 
         final Optional<NormalizedNode<?, ?>> node = snapshot.readNode(YangInstanceIdentifier.EMPTY);
index 6b2e4d51c5ed38dc3da3391027f2dc9ceab5497e..22654d0ea953cde01087ba89ba4562b40e42756b 100644 (file)
@@ -32,8 +32,8 @@ import org.slf4j.LoggerFactory;
 /**
  * Resolve Data Change Events based on modifications and listeners
  *
- * Computes data change events for all affected registered listeners in data
- * tree.
+ * <p>
+ * Computes data change events for all affected registered listeners in data tree.
  */
 @Beta
 public final class ResolveDataChangeEventsTask {
@@ -52,8 +52,9 @@ public final class ResolveDataChangeEventsTask {
     /**
      * Resolves and submits notification tasks to the specified manager.
      */
-    public synchronized void resolve(final NotificationManager<DataChangeListenerRegistration<?>, DOMImmutableDataChangeEvent> manager) {
-        try (final RegistrationTreeSnapshot<DataChangeListenerRegistration<?>> w = listenerRoot.takeSnapshot()) {
+    public synchronized void resolve(final NotificationManager<DataChangeListenerRegistration<?>,
+            DOMImmutableDataChangeEvent> manager) {
+        try (RegistrationTreeSnapshot<DataChangeListenerRegistration<?>> w = listenerRoot.takeSnapshot()) {
             // Defensive: reset internal state
             collectedEvents = ArrayListMultimap.create();
 
@@ -65,7 +66,8 @@ public final class ResolveDataChangeEventsTask {
              * Convert to tasks, but be mindful of multiple values -- those indicate multiple
              * wildcard matches, which need to be merged.
              */
-            for (Entry<DataChangeListenerRegistration<?>, Collection<DOMImmutableDataChangeEvent>> e : collectedEvents.asMap().entrySet()) {
+            for (Entry<DataChangeListenerRegistration<?>, Collection<DOMImmutableDataChangeEvent>> e :
+                    collectedEvents.asMap().entrySet()) {
                 final Collection<DOMImmutableDataChangeEvent> col = e.getValue();
                 final DOMImmutableDataChangeEvent event;
 
@@ -87,7 +89,7 @@ public final class ResolveDataChangeEventsTask {
     }
 
     /**
-     * Resolves data change event for supplied node
+     * Resolves data change event for supplied node.
      *
      * @param path
      *            Path to current node in tree
@@ -116,31 +118,33 @@ public final class ResolveDataChangeEventsTask {
         // no before and after state is present
 
         switch (type) {
-        case SUBTREE_MODIFIED:
-            return resolveSubtreeChangeEvent(state, node);
-        case APPEARED:
-        case WRITE:
-            Preconditions.checkArgument(maybeAfter.isPresent(),
-                    "Modification at {} has type {} but no after-data", state.getPath(), type);
-            if (!maybeBefore.isPresent()) {
-                @SuppressWarnings({ "unchecked", "rawtypes" })
-                final NormalizedNode<PathArgument, ?> afterNode = (NormalizedNode)maybeAfter.get();
-                resolveSameEventRecursivelly(state, afterNode, DOMImmutableDataChangeEvent.getCreateEventFactory());
-                return true;
-            }
+            case SUBTREE_MODIFIED:
+                return resolveSubtreeChangeEvent(state, node);
+            case APPEARED:
+            case WRITE:
+                Preconditions.checkArgument(maybeAfter.isPresent(),
+                        "Modification at {} has type {} but no after-data", state.getPath(), type);
+                if (!maybeBefore.isPresent()) {
+                    @SuppressWarnings({ "unchecked", "rawtypes" })
+                    final NormalizedNode<PathArgument, ?> afterNode = (NormalizedNode)maybeAfter.get();
+                    resolveSameEventRecursivelly(state, afterNode, DOMImmutableDataChangeEvent.getCreateEventFactory());
+                    return true;
+                }
 
-            return resolveReplacedEvent(state, maybeBefore.get(), maybeAfter.get());
-        case DISAPPEARED:
-        case DELETE:
-            Preconditions.checkArgument(maybeBefore.isPresent(),
-                    "Modification at {} has type {} but no before-data", state.getPath(), type);
+                return resolveReplacedEvent(state, maybeBefore.get(), maybeAfter.get());
+            case DISAPPEARED:
+            case DELETE:
+                Preconditions.checkArgument(maybeBefore.isPresent(),
+                        "Modification at {} has type {} but no before-data", state.getPath(), type);
 
-            @SuppressWarnings({ "unchecked", "rawtypes" })
-            final NormalizedNode<PathArgument, ?> beforeNode = (NormalizedNode)maybeBefore.get();
-            resolveSameEventRecursivelly(state, beforeNode, DOMImmutableDataChangeEvent.getRemoveEventFactory());
-            return true;
-        case UNMODIFIED:
-            return false;
+                @SuppressWarnings({ "unchecked", "rawtypes" })
+                final NormalizedNode<PathArgument, ?> beforeNode = (NormalizedNode)maybeBefore.get();
+                resolveSameEventRecursivelly(state, beforeNode, DOMImmutableDataChangeEvent.getRemoveEventFactory());
+                return true;
+            case UNMODIFIED:
+                return false;
+            default:
+                break;
         }
 
         throw new IllegalStateException(String.format("Unhandled node state %s at %s", type, state.getPath()));
@@ -156,11 +160,14 @@ public final class ResolveDataChangeEventsTask {
              * resolution of changes on children level and can not
              * shortcut resolution.
              */
-            LOG.trace("Resolving subtree replace event for {} before {}, after {}", state.getPath(), beforeData, afterData);
+            LOG.trace("Resolving subtree replace event for {} before {}, after {}", state.getPath(), beforeData,
+                    afterData);
             @SuppressWarnings("unchecked")
-            NormalizedNodeContainer<?, PathArgument, NormalizedNode<PathArgument, ?>> beforeCont = (NormalizedNodeContainer<?, PathArgument, NormalizedNode<PathArgument, ?>>) beforeData;
+            NormalizedNodeContainer<?, PathArgument, NormalizedNode<PathArgument, ?>> beforeCont =
+                (NormalizedNodeContainer<?, PathArgument, NormalizedNode<PathArgument, ?>>) beforeData;
             @SuppressWarnings("unchecked")
-            NormalizedNodeContainer<?, PathArgument, NormalizedNode<PathArgument, ?>> afterCont = (NormalizedNodeContainer<?, PathArgument, NormalizedNode<PathArgument, ?>>) afterData;
+            NormalizedNodeContainer<?, PathArgument, NormalizedNode<PathArgument, ?>> afterCont =
+                (NormalizedNodeContainer<?, PathArgument, NormalizedNode<PathArgument, ?>>) afterData;
             return resolveNodeContainerReplaced(state, beforeCont, afterCont);
         }
 
@@ -172,7 +179,8 @@ public final class ResolveDataChangeEventsTask {
         }
 
         LOG.trace("Resolving leaf replace event for {} , before {}, after {}", state.getPath(), beforeData, afterData);
-        DOMImmutableDataChangeEvent event = DOMImmutableDataChangeEvent.builder(DataChangeScope.BASE).addUpdated(state.getPath(), beforeData, afterData).build();
+        DOMImmutableDataChangeEvent event = DOMImmutableDataChangeEvent.builder(DataChangeScope.BASE)
+                .addUpdated(state.getPath(), beforeData, afterData).build();
         state.addEvent(event);
         state.collectEvents(beforeData, afterData, collectedEvents);
         return true;
@@ -205,7 +213,8 @@ public final class ResolveDataChangeEventsTask {
              * created.
              */
             if (!beforeCont.getChild(childId).isPresent()) {
-                resolveSameEventRecursivelly(state.child(childId), afterChild, DOMImmutableDataChangeEvent.getCreateEventFactory());
+                resolveSameEventRecursivelly(state.child(childId), afterChild,
+                        DOMImmutableDataChangeEvent.getCreateEventFactory());
                 childChanged = true;
             }
         }
@@ -247,7 +256,8 @@ public final class ResolveDataChangeEventsTask {
             // Node has children, so we will try to resolve it's children
             // changes.
             @SuppressWarnings("unchecked")
-            NormalizedNodeContainer<?, PathArgument, NormalizedNode<PathArgument, ?>> container = (NormalizedNodeContainer<?, PathArgument, NormalizedNode<PathArgument, ?>>) node;
+            NormalizedNodeContainer<?, PathArgument, NormalizedNode<PathArgument, ?>> container =
+                (NormalizedNodeContainer<?, PathArgument, NormalizedNode<PathArgument, ?>>) node;
             for (NormalizedNode<PathArgument, ?> child : container.getValue()) {
                 final PathArgument childId = child.getIdentifier();
 
@@ -262,12 +272,15 @@ public final class ResolveDataChangeEventsTask {
         state.collectEvents(event.getOriginalSubtree(), event.getUpdatedSubtree(), collectedEvents);
     }
 
-    private boolean resolveSubtreeChangeEvent(final ResolveDataChangeState state, final DataTreeCandidateNode modification) {
+    private boolean resolveSubtreeChangeEvent(final ResolveDataChangeState state,
+            final DataTreeCandidateNode modification) {
         final Optional<NormalizedNode<?, ?>> maybeBefore = modification.getDataBefore();
         final Optional<NormalizedNode<?, ?>> maybeAfter = modification.getDataAfter();
 
-        Preconditions.checkArgument(maybeBefore.isPresent(), "Subtree change with before-data not present at path %s", state.getPath());
-        Preconditions.checkArgument(maybeAfter.isPresent(), "Subtree change with after-data not present at path %s", state.getPath());
+        Preconditions.checkArgument(maybeBefore.isPresent(), "Subtree change with before-data not present at path %s",
+                state.getPath());
+        Preconditions.checkArgument(maybeAfter.isPresent(), "Subtree change with after-data not present at path %s",
+                state.getPath());
 
         if (!state.needsProcessing()) {
             LOG.trace("Not processing modified subtree {}", state.getPath());
@@ -279,22 +292,24 @@ public final class ResolveDataChangeEventsTask {
             final ResolveDataChangeState childState = state.child(childMod.getIdentifier());
 
             switch (childMod.getModificationType()) {
-            case APPEARED:
-            case DELETE:
-            case DISAPPEARED:
-            case WRITE:
-                if (resolveAnyChangeEvent(childState, childMod)) {
-                    scope = DataChangeScope.ONE;
-                }
-                break;
-            case SUBTREE_MODIFIED:
-                if (resolveSubtreeChangeEvent(childState, childMod) && scope == null) {
-                    scope = DataChangeScope.SUBTREE;
-                }
-                break;
-            case UNMODIFIED:
-                // no-op
-                break;
+                case APPEARED:
+                case DELETE:
+                case DISAPPEARED:
+                case WRITE:
+                    if (resolveAnyChangeEvent(childState, childMod)) {
+                        scope = DataChangeScope.ONE;
+                    }
+                    break;
+                case SUBTREE_MODIFIED:
+                    if (resolveSubtreeChangeEvent(childState, childMod) && scope == null) {
+                        scope = DataChangeScope.SUBTREE;
+                    }
+                    break;
+                case UNMODIFIED:
+                    // no-op
+                    break;
+                default:
+                    break;
             }
         }
 
@@ -302,7 +317,8 @@ public final class ResolveDataChangeEventsTask {
         final NormalizedNode<?, ?> after = maybeAfter.get();
 
         if (scope != null) {
-            DOMImmutableDataChangeEvent one = DOMImmutableDataChangeEvent.builder(scope).addUpdated(state.getPath(), before, after).build();
+            DOMImmutableDataChangeEvent one = DOMImmutableDataChangeEvent.builder(scope)
+                    .addUpdated(state.getPath(), before, after).build();
             state.addEvent(one);
         }
 
@@ -310,7 +326,8 @@ public final class ResolveDataChangeEventsTask {
         return scope != null;
     }
 
-    public static ResolveDataChangeEventsTask create(final DataTreeCandidate candidate, final ListenerTree listenerTree) {
+    public static ResolveDataChangeEventsTask create(final DataTreeCandidate candidate,
+            final ListenerTree listenerTree) {
         return new ResolveDataChangeEventsTask(candidate, listenerTree);
     }
 }
index 1547ad122aa8a44e699e9c82ac7e5917b508a6eb..a644dca91d901cebda997c0f183eb57596887fdb 100644 (file)
@@ -37,12 +37,14 @@ import org.slf4j.LoggerFactory;
  */
 final class ResolveDataChangeState {
     private static final Logger LOG = LoggerFactory.getLogger(ResolveDataChangeState.class);
+
     /**
-     * Inherited from all parents
+     * Inherited from all parents.
      */
     private final Iterable<Builder> inheritedSub;
+
     /**
-     * Inherited from immediate parent
+     * Inherited from immediate parent.
      */
     private final Collection<Builder> inheritedOne;
     private final YangInstanceIdentifier nodeId;
@@ -70,15 +72,17 @@ final class ResolveDataChangeState {
             for (DataChangeListenerRegistration<?> l : n.getRegistrations()) {
                 final Builder b = DOMImmutableDataChangeEvent.builder(DataChangeScope.BASE);
                 switch (l.getScope()) {
-                case BASE:
-                    base.put(l, b);
-                    break;
-                case ONE:
-                    one.put(l, b);
-                    break;
-                case SUBTREE:
-                    sub.put(l, b);
-                    break;
+                    case BASE:
+                        base.put(l, b);
+                        break;
+                    case ONE:
+                        one.put(l, b);
+                        break;
+                    case SUBTREE:
+                        sub.put(l, b);
+                        break;
+                    default:
+                        break;
                 }
             }
         }
@@ -100,9 +104,9 @@ final class ResolveDataChangeState {
      *
      * @param rootId root instance identifier
      * @param registrationTreeNode root node
-     * @return
      */
-    public static ResolveDataChangeState initial(final YangInstanceIdentifier rootId, final RegistrationTreeNode<DataChangeListenerRegistration<?>> registrationTreeNode) {
+    public static ResolveDataChangeState initial(final YangInstanceIdentifier rootId,
+            final RegistrationTreeNode<DataChangeListenerRegistration<?>> registrationTreeNode) {
         return new ResolveDataChangeState(rootId, Collections.<Builder>emptyList(),
             Collections.<Builder>emptyList(), Collections.singletonList(registrationTreeNode));
     }
@@ -150,7 +154,7 @@ final class ResolveDataChangeState {
     }
 
     /**
-     * Get the current path
+     * Get the current path.
      *
      * @return Current path.
      */
@@ -195,8 +199,6 @@ final class ResolveDataChangeState {
 
     /**
      * Add an event to all current listeners.
-     *
-     * @param event
      */
     public void addEvent(final DOMImmutableDataChangeEvent event) {
         // Subtree builders get always notified
@@ -254,7 +256,8 @@ final class ResolveDataChangeState {
         LOG.trace("Collected events {}", map);
     }
 
-    private static Collection<RegistrationTreeNode<DataChangeListenerRegistration<?>>> getListenerChildrenWildcarded(final Collection<RegistrationTreeNode<DataChangeListenerRegistration<?>>> parentNodes,
+    private static Collection<RegistrationTreeNode<DataChangeListenerRegistration<?>>> getListenerChildrenWildcarded(
+            final Collection<RegistrationTreeNode<DataChangeListenerRegistration<?>>> parentNodes,
             final PathArgument child) {
         if (parentNodes.isEmpty()) {
             return Collections.emptyList();
@@ -269,7 +272,9 @@ final class ResolveDataChangeState {
         return result;
     }
 
-    private static void addChildNodes(final List<RegistrationTreeNode<DataChangeListenerRegistration<?>>> result, final Collection<RegistrationTreeNode<DataChangeListenerRegistration<?>>> parentNodes, final PathArgument childIdentifier) {
+    private static void addChildNodes(final List<RegistrationTreeNode<DataChangeListenerRegistration<?>>> result,
+            final Collection<RegistrationTreeNode<DataChangeListenerRegistration<?>>> parentNodes,
+            final PathArgument childIdentifier) {
         for (RegistrationTreeNode<DataChangeListenerRegistration<?>> node : parentNodes) {
             RegistrationTreeNode<DataChangeListenerRegistration<?>> child = node.getExactChild(childIdentifier);
             if (child != null) {
index cb91b4c81ac2c7bf1222678eb6f3f063bd02fd42..f4af794b4639685f64ca24d6244669c73744e57b 100644 (file)
@@ -24,14 +24,14 @@ public class InMemoryDataStoreStats implements AutoCloseable {
     private final AbstractMXBean notificationExecutorStatsBean;
     private final QueuedNotificationManagerMXBeanImpl notificationManagerStatsBean;
 
-    public InMemoryDataStoreStats(final String mBeanType, final QueuedNotificationManager<?, ?> manager) {
+    public InMemoryDataStoreStats(final String beanType, final QueuedNotificationManager<?, ?> manager) {
 
         notificationManagerStatsBean = new QueuedNotificationManagerMXBeanImpl(manager,
-                "notification-manager", mBeanType, null);
+                "notification-manager", beanType, null);
         notificationManagerStatsBean.registerMBean();
 
         notificationExecutorStatsBean = ThreadExecutorStatsMXBeanImpl.create(manager.getExecutor(),
-                "notification-executor", mBeanType, null);
+                "notification-executor", beanType, null);
         if (notificationExecutorStatsBean != null) {
             notificationExecutorStatsBean.registerMBean();
         }
@@ -43,11 +43,11 @@ public class InMemoryDataStoreStats implements AutoCloseable {
 
     @Override
     public void close() throws Exception {
-        if(notificationExecutorStatsBean != null) {
+        if (notificationExecutorStatsBean != null) {
             notificationExecutorStatsBean.unregisterMBean();
         }
 
-        if(notificationManagerStatsBean != null) {
+        if (notificationManagerStatsBean != null) {
             notificationManagerStatsBean.unregisterMBean();
         }
     }
index 5c06b00a410c9ff6e6f3e9952f3ea5e33ef1a5b0..55b4ad2de42d07fc2c429461adf6ab8ffb444d0d 100644 (file)
@@ -13,8 +13,9 @@ import org.opendaylight.yangtools.concepts.AbstractListenerRegistration;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
-abstract class DataChangeListenerRegistrationImpl<T extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> extends AbstractListenerRegistration<T> implements DataChangeListenerRegistration<T> {
-    public DataChangeListenerRegistrationImpl(final T listener) {
+abstract class DataChangeListenerRegistrationImpl<T extends AsyncDataChangeListener<YangInstanceIdentifier,
+        NormalizedNode<?, ?>>> extends AbstractListenerRegistration<T> implements DataChangeListenerRegistration<T> {
+    DataChangeListenerRegistrationImpl(final T listener) {
         super(listener);
     }
-}
\ No newline at end of file
+}
index da3e3b40bf9267fdd2d3fc37d89f97cac3eb8c60..a67040e9290c044b84f94b76ebfd456737cb92a9 100644 (file)
@@ -43,8 +43,9 @@ public final class ListenerTree extends AbstractRegistrationTree<DataChangeListe
      * @param scope Scope of triggering event.
      * @return Listener registration
      */
-    public <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> DataChangeListenerRegistration<L> registerDataChangeListener(final YangInstanceIdentifier path,
-            final L listener, final DataChangeScope scope) {
+    public <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>>
+            DataChangeListenerRegistration<L> registerDataChangeListener(final YangInstanceIdentifier path,
+                final L listener, final DataChangeScope scope) {
 
         // Take the write lock
         takeLock();
index a500f257d6320c7cdf9eae05db202acac3192ab8..1146458171bd1dfff7bbbce51c5a8335b15aec44 100644 (file)
@@ -67,7 +67,7 @@ public abstract class AbstractDataChangeListenerTest {
 
     @After
     public void tearDown() {
-        if( this.dclExecutorService != null ) {
+        if (this.dclExecutorService != null) {
             this.dclExecutorService.shutdownNow();
         }
     }
@@ -120,15 +120,15 @@ public abstract class AbstractDataChangeListenerTest {
 
     }
 
-    protected static <K> void assertNotContains(final Collection<K> set, final K... values) {
+    protected static <K> void assertContains(final Map<K,?> map, final K... values) {
         for (final K key : values) {
-            Assert.assertFalse(set.contains(key));
+            Assert.assertTrue(map.containsKey(key));
         }
     }
 
-    protected static <K> void assertContains(final Map<K,?> map, final K... values) {
+    protected static <K> void assertNotContains(final Collection<K> set, final K... values) {
         for (final K key : values) {
-            Assert.assertTrue(map.containsKey(key));
+            Assert.assertFalse(set.contains(key));
         }
     }
 
index 63e1498c0efe20d697584bb40114528aab507e09..ed17aa55cfb852fa5724272f87f8d298f1f694cb 100644 (file)
@@ -10,10 +10,11 @@ package org.opendaylight.controller.md.sal.dom.store.impl;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import com.google.common.base.Preconditions;
+import com.google.common.util.concurrent.SettableFuture;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
-
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
@@ -25,9 +26,6 @@ import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
-import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.SettableFuture;
-
 public class DatastoreTestTask {
 
     private final DOMStore store;
@@ -50,8 +48,8 @@ public class DatastoreTestTask {
     }
 
     public DatastoreTestTask changeListener(final YangInstanceIdentifier path, final DataChangeScope scope,
-            final AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> changeListener) {
-        this.changeListener = changeListener;
+            final AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> listener) {
+        this.changeListener = listener;
         this.changePath = path;
         this.changeScope = scope;
         return this;
@@ -63,27 +61,27 @@ public class DatastoreTestTask {
         return this;
     }
 
-    public DatastoreTestTask setup(final WriteTransactionCustomizer setup) {
-        this.setup = setup;
+    public DatastoreTestTask setup(final WriteTransactionCustomizer customizer) {
+        this.setup = customizer;
         return this;
     }
 
-    public DatastoreTestTask test(final WriteTransactionCustomizer write) {
-        this.write = write;
+    public DatastoreTestTask test(final WriteTransactionCustomizer customizer) {
+        this.write = customizer;
         return this;
     }
 
-    public DatastoreTestTask read(final ReadTransactionVerifier read) {
-        this.read = read;
+    public DatastoreTestTask read(final ReadTransactionVerifier customizer) {
+        this.read = customizer;
         return this;
     }
 
-    public DatastoreTestTask cleanup(final WriteTransactionCustomizer cleanup) {
-        this.cleanup = cleanup;
+    public DatastoreTestTask cleanup(final WriteTransactionCustomizer customizer) {
+        this.cleanup = customizer;
         return this;
     }
 
-    public void run() throws InterruptedException, ExecutionException, TimeoutException {
+    public void run() throws Exception {
         if (setup != null) {
             execute(setup);
         }
@@ -113,25 +111,16 @@ public class DatastoreTestTask {
         }
     }
 
-    public AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> getChangeEvent() {
-        try {
-            return internalListener.receivedChange.get(10, TimeUnit.SECONDS);
-        } catch( Exception e ) {
-            fail( "Error getting the AsyncDataChangeEvent from the Future: " + e );
-        }
-
-        // won't get here
-        return null;
+    public AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> getChangeEvent() throws Exception {
+        return internalListener.receivedChange.get(10, TimeUnit.SECONDS);
     }
 
-    public void verifyNoChangeEvent() {
+    public void verifyNoChangeEvent() throws Exception {
         try {
             Object unexpected = internalListener.receivedChange.get(500, TimeUnit.MILLISECONDS);
-            fail( "Got unexpected AsyncDataChangeEvent from the Future: " + unexpected );
-        } catch( TimeoutException e ) {
+            fail("Got unexpected AsyncDataChangeEvent from the Future: " + unexpected);
+        } catch (TimeoutException e) {
             // Expected
-        } catch( Exception e ) {
-            fail( "Error getting the AsyncDataChangeEvent from the Future: " + e );
         }
     }
 
@@ -156,8 +145,8 @@ public class DatastoreTestTask {
     private final class ChangeEventListener implements
             AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> {
 
-        protected final SettableFuture<AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>>> receivedChange = SettableFuture
-                .create();
+        protected final SettableFuture<AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>>>
+                receivedChange = SettableFuture.create();
 
         @Override
         public void onDataChanged(final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change) {
index c82fff3662cf40e2e2efe4f5a3bd08e7b8eb5e7b..74014493fa217cdad17643e964c0e364eb0d72c7 100644 (file)
@@ -7,8 +7,6 @@
  */
 package org.opendaylight.controller.md.sal.dom.store.impl;
 
-import java.util.concurrent.ExecutionException;
-
 import org.junit.Test;
 
 /**
@@ -23,7 +21,7 @@ public abstract class DefaultDataChangeListenerTestSuite extends AbstractDataCha
      *
      * @param task Update task configuration as needed
      */
-    abstract protected void customizeTask(DatastoreTestTask task);
+    protected abstract void customizeTask(DatastoreTestTask task);
 
     @Test
     public final void putTopLevelOneNested() throws Exception {
@@ -34,45 +32,44 @@ public abstract class DefaultDataChangeListenerTestSuite extends AbstractDataCha
         putTopLevelOneNested(task);
     }
 
+    protected abstract void putTopLevelOneNested(DatastoreTestTask task) throws Exception;
+
     @Test
     public final void existingTopWriteSibling() throws Exception {
         DatastoreTestTask task = newTestTask().setup(writeOneTopMultipleNested(FOO)).test(
-                tx -> tx.write(path(FOO_SIBLING), topLevelList(FOO_SIBLING).build()));
+            tx -> tx.write(path(FOO_SIBLING), topLevelList(FOO_SIBLING).build()));
         customizeTask(task);
         task.run();
         existingTopWriteSibling(task);
     }
 
-    protected abstract void existingTopWriteSibling(DatastoreTestTask task) throws InterruptedException, ExecutionException;
-
+    protected abstract void existingTopWriteSibling(DatastoreTestTask task) throws Exception;
 
     @Test
     public final void existingTopWriteTwoNested() throws Exception {
         DatastoreTestTask task = newTestTask().setup(writeOneTopMultipleNested(FOO)).test(
-                tx -> {
-                    tx.write(path(FOO,BAR), nestedList(BAR).build());
-                    tx.write(path(FOO,BAZ), nestedList(BAZ).build());
-                });
+            tx -> {
+                tx.write(path(FOO,BAR), nestedList(BAR).build());
+                tx.write(path(FOO,BAZ), nestedList(BAZ).build());
+            });
         customizeTask(task);
         task.run();
         existingTopWriteTwoNested(task);
     }
 
-    protected abstract void existingTopWriteTwoNested(DatastoreTestTask task) throws InterruptedException, ExecutionException;
+    protected abstract void existingTopWriteTwoNested(DatastoreTestTask task) throws Exception;
 
 
     @Test
     public final void existingOneNestedWriteAdditionalNested() throws Exception {
         DatastoreTestTask task = newTestTask().setup(writeOneTopMultipleNested(FOO, BAR)).test(
-                tx -> tx.write(path(FOO,BAZ), nestedList(BAZ).build()));
+            tx -> tx.write(path(FOO,BAZ), nestedList(BAZ).build()));
         customizeTask(task);
         task.run();
         existingOneNestedWriteAdditionalNested(task);
     }
 
-    protected abstract void existingOneNestedWriteAdditionalNested(DatastoreTestTask task) throws InterruptedException, ExecutionException;
-
-    protected abstract void putTopLevelOneNested(DatastoreTestTask task) throws Exception;
+    protected abstract void existingOneNestedWriteAdditionalNested(DatastoreTestTask task) throws Exception;
 
     @Test
     public final void replaceTopLevelNestedChanged() throws Exception {
@@ -83,8 +80,7 @@ public abstract class DefaultDataChangeListenerTestSuite extends AbstractDataCha
         replaceTopLevelNestedChanged(task);
     }
 
-    protected abstract void replaceTopLevelNestedChanged(DatastoreTestTask task) throws InterruptedException,
-            ExecutionException;
+    protected abstract void replaceTopLevelNestedChanged(DatastoreTestTask task) throws Exception;
 
     @Test
     public final void putTopLevelWithTwoNested() throws Exception {
@@ -95,8 +91,7 @@ public abstract class DefaultDataChangeListenerTestSuite extends AbstractDataCha
         putTopLevelWithTwoNested(task);
     }
 
-    protected abstract void putTopLevelWithTwoNested(DatastoreTestTask task) throws InterruptedException,
-            ExecutionException;
+    protected abstract void putTopLevelWithTwoNested(DatastoreTestTask task) throws Exception;
 
     @Test
     public final void twoNestedExistsOneIsDeleted() throws Exception {
@@ -108,8 +103,7 @@ public abstract class DefaultDataChangeListenerTestSuite extends AbstractDataCha
         twoNestedExistsOneIsDeleted(task);
     }
 
-    protected abstract void twoNestedExistsOneIsDeleted(DatastoreTestTask task) throws InterruptedException,
-            ExecutionException;
+    protected abstract void twoNestedExistsOneIsDeleted(DatastoreTestTask task) throws Exception;
 
     @Test
     public final void nestedListExistsRootDeleted() throws Exception {
@@ -121,6 +115,5 @@ public abstract class DefaultDataChangeListenerTestSuite extends AbstractDataCha
         nestedListExistsRootDeleted(task);
     }
 
-    protected abstract void nestedListExistsRootDeleted(DatastoreTestTask task) throws InterruptedException,
-            ExecutionException;
+    protected abstract void nestedListExistsRootDeleted(DatastoreTestTask task) throws Exception;
 }
index 5734f9ac5b27c635fdf01a9fab66d084863c0ab4..72e06d63a81b32dde1bf5592d9076449d6faf9b3 100644 (file)
@@ -11,6 +11,7 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
+
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.ListenableFuture;
@@ -21,7 +22,6 @@ import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.mockito.Mockito;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
@@ -33,12 +33,10 @@ import org.opendaylight.controller.sal.core.spi.data.SnapshotBackedWriteTransact
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.NormalizedNodeContainerBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
@@ -65,20 +63,20 @@ public class InMemoryDataStoreTest {
         DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
         assertNotNull(writeTx);
 
-        /**
+        /*
          * Writes /test in writeTx
          */
         NormalizedNode<?, ?> testNode = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
         writeTx.write(TestModel.TEST_PATH, testNode);
 
-        /**
+        /*
          * Reads /test from writeTx Read should return container.
          */
         ListenableFuture<Optional<NormalizedNode<?, ?>>> writeTxContainer = writeTx.read(TestModel.TEST_PATH);
         assertEquals("read: isPresent", true, writeTxContainer.get().isPresent());
         assertEquals("read: data", testNode, writeTxContainer.get().get());
 
-        /**
+        /*
          * Reads /test from readTx Read should return Absent.
          */
         ListenableFuture<Optional<NormalizedNode<?, ?>>> readTxContainer = readTx.read(TestModel.TEST_PATH);
@@ -91,13 +89,13 @@ public class InMemoryDataStoreTest {
         DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
         assertNotNull(writeTx);
 
-        /**
+        /*
          * Writes /test in writeTx
          */
         NormalizedNode<?, ?> testNode = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
         writeTx.write(TestModel.TEST_PATH, testNode);
 
-        /**
+        /*
          * Reads /test from writeTx Read should return container.
          */
         ListenableFuture<Optional<NormalizedNode<?, ?>>> writeTxContainer = writeTx.read(TestModel.TEST_PATH);
@@ -118,72 +116,70 @@ public class InMemoryDataStoreTest {
     public void testDelete() throws Exception {
 
         DOMStoreWriteTransaction writeTx = domStore.newWriteOnlyTransaction();
-        assertNotNull( writeTx );
+        assertNotNull(writeTx);
 
         // Write /test and commit
 
-        writeTx.write( TestModel.TEST_PATH, ImmutableNodes.containerNode( TestModel.TEST_QNAME ) );
+        writeTx.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
 
-        assertThreePhaseCommit( writeTx.ready() );
+        assertThreePhaseCommit(writeTx.ready());
 
-        Optional<NormalizedNode<?, ?>> afterCommitRead = domStore.newReadOnlyTransaction().
-                read(TestModel.TEST_PATH ).get();
-        assertEquals( "After commit read: isPresent", true, afterCommitRead.isPresent() );
+        Optional<NormalizedNode<?, ?>> afterCommitRead = domStore.newReadOnlyTransaction().read(TestModel.TEST_PATH)
+                .get();
+        assertEquals("After commit read: isPresent", true, afterCommitRead.isPresent());
 
         // Delete /test and verify
 
         writeTx = domStore.newWriteOnlyTransaction();
 
-        writeTx.delete( TestModel.TEST_PATH );
+        writeTx.delete(TestModel.TEST_PATH);
 
-        assertThreePhaseCommit( writeTx.ready() );
+        assertThreePhaseCommit(writeTx.ready());
 
-        afterCommitRead = domStore.newReadOnlyTransaction().
-                read(TestModel.TEST_PATH ).get();
-        assertEquals( "After commit read: isPresent", false, afterCommitRead.isPresent() );
+        afterCommitRead = domStore.newReadOnlyTransaction().read(TestModel.TEST_PATH).get();
+        assertEquals("After commit read: isPresent", false, afterCommitRead.isPresent());
     }
 
     @Test
     public void testMerge() throws Exception {
 
         DOMStoreWriteTransaction writeTx = domStore.newWriteOnlyTransaction();
-        assertNotNull( writeTx );
+        assertNotNull(writeTx);
 
         ContainerNode containerNode = ImmutableContainerNodeBuilder.create()
-                .withNodeIdentifier( new NodeIdentifier( TestModel.TEST_QNAME ) )
-                .addChild( ImmutableNodes.mapNodeBuilder( TestModel.OUTER_LIST_QNAME )
-                        .addChild( ImmutableNodes.mapEntry( TestModel.OUTER_LIST_QNAME,
-                                                            TestModel.ID_QNAME, 1 ) ).build() ).build();
+                .withNodeIdentifier(new NodeIdentifier(TestModel.TEST_QNAME))
+                .addChild(ImmutableNodes.mapNodeBuilder(TestModel.OUTER_LIST_QNAME)
+                        .addChild(ImmutableNodes.mapEntry(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, 1)).build())
+                .build();
 
-        writeTx.merge( TestModel.TEST_PATH, containerNode );
+        writeTx.merge(TestModel.TEST_PATH, containerNode);
 
-        assertThreePhaseCommit( writeTx.ready() );
+        assertThreePhaseCommit(writeTx.ready());
 
-        Optional<NormalizedNode<?, ?>> afterCommitRead = domStore.newReadOnlyTransaction().
-                read(TestModel.TEST_PATH ).get();
-        assertEquals( "After commit read: isPresent", true, afterCommitRead.isPresent() );
-        assertEquals( "After commit read: data", containerNode, afterCommitRead.get() );
+        Optional<NormalizedNode<?, ?>> afterCommitRead = domStore.newReadOnlyTransaction().read(TestModel.TEST_PATH)
+                .get();
+        assertEquals("After commit read: isPresent", true, afterCommitRead.isPresent());
+        assertEquals("After commit read: data", containerNode, afterCommitRead.get());
 
         // Merge a new list entry node
 
         writeTx = domStore.newWriteOnlyTransaction();
-        assertNotNull( writeTx );
+        assertNotNull(writeTx);
 
         containerNode = ImmutableContainerNodeBuilder.create()
-                .withNodeIdentifier( new NodeIdentifier( TestModel.TEST_QNAME ) )
-                .addChild( ImmutableNodes.mapNodeBuilder( TestModel.OUTER_LIST_QNAME )
-                        .addChild( ImmutableNodes.mapEntry( TestModel.OUTER_LIST_QNAME,
-                                                            TestModel.ID_QNAME, 1 ) )
-                        .addChild( ImmutableNodes.mapEntry( TestModel.OUTER_LIST_QNAME,
-                                                            TestModel.ID_QNAME, 2 ) ).build() ).build();
+                .withNodeIdentifier(new NodeIdentifier(TestModel.TEST_QNAME))
+                .addChild(ImmutableNodes.mapNodeBuilder(TestModel.OUTER_LIST_QNAME)
+                        .addChild(ImmutableNodes.mapEntry(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, 1))
+                        .addChild(ImmutableNodes.mapEntry(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, 2)).build())
+                .build();
 
-        writeTx.merge( TestModel.TEST_PATH, containerNode );
+        writeTx.merge(TestModel.TEST_PATH, containerNode);
 
-        assertThreePhaseCommit( writeTx.ready() );
+        assertThreePhaseCommit(writeTx.ready());
 
-        afterCommitRead = domStore.newReadOnlyTransaction().read(TestModel.TEST_PATH ).get();
-        assertEquals( "After commit read: isPresent", true, afterCommitRead.isPresent() );
-        assertEquals( "After commit read: data", containerNode, afterCommitRead.get() );
+        afterCommitRead = domStore.newReadOnlyTransaction().read(TestModel.TEST_PATH).get();
+        assertEquals("After commit read: isPresent", true, afterCommitRead.isPresent());
+        assertEquals("After commit read: data", containerNode, afterCommitRead.get());
     }
 
 
@@ -191,15 +187,15 @@ public class InMemoryDataStoreTest {
     public void testExistsForExistingData() throws Exception {
 
         DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
-        assertNotNull( writeTx );
+        assertNotNull(writeTx);
 
         ContainerNode containerNode = ImmutableContainerNodeBuilder.create()
-            .withNodeIdentifier( new NodeIdentifier( TestModel.TEST_QNAME ) )
-            .addChild( ImmutableNodes.mapNodeBuilder( TestModel.OUTER_LIST_QNAME )
-                .addChild( ImmutableNodes.mapEntry( TestModel.OUTER_LIST_QNAME,
-                    TestModel.ID_QNAME, 1 ) ).build() ).build();
+                .withNodeIdentifier(new NodeIdentifier(TestModel.TEST_QNAME))
+                .addChild(ImmutableNodes.mapNodeBuilder(TestModel.OUTER_LIST_QNAME)
+                        .addChild(ImmutableNodes.mapEntry(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, 1)).build())
+                .build();
 
-        writeTx.merge( TestModel.TEST_PATH, containerNode );
+        writeTx.merge(TestModel.TEST_PATH, containerNode);
 
         CheckedFuture<Boolean, ReadFailedException> exists =
             writeTx.exists(TestModel.TEST_PATH);
@@ -213,7 +209,7 @@ public class InMemoryDataStoreTest {
         ready.commit().get();
 
         DOMStoreReadTransaction readTx = domStore.newReadOnlyTransaction();
-        assertNotNull( readTx );
+        assertNotNull(readTx);
 
         exists =
             readTx.exists(TestModel.TEST_PATH);
@@ -225,7 +221,7 @@ public class InMemoryDataStoreTest {
     public void testExistsForNonExistingData() throws Exception {
 
         DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
-        assertNotNull( writeTx );
+        assertNotNull(writeTx);
 
         CheckedFuture<Boolean, ReadFailedException> exists =
             writeTx.exists(TestModel.TEST_PATH);
@@ -233,7 +229,7 @@ public class InMemoryDataStoreTest {
         assertEquals(false, exists.checkedGet());
 
         DOMStoreReadTransaction readTx = domStore.newReadOnlyTransaction();
-        assertNotNull( readTx );
+        assertNotNull(readTx);
 
         exists =
             readTx.exists(TestModel.TEST_PATH);
@@ -241,77 +237,72 @@ public class InMemoryDataStoreTest {
         assertEquals(false, exists.checkedGet());
     }
 
-    @Test(expected=ReadFailedException.class)
+    @Test(expected = ReadFailedException.class)
     public void testExistsThrowsReadFailedException() throws Exception {
 
         DOMStoreReadTransaction readTx = domStore.newReadOnlyTransaction();
-        assertNotNull( readTx );
+        assertNotNull(readTx);
 
         readTx.close();
 
         readTx.exists(TestModel.TEST_PATH).checkedGet();
     }
 
-
-
-    @Test(expected=ReadFailedException.class)
-    public void testReadWithReadOnlyTransactionClosed() throws Throwable {
+    @Test(expected = ReadFailedException.class)
+    public void testReadWithReadOnlyTransactionClosed() throws Exception {
 
         DOMStoreReadTransaction readTx = domStore.newReadOnlyTransaction();
-        assertNotNull( readTx );
+        assertNotNull(readTx);
 
         readTx.close();
 
-        doReadAndThrowEx( readTx );
+        doReadAndThrowEx(readTx);
     }
 
-    @Test(expected=ReadFailedException.class)
-    public void testReadWithReadOnlyTransactionFailure() throws Throwable {
+    @Test(expected = ReadFailedException.class)
+    public void testReadWithReadOnlyTransactionFailure() throws Exception {
 
-        DataTreeSnapshot mockSnapshot = Mockito.mock( DataTreeSnapshot.class );
-        Mockito.doThrow( new RuntimeException( "mock ex" ) ).when( mockSnapshot )
-        .readNode( Mockito.any( YangInstanceIdentifier.class ) );
+        DataTreeSnapshot mockSnapshot = Mockito.mock(DataTreeSnapshot.class);
+        Mockito.doThrow(new RuntimeException("mock ex")).when(mockSnapshot)
+                .readNode(Mockito.any(YangInstanceIdentifier.class));
 
         DOMStoreReadTransaction readTx = SnapshotBackedTransactions.newReadTransaction("1", true, mockSnapshot);
 
-        doReadAndThrowEx( readTx );
+        doReadAndThrowEx(readTx);
     }
 
-    @Test(expected=ReadFailedException.class)
-    public void testReadWithReadWriteTransactionClosed() throws Throwable {
+    @Test(expected = ReadFailedException.class)
+    public void testReadWithReadWriteTransactionClosed() throws Exception {
 
         DOMStoreReadTransaction readTx = domStore.newReadWriteTransaction();
-        assertNotNull( readTx );
+        assertNotNull(readTx);
 
         readTx.close();
 
-        doReadAndThrowEx( readTx );
+        doReadAndThrowEx(readTx);
     }
 
-    @Test(expected=ReadFailedException.class)
-    public void testReadWithReadWriteTransactionFailure() throws Throwable {
+    @Test(expected = ReadFailedException.class)
+    public void testReadWithReadWriteTransactionFailure() throws Exception {
 
-        DataTreeSnapshot mockSnapshot = Mockito.mock( DataTreeSnapshot.class );
-        DataTreeModification mockModification = Mockito.mock( DataTreeModification.class );
-        Mockito.doThrow( new RuntimeException( "mock ex" ) ).when( mockModification )
-        .readNode( Mockito.any( YangInstanceIdentifier.class ) );
-        Mockito.doReturn( mockModification ).when( mockSnapshot ).newModification();
+        DataTreeSnapshot mockSnapshot = Mockito.mock(DataTreeSnapshot.class);
+        DataTreeModification mockModification = Mockito.mock(DataTreeModification.class);
+        Mockito.doThrow(new RuntimeException("mock ex")).when(mockModification)
+                .readNode(Mockito.any(YangInstanceIdentifier.class));
+        Mockito.doReturn(mockModification).when(mockSnapshot).newModification();
         @SuppressWarnings("unchecked")
-        TransactionReadyPrototype<String> mockReady = Mockito.mock( TransactionReadyPrototype.class );
-        DOMStoreReadTransaction readTx = SnapshotBackedTransactions.newReadWriteTransaction("1", false, mockSnapshot, mockReady);
+        TransactionReadyPrototype<String> mockReady = Mockito.mock(TransactionReadyPrototype.class);
+        DOMStoreReadTransaction readTx = SnapshotBackedTransactions.newReadWriteTransaction("1", false, mockSnapshot,
+                mockReady);
 
-        doReadAndThrowEx( readTx );
+        doReadAndThrowEx(readTx);
     }
 
-    private static void doReadAndThrowEx( final DOMStoreReadTransaction readTx ) throws Throwable {
-        try {
-            readTx.read(TestModel.TEST_PATH).get();
-        } catch( ExecutionException e ) {
-            throw e.getCause();
-        }
+    private static void doReadAndThrowEx(final DOMStoreReadTransaction readTx) throws ReadFailedException  {
+        readTx.read(TestModel.TEST_PATH).checkedGet();
     }
 
-    @Test(expected=IllegalStateException.class)
+    @Test(expected = IllegalStateException.class)
     public void testWriteWithTransactionReady() throws Exception {
 
         DOMStoreWriteTransaction writeTx = domStore.newWriteOnlyTransaction();
@@ -319,10 +310,10 @@ public class InMemoryDataStoreTest {
         writeTx.ready();
 
         // Should throw ex
-        writeTx.write( TestModel.TEST_PATH, ImmutableNodes.containerNode( TestModel.TEST_QNAME ) );
+        writeTx.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
     }
 
-    @Test(expected=IllegalStateException.class)
+    @Test(expected = IllegalStateException.class)
     public void testReadyWithTransactionAlreadyReady() throws Exception {
 
         DOMStoreWriteTransaction writeTx = domStore.newWriteOnlyTransaction();
@@ -374,77 +365,68 @@ public class InMemoryDataStoreTest {
         DOMStoreTransactionChain txChain = domStore.createTransactionChain();
         assertNotNull(txChain);
 
-        /**
+        /*
          * We alocate new read-write transaction and write /test
-         *
-         *
          */
         DOMStoreReadWriteTransaction firstTx = txChain.newReadWriteTransaction();
         assertTestContainerWrite(firstTx);
 
-        /**
+        /*
          * First transaction is marked as ready, we are able to allocate chained
          * transactions
          */
-        DOMStoreThreePhaseCommitCohort firstWriteTxCohort = firstTx.ready();
+        final DOMStoreThreePhaseCommitCohort firstWriteTxCohort = firstTx.ready();
 
-        /**
+        /*
          * We alocate chained transaction - read transaction, note first one is
          * still not commited to datastore.
          */
         DOMStoreReadTransaction secondReadTx = txChain.newReadOnlyTransaction();
 
-        /**
-         *
+        /*
          * We test if we are able to read data from tx, read should not fail
          * since we are using chained transaction.
-         *
-         *
          */
         assertTestContainerExists(secondReadTx);
 
-        /**
-         *
+        /*
          * We alocate next transaction, which is still based on first one, but
          * is read-write.
-         *
          */
         DOMStoreReadWriteTransaction thirdDeleteTx = txChain.newReadWriteTransaction();
 
-        /**
+        /*
          * We test existence of /test in third transaction container should
          * still be visible from first one (which is still uncommmited).
-         *
-         *
          */
         assertTestContainerExists(thirdDeleteTx);
 
-        /**
+        /*
          * We delete node in third transaction
          */
         thirdDeleteTx.delete(TestModel.TEST_PATH);
 
-        /**
+        /*
          * third transaction is sealed.
          */
         DOMStoreThreePhaseCommitCohort thirdDeleteTxCohort = thirdDeleteTx.ready();
 
-        /**
+        /*
          * We commit first transaction
-         *
          */
         assertThreePhaseCommit(firstWriteTxCohort);
 
         // Alocates store transacion
         DOMStoreReadTransaction storeReadTx = domStore.newReadOnlyTransaction();
-        /**
+
+        /*
          * We verify transaction is commited to store, container should exists
          * in datastore.
          */
         assertTestContainerExists(storeReadTx);
-        /**
+
+        /*
          * We commit third transaction
-         *
          */
         assertThreePhaseCommit(thirdDeleteTxCohort);
     }
@@ -457,12 +439,12 @@ public class InMemoryDataStoreTest {
         assertTestContainerWrite(txOne);
         assertTestContainerWrite(txTwo);
 
-        /**
+        /*
          * Commits transaction
          */
         assertThreePhaseCommit(txOne.ready());
 
-        /**
+        /*
          * Asserts that txTwo could not be commited
          */
         assertFalse(txTwo.ready().canCommit().get());
@@ -477,10 +459,8 @@ public class InMemoryDataStoreTest {
 
     private static Optional<NormalizedNode<?, ?>> assertTestContainerWrite(final DOMStoreReadWriteTransaction writeTx)
             throws InterruptedException, ExecutionException {
-        /**
-         *
+        /*
          * Writes /test in writeTx
-         *
          */
         writeTx.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
 
@@ -497,5 +477,4 @@ public class InMemoryDataStoreTest {
         assertTrue(writeTxContainer.get().isPresent());
         return writeTxContainer.get();
     }
-
 }
index 43b339e506d48670b10b896183d11db8d3c83a2f..7d496568c6fe74dc115c2327a76d3f4f275d6d57 100644 (file)
@@ -7,8 +7,6 @@
  */
 package org.opendaylight.controller.md.sal.dom.store.impl;
 
-import java.util.concurrent.ExecutionException;
-
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -22,7 +20,7 @@ public class RootScopeSubtreeTest extends DefaultDataChangeListenerTestSuite {
     }
 
     @Override
-    public void putTopLevelOneNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+    public void putTopLevelOneNested(final DatastoreTestTask task) throws Exception {
         AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
 
         assertContains(change.getCreatedData(), TOP_LEVEL, path(FOO), path(FOO, BAR));
@@ -31,8 +29,7 @@ public class RootScopeSubtreeTest extends DefaultDataChangeListenerTestSuite {
     }
 
     @Override
-    public void replaceTopLevelNestedChanged(final DatastoreTestTask task) throws InterruptedException,
-            ExecutionException {
+    public void replaceTopLevelNestedChanged(final DatastoreTestTask task) throws Exception {
 
         AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
 
@@ -42,8 +39,7 @@ public class RootScopeSubtreeTest extends DefaultDataChangeListenerTestSuite {
     }
 
     @Override
-    protected void putTopLevelWithTwoNested(final DatastoreTestTask task) throws InterruptedException,
-            ExecutionException {
+    protected void putTopLevelWithTwoNested(final DatastoreTestTask task) throws Exception {
 
         AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
 
@@ -53,8 +49,7 @@ public class RootScopeSubtreeTest extends DefaultDataChangeListenerTestSuite {
     }
 
     @Override
-    protected void twoNestedExistsOneIsDeleted(final DatastoreTestTask task) throws InterruptedException,
-            ExecutionException {
+    protected void twoNestedExistsOneIsDeleted(final DatastoreTestTask task) throws Exception {
 
         AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
 
@@ -64,8 +59,7 @@ public class RootScopeSubtreeTest extends DefaultDataChangeListenerTestSuite {
     }
 
     @Override
-    protected void nestedListExistsRootDeleted(final DatastoreTestTask task) throws InterruptedException,
-            ExecutionException {
+    protected void nestedListExistsRootDeleted(final DatastoreTestTask task) throws Exception {
 
         AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
 
@@ -75,7 +69,7 @@ public class RootScopeSubtreeTest extends DefaultDataChangeListenerTestSuite {
     }
 
     @Override
-    protected void existingOneNestedWriteAdditionalNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+    protected void existingOneNestedWriteAdditionalNested(final DatastoreTestTask task) throws Exception {
         AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
 
         assertContains(change.getCreatedData(), path(FOO,BAZ));
@@ -85,7 +79,7 @@ public class RootScopeSubtreeTest extends DefaultDataChangeListenerTestSuite {
     }
 
     @Override
-    protected void existingTopWriteTwoNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+    protected void existingTopWriteTwoNested(final DatastoreTestTask task) throws Exception {
         AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
 
         assertContains(change.getCreatedData(), path(FOO,BAR),path(FOO,BAZ));
@@ -95,7 +89,7 @@ public class RootScopeSubtreeTest extends DefaultDataChangeListenerTestSuite {
     }
 
     @Override
-    protected void existingTopWriteSibling(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+    protected void existingTopWriteSibling(final DatastoreTestTask task) throws Exception {
         AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
 
         assertContains(change.getCreatedData(), path(FOO_SIBLING));
index 9910039e2e187f012b235ea43fb3afb4e64d932a..0b5598098595d16056a7d88ee766faf3ca6be996 100644 (file)
@@ -8,9 +8,8 @@
 package org.opendaylight.controller.md.sal.dom.store.impl;
 
 import static org.junit.Assert.assertNotNull;
-import com.google.common.base.Throwables;
+
 import com.google.common.util.concurrent.MoreExecutors;
-import java.util.concurrent.ExecutionException;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
@@ -30,25 +29,20 @@ public class SchemaUpdateForTransactionTest {
     private InMemoryDOMDataStore domStore;
 
     @Before
-    public void setupStore() {
+    public void setupStore() throws Exception {
         this.domStore = new InMemoryDOMDataStore("TEST", MoreExecutors.newDirectExecutorService());
         loadSchemas(RockTheHouseInput.class);
     }
 
-    public void loadSchemas(final Class<?>... classes) {
-        YangModuleInfo moduleInfo;
-        try {
-            final ModuleInfoBackedContext context = ModuleInfoBackedContext.create();
-            for (final Class<?> clz : classes) {
-                moduleInfo = BindingReflections.getModuleInfo(clz);
+    public void loadSchemas(final Class<?>... classes) throws Exception {
+        final ModuleInfoBackedContext context = ModuleInfoBackedContext.create();
+        for (final Class<?> clz : classes) {
+            YangModuleInfo moduleInfo = BindingReflections.getModuleInfo(clz);
 
-                context.registerModuleInfo(moduleInfo);
-            }
-            this.schemaContext = context.tryToCreateSchemaContext().get();
-            this.domStore.onGlobalContextUpdated(this.schemaContext);
-        } catch (final Exception e) {
-            Throwables.propagateIfPossible(e);
+            context.registerModuleInfo(moduleInfo);
         }
+        this.schemaContext = context.tryToCreateSchemaContext().get();
+        this.domStore.onGlobalContextUpdated(this.schemaContext);
     }
 
     /**
@@ -57,16 +51,14 @@ public class SchemaUpdateForTransactionTest {
      * then triggering update of global schema context
      * and then performing write (according to new module).
      *
+     * <p>
      * If transaction between allocation and schema context was
      * unmodified, it is safe to change its schema context
      * to new one (e.g. it will be same as if allocated after
      * schema context update.)
-     *
-     * @throws InterruptedException
-     * @throws ExecutionException
      */
     @Test
-    public void testTransactionSchemaUpdate() throws InterruptedException, ExecutionException {
+    public void testTransactionSchemaUpdate() throws Exception {
 
         assertNotNull(this.domStore);
 
@@ -78,15 +70,11 @@ public class SchemaUpdateForTransactionTest {
         // we trigger schema context update to contain Lists model
         loadSchemas(RockTheHouseInput.class, Top.class);
 
-        /**
-         *
+        /*
          * Writes /test in writeTx, this write should not fail
          * with IllegalArgumentException since /test is in
          * schema context.
-         *
          */
         writeTx.write(TOP_PATH, ImmutableNodes.containerNode(Top.QNAME));
-
     }
-
 }
index a01933c295bea088f5f86e7f0ad417f4d4e2be58..cbeff79d129a84ecd60cb3faf4acea2bff6922f7 100644 (file)
@@ -13,7 +13,7 @@ import com.google.common.util.concurrent.MoreExecutors;
 import java.util.concurrent.ExecutorService;
 
 /**
- * A forwarding Executor used by unit tests for DataChangeListener notifications
+ * A forwarding Executor used by unit tests for DataChangeListener notifications.
  *
  * @author Thomas Pantelis
  */
@@ -26,7 +26,7 @@ public class TestDCLExecutorService extends ForwardingExecutorService {
     private final ExecutorService postSetupExecutor;
 
 
-    public TestDCLExecutorService( final ExecutorService postSetupExecutor ) {
+    public TestDCLExecutorService(final ExecutorService postSetupExecutor) {
         this.postSetupExecutor = postSetupExecutor;
     }
 
@@ -39,4 +39,4 @@ public class TestDCLExecutorService extends ForwardingExecutorService {
         // Test setup complete - switch to the real executor.
         currentExecutor = postSetupExecutor;
     }
-}
\ No newline at end of file
+}
index 96749b037d8cf3c8f89d70d6eed07edcdf3d55da..8e36a8c3779dd73ced621c60c67d71d70327b5ff 100644 (file)
@@ -12,7 +12,7 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
-public class TestModel {
+public final class TestModel {
 
     public static final QName TEST_QNAME =
             QName.create("urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test", "2014-03-13", "test");
@@ -39,6 +39,9 @@ public class TestModel {
 
     private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
 
+    private TestModel() {
+    }
+
     public static SchemaContext createTestContext() {
         return YangParserTestUtils.parseYangResource(DATASTORE_TEST_YANG);
     }
index ddbba76ae035b752701530d46104dc8c0bdec639..b9ce0accf80939516fcf6d9d5417c1a349c068a9 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.controller.md.sal.dom.store.impl;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 
-import java.util.concurrent.ExecutionException;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelList;
@@ -28,7 +27,7 @@ public class WildcardedScopeBaseTest extends DefaultDataChangeListenerTestSuite
     }
 
     @Override
-    public void putTopLevelOneNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+    public void putTopLevelOneNested(final DatastoreTestTask task) throws Exception {
 
         AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
 
@@ -38,7 +37,7 @@ public class WildcardedScopeBaseTest extends DefaultDataChangeListenerTestSuite
          * Created data must not contain nested-list item, since that is two-level deep.
          */
         assertNotContains(change.getCreatedData(), TOP_LEVEL,path(FOO, BAR));
-        assertContains(change.getCreatedData(), path(FOO) );
+        assertContains(change.getCreatedData(), path(FOO));
 
         assertEmpty(change.getUpdatedData());
         assertEmpty(change.getRemovedPaths());
@@ -46,8 +45,7 @@ public class WildcardedScopeBaseTest extends DefaultDataChangeListenerTestSuite
     }
 
     @Override
-    public void replaceTopLevelNestedChanged(final DatastoreTestTask task) throws InterruptedException,
-            ExecutionException {
+    public void replaceTopLevelNestedChanged(final DatastoreTestTask task) throws Exception {
 
         AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
         assertNotNull(change);
@@ -67,8 +65,7 @@ public class WildcardedScopeBaseTest extends DefaultDataChangeListenerTestSuite
     }
 
     @Override
-    protected void putTopLevelWithTwoNested(final DatastoreTestTask task) throws InterruptedException,
-            ExecutionException {
+    protected void putTopLevelWithTwoNested(final DatastoreTestTask task) throws Exception {
 
         AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
         assertNotNull(change);
@@ -83,8 +80,7 @@ public class WildcardedScopeBaseTest extends DefaultDataChangeListenerTestSuite
     }
 
     @Override
-    protected void twoNestedExistsOneIsDeleted(final DatastoreTestTask task) throws InterruptedException,
-            ExecutionException {
+    protected void twoNestedExistsOneIsDeleted(final DatastoreTestTask task) throws Exception {
 
         /*
          * Base listener should be notified only and only if actual node changed its state,
@@ -97,8 +93,7 @@ public class WildcardedScopeBaseTest extends DefaultDataChangeListenerTestSuite
     }
 
     @Override
-    public void nestedListExistsRootDeleted(final DatastoreTestTask task) throws InterruptedException,
-            ExecutionException {
+    public void nestedListExistsRootDeleted(final DatastoreTestTask task) throws Exception {
 
         AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
 
@@ -115,7 +110,7 @@ public class WildcardedScopeBaseTest extends DefaultDataChangeListenerTestSuite
     }
 
     @Override
-    protected void existingOneNestedWriteAdditionalNested(final DatastoreTestTask task) {
+    protected void existingOneNestedWriteAdditionalNested(final DatastoreTestTask task) throws Exception {
         /*
          * One listener should be notified only and only if actual node changed its state,
          * since deletion of nested child (in this case /nested-list/nested-list[foo],
@@ -128,7 +123,7 @@ public class WildcardedScopeBaseTest extends DefaultDataChangeListenerTestSuite
     }
 
     @Override
-    protected void existingTopWriteTwoNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+    protected void existingTopWriteTwoNested(final DatastoreTestTask task) throws Exception {
         /*
          * One listener should be notified only and only if actual node changed its state,
          * since deletion of nested child (in this case /nested-list/nested-list[foo],
@@ -141,7 +136,7 @@ public class WildcardedScopeBaseTest extends DefaultDataChangeListenerTestSuite
     }
 
     @Override
-    protected void existingTopWriteSibling(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+    protected void existingTopWriteSibling(final DatastoreTestTask task) throws Exception {
         AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
 
         assertContains(change.getCreatedData(), path(FOO_SIBLING));
index 75f9fce612056bf1f89f00b95840f66f73d00ab6..02797c27610c88a0c411f6674f4d5abda16256f2 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.controller.md.sal.dom.store.impl;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 
-import java.util.concurrent.ExecutionException;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelList;
@@ -29,7 +28,7 @@ public class WildcardedScopeOneTest extends DefaultDataChangeListenerTestSuite {
     }
 
     @Override
-    public void putTopLevelOneNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+    public void putTopLevelOneNested(final DatastoreTestTask task) throws Exception {
 
         AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
 
@@ -44,8 +43,7 @@ public class WildcardedScopeOneTest extends DefaultDataChangeListenerTestSuite {
     }
 
     @Override
-    public void replaceTopLevelNestedChanged(final DatastoreTestTask task) throws InterruptedException,
-            ExecutionException {
+    public void replaceTopLevelNestedChanged(final DatastoreTestTask task) throws Exception {
 
         AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
         assertNotNull(change);
@@ -65,8 +63,7 @@ public class WildcardedScopeOneTest extends DefaultDataChangeListenerTestSuite {
     }
 
     @Override
-    protected void putTopLevelWithTwoNested(final DatastoreTestTask task) throws InterruptedException,
-            ExecutionException {
+    protected void putTopLevelWithTwoNested(final DatastoreTestTask task) throws Exception {
 
         AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
         assertNotNull(change);
@@ -81,8 +78,7 @@ public class WildcardedScopeOneTest extends DefaultDataChangeListenerTestSuite {
     }
 
     @Override
-    protected void twoNestedExistsOneIsDeleted(final DatastoreTestTask task) throws InterruptedException,
-            ExecutionException {
+    protected void twoNestedExistsOneIsDeleted(final DatastoreTestTask task) throws Exception {
 
         /*
          * One listener should be notified only and only if actual node changed its state,
@@ -96,8 +92,7 @@ public class WildcardedScopeOneTest extends DefaultDataChangeListenerTestSuite {
     }
 
     @Override
-    public void nestedListExistsRootDeleted(final DatastoreTestTask task) throws InterruptedException,
-            ExecutionException {
+    public void nestedListExistsRootDeleted(final DatastoreTestTask task) throws Exception {
 
         AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
 
@@ -110,7 +105,7 @@ public class WildcardedScopeOneTest extends DefaultDataChangeListenerTestSuite {
     }
 
     @Override
-    protected void existingOneNestedWriteAdditionalNested(final DatastoreTestTask task) {
+    protected void existingOneNestedWriteAdditionalNested(final DatastoreTestTask task) throws Exception {
         /*
          * One listener should be notified only and only if actual node changed its state,
          * since deletion of nested child (in this case /nested-list/nested-list[foo],
@@ -123,7 +118,7 @@ public class WildcardedScopeOneTest extends DefaultDataChangeListenerTestSuite {
     }
 
     @Override
-    protected void existingTopWriteTwoNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+    protected void existingTopWriteTwoNested(final DatastoreTestTask task) throws Exception {
         /*
          * One listener should be notified only and only if actual node changed its state,
          * since deletion of nested child (in this case /nested-list/nested-list[foo],
@@ -136,7 +131,7 @@ public class WildcardedScopeOneTest extends DefaultDataChangeListenerTestSuite {
     }
 
     @Override
-    protected void existingTopWriteSibling(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+    protected void existingTopWriteSibling(final DatastoreTestTask task) throws Exception {
         AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
 
         assertContains(change.getCreatedData(), path(FOO_SIBLING));
index a7fa24f2934a8da5dc879236147f6fd35df14cba..31a9f9c979566e5828b2abf4efb0bf03cbe2e46a 100644 (file)
@@ -11,8 +11,6 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
-import java.util.concurrent.ExecutionException;
-
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelList;
@@ -30,7 +28,7 @@ public class WildcardedScopeSubtreeTest extends DefaultDataChangeListenerTestSui
     }
 
     @Override
-    public void putTopLevelOneNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+    public void putTopLevelOneNested(final DatastoreTestTask task) throws Exception {
 
         AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
 
@@ -42,8 +40,7 @@ public class WildcardedScopeSubtreeTest extends DefaultDataChangeListenerTestSui
     }
 
     @Override
-    public void replaceTopLevelNestedChanged(final DatastoreTestTask task) throws InterruptedException,
-            ExecutionException {
+    public void replaceTopLevelNestedChanged(final DatastoreTestTask task) throws Exception {
 
         AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
         assertNotNull(change);
@@ -56,8 +53,7 @@ public class WildcardedScopeSubtreeTest extends DefaultDataChangeListenerTestSui
     }
 
     @Override
-    protected void putTopLevelWithTwoNested(final DatastoreTestTask task) throws InterruptedException,
-            ExecutionException {
+    protected void putTopLevelWithTwoNested(final DatastoreTestTask task) throws Exception {
 
         AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
         assertNotNull(change);
@@ -71,8 +67,7 @@ public class WildcardedScopeSubtreeTest extends DefaultDataChangeListenerTestSui
     }
 
     @Override
-    protected void twoNestedExistsOneIsDeleted(final DatastoreTestTask task) throws InterruptedException,
-            ExecutionException {
+    protected void twoNestedExistsOneIsDeleted(final DatastoreTestTask task) throws Exception {
 
         AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
         assertNotNull(change);
@@ -83,8 +78,7 @@ public class WildcardedScopeSubtreeTest extends DefaultDataChangeListenerTestSui
     }
 
     @Override
-    public void nestedListExistsRootDeleted(final DatastoreTestTask task) throws InterruptedException,
-            ExecutionException {
+    public void nestedListExistsRootDeleted(final DatastoreTestTask task) throws Exception {
 
         AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
 
@@ -96,7 +90,7 @@ public class WildcardedScopeSubtreeTest extends DefaultDataChangeListenerTestSui
     }
 
     @Override
-    protected void existingOneNestedWriteAdditionalNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+    protected void existingOneNestedWriteAdditionalNested(final DatastoreTestTask task) throws Exception {
         AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
 
         assertContains(change.getCreatedData(), path(FOO,BAZ));
@@ -107,7 +101,7 @@ public class WildcardedScopeSubtreeTest extends DefaultDataChangeListenerTestSui
     }
 
     @Override
-    protected void existingTopWriteTwoNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+    protected void existingTopWriteTwoNested(final DatastoreTestTask task) throws Exception {
         AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
 
         assertContains(change.getCreatedData(), path(FOO,BAR),path(FOO,BAZ));
@@ -117,7 +111,7 @@ public class WildcardedScopeSubtreeTest extends DefaultDataChangeListenerTestSui
     }
 
     @Override
-    protected void existingTopWriteSibling(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+    protected void existingTopWriteSibling(final DatastoreTestTask task) throws Exception {
         AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
 
         assertContains(change.getCreatedData(), path(FOO_SIBLING));