Fix checkstyle violations in sal-binding-broker 45/69145/3
authorTom Pantelis <tompantelis@gmail.com>
Tue, 6 Mar 2018 15:14:07 +0000 (10:14 -0500)
committerMichael Vorburger <vorburger@redhat.com>
Fri, 9 Mar 2018 15:11:22 +0000 (15:11 +0000)
Change-Id: Ia5bcaa7073ff3fb4c004864649e8f5bc2bf23281
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
70 files changed:
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/AbstractNotificationListenerRegistration.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/AggregatedNotificationListenerRegistration.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/CompositeRoutedRpcRegistration.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/DelegatedRootRpcRegistration.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/FunctionalNotificationListenerAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/HeliumNotificationProviderServiceAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/HeliumNotificationProviderServiceWithInterestListeners.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/HeliumNotificationServiceAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/HeliumRpcProviderRegistry.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/ListenerMapGeneration.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/NotificationInvoker.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/NotificationListenerRegistration.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/AbstractForwardedDataBroker.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/AbstractForwardedTransaction.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/AbstractReadWriteTransaction.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/AbstractWriteTransaction.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMAdapterLoader.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMDataBrokerAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMDataTreeChangeListenerAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMDataTreeChangeServiceAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMMountPointListenerAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMMountPointServiceAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMNotificationListenerAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMNotificationPublishServiceAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMNotificationServiceAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMReadTransactionAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMReadWriteTransactionAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMRpcAdapterRegistration.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMRpcImplementationAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMRpcProviderServiceAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMTransactionChainAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMWriteTransactionAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDataTreeChangeListenerRegistration.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingMountPointAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingRpcAdapterRegistration.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingToNormalizedNodeCodec.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingToNormalizedNodeCodecFactory.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/ContextReferenceExtractor.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/DirectGetterRouteContextExtractor.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/FutureSchema.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/GetValueRouteContextExtractor.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/LazyDataObjectModification.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/LazyDataTreeModification.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/LazySerializedContainerNode.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/LazySerializedDOMNotification.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/RpcServiceAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/spi/AdapterBuilder.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/spi/AdapterLoader.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/SingletonHolder.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RootBindingAwareBroker.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMDataTreeChangeServiceAdapterTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/BindingNormalizedCodecTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/ContextExtractorTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/BackwardsCompatibleNotificationBrokerTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/BindingDOMDataBrokerAdapterTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/Bug1125RegressionTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/Bug1333DataChangeListenerTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/Bug1418AugmentationTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/Bug2562DeserializedUnkeyedListTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/Bug3090MultiKeyList.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/DataTreeChangeListenerTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/ForwardedNotificationAdapterTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/WriteTransactionTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/AbstractDataBrokerTestCustomizer.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/AssertCollections.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/AugmentationVerifier.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/mock/ReferencableObject.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/mock/ReferencableObjectKey.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/util/BindingBrokerTestFactory.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/util/BindingTestContext.java

index 540c26131621477ef00f95d0055db2576ce7550c..e327e6f23657ed5d24ec25eb73336d58b7e69bad 100644 (file)
@@ -7,21 +7,22 @@
  */
 package org.opendaylight.controller.md.sal.binding.compat;
 
+import com.google.common.base.Preconditions;
 import org.opendaylight.controller.sal.binding.api.NotificationListener;
 import org.opendaylight.yangtools.concepts.AbstractListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.Notification;
 
-import com.google.common.base.Preconditions;
-
 /**
  * Abstract implementation of {@link NotificationListenerRegistration}.
  *
  * @param <T> Notification type
  */
