diff options
author | Jan Srnicek <jsrnicek@cisco.com> | 2017-02-24 10:39:55 +0100 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2017-02-27 11:42:19 +0000 |
commit | ec78f178f542369fdfd696fdc6e4bb872780ac87 (patch) | |
tree | 129206bdf7bb3ad62257d5cfca776e264f70fad6 /infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/HoneycombSubtreeReadInfraTest.java | |
parent | 309d5e1561ba42ee491fa33c3b8c24849dc003fa (diff) |
HONEYCOMB-344 - structural reader for list
Change-Id: Ia02ed73daaeea547d49c9ec2d4d7d10f4db85b5e
Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/HoneycombSubtreeReadInfraTest.java')
-rw-r--r-- | infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/HoneycombSubtreeReadInfraTest.java | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/HoneycombSubtreeReadInfraTest.java b/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/HoneycombSubtreeReadInfraTest.java index 1894f4942..b513b5886 100644 --- a/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/HoneycombSubtreeReadInfraTest.java +++ b/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/HoneycombSubtreeReadInfraTest.java @@ -33,6 +33,8 @@ import io.fd.honeycomb.translate.read.Reader; import io.fd.honeycomb.translate.read.registry.ReaderRegistry; import io.fd.honeycomb.translate.util.read.ReflexiveListReaderCustomizer; import io.fd.honeycomb.translate.impl.read.registry.CompositeReaderRegistryBuilder; + +import java.util.Collections; import java.util.List; import java.util.stream.Collectors; import javax.annotation.Nonnull; @@ -61,22 +63,8 @@ public class HoneycombSubtreeReadInfraTest extends AbstractInfraTest { private ListReader<ListInContainer, ListInContainerKey, ListInContainerBuilder> listInContainerReader = new GenericListReader<>(Ids.LIST_IN_CONTAINER_ID, - new ReflexiveListReaderCustomizer<ListInContainer, ListInContainerKey, ListInContainerBuilder>(Ids.LIST_IN_CONTAINER_ID.getTargetType(), ListInContainerBuilder.class) { - - @Nonnull - @Override - public List<ListInContainerKey> getAllIds(@Nonnull final InstanceIdentifier<ListInContainer> id, - @Nonnull final ReadContext context) - throws ReadFailedException { - // This is the only way of extending subtree reader's list child - // Reflexive list reader has to be used in place of the list(managed by subtree reader perent) - // to enable further children readers. However, it will not work out of the box, because - // reflexive list reader has no way to tell what are the IDs to correctly invoke its children. - // Only way is to override the getAllIds method in reflexive reader and return the same list - // as parent used (this can be done using cache or repeated dump call) - return Lists.newArrayList(new ListInContainerKey(1L), new ListInContainerKey(2L)); - } - + new ReflexiveListReaderCustomizer<ListInContainer, ListInContainerKey, ListInContainerBuilder>(Ids.LIST_IN_CONTAINER_ID.getTargetType(), ListInContainerBuilder.class, + Lists.newArrayList(new ListInContainerKey(1L), new ListInContainerKey(2L))) { @Override public void readCurrentAttributes(final InstanceIdentifier<ListInContainer> id, final ListInContainerBuilder builder, |