summaryrefslogtreecommitdiffstats
path: root/infra/translate-impl/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'infra/translate-impl/src/test')
-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
8 files changed, 25 insertions, 26 deletions
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 b7fadda6c..27c578f2b 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 1d9f5d55b..22ff3b8eb 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 40068e02c..d98025a30 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 8d4bdadda..c2934071d 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 a9b15ad32..735fdf7de 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 d2375e6be..7c0206446 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 36ab85eff..d579faad4 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 e06197fae..e89548dd9 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;