-abstract class AbstractNotificationListenerRegistration<T extends Notification> extends AbstractListenerRegistration<NotificationListener<T>> implements NotificationListenerRegistration<T> {
+abstract class AbstractNotificationListenerRegistration<T extends Notification>
+        extends AbstractListenerRegistration<NotificationListener<T>> implements NotificationListenerRegistration<T> {
     private final Class<? extends Notification> type;
 
-    protected AbstractNotificationListenerRegistration(final Class<? extends Notification> type, final NotificationListener<T> listener) {
+    protected AbstractNotificationListenerRegistration(final Class<? extends Notification> type,
+            final NotificationListener<T> listener) {
         super(listener);
         this.type = Preconditions.checkNotNull(type);
     }
index e93109d576a284fa2401a63d05ca10f572cfe6a9..339ad68ff762cdbf996d81f3bb228673cbbb5dd7 100644 (file)
@@ -16,16 +16,19 @@ import org.opendaylight.yangtools.yang.binding.Notification;
  * interfaces at the same time. In order to support correct delivery, we need to maintain per-type registrations
  * which get squashed if a notification which implements multiple interfaces is encountered.
  *
+ * <p>
  * We take care of that by implementing alternate {@link #hashCode()}/{@link #equals(Object)}, which resolve
  * to the backing aggregator.
  *
  * @param <N> Notification type
  * @param <A> Aggregator type
  */
-abstract class AggregatedNotificationListenerRegistration<N extends Notification, A> extends AbstractNotificationListenerRegistration<N> {
+abstract class AggregatedNotificationListenerRegistration<N extends Notification, A>
+        extends AbstractNotificationListenerRegistration<N> {
     private final A aggregator;
 
-    protected AggregatedNotificationListenerRegistration(final Class<? extends Notification> type, final NotificationListener<N> listener, final A aggregator) {
+    protected AggregatedNotificationListenerRegistration(final Class<? extends Notification> type,
+            final NotificationListener<N> listener, final A aggregator) {
         super(type, listener);
         this.aggregator = Preconditions.checkNotNull(aggregator);
     }
index bb6c2e7770b35021083d55e561ef65849de36be2..1a405e02c80798fb80abbefeb271fc5c9c0db857 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.controller.md.sal.binding.compat;
 
-import com.google.common.base.Throwables;
 import com.google.common.collect.ImmutableSet;
 import java.util.HashMap;
 import java.util.Map;
@@ -25,7 +24,8 @@ final class CompositeRoutedRpcRegistration<T extends RpcService> implements Rout
     private final BindingDOMRpcProviderServiceAdapter adapter;
     private final Map<InstanceIdentifier<?>, ObjectRegistration<T>> registrations = new HashMap<>(2);
 
-    CompositeRoutedRpcRegistration(final Class<T> type, final T impl, final BindingDOMRpcProviderServiceAdapter providerAdapter) {
+    CompositeRoutedRpcRegistration(final Class<T> type, final T impl,
+            final BindingDOMRpcProviderServiceAdapter providerAdapter) {
         this.type = type;
         this.instance = impl;
         this.adapter = providerAdapter;
@@ -48,9 +48,11 @@ final class CompositeRoutedRpcRegistration<T extends RpcService> implements Rout
     }
 
     @Override
-    public synchronized void registerPath(final Class<? extends BaseIdentity> context, final InstanceIdentifier<?> path) {
-        if(!registrations.containsKey(path)) {
-            registrations.put(path, adapter.registerRpcImplementation(type, instance, ImmutableSet.<InstanceIdentifier<?>>of(path)));
+    public synchronized void registerPath(final Class<? extends BaseIdentity> context,
+            final InstanceIdentifier<?> path) {
+        if (!registrations.containsKey(path)) {
+            registrations.put(path,
+                    adapter.registerRpcImplementation(type, instance, ImmutableSet.<InstanceIdentifier<?>>of(path)));
         }
     }
 
@@ -62,27 +64,18 @@ final class CompositeRoutedRpcRegistration<T extends RpcService> implements Rout
     }
 
     @Override
-    public synchronized  void unregisterPath(final Class<? extends BaseIdentity> context, final InstanceIdentifier<?> path) {
+    public synchronized  void unregisterPath(final Class<? extends BaseIdentity> context,
+            final InstanceIdentifier<?> path) {
         final ObjectRegistration<T> reg = registrations.remove(path);
-        if(reg != null) {
-            try {
-                reg.close();
-            } catch (final Exception e) {
-                // FIXME: Once we have proper subclass of ObjectRegistrationo
-                throw Throwables.propagate(e);
-            }
+        if (reg != null) {
+            reg.close();
         }
     }
 
     @Override
     public synchronized void close() {
-        try {
-            for(final ObjectRegistration<T> reg : registrations.values()) {
-                    reg.close();
-            }
-        } catch (final Exception e) {
-            throw Throwables.propagate(e);
+        for (final ObjectRegistration<T> reg : registrations.values()) {
+            reg.close();
         }
     }
-
 }
index 1c3e6d89ee62e685b363a21953f572b4af6d1022..aa94e219f69dff319499bc2a25dd0d016b948fb2 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.controller.md.sal.binding.compat;
 
-import com.google.common.base.Throwables;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
 import org.opendaylight.yangtools.concepts.ObjectRegistration;
 import org.opendaylight.yangtools.yang.binding.RpcService;
@@ -17,7 +16,7 @@ final class DelegatedRootRpcRegistration<T extends RpcService> implements RpcReg
     private final ObjectRegistration<T> delegate;
     private final Class<T> type;
 
-    public DelegatedRootRpcRegistration(final Class<T> type,final ObjectRegistration<T> impl) {
+    DelegatedRootRpcRegistration(final Class<T> type, final ObjectRegistration<T> impl) {
         this.delegate = impl;
         this.type = type;
     }
@@ -25,12 +24,7 @@ final class DelegatedRootRpcRegistration<T extends RpcService> implements RpcReg
 
     @Override
     public void close() {
-        try {
-            // FIXME: Should use more specific registration object.
-            delegate.close();
-        } catch (final Exception e) {
-            throw Throwables.propagate(e);
-        }
+        delegate.close();
     }
 
     @Override
@@ -42,5 +36,4 @@ final class DelegatedRootRpcRegistration<T extends RpcService> implements RpcReg
     public Class<T> getServiceType() {
         return type;
     }
-
 }
index 0d85ef9a5f9aca69fd4be8d070439b9fba8b3bfd..5189e8fb4614ae2b0272abd9696da997796f5cc0 100644 (file)
@@ -21,7 +21,8 @@ final class FunctionalNotificationListenerAdapter<N extends Notification> implem
     private final NotificationListener<N> delegate;
     private final Class<N> type;
 
-    public FunctionalNotificationListenerAdapter(final BindingNormalizedNodeSerializer codec, final Class<N> type, final NotificationListener<N> delegate) {
+    FunctionalNotificationListenerAdapter(final BindingNormalizedNodeSerializer codec, final Class<N> type,
+            final NotificationListener<N> delegate) {
         this.codec = codec;
         this.type = type;
         this.delegate = delegate;
@@ -29,11 +30,11 @@ final class FunctionalNotificationListenerAdapter<N extends Notification> implem
 
     @Override
     public void onNotification(@Nonnull final DOMNotification notification) {
-        delegate.onNotification( type.cast(deserialize(notification)));
+        delegate.onNotification(type.cast(deserialize(notification)));
     }
 
     private Notification deserialize(final DOMNotification notification) {
-        if(notification instanceof LazySerializedDOMNotification) {
+        if (notification instanceof LazySerializedDOMNotification) {
             return ((LazySerializedDOMNotification) notification).getBindingData();
         }
         return codec.fromNormalizedNodeNotification(notification.getType(), notification.getBody());
index 24376d64821f9f0028b40590c635cba0b085d337..a65d490742bdbebb9bfd4f03b584d8f7be6825e3 100644 (file)
@@ -16,7 +16,8 @@ import org.opendaylight.yangtools.yang.binding.Notification;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class HeliumNotificationProviderServiceAdapter extends HeliumNotificationServiceAdapter implements NotificationProviderService, AutoCloseable {
+public class HeliumNotificationProviderServiceAdapter extends HeliumNotificationServiceAdapter
+        implements NotificationProviderService, AutoCloseable {
     private static final Logger LOG = LoggerFactory.getLogger(HeliumNotificationProviderServiceAdapter.class);
 
     private final NotificationPublishService notificationPublishService;
@@ -53,7 +54,5 @@ public class HeliumNotificationProviderServiceAdapter extends HeliumNotification
 
     @Override
     public void close() throws Exception {
-
     }
-
 }
index 1eb421de7c7ef249a363cfd567eb1b4d4a4bc6df..6181b0edc4c2af367407c3f6da04f6c0196931ee 100644 (file)
@@ -29,7 +29,8 @@ import org.slf4j.LoggerFactory;
 
 public class HeliumNotificationProviderServiceWithInterestListeners extends HeliumNotificationProviderServiceAdapter {
 
-    private static final Logger LOG = LoggerFactory.getLogger(HeliumNotificationProviderServiceWithInterestListeners.class);
+    private static final Logger LOG = LoggerFactory.getLogger(
+            HeliumNotificationProviderServiceWithInterestListeners.class);
 
     private final ListenerRegistry<NotificationInterestListener> interestListeners = ListenerRegistry.create();
     private final ListenerRegistration<Listener> domListener;
@@ -37,7 +38,9 @@ public class HeliumNotificationProviderServiceWithInterestListeners extends Heli
     private final BindingToNormalizedNodeCodec codec;
 
     public HeliumNotificationProviderServiceWithInterestListeners(
-            final BindingDOMNotificationPublishServiceAdapter publishService, final BindingDOMNotificationServiceAdapter listenService, final DOMNotificationSubscriptionListenerRegistry registry) {
+            final BindingDOMNotificationPublishServiceAdapter publishService,
+            final BindingDOMNotificationServiceAdapter listenService,
+            final DOMNotificationSubscriptionListenerRegistry registry) {
         super(publishService, listenService);
         this.codec = publishService.getCodecRegistry();
         this.domListener = registry.registerSubscriptionListener(new Listener());
@@ -55,16 +58,17 @@ public class HeliumNotificationProviderServiceWithInterestListeners extends Heli
         return codec.getNotificationClasses(added);
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private void notifyAllListeners(final Set<SchemaPath> added) {
         final Iterator<ListenerRegistration<NotificationInterestListener>> listeners = interestListeners.iterator();
-        if(listeners.hasNext()) {
+        if (listeners.hasNext()) {
             final Set<Class<? extends Notification>> baEvent = translate(added);
-            while(listeners.hasNext()) {
+            while (listeners.hasNext()) {
                 final NotificationInterestListener listenerRef = listeners.next().getInstance();
                 try {
-                    notifyListener(listenerRef,baEvent);
-                } catch (final Exception e) {
-                    LOG.warn("Unhandled exception during invoking listener {}",e, listenerRef);
+                    notifyListener(listenerRef, baEvent);
+                } catch (RuntimeException  e) {
+                    LOG.warn("Unhandled exception during invoking listener {}", e, listenerRef);
                 }
             }
         }
@@ -74,7 +78,8 @@ public class HeliumNotificationProviderServiceWithInterestListeners extends Heli
     public <T extends Notification> ListenerRegistration<NotificationListener<T>> registerNotificationListener(
             final Class<T> type, final NotificationListener<T> listener) {
 
-        final FunctionalNotificationListenerAdapter<T> adapter = new FunctionalNotificationListenerAdapter<>(codec, type, listener);
+        final FunctionalNotificationListenerAdapter<T> adapter =
+                new FunctionalNotificationListenerAdapter<>(codec, type, listener);
         final SchemaPath domType = SchemaPath.create(true, BindingReflections.findQName(type));
         final ListenerRegistration<?> domReg = domService.registerNotificationListener(adapter, domType);
         return new AbstractListenerRegistration<NotificationListener<T>>(listener) {
@@ -82,12 +87,12 @@ public class HeliumNotificationProviderServiceWithInterestListeners extends Heli
             protected void removeRegistration() {
                 domReg.close();
             }
-
         };
     }
 
-    private void notifyListener(final NotificationInterestListener listener, final Set<Class<? extends Notification>> baEvent) {
-        for(final Class<? extends Notification> event: baEvent) {
+    private void notifyListener(final NotificationInterestListener listener,
+            final Set<Class<? extends Notification>> baEvent) {
+        for (final Class<? extends Notification> event: baEvent) {
             listener.onNotificationSubscribtion(event);
         }
     }
index 68daa45c45c88c8b9d410c37f5512d7439c9e0c3..f4c1020677f87a2e1c54853046d49a3066a1c286 100644 (file)
@@ -12,7 +12,8 @@ import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.Notification;
 import org.opendaylight.yangtools.yang.binding.NotificationListener;
 
-public class HeliumNotificationServiceAdapter implements org.opendaylight.controller.sal.binding.api.NotificationService, AutoCloseable {
+public class HeliumNotificationServiceAdapter
+        implements org.opendaylight.controller.sal.binding.api.NotificationService, AutoCloseable {
 
     private final NotificationService notificationService;
 
@@ -21,8 +22,10 @@ public class HeliumNotificationServiceAdapter implements org.opendaylight.contro
     }
 
     @Override
-    public <T extends Notification> ListenerRegistration<org.opendaylight.controller.sal.binding.api.NotificationListener<T>> registerNotificationListener(
-            final Class<T> notificationType, final org.opendaylight.controller.sal.binding.api.NotificationListener<T> listener) {
+    public <T extends Notification> ListenerRegistration<
+            org.opendaylight.controller.sal.binding.api.NotificationListener<T>> registerNotificationListener(
+            final Class<T> notificationType,
+            final org.opendaylight.controller.sal.binding.api.NotificationListener<T> listener) {
         throw new UnsupportedOperationException("Not supported type of listener.");
     }
 
@@ -34,6 +37,5 @@ public class HeliumNotificationServiceAdapter implements org.opendaylight.contro
 
     @Override
     public void close() throws Exception {
-
     }
 }
index 555c96e16457dd60603cb601aa7bdaa8faca7a2b..34f71e9f0583326bb6a98141a1122bb13917aac0 100644 (file)
@@ -49,10 +49,9 @@ public class HeliumRpcProviderRegistry implements RpcProviderRegistry {
     }
 
     @Override
-    public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L> registerRouteChangeListener(
-            final L arg0) {
+    public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L>
+            registerRouteChangeListener(final L listener) {
         // FIXME: Implement this only if necessary
         return null;
     }
-
 }
index 7ca35aa66ba7d76cb0fdb74c576bc13c997c2a36..e2cf3d753d44ced436caaca562fdce727e2cf4a9 100644 (file)
@@ -7,20 +7,18 @@
  */
 package org.opendaylight.controller.md.sal.binding.compat;
 
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-import java.util.stream.Collectors;
-import org.opendaylight.yangtools.yang.binding.Notification;
-
 import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
 import com.google.common.collect.ImmutableMultimap;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Multimap;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.stream.Collectors;
+import org.opendaylight.yangtools.yang.binding.Notification;
 
 /**
  * An immutable view of the current generation of listeners.
@@ -48,7 +46,8 @@ final class ListenerMapGeneration {
 
                     for (final Class<?> type : getNotificationTypes(key)) {
                         @SuppressWarnings("unchecked")
-                        final Collection<NotificationListenerRegistration<?>> l = typeToListeners.get((Class<? extends Notification>) type);
+                        final Collection<NotificationListenerRegistration<?>> l =
+                                typeToListeners.get((Class<? extends Notification>) type);
                         if (l != null) {
                             regs.addAll(l);
                         }
@@ -62,7 +61,8 @@ final class ListenerMapGeneration {
         typeToListeners = ImmutableMultimap.of();
     }
 
-    ListenerMapGeneration(final Multimap<Class<? extends Notification>, NotificationListenerRegistration<?>> listeners) {
+    ListenerMapGeneration(final Multimap<Class<? extends Notification>,
+            NotificationListenerRegistration<?>> listeners) {
         this.typeToListeners = ImmutableMultimap.copyOf(listeners);
     }
 
@@ -96,4 +96,4 @@ final class ListenerMapGeneration {
                 .filter(input -> !Notification.class.equals(input) && Notification.class.isAssignableFrom(input))
                 .collect(Collectors.toList());
     }
-}
\ No newline at end of file
+}
index f98c8b8a53f3f6d1476ef9df377e7fbab112e285..b803c96b80c7ec998e3f257ab12a4e9f4bb59382 100644 (file)
@@ -20,7 +20,8 @@ import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
 import org.opendaylight.yangtools.yang.binding.util.NotificationListenerInvoker;
 import org.opendaylight.yangtools.yang.common.QName;
 
-final class NotificationInvoker implements org.opendaylight.controller.sal.binding.api.NotificationListener<Notification> {
+final class NotificationInvoker
+        implements org.opendaylight.controller.sal.binding.api.NotificationListener<Notification> {
 
     private final NotificationListener delegate;
     private final Map<Class<? extends Notification>,InvokerContext> invokers;
@@ -29,14 +30,15 @@ final class NotificationInvoker implements org.opendaylight.controller.sal.bindi
     private NotificationInvoker(final NotificationListener listener) {
         delegate = listener;
         final Map<Class<? extends Notification>, InvokerContext> builder = new HashMap<>();
-        for(final TypeToken<?> ifaceToken : TypeToken.of(listener.getClass()).getTypes().interfaces()) {
+        for (final TypeToken<?> ifaceToken : TypeToken.of(listener.getClass()).getTypes().interfaces()) {
             final Class<?> iface = ifaceToken.getRawType();
-            if(NotificationListener.class.isAssignableFrom(iface) && BindingReflections.isBindingClass(iface)) {
+            if (NotificationListener.class.isAssignableFrom(iface) && BindingReflections.isBindingClass(iface)) {
                 @SuppressWarnings("unchecked")
-                final Class<? extends NotificationListener> listenerType = (Class<? extends NotificationListener>) iface;
+                final Class<? extends NotificationListener> listenerType =
+                        (Class<? extends NotificationListener>) iface;
                 final NotificationListenerInvoker invoker = NotificationListenerInvoker.from(listenerType);
-                for(final Class<? extends Notification> type : getNotificationTypes(listenerType)) {
-                    builder.put(type, new InvokerContext(BindingReflections.findQName(type) , invoker));
+                for (final Class<? extends Notification> type : getNotificationTypes(listenerType)) {
+                    builder.put(type, new InvokerContext(BindingReflections.findQName(type), invoker));
                 }
             }
         }
@@ -61,13 +63,15 @@ final class NotificationInvoker implements org.opendaylight.controller.sal.bindi
     }
 
     @SuppressWarnings("unchecked")
-    private static Set<Class<? extends Notification>> getNotificationTypes(final Class<? extends org.opendaylight.yangtools.yang.binding.NotificationListener> type) {
+    private static Set<Class<? extends Notification>> getNotificationTypes(
+            final Class<? extends org.opendaylight.yangtools.yang.binding.NotificationListener> type) {
         // TODO: Investigate possibility and performance impact if we cache this or expose
         // it from NotificationListenerInvoker
         final Set<Class<? extends Notification>> ret = new HashSet<>();
-        for(final Method method : type.getMethods()) {
-            if(BindingReflections.isNotificationCallback(method)) {
-                final Class<? extends Notification> notification = (Class<? extends Notification>) method.getParameterTypes()[0];
+        for (final Method method : type.getMethods()) {
+            if (BindingReflections.isNotificationCallback(method)) {
+                final Class<? extends Notification> notification =
+                        (Class<? extends Notification>) method.getParameterTypes()[0];
                 ret.add(notification);
             }
         }
@@ -87,7 +91,5 @@ final class NotificationInvoker implements org.opendaylight.controller.sal.bindi
         public void invoke(final Notification notification) {
             invoker.invokeNotification(delegate, name, notification);
         }
-
     }
-
 }
index 81183c97a1523236055fb2040ec4a29fffd9e3c7..c6af237924e395dcb01d3619f54e53b2779f61af 100644 (file)
@@ -18,7 +18,8 @@ import org.opendaylight.yangtools.yang.binding.Notification;
  *
  * @param <T> Type of notification
  */
-interface NotificationListenerRegistration<T extends Notification> extends ListenerRegistration<NotificationListener<T>> {
+interface NotificationListenerRegistration<T extends Notification>
+        extends ListenerRegistration<NotificationListener<T>> {
     /**
      * Return the interface class of the notification type.
      *
index 82cbf087c862b6a6800117338d86bdc8dfd86acd..da9cb2ee9a15f3cbc0e17db2438f3850b77d517a 100644 (file)
@@ -64,18 +64,19 @@ public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBr
     }
 
     public ListenerRegistration<DataChangeListener> registerDataChangeListener(final LogicalDatastoreType store,
-            final InstanceIdentifier<?> path, final DataChangeListener listener, final DataChangeScope triggeringScope) {
+            final InstanceIdentifier<?> path, final DataChangeListener listener,
+            final DataChangeScope triggeringScope) {
         final DOMDataChangeListener domDataChangeListener;
 
-        if(listener instanceof ClusteredDataChangeListener) {
+        if (listener instanceof ClusteredDataChangeListener) {
             domDataChangeListener = new TranslatingClusteredDataChangeInvoker(store, path, listener, triggeringScope);
         } else {
             domDataChangeListener = new TranslatingDataChangeInvoker(store, path, listener,
                 triggeringScope);
         }
         final YangInstanceIdentifier domPath = codec.toYangInstanceIdentifierBlocking(path);
-        final ListenerRegistration<DOMDataChangeListener> domRegistration = domDataBroker.registerDataChangeListener(store,
-                domPath, domDataChangeListener, triggeringScope);
+        final ListenerRegistration<DOMDataChangeListener> domRegistration =
+                domDataBroker.registerDataChangeListener(store, domPath, domDataChangeListener, triggeringScope);
         return new ListenerRegistrationImpl(listener, domRegistration);
     }
 
@@ -85,7 +86,8 @@ public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBr
 
         for (final Map.Entry<YangInstanceIdentifier, ? extends NormalizedNode<?, ?>> entry : normalized.entrySet()) {
             try {
-                final Optional<Entry<InstanceIdentifier<? extends DataObject>, DataObject>> potential = getCodec().toBinding(entry);
+                final Optional<Entry<InstanceIdentifier<? extends DataObject>, DataObject>> potential =
+                        getCodec().toBinding(entry);
                 if (potential.isPresent()) {
                     final Entry<InstanceIdentifier<? extends DataObject>, DataObject> binding = potential.get();
                     newMap.put(binding.getKey(), binding.getValue());
@@ -102,11 +104,13 @@ public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBr
         final Set<InstanceIdentifier<?>> hashSet = new HashSet<>();
         for (final YangInstanceIdentifier normalizedPath : normalized) {
             try {
-                final Optional<InstanceIdentifier<? extends DataObject>> potential = getCodec().toBinding(normalizedPath);
+                final Optional<InstanceIdentifier<? extends DataObject>> potential =
+                        getCodec().toBinding(normalizedPath);
                 if (potential.isPresent()) {
                     final InstanceIdentifier<? extends DataObject> binding = potential.get();
                     hashSet.add(binding);
-                } else if (normalizedPath.getLastPathArgument() instanceof YangInstanceIdentifier.AugmentationIdentifier) {
+                } else if (normalizedPath.getLastPathArgument()
+                        instanceof YangInstanceIdentifier.AugmentationIdentifier) {
                     hashSet.add(path);
                 }
             } catch (final DeserializationException e) {
@@ -120,7 +124,8 @@ public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBr
         if (path.isWildcarded()) {
             return Optional.absent();
         }
-        return (Optional<DataObject>) getCodec().deserializeFunction(path).apply(Optional.<NormalizedNode<?, ?>> of(data));
+        return (Optional<DataObject>) getCodec().deserializeFunction(path)
+                .apply(Optional.<NormalizedNode<?, ?>>of(data));
     }
 
     private class TranslatingDataChangeInvoker implements DOMDataChangeListener {
@@ -129,7 +134,7 @@ public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBr
         private final InstanceIdentifier<?> path;
         private final DataChangeScope triggeringScope;
 
-        public TranslatingDataChangeInvoker(final LogicalDatastoreType store, final InstanceIdentifier<?> path,
+        TranslatingDataChangeInvoker(final LogicalDatastoreType store, final InstanceIdentifier<?> path,
                 final DataChangeListener bindingDataChangeListener, final DataChangeScope triggeringScope) {
             this.store = store;
             this.path = path;
@@ -149,15 +154,13 @@ public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBr
     }
 
     /**
-     * Translator for ClusteredDataChangeListener
+     * Translator for ClusteredDataChangeListener.
      */
-
     private class TranslatingClusteredDataChangeInvoker extends TranslatingDataChangeInvoker implements
         ClusteredDOMDataChangeListener {
 
-        public TranslatingClusteredDataChangeInvoker(final LogicalDatastoreType store, final InstanceIdentifier<?> path,
-                                                     final DataChangeListener bindingDataChangeListener,
-                                                     final DataChangeScope triggeringScope) {
+        TranslatingClusteredDataChangeInvoker(final LogicalDatastoreType store, final InstanceIdentifier<?> path,
+                final DataChangeListener bindingDataChangeListener, final DataChangeScope triggeringScope) {
             super(store, path, bindingDataChangeListener, triggeringScope);
         }
     }
@@ -173,7 +176,7 @@ public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBr
         private Optional<DataObject> originalDataCache;
         private Optional<DataObject> updatedDataCache;
 
-        public TranslatedDataChangeEvent(
+        TranslatedDataChangeEvent(
                 final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change,
                 final InstanceIdentifier<?> path) {
             this.domEvent = change;
@@ -252,7 +255,7 @@ public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBr
     private static class ListenerRegistrationImpl extends AbstractListenerRegistration<DataChangeListener> {
         private final ListenerRegistration<DOMDataChangeListener> registration;
 
-        public ListenerRegistrationImpl(final DataChangeListener listener,
+        ListenerRegistrationImpl(final DataChangeListener listener,
                 final ListenerRegistration<DOMDataChangeListener> registration) {
             super(listener);
             this.registration = registration;
@@ -267,5 +270,4 @@ public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBr
     @Override
     public void close() {
     }
-
 }
index 1184d395828dee8abd2fd23353257245897f6c79..ad8b60517cc2c4975a17e737c0a9ffa4215037b3 100644 (file)
@@ -29,7 +29,7 @@ abstract class AbstractForwardedTransaction<T extends AsyncTransaction<YangInsta
     private final T delegate;
     private final BindingToNormalizedNodeCodec codec;
 
-    public AbstractForwardedTransaction(final T delegateTx, final BindingToNormalizedNodeCodec codec) {
+    AbstractForwardedTransaction(final T delegateTx, final BindingToNormalizedNodeCodec codec) {
         this.delegate = Preconditions.checkNotNull(delegateTx, "Delegate must not be null");
         this.codec = Preconditions.checkNotNull(codec, "Codec must not be null");
     }
@@ -46,7 +46,8 @@ abstract class AbstractForwardedTransaction<T extends AsyncTransaction<YangInsta
     }
 
     @SuppressWarnings("unchecked")
-    protected final <S extends AsyncTransaction<YangInstanceIdentifier, NormalizedNode<?, ?>>> S getDelegateChecked(final Class<S> txType) {
+    protected final <S extends AsyncTransaction<YangInstanceIdentifier, NormalizedNode<?, ?>>>
+            S getDelegateChecked(final Class<S> txType) {
         Preconditions.checkState(txType.isInstance(delegate));
         return (S) delegate;
     }
index 8fbc118a16efcc59b74b4016743a8ff87ee24f7a..c4ec8e49bfb39d57802825de05175be4f26c6f73 100644 (file)
@@ -7,6 +7,9 @@
  */
 package org.opendaylight.controller.md.sal.binding.impl;
 
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizationException;
@@ -17,15 +20,12 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgum
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
 public class AbstractReadWriteTransaction extends AbstractWriteTransaction<DOMDataReadWriteTransaction> {
 
     private static final Logger LOG = LoggerFactory.getLogger(AbstractReadWriteTransaction.class);
 
-    public AbstractReadWriteTransaction(final DOMDataReadWriteTransaction delegate, final BindingToNormalizedNodeCodec codec) {
+    public AbstractReadWriteTransaction(final DOMDataReadWriteTransaction delegate,
+            final BindingToNormalizedNodeCodec codec) {
         super(delegate, codec);
     }
 
@@ -44,8 +44,8 @@ public class AbstractReadWriteTransaction extends AbstractWriteTransaction<DOMDa
                 throw new IllegalArgumentException(String.format("Invalid child encountered in path %s", path), e);
             }
             currentArguments.add(currentArg);
-            org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier currentPath = org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.create(
-                    currentArguments);
+            org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier currentPath =
+                    org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.create(currentArguments);
 
             final Boolean exists;
             try {
@@ -60,6 +60,4 @@ public class AbstractReadWriteTransaction extends AbstractWriteTransaction<DOMDa
             }
         }
     }
-
-
 }
index 1e3e41909aad90172f0f5d0a19cc9a9d0aaa7fce..eebd8367f3431ebee505b807d197b5c2e5c001a7 100644 (file)
@@ -21,9 +21,7 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 /**
- *
- * Abstract Base Transaction for transactions which are backed by
- * {@link DOMDataWriteTransaction}
+ * Abstract Base Transaction for transactions which are backed by {@link DOMDataWriteTransaction}.
  */
 public abstract class AbstractWriteTransaction<T extends DOMDataWriteTransaction> extends
         AbstractForwardedTransaction<T> {
@@ -61,7 +59,6 @@ public abstract class AbstractWriteTransaction<T extends DOMDataWriteTransaction
     }
 
     /**
-     *
      * Ensures list parent if item is list, otherwise noop.
      *
      * <p>
@@ -83,7 +80,7 @@ public abstract class AbstractWriteTransaction<T extends DOMDataWriteTransaction
      * put("/nodes/node/node[key]",domNode);
      * </pre>
      *
-     *
+     * <p>
      * In order to allow that to be inserted if necessary, if we know
      * item is list item, we will try to merge empty MapNode or OrderedNodeMap
      * to ensure list exists.
@@ -104,6 +101,8 @@ public abstract class AbstractWriteTransaction<T extends DOMDataWriteTransaction
     }
 
     /**
+     * Deprecated.
+     *
      * @deprecated Use {@link YangInstanceIdentifier#getParent()} instead.
      */
     @Deprecated
@@ -114,10 +113,6 @@ public abstract class AbstractWriteTransaction<T extends DOMDataWriteTransaction
     /**
      * Subclasses of this class are required to implement creation of parent
      * nodes based on behaviour of their underlying transaction.
-     *
-     * @param store
-     * @param key
-     * @param path
      */
     protected abstract void ensureParentsByMerge(LogicalDatastoreType store,
             YangInstanceIdentifier key, InstanceIdentifier<?> path);
@@ -137,5 +132,4 @@ public abstract class AbstractWriteTransaction<T extends DOMDataWriteTransaction
     protected final boolean doCancel() {
         return getDelegate().cancel();
     }
-
 }
index d8afdeb150e8484be36366bba168793c84e2156a..531f84a976d9cca6e1216f8ba2337cc19e857215 100644 (file)
@@ -21,9 +21,8 @@ import org.opendaylight.controller.md.sal.dom.api.DOMService;
 import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
 
 public abstract class BindingDOMAdapterLoader extends AdapterLoader<BindingService, DOMService> {
-
-
-    private static final Map<Class<?>,BindingDOMAdapterBuilder.Factory<?>> FACTORIES = ImmutableMap.<Class<?>,BindingDOMAdapterBuilder.Factory<?>>builder()
+    private static final Map<Class<?>,BindingDOMAdapterBuilder.Factory<?>> FACTORIES =
+        ImmutableMap.<Class<?>,BindingDOMAdapterBuilder.Factory<?>>builder()
             .put(NotificationService.class,BindingDOMNotificationServiceAdapter.BUILDER_FACTORY)
             .put(NotificationPublishService.class,BindingDOMNotificationPublishServiceAdapter.BUILDER_FACTORY)
             .put(DataBroker.class,BindingDOMDataBrokerAdapter.BUILDER_FACTORY)
@@ -37,7 +36,8 @@ public abstract class BindingDOMAdapterLoader extends AdapterLoader<BindingServi
     }
 
     @Override
-    protected final AdapterBuilder<? extends BindingService, DOMService> createBuilder(final Class<? extends BindingService> key) {
+    protected final AdapterBuilder<? extends BindingService, DOMService> createBuilder(
+            final Class<? extends BindingService> key) {
         final Factory<?> factory = FACTORIES.get(key);
         Preconditions.checkArgument(factory != null, "Unsupported service type %s", key);
         final BindingDOMAdapterBuilder<?> builder = factory.newBuilder();
index c78db4ba8edb0b5791ee48fa6e8fbf71095a7e11..7b4c5495d6d2ff3fef2cdc467fe035f8d16015cd 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.controller.md.sal.binding.impl;
 
-
 import com.google.common.collect.ClassToInstanceMap;
 import com.google.common.collect.ImmutableSet;
 import java.util.Set;
@@ -32,21 +31,20 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
  * All transactions and listener registrations are wrapped by the DataBrokerImpl
  * to allow binding aware components to use the DataBroker transparently.
  *
+ * <p>
  * Besides this the DataBrokerImpl and it's collaborators also cache data that
  * is already transformed from the binding independent to binding aware format
- *
-
  */
-public class BindingDOMDataBrokerAdapter extends AbstractForwardedDataBroker implements DataBroker, DataTreeChangeService {
-
-
+public class BindingDOMDataBrokerAdapter extends AbstractForwardedDataBroker
+        implements DataBroker, DataTreeChangeService {
     static final Factory<DataBroker> BUILDER_FACTORY = Builder::new;
     private final DataTreeChangeService treeChangeService;
 
     public BindingDOMDataBrokerAdapter(final DOMDataBroker domDataBroker, final BindingToNormalizedNodeCodec codec) {
         super(domDataBroker, codec);
-        final DOMDataTreeChangeService domTreeChange = (DOMDataTreeChangeService) domDataBroker.getSupportedExtensions().get(DOMDataTreeChangeService.class);
-        if(domTreeChange != null) {
+        final DOMDataTreeChangeService domTreeChange = (DOMDataTreeChangeService) domDataBroker
+                .getSupportedExtensions().get(DOMDataTreeChangeService.class);
+        if (domTreeChange != null) {
             treeChangeService = BindingDOMDataTreeChangeServiceAdapter.create(codec, domTreeChange);
         } else {
             treeChangeService = null;
@@ -96,12 +94,11 @@ public class BindingDOMDataBrokerAdapter extends AbstractForwardedDataBroker imp
     }
 
     @Override
-    public <T extends DataObject, L extends DataTreeChangeListener<T>> ListenerRegistration<L> registerDataTreeChangeListener(
-            final DataTreeIdentifier<T> treeId, final L listener) {
-        if(treeChangeService == null) {
+    public <T extends DataObject, L extends DataTreeChangeListener<T>> ListenerRegistration<L>
+            registerDataTreeChangeListener(final DataTreeIdentifier<T> treeId, final L listener) {
+        if (treeChangeService == null) {
             throw new UnsupportedOperationException("Underlying data broker does not expose DOMDataTreeChangeService.");
         }
         return treeChangeService.registerDataTreeChangeListener(treeId, listener);
     }
-
 }
index e0cd69b86f31323b422fdf0906896c5e88bce4d9..fa748f9f60aa73a1d931448ffcc9c807027154b9 100644 (file)
@@ -28,8 +28,8 @@ class BindingDOMDataTreeChangeListenerAdapter<T extends DataObject> implements D
     private final DataTreeChangeListener<T> listener;
     private final LogicalDatastoreType store;
 
-    BindingDOMDataTreeChangeListenerAdapter(final BindingToNormalizedNodeCodec codec, final DataTreeChangeListener<T> listener,
-            final LogicalDatastoreType store) {
+    BindingDOMDataTreeChangeListenerAdapter(final BindingToNormalizedNodeCodec codec,
+            final DataTreeChangeListener<T> listener, final LogicalDatastoreType store) {
         this.codec = Preconditions.checkNotNull(codec);
         this.listener = Preconditions.checkNotNull(listener);
         this.store = Preconditions.checkNotNull(store);
@@ -37,7 +37,8 @@ class BindingDOMDataTreeChangeListenerAdapter<T extends DataObject> implements D
 
     @Override
     public void onDataTreeChanged(final Collection<DataTreeCandidate> domChanges) {
-        final Collection<DataTreeModification<T>> bindingChanges = LazyDataTreeModification.from(codec, domChanges, store);
+        final Collection<DataTreeModification<T>> bindingChanges =
+                LazyDataTreeModification.from(codec, domChanges, store);
         listener.onDataTreeChanged(bindingChanges);
     }
 
index 28ca144b97c979b28241691f7e1f85b96466f13e..13b09d19cd187f48f3e367285ce657c7e6086255 100644 (file)
@@ -20,12 +20,12 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 
 /**
- *
  * Adapter exposing Binding {@link DataTreeChangeService} and wrapping
  * {@link DOMDataTreeChangeService} and is responsible for translation
  * and instantiation of {@link BindingDOMDataTreeChangeListenerAdapter}
  * adapters.
  *
+ * <p>
  * Each registered {@link DataTreeChangeListener} is wrapped using
  * adapter and registered directly to DOM service.
  */
@@ -46,16 +46,16 @@ final class BindingDOMDataTreeChangeServiceAdapter implements DataTreeChangeServ
     }
 
     @Override
-    public <T extends DataObject, L extends DataTreeChangeListener<T>> ListenerRegistration<L> registerDataTreeChangeListener(
-            final DataTreeIdentifier<T> treeId, final L listener) {
+    public <T extends DataObject, L extends DataTreeChangeListener<T>> ListenerRegistration<L>
+            registerDataTreeChangeListener(final DataTreeIdentifier<T> treeId, final L listener) {
         final DOMDataTreeIdentifier domIdentifier = toDomTreeIdentifier(treeId);
 
         @SuppressWarnings({ "rawtypes", "unchecked" })
         final BindingDOMDataTreeChangeListenerAdapter<T> domListener =
-                listener instanceof ClusteredDataTreeChangeListener ?
-                        new BindingClusteredDOMDataTreeChangeListenerAdapter<>(
-                                codec, (ClusteredDataTreeChangeListener) listener, treeId.getDatastoreType()) :
-                        new BindingDOMDataTreeChangeListenerAdapter<>(codec, listener, treeId.getDatastoreType());
+                listener instanceof ClusteredDataTreeChangeListener
+                        new BindingClusteredDOMDataTreeChangeListenerAdapter<>(
+                                codec, (ClusteredDataTreeChangeListener) listener, treeId.getDatastoreType())
+                        new BindingDOMDataTreeChangeListenerAdapter<>(codec, listener, treeId.getDatastoreType());
 
         final ListenerRegistration<BindingDOMDataTreeChangeListenerAdapter<T>> domReg =
                 dataTreeChangeService.registerDataTreeChangeListener(domIdentifier, domListener);
index f33148271f4ba85590a35452efd7dfc8899cce21..6861ff9b3cae870b9f06eb6b5b6f175973e8d760 100644 (file)
@@ -17,13 +17,15 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.impl.codec.DeserializationException;
 
-final class BindingDOMMountPointListenerAdapter<T extends MountPointListener> implements ListenerRegistration<T>, MountProvisionListener {
+final class BindingDOMMountPointListenerAdapter<T extends MountPointListener>
+        implements ListenerRegistration<T>, MountProvisionListener {
 
     private final T listener;
     private final ListenerRegistration<MountProvisionListener> registration;
     private final BindingToNormalizedNodeCodec codec;
 
-    public BindingDOMMountPointListenerAdapter(final T listener, final BindingToNormalizedNodeCodec codec, final DOMMountPointService mountService) {
+    BindingDOMMountPointListenerAdapter(final T listener, final BindingToNormalizedNodeCodec codec,
+            final DOMMountPointService mountService) {
         this.listener = listener;
         this.codec = codec;
         this.registration = mountService.registerProvisionListener(this);
@@ -45,14 +47,16 @@ final class BindingDOMMountPointListenerAdapter<T extends MountPointListener> im
             final InstanceIdentifier<? extends DataObject> bindingPath = toBinding(path);
             listener.onMountPointCreated(bindingPath);
         } catch (final DeserializationException e) {
-            BindingDOMMountPointServiceAdapter.LOG.error("Unable to translate mountPoint path {}. Omitting event.",path,e);
+            BindingDOMMountPointServiceAdapter.LOG.error("Unable to translate mountPoint path {}. Omitting event.",
+                    path, e);
         }
 
     }
 
-    private InstanceIdentifier<? extends DataObject> toBinding(final YangInstanceIdentifier path) throws DeserializationException {
+    private InstanceIdentifier<? extends DataObject> toBinding(final YangInstanceIdentifier path)
+            throws DeserializationException {
         final Optional<InstanceIdentifier<? extends DataObject>> instanceIdentifierOptional = codec.toBinding(path);
-        if(instanceIdentifierOptional.isPresent()) {
+        if (instanceIdentifierOptional.isPresent()) {
             return instanceIdentifierOptional.get();
         } else {
             throw new DeserializationException("Deserialization unsuccessful, " + instanceIdentifierOptional);
@@ -65,7 +69,8 @@ final class BindingDOMMountPointListenerAdapter<T extends MountPointListener> im
             final InstanceIdentifier<? extends DataObject> bindingPath = toBinding(path);
             listener.onMountPointRemoved(bindingPath);
         } catch (final DeserializationException e) {
-            BindingDOMMountPointServiceAdapter.LOG.error("Unable to translate mountPoint path {}. Omitting event.",path,e);
+            BindingDOMMountPointServiceAdapter.LOG.error("Unable to translate mountPoint path {}. Omitting event.",
+                    path, e);
         }
     }
-}
\ No newline at end of file
+}
index 8b88f0f5c01348ee3bacd9a4277682f699d7505b..174f973adedaf27e8911d29057ac68a004af1269 100644 (file)
@@ -21,9 +21,7 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 public class BindingDOMMountPointServiceAdapter implements MountPointService {
-
     public static final Logger LOG = LoggerFactory.getLogger(BindingDOMMountPointServiceAdapter.class);
 
     private final BindingToNormalizedNodeCodec codec;
@@ -47,7 +45,7 @@ public class BindingDOMMountPointServiceAdapter implements MountPointService {
 
         YangInstanceIdentifier domPath = codec.toYangInstanceIdentifierBlocking(mountPoint);
         Optional<DOMMountPoint> domMount = mountService.getMountPoint(domPath);
-        if(domMount.isPresent()) {
+        if (domMount.isPresent()) {
             return Optional.<MountPoint>fromNullable(bindingMountpoints.getUnchecked(domMount.get()));
         }
         return Optional.absent();
@@ -58,5 +56,4 @@ public class BindingDOMMountPointServiceAdapter implements MountPointService {
             T listener) {
         return new BindingDOMMountPointListenerAdapter<>(listener, codec, mountService);
     }
-
 }
index e6414c4576822ac5daee5e646dd50f2277569b3a..744c1c84b535bec8e6ebacfd2d7dfea99c66f405 100644 (file)
@@ -31,7 +31,8 @@ class BindingDOMNotificationListenerAdapter implements DOMNotificationListener {
     private final NotificationListener delegate;
     private final Map<SchemaPath,NotificationListenerInvoker> invokers;
 
-    public BindingDOMNotificationListenerAdapter(final BindingNormalizedNodeSerializer codec, final NotificationListener delegate) {
+    BindingDOMNotificationListenerAdapter(final BindingNormalizedNodeSerializer codec,
+            final NotificationListener delegate) {
         this.codec = codec;
         this.delegate = delegate;
         this.invokers = createInvokerMapFor(delegate.getClass());
@@ -45,7 +46,7 @@ class BindingDOMNotificationListenerAdapter implements DOMNotificationListener {
     }
 
     private Notification deserialize(final DOMNotification notification) {
-        if(notification instanceof LazySerializedDOMNotification) {
+        if (notification instanceof LazySerializedDOMNotification) {
             return ((LazySerializedDOMNotification) notification).getBindingData();
         }
         return codec.fromNormalizedNodeNotification(notification.getType(), notification.getBody());
@@ -59,15 +60,17 @@ class BindingDOMNotificationListenerAdapter implements DOMNotificationListener {
         return invokers.keySet();
     }
 
-    public static Map<SchemaPath, NotificationListenerInvoker> createInvokerMapFor(final Class<? extends NotificationListener> implClz) {
+    public static Map<SchemaPath, NotificationListenerInvoker> createInvokerMapFor(
+            final Class<? extends NotificationListener> implClz) {
         final Map<SchemaPath, NotificationListenerInvoker> builder = new HashMap<>();
-        for(final TypeToken<?> ifaceToken : TypeToken.of(implClz).getTypes().interfaces()) {
+        for (final TypeToken<?> ifaceToken : TypeToken.of(implClz).getTypes().interfaces()) {
             Class<?> iface = ifaceToken.getRawType();
-            if(NotificationListener.class.isAssignableFrom(iface) && BindingReflections.isBindingClass(iface)) {
+            if (NotificationListener.class.isAssignableFrom(iface) && BindingReflections.isBindingClass(iface)) {
                 @SuppressWarnings("unchecked")
-                final Class<? extends NotificationListener> listenerType = (Class<? extends NotificationListener>) iface;
+                final Class<? extends NotificationListener> listenerType =
+                        (Class<? extends NotificationListener>) iface;
                 final NotificationListenerInvoker invoker = NotificationListenerInvoker.from(listenerType);
-                for(final SchemaPath path : getNotificationTypes(listenerType)) {
+                for (final SchemaPath path : getNotificationTypes(listenerType)) {
                     builder.put(path, invoker);
                 }
             }
@@ -79,8 +82,8 @@ class BindingDOMNotificationListenerAdapter implements DOMNotificationListener {
         // TODO: Investigate possibility and performance impact if we cache this or expose
         // it from NotificationListenerInvoker
         final Set<SchemaPath> ret = new HashSet<>();
-        for(final Method method : type.getMethods()) {
-            if(BindingReflections.isNotificationCallback(method)) {
+        for (final Method method : type.getMethods()) {
+            if (BindingReflections.isNotificationCallback(method)) {
                 final Class<?> notification = method.getParameterTypes()[0];
                 final QName name = BindingReflections.findQName(notification);
                 ret.add(SchemaPath.create(true, name));
index 6f7e9e2c35aa8c34ebb8f0bf08e0d75f88d27420..ae3b5d504a5dcc1b2bcb8a8e123545c45ba38a05 100644 (file)
@@ -26,7 +26,8 @@ public class BindingDOMNotificationPublishServiceAdapter implements Notification
     private final BindingToNormalizedNodeCodec codecRegistry;
     private final DOMNotificationPublishService domPublishService;
 
-    public BindingDOMNotificationPublishServiceAdapter(final BindingToNormalizedNodeCodec codec, final DOMNotificationPublishService domPublishService) {
+    public BindingDOMNotificationPublishServiceAdapter(final BindingToNormalizedNodeCodec codec,
+            final DOMNotificationPublishService domPublishService) {
         this.codecRegistry = codec;
         this.domPublishService = domPublishService;
     }
@@ -53,8 +54,10 @@ public class BindingDOMNotificationPublishServiceAdapter implements Notification
     }
 
     @Override
-    public ListenableFuture<?> offerNotification(final Notification notification, final int timeout, final TimeUnit unit) throws InterruptedException {
-        ListenableFuture<?> offerResult = domPublishService.offerNotification(toDomNotification(notification), timeout, unit);
+    public ListenableFuture<?> offerNotification(final Notification notification, final int timeout,
+            final TimeUnit unit) throws InterruptedException {
+        ListenableFuture<?> offerResult = domPublishService.offerNotification(toDomNotification(notification),
+                timeout, unit);
         return DOMNotificationPublishService.REJECTED.equals(offerResult)
                 ? NotificationPublishService.REJECTED
                 : offerResult;
@@ -82,6 +85,5 @@ public class BindingDOMNotificationPublishServiceAdapter implements Notification
             final DOMNotificationPublishService domPublish = delegates.getInstance(DOMNotificationPublishService.class);
             return new BindingDOMNotificationPublishServiceAdapter(codec, domPublish);
         }
-
     }
 }
index 78a22f8a7182dd8277625e95a39c9abdf2111a5b..64ccef369465daec611a8b30b836523ff06e584a 100644 (file)
@@ -25,14 +25,16 @@ public class BindingDOMNotificationServiceAdapter implements NotificationService
     private final BindingNormalizedNodeSerializer codec;
     private final DOMNotificationService domNotifService;
 
-    public BindingDOMNotificationServiceAdapter(final BindingNormalizedNodeSerializer codec, final DOMNotificationService domNotifService) {
+    public BindingDOMNotificationServiceAdapter(final BindingNormalizedNodeSerializer codec,
+            final DOMNotificationService domNotifService) {
         this.codec = codec;
         this.domNotifService = domNotifService;
     }
 
     @Override
     public <T extends NotificationListener> ListenerRegistration<T> registerNotificationListener(final T listener) {
-        final BindingDOMNotificationListenerAdapter domListener = new BindingDOMNotificationListenerAdapter(codec, listener);
+        final BindingDOMNotificationListenerAdapter domListener =
+                new BindingDOMNotificationListenerAdapter(codec, listener);
         final ListenerRegistration<BindingDOMNotificationListenerAdapter> domRegistration =
                 domNotifService.registerNotificationListener(domListener, domListener.getSupportedNotifications());
         return new ListenerRegistrationImpl<>(listener, domRegistration);
@@ -43,10 +45,11 @@ public class BindingDOMNotificationServiceAdapter implements NotificationService
 
     }
 
-    private static class ListenerRegistrationImpl<T extends NotificationListener> extends AbstractListenerRegistration<T> {
+    private static class ListenerRegistrationImpl<T extends NotificationListener>
+            extends AbstractListenerRegistration<T> {
         private final ListenerRegistration<?> listenerRegistration;
 
-        public ListenerRegistrationImpl(final T listener, final ListenerRegistration<?> listenerRegistration) {
+        ListenerRegistrationImpl(final T listener, final ListenerRegistration<?> listenerRegistration) {
             super(listener);
             this.listenerRegistration = listenerRegistration;
         }
index 0e8a043cccb47f78bf6fa024841755946d9307d2..1d6932237bb16f34d84ac6fc5eb0ee6e22ed3a52 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.controller.md.sal.binding.impl;
 
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.CheckedFuture;
 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
@@ -14,9 +16,6 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
-import com.google.common.base.Optional;
-import com.google.common.util.concurrent.CheckedFuture;
-
 class BindingDOMReadTransactionAdapter extends AbstractForwardedTransaction<DOMDataReadOnlyTransaction> implements
         ReadOnlyTransaction {
 
@@ -35,5 +34,4 @@ class BindingDOMReadTransactionAdapter extends AbstractForwardedTransaction<DOMD
     public void close() {
         getDelegate().close();
     }
-
-}
\ No newline at end of file
+}
index e9c4efac531b0677945ae67547d035f5b54c0eb0..bebed4df8508ebd689d1b9b407887b711362e9de 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.controller.md.sal.binding.impl;
 
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.CheckedFuture;
 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
@@ -14,9 +16,6 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
-import com.google.common.base.Optional;
-import com.google.common.util.concurrent.CheckedFuture;
-
 class BindingDOMReadWriteTransactionAdapter extends
         BindingDOMWriteTransactionAdapter<DOMDataReadWriteTransaction> implements ReadWriteTransaction {
 
@@ -30,4 +29,4 @@ class BindingDOMReadWriteTransactionAdapter extends
             final LogicalDatastoreType store, final InstanceIdentifier<T> path) {
         return doRead(getDelegate(), store, path);
     }
-}
\ No newline at end of file
+}
index c971fc6a62e68d81ca1976bc83f9605ad25a679e..fa45b8ea7acf8744851a28703bc078842ce7c301 100644 (file)
@@ -11,11 +11,11 @@ import org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementationRegistrati
 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 
-class BindingDOMRpcAdapterRegistration<T extends RpcService> extends AbstractObjectRegistration<T>{
+class BindingDOMRpcAdapterRegistration<T extends RpcService> extends AbstractObjectRegistration<T> {
 
     private final DOMRpcImplementationRegistration<?> reg;
 
-    public BindingDOMRpcAdapterRegistration(T instance, DOMRpcImplementationRegistration<?> reg) {
+    BindingDOMRpcAdapterRegistration(T instance, DOMRpcImplementationRegistration<?> reg) {
         super(instance);
         this.reg = reg;
     }
index e67fba8920f5de47c17d8ae654eacd8694dcdc53..1554f1120f1a20f5a9ede41648167f982e2abae7 100644 (file)
@@ -36,14 +36,16 @@ import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
 public class BindingDOMRpcImplementationAdapter implements DOMRpcImplementation {
 
-    private static final Cache<Class<?>, RpcServiceInvoker> SERVICE_INVOKERS = CacheBuilder.newBuilder().weakKeys().build();
+    private static final Cache<Class<?>, RpcServiceInvoker> SERVICE_INVOKERS =
+            CacheBuilder.newBuilder().weakKeys().build();
 
     private final BindingNormalizedNodeSerializer codec;
     private final RpcServiceInvoker invoker;
     private final RpcService delegate;
     private final QName inputQname;
 
-    <T extends RpcService> BindingDOMRpcImplementationAdapter(final BindingNormalizedNodeSerializer codec, final Class<T> type, final Map<SchemaPath, Method> localNameToMethod, final T delegate) {
+    <T extends RpcService> BindingDOMRpcImplementationAdapter(final BindingNormalizedNodeSerializer codec,
+            final Class<T> type, final Map<SchemaPath, Method> localNameToMethod, final T delegate) {
         try {
             this.invoker = SERVICE_INVOKERS.get(type, () -> {
                 final Map<QName, Method> map = new HashMap<>();
@@ -64,7 +66,8 @@ public class BindingDOMRpcImplementationAdapter implements DOMRpcImplementation
 
     @Nonnull
     @Override
-    public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(@Nonnull final DOMRpcIdentifier rpc, final NormalizedNode<?, ?> input) {
+    public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(@Nonnull final DOMRpcIdentifier rpc,
+            final NormalizedNode<?, ?> input) {
         final SchemaPath schemaPath = rpc.getType();
         final DataObject bindingInput = input != null ? deserialize(rpc.getType(), input) : null;
         final ListenableFuture<RpcResult<?>> bindingResult = invoke(schemaPath, bindingInput);
@@ -83,7 +86,8 @@ public class BindingDOMRpcImplementationAdapter implements DOMRpcImplementation
         return JdkFutureAdapters.listenInPoolThread(invoker.invokeRpc(delegate, schemaPath.getLastComponent(), input));
     }
 
-    private CheckedFuture<DOMRpcResult, DOMRpcException> transformResult(final ListenableFuture<RpcResult<?>> bindingResult) {
+    private CheckedFuture<DOMRpcResult, DOMRpcException> transformResult(
+            final ListenableFuture<RpcResult<?>> bindingResult) {
         return LazyDOMRpcResultFuture.create(codec, bindingResult);
     }
 
index 1232035e033a5414a2376f28c3b524195e944717..252a17f1e543351f4cd5a9d31e686c9f57634d5d 100644 (file)
@@ -29,7 +29,8 @@ public class BindingDOMRpcProviderServiceAdapter {
     private final BindingToNormalizedNodeCodec codec;
     private final DOMRpcProviderService domRpcRegistry;
 
-    public BindingDOMRpcProviderServiceAdapter(final DOMRpcProviderService domRpcRegistry, final BindingToNormalizedNodeCodec codec) {
+    public BindingDOMRpcProviderServiceAdapter(final DOMRpcProviderService domRpcRegistry,
+            final BindingToNormalizedNodeCodec codec) {
         this.codec = codec;
         this.domRpcRegistry = domRpcRegistry;
     }
@@ -44,16 +45,19 @@ public class BindingDOMRpcProviderServiceAdapter {
         return register(type, implementation, toYangInstanceIdentifiers(paths));
     }
 
-    private <S extends RpcService, T extends S> ObjectRegistration<T> register(final Class<S> type, final T implementation, final Collection<YangInstanceIdentifier> rpcContextPaths) {
+    private <S extends RpcService, T extends S> ObjectRegistration<T> register(final Class<S> type,
+            final T implementation, final Collection<YangInstanceIdentifier> rpcContextPaths) {
         final Map<SchemaPath, Method> rpcs = codec.getRpcMethodToSchemaPath(type).inverse();
 
-        final BindingDOMRpcImplementationAdapter adapter = new BindingDOMRpcImplementationAdapter(codec.getCodecRegistry(), type, rpcs, implementation);
+        final BindingDOMRpcImplementationAdapter adapter = new BindingDOMRpcImplementationAdapter(
+                codec.getCodecRegistry(), type, rpcs, implementation);
         final Set<DOMRpcIdentifier> domRpcs = createDomRpcIdentifiers(rpcs.keySet(), rpcContextPaths);
         final DOMRpcImplementationRegistration<?> domReg = domRpcRegistry.registerRpcImplementation(adapter, domRpcs);
         return new BindingRpcAdapterRegistration<>(implementation, domReg);
     }
 
-    private static Set<DOMRpcIdentifier> createDomRpcIdentifiers(final Set<SchemaPath> rpcs, final Collection<YangInstanceIdentifier> paths) {
+    private static Set<DOMRpcIdentifier> createDomRpcIdentifiers(final Set<SchemaPath> rpcs,
+            final Collection<YangInstanceIdentifier> paths) {
         final Set<DOMRpcIdentifier> ret = new HashSet<>();
         for (final YangInstanceIdentifier path : paths) {
             for (final SchemaPath rpc : rpcs) {
index 4dc55d2e148c6d7f5c1c7dce1295b05f0ba17379..7955dcdf16405674e8fda23df538b952bea9beec 100644 (file)
@@ -11,6 +11,7 @@ import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
 import org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain;
 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
@@ -37,7 +38,7 @@ final class BindingDOMTransactionChainAdapter implements BindingTransactionChain
     private final DelegateChainListener domListener;
     private final TransactionChainListener bindingListener;
 
-    public BindingDOMTransactionChainAdapter(final DOMDataBroker chainFactory,
+    BindingDOMTransactionChainAdapter(final DOMDataBroker chainFactory,
             final BindingToNormalizedNodeCodec codec, final TransactionChainListener listener) {
         Preconditions.checkNotNull(chainFactory, "DOM Transaction chain factory must not be null");
         this.domListener = new DelegateChainListener();
@@ -87,27 +88,27 @@ final class BindingDOMTransactionChainAdapter implements BindingTransactionChain
             final WriteTransaction tx, final CheckedFuture<Void, TransactionCommitFailedException> future) {
         Futures.addCallback(future, new FutureCallback<Void>() {
             @Override
-            public void onFailure(final Throwable t) {
-                failTransactionChain(tx,t);
+            public void onFailure(final Throwable ex) {
+                failTransactionChain(tx,ex);
             }
 
             @Override
             public void onSuccess(final Void result) {
                 // Intentionally NOOP
             }
-        });
+        }, MoreExecutors.directExecutor());
 
         return future;
     }
 
-    private void failTransactionChain(final WriteTransaction tx, final Throwable t) {
+    private void failTransactionChain(final WriteTransaction tx, final Throwable ex) {
         /*
          *  We asume correct state change for underlaying transaction
          *
          * chain, so we are not changing any of our internal state
          * to mark that we failed.
          */
-        this.bindingListener.onTransactionChainFailed(this, tx, t);
+        this.bindingListener.onTransactionChainFailed(this, tx, ex);
     }
 
     @Override
index c0a71543e306eaa35786c59ad7b59797bf4b5cf3..6540ad96cc3fcaf3807cb12698372a4ed0579be2 100644 (file)
@@ -7,9 +7,10 @@
  */
 package org.opendaylight.controller.md.sal.binding.impl;
 
+import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.ListenableFuture;
 import java.util.ArrayList;
 import java.util.List;
-
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
@@ -24,9 +25,6 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 
-import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.ListenableFuture;
-
 class BindingDOMWriteTransactionAdapter<T extends DOMDataWriteTransaction> extends
         AbstractWriteTransaction<T> implements WriteTransaction {
 
@@ -49,7 +47,8 @@ class BindingDOMWriteTransactionAdapter<T extends DOMDataWriteTransaction> exten
 
     @Override
     protected void ensureParentsByMerge(final LogicalDatastoreType store,
-            final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalizedPath, final InstanceIdentifier<?> path) {
+            final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalizedPath,
+            final InstanceIdentifier<?> path) {
         List<PathArgument> currentArguments = new ArrayList<>();
         DataNormalizationOperation<?> currentOp = getCodec().getDataNormalizer().getRootOperation();
         for (PathArgument currentArg : normalizedPath.getPathArguments()) {
@@ -68,7 +67,7 @@ class BindingDOMWriteTransactionAdapter<T extends DOMDataWriteTransaction> exten
 
     @Override
     public void delete(final LogicalDatastoreType store, final InstanceIdentifier<?> path) {
-        doDelete( store, path);
+        doDelete(store, path);
     }
 
     @Override
@@ -85,4 +84,4 @@ class BindingDOMWriteTransactionAdapter<T extends DOMDataWriteTransaction> exten
     public boolean cancel() {
         return doCancel();
     }
-}
\ No newline at end of file
+}
index 8a92e5fc80f1b7d61c8504a06651b39c4a31532b..c176e2d31dde6fd731b2a40362f8f6c331c857a6 100644 (file)
@@ -12,7 +12,8 @@ import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener;
 import org.opendaylight.yangtools.concepts.AbstractListenerRegistration;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 
-class BindingDataTreeChangeListenerRegistration<L extends DataTreeChangeListener<?>> extends AbstractListenerRegistration<L> {
+class BindingDataTreeChangeListenerRegistration<L extends DataTreeChangeListener<?>>
+        extends AbstractListenerRegistration<L> {
 
     private final ListenerRegistration<?> domReg;
 
index 372771ff76a229ce821f3cc89848256475d5ebaa..ebcfcc67de42288eb101d45cd6fe3a2792962459 100644 (file)
@@ -40,7 +40,7 @@ public class BindingMountPointAdapter implements MountPoint {
     @Override
     public <T extends BindingService> Optional<T> getService(Class<T> service) {
         Optional<BindingService> potential = services.getUnchecked(service);
-        if(potential.isPresent()) {
+        if (potential.isPresent()) {
             return Optional.of(service.cast(potential.get()));
         }
         return Optional.absent();
index 5fade2c8c14c22c6138096232337b855bde05de9..7285d9ca3aed6fc14d44e83916f18f5c78609a98 100644 (file)
@@ -11,11 +11,11 @@ import org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementationRegistrati
 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 
-class BindingRpcAdapterRegistration<T extends RpcService> extends AbstractObjectRegistration<T>{
+class BindingRpcAdapterRegistration<T extends RpcService> extends AbstractObjectRegistration<T> {
 
     private final DOMRpcImplementationRegistration<?> reg;
 
-    public BindingRpcAdapterRegistration(T instance, DOMRpcImplementationRegistration<?> reg) {
+    BindingRpcAdapterRegistration(T instance, DOMRpcImplementationRegistration<?> reg) {
         super(instance);
         this.reg = reg;
     }
index 2d4d9b83e597f81ccc756f4cc8e21a170fca0449..e341a04d26b257bbccdb776527b1b9900b4aede6 100644 (file)
@@ -137,6 +137,7 @@ public class BindingToNormalizedNodeCodec
     /**
      * Converts Binding Map.Entry to DOM Map.Entry
      *
+     * <p>
      * Same as {@link #toNormalizedNode(InstanceIdentifier, DataObject)}.
      *
      * @param binding Map Entry with InstanceIdentifier as key and DataObject as value.
@@ -180,11 +181,15 @@ public class BindingToNormalizedNodeCodec
         return this.codecRegistry.toNormalizedNodeRpcData(data);
     }
 
+    public DataNormalizer getDataNormalizer() {
+        return this.legacyToNormalized;
+    }
+
     /**
-     *
      * Returns a Binding-Aware instance identifier from normalized
      * instance-identifier if it is possible to create representation.
      *
+     * <p>
      * Returns Optional.absent for cases where target is mixin node except
      * augmentation.
      *
@@ -199,10 +204,6 @@ public class BindingToNormalizedNodeCodec
         }
     }
 
-    public DataNormalizer getDataNormalizer() {
-        return this.legacyToNormalized;
-    }
-
     public Optional<Entry<InstanceIdentifier<? extends DataObject>, DataObject>> toBinding(
             @Nonnull final Entry<YangInstanceIdentifier, ? extends NormalizedNode<?, ?>> normalized)
             throws DeserializationException {
@@ -315,14 +316,14 @@ public class BindingToNormalizedNodeCodec
         return module;
     }
 
-    private void waitForSchema(final Collection<Class<?>> binding, final MissingSchemaException e) {
+    private void waitForSchema(final Collection<Class<?>> binding, final MissingSchemaException ex) {
         LOG.warn("Blocking thread to wait for schema convergence updates for {} {}", this.futureSchema.getDuration(),
                 this.futureSchema.getUnit());
         if (this.futureSchema.waitForSchema(binding)) {
             return;
         }
 
-        throw e;
+        throw ex;
     }
 
     private Method findRpcMethod(final Class<? extends RpcService> key, final RpcDefinition rpcDef)
index 97fcc07e98acf378f79f615d7cd78b9ce2f00888..f24eda2c4cea59811f022df89ebf70cdab9aa55c 100644 (file)
@@ -20,11 +20,14 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
  *
  * @author Thomas Pantelis
  */
-public class BindingToNormalizedNodeCodecFactory {
+public final class BindingToNormalizedNodeCodecFactory {
+    private BindingToNormalizedNodeCodecFactory() {
+    }
+
     /**
      * Creates a new BindingToNormalizedNodeCodec instance.
      *
-     * @param classLoadingStrategy
+     * @param classLoadingStrategy the ClassLoadingStrategy
      * @return the BindingToNormalizedNodeCodec instance
      */
     public static BindingToNormalizedNodeCodec newInstance(final ClassLoadingStrategy classLoadingStrategy) {
@@ -40,8 +43,8 @@ public class BindingToNormalizedNodeCodecFactory {
      * @param schemaService the SchemaService.
      * @return the ListenerRegistration
      */
-    public static ListenerRegistration<SchemaContextListener> registerInstance(final BindingToNormalizedNodeCodec instance,
-            final DOMSchemaService schemaService) {
+    public static ListenerRegistration<SchemaContextListener> registerInstance(
+            final BindingToNormalizedNodeCodec instance, final DOMSchemaService schemaService) {
         return schemaService.registerSchemaContextListener(instance);
     }
 }
index 84f12444e5a9473cced4d79f3d0d289c9245fe21..a639bb9c7a0ae494063dc114cd26a3c1d2f06e9d 100644 (file)
@@ -20,9 +20,7 @@ import org.opendaylight.yangtools.yang.binding.annotations.RoutingContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 abstract class ContextReferenceExtractor {
-
     private static final Logger LOG = LoggerFactory.getLogger(ContextReferenceExtractor.class);
     private static final ContextReferenceExtractor NULL_EXTRACTOR = new ContextReferenceExtractor() {
 
@@ -32,7 +30,6 @@ abstract class ContextReferenceExtractor {
         }
     };
 
-
     private static final LoadingCache<Class<?>, ContextReferenceExtractor> EXTRACTORS = CacheBuilder.newBuilder()
             .weakKeys().build(new CacheLoader<Class<?>, ContextReferenceExtractor>() {
 
@@ -53,11 +50,10 @@ abstract class ContextReferenceExtractor {
      * Extract context-reference (Instance Identifier) from
      * Binding DataObject.
      *
-     * @param obj DataObject from which context reference
-     * should be extracted.
+     * @param obj DataObject from which context reference should be extracted.
      *
-     * @return Instance Identifier representing context reference
-     * or null, if data object does not contain context reference.
+     * @return Instance Identifier representing context reference or null, if data object does not contain
+     *     context reference.
      */
     abstract @Nullable InstanceIdentifier<?> extract(DataObject obj);
 
@@ -88,7 +84,7 @@ abstract class ContextReferenceExtractor {
     private static Method findGetValueMethod(final Class<?> type, final Class<?> returnType) {
         try {
             final Method method = type.getMethod(GET_VALUE_NAME);
-            if(returnType.equals(method.getReturnType())) {
+            if (returnType.equals(method.getReturnType())) {
                 return method;
             }
         } catch (final NoSuchMethodException e) {
@@ -105,7 +101,4 @@ abstract class ContextReferenceExtractor {
         }
         return null;
     }
-
-
-
 }
index 599dfcc277ca9433ad36a7b634168cff22a3f389..cb02bfd445cda65b93c93653e4505896c16986d5 100644 (file)
@@ -19,25 +19,25 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 final class DirectGetterRouteContextExtractor extends ContextReferenceExtractor {
 
-    private final static Lookup PUBLIC_LOOKUP = MethodHandles.publicLookup();
+    private static final Lookup PUBLIC_LOOKUP = MethodHandles.publicLookup();
     private final MethodHandle handle;
 
     private DirectGetterRouteContextExtractor(final MethodHandle rawHandle) {
         handle = rawHandle.asType(MethodType.methodType(InstanceIdentifier.class, DataObject.class));
     }
 
-    static final ContextReferenceExtractor create(final Method getterMethod) throws IllegalAccessException {
+    static ContextReferenceExtractor create(final Method getterMethod) throws IllegalAccessException {
         final MethodHandle getterHandle = PUBLIC_LOOKUP.unreflect(getterMethod);
         return new DirectGetterRouteContextExtractor(getterHandle);
     }
 
     @Override
+    @SuppressWarnings("checkstyle:IllegalCatch")
     InstanceIdentifier<?> extract(final DataObject obj) {
         try {
             return (InstanceIdentifier<?>) handle.invokeExact(obj);
-        } catch (final Throwable e) {
+        } catch (Throwable e) {
             throw Throwables.propagate(e);
         }
     }
-
 }
index 0c316e809d5e9165b536d51f10046b2d853cee52..0c378390e529ca33dfd815fb9f9f36824a2cdeb8 100644 (file)
@@ -25,7 +25,7 @@ import org.opendaylight.yangtools.yang.common.QNameModule;
 
 class FutureSchema implements AutoCloseable {
 
-    @GuardedBy(value="postponedOperations")
+    @GuardedBy(value = "postponedOperations")
     private final Set<FutureSchemaPredicate> postponedOperations = new LinkedHashSet<>();
     private final long duration;
     private final TimeUnit unit;
@@ -40,11 +40,11 @@ class FutureSchema implements AutoCloseable {
 
     BindingRuntimeContext runtimeContext() {
         final BindingRuntimeContext localRuntimeContext = this.runtimeContext;
-        if(localRuntimeContext != null) {
+        if (localRuntimeContext != null) {
             return localRuntimeContext;
         }
 
-        if(waitForSchema(Collections.emptyList())) {
+        if (waitForSchema(Collections.emptyList())) {
             return this.runtimeContext;
         }
 
@@ -52,7 +52,7 @@ class FutureSchema implements AutoCloseable {
     }
 
     void onRuntimeContextUpdated(final BindingRuntimeContext context) {
-        synchronized(this.postponedOperations) {
+        synchronized (this.postponedOperations) {
             this.runtimeContext = context;
             for (final FutureSchemaPredicate op : this.postponedOperations) {
                 op.unlockIfPossible(context);
@@ -70,7 +70,7 @@ class FutureSchema implements AutoCloseable {
 
     @Override
     public void close() {
-        synchronized(this.postponedOperations) {
+        synchronized (this.postponedOperations) {
             for (final FutureSchemaPredicate op : this.postponedOperations) {
                 op.cancel();
             }
@@ -111,16 +111,16 @@ class FutureSchema implements AutoCloseable {
     }
 
     private boolean addPostponedOpAndWait(final FutureSchemaPredicate postponedOp) {
-        if(!this.waitEnabled) {
+        if (!this.waitEnabled) {
             return false;
         }
 
         final BindingRuntimeContext localRuntimeContext = this.runtimeContext;
-        synchronized(this.postponedOperations) {
+        synchronized (this.postponedOperations) {
             this.postponedOperations.add(postponedOp);
 
             // If the runtimeContext changed, this op may now be satisfied so check it.
-            if(localRuntimeContext != this.runtimeContext) {
+            if (localRuntimeContext != this.runtimeContext) {
                 postponedOp.unlockIfPossible(this.runtimeContext);
             }
         }
@@ -139,7 +139,7 @@ class FutureSchema implements AutoCloseable {
             } catch (final TimeoutException e) {
                 return false;
             } finally {
-                synchronized(FutureSchema.this.postponedOperations) {
+                synchronized (FutureSchema.this.postponedOperations) {
                     FutureSchema.this.postponedOperations.remove(this);
                 }
             }
@@ -157,5 +157,4 @@ class FutureSchema implements AutoCloseable {
 
         private final SettableFuture<?> schemaPromise = SettableFuture.create();
     }
-
 }
index 05725a120f5f341c395639c7652c453080e91cf7..f436c5ea9f3ad43b3089f7f025f020165e4a1a4d 100644 (file)
@@ -19,7 +19,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 final class GetValueRouteContextExtractor extends ContextReferenceExtractor {
 
-    private final static Lookup PUBLIC_LOOKUP = MethodHandles.publicLookup();
+    private static final Lookup PUBLIC_LOOKUP = MethodHandles.publicLookup();
     private final MethodHandle contextHandle;
     private final MethodHandle valueHandle;
 
@@ -36,6 +36,7 @@ final class GetValueRouteContextExtractor extends ContextReferenceExtractor {
     }
 
     @Override
+    @SuppressWarnings("checkstyle:IllegalCatch")
     InstanceIdentifier<?> extract(final DataObject obj) {
         try {
             final Object ctx = contextHandle.invokeExact(obj);
@@ -43,10 +44,8 @@ final class GetValueRouteContextExtractor extends ContextReferenceExtractor {
                 return (InstanceIdentifier<?>) valueHandle.invokeExact(ctx);
             }
             return null;
-        } catch (final Throwable e) {
+        } catch (Throwable e) {
             throw Throwables.propagate(e);
         }
     }
-
-
 }
index 525ea4e39140e646187e4c9428b19d10ef5e64b7..d12ec53c831b9f9f2921fe103148b18b92bb7684 100644 (file)
@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
  */
 final class LazyDataObjectModification<T extends DataObject> implements DataObjectModification<T> {
 
-    private final static Logger LOG = LoggerFactory.getLogger(LazyDataObjectModification.class);
+    private static final Logger LOG = LoggerFactory.getLogger(LazyDataObjectModification.class);
 
     private final BindingCodecTreeNode<T> codec;
     private final DataTreeCandidateNode domData;
@@ -60,8 +60,8 @@ final class LazyDataObjectModification<T extends DataObject> implements DataObje
         return new LazyDataObjectModification<>(codec,domData);
     }
 
-    private static Collection<DataObjectModification<? extends DataObject>> from(final BindingCodecTreeNode<?> parentCodec,
-            final Collection<DataTreeCandidateNode> domChildNodes) {
+    private static Collection<DataObjectModification<? extends DataObject>> from(
+            final BindingCodecTreeNode<?> parentCodec, final Collection<DataTreeCandidateNode> domChildNodes) {
         final List<DataObjectModification<? extends DataObject>> result = new ArrayList<>(domChildNodes.size());
         populateList(result, parentCodec, domChildNodes);
         return result;
@@ -106,6 +106,7 @@ final class LazyDataObjectModification<T extends DataObject> implements DataObje
             case UNKNOWN:
             case VISIBLE_CONTAINER:
                 result.add(create(childCodec, domChildNode));
+                break;
             default:
                 break;
         }
@@ -220,9 +221,10 @@ final class LazyDataObjectModification<T extends DataObject> implements DataObje
 
     @Override
     @SuppressWarnings("unchecked")
-    public <C extends Identifiable<K> & ChildOf<? super T>, K extends Identifier<C>> DataObjectModification<C> getModifiedChildListItem(
-            final Class<C> listItem, final K listKey) {
-        return (DataObjectModification<C>) getModifiedChild(new InstanceIdentifier.IdentifiableItem<>(listItem, listKey));
+    public <C extends Identifiable<K> & ChildOf<? super T>, K extends Identifier<C>> DataObjectModification<C>
+            getModifiedChildListItem(final Class<C> listItem, final K listKey) {
+        return (DataObjectModification<C>) getModifiedChild(new InstanceIdentifier.IdentifiableItem<>(
+                listItem, listKey));
     }
 
     @Override
index 5e9038e7d4c4ef9a13017208c9c07789d6197ea9..3b140120e49c53aa761caba39197e818a8aebabf 100644 (file)
@@ -33,7 +33,8 @@ class LazyDataTreeModification<T extends DataObject> implements DataTreeModifica
     private final DataTreeIdentifier<T> path;
     private final DataObjectModification<T> rootNode;
 
-    LazyDataTreeModification(final LogicalDatastoreType datastoreType, final InstanceIdentifier<T> path, final BindingCodecTreeNode<T> codec, final DataTreeCandidate domChange) {
+    LazyDataTreeModification(final LogicalDatastoreType datastoreType, final InstanceIdentifier<T> path,
+            final BindingCodecTreeNode<T> codec, final DataTreeCandidate domChange) {
         this.path = new DataTreeIdentifier<>(datastoreType, path);
         this.rootNode = LazyDataObjectModification.create(codec, domChange.getRootNode());
     }
@@ -49,8 +50,8 @@ class LazyDataTreeModification<T extends DataObject> implements DataTreeModifica
     }
 
     @SuppressWarnings({"unchecked", "rawtypes"})
-    static <T extends DataObject> DataTreeModification<T> create(final BindingToNormalizedNodeCodec codec, final DataTreeCandidate domChange,
-            final LogicalDatastoreType datastoreType) {
+    static <T extends DataObject> DataTreeModification<T> create(final BindingToNormalizedNodeCodec codec,
+            final DataTreeCandidate domChange, final LogicalDatastoreType datastoreType) {
         final Entry<InstanceIdentifier<?>, BindingCodecTreeNode<?>> codecCtx =
                 codec.getSubtreeCodec(domChange.getRootPath());
         return new LazyDataTreeModification(datastoreType, codecCtx.getKey(), codecCtx.getValue(), domChange);
index 8185446fcdf9823fd6bf72119e1dfb7d179eb627..5066ed53546bfb88ea4109be465874c05b1a8bc6 100644 (file)
@@ -22,11 +22,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
-/**
- *
- * FIXME: Should be this moved to binding-data-codec?
- *
- */
+ // FIXME: Should be this moved to binding-data-codec?
 class LazySerializedContainerNode implements ContainerNode {
 
     private final NodeIdentifier identifier;
index ffab566e68e03c8dda5cbddcb418accbc47a7476..093bcddb7d398f9e5e5c98840d89dd304ad64855 100644 (file)
@@ -17,6 +17,7 @@ import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 /**
  * Lazy serialized implementation of DOM Notification.
  *
+ * <p>
  * This implementation performs serialization of data, only if receiver
  * of notification actually accessed data from notification.
  *
@@ -29,7 +30,8 @@ public final class LazySerializedDOMNotification implements DOMNotification {
 
     private ContainerNode domBody;
 
-    private LazySerializedDOMNotification(final BindingNormalizedNodeSerializer codec, final Notification data, final SchemaPath type) {
+    private LazySerializedDOMNotification(final BindingNormalizedNodeSerializer codec, final Notification data,
+            final SchemaPath type) {
         this.codec = codec;
         this.data = data;
         this.type = type;
index c6ea9db3d861967003be34a1c6f92d13ecc2801c..c0232298245fe95a73ddae1e257208d932731445 100644 (file)
@@ -14,6 +14,7 @@ import com.google.common.collect.ImmutableMap;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
@@ -63,7 +64,7 @@ class RpcServiceAdapter implements InvocationHandler {
 
     private ListenableFuture<RpcResult<?>> invoke0(final SchemaPath schemaPath, final NormalizedNode<?, ?> input) {
         final CheckedFuture<DOMRpcResult, DOMRpcException> result = delegate.invokeRpc(schemaPath, input);
-        if(result instanceof LazyDOMRpcResultFuture) {
+        if (result instanceof LazyDOMRpcResultFuture) {
             return ((LazyDOMRpcResultFuture) result).getBindingFuture();
         }
 
@@ -83,7 +84,7 @@ class RpcServiceAdapter implements InvocationHandler {
     }
 
     @Override
-    public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
+    public Object invoke(final Object proxyObj, final Method method, final Object[] args) throws Throwable {
 
         final RpcInvocationStrategy rpc = rpcNames.get(method);
         if (rpc != null) {
@@ -97,33 +98,33 @@ class RpcServiceAdapter implements InvocationHandler {
         }
 
         if (isObjectMethod(method)) {
-            return callObjectMethod(proxy, method, args);
+            return callObjectMethod(proxyObj, method, args);
         }
         throw new UnsupportedOperationException("Method " + method.toString() + "is unsupported.");
     }
 
-    private static boolean isObjectMethod(final Method m) {
-        switch (m.getName()) {
+    private static boolean isObjectMethod(final Method method) {
+        switch (method.getName()) {
             case "toString":
-                return (m.getReturnType().equals(String.class) && m.getParameterTypes().length == 0);
+                return method.getReturnType().equals(String.class) && method.getParameterTypes().length == 0;
             case "hashCode":
-                return (m.getReturnType().equals(int.class) && m.getParameterTypes().length == 0);
+                return method.getReturnType().equals(int.class) && method.getParameterTypes().length == 0;
             case "equals":
-                return (m.getReturnType().equals(boolean.class) && m.getParameterTypes().length == 1 && m
-                        .getParameterTypes()[0] == Object.class);
+                return method.getReturnType().equals(boolean.class) && method.getParameterTypes().length == 1 && method
+                        .getParameterTypes()[0] == Object.class;
             default:
                 return false;
         }
     }
 
-    private Object callObjectMethod(final Object self, final Method m, final Object[] args) {
-        switch (m.getName()) {
+    private Object callObjectMethod(final Object self, final Method method, final Object[] args) {
+        switch (method.getName()) {
             case "toString":
                 return type.getName() + "$Adapter{delegate=" + delegate.toString() + "}";
             case "hashCode":
                 return System.identityHashCode(self);
             case "equals":
-                return (self == args[0]);
+                return self == args[0];
             default:
                 return null;
         }
@@ -141,7 +142,7 @@ class RpcServiceAdapter implements InvocationHandler {
                 bindingResult = null;
             }
             return RpcResult.class.cast(RpcResultBuilder.success(bindingResult).build());
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     private abstract class RpcInvocationStrategy {
@@ -165,7 +166,6 @@ class RpcServiceAdapter implements InvocationHandler {
         final SchemaPath getRpcName() {
             return rpcName;
         }
-
     }
 
     private final class NonRoutedStrategy extends RpcInvocationStrategy {
@@ -178,7 +178,6 @@ class RpcServiceAdapter implements InvocationHandler {
         NormalizedNode<?, ?> serialize(final DataObject input) {
             return LazySerializedContainerNode.create(getRpcName(), input, codec.getCodecRegistry());
         }
-
     }
 
     private final class RoutedStrategy extends RpcInvocationStrategy {
@@ -204,6 +203,5 @@ class RpcServiceAdapter implements InvocationHandler {
             }
             return LazySerializedContainerNode.create(getRpcName(), input, codec.getCodecRegistry());
         }
-
     }
 }
index 655a176d05aa30e0839c6e08e1a5c0d777d8959e..8fc838b16161505e505f2dcde1a3f7f3f14f9ad1 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.controller.md.sal.binding.spi;
 
-
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ClassToInstanceMap;
 import com.google.common.collect.ImmutableClassToInstanceMap;
@@ -21,15 +20,15 @@ public abstract class AdapterBuilder<T,D> implements Builder<T> {
 
     public abstract Set<? extends Class<? extends D>> getRequiredDelegates();
 
-    protected abstract T createInstance(ClassToInstanceMap<D> delegates);
+    protected abstract T createInstance(ClassToInstanceMap<D> classToInstanceMap);
 
     private void checkAllRequiredServices() {
-        for(final Class<? extends D> type : getRequiredDelegates()) {
+        for (final Class<? extends D> type : getRequiredDelegates()) {
             Preconditions.checkState(delegates.get(type) != null, "Requires service %s is not defined.",type);
         }
     }
 
-    public final <V extends D>void addDelegate(final Class<V> type,final D impl) {
+    public final <V extends D> void addDelegate(final Class<V> type,final D impl) {
         delegates.put(type,impl);
     }
 
@@ -38,5 +37,4 @@ public abstract class AdapterBuilder<T,D> implements Builder<T> {
         checkAllRequiredServices();
         return createInstance(ImmutableClassToInstanceMap.<D,D>copyOf(delegates));
     }
-
 }
index 7919a8fba4e7f825c4f486a3a8254e2d24a6b6da..ea3888e14d2287b7f7ff44d2fb8300691d67bd4c 100644 (file)
@@ -18,10 +18,10 @@ public abstract class AdapterLoader<T, D> extends CacheLoader<Class<? extends T>
     public Optional<T> load(final Class<? extends T> key) {
 
         final AdapterBuilder<? extends T, D> builder = createBuilder(key);
-        for(final Class<? extends D> reqDeleg : builder.getRequiredDelegates()) {
+        for (final Class<? extends D> reqDeleg : builder.getRequiredDelegates()) {
             final D deleg = getDelegate(reqDeleg);
-            if(deleg != null) {
-                builder.addDelegate(reqDeleg,deleg);
+            if (deleg != null) {
+                builder.addDelegate(reqDeleg, deleg);
             } else {
                 return Optional.absent();
             }
@@ -34,5 +34,4 @@ public abstract class AdapterLoader<T, D> extends CacheLoader<Class<? extends T>
 
     @Nonnull
     protected abstract AdapterBuilder<? extends T, D> createBuilder(Class<? extends T> key);
-
 }
index cdf29f687e80bf848efc661dc86707059261dcb0..6098684d7c75093fd973e5767a11acb4b1156140 100644 (file)
@@ -19,13 +19,13 @@ import java.util.concurrent.RejectedExecutionException;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
+import javassist.ClassPool;
 import org.apache.commons.lang3.StringUtils;
 import org.opendaylight.mdsal.binding.generator.util.JavassistUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import javassist.ClassPool;
 
-public class SingletonHolder {
+public final class SingletonHolder {
     private static final Logger LOG = LoggerFactory.getLogger(SingletonHolder.class);
 
     public static final ClassPool CLASS_POOL = ClassPool.getDefault();
@@ -42,7 +42,12 @@ public class SingletonHolder {
     private static ListeningExecutorService COMMIT_EXECUTOR = null;
     private static ListeningExecutorService CHANGE_EVENT_EXECUTOR = null;
 
+    private SingletonHolder() {
+    }
+
     /**
+     * Deprecated.
+     *
      * @deprecated This method is only used from configuration modules and thus callers of it
      *             should use service injection to make the executor configurable.
      */
@@ -74,28 +79,26 @@ public class SingletonHolder {
                 }
 
                 @Override
-                public boolean offer(final Runnable r) {
+                public boolean offer(final Runnable runnrunnableable) {
                     // ThreadPoolExecutor will spawn a new thread after core size is reached only
                     // if the queue.offer returns false.
                     return false;
                 }
             };
 
-            final ThreadFactory factory = new ThreadFactoryBuilder()
-            .setDaemon(true)
-            .setNameFormat("md-sal-binding-notification-%d")
-            .build();
-
-            final ThreadPoolExecutor executor = new ThreadPoolExecutor(CORE_NOTIFICATION_THREADS, MAX_NOTIFICATION_THREADS,
-                    NOTIFICATION_THREAD_LIFE, TimeUnit.SECONDS, queue, factory,
-                    // if the max threads are met, then it will raise a rejectedExecution. We then push to the queue.
-                    (r, executor1) -> {
-                        try {
-                            executor1.getQueue().put(r);
-                        } catch (final InterruptedException e) {
-                            throw new RejectedExecutionException("Interrupted while waiting on the queue", e);
-                        }
-                    });
+            final ThreadFactory factory = new ThreadFactoryBuilder().setDaemon(true)
+                    .setNameFormat("md-sal-binding-notification-%d").build();
+
+            final ThreadPoolExecutor executor = new ThreadPoolExecutor(CORE_NOTIFICATION_THREADS,
+                MAX_NOTIFICATION_THREADS, NOTIFICATION_THREAD_LIFE, TimeUnit.SECONDS, queue, factory,
+                // if the max threads are met, then it will raise a rejectedExecution. We then push to the queue.
+                (runnable, executor1) -> {
+                    try {
+                        executor1.getQueue().put(runnable);
+                    } catch (final InterruptedException e) {
+                        throw new RejectedExecutionException("Interrupted while waiting on the queue", e);
+                    }
+                });
 
             NOTIFICATION_EXECUTOR = MoreExecutors.listeningDecorator(executor);
         }
@@ -104,13 +107,16 @@ public class SingletonHolder {
     }
 
     /**
+     * Deprecated.
+     *
      * @deprecated This method is only used from configuration modules and thus callers of it
      *             should use service injection to make the executor configurable.
      */
     @Deprecated
     public static synchronized ListeningExecutorService getDefaultCommitExecutor() {
         if (COMMIT_EXECUTOR == null) {
-            final ThreadFactory factory = new ThreadFactoryBuilder().setDaemon(true).setNameFormat("md-sal-binding-commit-%d").build();
+            final ThreadFactory factory = new ThreadFactoryBuilder().setDaemon(true)
+                    .setNameFormat("md-sal-binding-commit-%d").build();
             /*
              * FIXME: this used to be newCacheThreadPool(), but MD-SAL does not have transaction
              *        ordering guarantees, which means that using a concurrent threadpool results
@@ -127,7 +133,8 @@ public class SingletonHolder {
 
     public static ExecutorService getDefaultChangeEventExecutor() {
         if (CHANGE_EVENT_EXECUTOR == null) {
-            final ThreadFactory factory = new ThreadFactoryBuilder().setDaemon(true).setNameFormat("md-sal-binding-change-%d").build();
+            final ThreadFactory factory = new ThreadFactoryBuilder().setDaemon(true)
+                    .setNameFormat("md-sal-binding-change-%d").build();
             /*
              * FIXME: this used to be newCacheThreadPool(), but MD-SAL does not have transaction
              *        ordering guarantees, which means that using a concurrent threadpool results
index d91737154754750a1e3a2aa309c9c8953ee63854..f5f2b76f9466655487af8411d9e0ae9379dac8bd 100644 (file)
@@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory;
 public class RootBindingAwareBroker implements Mutable, Identifiable<String>, BindingAwareBroker, AutoCloseable,
         RpcProviderRegistry {
 
-    private final static Logger LOG = LoggerFactory.getLogger(RootBindingAwareBroker.class);
+    private static final Logger LOG = LoggerFactory.getLogger(RootBindingAwareBroker.class);
 
     RootSalInstance controllerRoot;
 
@@ -143,17 +143,17 @@ public class RootBindingAwareBroker implements Mutable, Identifiable<String>, Bi
         return registerConsumer(consumer);
     }
 
-    @Override
-    public ProviderContext registerProvider(final BindingAwareProvider provider, final BundleContext ctx) {
-        return registerProvider(provider);
-    }
-
     @Override
     public ConsumerContext registerConsumer(final BindingAwareConsumer consumer) {
         checkState(supportedConsumerServices != null, "Broker is not initialized.");
         return BindingContextUtils.createConsumerContextAndInitialize(consumer, supportedConsumerServices);
     }
 
+    @Override
+    public ProviderContext registerProvider(final BindingAwareProvider provider, final BundleContext ctx) {
+        return registerProvider(provider);
+    }
+
     @Override
     public ProviderContext registerProvider(final BindingAwareProvider provider) {
         checkState(supportedProviderServices != null, "Broker is not initialized.");
@@ -183,9 +183,9 @@ public class RootBindingAwareBroker implements Mutable, Identifiable<String>, Bi
     }
 
     @Override
-    public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L> registerRouteChangeListener(
-            final L arg0) {
-        return getRoot().registerRouteChangeListener(arg0);
+    public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L>
+            registerRouteChangeListener(final L listener) {
+        return getRoot().registerRouteChangeListener(listener);
     }
 
     public class RootSalInstance extends
@@ -196,5 +196,4 @@ public class RootBindingAwareBroker implements Mutable, Identifiable<String>, Bi
             super(rpcRegistry, notificationBroker);
         }
     }
-
 }
index 8c280e381fe527fefe661b2c6b07d16b2bcf6d76..a3d934858dbe7277bd1835983906c2c7b0fbabb5 100644 (file)
@@ -13,6 +13,7 @@ import static org.mockito.Matchers.isA;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.reset;
 import static org.mockito.Mockito.verify;
+
 import java.util.Collection;
 import org.hamcrest.Description;
 import org.junit.Before;
@@ -31,8 +32,8 @@ import org.opendaylight.controller.md.sal.dom.api.ClusteredDOMDataTreeChangeList
 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeIdentifier;
-import org.opendaylight.mdsal.binding.generator.impl.GeneratedClassLoadingStrategy;
 import org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry;
+import org.opendaylight.mdsal.binding.generator.impl.GeneratedClassLoadingStrategy;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.Top;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -70,11 +71,13 @@ public class BindingDOMDataTreeChangeServiceAdapterTest {
 
     @Test
     public void testRegisterDataTreeChangeListener() {
-        final BindingToNormalizedNodeCodec codec = new BindingToNormalizedNodeCodec(this.classLoadingStrategy, this.codecRegistry);
+        final BindingToNormalizedNodeCodec codec =
+                new BindingToNormalizedNodeCodec(this.classLoadingStrategy, this.codecRegistry);
 
         final DataTreeChangeService service = BindingDOMDataTreeChangeServiceAdapter.create(codec, this.mockDOMService);
 
-        doReturn(this.mockDOMReg).when(this.mockDOMService).registerDataTreeChangeListener(domDataTreeIdentifier(this.mockYangID),
+        doReturn(this.mockDOMReg).when(this.mockDOMService).registerDataTreeChangeListener(
+                domDataTreeIdentifier(this.mockYangID),
                 any(DOMDataTreeChangeListener.class));
         final DataTreeIdentifier<Top> treeId = new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, TOP_PATH);
         final TestClusteredDataTreeChangeListener mockClusteredListener = new TestClusteredDataTreeChangeListener();
@@ -84,8 +87,8 @@ public class BindingDOMDataTreeChangeServiceAdapterTest {
                 isA(ClusteredDOMDataTreeChangeListener.class));
 
         reset(this.mockDOMService);
-        doReturn(this.mockDOMReg).when(this.mockDOMService).registerDataTreeChangeListener(domDataTreeIdentifier(this.mockYangID),
-                any(DOMDataTreeChangeListener.class));
+        doReturn(this.mockDOMReg).when(this.mockDOMService).registerDataTreeChangeListener(
+                domDataTreeIdentifier(this.mockYangID), any(DOMDataTreeChangeListener.class));
         final TestDataTreeChangeListener mockNonClusteredListener = new TestDataTreeChangeListener();
         service.registerDataTreeChangeListener(treeId , mockNonClusteredListener);
 
@@ -98,8 +101,8 @@ public class BindingDOMDataTreeChangeServiceAdapterTest {
             @Override
             public boolean matches(final Object argument) {
                 final DOMDataTreeIdentifier treeId = (DOMDataTreeIdentifier) argument;
-                return (treeId.getDatastoreType() == LogicalDatastoreType.CONFIGURATION) &&
-                        yangID.equals(treeId.getRootIdentifier());
+                return treeId.getDatastoreType() == LogicalDatastoreType.CONFIGURATION
+                        && yangID.equals(treeId.getRootIdentifier());
             }
 
             @Override
index b05e88bc85fcfca122c5cbed69f5b4ef5aa3c39d..a72eba5d8383eeba8738c59b6a38d8c73a54bd09 100644 (file)
@@ -55,12 +55,14 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
     private static final TopLevelListKey TOP_FOO_KEY = new TopLevelListKey("foo");
     private static final InstanceIdentifier<TopLevelList> BA_TOP_LEVEL_LIST = InstanceIdentifier
             .builder(Top.class).child(TopLevelList.class, TOP_FOO_KEY).build();
-    private static final InstanceIdentifier<TreeLeafOnlyAugment> BA_TREE_LEAF_ONLY = BA_TOP_LEVEL_LIST.augmentation(TreeLeafOnlyAugment.class);
-    private static final InstanceIdentifier<TreeComplexUsesAugment> BA_TREE_COMPLEX_USES = BA_TOP_LEVEL_LIST.augmentation(TreeComplexUsesAugment.class);
+    private static final InstanceIdentifier<TreeLeafOnlyAugment> BA_TREE_LEAF_ONLY =
+            BA_TOP_LEVEL_LIST.augmentation(TreeLeafOnlyAugment.class);
+    private static final InstanceIdentifier<TreeComplexUsesAugment> BA_TREE_COMPLEX_USES =
+            BA_TOP_LEVEL_LIST.augmentation(TreeComplexUsesAugment.class);
     private static final QName SIMPLE_VALUE_QNAME = QName.create(TreeComplexUsesAugment.QNAME, "simple-value");
     private static final QName NAME_QNAME = QName.create(Top.QNAME, "name");
-    private static final YangInstanceIdentifier BI_TOP_LEVEL_LIST = YangInstanceIdentifier.builder().
-            node(Top.QNAME).node(TopLevelList.QNAME).nodeWithKey(
+    private static final YangInstanceIdentifier BI_TOP_LEVEL_LIST = YangInstanceIdentifier.builder()
+            .node(Top.QNAME).node(TopLevelList.QNAME).nodeWithKey(
                     TopLevelList.QNAME, NAME_QNAME, TOP_FOO_KEY.getName()).build();
 
 
@@ -68,11 +70,13 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
     private SchemaContext context;
 
     @Override
-    protected void setupWithSchema(final SchemaContext context) {
-        this.context = context;
-        final DataObjectSerializerGenerator streamWriter = StreamWriterGenerator.create(JavassistUtils.forClassPool(ClassPool.getDefault()));
+    protected void setupWithSchema(final SchemaContext schemaContext) {
+        this.context = schemaContext;
+        final DataObjectSerializerGenerator streamWriter = StreamWriterGenerator
+                .create(JavassistUtils.forClassPool(ClassPool.getDefault()));
         final BindingNormalizedNodeCodecRegistry registry = new BindingNormalizedNodeCodecRegistry(streamWriter);
-        this.codec = new BindingToNormalizedNodeCodec(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), registry, true);
+        this.codec = new BindingToNormalizedNodeCodec(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(),
+                registry, true);
     }
 
     @Test
@@ -86,22 +90,25 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
     @Test
     public void testLeafOnlyAugmentationSerialization() {
         this.codec.onGlobalContextUpdated(this.context);
-        final PathArgument leafOnlyLastArg = this.codec.toYangInstanceIdentifier(BA_TREE_LEAF_ONLY).getLastPathArgument();
+        final PathArgument leafOnlyLastArg = this.codec.toYangInstanceIdentifier(BA_TREE_LEAF_ONLY)
+                .getLastPathArgument();
         assertTrue(leafOnlyLastArg instanceof AugmentationIdentifier);
         assertTrue(((AugmentationIdentifier) leafOnlyLastArg).getPossibleChildNames().contains(SIMPLE_VALUE_QNAME));
     }
 
     @Test
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public void testToYangInstanceIdentifierBlocking() {
         this.codec.onGlobalContextUpdated(new EmptySchemaContext());
 
         final CountDownLatch done = new CountDownLatch(1);
         final AtomicReference<YangInstanceIdentifier> yangId = new AtomicReference<>();
         final AtomicReference<RuntimeException> error = new AtomicReference<>();
+
         new Thread(() -> {
             try {
                 yangId.set(BindingNormalizedCodecTest.this.codec.toYangInstanceIdentifierBlocking(BA_TOP_LEVEL_LIST));
-            } catch(final RuntimeException e) {
+            } catch (RuntimeException e) {
                 error.set(e);
             } finally {
                 done.countDown();
@@ -113,7 +120,7 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
 
         assertEquals("toYangInstanceIdentifierBlocking completed", true,
                 Uninterruptibles.awaitUninterruptibly(done, 3, TimeUnit.SECONDS));
-        if(error.get() != null) {
+        if (error.get() != null) {
             throw error.get();
         }
 
@@ -131,14 +138,16 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
         testGetRpcMethodToSchemaPath();
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private void testGetRpcMethodToSchemaPath() {
         final CountDownLatch done = new CountDownLatch(1);
         final AtomicReference<ImmutableBiMap<Method, SchemaPath>> retMap = new AtomicReference<>();
         final AtomicReference<RuntimeException> error = new AtomicReference<>();
         new Thread(() -> {
             try {
-                retMap.set(BindingNormalizedCodecTest.this.codec.getRpcMethodToSchemaPath(OpendaylightTestRpcServiceService.class));
-            } catch(final RuntimeException e) {
+                retMap.set(BindingNormalizedCodecTest.this.codec.getRpcMethodToSchemaPath(
+                        OpendaylightTestRpcServiceService.class));
+            } catch (RuntimeException e) {
                 error.set(e);
             } finally {
                 done.countDown();
@@ -150,12 +159,12 @@ public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
 
         assertEquals("getRpcMethodToSchemaPath completed", true,
                 Uninterruptibles.awaitUninterruptibly(done, 3, TimeUnit.SECONDS));
-        if(error.get() != null) {
+        if (error.get() != null) {
             throw error.get();
         }
 
-        for(final Method method: retMap.get().keySet()) {
-            if(method.getName().equals("rockTheHouse")) {
+        for (final Method method: retMap.get().keySet()) {
+            if (method.getName().equals("rockTheHouse")) {
                 return;
             }
         }
index a38f3f1539416daa7493959fa08af3e28831d616..3e1a688f44d5a25d1173ab04182051a7a98b158b 100644 (file)
@@ -71,4 +71,4 @@ public final class ContextExtractorTest {
         final InstanceIdentifier<?> extractedValue = extractor.extract(TEST_GROUPING);
         assertSame(TEST_ROUTE,extractedValue);
     }
- }
+}
index f43352d1018e3345dbbd7188d5fb4947b7bb630a..dd434b8152a61f4165b41a275d2c52a7002b0e82 100644 (file)
@@ -10,17 +10,16 @@ package org.opendaylight.controller.md.sal.binding.impl.test;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-import java.util.concurrent.TimeUnit;
-import org.opendaylight.controller.md.sal.binding.compat.HeliumNotificationProviderServiceAdapter;
-
 import com.google.common.collect.ImmutableList;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
 import org.opendaylight.controller.md.sal.binding.api.NotificationService;
+import org.opendaylight.controller.md.sal.binding.compat.HeliumNotificationProviderServiceAdapter;
 import org.opendaylight.controller.md.sal.binding.test.AbstractNotificationBrokerTest;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.OpendaylightMdsalListTestListener;
@@ -39,7 +38,8 @@ public class BackwardsCompatibleNotificationBrokerTest extends AbstractNotificat
     public void initTest() {
         final NotificationService notificationService = getNotificationService();
         final NotificationPublishService notificationPublishService = getNotificationPublishService();
-        notificationProviderService = new HeliumNotificationProviderServiceAdapter(notificationPublishService, notificationService);
+        notificationProviderService = new HeliumNotificationProviderServiceAdapter(notificationPublishService,
+                notificationService);
     }
 
     private TwoLevelListChanged createTestData() {
@@ -66,15 +66,16 @@ public class BackwardsCompatibleNotificationBrokerTest extends AbstractNotificat
 
     private static class NotifTestListenerChild extends  NotifTestListener {
 
-        public NotifTestListenerChild(final CountDownLatch latch) {
+        NotifTestListenerChild(final CountDownLatch latch) {
             super(latch);
         }
     }
+
     private static class NotifTestListener implements OpendaylightMdsalListTestListener {
-        private List<TwoLevelListChanged> receivedNotifications = new ArrayList<>();
-        private CountDownLatch latch;
+        private final List<TwoLevelListChanged> receivedNotifications = new ArrayList<>();
+        private final CountDownLatch latch;
 
-        public NotifTestListener(CountDownLatch latch) {
+        NotifTestListener(CountDownLatch latch) {
             this.latch = latch;
         }
 
@@ -88,5 +89,4 @@ public class BackwardsCompatibleNotificationBrokerTest extends AbstractNotificat
             return receivedNotifications;
         }
     }
-
 }
index 09a128b481d75858563299ba4ef5d02dacee7aa9..3506f4ba19583fe0f1b92f24c69ade604af807ee 100644 (file)
@@ -55,7 +55,8 @@ public class BindingDOMDataBrokerAdapterTest {
     @Test
     public void testClusteredDataChangeListernerRegisteration() {
 
-        final BindingToNormalizedNodeCodec codec = new BindingToNormalizedNodeCodec(this.classLoadingStrategy, this.codecRegistry);
+        final BindingToNormalizedNodeCodec codec =
+                new BindingToNormalizedNodeCodec(this.classLoadingStrategy, this.codecRegistry);
 
         try (BindingDOMDataBrokerAdapter bindingDOMDataBrokerAdapter = new BindingDOMDataBrokerAdapter(this.dataBroker,
                 codec)) {
@@ -67,7 +68,7 @@ public class BindingDOMDataBrokerAdapterTest {
                     .forClass(LogicalDatastoreType.class);
             final ArgumentCaptor<AsyncDataBroker.DataChangeScope> dataChangeScope = ArgumentCaptor
                     .forClass(AsyncDataBroker.DataChangeScope.class);
-            final ArgumentCaptor<YangInstanceIdentifier> yangInstanceIdentifier = ArgumentCaptor
+            final ArgumentCaptor<YangInstanceIdentifier> yangIidCapture = ArgumentCaptor
                     .forClass(YangInstanceIdentifier.class);
 
             final TestListener listener = new TestListener();
@@ -75,7 +76,7 @@ public class BindingDOMDataBrokerAdapterTest {
             bindingDOMDataBrokerAdapter.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL, TOP_PATH,
                     listener, AsyncDataBroker.DataChangeScope.BASE);
             Mockito.verify(this.dataBroker).registerDataChangeListener(logicalDatastoreType.capture(),
-                    yangInstanceIdentifier.capture(), clusteredDOMListener.capture(), dataChangeScope.capture());
+                    yangIidCapture.capture(), clusteredDOMListener.capture(), dataChangeScope.capture());
         }
 
     }
index 9f9276954b08aa402661808f88205375a57b1e30..41c3375b2fed950a6509f3f3d0dc9aeb47573972 100644 (file)
@@ -31,7 +31,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 /**
  * Regression test suite for Bug 1125 - Can't detect switch disconnection
- * https://bugs.opendaylight.org/show_bug.cgi?id=1125
+ * https://bugs.opendaylight.org/show_bug.cgi?id=1125.
  */
 public class Bug1125RegressionTest extends AbstractDataChangeListenerTest {
 
index e7b03d9b146f432e0a4722f42a97905216d4a5a7..177aa6b282980e51f01f233d8dc13a9ec8700b5c 100644 (file)
@@ -32,15 +32,13 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 /**
- *
  * This testsuite tries to replicate bug 1333 and tests regresion of it
  * using test-model with similar construction as one reported.
  *
- *
+ * <p>
  * See  https://bugs.opendaylight.org/show_bug.cgi?id=1333 for Bug Description
- *
  */
-public class Bug1333DataChangeListenerTest extends AbstractDataChangeListenerTest{
+public class Bug1333DataChangeListenerTest extends AbstractDataChangeListenerTest {
 
     private static final InstanceIdentifier<Top> TOP_PATH = InstanceIdentifier.create(Top.class);
 
@@ -139,5 +137,4 @@ public class Bug1333DataChangeListenerTest extends AbstractDataChangeListenerTes
 
         assertContains(event.getRemovedPaths(), deletePath);
     }
-
 }
index 4393dcc5ef251f074383c5d2a82d3de869256570..ca6c78f0cf43516f37329d6ae6ade0f3fb525185 100644 (file)
@@ -32,7 +32,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controll
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
-public class Bug1418AugmentationTest extends AbstractDataChangeListenerTest{
+public class Bug1418AugmentationTest extends AbstractDataChangeListenerTest {
     private static final InstanceIdentifier<Top> TOP = InstanceIdentifier.create(Top.class);
     private static final InstanceIdentifier<TopLevelList> TOP_FOO = TOP.child(TopLevelList.class, TOP_FOO_KEY);
     private static final InstanceIdentifier<TreeLeafOnlyUsesAugment> SIMPLE_AUGMENT =
@@ -46,7 +46,7 @@ public class Bug1418AugmentationTest extends AbstractDataChangeListenerTest{
 
     @Test
     public void leafOnlyAugmentationCreatedTest() {
-        TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT,
+        final TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT,
                 AsyncDataBroker.DataChangeScope.SUBTREE, false);
         WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
         writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP, top());
@@ -67,7 +67,7 @@ public class Bug1418AugmentationTest extends AbstractDataChangeListenerTest{
         writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP_FOO, topLevelList(new TopLevelListKey(TOP_FOO_KEY)));
         writeTx.put(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT, leafOnlyUsesAugment("test leaf"));
         assertCommit(writeTx.submit());
-        TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT,
+        final TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT,
                 AsyncDataBroker.DataChangeScope.SUBTREE);
         writeTx = getDataBroker().newWriteOnlyTransaction();
         writeTx.put(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT, leafOnlyUsesAugment("test leaf changed"));
@@ -86,7 +86,7 @@ public class Bug1418AugmentationTest extends AbstractDataChangeListenerTest{
         writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP_FOO, topLevelList(new TopLevelListKey(TOP_FOO_KEY)));
         writeTx.put(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT, leafOnlyUsesAugment("test leaf"));
         assertCommit(writeTx.submit());
-        TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT,
+        final TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT,
                 AsyncDataBroker.DataChangeScope.SUBTREE);
         writeTx = getDataBroker().newWriteOnlyTransaction();
         writeTx.delete(LogicalDatastoreType.CONFIGURATION, SIMPLE_AUGMENT);
@@ -100,7 +100,7 @@ public class Bug1418AugmentationTest extends AbstractDataChangeListenerTest{
 
     @Test
     public void complexAugmentationCreatedTest() {
-        TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT,
+        final TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT,
                 AsyncDataBroker.DataChangeScope.SUBTREE, false);
         WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
         writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP, top());
@@ -122,7 +122,7 @@ public class Bug1418AugmentationTest extends AbstractDataChangeListenerTest{
         writeTx.put(LogicalDatastoreType.CONFIGURATION, TOP_FOO, topLevelList(new TopLevelListKey(TOP_FOO_KEY)));
         writeTx.put(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT, complexUsesAugment(LIST_VIA_USES_KEY));
         assertCommit(writeTx.submit());
-        TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT,
+        final TestListener listener = createListener(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT,
                 AsyncDataBroker.DataChangeScope.SUBTREE);
         writeTx = getDataBroker().newWriteOnlyTransaction();
         writeTx.put(LogicalDatastoreType.CONFIGURATION, COMPLEX_AUGMENT, complexUsesAugment(LIST_VIA_USES_KEY_MOD));
index 94d727287c6b3cb9ca44985341d3d58027dac4d0..57d390b176aa8a8f15d29fa0c918bd813fef7a34 100644 (file)
@@ -35,10 +35,10 @@ public class Bug2562DeserializedUnkeyedListTest extends AbstractDataChangeListen
     private void writeRoot(final LogicalDatastoreType store) {
         final ReadWriteTransaction readWriteTransaction = getDataBroker().newReadWriteTransaction();
         final Barroot barRoot = new BarrootBuilder().setType(2).setValue(2).setKey(new BarrootKey(2)).build();
-        final ArrayList barRootList = new ArrayList();
+        final ArrayList<Barroot> barRootList = new ArrayList<>();
         barRootList.add(barRoot);
         final Fooroot fooRoot = new FoorootBuilder().setBarroot(barRootList).build();
-        final ArrayList fooRootList = new ArrayList();
+        final ArrayList<Fooroot> fooRootList = new ArrayList<>();
         fooRootList.add(fooRoot);
         final Root root = new RootBuilder().setFooroot(fooRootList).build();
 
@@ -48,8 +48,8 @@ public class Bug2562DeserializedUnkeyedListTest extends AbstractDataChangeListen
 
     @Test
     public void writeListToList2562Root() {
-        final AbstractDataChangeListenerTest.TestListener listenerRoot = createListener(LogicalDatastoreType.CONFIGURATION,
-                ROOT_PATH, AsyncDataBroker.DataChangeScope.ONE, false);
+        final AbstractDataChangeListenerTest.TestListener listenerRoot =
+            createListener(LogicalDatastoreType.CONFIGURATION, ROOT_PATH, AsyncDataBroker.DataChangeScope.ONE, false);
         writeRoot(LogicalDatastoreType.CONFIGURATION);
         final AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> eventRoot = listenerRoot.event();
 
index 1efa3a7a6c243eaf3234ef48a0872ab47c06ba01..3b883b418f16b27ac352e1e60cbb32c28a35ceee 100644 (file)
@@ -26,7 +26,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.opendaylight.
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
-public class Bug3090MultiKeyList extends AbstractDataChangeListenerTest{
+public class Bug3090MultiKeyList extends AbstractDataChangeListenerTest {
     private static final InstanceIdentifier<Root> ROOT_PATH = InstanceIdentifier.create(Root.class);
 
     private void write(final LogicalDatastoreType store) {
index 071c9bcb40bc9a428a8a6d9d2e908f865a5dbb43..234cb959b11dcce8f1e4af7dfb0ab6dba8136fd7 100644 (file)
@@ -75,8 +75,8 @@ public class DataTreeChangeListenerTest extends AbstractConcurrentDataBrokerTest
         private SettableFuture<Collection<DataTreeModification<T>>> changes = SettableFuture.create();
 
         @Override
-        public void onDataTreeChanged(final Collection<DataTreeModification<T>> changes) {
-            this.changes.set(changes);
+        public void onDataTreeChanged(final Collection<DataTreeModification<T>> modification) {
+            this.changes.set(modification);
 
         }
 
@@ -85,7 +85,6 @@ public class DataTreeChangeListenerTest extends AbstractConcurrentDataBrokerTest
             changes = SettableFuture.create();
             return result;
         }
-
     }
 
     @Override
@@ -109,23 +108,28 @@ public class DataTreeChangeListenerTest extends AbstractConcurrentDataBrokerTest
         createAndVerifyTop(listener);
 
         putTx(BAR_PATH, BAR_DATA).submit().checkedGet();
-        final DataObjectModification<Top> afterBarPutEvent = Iterables.getOnlyElement(listener.nextEvent()).getRootNode();
+        final DataObjectModification<Top> afterBarPutEvent = Iterables.getOnlyElement(listener.nextEvent())
+                .getRootNode();
         verifyModification(afterBarPutEvent, TOP_ARGUMENT, ModificationType.SUBTREE_MODIFIED);
-        final DataObjectModification<TopLevelList> barPutMod = afterBarPutEvent.getModifiedChildListItem(TopLevelList.class, TOP_BAR_KEY);
+        final DataObjectModification<TopLevelList> barPutMod = afterBarPutEvent
+                .getModifiedChildListItem(TopLevelList.class, TOP_BAR_KEY);
         assertNotNull(barPutMod);
         verifyModification(barPutMod, BAR_ARGUMENT, ModificationType.WRITE);
 
         deleteTx(BAR_PATH).submit().checkedGet();
-        final DataObjectModification<Top> afterBarDeleteEvent = Iterables.getOnlyElement(listener.nextEvent()).getRootNode();
+        final DataObjectModification<Top> afterBarDeleteEvent = Iterables.getOnlyElement(listener.nextEvent())
+                .getRootNode();
         verifyModification(afterBarDeleteEvent, TOP_ARGUMENT, ModificationType.SUBTREE_MODIFIED);
-        final DataObjectModification<TopLevelList> barDeleteMod = afterBarDeleteEvent.getModifiedChildListItem(TopLevelList.class, TOP_BAR_KEY);
+        final DataObjectModification<TopLevelList> barDeleteMod = afterBarDeleteEvent
+                .getModifiedChildListItem(TopLevelList.class, TOP_BAR_KEY);
         verifyModification(barDeleteMod, BAR_ARGUMENT, ModificationType.DELETE);
     }
 
     @Test
     public void testWildcardedListListener() throws Exception {
         final EventCapturingListener<TopLevelList> listener = new EventCapturingListener<>();
-        final DataTreeIdentifier<TopLevelList> wildcard = new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, TOP_PATH.child(TopLevelList.class));
+        final DataTreeIdentifier<TopLevelList> wildcard = new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL,
+                TOP_PATH.child(TopLevelList.class));
         dataBrokerImpl.registerDataTreeChangeListener(wildcard, listener);
 
         putTx(TOP_PATH, TOP_INITIAL_DATA).submit().checkedGet();
@@ -179,8 +183,8 @@ public class DataTreeChangeListenerTest extends AbstractConcurrentDataBrokerTest
         assertEquals(TOP_INITIAL_DATA, initialNode.getDataAfter());
     }
 
-    private void verifyModification(final DataObjectModification<? extends DataObject> barWrite, final PathArgument pathArg,
-            final ModificationType eventType) {
+    private void verifyModification(final DataObjectModification<? extends DataObject> barWrite,
+            final PathArgument pathArg, final ModificationType eventType) {
         assertEquals(pathArg.getType(), barWrite.getDataType());
         assertEquals(eventType,barWrite.getModificationType());
         assertEquals(pathArg, barWrite.getIdentifier());
index cf7ad16ad3afdc7c0a340cb646ecda9d2ae8ef25..1687705854fe10001426923358651deee3548ad4 100644 (file)
@@ -108,10 +108,10 @@ public class ForwardedNotificationAdapterTest extends AbstractNotificationBroker
     }
 
     private static class TestNotifListener implements OpendaylightMdsalListTestListener {
-        private List<TwoLevelListChanged> receivedNotifications = new ArrayList<>();
-        private CountDownLatch latch;
+        private final List<TwoLevelListChanged> receivedNotifications = new ArrayList<>();
+        private final CountDownLatch latch;
 
-        public TestNotifListener(CountDownLatch latch) {
+        TestNotifListener(CountDownLatch latch) {
             this.latch = latch;
         }
 
index 5d19d04ddcf54624a062093f5e0d857730abfad6..9885146c7b851dc9901c77aed6e8303da3dbd8bd 100644 (file)
@@ -9,8 +9,8 @@ package org.opendaylight.controller.md.sal.binding.impl.test;
 
 import static org.junit.Assert.assertTrue;
 
+import com.google.common.base.Optional;
 import java.util.concurrent.ExecutionException;
-
 import org.junit.Test;
 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
@@ -24,9 +24,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controll
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelListKey;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
-import com.google.common.base.Optional;
-
-
 public class WriteTransactionTest extends AbstractConcurrentDataBrokerTest {
 
     private static final InstanceIdentifier<Top> TOP_PATH = InstanceIdentifier.create(Top.class);
@@ -43,7 +40,8 @@ public class WriteTransactionTest extends AbstractConcurrentDataBrokerTest {
     }
 
     @Test
-    public void testPutCreateParentsSuccess() throws TransactionCommitFailedException, InterruptedException, ExecutionException {
+    public void testPutCreateParentsSuccess()
+            throws TransactionCommitFailedException, InterruptedException, ExecutionException {
         WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
         writeTx.put(LogicalDatastoreType.OPERATIONAL, NODE_PATH, NODE,true);
         writeTx.submit().checkedGet();
@@ -56,7 +54,8 @@ public class WriteTransactionTest extends AbstractConcurrentDataBrokerTest {
     }
 
     @Test
-    public void testMergeCreateParentsSuccess() throws TransactionCommitFailedException, InterruptedException, ExecutionException {
+    public void testMergeCreateParentsSuccess()
+            throws TransactionCommitFailedException, InterruptedException, ExecutionException {
         WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
         writeTx.merge(LogicalDatastoreType.OPERATIONAL, NODE_PATH, NODE,true);
         writeTx.submit().checkedGet();
@@ -67,5 +66,4 @@ public class WriteTransactionTest extends AbstractConcurrentDataBrokerTest {
         Optional<TopLevelList> listNode = readTx.read(LogicalDatastoreType.OPERATIONAL, NODE_PATH).get();
         assertTrue("List node must exists after commit",listNode.isPresent());
     }
-
 }
index 9dbf443cd3bf0179cd8d719ea39d8dddd60da640..784fea804b2e6b671875ea99a2bba5419834381f 100644 (file)
@@ -76,7 +76,8 @@ public abstract class AbstractDataBrokerTestCustomizer {
     }
 
     public NotificationService createNotificationService() {
-        return new BindingDOMNotificationServiceAdapter(this.bindingToNormalized.getCodecRegistry(), this.domNotificationRouter);
+        return new BindingDOMNotificationServiceAdapter(this.bindingToNormalized.getCodecRegistry(),
+                this.domNotificationRouter);
     }
 
     public NotificationPublishService createNotificationPublishService() {
index d96ebff49eb1190b14f8433edc9175ca4ce5e103..f1619d0c9014526d35f38d17491748d717d419a8 100644 (file)
@@ -10,10 +10,11 @@ package org.opendaylight.controller.md.sal.binding.test;
 
 import java.util.Collection;
 import java.util.Map;
-
 import org.junit.Assert;
 
-public class AssertCollections {
+public final class AssertCollections {
+    private AssertCollections() {
+    }
 
     public static void assertEmpty(final Collection<?> set) {
         Assert.assertTrue(set.isEmpty());
@@ -30,15 +31,15 @@ public class AssertCollections {
 
     }
 
-    public static void assertNotContains(final Collection<?> set, final Object... values) {
+    public static void assertContains(final Map<?,?> map, final Object... values) {
         for (Object key : values) {
-            Assert.assertFalse(set.contains(key));
+            Assert.assertTrue(map.containsKey(key));
         }
     }
 
-    public static void assertContains(final Map<?,?> map, final Object... values) {
+    public static void assertNotContains(final Collection<?> set, final Object... values) {
         for (Object key : values) {
-            Assert.assertTrue(map.containsKey(key));
+            Assert.assertFalse(set.contains(key));
         }
     }
 
index 3df048bdaae79c1cfb0ad5c8971f25a69de73ac4..939349c96f815a173aa0c06240397ae59c67c66a 100644 (file)
@@ -8,12 +8,13 @@
 package org.opendaylight.controller.sal.binding.test;
 
 import static org.junit.Assert.assertNotNull;
+
 import org.opendaylight.yangtools.yang.binding.Augmentable;
 import org.opendaylight.yangtools.yang.binding.Augmentation;
 
 public class AugmentationVerifier<T extends Augmentable<T>> {
 
-    private T object;
+    private final T object;
 
     public AugmentationVerifier(T objectToVerify) {
         this.object = objectToVerify;
@@ -27,11 +28,11 @@ public class AugmentationVerifier<T extends Augmentable<T>> {
     public static <T extends Augmentable<T>> void assertHasAugmentation(T object,
             Class<? extends Augmentation<T>> augmentation) {
         assertNotNull(object);
-        assertNotNull("Augmentation " + augmentation.getSimpleName() + " is not present.", object.getAugmentation(augmentation));
+        assertNotNull("Augmentation " + augmentation.getSimpleName() + " is not present.",
+                object.getAugmentation(augmentation));
     }
 
     public static <T extends Augmentable<T>> AugmentationVerifier<T> from(T obj) {
         return new AugmentationVerifier<>(obj);
     }
-
 }
index fa565070b90ea12a9898fb30c3e2731f7944e7e1..a8ff31c85c5eb1bffb0f3c022d68d917e85ea4ef 100644 (file)
@@ -12,7 +12,5 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.DataRoot;
 import org.opendaylight.yangtools.yang.binding.Identifiable;
 
-public interface ReferencableObject extends DataObject,
-    Identifiable<ReferencableObjectKey>,ChildOf<DataRoot>{
-
+public interface ReferencableObject extends DataObject, Identifiable<ReferencableObjectKey>,ChildOf<DataRoot> {
 }
index 68d7f6cd9efd510e269f791951da082e6a98c6dd..412f1bf4dfc4e4bb53e9a1ca368d902390b06595 100644 (file)
@@ -13,32 +13,37 @@ public class ReferencableObjectKey implements Identifier<ReferencableObject> {
     private static final long serialVersionUID = 1L;
     final Integer value;
 
-    public ReferencableObjectKey(Integer _value) {
-        this.value = _value;
+    public ReferencableObjectKey(Integer value) {
+        this.value = value;
     }
 
     @Override
     public int hashCode() {
         final int prime = 31;
         int result = 1;
-        result = prime * result + ((value == null) ? 0 : value.hashCode());
+        result = prime * result + (value == null ? 0 : value.hashCode());
         return result;
     }
 
     @Override
     public boolean equals(Object obj) {
-        if (this == obj)
+        if (this == obj) {
             return true;
-        if (obj == null)
+        }
+        if (obj == null) {
             return false;
-        if (getClass() != obj.getClass())
+        }
+        if (getClass() != obj.getClass()) {
             return false;
+        }
         ReferencableObjectKey other = (ReferencableObjectKey) obj;
         if (value == null) {
-            if (other.value != null)
+            if (other.value != null) {
                 return false;
-        } else if (!value.equals(other.value))
+            }
+        } else if (!value.equals(other.value)) {
             return false;
+        }
         return true;
     }
 
index c58e258e8b64daa1151a88d1153aac3571d813ea..16c065bd02fb7fea9fac3345cc8f35b2394890d5 100644 (file)
@@ -7,14 +7,12 @@
  */
 package org.opendaylight.controller.sal.binding.test.util;
 
-import java.util.concurrent.ExecutorService;
-
-import javassist.ClassPool;
-
 import com.google.common.annotations.Beta;
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
+import java.util.concurrent.ExecutorService;
+import javassist.ClassPool;
 
 @Beta
 public class BindingBrokerTestFactory {
@@ -49,7 +47,7 @@ public class BindingBrokerTestFactory {
     }
 
     public ClassPool getClassPool() {
-        if(classPool == null) {
+        if (classPool == null) {
             return CLASS_POOL;
         }
 
@@ -59,5 +57,4 @@ public class BindingBrokerTestFactory {
     public void setClassPool(final ClassPool classPool) {
         this.classPool = classPool;
     }
-
 }
index 0d328166354098688c08e5077cfd1d4236163e24..a5b55a3f9dc787b67831a7d69e8ec6f429567958 100644 (file)
@@ -60,8 +60,6 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 @Beta
 public class BindingTestContext implements AutoCloseable {
-
-
     private BindingToNormalizedNodeCodec codec;
 
     private RootBindingAwareBroker baBrokerImpl;
@@ -109,7 +107,8 @@ public class BindingTestContext implements AutoCloseable {
         return this.codec;
     }
 
-    protected BindingTestContext(final ListeningExecutorService executor, final ClassPool classPool, final boolean startWithSchema) {
+    protected BindingTestContext(final ListeningExecutorService executor, final ClassPool classPool,
+            final boolean startWithSchema) {
         this.executor = executor;
         this.classPool = classPool;
         this.startWithSchema = startWithSchema;
@@ -168,7 +167,8 @@ public class BindingTestContext implements AutoCloseable {
     public void startBindingToDomMappingService() {
         checkState(this.classPool != null, "ClassPool needs to be present");
 
-        final DataObjectSerializerGenerator generator = StreamWriterGenerator.create(JavassistUtils.forClassPool(this.classPool));
+        final DataObjectSerializerGenerator generator = StreamWriterGenerator.create(
+                JavassistUtils.forClassPool(this.classPool));
         final BindingNormalizedNodeCodecRegistry codecRegistry = new BindingNormalizedNodeCodecRegistry(generator);
         final GeneratedClassLoadingStrategy loading = GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy();
         this.codec = new BindingToNormalizedNodeCodec(loading,  codecRegistry);
@@ -262,6 +262,4 @@ public class BindingTestContext implements AutoCloseable {
     public DataBroker getDataBroker() {
         return this.dataBroker;
     }
-
-
 }