diff options
author | Maros Marsalek <mmarsale@cisco.com> | 2016-09-13 16:50:00 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2016-09-16 08:43:18 +0000 |
commit | 963a3601284b033ce8ae23a6c22789c8d1245d7f (patch) | |
tree | 216ff7db7b48da47dede5e412fbf327cf8ab1ed5 /infra/translate-utils/src/main | |
parent | cedfd619866ee2d3a1b9a74bc5540697aa0e275d (diff) |
HONEYCOMB-194 Raise unit test coverage of translation-util to 80%
Change-Id: I6689f6d1f6a4a1376465783dad2650f5137142d2
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Diffstat (limited to 'infra/translate-utils/src/main')
5 files changed, 8 insertions, 13 deletions
diff --git a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/RealtimeMappingContext.java b/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/RealtimeMappingContext.java index 3d1b5222f..82079f0e5 100644 --- a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/RealtimeMappingContext.java +++ b/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/RealtimeMappingContext.java @@ -38,7 +38,7 @@ public final class RealtimeMappingContext implements MappingContext { @Override public <T extends DataObject> Optional<T> read(@Nonnull final InstanceIdentifier<T> currentId) { - try(ReadOnlyTransaction tx = contextBindingBrokerDependency.newReadOnlyTransaction()) { + try (ReadOnlyTransaction tx = contextBindingBrokerDependency.newReadOnlyTransaction()) { try { return tx.read(LogicalDatastoreType.OPERATIONAL, currentId).checkedGet(); } catch (ReadFailedException e) { diff --git a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/BindingBrokerReader.java b/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/BindingBrokerReader.java index 03df15175..b7a38e97f 100644 --- a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/BindingBrokerReader.java +++ b/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/BindingBrokerReader.java @@ -33,7 +33,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; * Simple DataBroker backed reader allowing to delegate reads to different brokers. */ public final class BindingBrokerReader<D extends DataObject, B extends Builder<D>> - implements Reader<D, B>, AutoCloseable { + implements Reader<D, B> { private final InstanceIdentifier<D> instanceIdentifier; private final DataBroker dataBroker; @@ -88,9 +88,4 @@ public final class BindingBrokerReader<D extends DataObject, B extends Builder<D public InstanceIdentifier<D> getManagedDataObjectType() { return instanceIdentifier; } - - @Override - public void close() throws Exception { - // Noop - } } diff --git a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/KeepaliveReaderWrapper.java b/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/KeepaliveReaderWrapper.java index f8d1458c0..5ab9bc59e 100644 --- a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/KeepaliveReaderWrapper.java +++ b/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/KeepaliveReaderWrapper.java @@ -39,7 +39,8 @@ import org.slf4j.LoggerFactory; * Reader wrapper that periodically invokes a read to determine whether reads are still fully functional. * In case a specific error occurs, Keep-alive failure listener gets notified. */ -public final class KeepaliveReaderWrapper<D extends DataObject, B extends Builder<D>> implements Reader<D, B>, Runnable, Closeable { +public final class KeepaliveReaderWrapper<D extends DataObject, B extends Builder<D>> + implements Reader<D, B>, Runnable, Closeable { private static final Logger LOG = LoggerFactory.getLogger(KeepaliveReaderWrapper.class); @@ -51,7 +52,7 @@ public final class KeepaliveReaderWrapper<D extends DataObject, B extends Builde private final ScheduledFuture<?> scheduledFuture; /** - * Create new Keepalive wrapper + * Create new Keepalive wrapper. * * @param delegate underlying reader performing actual reads * @param executor scheduled executor service to schedule keepalive calls @@ -123,7 +124,7 @@ public final class KeepaliveReaderWrapper<D extends DataObject, B extends Builde } /** - * Listener that gets called whenever keepalive fails as expected + * Listener that gets called whenever keepalive fails as expected. */ public interface KeepaliveFailureListener { @@ -145,7 +146,6 @@ public final class KeepaliveReaderWrapper<D extends DataObject, B extends Builde @Override public <T extends DataObject> void put(final InstanceIdentifier<T> path, final T data) {} - @Override public void close() {} } diff --git a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/ReflexiveListReaderCustomizer.java b/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/ReflexiveListReaderCustomizer.java index bf2d109c7..62dbcd6c9 100644 --- a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/ReflexiveListReaderCustomizer.java +++ b/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/ReflexiveListReaderCustomizer.java @@ -32,7 +32,7 @@ import org.opendaylight.yangtools.yang.binding.Identifiable; import org.opendaylight.yangtools.yang.binding.Identifier; /** - * Might be slow ! + * Might be slow. */ public abstract class ReflexiveListReaderCustomizer<C extends DataObject & Identifiable<K>, K extends Identifier<C>, B extends Builder<C>> extends ReflexiveReaderCustomizer<C, B> diff --git a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/ReflexiveReaderCustomizer.java b/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/ReflexiveReaderCustomizer.java index 6ceb7a2b1..18e6285f3 100644 --- a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/ReflexiveReaderCustomizer.java +++ b/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/ReflexiveReaderCustomizer.java @@ -31,7 +31,7 @@ import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; /** - * Might be slow ! + * Might be slow. */ class ReflexiveReaderCustomizer<C extends DataObject, B extends Builder<C>> extends NoopReaderCustomizer<C, B> { |