diff options
author | Maros Marsalek <mmarsale@cisco.com> | 2016-04-12 10:13:25 +0200 |
---|---|---|
committer | Maros Marsalek <mmarsale@cisco.com> | 2016-04-12 10:13:25 +0200 |
commit | a36279bc8bf595fc3d92cf8a59d2044e1f700358 (patch) | |
tree | 8f10468e79dc25b868b70227e1ea768e03975237 /v3po/data-impl/src/test/java/io/fd | |
parent | c3661fb2793928359ef28c4439a67d3208ff1604 (diff) |
HONEYCOMB-8: Remove references to VPP from data layer
Change-Id: Ia8ceb1f6e16c5148514ee2add55ff78533d8fe1e
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Diffstat (limited to 'v3po/data-impl/src/test/java/io/fd')
-rw-r--r-- | v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/ConfigDataTreeTest.java (renamed from v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VPPConfigDataTreeTest.java) | 41 | ||||
-rw-r--r-- | v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/DataBrokerTest.java (renamed from v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VppDataBrokerTest.java) | 18 | ||||
-rw-r--r-- | v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/OperationalDataTreeTest.java (renamed from v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VppOperationalDataTreeTest.java) | 6 | ||||
-rw-r--r-- | v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/ReadOnlyTransactionTest.java (renamed from v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VppReadOnlyTransactionTest.java) | 14 | ||||
-rw-r--r-- | v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/WriteTransactionTest.java (renamed from v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VppWriteTransactionTest.java) | 18 |
5 files changed, 49 insertions, 48 deletions
diff --git a/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VPPConfigDataTreeTest.java b/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/ConfigDataTreeTest.java index ecb9ac4ab..b7f8b9d2c 100644 --- a/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VPPConfigDataTreeTest.java +++ b/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/ConfigDataTreeTest.java @@ -31,7 +31,7 @@ import static org.mockito.MockitoAnnotations.initMocks; import com.google.common.base.Optional; import com.google.common.util.concurrent.CheckedFuture; -import io.fd.honeycomb.v3po.data.VppDataTreeSnapshot; +import io.fd.honeycomb.v3po.data.DataTreeSnapshot; import io.fd.honeycomb.v3po.translate.TranslationException; import io.fd.honeycomb.v3po.translate.write.WriteContext; import io.fd.honeycomb.v3po.translate.write.WriterRegistry; @@ -56,12 +56,11 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification; -import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot; -public class VPPConfigDataTreeTest { +public class ConfigDataTreeTest { @Mock - private WriterRegistry vppWriter; + private WriterRegistry writer; @Mock private BindingNormalizedNodeSerializer serializer; @Mock @@ -69,26 +68,27 @@ public class VPPConfigDataTreeTest { @Mock private DataTreeModification modification; - private VppConfigDataTree proxy; + private ConfigDataTree configDataTree; @Before public void setUp() { initMocks(this); - proxy = new VppConfigDataTree(serializer, dataTree, vppWriter); + configDataTree = new ConfigDataTree(serializer, dataTree, writer); } @Test public void testRead() throws Exception { - final DataTreeSnapshot snapshot = mock(DataTreeSnapshot.class); + final org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot + snapshot = mock(org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot.class); when(dataTree.takeSnapshot()).thenReturn(snapshot); final YangInstanceIdentifier path = mock(YangInstanceIdentifier.class); final Optional node = mock(Optional.class); doReturn(node).when(snapshot).readNode(path); - final VppDataTreeSnapshot vppDataTreeSnapshot = proxy.takeSnapshot(); + final DataTreeSnapshot dataTreeSnapshot = configDataTree.takeSnapshot(); final CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> future = - vppDataTreeSnapshot.read(path); + dataTreeSnapshot.read(path); verify(dataTree).takeSnapshot(); verify(snapshot).readNode(path); @@ -99,13 +99,14 @@ public class VPPConfigDataTreeTest { @Test public void testNewModification() throws Exception { - final DataTreeSnapshot snapshot = mock(DataTreeSnapshot.class); + final org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot + snapshot = mock(org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot.class); when(dataTree.takeSnapshot()).thenReturn(snapshot); when(snapshot.newModification()).thenReturn(modification); - final VppDataTreeSnapshot vppDataTreeSnapshot = proxy.takeSnapshot(); - final DataTreeModification newModification = vppDataTreeSnapshot.newModification(); + final DataTreeSnapshot dataTreeSnapshot = configDataTree.takeSnapshot(); + final DataTreeModification newModification = dataTreeSnapshot.newModification(); verify(dataTree).takeSnapshot(); verify(snapshot).newModification(); @@ -127,10 +128,10 @@ public class VPPConfigDataTreeTest { when(rootNode.getDataAfter()).thenReturn(Optional.<NormalizedNode<?, ?>>fromNullable(nodeAfter)); // Run the test - proxy.commit(modification); + configDataTree.modify(modification); // Verify all changes were processed: - verify(vppWriter).update( + verify(writer).update( mapOf(dataBefore, Ethernet.class), mapOf(dataAfter, Ethernet.class), any(WriteContext.class)); @@ -163,7 +164,7 @@ public class VPPConfigDataTreeTest { // Fail on update: final TranslationException failedOnUpdateException = new TranslationException("update failed"); doThrow(new io.fd.honeycomb.v3po.translate.write.WriterRegistry.BulkUpdateException(InstanceIdentifier.create(Ethernet.class), reverter, - failedOnUpdateException)).when(vppWriter).update(anyMap(), anyMap(), any(WriteContext.class)); + failedOnUpdateException)).when(writer).update(anyMap(), anyMap(), any(WriteContext.class)); // Prepare modification: final DataTreeCandidateNode rootNode = mockRootNode(); @@ -176,9 +177,9 @@ public class VPPConfigDataTreeTest { // Run the test try { - proxy.commit(modification); + configDataTree.modify(modification); } catch (io.fd.honeycomb.v3po.translate.write.WriterRegistry.BulkUpdateException e) { - verify(vppWriter).update(anyMap(), anyMap(), any(WriteContext.class)); + verify(writer).update(anyMap(), anyMap(), any(WriteContext.class)); verify(reverter).revert(); assertEquals(failedOnUpdateException, e.getCause()); return; @@ -198,7 +199,7 @@ public class VPPConfigDataTreeTest { // Fail on update: doThrow(new io.fd.honeycomb.v3po.translate.write.WriterRegistry.BulkUpdateException(InstanceIdentifier.create(Ethernet.class), reverter, - new TranslationException("update failed"))).when(vppWriter).update(anyMap(), anyMap(), any(WriteContext.class)); + new TranslationException("update failed"))).when(writer).update(anyMap(), anyMap(), any(WriteContext.class)); // Fail on revert: final TranslationException failedOnRevertException = new TranslationException("update failed"); @@ -218,9 +219,9 @@ public class VPPConfigDataTreeTest { // Run the test try { - proxy.commit(modification); + configDataTree.modify(modification); } catch (io.fd.honeycomb.v3po.translate.write.WriterRegistry.Reverter.RevertFailedException e) { - verify(vppWriter).update(anyMap(), anyMap(), any(WriteContext.class)); + verify(writer).update(anyMap(), anyMap(), any(WriteContext.class)); verify(reverter).revert(); assertEquals(failedOnRevertException, e.getCause()); return; diff --git a/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VppDataBrokerTest.java b/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/DataBrokerTest.java index 0a7cd80ae..a2908d591 100644 --- a/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VppDataBrokerTest.java +++ b/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/DataBrokerTest.java @@ -22,9 +22,9 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import static org.mockito.MockitoAnnotations.initMocks; -import io.fd.honeycomb.v3po.data.ReadableVppDataTree; -import io.fd.honeycomb.v3po.data.VppDataTree; -import io.fd.honeycomb.v3po.data.VppDataTreeSnapshot; +import io.fd.honeycomb.v3po.data.ReadableDataTree; +import io.fd.honeycomb.v3po.data.ModifiableDataTree; +import io.fd.honeycomb.v3po.data.DataTreeSnapshot; import java.util.Map; import org.junit.Before; import org.junit.Test; @@ -39,21 +39,21 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction; import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; -public class VppDataBrokerTest { +public class DataBrokerTest { @Mock - private ReadableVppDataTree operationalData; + private ReadableDataTree operationalData; @Mock - private VppDataTree confiDataTree; + private ModifiableDataTree confiDataTree; @Mock - private VppDataTreeSnapshot configSnapshot; - private VppDataBroker broker; + private DataTreeSnapshot configSnapshot; + private DataBroker broker; @Before public void setUp() { initMocks(this); when(confiDataTree.takeSnapshot()).thenReturn(configSnapshot); - broker = new VppDataBroker(operationalData, confiDataTree); + broker = new DataBroker(operationalData, confiDataTree); } @Test diff --git a/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VppOperationalDataTreeTest.java b/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/OperationalDataTreeTest.java index d0b45fa65..f4c2f1e5b 100644 --- a/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VppOperationalDataTreeTest.java +++ b/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/OperationalDataTreeTest.java @@ -53,14 +53,14 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; -public class VppOperationalDataTreeTest { +public class OperationalDataTreeTest { @Mock private BindingNormalizedNodeSerializer serializer; @Mock private ReaderRegistry reader; - private VppOperationalDataTree operationalData; + private OperationalDataTree operationalData; @Mock private InstanceIdentifier<DataObject> id; @@ -76,7 +76,7 @@ public class VppOperationalDataTreeTest { @Before public void setUp() { initMocks(this); - operationalData = new VppOperationalDataTree(serializer, globalContext, reader); + operationalData = new OperationalDataTree(serializer, globalContext, reader); doReturn(schemaNode).when(globalContext).getDataChildByName(any(QName.class)); } diff --git a/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VppReadOnlyTransactionTest.java b/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/ReadOnlyTransactionTest.java index b0c64bbdf..30fdd1392 100644 --- a/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VppReadOnlyTransactionTest.java +++ b/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/ReadOnlyTransactionTest.java @@ -24,8 +24,8 @@ import static org.mockito.MockitoAnnotations.initMocks; import com.google.common.base.Optional; import com.google.common.util.concurrent.CheckedFuture; -import io.fd.honeycomb.v3po.data.ReadableVppDataTree; -import io.fd.honeycomb.v3po.data.VppDataTreeSnapshot; +import io.fd.honeycomb.v3po.data.ReadableDataTree; +import io.fd.honeycomb.v3po.data.DataTreeSnapshot; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; @@ -34,19 +34,19 @@ import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; -public class VppReadOnlyTransactionTest { +public class ReadOnlyTransactionTest { @Mock - private ReadableVppDataTree operationalData; + private ReadableDataTree operationalData; @Mock - private VppDataTreeSnapshot configSnapshot; + private DataTreeSnapshot configSnapshot; - private VppReadOnlyTransaction readOnlyTx; + private ReadOnlyTransaction readOnlyTx; @Before public void setUp() { initMocks(this); - readOnlyTx = new VppReadOnlyTransaction(operationalData, configSnapshot); + readOnlyTx = new ReadOnlyTransaction(operationalData, configSnapshot); } @Test diff --git a/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VppWriteTransactionTest.java b/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/WriteTransactionTest.java index ad93b148a..d0360dbd8 100644 --- a/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VppWriteTransactionTest.java +++ b/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/WriteTransactionTest.java @@ -27,8 +27,8 @@ import static org.mockito.Mockito.when; import static org.mockito.MockitoAnnotations.initMocks; import com.google.common.util.concurrent.CheckedFuture; -import io.fd.honeycomb.v3po.data.VppDataTree; -import io.fd.honeycomb.v3po.data.VppDataTreeSnapshot; +import io.fd.honeycomb.v3po.data.ModifiableDataTree; +import io.fd.honeycomb.v3po.data.DataTreeSnapshot; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; @@ -39,12 +39,12 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException; -public class VppWriteTransactionTest { +public class WriteTransactionTest { @Mock - private VppDataTree configDataTree; + private ModifiableDataTree configDataTree; @Mock - private VppDataTreeSnapshot configSnapshot; + private DataTreeSnapshot configSnapshot; @Mock private YangInstanceIdentifier path; @Mock @@ -52,13 +52,13 @@ public class VppWriteTransactionTest { @Mock private DataTreeModification dataTreeModification; - private VppWriteTransaction writeTx; + private WriteTransaction writeTx; @Before public void setUp() { initMocks(this); when(configSnapshot.newModification()).thenReturn(dataTreeModification); - writeTx = new VppWriteTransaction(configDataTree, configSnapshot); + writeTx = new WriteTransaction(configDataTree, configSnapshot); } @Test @@ -107,12 +107,12 @@ public class VppWriteTransactionTest { public void testSubmit() throws Exception { writeTx.submit(); verify(dataTreeModification).ready(); - verify(configDataTree).commit(dataTreeModification); + verify(configDataTree).modify(dataTreeModification); } @Test public void testSubmitFailed() throws Exception { - doThrow(mock(DataValidationFailedException.class)).when(configDataTree).commit(dataTreeModification); + doThrow(mock(DataValidationFailedException.class)).when(configDataTree).modify(dataTreeModification); final CheckedFuture<Void, TransactionCommitFailedException> future = writeTx.submit(); try { future.get(); |