summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/util/StaticReader.java5
-rw-r--r--infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/HoneycombReadInfraTest.java16
-rw-r--r--infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/HoneycombSubtreeReadInfraTest.java2
-rw-r--r--infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/HoneycombWriteInfraTest.java2
-rw-r--r--infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/config/WriterRegistryProvider.java2
-rw-r--r--infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/oper/ReaderRegistryBuilderProvider.java2
-rw-r--r--infra/translate-api/src/main/java/io/fd/honeycomb/translate/read/Reader.java15
-rw-r--r--infra/translate-impl/pom.xml7
-rw-r--r--infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericListReader.java30
-rw-r--r--infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericReader.java11
-rw-r--r--infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReader.java (renamed from infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/registry/CompositeReader.java)38
-rw-r--r--infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistry.java (renamed from infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/registry/CompositeReaderRegistry.java)2
-rw-r--r--infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistryBuilder.java (renamed from infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/registry/CompositeReaderRegistryBuilder.java)8
-rw-r--r--infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/InitSubtreeReader.java (renamed from infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/registry/InitSubtreeReader.java)2
-rw-r--r--infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/SubtreeReader.java (renamed from infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/registry/SubtreeReader.java)41
-rw-r--r--infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/TypeHierarchy.java (renamed from infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/registry/TypeHierarchy.java)2
-rw-r--r--infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistry.java (renamed from infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/write/registry/FlatWriterRegistry.java)2
-rw-r--r--infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryBuilder.java (renamed from infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/write/registry/FlatWriterRegistryBuilder.java)2
-rw-r--r--infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/registry/SubtreeWriter.java (renamed from infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/write/registry/SubtreeWriter.java)2
-rw-r--r--infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/GenericListReaderTest.java3
-rw-r--r--infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistryBuilderTest.java (renamed from infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/registry/CompositeReaderRegistryBuilderTest.java)2
-rw-r--r--infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistryTest.java (renamed from infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/registry/CompositeReaderRegistryTest.java)24
-rw-r--r--infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderTest.java (renamed from infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/registry/CompositeReaderTest.java)4
-rw-r--r--infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/SubtreeReaderTest.java (renamed from infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/registry/SubtreeReaderTest.java)5
-rw-r--r--infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/TypeHierarchyTest.java (renamed from infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/registry/TypeHierarchyTest.java)2
-rw-r--r--infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryBuilderTest.java (renamed from infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/write/registry/FlatWriterRegistryBuilderTest.java)6
-rw-r--r--infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryTest.java (renamed from infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/write/registry/FlatWriterRegistryTest.java)2
-rw-r--r--infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/SubtreeWriterTest.java (renamed from infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/write/registry/SubtreeWriterTest.java)5
-rw-r--r--infra/translate-spi/src/main/java/io/fd/honeycomb/translate/spi/read/ReaderCustomizer.java15
-rw-r--r--infra/translate-utils/pom.xml16
-rw-r--r--infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/AbstractGenericReader.java9
-rw-r--r--infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/BindingBrokerReader.java5
-rw-r--r--infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/DelegatingReader.java103
-rw-r--r--infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/KeepaliveReaderWrapper.java40
-rw-r--r--infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/ReflexiveReader.java57
-rw-r--r--infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/ReflexiveReaderCustomizer.java2
-rw-r--r--ioam/impl/src/test/java/io/fd/honeycomb/vppioam/impl/VppIoamModuleTest.java9
-rw-r--r--lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/LispModuleTest.java4
-rw-r--r--nat/nat2vpp/src/test/java/io/fd/honeycomb/nat/NatModuleTest.java4
-rw-r--r--nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/VppNshModuleTest.java4
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/V3poModuleTest.java4
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/VppStateTest.java2
42 files changed, 282 insertions, 236 deletions
diff --git a/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/util/StaticReader.java b/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/util/StaticReader.java
index 90e560152..76ad0e3d4 100644
--- a/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/util/StaticReader.java
+++ b/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/util/StaticReader.java
@@ -55,6 +55,11 @@ public final class StaticReader<T extends DataObject, B extends Builder<T>> impl
'}';
}
+ @Override
+ public boolean isPresent(final InstanceIdentifier<T> id, final T built, final ReadContext ctx) {
+ return true;
+ }
+
@Nonnull
@Override
public Optional<? extends DataObject> read(@Nonnull final InstanceIdentifier<? extends DataObject> id,
diff --git a/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/HoneycombReadInfraTest.java b/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/HoneycombReadInfraTest.java
index 5ec2b55ba..6d4c9e6f3 100644
--- a/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/HoneycombReadInfraTest.java
+++ b/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/HoneycombReadInfraTest.java
@@ -24,6 +24,7 @@ import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyListOf;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.atLeastOnce;
+import static org.mockito.Mockito.atMost;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.inOrder;
@@ -36,6 +37,8 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
import com.google.common.util.concurrent.CheckedFuture;
import io.fd.honeycomb.translate.impl.read.GenericListReader;
+import io.fd.honeycomb.translate.impl.read.GenericReader;
+import io.fd.honeycomb.translate.impl.read.registry.CompositeReaderRegistryBuilder;
import io.fd.honeycomb.translate.read.ListReader;
import io.fd.honeycomb.translate.read.ReadContext;
import io.fd.honeycomb.translate.read.ReadFailedException;
@@ -43,8 +46,7 @@ import io.fd.honeycomb.translate.read.Reader;
import io.fd.honeycomb.translate.read.registry.ReaderRegistry;
import io.fd.honeycomb.translate.util.RWUtils;
import io.fd.honeycomb.translate.util.read.ReflexiveListReaderCustomizer;
-import io.fd.honeycomb.translate.util.read.ReflexiveReader;
-import io.fd.honeycomb.translate.util.read.registry.CompositeReaderRegistryBuilder;
+import io.fd.honeycomb.translate.util.read.ReflexiveReaderCustomizer;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.stream.Collectors;
@@ -185,8 +187,11 @@ public class HoneycombReadInfraTest extends AbstractInfraTest {
}
}
- private <D extends DataObject, B extends Builder<D>> void verifyNoMoreReadInteractions(final Reader<D, B> reader) {
+ private <D extends DataObject, B extends Builder<D>> void verifyNoMoreReadInteractions(final Reader<D, B> reader)
+ throws ReadFailedException {
verify(reader, atLeastOnce()).getManagedDataObjectType();
+ // Just mark all the isPresent calls as verified
+ verify(reader, atMost(100)).isPresent(any(InstanceIdentifier.class), any(), any());
verifyNoMoreInteractions(reader);
}
@@ -254,7 +259,8 @@ public class HoneycombReadInfraTest extends AbstractInfraTest {
static <D extends DataObject, B extends Builder<D>> Reader<D, B> mockReader(InstanceIdentifier<D> id,
CurrentAttributesReader<D, B> currentAttributesReader,
Class<B> builderClass) {
- final ReflexiveReader<D, B> reflex = new ReflexiveReader<D, B>(id, builderClass) {
+ final Reader<D, B> reflex = new GenericReader<D, B>(id,
+ new ReflexiveReaderCustomizer<>(id.getTargetType(), builderClass)) {
@Override
public void readCurrentAttributes(@Nonnull final InstanceIdentifier<D> id,
@@ -270,6 +276,7 @@ public class HoneycombReadInfraTest extends AbstractInfraTest {
final Reader<D, B> mock = mock(Reader.class);
try {
doAnswer(i -> reflexiveAnswer(reflex, i)).when(mock).read(any(InstanceIdentifier.class), any(ReadContext.class));
+ doAnswer(i -> reflexiveAnswer(reflex, i)).when(mock).isPresent(any(InstanceIdentifier.class), any(), any());
doAnswer(i -> reflexiveAnswer(reflex, i)).when(mock)
.readCurrentAttributes(any(InstanceIdentifier.class), any(builderClass), any(ReadContext.class));
doAnswer(i -> reflexiveAnswer(reflex, i)).when(mock).merge(any(Builder.class), any(id.getTargetType()));
@@ -311,6 +318,7 @@ public class HoneycombReadInfraTest extends AbstractInfraTest {
// not using eq(id) instead using any(InstanceIdentifier.class) due to InstanceIdentifier.equals weird behavior
// with wildcarded instance identifiers for lists
doAnswer(i -> reflexiveAnswer(reflex, i)).when(mock).read(any(InstanceIdentifier.class), any(ReadContext.class));
+ doAnswer(i -> reflexiveAnswer(reflex, i)).when(mock).isPresent(any(InstanceIdentifier.class), any(), any());
doAnswer(i -> reflexiveAnswer(reflex, i)).when(mock)
.readCurrentAttributes(any(InstanceIdentifier.class), any(builderClass), any(ReadContext.class));
doAnswer(i -> reflexiveAnswer(reflex, i)).when(mock).merge(any(Builder.class), any(id.getTargetType()));
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 5bb81b477..1894f4942 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
@@ -32,7 +32,7 @@ import io.fd.honeycomb.translate.read.ReadFailedException;
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.util.read.registry.CompositeReaderRegistryBuilder;
+import io.fd.honeycomb.translate.impl.read.registry.CompositeReaderRegistryBuilder;
import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
diff --git a/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/HoneycombWriteInfraTest.java b/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/HoneycombWriteInfraTest.java
index 12ae6568d..bd51e39de 100644
--- a/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/HoneycombWriteInfraTest.java
+++ b/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/HoneycombWriteInfraTest.java
@@ -29,7 +29,7 @@ import static org.mockito.Mockito.when;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import io.fd.honeycomb.data.DataModification;
-import io.fd.honeycomb.translate.util.write.registry.FlatWriterRegistryBuilder;
+import io.fd.honeycomb.translate.impl.write.registry.FlatWriterRegistryBuilder;
import io.fd.honeycomb.translate.write.WriteFailedException;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.Writer;
diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/config/WriterRegistryProvider.java b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/config/WriterRegistryProvider.java
index f3e8ce200..fa0c298fb 100644
--- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/config/WriterRegistryProvider.java
+++ b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/config/WriterRegistryProvider.java
@@ -18,7 +18,7 @@ package io.fd.honeycomb.infra.distro.data.config;
import com.google.inject.Inject;
import io.fd.honeycomb.infra.distro.ProviderTrait;
-import io.fd.honeycomb.translate.util.write.registry.FlatWriterRegistryBuilder;
+import io.fd.honeycomb.translate.impl.write.registry.FlatWriterRegistryBuilder;
import io.fd.honeycomb.translate.write.WriterFactory;
import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
import java.util.HashSet;
diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/oper/ReaderRegistryBuilderProvider.java b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/oper/ReaderRegistryBuilderProvider.java
index 05177d54d..ab967e164 100644
--- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/oper/ReaderRegistryBuilderProvider.java
+++ b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/data/oper/ReaderRegistryBuilderProvider.java
@@ -20,7 +20,7 @@ import com.google.inject.Inject;
import io.fd.honeycomb.infra.distro.ProviderTrait;
import io.fd.honeycomb.translate.read.ReaderFactory;
import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
-import io.fd.honeycomb.translate.util.read.registry.CompositeReaderRegistryBuilder;
+import io.fd.honeycomb.translate.impl.read.registry.CompositeReaderRegistryBuilder;
import java.util.HashSet;
import java.util.Set;
diff --git a/infra/translate-api/src/main/java/io/fd/honeycomb/translate/read/Reader.java b/infra/translate-api/src/main/java/io/fd/honeycomb/translate/read/Reader.java
index dd9944624..7138006e0 100644
--- a/infra/translate-api/src/main/java/io/fd/honeycomb/translate/read/Reader.java
+++ b/infra/translate-api/src/main/java/io/fd/honeycomb/translate/read/Reader.java
@@ -35,6 +35,21 @@ public interface Reader<D extends DataObject, B extends Builder<D>> extends Subt
// TODO HONEYCOMB-169 make async
/**
+ * Check whether the data from current reader are present or not.
+ * Invoked after {@link #readCurrentAttributes(InstanceIdentifier, Builder, ReadContext)}
+ *
+ * @param id Keyed instance identifier of read data
+ * @param built Read data as returned from builder
+ * after {@link #readCurrentAttributes(InstanceIdentifier, Builder, ReadContext)} invocation
+ * @param ctx Read context
+ *
+ *
+ * @return true if the result value is present.
+ */
+ boolean isPresent(@Nonnull InstanceIdentifier<D> id, @Nonnull D built, @Nonnull ReadContext ctx)
+ throws ReadFailedException;
+
+ /**
* Reads data identified by id
*
* @param id unique identifier of subtree to be read. The subtree must contain managed data object type. For
diff --git a/infra/translate-impl/pom.xml b/infra/translate-impl/pom.xml
index 7892e90af..b431c07f9 100644
--- a/infra/translate-impl/pom.xml
+++ b/infra/translate-impl/pom.xml
@@ -46,6 +46,13 @@
<artifactId>translate-utils</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>translate-utils</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>junit</groupId>
diff --git a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericListReader.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericListReader.java
index ad93e8fe9..b06ac060f 100644
--- a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericListReader.java
+++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericListReader.java
@@ -25,7 +25,6 @@ import io.fd.honeycomb.translate.read.ReadContext;
import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer;
import io.fd.honeycomb.translate.util.RWUtils;
-import io.fd.honeycomb.translate.util.read.AbstractGenericReader;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nonnull;
@@ -48,12 +47,10 @@ import org.slf4j.LoggerFactory;
@Beta
@ThreadSafe
public class GenericListReader<C extends DataObject & Identifiable<K>, K extends Identifier<C>, B extends Builder<C>>
- extends AbstractGenericReader<C, B> implements ListReader<C, K, B> {
+ extends GenericReader<C, B> implements ListReader<C, K, B> {
private static final Logger LOG = LoggerFactory.getLogger(GenericListReader.class);
- protected final ListReaderCustomizer<C, K, B> customizer;
-
/**
* Create new {@link GenericListReader}
*
@@ -62,8 +59,7 @@ public class GenericListReader<C extends DataObject & Identifiable<K>, K extends
*/
public GenericListReader(@Nonnull final InstanceIdentifier<C> managedDataObjectType,
@Nonnull final ListReaderCustomizer<C, K, B> customizer) {
- super(managedDataObjectType);
- this.customizer = customizer;
+ super(managedDataObjectType, customizer);
}
@Override
@@ -92,31 +88,13 @@ public class GenericListReader<C extends DataObject & Identifiable<K>, K extends
public List<K> getAllIds(@Nonnull final InstanceIdentifier<C> id, @Nonnull final ReadContext ctx)
throws ReadFailedException {
LOG.trace("{}: Getting all list ids", this);
- final List<K> allIds = customizer.getAllIds(id, ctx);
+ final List<K> allIds = ((ListReaderCustomizer<C, K, B>) customizer).getAllIds(id, ctx);
LOG.debug("{}: All list ids: {}", this, allIds);
return allIds;
}
@Override
public void merge(@Nonnull final Builder<? extends DataObject> builder, @Nonnull final List<C> readData) {
- customizer.merge(builder, readData);
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<C> id, @Nonnull final B builder,
- @Nonnull final ReadContext ctx)
- throws ReadFailedException {
- try {
- customizer.readCurrentAttributes(id, builder, ctx);
- } catch (RuntimeException e) {
- throw new ReadFailedException(id, e);
- }
+ ((ListReaderCustomizer<C, K, B>) customizer).merge(builder, readData);
}
-
- @Nonnull
- @Override
- public B getBuilder(@Nonnull final InstanceIdentifier<C> id) {
- return customizer.getBuilder(id);
- }
-
}
diff --git a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericReader.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericReader.java
index e76b6e9a3..2bf439f82 100644
--- a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericReader.java
+++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/GenericReader.java
@@ -22,6 +22,7 @@ import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.read.Reader;
import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
import io.fd.honeycomb.translate.util.read.AbstractGenericReader;
+import io.fd.honeycomb.translate.util.read.ReflexiveReaderCustomizer;
import javax.annotation.Nonnull;
import javax.annotation.concurrent.ThreadSafe;
import org.opendaylight.yangtools.concepts.Builder;
@@ -73,4 +74,14 @@ public class GenericReader<C extends DataObject, B extends Builder<C>>
customizer.merge(parentBuilder, readValue);
}
+ @Override
+ public boolean isPresent(final InstanceIdentifier<C> id, final C built, final ReadContext ctx)
+ throws ReadFailedException {
+ return customizer.isPresent(id, built, ctx);
+ }
+
+ public static <C extends DataObject, B extends Builder<C>> Reader<C, B> createReflexive(
+ final InstanceIdentifier<C> id, Class<B> builderClass) {
+ return new GenericReader<>(id, new ReflexiveReaderCustomizer<>(id.getTargetType(), builderClass));
+ }
}
diff --git a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/registry/CompositeReader.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReader.java
index b52fd09ec..ec82b3f7f 100644
--- a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/registry/CompositeReader.java
+++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReader.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.fd.honeycomb.translate.util.read.registry;
+package io.fd.honeycomb.translate.impl.read.registry;
import static com.google.common.base.Preconditions.checkArgument;
@@ -31,6 +31,7 @@ import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.read.Reader;
import io.fd.honeycomb.translate.util.RWUtils;
import io.fd.honeycomb.translate.util.read.AbstractGenericReader;
+import io.fd.honeycomb.translate.util.read.DelegatingReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -46,7 +47,7 @@ import org.slf4j.LoggerFactory;
class CompositeReader<D extends DataObject, B extends Builder<D>>
extends AbstractGenericReader<D, B>
- implements Initializer<D> {
+ implements Initializer<D>, DelegatingReader<D, B> {
private static final Logger LOG = LoggerFactory.getLogger(CompositeReader.class);
@@ -131,6 +132,11 @@ class CompositeReader<D extends DataObject, B extends Builder<D>>
}
@Override
+ public Reader<D, B> getDelegate() {
+ return delegate;
+ }
+
+ @Override
public void readCurrentAttributes(@Nonnull final InstanceIdentifier<D> id, @Nonnull final B builder,
@Nonnull final ReadContext ctx)
throws ReadFailedException {
@@ -138,17 +144,6 @@ class CompositeReader<D extends DataObject, B extends Builder<D>>
readChildren(id, ctx, builder);
}
- @Nonnull
- @Override
- public B getBuilder(final InstanceIdentifier<D> id) {
- return delegate.getBuilder(id);
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder, @Nonnull final D readValue) {
- delegate.merge(parentBuilder, readValue);
- }
-
/**
* Wrap a Reader as a Composite Reader.
*/
@@ -181,7 +176,7 @@ class CompositeReader<D extends DataObject, B extends Builder<D>>
private static class CompositeListReader<D extends DataObject & Identifiable<K>, B extends Builder<D>, K extends Identifier<D>>
extends CompositeReader<D, B>
- implements InitListReader<D, K, B> {
+ implements DelegatingListReader<D, K, B>, InitListReader<D, K, B> {
private final ListReader<D, K, B> delegate;
@@ -191,6 +186,10 @@ class CompositeReader<D extends DataObject, B extends Builder<D>>
this.delegate = reader;
}
+ public ListReader<D, K, B> getDelegate() {
+ return delegate;
+ }
+
@Nonnull
@Override
public List<D> readList(@Nonnull final InstanceIdentifier<D> id, @Nonnull final ReadContext ctx)
@@ -226,16 +225,5 @@ class CompositeReader<D extends DataObject, B extends Builder<D>>
throw new InitFailedException(id, e);
}
}
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> builder, @Nonnull final List<D> readData) {
- delegate.merge(builder, readData);
- }
-
- @Override
- public List<K> getAllIds(@Nonnull final InstanceIdentifier<D> id,
- @Nonnull final ReadContext ctx) throws ReadFailedException {
- return delegate.getAllIds(id, ctx);
- }
}
}
diff --git a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/registry/CompositeReaderRegistry.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistry.java
index 9505a7730..d69e53765 100644
--- a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/registry/CompositeReaderRegistry.java
+++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistry.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.fd.honeycomb.translate.util.read.registry;
+package io.fd.honeycomb.translate.impl.read.registry;
import static com.google.common.base.Preconditions.checkNotNull;
diff --git a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/registry/CompositeReaderRegistryBuilder.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistryBuilder.java
index da9bbe934..290c5d4aa 100644
--- a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/registry/CompositeReaderRegistryBuilder.java
+++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistryBuilder.java
@@ -14,16 +14,16 @@
* limitations under the License.
*/
-package io.fd.honeycomb.translate.util.read.registry;
+package io.fd.honeycomb.translate.impl.read.registry;
import com.google.common.collect.ImmutableMap;
+import io.fd.honeycomb.translate.impl.read.GenericReader;
import io.fd.honeycomb.translate.read.InitReader;
import io.fd.honeycomb.translate.read.Reader;
import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
import io.fd.honeycomb.translate.read.registry.ReaderRegistry;
import io.fd.honeycomb.translate.read.registry.ReaderRegistryBuilder;
import io.fd.honeycomb.translate.util.AbstractSubtreeManagerRegistryBuilderBuilder;
-import io.fd.honeycomb.translate.util.read.ReflexiveReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@@ -54,11 +54,9 @@ public final class CompositeReaderRegistryBuilder
@Override
public <D extends DataObject> void addStructuralReader(@Nonnull InstanceIdentifier<D> id,
@Nonnull Class<? extends Builder<D>> builderType) {
- add(new ReflexiveReader<>(id, builderType));
+ add(GenericReader.createReflexive(id, builderType));
}
-
-
/**
* Create {@link CompositeReaderRegistry} with Readers ordered according to submitted relationships.
* <p/>
diff --git a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/registry/InitSubtreeReader.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/InitSubtreeReader.java
index 4edc38f9d..809cdb214 100644
--- a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/registry/InitSubtreeReader.java
+++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/InitSubtreeReader.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.fd.honeycomb.translate.util.read.registry;
+package io.fd.honeycomb.translate.impl.read.registry;
import io.fd.honeycomb.translate.read.InitFailedException;
import io.fd.honeycomb.translate.read.InitListReader;
diff --git a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/registry/SubtreeReader.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/SubtreeReader.java
index 3bc76b19a..4db6dd70e 100644
--- a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/registry/SubtreeReader.java
+++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/SubtreeReader.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.fd.honeycomb.translate.util.read.registry;
+package io.fd.honeycomb.translate.impl.read.registry;
import static com.google.common.base.Preconditions.checkArgument;
@@ -26,6 +26,7 @@ import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.read.Reader;
import io.fd.honeycomb.translate.util.RWUtils;
import io.fd.honeycomb.translate.util.ReflectionUtils;
+import io.fd.honeycomb.translate.util.read.DelegatingReader;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Collections;
@@ -45,7 +46,7 @@ import org.slf4j.LoggerFactory;
* Simple Reader delegate for subtree Readers (Readers handling also children nodes) providing a list of all the
* children nodes being handled.
*/
-class SubtreeReader<D extends DataObject, B extends Builder<D>> implements Reader<D, B> {
+class SubtreeReader<D extends DataObject, B extends Builder<D>> implements DelegatingReader<D, B> {
private static final Logger LOG = LoggerFactory.getLogger(SubtreeReader.class);
@@ -103,21 +104,8 @@ class SubtreeReader<D extends DataObject, B extends Builder<D>> implements Reade
}
@Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<D> id, @Nonnull final B builder,
- @Nonnull final ReadContext ctx)
- throws ReadFailedException {
- delegate.readCurrentAttributes(id, builder, ctx);
- }
-
- @Nonnull
- @Override
- public B getBuilder(final InstanceIdentifier<D> id) {
- return delegate.getBuilder(id);
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder, @Nonnull final D readValue) {
- delegate.merge(parentBuilder, readValue);
+ public Reader<D, B> getDelegate() {
+ return delegate;
}
@Nonnull
@@ -209,7 +197,7 @@ class SubtreeReader<D extends DataObject, B extends Builder<D>> implements Reade
}
static class SubtreeListReader<D extends DataObject & Identifiable<K>, B extends Builder<D>, K extends Identifier<D>>
- extends SubtreeReader<D, B> implements ListReader<D, K, B> {
+ extends SubtreeReader<D, B> implements DelegatingListReader<D, K, B>, ListReader<D, K, B> {
final ListReader<D, K, B> delegate;
@@ -219,22 +207,9 @@ class SubtreeReader<D extends DataObject, B extends Builder<D>> implements Reade
this.delegate = delegate;
}
- @Nonnull
- @Override
- public List<D> readList(@Nonnull final InstanceIdentifier<D> id, @Nonnull final ReadContext ctx)
- throws ReadFailedException {
- return delegate.readList(id, ctx);
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> builder, @Nonnull final List<D> readData) {
- delegate.merge(builder, readData);
- }
-
@Override
- public List<K> getAllIds(@Nonnull final InstanceIdentifier<D> id,
- @Nonnull final ReadContext ctx) throws ReadFailedException {
- return delegate.getAllIds(id, ctx);
+ public ListReader<D, K, B> getDelegate() {
+ return delegate;
}
}
diff --git a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/registry/TypeHierarchy.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/TypeHierarchy.java
index a30663221..14fc57632 100644
--- a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/registry/TypeHierarchy.java
+++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/read/registry/TypeHierarchy.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.fd.honeycomb.translate.util.read.registry;
+package io.fd.honeycomb.translate.impl.read.registry;
import static com.google.common.base.Preconditions.checkArgument;
diff --git a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/write/registry/FlatWriterRegistry.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistry.java
index e5b829d6a..990431a15 100644
--- a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/write/registry/FlatWriterRegistry.java
+++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistry.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.fd.honeycomb.translate.util.write.registry;
+package io.fd.honeycomb.translate.impl.write.registry;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
diff --git a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/write/registry/FlatWriterRegistryBuilder.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryBuilder.java
index 0f75de7e7..936aa3c1e 100644
--- a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/write/registry/FlatWriterRegistryBuilder.java
+++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryBuilder.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.fd.honeycomb.translate.util.write.registry;
+package io.fd.honeycomb.translate.impl.write.registry;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableMap;
diff --git a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/write/registry/SubtreeWriter.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/registry/SubtreeWriter.java
index bab1da16f..fc6ecc67e 100644
--- a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/write/registry/SubtreeWriter.java
+++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/registry/SubtreeWriter.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.fd.honeycomb.translate.util.write.registry;
+package io.fd.honeycomb.translate.impl.write.registry;
import static com.google.common.base.Preconditions.checkArgument;
diff --git a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/GenericListReaderTest.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/GenericListReaderTest.java
index 0dc916fb8..3ed400dba 100644
--- a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/GenericListReaderTest.java
+++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/GenericListReaderTest.java
@@ -25,7 +25,6 @@ import static org.mockito.Mockito.when;
import com.google.common.collect.Lists;
import io.fd.honeycomb.translate.read.ReadContext;
import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer;
-import java.util.Collections;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
@@ -78,7 +77,7 @@ public class GenericListReaderTest {
@Test
public void testMerge() throws Exception {
reader.merge(builder, data);
- verify(customizer).merge(builder, Collections.singletonList(data));
+ verify(customizer).merge(builder, data);
}
@Test
diff --git a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/registry/CompositeReaderRegistryBuilderTest.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistryBuilderTest.java
index d742575be..4dee8e60f 100644
--- a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/registry/CompositeReaderRegistryBuilderTest.java
+++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistryBuilderTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.fd.honeycomb.translate.util.read.registry;
+package io.fd.honeycomb.translate.impl.read.registry;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
diff --git a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/registry/CompositeReaderRegistryTest.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistryTest.java
index 06cb8498f..40068e02c 100644
--- a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/registry/CompositeReaderRegistryTest.java
+++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderRegistryTest.java
@@ -14,16 +14,16 @@
* limitations under the License.
*/
-package io.fd.honeycomb.translate.util.read.registry;
+package io.fd.honeycomb.translate.impl.read.registry;
import static io.fd.honeycomb.translate.util.DataObjects.DataObject3;
import static io.fd.honeycomb.translate.util.DataObjects.DataObject3.DataObject31;
import static io.fd.honeycomb.translate.util.DataObjects.DataObject4;
import static io.fd.honeycomb.translate.util.DataObjects.DataObject4.DataObject41;
import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -37,6 +37,7 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.InOrder;
import org.mockito.Mock;
+import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.DataObject;
@@ -57,16 +58,27 @@ public class CompositeReaderRegistryTest {
MockitoAnnotations.initMocks(this);
reader31 = mockReader(DataObject31.class);
+ final Reader<DataObject3, Builder<DataObject3>> mockedReader3 = mockReader(DataObject3.class);
rootReader3 =
- spy(CompositeReader.createForReader(
- mockReader(DataObject3.class),
+ Mockito.spy(CompositeReader.createForReader(
+ mockedReader3,
ImmutableMap.of(DataObject31.class, reader31)));
+ // This is a workaround. This functionality is already present in CompositeReader, however when wrapping as spy
+ // null is always returned. That's why we need to explicitly stub the method with its actual implementation.
+ // The problem is that the method is inherited as default method from an interface and mockito's spy seems to
+ // have a problem there
+ doReturn(mockedReader3.getBuilder(InstanceIdentifier.create(DataObject3.class)))
+ .when(rootReader3).getBuilder(any(InstanceIdentifier.class));
reader41 = mockReader(DataObject41.class);
+ final Reader<DataObject4, Builder<DataObject4>> mockedReader4 = mockReader(DataObject4.class);
rootReader4 =
- spy(CompositeReader.createForReader(
- mockReader(DataObject4.class), ImmutableMap.of(
+ Mockito.spy(CompositeReader.createForReader(
+ mockedReader4, ImmutableMap.of(
DataObject41.class, reader41)));
+ // Workaround
+ doReturn(mockedReader4.getBuilder(InstanceIdentifier.create(DataObject4.class)))
+ .when(rootReader4).getBuilder(any(InstanceIdentifier.class));
reg = new CompositeReaderRegistry(Lists.newArrayList(rootReader3, rootReader4));
}
diff --git a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/registry/CompositeReaderTest.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderTest.java
index 9ae036013..8d4bdadda 100644
--- a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/registry/CompositeReaderTest.java
+++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/CompositeReaderTest.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package io.fd.honeycomb.translate.util.read.registry;
+package io.fd.honeycomb.translate.impl.read.registry;
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.util.read.registry.CompositeReaderRegistryTest.mockReader;
+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;
diff --git a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/registry/SubtreeReaderTest.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/SubtreeReaderTest.java
index 799b9553f..d2375e6be 100644
--- a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/registry/SubtreeReaderTest.java
+++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/SubtreeReaderTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.fd.honeycomb.translate.util.read.registry;
+package io.fd.honeycomb.translate.impl.read.registry;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -31,6 +31,7 @@ import io.fd.honeycomb.translate.util.DataObjects;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
+import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.ChildOf;
@@ -49,7 +50,7 @@ public class SubtreeReaderTest {
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
- doReturn(DataObjects.DataObject4.IID).when(delegate).getManagedDataObjectType();
+ Mockito.doReturn(DataObjects.DataObject4.IID).when(delegate).getManagedDataObjectType();
doReturn(DataObject1.IID).when(delegateLocal).getManagedDataObjectType();
}
diff --git a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/registry/TypeHierarchyTest.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/TypeHierarchyTest.java
index 3b3ea3a35..bbccc488b 100644
--- a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/read/registry/TypeHierarchyTest.java
+++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/TypeHierarchyTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.fd.honeycomb.translate.util.read.registry;
+package io.fd.honeycomb.translate.impl.read.registry;
import static org.hamcrest.CoreMatchers.hasItem;
import static org.hamcrest.CoreMatchers.hasItems;
diff --git a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/write/registry/FlatWriterRegistryBuilderTest.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryBuilderTest.java
index 7822c8926..3a6767265 100644
--- a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/write/registry/FlatWriterRegistryBuilderTest.java
+++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryBuilderTest.java
@@ -14,11 +14,10 @@
* limitations under the License.
*/
-package io.fd.honeycomb.translate.util.write.registry;
+package io.fd.honeycomb.translate.impl.write.registry;
import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.hasItems;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
@@ -40,6 +39,7 @@ import io.fd.honeycomb.translate.write.registry.WriterRegistry;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import org.hamcrest.CoreMatchers;
import org.junit.Test;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -171,7 +171,7 @@ public class FlatWriterRegistryBuilderTest {
mockWriter(DataObjects.DataObject4.class));
assertThat(forWriter, instanceOf(SubtreeWriter.class));
assertThat(((SubtreeWriter<?>) forWriter).getHandledChildTypes().size(), is(3));
- assertThat(((SubtreeWriter<?>) forWriter).getHandledChildTypes(), hasItems(DataObjects.DataObject4.DataObject41.IID,
+ assertThat(((SubtreeWriter<?>) forWriter).getHandledChildTypes(), CoreMatchers.hasItems(DataObjects.DataObject4.DataObject41.IID,
DataObjects.DataObject4.DataObject42.IID, DataObjects.DataObject4.DataObject41.DataObject411.IID));
}
diff --git a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/write/registry/FlatWriterRegistryTest.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryTest.java
index 5566fca47..65742df33 100644
--- a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/write/registry/FlatWriterRegistryTest.java
+++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.fd.honeycomb.translate.util.write.registry;
+package io.fd.honeycomb.translate.impl.write.registry;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
diff --git a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/write/registry/SubtreeWriterTest.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/SubtreeWriterTest.java
index 313dd34a8..ff2f83158 100644
--- a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/write/registry/SubtreeWriterTest.java
+++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/SubtreeWriterTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.fd.honeycomb.translate.util.write.registry;
+package io.fd.honeycomb.translate.impl.write.registry;
import static org.hamcrest.CoreMatchers.hasItem;
import static org.junit.Assert.assertEquals;
@@ -25,6 +25,7 @@ import com.google.common.collect.Sets;
import io.fd.honeycomb.translate.util.DataObjects;
import io.fd.honeycomb.translate.write.Writer;
import java.util.Collections;
+import org.hamcrest.CoreMatchers;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
@@ -78,7 +79,7 @@ public class SubtreeWriterTest {
assertEquals(writer.getManagedDataObjectType(), forWriter.getManagedDataObjectType());
assertEquals(1, forWriter.getHandledChildTypes().size());
- assertThat(forWriter.getHandledChildTypes(), hasItem(DataObjects.DataObject4.DataObject41.DataObject411.IID));
+ assertThat(forWriter.getHandledChildTypes(), CoreMatchers.hasItem(DataObjects.DataObject4.DataObject41.DataObject411.IID));
}
} \ No newline at end of file
diff --git a/infra/translate-spi/src/main/java/io/fd/honeycomb/translate/spi/read/ReaderCustomizer.java b/infra/translate-spi/src/main/java/io/fd/honeycomb/translate/spi/read/ReaderCustomizer.java
index acfabf5bc..738431eea 100644
--- a/infra/translate-spi/src/main/java/io/fd/honeycomb/translate/spi/read/ReaderCustomizer.java
+++ b/infra/translate-spi/src/main/java/io/fd/honeycomb/translate/spi/read/ReaderCustomizer.java
@@ -57,4 +57,19 @@ public interface ReaderCustomizer<O extends DataObject, B extends Builder<O>> {
void merge(@Nonnull final Builder<? extends DataObject> parentBuilder, @Nonnull final O readValue);
+ /**
+ * Check whether the resulting value should be added to the results or ignored.
+ * Invoked after {@link #readCurrentAttributes(InstanceIdentifier, Builder, ReadContext)}
+ *
+ * @param id Keyed instance identifier of read data
+ * @param built Read data as returned from builder
+ * after {@link #readCurrentAttributes(InstanceIdentifier, Builder, ReadContext)} invocation
+ * @param ctx Read context
+ *
+ * @return true if value is present (even if empty)
+ */
+ default boolean isPresent(final InstanceIdentifier<O> id, final O built, final ReadContext ctx) throws ReadFailedException {
+ // Default impl = check whether read value is empty
+ return !built.equals(getBuilder(id).build());
+ }
}
diff --git a/infra/translate-utils/pom.xml b/infra/translate-utils/pom.xml
index 1ac453d26..6f01a66fc 100644
--- a/infra/translate-utils/pom.xml
+++ b/infra/translate-utils/pom.xml
@@ -78,4 +78,20 @@
<scope>test</scope>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
diff --git a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/AbstractGenericReader.java b/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/AbstractGenericReader.java
index 40c78b3c9..b19b72ecf 100644
--- a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/AbstractGenericReader.java
+++ b/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/AbstractGenericReader.java
@@ -56,18 +56,15 @@ public abstract class AbstractGenericReader<D extends DataObject, B extends Buil
@Nonnull final ReadContext ctx) throws ReadFailedException {
LOG.debug("{}: Reading current: {}", this, id);
final B builder = getBuilder(id);
- // The empty value could be cached, but no caching is safer since we call overridden getBuilder each time
- // and the build could produce something different (even if it shouldn't)
- final D emptyValue = builder.build();
LOG.trace("{}: Reading current attributes", this);
readCurrentAttributes(id, builder, ctx);
// Need to check whether anything was filled in to determine if data is present or not.
final D built = builder.build();
- final Optional<D> read = built.equals(emptyValue)
- ? Optional.absent()
- : Optional.of(built);
+ final Optional<D> read = isPresent(id, built, ctx)
+ ? Optional.of(built)
+ : Optional.absent();
LOG.debug("{}: Current node read successfully. Result: {}", this, read);
return read;
diff --git a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/BindingBrokerReader.java b/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/BindingBrokerReader.java
index b7a38e97f..e59e642c4 100644
--- a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/BindingBrokerReader.java
+++ b/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/BindingBrokerReader.java
@@ -50,6 +50,11 @@ public final class BindingBrokerReader<D extends DataObject, B extends Builder<D
this.datastoreType = datastoreType;
}
+ @Override
+ public boolean isPresent(final InstanceIdentifier<D> id, final D built, final ReadContext ctx) {
+ throw new UnsupportedOperationException("Not supported");
+ }
+
@Nonnull
@Override
public Optional<? extends DataObject> read(@Nonnull final InstanceIdentifier<? extends DataObject> id,
diff --git a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/DelegatingReader.java b/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/DelegatingReader.java
new file mode 100644
index 000000000..513639610
--- /dev/null
+++ b/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/DelegatingReader.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.honeycomb.translate.util.read;
+
+import com.google.common.base.Optional;
+import io.fd.honeycomb.translate.read.ListReader;
+import io.fd.honeycomb.translate.read.ReadContext;
+import io.fd.honeycomb.translate.read.ReadFailedException;
+import io.fd.honeycomb.translate.read.Reader;
+import java.util.List;
+import javax.annotation.Nonnull;
+import org.opendaylight.yangtools.concepts.Builder;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.Identifiable;
+import org.opendaylight.yangtools.yang.binding.Identifier;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+/**
+ * A trait of a delegating reader. Delegates all the calls to its delegate.
+ */
+public interface DelegatingReader<D extends DataObject, B extends Builder<D>> extends Reader<D, B> {
+
+ Reader<D, B> getDelegate();
+
+ @Nonnull
+ default Optional<? extends DataObject> read(@Nonnull final InstanceIdentifier<? extends DataObject> id,
+ @Nonnull final ReadContext ctx) throws ReadFailedException {
+ return getDelegate().read(id, ctx);
+ }
+
+ default void readCurrentAttributes(@Nonnull final InstanceIdentifier<D> id,
+ @Nonnull final B builder,
+ @Nonnull final ReadContext ctx) throws ReadFailedException {
+ getDelegate().readCurrentAttributes(id, builder, ctx);
+ }
+
+ @Nonnull
+ default B getBuilder(final InstanceIdentifier<D> id) {
+ return getDelegate().getBuilder(id);
+ }
+
+ default void merge(@Nonnull final Builder<? extends DataObject> parentBuilder,
+ @Nonnull final D readValue) {
+ getDelegate().merge(parentBuilder, readValue);
+ }
+
+ @Override
+ default boolean isPresent(InstanceIdentifier<D> id, D built, final ReadContext ctx) throws ReadFailedException {
+ return getDelegate().isPresent(id, built, ctx);
+ }
+
+ @Nonnull
+ default InstanceIdentifier<D> getManagedDataObjectType() {
+ return getDelegate().getManagedDataObjectType();
+ }
+
+ /**
+ * ListReader specific delegating trait.
+ */
+ interface DelegatingListReader<D extends DataObject & Identifiable<K>, K extends Identifier<D>, B extends Builder<D>>
+ extends DelegatingReader<D, B>, ListReader<D, K, B> {
+
+ ListReader<D, K, B> getDelegate();
+
+ @Override
+ default List<K> getAllIds(@Nonnull InstanceIdentifier<D> id, @Nonnull ReadContext ctx)
+ throws ReadFailedException {
+ return getDelegate().getAllIds(id, ctx);
+ }
+
+ @Nonnull
+ @Override
+ default List<D> readList(@Nonnull final InstanceIdentifier<D> id, @Nonnull final ReadContext ctx)
+ throws ReadFailedException {
+ return getDelegate().readList(id, ctx);
+ }
+
+ @Override
+ default void merge(@Nonnull final Builder<? extends DataObject> builder,
+ @Nonnull final List<D> readData) {
+ getDelegate().merge(builder, readData);
+ }
+
+ @Override
+ default void merge(@Nonnull final Builder<? extends DataObject> parentBuilder, @Nonnull final D readValue) {
+ getDelegate().merge(parentBuilder, readValue);
+ }
+ }
+}
diff --git a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/KeepaliveReaderWrapper.java b/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/KeepaliveReaderWrapper.java
index 5ab9bc59e..9a695a53c 100644
--- a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/KeepaliveReaderWrapper.java
+++ b/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/KeepaliveReaderWrapper.java
@@ -18,11 +18,10 @@ package io.fd.honeycomb.translate.util.read;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.Reader;
import io.fd.honeycomb.translate.MappingContext;
import io.fd.honeycomb.translate.ModificationCache;
-import io.fd.honeycomb.translate.read.ReadFailedException;
+import io.fd.honeycomb.translate.read.ReadContext;
+import io.fd.honeycomb.translate.read.Reader;
import java.io.Closeable;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
@@ -40,7 +39,7 @@ import org.slf4j.LoggerFactory;
* In case a specific error occurs, Keep-alive failure listener gets notified.
*/
public final class KeepaliveReaderWrapper<D extends DataObject, B extends Builder<D>>
- implements Reader<D, B>, Runnable, Closeable {
+ implements DelegatingReader<D, B>,Runnable, Closeable {
private static final Logger LOG = LoggerFactory.getLogger(KeepaliveReaderWrapper.class);
@@ -73,34 +72,6 @@ public final class KeepaliveReaderWrapper<D extends DataObject, B extends Builde
scheduledFuture = executor.scheduleWithFixedDelay(this, delayInSeconds, delayInSeconds, TimeUnit.SECONDS);
}
- @Nonnull
- public Optional<? extends DataObject> read(@Nonnull final InstanceIdentifier id,
- @Nonnull final ReadContext ctx) throws ReadFailedException {
- return delegate.read(id, ctx);
- }
-
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<D> id,
- @Nonnull final B builder,
- @Nonnull final ReadContext ctx) throws ReadFailedException {
- delegate.readCurrentAttributes(id, builder, ctx);
- }
-
- @Nonnull
- public B getBuilder(final InstanceIdentifier<D> id) {
- return delegate.getBuilder(id);
- }
-
- public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder,
- @Nonnull final D readValue) {
- delegate.merge(parentBuilder, readValue);
- }
-
- @Nonnull
- @Override
- public InstanceIdentifier<D> getManagedDataObjectType() {
- return delegate.getManagedDataObjectType();
- }
-
@Override
public void run() {
LOG.trace("Invoking keepalive");
@@ -123,6 +94,11 @@ public final class KeepaliveReaderWrapper<D extends DataObject, B extends Builde
scheduledFuture.cancel(false);
}
+ @Override
+ public Reader<D, B> getDelegate() {
+ return delegate;
+ }
+
/**
* Listener that gets called whenever keepalive fails as expected.
*/
diff --git a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/ReflexiveReader.java b/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/ReflexiveReader.java
deleted file mode 100644
index 2aa35514e..000000000
--- a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/ReflexiveReader.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.honeycomb.translate.util.read;
-
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import javax.annotation.Nonnull;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-/**
- * Reader that performs no read operation on its own, just fills in the hierarchy.
- * <p/>
- * Might be slow due to reflection !
- */
-public class ReflexiveReader<C extends DataObject, B extends Builder<C>> extends AbstractGenericReader<C, B> {
-
- private final ReflexiveReaderCustomizer<C, B> customizer;
-
- public ReflexiveReader(final InstanceIdentifier<C> identifier, final Class<B> builderClass) {
- super(identifier);
- this.customizer = new ReflexiveReaderCustomizer<>(identifier.getTargetType(), builderClass);
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<C> id, @Nonnull final B builder,
- @Nonnull final ReadContext ctx)
- throws ReadFailedException {
- customizer.readCurrentAttributes(id, builder, ctx);
- }
-
- @Nonnull
- @Override
- public B getBuilder(final InstanceIdentifier<C> id) {
- return customizer.getBuilder(id);
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> parentBuilder, @Nonnull final C readValue) {
- customizer.merge(parentBuilder, readValue);
- }
-}
diff --git a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/ReflexiveReaderCustomizer.java b/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/ReflexiveReaderCustomizer.java
index 18e6285f3..087873306 100644
--- a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/ReflexiveReaderCustomizer.java
+++ b/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/read/ReflexiveReaderCustomizer.java
@@ -33,7 +33,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
/**
* Might be slow.
*/
-class ReflexiveReaderCustomizer<C extends DataObject, B extends Builder<C>> extends NoopReaderCustomizer<C, B> {
+public class ReflexiveReaderCustomizer<C extends DataObject, B extends Builder<C>> extends NoopReaderCustomizer<C, B> {
private final Class<C> typeClass;
private final Class<B> builderClass;
diff --git a/ioam/impl/src/test/java/io/fd/honeycomb/vppioam/impl/VppIoamModuleTest.java b/ioam/impl/src/test/java/io/fd/honeycomb/vppioam/impl/VppIoamModuleTest.java
index 288122fd0..d9176d39d 100644
--- a/ioam/impl/src/test/java/io/fd/honeycomb/vppioam/impl/VppIoamModuleTest.java
+++ b/ioam/impl/src/test/java/io/fd/honeycomb/vppioam/impl/VppIoamModuleTest.java
@@ -27,13 +27,10 @@ import static org.mockito.MockitoAnnotations.initMocks;
import com.google.inject.Guice;
import com.google.inject.Inject;
import com.google.inject.Provider;
-import com.google.inject.multibindings.Multibinder;
import com.google.inject.name.Named;
import com.google.inject.testing.fieldbinder.Bind;
import com.google.inject.testing.fieldbinder.BoundFieldModule;
-import io.fd.honeycomb.translate.util.read.registry.CompositeReaderRegistryBuilder;
-import io.fd.honeycomb.translate.util.write.registry.FlatWriterRegistryBuilder;
-import io.fd.honeycomb.translate.vpp.util.NamingContext;
+import io.fd.honeycomb.translate.impl.write.registry.FlatWriterRegistryBuilder;
import io.fd.honeycomb.translate.write.WriterFactory;
import java.util.HashSet;
import java.util.Set;
@@ -41,11 +38,7 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.honeycomb.vppioam.impl.config.VppIoamWriterFactory;
-import io.fd.honeycomb.vppioam.impl.util.JVppIoamProvider;
-import io.fd.vpp.jvpp.ioamtrace.future.FutureJVppIoamtrace;
import io.fd.vpp.jvpp.ioamtrace.future.FutureJVppIoamtraceFacade;
import io.fd.vpp.jvpp.JVppRegistry;
diff --git a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/LispModuleTest.java b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/LispModuleTest.java
index 6d1e05ce8..20c6aa3f7 100644
--- a/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/LispModuleTest.java
+++ b/lisp/lisp2vpp/src/test/java/io/fd/honeycomb/lisp/LispModuleTest.java
@@ -29,8 +29,8 @@ import com.google.inject.name.Named;
import com.google.inject.testing.fieldbinder.Bind;
import com.google.inject.testing.fieldbinder.BoundFieldModule;
import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.util.read.registry.CompositeReaderRegistryBuilder;
-import io.fd.honeycomb.translate.util.write.registry.FlatWriterRegistryBuilder;
+import io.fd.honeycomb.translate.impl.read.registry.CompositeReaderRegistryBuilder;
+import io.fd.honeycomb.translate.impl.write.registry.FlatWriterRegistryBuilder;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
import io.fd.honeycomb.translate.write.WriterFactory;
import java.util.HashSet;
diff --git a/nat/nat2vpp/src/test/java/io/fd/honeycomb/nat/NatModuleTest.java b/nat/nat2vpp/src/test/java/io/fd/honeycomb/nat/NatModuleTest.java
index 774dd6f2a..f69672e15 100644
--- a/nat/nat2vpp/src/test/java/io/fd/honeycomb/nat/NatModuleTest.java
+++ b/nat/nat2vpp/src/test/java/io/fd/honeycomb/nat/NatModuleTest.java
@@ -32,8 +32,8 @@ import com.google.inject.name.Named;
import com.google.inject.testing.fieldbinder.Bind;
import com.google.inject.testing.fieldbinder.BoundFieldModule;
import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.util.read.registry.CompositeReaderRegistryBuilder;
-import io.fd.honeycomb.translate.util.write.registry.FlatWriterRegistryBuilder;
+import io.fd.honeycomb.translate.impl.read.registry.CompositeReaderRegistryBuilder;
+import io.fd.honeycomb.translate.impl.write.registry.FlatWriterRegistryBuilder;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
import io.fd.honeycomb.translate.write.WriterFactory;
import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade;
diff --git a/nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/VppNshModuleTest.java b/nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/VppNshModuleTest.java
index 211757474..0da2c1bc4 100644
--- a/nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/VppNshModuleTest.java
+++ b/nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/VppNshModuleTest.java
@@ -31,8 +31,8 @@ import com.google.inject.name.Named;
import com.google.inject.testing.fieldbinder.Bind;
import com.google.inject.testing.fieldbinder.BoundFieldModule;
import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.util.read.registry.CompositeReaderRegistryBuilder;
-import io.fd.honeycomb.translate.util.write.registry.FlatWriterRegistryBuilder;
+import io.fd.honeycomb.translate.impl.read.registry.CompositeReaderRegistryBuilder;
+import io.fd.honeycomb.translate.impl.write.registry.FlatWriterRegistryBuilder;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
import io.fd.honeycomb.translate.write.WriterFactory;
import io.fd.vpp.jvpp.JVppRegistry;
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/V3poModuleTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/V3poModuleTest.java
index 93453dd22..19aa2c98b 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/V3poModuleTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/V3poModuleTest.java
@@ -30,8 +30,8 @@ import com.google.inject.testing.fieldbinder.Bind;
import com.google.inject.testing.fieldbinder.BoundFieldModule;
import io.fd.honeycomb.translate.MappingContext;
import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.util.read.registry.CompositeReaderRegistryBuilder;
-import io.fd.honeycomb.translate.util.write.registry.FlatWriterRegistryBuilder;
+import io.fd.honeycomb.translate.impl.read.registry.CompositeReaderRegistryBuilder;
+import io.fd.honeycomb.translate.impl.write.registry.FlatWriterRegistryBuilder;
import io.fd.honeycomb.translate.write.WriterFactory;
import java.util.HashSet;
import java.util.Set;
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/VppStateTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/VppStateTest.java
index cdb2b0376..cdc352ac5 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/VppStateTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/VppStateTest.java
@@ -35,7 +35,7 @@ import io.fd.honeycomb.translate.impl.read.GenericReader;
import io.fd.honeycomb.translate.read.ReadContext;
import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.read.registry.ReaderRegistry;
-import io.fd.honeycomb.translate.util.read.registry.CompositeReaderRegistryBuilder;
+import io.fd.honeycomb.translate.impl.read.registry.CompositeReaderRegistryBuilder;
import io.fd.honeycomb.vpp.test.util.NamingContextHelper;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
import io.fd.honeycomb.vpp.test.util.FutureProducer;