summaryrefslogtreecommitdiffstats
path: root/infra/translate-impl
diff options
context:
space:
mode:
authorMichal Cmarada <mcmarada@cisco.com>2019-04-08 11:37:45 +0200
committerMichal Cmarada <mcmarada@cisco.com>2019-04-08 11:37:45 +0200
commitb16cea20258ba537db7c0755208c82ab93331ff7 (patch)
tree8a5a3c87069b9ce700c34323e75ff434e7acae97 /infra/translate-impl
parent23979469bcf8cd312cb3ec9e9e548003110f68f4 (diff)
HONEYCOMB-443: ODL bump to Neon
- bumps ODL dependencies to neon - migrates guava optional to java.utils.optional Change-Id: Ibdaa365c7e21a341103aba88dfd67277e40d2969 Signed-off-by: Michal Cmarada <mcmarada@cisco.com>
Diffstat (limited to 'infra/translate-impl')
-rw-r--r--infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericInitListReader.java4
-rw-r--r--infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericInitReader.java19
-rw-r--r--infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericListReader.java5
-rw-r--r--infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReader.java6
-rw-r--r--infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistry.java4
-rw-r--r--infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/InitSubtreeReader.java2
-rw-r--r--infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/SubtreeReader.java6
-rw-r--r--infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/GenericListWriter.java2
-rw-r--r--infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistry.java5
-rw-r--r--infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/GenericInitListReaderTest.java10
-rw-r--r--infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/GenericIntReaderTest.java8
-rw-r--r--infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistryTest.java2
-rw-r--r--infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderTest.java4
-rw-r--r--infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/InitSubtreeReaderTest.java2
-rw-r--r--infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/SubtreeReaderTest.java15
-rw-r--r--infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/GenericListWriterTest.java8
-rw-r--r--infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryTest.java2
17 files changed, 56 insertions, 48 deletions
diff --git a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericInitListReader.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericInitListReader.java
index cabf316..bc76f37 100644
--- a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericInitListReader.java
+++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericInitListReader.java
@@ -18,7 +18,6 @@ package io.fd.honeycomb.translate.impl.read;
import static io.fd.honeycomb.translate.impl.read.GenericInitReader.writeInit;
-import com.google.common.base.Optional;
import io.fd.honeycomb.translate.read.InitFailedException;
import io.fd.honeycomb.translate.read.InitListReader;
import io.fd.honeycomb.translate.read.ReadContext;
@@ -26,8 +25,9 @@ import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.spi.read.Initialized;
import io.fd.honeycomb.translate.spi.read.InitializingListReaderCustomizer;
import io.fd.honeycomb.translate.util.RWUtils;
+import java.util.Optional;
import javax.annotation.Nonnull;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.Identifiable;
diff --git a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericInitReader.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericInitReader.java
index 147cbd3..59f9bc1 100644
--- a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericInitReader.java
+++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericInitReader.java
@@ -16,9 +16,8 @@
package io.fd.honeycomb.translate.impl.read;
-import static org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.CONFIGURATION;
+import static org.opendaylight.mdsal.common.api.LogicalDatastoreType.CONFIGURATION;
-import com.google.common.base.Optional;
import com.google.common.util.concurrent.FluentFuture;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.MoreExecutors;
@@ -28,10 +27,12 @@ import io.fd.honeycomb.translate.read.ReadContext;
import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.spi.read.Initialized;
import io.fd.honeycomb.translate.spi.read.InitializingReaderCustomizer;
+import java.util.List;
+import java.util.Optional;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
import org.opendaylight.mdsal.common.api.CommitInfo;
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.DataObject;
@@ -72,7 +73,15 @@ public final class GenericInitReader<O extends DataObject, B extends Builder<O>>
@SuppressWarnings("unchecked")
static void writeInit(final DataBroker broker, final Initialized<? extends DataObject> init) {
final WriteTransaction writeTx = broker.newWriteOnlyTransaction();
- writeTx.merge(CONFIGURATION, (InstanceIdentifier) init.getId(), init.getData(), true);
+
+ InstanceIdentifier id = init.getId();
+ if (id.getPathArguments() instanceof List && ((List) id.getPathArguments()).size() == 1) {
+ //root element only. not necessary to create parents
+ writeTx.merge(CONFIGURATION, id, init.getData());
+ }
+ else {
+ writeTx.mergeParentStructureMerge(CONFIGURATION, id, init.getData());
+ }
FluentFuture<? extends CommitInfo> future = writeTx.commit();
future.addCallback(new FutureCallback<CommitInfo>() {
@Override
diff --git a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericListReader.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericListReader.java
index 9e2ccd7..d715dde 100644
--- a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericListReader.java
+++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericListReader.java
@@ -19,19 +19,18 @@ package io.fd.honeycomb.translate.impl.read;
import static com.google.common.base.Preconditions.checkArgument;
import com.google.common.annotations.Beta;
-import com.google.common.base.Optional;
import io.fd.honeycomb.translate.read.ListReader;
import io.fd.honeycomb.translate.read.ReadContext;
import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.read.Reader;
import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer;
import io.fd.honeycomb.translate.util.RWUtils;
+import io.fd.honeycomb.translate.util.read.ReflexiveListReaderCustomizer;
import java.util.ArrayList;
import java.util.List;
+import java.util.Optional;
import javax.annotation.Nonnull;
import javax.annotation.concurrent.ThreadSafe;
-
-import io.fd.honeycomb.translate.util.read.ReflexiveListReaderCustomizer;
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.Identifiable;
diff --git a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReader.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReader.java
index 0a87d9b..7283e21 100644
--- a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReader.java
+++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReader.java
@@ -19,7 +19,6 @@ package io.fd.honeycomb.translate.impl.read.registry;
import static com.google.common.base.Preconditions.checkArgument;
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Optional;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import io.fd.honeycomb.translate.read.InitFailedException;
@@ -36,8 +35,9 @@ import io.fd.honeycomb.translate.util.read.DelegatingReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.Optional;
import javax.annotation.Nonnull;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.Identifiable;
@@ -70,7 +70,7 @@ class CompositeReader<D extends DataObject, B extends Builder<D>>
@SuppressWarnings("unchecked")
public static <D extends DataObject> InstanceIdentifier<D> appendTypeToId(
final InstanceIdentifier<? extends DataObject> parentId, final InstanceIdentifier<D> type) {
- final InstanceIdentifier.PathArgument t = new InstanceIdentifier.Item<>(type.getTargetType());
+ final InstanceIdentifier.PathArgument t = InstanceIdentifier.Item.of(type.getTargetType());
return (InstanceIdentifier<D>) InstanceIdentifier.create(Iterables.concat(
parentId.getPathArguments(), Collections.singleton(t)));
}
diff --git a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistry.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistry.java
index 0eda8e6..4783c9c 100644
--- a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistry.java
+++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistry.java
@@ -19,7 +19,6 @@ package io.fd.honeycomb.translate.impl.read.registry;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Optional;
import com.google.common.collect.Iterables;
import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.Multimap;
@@ -34,9 +33,10 @@ import io.fd.honeycomb.translate.util.RWUtils;
import java.util.Collections;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
diff --git a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/InitSubtreeReader.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/InitSubtreeReader.java
index e7cef81..6d37991 100644
--- a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/InitSubtreeReader.java
+++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/InitSubtreeReader.java
@@ -23,7 +23,7 @@ import io.fd.honeycomb.translate.read.ListReader;
import io.fd.honeycomb.translate.read.ReadContext;
import java.util.Set;
import javax.annotation.Nonnull;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.Identifiable;
diff --git a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/SubtreeReader.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/SubtreeReader.java
index 4db6dd7..e4d9b84 100644
--- a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/SubtreeReader.java
+++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/SubtreeReader.java
@@ -18,7 +18,6 @@ package io.fd.honeycomb.translate.impl.read.registry;
import static com.google.common.base.Preconditions.checkArgument;
-import com.google.common.base.Optional;
import com.google.common.collect.Iterables;
import io.fd.honeycomb.translate.read.ListReader;
import io.fd.honeycomb.translate.read.ReadContext;
@@ -32,6 +31,7 @@ import java.lang.reflect.Method;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
+import java.util.Optional;
import java.util.Set;
import javax.annotation.Nonnull;
import org.opendaylight.yangtools.concepts.Builder;
@@ -133,7 +133,7 @@ class SubtreeReader<D extends DataObject, B extends Builder<D>> implements Deleg
Collections.emptyList(), nextId.getType());
if (method.isPresent()) {
- return Optional.fromNullable(filterSingle(parent, nextId, method.get()));
+ return Optional.ofNullable(filterSingle(parent, nextId, method.get()));
} else {
// List child nodes
method = ReflectionUtils.findMethodReflex(managedType,
@@ -161,7 +161,7 @@ class SubtreeReader<D extends DataObject, B extends Builder<D>> implements Deleg
final Method keyGetter = ReflectionUtils.findMethodReflex(nextId.getType(), "get",
Collections.emptyList(), key.getClass()).get();
- return Optional.fromNullable(invoke.stream()
+ return Optional.ofNullable(invoke.stream()
.filter(item -> key.equals(invoke(keyGetter, nextId, item)))
.findFirst().orElse(null));
}
diff --git a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/GenericListWriter.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/GenericListWriter.java
index cc4800a..e78278f 100644
--- a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/GenericListWriter.java
+++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/GenericListWriter.java
@@ -92,7 +92,7 @@ public final class GenericListWriter<D extends DataObject & Identifiable<K>, K e
// Make sure the key is present
if (isWildcarded(id)) {
return RWUtils.replaceLastInId(id,
- new InstanceIdentifier.IdentifiableItem<>(id.getTargetType(), current.key()));
+ InstanceIdentifier.IdentifiableItem.of(id.getTargetType(), current.key()));
} else {
return id;
}
diff --git a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistry.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistry.java
index 9e36e59..60ee68e 100644
--- a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistry.java
+++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistry.java
@@ -20,7 +20,6 @@ import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static java.util.stream.Collectors.toMap;
-import com.google.common.base.Optional;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
@@ -39,6 +38,7 @@ import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -216,7 +216,8 @@ final class FlatWriterRegistry implements WriterRegistry {
final Optional<? extends DataObject> parentAfter = ctx.readAfter(parentKeyedId);
// Put the parent update data into updates map so that revert can also access the state
- DataObjectUpdate parentUpdate = DataObjectUpdate.create(parentKeyedId, parentBefore.orNull(), parentAfter.orNull());
+ DataObjectUpdate parentUpdate =
+ DataObjectUpdate.create(parentKeyedId, parentBefore.orElse(null), parentAfter.orElse(null));
updates.put(RWUtils.makeIidWildcarded(parentKeyedId), parentUpdate);
return parentUpdate;
}
diff --git a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/GenericInitListReaderTest.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/GenericInitListReaderTest.java
index b7fadda..27c578f 100644
--- a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/GenericInitListReaderTest.java
+++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/GenericInitListReaderTest.java
@@ -23,6 +23,7 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
+import static org.opendaylight.mdsal.common.api.LogicalDatastoreType.CONFIGURATION;
import com.google.common.util.concurrent.FluentFuture;
import com.google.common.util.concurrent.Futures;
@@ -32,11 +33,8 @@ import io.fd.honeycomb.translate.spi.read.Initialized;
import io.fd.honeycomb.translate.spi.read.InitializingListReaderCustomizer;
import org.junit.Test;
import org.mockito.Mock;
-import org.mockito.stubbing.Answer;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.mdsal.common.api.CommitInfo;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
import org.opendaylight.yangtools.concepts.Builder;
public class GenericInitListReaderTest extends AbstractListReaderTest {
@@ -78,7 +76,7 @@ public class GenericInitListReaderTest extends AbstractListReaderTest {
getReader().init(broker, DATA_OBJECT_ID, ctx);
- verify(writeTx, times(2)).merge(LogicalDatastoreType.CONFIGURATION, DATA_OBJECT_ID, data, true);
+ verify(writeTx, times(2)).merge(CONFIGURATION, DATA_OBJECT_ID, data);
verify(writeTx, times(2)).commit();
}
diff --git a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/GenericIntReaderTest.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/GenericIntReaderTest.java
index 1d9f5d5..22ff3b8 100644
--- a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/GenericIntReaderTest.java
+++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/GenericIntReaderTest.java
@@ -21,6 +21,7 @@ import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
+import static org.opendaylight.mdsal.common.api.LogicalDatastoreType.CONFIGURATION;
import com.google.common.util.concurrent.FluentFuture;
import com.google.common.util.concurrent.Futures;
@@ -30,9 +31,8 @@ import io.fd.honeycomb.translate.spi.read.Initialized;
import io.fd.honeycomb.translate.spi.read.InitializingReaderCustomizer;
import org.junit.Test;
import org.mockito.Mock;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.DataObject;
@@ -73,7 +73,7 @@ public class GenericIntReaderTest extends AbstractReaderTest {
getReader().init(broker, DATA_OBJECT_ID, ctx);
- verify(writeTx).merge(LogicalDatastoreType.CONFIGURATION, DATA_OBJECT_ID, data, true);
+ verify(writeTx).merge(CONFIGURATION, DATA_OBJECT_ID, data);
verify(writeTx).commit();
}
diff --git a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistryTest.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistryTest.java
index 40068e0..d98025a 100644
--- a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistryTest.java
+++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistryTest.java
@@ -28,11 +28,11 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import com.google.common.base.Optional;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import io.fd.honeycomb.translate.read.ReadContext;
import io.fd.honeycomb.translate.read.Reader;
+import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
import org.mockito.InOrder;
diff --git a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderTest.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderTest.java
index 8d4bdad..c293407 100644
--- a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderTest.java
+++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderTest.java
@@ -16,11 +16,11 @@
package io.fd.honeycomb.translate.impl.read.registry;
+import static io.fd.honeycomb.translate.impl.read.registry.CompositeReaderRegistryTest.mockReader;
import static io.fd.honeycomb.translate.util.DataObjects.DataObject4;
import static io.fd.honeycomb.translate.util.DataObjects.DataObject4.DataObject41;
import static io.fd.honeycomb.translate.util.DataObjects.DataObjectK;
import static io.fd.honeycomb.translate.util.DataObjects.DataObjectKey;
-import static io.fd.honeycomb.translate.impl.read.registry.CompositeReaderRegistryTest.mockReader;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
@@ -28,7 +28,6 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import com.google.common.base.Optional;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import io.fd.honeycomb.translate.read.ListReader;
@@ -36,6 +35,7 @@ import io.fd.honeycomb.translate.read.ReadContext;
import io.fd.honeycomb.translate.read.Reader;
import io.fd.honeycomb.translate.util.DataObjects;
import java.util.List;
+import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
diff --git a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/InitSubtreeReaderTest.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/InitSubtreeReaderTest.java
index a9b15ad..735fdf7 100644
--- a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/InitSubtreeReaderTest.java
+++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/InitSubtreeReaderTest.java
@@ -30,7 +30,7 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.ChildOf;
import org.opendaylight.yangtools.yang.binding.DataObject;
diff --git a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/SubtreeReaderTest.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/SubtreeReaderTest.java
index d2375e6..7c02064 100644
--- a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/SubtreeReaderTest.java
+++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/SubtreeReaderTest.java
@@ -23,11 +23,11 @@ import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
-import com.google.common.base.Optional;
import com.google.common.collect.Sets;
import io.fd.honeycomb.translate.read.ReadContext;
import io.fd.honeycomb.translate.read.Reader;
import io.fd.honeycomb.translate.util.DataObjects;
+import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
@@ -48,14 +48,14 @@ public class SubtreeReaderTest {
private ReadContext ctx;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
MockitoAnnotations.initMocks(this);
Mockito.doReturn(DataObjects.DataObject4.IID).when(delegate).getManagedDataObjectType();
doReturn(DataObject1.IID).when(delegateLocal).getManagedDataObjectType();
}
@Test
- public void testCreate() throws Exception {
+ public void testCreate() {
final Reader<DataObjects.DataObject4, Builder<DataObjects.DataObject4>> subtreeR =
SubtreeReader.createForReader(Sets.newHashSet(DataObjects.DataObject4.DataObject41.IID), delegate);
@@ -76,7 +76,8 @@ public class SubtreeReaderTest {
final Reader<DataObjects.DataObject4, Builder<DataObjects.DataObject4>> subtreeR =
SubtreeReader.createForReader(Sets.newHashSet(DataObjects.DataObject4.DataObject41.IID), delegate);
- doReturn(Optional.fromNullable(mock(DataObjects.DataObject4.class))).when(delegate).read(DataObjects.DataObject4.IID, ctx);
+ doReturn(Optional.ofNullable(mock(DataObjects.DataObject4.class))).when(delegate)
+ .read(DataObjects.DataObject4.IID, ctx);
subtreeR.read(DataObjects.DataObject4.DataObject41.IID, ctx);
}
@@ -85,7 +86,7 @@ public class SubtreeReaderTest {
final Reader<DataObjects.DataObject4, Builder<DataObjects.DataObject4>> subtreeR =
SubtreeReader.createForReader(Sets.newHashSet(DataObjects.DataObject4.DataObject41.IID), delegate);
- doReturn(Optional.absent()).when(delegate).read(DataObjects.DataObject4.IID, ctx);
+ doReturn(Optional.empty()).when(delegate).read(DataObjects.DataObject4.IID, ctx);
assertFalse(subtreeR.read(DataObjects.DataObject4.DataObject41.IID, ctx).isPresent());
}
@@ -97,7 +98,7 @@ public class SubtreeReaderTest {
final DataObject1 mock = mock(DataObject1.class);
final DataObject1.DataObject11 mock11 = mock(DataObject1.DataObject11.class);
doReturn(mock11).when(mock).getDataObject11();
- doReturn(Optional.fromNullable(mock)).when(delegateLocal).read(DataObject1.IID, ctx);
+ doReturn(Optional.ofNullable(mock)).when(delegateLocal).read(DataObject1.IID, ctx);
assertEquals(mock11, subtreeR.read(DataObject1.DataObject11.IID, ctx).get());
}
@@ -109,7 +110,7 @@ public class SubtreeReaderTest {
final DataObject1 mock = mock(DataObject1.class);
final DataObject1.DataObject11 mock11 = mock(DataObject1.DataObject11.class);
doReturn(mock11).when(mock).getDataObject11();
- doReturn(Optional.fromNullable(mock)).when(delegateLocal).read(DataObject1.IID, ctx);
+ doReturn(Optional.ofNullable(mock)).when(delegateLocal).read(DataObject1.IID, ctx);
assertEquals(mock, subtreeR.read(DataObject1.IID, ctx).get());
}
diff --git a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/GenericListWriterTest.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/GenericListWriterTest.java
index 36ab85e..d579faa 100644
--- a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/GenericListWriterTest.java
+++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/GenericListWriterTest.java
@@ -70,10 +70,10 @@ public class GenericListWriterTest {
final InstanceIdentifier<IdentifiableDataObject> keyedIdBefore =
(InstanceIdentifier<IdentifiableDataObject>) InstanceIdentifier.create(Collections
- .singleton(new InstanceIdentifier.IdentifiableItem<>(IdentifiableDataObject.class, beforeKey)));
+ .singleton(InstanceIdentifier.IdentifiableItem.of(IdentifiableDataObject.class, beforeKey)));
final InstanceIdentifier<IdentifiableDataObject> keyedIdAfter =
(InstanceIdentifier<IdentifiableDataObject>) InstanceIdentifier.create(Collections
- .singleton(new InstanceIdentifier.IdentifiableItem<>(IdentifiableDataObject.class, keyAfter)));
+ .singleton(InstanceIdentifier.IdentifiableItem.of(IdentifiableDataObject.class, keyAfter)));
writer.processModification(DATA_OBJECT_ID, before, after, ctx);
verify(customizer).updateCurrentAttributes(keyedIdBefore, before, after, ctx);
@@ -117,10 +117,10 @@ public class GenericListWriterTest {
final InstanceIdentifier<IdentifiableDataObject> keyedIdBefore =
(InstanceIdentifier<IdentifiableDataObject>) InstanceIdentifier.create(Collections
- .singleton(new InstanceIdentifier.IdentifiableItem<>(IdentifiableDataObject.class, beforeKey)));
+ .singleton(InstanceIdentifier.IdentifiableItem.of(IdentifiableDataObject.class, beforeKey)));
final InstanceIdentifier<IdentifiableDataObject> keyedIdAfter =
(InstanceIdentifier<IdentifiableDataObject>) InstanceIdentifier.create(Collections
- .singleton(new InstanceIdentifier.IdentifiableItem<>(IdentifiableDataObject.class, keyAfter)));
+ .singleton(InstanceIdentifier.IdentifiableItem.of(IdentifiableDataObject.class, keyAfter)));
writer.validate(DATA_OBJECT_ID, before, after, ctx);
verify(validator).validateUpdate(keyedIdBefore, before, after, ctx);
diff --git a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryTest.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryTest.java
index e06197f..e89548d 100644
--- a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryTest.java
+++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryTest.java
@@ -31,7 +31,6 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
-import com.google.common.base.Optional;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMultimap;
@@ -50,6 +49,7 @@ import io.fd.honeycomb.translate.write.registry.WriterRegistry;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
+import java.util.Optional;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.junit.Before;