summaryrefslogtreecommitdiffstats
path: root/infra/test-utils/test-tools
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2017-05-19 09:30:58 +0200
committerMarek Gradzki <mgradzki@cisco.com>2017-05-19 10:31:58 +0200
commit8166c0a4615ae23694ea7a4a7b050a68e9df9770 (patch)
tree3b00247a58e9e0bedc674db10a02f6d3121326f8 /infra/test-utils/test-tools
parentbe05d84deebf8bd030bb6564d5cd49094f6da961 (diff)
Remove unnecessary usages of Supplier interface
Change-Id: I6bc2f99806f81c206dcf31711a01fcebe809288a Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'infra/test-utils/test-tools')
-rw-r--r--infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/ContainerNodeDataProcessor.java15
-rw-r--r--infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/ListNodeDataProcessor.java15
-rw-r--r--infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/YangDataProcessor.java18
3 files changed, 22 insertions, 26 deletions
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 b7641e01d..4e5893e2b 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
@@ -16,6 +16,12 @@
package io.fd.honeycomb.test.tools;
+import static com.google.common.base.Preconditions.checkState;
+import static io.fd.honeycomb.translate.util.JsonUtils.readContainerEntryJson;
+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.yangtools.yang.binding.Augmentation;
import org.opendaylight.yangtools.yang.binding.DataObject;
@@ -28,13 +34,6 @@ import org.opendaylight.yangtools.yang.model.api.SchemaNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.annotation.Nonnull;
-import java.io.InputStream;
-
-import static com.google.common.base.Preconditions.checkState;
-import static io.fd.honeycomb.translate.util.JsonUtils.readContainerEntryJson;
-import static io.fd.honeycomb.translate.util.JsonUtils.readJson;
-
final class ContainerNodeDataProcessor extends AbstractYangContextHolder implements YangDataProcessor {
private static final Logger LOG = LoggerFactory.getLogger(ContainerNodeDataProcessor.class);
@@ -51,7 +50,7 @@ final class ContainerNodeDataProcessor extends AbstractYangContextHolder impleme
checkState(resourceStream != null, "Resource %s not found", resourcePath);
final YangInstanceIdentifier nodeParent = getNodeParent(yangInstanceIdentifier).orElse(null);
- final SchemaNode parentSchema = parentSchema(schemaContext(), serializer(), nodeParent, () -> LOG);
+ final SchemaNode parentSchema = parentSchema(schemaContext(), serializer(), nodeParent, LOG);
// to be able to process containers in root of model
if (isRoot(yangInstanceIdentifier)) {
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 c14ea354e..dd7efbb84 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
@@ -16,6 +16,12 @@
package io.fd.honeycomb.test.tools;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkState;
+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.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.Identifiable;
@@ -26,13 +32,6 @@ import org.opendaylight.yangtools.yang.model.api.SchemaNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.annotation.Nonnull;
-import java.io.InputStream;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkState;
-import static io.fd.honeycomb.translate.util.JsonUtils.readListEntryFromJson;
-
/**
* json --> BA processor for list entry data
*/
@@ -55,7 +54,7 @@ final class ListNodeDataProcessor extends AbstractYangContextHolder implements Y
final InputStream resourceStream = this.getClass().getResourceAsStream(resourcePath);
checkState(resourceStream != null, "Resource %s not found", resourcePath);
- final SchemaNode parentSchemaNode = parentSchema(schemaContext(), serializer(), listParent, () -> LOG);
+ final SchemaNode parentSchemaNode = parentSchema(schemaContext(), serializer(), listParent, LOG);
final MapEntryNode data = readListEntryFromJson(schemaContext(), resourceStream, parentSchemaNode, keyedNodeIdentifier);
return nodeBinding(serializer(), nodeIdentifier, data).getValue();
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 a353e4b3b..fe46410d7 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
@@ -16,6 +16,11 @@
package io.fd.honeycomb.test.tools;
+import java.util.AbstractMap;
+import java.util.Map;
+import java.util.Optional;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec;
import org.opendaylight.yangtools.sal.binding.generator.impl.BindingSchemaContextUtils;
import org.opendaylight.yangtools.yang.binding.DataObject;
@@ -28,13 +33,6 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.api.SchemaNode;
import org.slf4j.Logger;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import java.util.AbstractMap;
-import java.util.Map;
-import java.util.Optional;
-import java.util.function.Supplier;
-
interface YangDataProcessor {
/**
@@ -68,11 +66,11 @@ interface YangDataProcessor {
default SchemaNode parentSchema(@Nonnull final SchemaContext schemaContext,
@Nonnull final BindingToNormalizedNodeCodec serializer,
@Nullable final YangInstanceIdentifier parentYangId,
- @Nonnull final Supplier<Logger> logProvider) {
+ @Nonnull final Logger logger) {
// null or root
if (parentYangId == null || parentYangId.getPathArguments().size() == 0) {
// no parent == use schema context as root context
- logProvider.get().info("Parent is null, providing schema context as parent node");
+ logger.info("Parent is null, providing schema context as parent node");
return schemaContext;
}
@@ -96,7 +94,7 @@ interface YangDataProcessor {
}
final DataNodeContainer parentNode = dataNodeContainerOptional.get();
- logProvider.get().info("Parent schema node resolved as {}", parentNode);
+ logger.info("Parent schema node resolved as {}", parentNode);
return (SchemaNode) parentNode;
}