diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2017-06-08 12:18:08 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2017-06-09 07:19:26 +0200 |
commit | 0380b9d1f451affec186f197189a4e0ca87336ab (patch) | |
tree | 6e0d457e07a685eb1f1f841895a3636f04bc42bd /infra/translate-impl/src/test/java/io/fd | |
parent | d500e65e12ce0ceaa59d30283fabde08ee3bffea (diff) |
Move ordering logic out of AbstractSubtreeManagerRegistryBuilderBuilder
Introduces YangDAG that maintains topological order for yang schema
nodes and can be used by other components to read additional graph edges,
e.g. from file (HONEYCOMB-365).
Change-Id: Ia3046d38ffb4ca222412309f6c4391afc9315bd2
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'infra/translate-impl/src/test/java/io/fd')
2 files changed, 11 insertions, 10 deletions
diff --git a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistryBuilderTest.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistryBuilderTest.java index 0c7c71eac..1858f222a 100644 --- a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistryBuilderTest.java +++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistryBuilderTest.java @@ -26,6 +26,7 @@ import com.google.common.collect.Lists; import io.fd.honeycomb.translate.read.Reader; import io.fd.honeycomb.translate.read.registry.ReaderRegistry; import io.fd.honeycomb.translate.util.DataObjects; +import io.fd.honeycomb.translate.util.YangDAG; import java.util.List; import java.util.Map; import org.junit.Test; @@ -68,12 +69,12 @@ public class CompositeReaderRegistryBuilderTest { @Test(expected = IllegalArgumentException.class) public void testPreventStructuralReaderForList() { - new CompositeReaderRegistryBuilder().addStructuralReader(InstanceIdentifier.create(DataObjects.DataObjectK.class), DataObjects.DataObjectKBuilder.class); + new CompositeReaderRegistryBuilder(new YangDAG()).addStructuralReader(InstanceIdentifier.create(DataObjects.DataObjectK.class), DataObjects.DataObjectKBuilder.class); } @Test public void testCompositeStructure() throws Exception { - final CompositeReaderRegistryBuilder compositeReaderRegistryBuilder = new CompositeReaderRegistryBuilder(); + final CompositeReaderRegistryBuilder compositeReaderRegistryBuilder = new CompositeReaderRegistryBuilder(new YangDAG()); /* Composite reader structure ordered left from right diff --git a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryBuilderTest.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryBuilderTest.java index 3a6767265..feaba726c 100644 --- a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryBuilderTest.java +++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryBuilderTest.java @@ -32,6 +32,7 @@ import com.google.common.collect.Lists; import com.google.common.collect.Multimaps; import com.google.common.collect.Sets; import io.fd.honeycomb.translate.util.DataObjects; +import io.fd.honeycomb.translate.util.YangDAG; import io.fd.honeycomb.translate.write.DataObjectUpdate; import io.fd.honeycomb.translate.write.WriteContext; import io.fd.honeycomb.translate.write.Writer; @@ -45,10 +46,9 @@ import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class FlatWriterRegistryBuilderTest { - @Test public void testRelationsBefore() throws Exception { - final FlatWriterRegistryBuilder flatWriterRegistryBuilder = new FlatWriterRegistryBuilder(); + final FlatWriterRegistryBuilder flatWriterRegistryBuilder = new FlatWriterRegistryBuilder(new YangDAG()); /* 1 -> 2 -> 3 -> 4 @@ -70,7 +70,7 @@ public class FlatWriterRegistryBuilderTest { @Test public void testBuild() throws Exception { - final FlatWriterRegistryBuilder flatWriterRegistryBuilder = new FlatWriterRegistryBuilder(); + final FlatWriterRegistryBuilder flatWriterRegistryBuilder = new FlatWriterRegistryBuilder(new YangDAG()); final Writer<? extends DataObject> writer = mockWriter(DataObjects.DataObject3.class); flatWriterRegistryBuilder.add(writer); final WriterRegistry build = flatWriterRegistryBuilder.build(); @@ -94,7 +94,7 @@ public class FlatWriterRegistryBuilderTest { @Test(expected = IllegalArgumentException.class) public void testBuildUnknownWriter() throws Exception { - final FlatWriterRegistryBuilder flatWriterRegistryBuilder = new FlatWriterRegistryBuilder(); + final FlatWriterRegistryBuilder flatWriterRegistryBuilder = new FlatWriterRegistryBuilder(new YangDAG()); final Writer<? extends DataObject> writer = mockWriter(DataObjects.DataObject3.class); flatWriterRegistryBuilder.add(writer); final WriterRegistry build = flatWriterRegistryBuilder.build(); @@ -109,7 +109,7 @@ public class FlatWriterRegistryBuilderTest { @Test public void testRelationsAfter() throws Exception { - final FlatWriterRegistryBuilder flatWriterRegistryBuilder = new FlatWriterRegistryBuilder(); + final FlatWriterRegistryBuilder flatWriterRegistryBuilder = new FlatWriterRegistryBuilder(new YangDAG()); /* 1 -> 2 -> 3 -> 4 @@ -131,7 +131,7 @@ public class FlatWriterRegistryBuilderTest { @Test(expected = IllegalArgumentException.class) public void testRelationsLoop() throws Exception { - final FlatWriterRegistryBuilder flatWriterRegistryBuilder = new FlatWriterRegistryBuilder(); + final FlatWriterRegistryBuilder flatWriterRegistryBuilder = new FlatWriterRegistryBuilder(new YangDAG()); /* 1 -> 2 -> 1 */ @@ -142,14 +142,14 @@ public class FlatWriterRegistryBuilderTest { @Test(expected = IllegalArgumentException.class) public void testAddWriterTwice() throws Exception { - final FlatWriterRegistryBuilder flatWriterRegistryBuilder = new FlatWriterRegistryBuilder(); + final FlatWriterRegistryBuilder flatWriterRegistryBuilder = new FlatWriterRegistryBuilder(new YangDAG()); flatWriterRegistryBuilder.add(mockWriter(DataObjects.DataObject1.class)); flatWriterRegistryBuilder.add(mockWriter(DataObjects.DataObject1.class)); } @Test public void testAddSubtreeWriter() throws Exception { - final FlatWriterRegistryBuilder flatWriterRegistryBuilder = new FlatWriterRegistryBuilder(); + final FlatWriterRegistryBuilder flatWriterRegistryBuilder = new FlatWriterRegistryBuilder(new YangDAG()); flatWriterRegistryBuilder.subtreeAdd( Sets.newHashSet(DataObjects.DataObject4.DataObject41.IID, DataObjects.DataObject4.DataObject41.IID), |