diff options
author | Michal Cmarada <mcmarada@cisco.com> | 2019-04-08 11:37:45 +0200 |
---|---|---|
committer | Michal Cmarada <mcmarada@cisco.com> | 2019-04-08 11:37:45 +0200 |
commit | b16cea20258ba537db7c0755208c82ab93331ff7 (patch) | |
tree | 8a5a3c87069b9ce700c34323e75ff434e7acae97 /infra/test-utils | |
parent | 23979469bcf8cd312cb3ec9e9e548003110f68f4 (diff) |
HONEYCOMB-443: ODL bump to Neon
- bumps ODL dependencies to neon
- migrates guava optional to java.utils.optional
Change-Id: Ibdaa365c7e21a341103aba88dfd67277e40d2969
Signed-off-by: Michal Cmarada <mcmarada@cisco.com>
Diffstat (limited to 'infra/test-utils')
10 files changed, 42 insertions, 24 deletions
diff --git a/infra/test-utils/test-tools/pom.xml b/infra/test-utils/test-tools/pom.xml index 140fb797f..2e4a5a795 100644 --- a/infra/test-utils/test-tools/pom.xml +++ b/infra/test-utils/test-tools/pom.xml @@ -83,6 +83,11 @@ <artifactId>mockito-core</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>3.8.1</version> + </dependency> </dependencies> </project>
\ No newline at end of file diff --git a/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/AbstractYangContextHolder.java b/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/AbstractYangContextHolder.java index 93360d25a..7a98ddbc5 100644 --- a/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/AbstractYangContextHolder.java +++ b/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/AbstractYangContextHolder.java @@ -16,10 +16,9 @@ package io.fd.honeycomb.test.tools; -import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec; -import org.opendaylight.yangtools.yang.model.api.SchemaContext; - import javax.annotation.Nonnull; +import org.opendaylight.mdsal.binding.dom.adapter.BindingToNormalizedNodeCodec; +import org.opendaylight.yangtools.yang.model.api.SchemaContext; abstract class AbstractYangContextHolder { diff --git a/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/ContainerNodeDataProcessor.java b/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/ContainerNodeDataProcessor.java index 4e5893e2b..88e8b04a5 100644 --- a/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/ContainerNodeDataProcessor.java +++ b/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/ContainerNodeDataProcessor.java @@ -22,7 +22,7 @@ import static io.fd.honeycomb.translate.util.JsonUtils.readJson; import java.io.InputStream; import javax.annotation.Nonnull; -import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec; +import org.opendaylight.mdsal.binding.dom.adapter.BindingToNormalizedNodeCodec; import org.opendaylight.yangtools.yang.binding.Augmentation; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.Identifiable; diff --git a/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/HoneycombTestRunner.java b/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/HoneycombTestRunner.java index 5b6cc5af8..c7b84dd5b 100644 --- a/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/HoneycombTestRunner.java +++ b/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/HoneycombTestRunner.java @@ -26,7 +26,7 @@ import org.junit.runners.BlockJUnit4ClassRunner; import org.junit.runners.model.FrameworkMethod; import org.junit.runners.model.InitializationError; import org.junit.runners.model.Statement; -import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec; +import org.opendaylight.mdsal.binding.dom.adapter.BindingToNormalizedNodeCodec; import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext; import org.opendaylight.yangtools.yang.data.util.AbstractModuleStringInstanceIdentifierCodec; import org.opendaylight.yangtools.yang.model.api.SchemaContext; diff --git a/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/ListNodeDataProcessor.java b/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/ListNodeDataProcessor.java index dd7efbb84..ee30b7803 100644 --- a/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/ListNodeDataProcessor.java +++ b/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/ListNodeDataProcessor.java @@ -22,7 +22,7 @@ import static io.fd.honeycomb.translate.util.JsonUtils.readListEntryFromJson; import java.io.InputStream; import javax.annotation.Nonnull; -import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec; +import org.opendaylight.mdsal.binding.dom.adapter.BindingToNormalizedNodeCodec; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.Identifiable; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; diff --git a/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/YangContextProducer.java b/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/YangContextProducer.java index 34cc5abd6..71333bfc4 100644 --- a/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/YangContextProducer.java +++ b/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/YangContextProducer.java @@ -24,7 +24,7 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import javassist.ClassPool; import org.apache.commons.lang3.reflect.MethodUtils; -import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec; +import org.opendaylight.mdsal.binding.dom.adapter.BindingToNormalizedNodeCodec; import org.opendaylight.mdsal.binding.dom.codec.gen.impl.StreamWriterGenerator; import org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry; import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext; diff --git a/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/YangDataProcessor.java b/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/YangDataProcessor.java index 6722d01af..7c6e3753c 100644 --- a/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/YangDataProcessor.java +++ b/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/YangDataProcessor.java @@ -19,9 +19,10 @@ package io.fd.honeycomb.test.tools; import java.util.AbstractMap; import java.util.Map; import java.util.Optional; +import java.util.function.Supplier; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec; +import org.opendaylight.mdsal.binding.dom.adapter.BindingToNormalizedNodeCodec; import org.opendaylight.mdsal.binding.generator.impl.BindingSchemaContextUtils; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; @@ -74,7 +75,7 @@ interface YangDataProcessor { return schemaContext; } - final com.google.common.base.Optional<InstanceIdentifier<? extends DataObject>> parentInstanceId; + final Optional<InstanceIdentifier<? extends DataObject>> parentInstanceId; try { parentInstanceId = serializer.toBinding(parentYangId); } catch (DeserializationException e) { @@ -85,12 +86,13 @@ interface YangDataProcessor { throw new IllegalStateException(String.format("Unable to resolve %s to instance identifier", parentYangId)); } - final com.google.common.base.Optional<DataNodeContainer> dataNodeContainerOptional = + final Optional<DataNodeContainer> dataNodeContainerOptional = BindingSchemaContextUtils.findDataNodeContainer(schemaContext, parentInstanceId.get()); if (!dataNodeContainerOptional.isPresent()) { - throw new IllegalArgumentException(String.format("Error finding DataNodeContainer for %s", parentInstanceId.get())); + throw new IllegalArgumentException( + String.format("Error finding DataNodeContainer for %s", parentInstanceId.get())); } final DataNodeContainer parentNode = dataNodeContainerOptional.get(); @@ -99,13 +101,18 @@ interface YangDataProcessor { } @Nonnull - default Map.Entry<InstanceIdentifier<? extends DataObject>, DataObject> nodeBinding(@Nonnull final BindingToNormalizedNodeCodec serializer, - @Nonnull final YangInstanceIdentifier identifier, - @Nonnull final NormalizedNode<?, ?> data) { + default Map.Entry<InstanceIdentifier<? extends DataObject>, DataObject> nodeBinding( + @Nonnull final BindingToNormalizedNodeCodec serializer, + @Nonnull final YangInstanceIdentifier identifier, + @Nonnull final NormalizedNode<?, ?> data) throws IllegalArgumentException { try { return serializer.toBinding(new AbstractMap.SimpleImmutableEntry<>(identifier, data)) - .or(() -> { - throw new IllegalArgumentException(String.format("Unable to create node binding for %s|%s", identifier, data)); + .orElseThrow(new Supplier<RuntimeException>() { + @Override + public RuntimeException get() { + throw new IllegalArgumentException( + String.format("Unable to create node binding for %s|%s", identifier, data)); + } }); } catch (DeserializationException e) { throw new IllegalArgumentException(String.format("Unable to deserialize node %s|%s", identifier, data), e); @@ -113,12 +120,17 @@ interface YangDataProcessor { } @Nonnull - default InstanceIdentifier<? extends DataObject> identifierBinding(@Nonnull final BindingToNormalizedNodeCodec serializer, - @Nonnull final YangInstanceIdentifier identifier) { + default InstanceIdentifier<? extends DataObject> identifierBinding( + @Nonnull final BindingToNormalizedNodeCodec serializer, + @Nonnull final YangInstanceIdentifier identifier) throws IllegalArgumentException{ try { return serializer.toBinding(identifier) - .or(() -> { - throw new IllegalArgumentException(String.format("Unable convert %s to binding", identifier)); + .orElseThrow(new Supplier<RuntimeException>() { + @Override + public RuntimeException get() { + throw new IllegalArgumentException( + String.format("Unable convert %s to binding", identifier)); + } }); } catch (DeserializationException e) { throw new IllegalArgumentException(String.format("Unable to deserialize %s", identifier), e); diff --git a/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/YangDataProcessorRegistry.java b/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/YangDataProcessorRegistry.java index b5057a527..690c01b6b 100644 --- a/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/YangDataProcessorRegistry.java +++ b/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/YangDataProcessorRegistry.java @@ -22,7 +22,7 @@ import java.util.LinkedList; import java.util.List; import java.util.stream.Collectors; import javax.annotation.Nonnull; -import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec; +import org.opendaylight.mdsal.binding.dom.adapter.BindingToNormalizedNodeCodec; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.model.api.SchemaContext; diff --git a/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/annotations/InjectablesProcessor.java b/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/annotations/InjectablesProcessor.java index 0afb89007..7a944924e 100644 --- a/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/annotations/InjectablesProcessor.java +++ b/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/annotations/InjectablesProcessor.java @@ -52,7 +52,8 @@ public interface InjectablesProcessor { return parameter.getAnnotation(InjectTestData.class).resourcePath(); } - default YangInstanceIdentifier instanceIdentifier(@Nonnull final AbstractModuleStringInstanceIdentifierCodec parser, @Nonnull final Field field) { + default YangInstanceIdentifier instanceIdentifier(@Nonnull final AbstractModuleStringInstanceIdentifierCodec parser, + @Nonnull final Field field) { final String identifier = field.getAnnotation(InjectTestData.class).id(); // == used instead of equals to ensure constant was used if (NO_ID.equals(identifier)) { @@ -62,7 +63,8 @@ public interface InjectablesProcessor { } } - default YangInstanceIdentifier instanceIdentifier(@Nonnull final AbstractModuleStringInstanceIdentifierCodec parser, @Nonnull final Parameter parameter) { + default YangInstanceIdentifier instanceIdentifier(@Nonnull final AbstractModuleStringInstanceIdentifierCodec parser, + @Nonnull final Parameter parameter) { final String identifier = parameter.getAnnotation(InjectTestData.class).id(); // == used instead of equals to ensure constant was used if (NO_ID.equals(identifier)) { diff --git a/infra/test-utils/test-tools/src/test/java/io/fd/honeycomb/test/tools/AbstractYangDataProcessorTest.java b/infra/test-utils/test-tools/src/test/java/io/fd/honeycomb/test/tools/AbstractYangDataProcessorTest.java index 4018d441c..d719ee721 100644 --- a/infra/test-utils/test-tools/src/test/java/io/fd/honeycomb/test/tools/AbstractYangDataProcessorTest.java +++ b/infra/test-utils/test-tools/src/test/java/io/fd/honeycomb/test/tools/AbstractYangDataProcessorTest.java @@ -21,7 +21,7 @@ import io.fd.honeycomb.test.tools.annotations.InjectablesProcessor; import java.lang.reflect.InvocationTargetException; import java.util.Collections; import org.junit.Before; -import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec; +import org.opendaylight.mdsal.binding.dom.adapter.BindingToNormalizedNodeCodec; import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.hc.data.rev150105.$YangModuleInfoImpl; import org.opendaylight.yangtools.yang.data.util.AbstractModuleStringInstanceIdentifierCodec; |