diff options
Diffstat (limited to 'infra/it')
4 files changed, 19 insertions, 6 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; |