diff options
author | Michal Cmarada <michal.cmarada@pantheon.tech> | 2018-09-25 11:15:35 +0200 |
---|---|---|
committer | Michal Cmarada <michal.cmarada@pantheon.tech> | 2018-09-25 11:22:18 +0200 |
commit | 556a0f59abc9b09005d40945bc20948d69e4f98e (patch) | |
tree | 76d795ae59aba49521fc4fdc7d65062c946147be /infra/translate-impl/src/test | |
parent | 46bcceb927b1bce07c1c9517f45470703293eb84 (diff) |
Bump ODL dependencies to Fluorine (HONEYCOMB-433)
Change-Id: I142ebd2899272feff00abe7d4bae708f093ee3ec
Signed-off-by: Michal Cmarada <michal.cmarada@pantheon.tech>
Diffstat (limited to 'infra/translate-impl/src/test')
5 files changed, 32 insertions, 9 deletions
diff --git a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/AbstractListReaderTest.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/AbstractListReaderTest.java index 5c08ce237..e8d26b660 100644 --- a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/AbstractListReaderTest.java +++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/AbstractListReaderTest.java @@ -131,7 +131,7 @@ public abstract class AbstractListReaderTest { } @Override - public TestingKey getKey() { + public TestingKey key() { return new TestingKey(); } 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 f695e66d7..b7fadda6c 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 @@ -24,15 +24,19 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; +import com.google.common.util.concurrent.FluentFuture; +import com.google.common.util.concurrent.Futures; import io.fd.honeycomb.translate.read.InitFailedException; import io.fd.honeycomb.translate.read.ReadFailedException; 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.yangtools.concepts.Builder; public class GenericInitListReaderTest extends AbstractListReaderTest { @@ -69,12 +73,13 @@ public class GenericInitListReaderTest extends AbstractListReaderTest { final Initialized<TestingData> initialized = Initialized.create(DATA_OBJECT_ID, data); when(getCustomizer().isPresent(any(), any(), any())).thenReturn(true); doReturn(initialized).when(getCustomizer()).init(any(), any(), any()); + when(writeTx.commit()).thenReturn(FluentFuture.from(Futures.immediateFuture(null))); when(broker.newWriteOnlyTransaction()).thenReturn(writeTx); getReader().init(broker, DATA_OBJECT_ID, ctx); verify(writeTx, times(2)).merge(LogicalDatastoreType.CONFIGURATION, DATA_OBJECT_ID, data, true); - verify(writeTx, times(2)).submit(); + verify(writeTx, times(2)).commit(); } @Test(expected = InitFailedException.class) 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 ef3de457f..1d9f5d55b 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 @@ -22,6 +22,8 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; +import com.google.common.util.concurrent.FluentFuture; +import com.google.common.util.concurrent.Futures; import io.fd.honeycomb.translate.read.InitFailedException; import io.fd.honeycomb.translate.read.ReadFailedException; import io.fd.honeycomb.translate.spi.read.Initialized; @@ -66,12 +68,13 @@ public class GenericIntReaderTest extends AbstractReaderTest { when(getCustomizer().isPresent(DATA_OBJECT_ID, data, ctx)).thenReturn(true); doReturn(initialized).when(getCustomizer()).init(DATA_OBJECT_ID, data, ctx); + when(writeTx.commit()).thenReturn(FluentFuture.from(Futures.immediateFuture(null))); when(broker.newWriteOnlyTransaction()).thenReturn(writeTx); getReader().init(broker, DATA_OBJECT_ID, ctx); verify(writeTx).merge(LogicalDatastoreType.CONFIGURATION, DATA_OBJECT_ID, data, true); - verify(writeTx).submit(); + verify(writeTx).commit(); } @Test(expected = InitFailedException.class) 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 20cabc5b4..36ab85eff 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 @@ -60,8 +60,8 @@ public class GenericListWriterTest { public void setUp() throws Exception { MockitoAnnotations.initMocks(this); writer = new GenericListWriter<>(DATA_OBJECT_ID, customizer, validator); - when(before.getKey()).thenReturn(beforeKey); - when(after.getKey()).thenReturn(keyAfter); + when(before.key()).thenReturn(beforeKey); + when(after.key()).thenReturn(keyAfter); } @Test diff --git a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/SubtreeWriterTest.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/SubtreeWriterTest.java index 65b2f375b..839674fb4 100644 --- a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/SubtreeWriterTest.java +++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/SubtreeWriterTest.java @@ -29,6 +29,7 @@ import io.fd.honeycomb.translate.impl.write.NoopWriters.NonDirectUpdateWriterCus import io.fd.honeycomb.translate.impl.write.NoopWriters.ParentImplDirectUpdateWriterCustomizer; import io.fd.honeycomb.translate.util.DataObjects; import io.fd.honeycomb.translate.write.Writer; +import java.io.UncheckedIOException; import java.util.Collections; import java.util.Set; import org.hamcrest.CoreMatchers; @@ -66,15 +67,29 @@ public class SubtreeWriterTest { } @Test + public void testCanHandleChild() throws Exception { + final SubtreeWriter<?> forWriter = createSubtreeWriter(); + + InstanceIdentifier<DataObjects.DataObject4.DataObject41.DataObject411> testIid = InstanceIdentifier.create( + DataObjects.DataObject4.class).child(DataObjects.DataObject4.DataObject41.class).child( + DataObjects.DataObject4.DataObject41.DataObject411.class); + assertTrue(forWriter.canProcess(testIid)); + } + + @Test public void testSubtreeWriterCreation() throws Exception { - final SubtreeWriter<?> forWriter = (SubtreeWriter<?>) SubtreeWriter.createForWriter(Sets.newHashSet( + final SubtreeWriter<?> forWriter = createSubtreeWriter(); + + assertEquals(writer.getManagedDataObjectType(), forWriter.getManagedDataObjectType()); + assertEquals(3, forWriter.getHandledChildTypes().size()); + } + + private SubtreeWriter<?> createSubtreeWriter() { + return (SubtreeWriter<?>) SubtreeWriter.createForWriter(Sets.newHashSet( DataObjects.DataObject4.DataObject41.IID, DataObjects.DataObject4.DataObject41.DataObject411.IID, DataObjects.DataObject4.DataObject42.IID), writer); - - assertEquals(writer.getManagedDataObjectType(), forWriter.getManagedDataObjectType()); - assertEquals(3, forWriter.getHandledChildTypes().size()); } @Test |