From: Robert Varga Date: Sun, 24 Oct 2021 21:35:35 +0000 (+0200) Subject: Add RestconfQueryParam X-Git-Tag: v2.0.6~15 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=7aa22c32092b288d6523926c37b2baeb894166c8;p=netconf.git Add RestconfQueryParam Add a useful common interface for all query parameters and shorten their names a bit. JIRA: NETCONF-773 Change-Id: I7fb00d14dcb1517bdecb13bda373b50fb280213c Signed-off-by: Robert Varga --- diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/AbstractReplayParameter.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/AbstractReplayParam.java similarity index 58% rename from restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/AbstractReplayParameter.java rename to restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/AbstractReplayParam.java index a413ea9129..7cafeac8c1 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/AbstractReplayParameter.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/AbstractReplayParam.java @@ -12,38 +12,38 @@ import static java.util.Objects.requireNonNull; import com.google.common.annotations.Beta; import com.google.common.base.MoreObjects; import java.net.URI; -import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; -import org.opendaylight.yangtools.concepts.Immutable; /** * Abstract base class for StartTimeParameter and StopTimeParameter. */ @Beta -@NonNullByDefault -public abstract class AbstractReplayParameter implements Immutable { - private static final URI CAPABILITY = URI.create("urn:ietf:params:restconf:capability:replay:1.0"); +// FIXME: sealed when we have JDK17+ +public abstract class AbstractReplayParam> implements RestconfQueryParam { + private static final @NonNull URI CAPABILITY = URI.create("urn:ietf:params:restconf:capability:replay:1.0"); - private final DateAndTime value; + private final @NonNull DateAndTime value; - AbstractReplayParameter(final DateAndTime value) { + AbstractReplayParam(final DateAndTime value) { this.value = requireNonNull(value); } - public final DateAndTime value() { + public final @NonNull DateAndTime value() { return value; } - public final String uriValue() { + @Override + public final String paramValue() { return value.getValue(); } @Override public final String toString() { - return MoreObjects.toStringHelper(this).add("value", uriValue()).toString(); + return MoreObjects.toStringHelper(this).add("value", paramValue()).toString(); } - public static final URI capabilityUri() { + public static final @NonNull URI capabilityUri() { return CAPABILITY; } } diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/ContentParameter.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/ContentParam.java similarity index 76% rename from restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/ContentParameter.java rename to restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/ContentParam.java index b55bcfa5a6..f4f6fa5438 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/ContentParameter.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/ContentParam.java @@ -16,7 +16,7 @@ import org.eclipse.jdt.annotation.Nullable; * Enumeration of possible {@code content} values as defined by * RFC8040, section 4.8.1. */ -public enum ContentParameter { +public enum ContentParam implements RestconfQueryParam { /** * Return all descendant data nodes. */ @@ -32,11 +32,22 @@ public enum ContentParameter { private final @NonNull String uriValue; - ContentParameter(final String uriValue) { + ContentParam(final String uriValue) { this.uriValue = requireNonNull(uriValue); } - public @NonNull String uriValue() { + @Override + public final Class<@NonNull ContentParam> javaClass() { + return ContentParam.class; + } + + @Override + public final String paramName() { + return uriName(); + } + + @Override + public String paramValue() { return uriValue; } @@ -45,7 +56,7 @@ public enum ContentParameter { } // Note: returns null of unknowns - public static @Nullable ContentParameter forUriValue(final String uriValue) { + public static @Nullable ContentParam forUriValue(final String uriValue) { switch (uriValue) { case "all": return ALL; diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/DepthParameter.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/DepthParam.java similarity index 61% rename from restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/DepthParameter.java rename to restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/DepthParam.java index acad8be197..d489c7f0bd 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/DepthParameter.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/DepthParam.java @@ -13,56 +13,62 @@ import com.google.common.annotations.Beta; import java.net.URI; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; -import org.opendaylight.yangtools.concepts.Immutable; /** * This class represents a {@code depth} parameter as defined in * RFC8040 section 4.8.2. */ -public final class DepthParameter implements Immutable { +public final class DepthParam implements RestconfQueryParam { private static final @NonNull URI CAPABILITY = URI.create("urn:ietf:params:restconf:capability:depth:1.0"); - private static final @NonNull DepthParameter MIN = of(1); - private static final @NonNull DepthParameter MAX = of(65535); + private static final @NonNull DepthParam MIN = of(1); + private static final @NonNull DepthParam MAX = of(65535); private final int value; - private DepthParameter(final int value) { + private DepthParam(final int value) { this.value = value; checkArgument(value >= 1 && value <= 65535); } - public static @NonNull DepthParameter of(final int value) { - return new DepthParameter(value); + public static @NonNull DepthParam of(final int value) { + return new DepthParam(value); } - @Beta - public static @NonNull DepthParameter min() { - return MIN; - } - - @Beta - public static @NonNull DepthParameter max() { - return MAX; + @Override + public Class<@NonNull DepthParam> javaClass() { + return DepthParam.class; } - public static @Nullable DepthParameter forUriValue(final String uriValue) { - return uriValue.equals(unboundedUriValue()) ? null : of(Integer.parseUnsignedInt(uriValue, 10)); + @Override + public String paramName() { + return uriName(); } - public int value() { - return value; + @Override + public String paramValue() { + return String.valueOf(value); } public static @NonNull String uriName() { return "depth"; } - public @NonNull String uriValue() { - return String.valueOf(value); + @Beta + public static @NonNull DepthParam min() { + return MIN; + } + + @Beta + public static @NonNull DepthParam max() { + return MAX; + } + + public static @Nullable DepthParam forUriValue(final String uriValue) { + return "unbounded".equals(uriValue) ? null : of(Integer.parseUnsignedInt(uriValue, 10)); } - public static String unboundedUriValue() { - return "unbounded"; + public int value() { + return value; } public static @NonNull URI capabilityUri() { diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/FieldsParameter.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/FieldsParam.java similarity index 84% rename from restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/FieldsParameter.java rename to restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/FieldsParam.java index ab6623f3f5..e51b45a090 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/FieldsParameter.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/FieldsParam.java @@ -15,6 +15,7 @@ import com.google.common.base.MoreObjects; import com.google.common.collect.ImmutableList; import java.net.URI; import java.text.ParseException; +import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.NonNullByDefault; import org.opendaylight.restconf.nb.rfc8040.ApiPath.ApiIdentifier; import org.opendaylight.yangtools.concepts.Immutable; @@ -25,7 +26,7 @@ import org.opendaylight.yangtools.concepts.Immutable; */ @Beta @NonNullByDefault -public final class FieldsParameter implements Immutable { +public final class FieldsParam implements RestconfQueryParam { /** * A selector for a single node as identified by {@link #path()}. Individual child nodes are subject to further * filtering based on {@link #subSelectors()}. @@ -76,12 +77,12 @@ public final class FieldsParameter implements Immutable { private static final URI CAPABILITY = URI.create("urn:ietf:params:restconf:capability:fields:1.0"); private final ImmutableList nodeSelectors; - private final String uriValue; + private final String paramValue; - private FieldsParameter(final ImmutableList nodeSelectors, final String uriValue) { + private FieldsParam(final ImmutableList nodeSelectors, final String uriValue) { this.nodeSelectors = requireNonNull(nodeSelectors); checkArgument(!nodeSelectors.isEmpty(), "At least one selector is required"); - this.uriValue = requireNonNull(uriValue); + this.paramValue = requireNonNull(uriValue); } /** @@ -91,8 +92,18 @@ public final class FieldsParameter implements Immutable { * @return The contents of parameter * @throws ParseException if {@code str} does not represent a valid {@code fields} parameter. */ - public static FieldsParameter parse(final String str) throws ParseException { - return new FieldsParameter(new FieldsParameterParser().parseNodeSelectors(str), str); + public static FieldsParam parse(final String str) throws ParseException { + return new FieldsParam(new FieldsParameterParser().parseNodeSelectors(str), str); + } + + @Override + public Class<@NonNull FieldsParam> javaClass() { + return FieldsParam.class; + } + + @Override + public String paramName() { + return uriName(); } public static String uriName() { @@ -112,9 +123,9 @@ public final class FieldsParameter implements Immutable { return nodeSelectors; } - // FIXME: for migration only - public String uriValue() { - return uriValue; + @Override + public String paramValue() { + return paramValue; } @Override diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/FieldsParameterParser.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/FieldsParameterParser.java index d8eb31b5e8..177c23222b 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/FieldsParameterParser.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/FieldsParameterParser.java @@ -16,12 +16,12 @@ import java.util.Deque; import java.util.List; import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.restconf.nb.rfc8040.ApiPath.ApiIdentifier; -import org.opendaylight.restconf.nb.rfc8040.FieldsParameter.NodeSelector; +import org.opendaylight.restconf.nb.rfc8040.FieldsParam.NodeSelector; import org.opendaylight.yangtools.yang.common.YangNames; /** - * Stateful parser for {@link FieldsParameter}. This is not as hard as IETF's ABNF would lead you to believe. The - * original definition is: + * Stateful parser for {@link FieldsParam}. This is not as hard as IETF's ABNF would lead you to believe. The original + * definition is: *
  *    fields-expr = path "(" fields-expr ")" / path ";" fields-expr / path
  *    path = api-identifier [ "/" path ]
@@ -55,7 +55,7 @@ import org.opendaylight.yangtools.yang.common.YangNames;
  * 
* *

- * That ANTLR4 grammar dictates the layout of {@link FieldsParameter}. It also shows the parsing is recursive on + * That ANTLR4 grammar dictates the layout of {@link FieldsParam}. It also shows the parsing is recursive on * {@code node-selectors}, which is what {@link #parse(String)} and * {@link NodeSelectorParser#parseSubSelectors(String, int)} deal with. */ diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/FilterParameter.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/FilterParam.java similarity index 70% rename from restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/FilterParameter.java rename to restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/FilterParam.java index 8d4ed56bd4..f66bd2dfd2 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/FilterParameter.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/FilterParam.java @@ -11,35 +11,45 @@ import static java.util.Objects.requireNonNull; import java.net.URI; import org.eclipse.jdt.annotation.NonNull; -import org.opendaylight.yangtools.concepts.Immutable; /** * This class represents a {@code filter} parameter as defined in * RFC8040 section 4.8.4. */ -public final class FilterParameter implements Immutable { +public final class FilterParam implements RestconfQueryParam { private static final @NonNull URI CAPABILITY = URI.create("urn:ietf:params:restconf:capability:filter:1.0"); // FIXME: can we have a parsed, but not bound version of an XPath, please? private final @NonNull String value; - private FilterParameter(final String value) { + private FilterParam(final String value) { this.value = requireNonNull(value); } - public static @NonNull FilterParameter forUriValue(final String uriValue) { - return new FilterParameter(uriValue); + @Override + public Class<@NonNull FilterParam> javaClass() { + return FilterParam.class; } - public static @NonNull String uriName() { - return "filter"; + @Override + public String paramName() { + return uriName(); } - public @NonNull String uriValue() { + @Override + public String paramValue() { return value; } + public static @NonNull FilterParam forUriValue(final String uriValue) { + return new FilterParam(uriValue); + } + + public static @NonNull String uriName() { + return "filter"; + } + public static @NonNull URI capabilityUri() { return CAPABILITY; } diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/InsertParameter.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/InsertParam.java similarity index 79% rename from restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/InsertParameter.java rename to restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/InsertParam.java index e6bbceebc6..206e66a627 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/InsertParameter.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/InsertParam.java @@ -16,7 +16,7 @@ import org.eclipse.jdt.annotation.Nullable; * Enumeration of possible {@code insert} values as defined by * RFC8040, section 4.8.1. */ -public enum InsertParameter { +public enum InsertParam implements RestconfQueryParam { /** * Insert the new data after the insertion point, as specified by the value of the "point" parameter. */ @@ -36,11 +36,22 @@ public enum InsertParameter { private @NonNull String uriValue; - InsertParameter(final String uriValue) { + InsertParam(final String uriValue) { this.uriValue = requireNonNull(uriValue); } - public @NonNull String uriValue() { + @Override + public Class<@NonNull InsertParam> javaClass() { + return InsertParam.class; + } + + @Override + public String paramName() { + return uriName(); + } + + @Override + public String paramValue() { return uriValue; } @@ -49,7 +60,7 @@ public enum InsertParameter { } // Note: returns null of unknowns - public static @Nullable InsertParameter forUriValue(final String uriValue) { + public static @Nullable InsertParam forUriValue(final String uriValue) { switch (uriValue) { case "after": return AFTER; diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/NotificationQueryParams.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/NotificationQueryParams.java index 0ce477cea2..afa522f0b4 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/NotificationQueryParams.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/NotificationQueryParams.java @@ -19,21 +19,21 @@ import org.opendaylight.yangtools.concepts.Immutable; * Parser and holder of query parameters from uriInfo for notifications. */ public final class NotificationQueryParams implements Immutable { - private final StartTimeParameter startTime; - private final StopTimeParameter stopTime; - private final FilterParameter filter; + private final StartTimeParam startTime; + private final StopTimeParam stopTime; + private final FilterParam filter; private final boolean skipNotificationData; - private NotificationQueryParams(final StartTimeParameter startTime, final StopTimeParameter stopTime, - final FilterParameter filter, final boolean skipNotificationData) { + private NotificationQueryParams(final StartTimeParam startTime, final StopTimeParam stopTime, + final FilterParam filter, final boolean skipNotificationData) { this.startTime = startTime; this.stopTime = stopTime; this.filter = filter; this.skipNotificationData = skipNotificationData; } - public static @NonNull NotificationQueryParams of(final StartTimeParameter startTime, - final StopTimeParameter stopTime, final FilterParameter filter, final boolean skipNotificationData) { + public static @NonNull NotificationQueryParams of(final StartTimeParam startTime, final StopTimeParam stopTime, + final FilterParam filter, final boolean skipNotificationData) { checkArgument(stopTime == null || startTime != null, "Stop-time parameter has to be used with start-time parameter."); return new NotificationQueryParams(startTime, stopTime, filter, skipNotificationData); @@ -44,7 +44,7 @@ public final class NotificationQueryParams implements Immutable { * * @return start-time */ - public @Nullable StartTimeParameter startTime() { + public @Nullable StartTimeParam startTime() { return startTime; } @@ -53,7 +53,7 @@ public final class NotificationQueryParams implements Immutable { * * @return stop-time */ - public @Nullable StopTimeParameter stopTime() { + public @Nullable StopTimeParam stopTime() { return stopTime; } @@ -62,7 +62,7 @@ public final class NotificationQueryParams implements Immutable { * * @return filter */ - public @Nullable FilterParameter filter() { + public @Nullable FilterParam filter() { return filter; } @@ -79,13 +79,13 @@ public final class NotificationQueryParams implements Immutable { public String toString() { final var helper = MoreObjects.toStringHelper(this); if (startTime != null) { - helper.add("startTime", startTime.uriValue()); + helper.add("startTime", startTime.paramValue()); } if (stopTime != null) { - helper.add("stopTime", stopTime.uriValue()); + helper.add("stopTime", stopTime.paramValue()); } if (filter != null) { - helper.add("filter", filter.uriValue()); + helper.add("filter", filter.paramValue()); } return helper.add("skipNotificationData", skipNotificationData).toString(); } diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/PointParameter.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/PointParam.java similarity index 63% rename from restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/PointParameter.java rename to restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/PointParam.java index b3670debfe..1cfc3c01c8 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/PointParameter.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/PointParam.java @@ -9,24 +9,39 @@ package org.opendaylight.restconf.nb.rfc8040; import static java.util.Objects.requireNonNull; +import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.NonNullByDefault; -import org.opendaylight.yangtools.concepts.Immutable; /** * This class represents a {@code point} parameter as defined in * RFC8040 section 4.8.4. */ @NonNullByDefault -public final class PointParameter implements Immutable { +public final class PointParam implements RestconfQueryParam { // FIXME: This should be ApiPath private final String value; - private PointParameter(final String value) { + private PointParam(final String value) { this.value = requireNonNull(value); } - public static PointParameter forUriValue(final String uriValue) { - return new PointParameter(uriValue); + @Override + public Class<@NonNull PointParam> javaClass() { + return PointParam.class; + } + + @Override + public String paramName() { + return uriName(); + } + + @Override + public String paramValue() { + return value; + } + + public static PointParam forUriValue(final String uriValue) { + return new PointParam(uriValue); } public static String uriName() { diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/ReadDataParams.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/ReadDataParams.java index 31a8a2dbc6..e1faefad39 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/ReadDataParams.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/ReadDataParams.java @@ -22,17 +22,17 @@ import org.opendaylight.yangtools.concepts.Immutable; // FIXME: this should be a record once we have JDK17+ public final class ReadDataParams implements Immutable { private static final @NonNull ReadDataParams EMPTY = - new ReadDataParams(ContentParameter.ALL, null, null, null, false, false); + new ReadDataParams(ContentParam.ALL, null, null, null, false, false); - private final @NonNull ContentParameter content; - private final WithDefaultsParameter withDefaults; - private final FieldsParameter fields; - private final DepthParameter depth; + private final @NonNull ContentParam content; + private final WithDefaultsParam withDefaults; + private final FieldsParam fields; + private final DepthParam depth; private final boolean prettyPrint; private final boolean tagged; - private ReadDataParams(final ContentParameter content, final DepthParameter depth, final FieldsParameter fields, - final WithDefaultsParameter withDefaults, final boolean tagged, final boolean prettyPrint) { + private ReadDataParams(final ContentParam content, final DepthParam depth, final FieldsParam fields, + final WithDefaultsParam withDefaults, final boolean tagged, final boolean prettyPrint) { this.content = requireNonNull(content); this.depth = depth; this.fields = fields; @@ -45,25 +45,25 @@ public final class ReadDataParams implements Immutable { return EMPTY; } - public static @NonNull ReadDataParams of(final ContentParameter content, final DepthParameter depth, - final FieldsParameter fields, final WithDefaultsParameter withDefaults, final boolean tagged, + public static @NonNull ReadDataParams of(final ContentParam content, final DepthParam depth, + final FieldsParam fields, final WithDefaultsParam withDefaults, final boolean tagged, final boolean prettyPrint) { return new ReadDataParams(content, depth, fields, withDefaults, tagged, prettyPrint); } - public @NonNull ContentParameter content() { + public @NonNull ContentParam content() { return content; } - public @Nullable DepthParameter depth() { + public @Nullable DepthParam depth() { return depth; } - public @Nullable FieldsParameter fields() { + public @Nullable FieldsParam fields() { return fields; } - public @Nullable WithDefaultsParameter withDefaults() { + public @Nullable WithDefaultsParam withDefaults() { return withDefaults; } @@ -78,7 +78,7 @@ public final class ReadDataParams implements Immutable { @Override public String toString() { - final var helper = MoreObjects.toStringHelper(this).add("content", content.uriValue()); + final var helper = MoreObjects.toStringHelper(this).add("content", content.paramValue()); if (depth != null) { helper.add("depth", depth.value()); } @@ -86,7 +86,7 @@ public final class ReadDataParams implements Immutable { helper.add("fields", fields.toString()); } if (withDefaults != null) { - helper.add("withDefaults", withDefaults.uriValue()); + helper.add("withDefaults", withDefaults.paramValue()); } return helper.add("tagged", tagged).add("prettyPrint", prettyPrint).toString(); } diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/RestconfQueryParam.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/RestconfQueryParam.java new file mode 100644 index 0000000000..f3f43996dd --- /dev/null +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/RestconfQueryParam.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.restconf.nb.rfc8040; + +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.concepts.Immutable; + +/** + * Interface implemented by all Java classes which represent a + * RESTCONF query parameter. + */ +// FIXME: sealed when we have JDK17+? +public interface RestconfQueryParam> extends Immutable { + /** + * Return the Java representation class. + * + * @return the Java representation class + */ + @NonNull Class<@NonNull T> javaClass(); + + /** + * Return the URI Request parameter name. + * + * @return the URI Request parameter name. + */ + @NonNull String paramName(); + + /** + * Return the URI Request parameter value. + * + * @return the URI Request parameter value. + */ + @NonNull String paramValue(); +} diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/StartTimeParameter.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/StartTimeParam.java similarity index 62% rename from restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/StartTimeParameter.java rename to restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/StartTimeParam.java index 01d8de9f2d..3d4c0acae8 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/StartTimeParameter.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/StartTimeParam.java @@ -14,20 +14,30 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types. * This class represents a {@code start-time} parameter as defined in * RFC8040 section 4.8.7. */ -public final class StartTimeParameter extends AbstractReplayParameter { - private StartTimeParameter(final DateAndTime value) { +public final class StartTimeParam extends AbstractReplayParam { + private StartTimeParam(final DateAndTime value) { super(value); } - public static @NonNull StartTimeParameter of(final DateAndTime value) { - return new StartTimeParameter(value); + public static @NonNull StartTimeParam of(final DateAndTime value) { + return new StartTimeParam(value); + } + + @Override + public Class<@NonNull StartTimeParam> javaClass() { + return StartTimeParam.class; + } + + @Override + public String paramName() { + return uriName(); } public static @NonNull String uriName() { return "start-time"; } - public static @NonNull StartTimeParameter forUriValue(final String uriValue) { + public static @NonNull StartTimeParam forUriValue(final String uriValue) { return of(new DateAndTime(uriValue)); } } diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/StopTimeParameter.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/StopTimeParam.java similarity index 62% rename from restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/StopTimeParameter.java rename to restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/StopTimeParam.java index 98c62dfe24..0c3fa6cbc4 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/StopTimeParameter.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/StopTimeParam.java @@ -14,20 +14,30 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types. * This class represents a {@code stop-time} parameter as defined in * RFC8040 section 4.8.8. */ -public final class StopTimeParameter extends AbstractReplayParameter { - private StopTimeParameter(final DateAndTime value) { +public final class StopTimeParam extends AbstractReplayParam { + private StopTimeParam(final DateAndTime value) { super(value); } - public static @NonNull StopTimeParameter of(final DateAndTime value) { - return new StopTimeParameter(value); + public static @NonNull StopTimeParam of(final DateAndTime value) { + return new StopTimeParam(value); + } + + @Override + public Class<@NonNull StopTimeParam> javaClass() { + return StopTimeParam.class; + } + + @Override + public String paramName() { + return uriName(); } public static @NonNull String uriName() { return "stop-time"; } - public static @NonNull StopTimeParameter forUriValue(final String uriValue) { + public static @NonNull StopTimeParam forUriValue(final String uriValue) { return of(new DateAndTime(uriValue)); } } diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/WithDefaultsParameter.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/WithDefaultsParam.java similarity index 80% rename from restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/WithDefaultsParameter.java rename to restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/WithDefaultsParam.java index 5d9d72b469..daf4e77ca5 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/WithDefaultsParameter.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/WithDefaultsParam.java @@ -17,7 +17,7 @@ import org.eclipse.jdt.annotation.Nullable; * Enumeration of possible {@code with-defaults} parameter values as defined by * RFC8040, section 4.8.9. */ -public enum WithDefaultsParameter { +public enum WithDefaultsParam implements RestconfQueryParam { /** * Data nodes set to the YANG default by the client are reported. */ @@ -39,19 +39,30 @@ public enum WithDefaultsParameter { private final @NonNull String uriValue; - WithDefaultsParameter(final String uriValue) { + WithDefaultsParam(final String uriValue) { this.uriValue = requireNonNull(uriValue); } - public static @NonNull String uriName() { - return "with-defaults"; + @Override + public Class<@NonNull WithDefaultsParam> javaClass() { + return WithDefaultsParam.class; + } + + @Override + public String paramName() { + return uriName(); } - public @NonNull String uriValue() { + @Override + public String paramValue() { return uriValue; } - public static @Nullable WithDefaultsParameter forUriValue(final String uriValue) { + public static @NonNull String uriName() { + return "with-defaults"; + } + + public static @Nullable WithDefaultsParam forUriValue(final String uriValue) { switch (uriValue) { case "explicit": return EXPLICIT; diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/WriteDataParams.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/WriteDataParams.java index 5d907d7999..6004c8b967 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/WriteDataParams.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/WriteDataParams.java @@ -19,10 +19,10 @@ import org.opendaylight.yangtools.concepts.Immutable; public final class WriteDataParams implements Immutable { private static final @NonNull WriteDataParams EMPTY = new WriteDataParams(null, null); - private final PointParameter point; - private final InsertParameter insert; + private final PointParam point; + private final InsertParam insert; - private WriteDataParams(final InsertParameter insert, final PointParameter point) { + private WriteDataParams(final InsertParam insert, final PointParam point) { this.insert = insert; this.point = point; } @@ -31,7 +31,7 @@ public final class WriteDataParams implements Immutable { return EMPTY; } - public static @NonNull WriteDataParams of(final InsertParameter insert, final PointParameter point) { + public static @NonNull WriteDataParams of(final InsertParam insert, final PointParam point) { if (point == null) { if (insert == null) { return empty(); @@ -41,9 +41,9 @@ public final class WriteDataParams implements Immutable { // If the values "before" or "after" are used, then a "point" query // parameter for the "insert" query parameter MUST also be present, or a // "400 Bad Request" status-line is returned. - if (insert == InsertParameter.BEFORE || insert == InsertParameter.AFTER) { + if (insert == InsertParam.BEFORE || insert == InsertParam.AFTER) { throw new IllegalArgumentException( - "Insert parameter " + insert.uriValue() + " cannot be used without a Point parameter."); + "Insert parameter " + insert.paramValue() + " cannot be used without a Point parameter."); } } else { // https://datatracker.ietf.org/doc/html/rfc8040#section-4.8.6: @@ -51,7 +51,7 @@ public final class WriteDataParams implements Immutable { // If the "insert" query parameter is not present or has a value other // than "before" or "after", then a "400 Bad Request" status-line is // returned. - if (insert != InsertParameter.BEFORE && insert != InsertParameter.AFTER) { + if (insert != InsertParam.BEFORE && insert != InsertParam.AFTER) { throw new IllegalArgumentException( "Point parameter can be used only with 'after' or 'before' values of Insert parameter."); } @@ -60,11 +60,11 @@ public final class WriteDataParams implements Immutable { return new WriteDataParams(insert, point); } - public @Nullable InsertParameter insert() { + public @Nullable InsertParam insert() { return insert; } - public @Nullable PointParameter point() { + public @Nullable PointParam point() { return point; } @@ -72,7 +72,7 @@ public final class WriteDataParams implements Immutable { public String toString() { final var helper = MoreObjects.toStringHelper(this).omitNullValues(); if (insert != null) { - helper.add("insert", insert.uriValue()); + helper.add("insert", insert.paramValue()); } if (point != null) { helper.add("point", point.value()); diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/databind/jaxrs/QueryParams.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/databind/jaxrs/QueryParams.java index 07152d1a10..fef0b87572 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/databind/jaxrs/QueryParams.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/databind/jaxrs/QueryParams.java @@ -27,17 +27,17 @@ import org.eclipse.jdt.annotation.Nullable; import org.opendaylight.restconf.common.context.InstanceIdentifierContext; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError; -import org.opendaylight.restconf.nb.rfc8040.ContentParameter; -import org.opendaylight.restconf.nb.rfc8040.DepthParameter; -import org.opendaylight.restconf.nb.rfc8040.FieldsParameter; -import org.opendaylight.restconf.nb.rfc8040.FilterParameter; -import org.opendaylight.restconf.nb.rfc8040.InsertParameter; +import org.opendaylight.restconf.nb.rfc8040.ContentParam; +import org.opendaylight.restconf.nb.rfc8040.DepthParam; +import org.opendaylight.restconf.nb.rfc8040.FieldsParam; +import org.opendaylight.restconf.nb.rfc8040.FilterParam; +import org.opendaylight.restconf.nb.rfc8040.InsertParam; import org.opendaylight.restconf.nb.rfc8040.NotificationQueryParams; -import org.opendaylight.restconf.nb.rfc8040.PointParameter; +import org.opendaylight.restconf.nb.rfc8040.PointParam; import org.opendaylight.restconf.nb.rfc8040.ReadDataParams; -import org.opendaylight.restconf.nb.rfc8040.StartTimeParameter; -import org.opendaylight.restconf.nb.rfc8040.StopTimeParameter; -import org.opendaylight.restconf.nb.rfc8040.WithDefaultsParameter; +import org.opendaylight.restconf.nb.rfc8040.StartTimeParam; +import org.opendaylight.restconf.nb.rfc8040.StopTimeParam; +import org.opendaylight.restconf.nb.rfc8040.WithDefaultsParam; import org.opendaylight.restconf.nb.rfc8040.WriteDataParams; import org.opendaylight.restconf.nb.rfc8040.legacy.QueryParameters; import org.opendaylight.yangtools.yang.common.ErrorTag; @@ -45,13 +45,13 @@ import org.opendaylight.yangtools.yang.common.ErrorType; @Beta public final class QueryParams { - private static final Set ALLOWED_PARAMETERS = Set.of(ContentParameter.uriName(), DepthParameter.uriName(), - FieldsParameter.uriName(), WithDefaultsParameter.uriName()); - private static final List POSSIBLE_CONTENT = Arrays.stream(ContentParameter.values()) - .map(ContentParameter::uriValue) + private static final Set ALLOWED_PARAMETERS = Set.of(ContentParam.uriName(), DepthParam.uriName(), + FieldsParam.uriName(), WithDefaultsParam.uriName()); + private static final List POSSIBLE_CONTENT = Arrays.stream(ContentParam.values()) + .map(ContentParam::paramValue) .collect(Collectors.toUnmodifiableList()); - private static final List POSSIBLE_WITH_DEFAULTS = Arrays.stream(WithDefaultsParameter.values()) - .map(WithDefaultsParameter::uriValue) + private static final List POSSIBLE_WITH_DEFAULTS = Arrays.stream(WithDefaultsParam.values()) + .map(WithDefaultsParam::paramValue) .collect(Collectors.toUnmodifiableList()); private QueryParams() { @@ -59,9 +59,9 @@ public final class QueryParams { } public static @NonNull NotificationQueryParams newNotificationQueryParams(final UriInfo uriInfo) { - StartTimeParameter startTime = null; - StopTimeParameter stopTime = null; - FilterParameter filter = null; + StartTimeParam startTime = null; + StopTimeParam stopTime = null; + FilterParam filter = null; boolean skipNotificationData = false; for (final Entry> entry : uriInfo.getQueryParameters().entrySet()) { @@ -69,14 +69,14 @@ public final class QueryParams { final List paramValues = entry.getValue(); try { - if (paramName.equals(StartTimeParameter.uriName())) { - startTime = optionalParam(StartTimeParameter::forUriValue, paramName, paramValues); + if (paramName.equals(StartTimeParam.uriName())) { + startTime = optionalParam(StartTimeParam::forUriValue, paramName, paramValues); break; - } else if (paramName.equals(StopTimeParameter.uriName())) { - stopTime = optionalParam(StopTimeParameter::forUriValue, paramName, paramValues); + } else if (paramName.equals(StopTimeParam.uriName())) { + stopTime = optionalParam(StopTimeParam::forUriValue, paramName, paramValues); break; - } else if (paramName.equals(FilterParameter.uriName())) { - filter = optionalParam(FilterParameter::forUriValue, paramName, paramValues); + } else if (paramName.equals(FilterParam.uriName())) { + filter = optionalParam(FilterParam::forUriValue, paramName, paramValues); } else if (paramName.equals("odl-skip-notification-data")) { // FIXME: this should be properly encapsulated in SkipNotificatioDataParameter skipNotificationData = Boolean.parseBoolean(optionalParam(paramName, paramValues)); @@ -103,8 +103,8 @@ public final class QueryParams { } return identifier.getMountPoint() != null - ? QueryParameters.ofFieldPaths(params, parseFieldsPaths(identifier, fields.uriValue())) - : QueryParameters.ofFields(params, parseFieldsParameter(identifier, fields.uriValue())); + ? QueryParameters.ofFieldPaths(params, parseFieldsPaths(identifier, fields.paramValue())) + : QueryParameters.ofFields(params, parseFieldsParameter(identifier, fields.paramValue())); } /** @@ -119,18 +119,18 @@ public final class QueryParams { checkParametersTypes(queryParams.keySet(), ALLOWED_PARAMETERS); // check and set content - final String contentStr = getSingleParameter(queryParams, ContentParameter.uriName()); - final ContentParameter content = contentStr == null ? ContentParameter.ALL - : RestconfDocumentedException.throwIfNull(ContentParameter.forUriValue(contentStr), + final String contentStr = getSingleParameter(queryParams, ContentParam.uriName()); + final ContentParam content = contentStr == null ? ContentParam.ALL + : RestconfDocumentedException.throwIfNull(ContentParam.forUriValue(contentStr), ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE, "Invalid content parameter: %s, allowed values are %s", contentStr, POSSIBLE_CONTENT); // check and set depth - final DepthParameter depth; - final String depthStr = getSingleParameter(queryParams, DepthParameter.uriName()); + final DepthParam depth; + final String depthStr = getSingleParameter(queryParams, DepthParam.uriName()); if (depthStr != null) { try { - depth = DepthParameter.forUriValue(depthStr); + depth = DepthParam.forUriValue(depthStr); } catch (IllegalArgumentException e) { throw new RestconfDocumentedException(e, new RestconfError(ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE, "Invalid depth parameter: " + depthStr, null, @@ -141,11 +141,11 @@ public final class QueryParams { } // check and set fields - final FieldsParameter fields; - final String fieldsStr = getSingleParameter(queryParams, FieldsParameter.uriName()); + final FieldsParam fields; + final String fieldsStr = getSingleParameter(queryParams, FieldsParam.uriName()); if (fieldsStr != null) { try { - fields = FieldsParameter.parse(fieldsStr); + fields = FieldsParam.parse(fieldsStr); } catch (ParseException e) { throw new RestconfDocumentedException(e, new RestconfError(ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE, "Invalid filds parameter: " + fieldsStr)); @@ -155,12 +155,12 @@ public final class QueryParams { } // check and set withDefaults parameter - final WithDefaultsParameter withDefaults; + final WithDefaultsParam withDefaults; final boolean tagged; - final String withDefaultsStr = getSingleParameter(queryParams, WithDefaultsParameter.uriName()); + final String withDefaultsStr = getSingleParameter(queryParams, WithDefaultsParam.uriName()); if (withDefaultsStr != null) { - final WithDefaultsParameter val = WithDefaultsParameter.forUriValue(withDefaultsStr); + final WithDefaultsParam val = WithDefaultsParam.forUriValue(withDefaultsStr); if (val == null) { throw new RestconfDocumentedException(new RestconfError(ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE, "Invalid with-defaults parameter: " + withDefaultsStr, null, @@ -190,25 +190,25 @@ public final class QueryParams { } public static @NonNull WriteDataParams newWriteDataParams(final UriInfo uriInfo) { - InsertParameter insert = null; - PointParameter point = null; + InsertParam insert = null; + PointParam point = null; for (final Entry> entry : uriInfo.getQueryParameters().entrySet()) { final String uriName = entry.getKey(); final List paramValues = entry.getValue(); - if (uriName.equals(InsertParameter.uriName())) { + if (uriName.equals(InsertParam.uriName())) { final String str = optionalParam(uriName, paramValues); if (str != null) { - insert = InsertParameter.forUriValue(str); + insert = InsertParam.forUriValue(str); if (insert == null) { throw new RestconfDocumentedException("Unrecognized insert parameter value '" + str + "'", ErrorType.PROTOCOL, ErrorTag.BAD_ELEMENT); } } - } else if (PointParameter.uriName().equals(uriName)) { + } else if (PointParam.uriName().equals(uriName)) { final String str = optionalParam(uriName, paramValues); if (str != null) { - point = PointParameter.forUriValue(str); + point = PointParam.forUriValue(str); } } else { throw new RestconfDocumentedException("Bad parameter for post: " + uriName, diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/handlers/SchemaContextHandler.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/handlers/SchemaContextHandler.java index f0fa0ed06c..b8e7bc08ef 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/handlers/SchemaContextHandler.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/handlers/SchemaContextHandler.java @@ -28,12 +28,12 @@ import org.opendaylight.mdsal.dom.api.DOMDataBroker; import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction; import org.opendaylight.mdsal.dom.api.DOMSchemaService; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; -import org.opendaylight.restconf.nb.rfc8040.AbstractReplayParameter; -import org.opendaylight.restconf.nb.rfc8040.DepthParameter; -import org.opendaylight.restconf.nb.rfc8040.FieldsParameter; -import org.opendaylight.restconf.nb.rfc8040.FilterParameter; +import org.opendaylight.restconf.nb.rfc8040.AbstractReplayParam; +import org.opendaylight.restconf.nb.rfc8040.DepthParam; +import org.opendaylight.restconf.nb.rfc8040.FieldsParam; +import org.opendaylight.restconf.nb.rfc8040.FilterParam; import org.opendaylight.restconf.nb.rfc8040.Rfc8040.IetfYangLibrary; -import org.opendaylight.restconf.nb.rfc8040.WithDefaultsParameter; +import org.opendaylight.restconf.nb.rfc8040.WithDefaultsParam; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.monitoring.rev170126.RestconfState; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.monitoring.rev170126.restconf.state.Capabilities; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev190104.ModulesState; @@ -178,11 +178,11 @@ public class SchemaContextHandler implements EffectiveModelContextListener, Auto .withNodeIdentifier(new NodeIdentifier(Capabilities.QNAME)) .withChild(Builders.orderedLeafSetBuilder() .withNodeIdentifier(new NodeIdentifier(CAPABILITY_QNAME)) - .withChildValue(DepthParameter.capabilityUri().toString()) - .withChildValue(FieldsParameter.capabilityUri().toString()) - .withChildValue(FilterParameter.capabilityUri().toString()) - .withChildValue(AbstractReplayParameter.capabilityUri().toString()) - .withChildValue(WithDefaultsParameter.capabilityUri().toString()) + .withChildValue(DepthParam.capabilityUri().toString()) + .withChildValue(FieldsParam.capabilityUri().toString()) + .withChildValue(FilterParam.capabilityUri().toString()) + .withChildValue(AbstractReplayParam.capabilityUri().toString()) + .withChildValue(WithDefaultsParam.capabilityUri().toString()) .build()) .build()) .build(); diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/JsonNormalizedNodeBodyWriter.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/JsonNormalizedNodeBodyWriter.java index a37a9a86cd..604f7a3c6a 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/JsonNormalizedNodeBodyWriter.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/JsonNormalizedNodeBodyWriter.java @@ -23,7 +23,7 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.Provider; import org.opendaylight.restconf.common.context.InstanceIdentifierContext; -import org.opendaylight.restconf.nb.rfc8040.DepthParameter; +import org.opendaylight.restconf.nb.rfc8040.DepthParam; import org.opendaylight.restconf.nb.rfc8040.MediaTypes; import org.opendaylight.restconf.nb.rfc8040.jersey.providers.api.RestconfNormalizedNodeWriter; import org.opendaylight.restconf.nb.rfc8040.legacy.NormalizedNodePayload; @@ -85,7 +85,7 @@ public class JsonNormalizedNodeBodyWriter extends AbstractNormalizedNodeBodyWrit private static void writeNormalizedNode(final JsonWriter jsonWriter, final SchemaPath path, final InstanceIdentifierContext context, final NormalizedNode data, - final DepthParameter depth, final List> fields) throws IOException { + final DepthParam depth, final List> fields) throws IOException { final RestconfNormalizedNodeWriter nnWriter; if (context.getSchemaNode() instanceof RpcDefinition) { @@ -148,7 +148,7 @@ public class JsonNormalizedNodeBodyWriter extends AbstractNormalizedNodeBodyWrit private static RestconfNormalizedNodeWriter createNormalizedNodeWriter( final InstanceIdentifierContext context, final SchemaPath path, final JsonWriter jsonWriter, - final DepthParameter depth, final List> fields) { + final DepthParam depth, final List> fields) { final SchemaNode schema = context.getSchemaNode(); final JSONCodecFactory codecs = getCodecFactory(context); diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/ParameterAwareNormalizedNodeWriter.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/ParameterAwareNormalizedNodeWriter.java index 87bfbdaccf..d023f4b13f 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/ParameterAwareNormalizedNodeWriter.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/ParameterAwareNormalizedNodeWriter.java @@ -19,7 +19,7 @@ import java.util.Map.Entry; import java.util.Optional; import java.util.Set; import javax.xml.transform.dom.DOMSource; -import org.opendaylight.restconf.nb.rfc8040.DepthParameter; +import org.opendaylight.restconf.nb.rfc8040.DepthParam; import org.opendaylight.restconf.nb.rfc8040.jersey.providers.api.RestconfNormalizedNodeWriter; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier; @@ -56,7 +56,7 @@ public class ParameterAwareNormalizedNodeWriter implements RestconfNormalizedNod protected final List> fields; protected int currentDepth = 0; - private ParameterAwareNormalizedNodeWriter(final NormalizedNodeStreamWriter writer, final DepthParameter depth, + private ParameterAwareNormalizedNodeWriter(final NormalizedNodeStreamWriter writer, final DepthParam depth, final List> fields) { this.writer = requireNonNull(writer); maxDepth = depth == null ? null : depth.value(); @@ -76,13 +76,13 @@ public class ParameterAwareNormalizedNodeWriter implements RestconfNormalizedNod * @return A new instance. */ public static ParameterAwareNormalizedNodeWriter forStreamWriter( - final NormalizedNodeStreamWriter writer, final DepthParameter maxDepth, final List> fields) { + final NormalizedNodeStreamWriter writer, final DepthParam maxDepth, final List> fields) { return forStreamWriter(writer, true, maxDepth, fields); } /** * Create a new writer backed by a {@link NormalizedNodeStreamWriter}. Unlike the simple - * {@link #forStreamWriter(NormalizedNodeStreamWriter, DepthParameter, List)} method, this allows the caller to + * {@link #forStreamWriter(NormalizedNodeStreamWriter, DepthParam, List)} method, this allows the caller to * switch off RFC6020 XML compliance, providing better throughput. The reason is that the XML mapping rules in * RFC6020 require the encoding to emit leaf nodes which participate in a list's key first and in the order in which * they are defined in the key. For JSON, this requirement is completely relaxed and leaves can be ordered in any @@ -97,7 +97,7 @@ public class ParameterAwareNormalizedNodeWriter implements RestconfNormalizedNod */ public static ParameterAwareNormalizedNodeWriter forStreamWriter(final NormalizedNodeStreamWriter writer, final boolean orderKeyLeaves, - final DepthParameter depth, + final DepthParam depth, final List> fields) { return orderKeyLeaves ? new OrderedParameterAwareNormalizedNodeWriter(writer, depth, fields) : new ParameterAwareNormalizedNodeWriter(writer, depth, fields); @@ -322,7 +322,7 @@ public class ParameterAwareNormalizedNodeWriter implements RestconfNormalizedNod private static final class OrderedParameterAwareNormalizedNodeWriter extends ParameterAwareNormalizedNodeWriter { private static final Logger LOG = LoggerFactory.getLogger(OrderedParameterAwareNormalizedNodeWriter.class); - OrderedParameterAwareNormalizedNodeWriter(final NormalizedNodeStreamWriter writer, final DepthParameter depth, + OrderedParameterAwareNormalizedNodeWriter(final NormalizedNodeStreamWriter writer, final DepthParam depth, final List> fields) { super(writer, depth, fields); } diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/XmlNormalizedNodeBodyWriter.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/XmlNormalizedNodeBodyWriter.java index 0baa199d7a..74ef222971 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/XmlNormalizedNodeBodyWriter.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/XmlNormalizedNodeBodyWriter.java @@ -27,7 +27,7 @@ import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import org.opendaylight.restconf.common.context.InstanceIdentifierContext; -import org.opendaylight.restconf.nb.rfc8040.DepthParameter; +import org.opendaylight.restconf.nb.rfc8040.DepthParam; import org.opendaylight.restconf.nb.rfc8040.MediaTypes; import org.opendaylight.restconf.nb.rfc8040.jersey.providers.api.RestconfNormalizedNodeWriter; import org.opendaylight.restconf.nb.rfc8040.legacy.NormalizedNodePayload; @@ -88,7 +88,7 @@ public class XmlNormalizedNodeBodyWriter extends AbstractNormalizedNodeBodyWrite } private static void writeNormalizedNode(final XMLStreamWriter xmlWriter, final SchemaPath path, - final InstanceIdentifierContext pathContext, final NormalizedNode data, final DepthParameter depth, + final InstanceIdentifierContext pathContext, final NormalizedNode data, final DepthParam depth, final List> fields) throws IOException { final RestconfNormalizedNodeWriter nnWriter; final EffectiveModelContext schemaCtx = pathContext.getSchemaContext(); @@ -135,7 +135,7 @@ public class XmlNormalizedNodeBodyWriter extends AbstractNormalizedNodeBodyWrite } private static RestconfNormalizedNodeWriter createNormalizedNodeWriter(final XMLStreamWriter xmlWriter, - final EffectiveModelContext schemaContext, final SchemaPath schemaPath, final DepthParameter depth, + final EffectiveModelContext schemaContext, final SchemaPath schemaPath, final DepthParam depth, final List> fields) { final NormalizedNodeStreamWriter xmlStreamWriter = XMLStreamNormalizedNodeStreamWriter .create(xmlWriter, schemaContext, schemaPath); diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/legacy/QueryParameters.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/legacy/QueryParameters.java index 762a614a67..52a72c8cbb 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/legacy/QueryParameters.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/legacy/QueryParameters.java @@ -14,7 +14,7 @@ import java.util.List; import java.util.Set; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; -import org.opendaylight.restconf.nb.rfc8040.DepthParameter; +import org.opendaylight.restconf.nb.rfc8040.DepthParam; import org.opendaylight.restconf.nb.rfc8040.ReadDataParams; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; @@ -61,7 +61,7 @@ public final class QueryParameters { return params; } - public @Nullable DepthParameter depth() { + public @Nullable DepthParam depth() { return params.depth(); } diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/PostDataTransactionUtil.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/PostDataTransactionUtil.java index 17f4bcb61f..b07e4f91f8 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/PostDataTransactionUtil.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/PostDataTransactionUtil.java @@ -19,8 +19,8 @@ import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.mdsal.dom.api.DOMTransactionChain; import org.opendaylight.restconf.common.context.InstanceIdentifierContext; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; -import org.opendaylight.restconf.nb.rfc8040.InsertParameter; -import org.opendaylight.restconf.nb.rfc8040.PointParameter; +import org.opendaylight.restconf.nb.rfc8040.InsertParam; +import org.opendaylight.restconf.nb.rfc8040.PointParam; import org.opendaylight.restconf.nb.rfc8040.legacy.NormalizedNodePayload; import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfStrategy; import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfTransaction; @@ -64,8 +64,8 @@ public final class PostDataTransactionUtil { */ public static Response postData(final UriInfo uriInfo, final NormalizedNodePayload payload, final RestconfStrategy strategy, - final EffectiveModelContext schemaContext, final InsertParameter insert, - final PointParameter point) { + final EffectiveModelContext schemaContext, final InsertParam insert, + final PointParam point) { final YangInstanceIdentifier path = payload.getInstanceIdentifierContext().getInstanceIdentifier(); final FluentFuture future = submitData(path, payload.getData(), strategy, schemaContext, insert, point); @@ -91,8 +91,8 @@ public final class PostDataTransactionUtil { final NormalizedNode data, final RestconfStrategy strategy, final EffectiveModelContext schemaContext, - final InsertParameter insert, - final PointParameter point) { + final InsertParam insert, + final PointParam point) { final RestconfTransaction transaction = strategy.prepareWriteExecution(); if (insert == null) { makePost(path, data, schemaContext, transaction); @@ -144,7 +144,7 @@ public final class PostDataTransactionUtil { } private static void insertWithPointPost(final YangInstanceIdentifier path, final NormalizedNode data, - final EffectiveModelContext schemaContext, final PointParameter point, + final EffectiveModelContext schemaContext, final PointParam point, final NormalizedNodeContainer readList, final boolean before, final RestconfTransaction transaction) { final YangInstanceIdentifier parent = path.getParent().getParent(); diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/PutDataTransactionUtil.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/PutDataTransactionUtil.java index 949277464a..26339e0360 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/PutDataTransactionUtil.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/PutDataTransactionUtil.java @@ -16,8 +16,8 @@ import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.mdsal.dom.api.DOMTransactionChain; import org.opendaylight.restconf.common.context.InstanceIdentifierContext; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; -import org.opendaylight.restconf.nb.rfc8040.InsertParameter; -import org.opendaylight.restconf.nb.rfc8040.PointParameter; +import org.opendaylight.restconf.nb.rfc8040.InsertParam; +import org.opendaylight.restconf.nb.rfc8040.PointParam; import org.opendaylight.restconf.nb.rfc8040.legacy.NormalizedNodePayload; import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfStrategy; import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfTransaction; @@ -58,8 +58,8 @@ public final class PutDataTransactionUtil { * @return {@link Response} */ public static Response putData(final NormalizedNodePayload payload, final EffectiveModelContext schemaContext, - final RestconfStrategy strategy, final InsertParameter insert, - final PointParameter point) { + final RestconfStrategy strategy, final InsertParam insert, + final PointParam point) { final YangInstanceIdentifier path = payload.getInstanceIdentifierContext().getInstanceIdentifier(); final FluentFuture existsFuture = strategy.exists(LogicalDatastoreType.CONFIGURATION, path); @@ -90,8 +90,8 @@ public final class PutDataTransactionUtil { final EffectiveModelContext schemaContext, final RestconfStrategy strategy, final NormalizedNode data, - final InsertParameter insert, - final PointParameter point) { + final InsertParam insert, + final PointParam point) { final RestconfTransaction transaction = strategy.prepareWriteExecution(); if (insert == null) { return makePut(path, schemaContext, transaction, data); @@ -143,7 +143,7 @@ public final class PutDataTransactionUtil { private static void insertWithPointPut(final RestconfTransaction transaction, final YangInstanceIdentifier path, final NormalizedNode data, - final EffectiveModelContext schemaContext, final PointParameter point, + final EffectiveModelContext schemaContext, final PointParam point, final NormalizedNodeContainer readList, final boolean before) { transaction.remove(path.getParent()); final InstanceIdentifierContext instanceIdentifier = diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/ReadDataTransactionUtil.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/ReadDataTransactionUtil.java index 843f65c024..91a9b280a7 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/ReadDataTransactionUtil.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/ReadDataTransactionUtil.java @@ -20,8 +20,8 @@ import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.mdsal.dom.api.DOMTransactionChain; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError; -import org.opendaylight.restconf.nb.rfc8040.ContentParameter; -import org.opendaylight.restconf.nb.rfc8040.WithDefaultsParameter; +import org.opendaylight.restconf.nb.rfc8040.ContentParam; +import org.opendaylight.restconf.nb.rfc8040.WithDefaultsParam; import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfStrategy; import org.opendaylight.yangtools.yang.common.ErrorTag; import org.opendaylight.yangtools.yang.common.ErrorType; @@ -88,10 +88,10 @@ public final class ReadDataTransactionUtil { * @param ctx schema context * @return {@link NormalizedNode} */ - public static @Nullable NormalizedNode readData(final @NonNull ContentParameter content, + public static @Nullable NormalizedNode readData(final @NonNull ContentParam content, final @NonNull YangInstanceIdentifier path, final @NonNull RestconfStrategy strategy, - final WithDefaultsParameter withDefa, + final WithDefaultsParam withDefa, final EffectiveModelContext ctx) { // FIXME: use a switch expression when they are available, removing source of RestconfDocumentedException switch (content) { @@ -105,7 +105,7 @@ public final class ReadDataTransactionUtil { default: throw new RestconfDocumentedException( new RestconfError(ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE, - "Invalid content parameter: " + content.uriValue(), null, + "Invalid content parameter: " + content.paramValue(), null, "The content parameter value must be either config, nonconfig or all (default)")); } } @@ -122,9 +122,9 @@ public final class ReadDataTransactionUtil { * @param fields paths to selected subtrees which should be read, relative to to the parent path * @return {@link NormalizedNode} */ - public static @Nullable NormalizedNode readData(final @NonNull ContentParameter content, + public static @Nullable NormalizedNode readData(final @NonNull ContentParam content, final @NonNull YangInstanceIdentifier path, final @NonNull RestconfStrategy strategy, - final @Nullable WithDefaultsParameter withDefa, @NonNull final EffectiveModelContext ctx, + final @Nullable WithDefaultsParam withDefa, @NonNull final EffectiveModelContext ctx, final @NonNull List fields) { // FIXME: use a switch expression when they are available, removing source of RestconfDocumentedException switch (content) { @@ -138,13 +138,13 @@ public final class ReadDataTransactionUtil { return readDataViaTransaction(strategy, LogicalDatastoreType.OPERATIONAL, path, fields); default: throw new RestconfDocumentedException(new RestconfError(ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE, - "Invalid content parameter: " + content.uriValue(), null, + "Invalid content parameter: " + content.paramValue(), null, "The content parameter value must be either config, nonconfig or all (default)")); } } private static NormalizedNode prepareDataByParamWithDef(final NormalizedNode result, - final YangInstanceIdentifier path, final WithDefaultsParameter withDefa, final EffectiveModelContext ctx) { + final YangInstanceIdentifier path, final WithDefaultsParam withDefa, final EffectiveModelContext ctx) { boolean trim; switch (withDefa) { case TRIM: @@ -154,7 +154,7 @@ public final class ReadDataTransactionUtil { trim = false; break; default: - throw new RestconfDocumentedException("Unsupported with-defaults value " + withDefa.uriValue()); + throw new RestconfDocumentedException("Unsupported with-defaults value " + withDefa.paramValue()); } final DataSchemaContextTree baseSchemaCtxTree = DataSchemaContextTree.from(ctx); @@ -316,7 +316,7 @@ public final class ReadDataTransactionUtil { * @return {@link NormalizedNode} */ private static @Nullable NormalizedNode readAllData(final @NonNull RestconfStrategy strategy, - final YangInstanceIdentifier path, final WithDefaultsParameter withDefa, final EffectiveModelContext ctx) { + final YangInstanceIdentifier path, final WithDefaultsParam withDefa, final EffectiveModelContext ctx) { // PREPARE STATE DATA NODE final NormalizedNode stateDataNode = readDataViaTransaction(strategy, LogicalDatastoreType.OPERATIONAL, path); // PREPARE CONFIG DATA NODE @@ -339,7 +339,7 @@ public final class ReadDataTransactionUtil { * @return {@link NormalizedNode} */ private static @Nullable NormalizedNode readAllData(final @NonNull RestconfStrategy strategy, - final @NonNull YangInstanceIdentifier path, final @Nullable WithDefaultsParameter withDefa, + final @NonNull YangInstanceIdentifier path, final @Nullable WithDefaultsParam withDefa, final @NonNull EffectiveModelContext ctx, final @NonNull List fields) { // PREPARE STATE DATA NODE final NormalizedNode stateDataNode = readDataViaTransaction(strategy, LogicalDatastoreType.OPERATIONAL, path, diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/streams/listeners/AbstractQueryParams.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/streams/listeners/AbstractQueryParams.java index d9248e3cce..e58f8ffa8a 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/streams/listeners/AbstractQueryParams.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/streams/listeners/AbstractQueryParams.java @@ -17,9 +17,9 @@ import javax.xml.xpath.XPathExpressionException; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; -import org.opendaylight.restconf.nb.rfc8040.FilterParameter; -import org.opendaylight.restconf.nb.rfc8040.StartTimeParameter; -import org.opendaylight.restconf.nb.rfc8040.StopTimeParameter; +import org.opendaylight.restconf.nb.rfc8040.FilterParam; +import org.opendaylight.restconf.nb.rfc8040.StartTimeParam; +import org.opendaylight.restconf.nb.rfc8040.StopTimeParam; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; /** @@ -55,8 +55,8 @@ abstract class AbstractQueryParams extends AbstractNotificationsData { * @param leafNodesOnly If TRUE, notifications will contain changes of leaf nodes only. */ @SuppressWarnings("checkstyle:hiddenField") - public final void setQueryParams(final StartTimeParameter startTime, final StopTimeParameter stopTime, - final FilterParameter filter, final boolean leafNodesOnly, final boolean skipNotificationData) { + public final void setQueryParams(final StartTimeParam startTime, final StopTimeParam stopTime, + final FilterParam filter, final boolean leafNodesOnly, final boolean skipNotificationData) { start = startTime == null ? Instant.now() : parseDateAndTime(startTime.value()); stop = stopTime == null ? null : parseDateAndTime(stopTime.value()); this.leafNodesOnly = leafNodesOnly; @@ -64,7 +64,7 @@ abstract class AbstractQueryParams extends AbstractNotificationsData { if (filter != null) { try { - setFilter(filter.uriValue()); + setFilter(filter.paramValue()); } catch (XPathExpressionException e) { throw new IllegalArgumentException("Failed to get filter", e); } diff --git a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/FieldsParameterTest.java b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/FieldsParameterTest.java index 3627eec129..8579921761 100644 --- a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/FieldsParameterTest.java +++ b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/FieldsParameterTest.java @@ -14,7 +14,7 @@ import java.text.ParseException; import java.util.List; import org.junit.Test; import org.opendaylight.restconf.nb.rfc8040.ApiPath.ApiIdentifier; -import org.opendaylight.restconf.nb.rfc8040.FieldsParameter.NodeSelector; +import org.opendaylight.restconf.nb.rfc8040.FieldsParam.NodeSelector; public class FieldsParameterTest { // https://datatracker.ietf.org/doc/html/rfc8040#section-4.8.3: @@ -176,14 +176,14 @@ public class FieldsParameterTest { } private static void assertInvalidFields(final String str, final String message, final int errorOffset) { - final var ex = assertThrows(ParseException.class, () -> FieldsParameter.parse(str)); + final var ex = assertThrows(ParseException.class, () -> FieldsParam.parse(str)); assertEquals(message, ex.getMessage()); assertEquals(errorOffset, ex.getErrorOffset()); } private static List assertValidFields(final String str) { try { - return FieldsParameter.parse(str).nodeSelectors(); + return FieldsParam.parse(str).nodeSelectors(); } catch (ParseException e) { throw new AssertionError(e); } diff --git a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/databind/jaxrs/QueryParamsTest.java b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/databind/jaxrs/QueryParamsTest.java index 1cc2cd4797..bdf83183d2 100644 --- a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/databind/jaxrs/QueryParamsTest.java +++ b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/databind/jaxrs/QueryParamsTest.java @@ -28,10 +28,10 @@ import org.mockito.junit.MockitoJUnitRunner; import org.opendaylight.restconf.common.context.InstanceIdentifierContext; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError; -import org.opendaylight.restconf.nb.rfc8040.ContentParameter; -import org.opendaylight.restconf.nb.rfc8040.DepthParameter; +import org.opendaylight.restconf.nb.rfc8040.ContentParam; +import org.opendaylight.restconf.nb.rfc8040.DepthParam; import org.opendaylight.restconf.nb.rfc8040.ReadDataParams; -import org.opendaylight.restconf.nb.rfc8040.WithDefaultsParameter; +import org.opendaylight.restconf.nb.rfc8040.WithDefaultsParam; import org.opendaylight.restconf.nb.rfc8040.legacy.QueryParameters; import org.opendaylight.yangtools.yang.common.ErrorTag; import org.opendaylight.yangtools.yang.common.ErrorType; @@ -59,8 +59,8 @@ public class QueryParamsTest { @Test public void getSingleParameterTest() { final MultivaluedHashMap parameters = new MultivaluedHashMap<>(); - parameters.putSingle(ContentParameter.uriName(), "all"); - assertEquals("all", QueryParams.getSingleParameter(parameters, ContentParameter.uriName())); + parameters.putSingle(ContentParam.uriName(), "all"); + assertEquals("all", QueryParams.getSingleParameter(parameters, ContentParam.uriName())); } /** @@ -69,10 +69,10 @@ public class QueryParamsTest { @Test public void getSingleParameterNegativeTest() { final MultivaluedHashMap parameters = new MultivaluedHashMap<>(); - parameters.put(ContentParameter.uriName(), List.of("config", "nonconfig", "all")); + parameters.put(ContentParam.uriName(), List.of("config", "nonconfig", "all")); final RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class, - () -> QueryParams.getSingleParameter(parameters, ContentParameter.uriName())); + () -> QueryParams.getSingleParameter(parameters, ContentParam.uriName())); final List errors = ex.getErrors(); assertEquals(1, errors.size()); @@ -87,7 +87,7 @@ public class QueryParamsTest { @Test public void checkParametersTypesTest() { QueryParams.checkParametersTypes(Set.of("content"), - Set.of(ContentParameter.uriName(), DepthParameter.uriName())); + Set.of(ContentParam.uriName(), DepthParam.uriName())); } /** @@ -97,7 +97,7 @@ public class QueryParamsTest { public void checkParametersTypesNegativeTest() { final RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class, () -> QueryParams.checkParametersTypes(Set.of("not-allowed-parameter"), - Set.of(ContentParameter.uriName(), DepthParameter.uriName()))); + Set.of(ContentParam.uriName(), DepthParam.uriName()))); final List errors = ex.getErrors(); assertEquals(1, errors.size()); @@ -115,7 +115,7 @@ public class QueryParamsTest { mockQueryParameters(new MultivaluedHashMap()); final var parsedParameters = QueryParams.newReadDataParams(uriInfo); - assertEquals(ContentParameter.ALL, parsedParameters.content()); + assertEquals(ContentParam.ALL, parsedParameters.content()); assertNull(parsedParameters.depth()); assertNull(parsedParameters.fields()); } @@ -232,7 +232,7 @@ public class QueryParamsTest { mockQueryParameter("with-defaults", "explicit"); final var parsedParameters = QueryParams.newReadDataParams(uriInfo); - assertSame(WithDefaultsParameter.EXPLICIT, parsedParameters.withDefaults()); + assertSame(WithDefaultsParam.EXPLICIT, parsedParameters.withDefaults()); assertFalse(parsedParameters.tagged()); } @@ -251,10 +251,10 @@ public class QueryParamsTest { final ReadDataParams parsedParameters = QueryParams.newReadDataParams(uriInfo); // content - assertEquals(ContentParameter.CONFIG, parsedParameters.content()); + assertEquals(ContentParam.CONFIG, parsedParameters.content()); // depth - final DepthParameter depth = parsedParameters.depth(); + final DepthParam depth = parsedParameters.depth(); assertNotNull(depth); assertEquals(10, depth.value()); diff --git a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/ParameterAwareNormalizedNodeWriterDepthTest.java b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/ParameterAwareNormalizedNodeWriterDepthTest.java index 360607d360..e9795bb0e1 100644 --- a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/ParameterAwareNormalizedNodeWriterDepthTest.java +++ b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/ParameterAwareNormalizedNodeWriterDepthTest.java @@ -24,7 +24,7 @@ import org.junit.runner.RunWith; import org.mockito.InOrder; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; -import org.opendaylight.restconf.nb.rfc8040.DepthParameter; +import org.opendaylight.restconf.nb.rfc8040.DepthParam; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates; @@ -135,7 +135,7 @@ public class ParameterAwareNormalizedNodeWriterDepthTest { @Test public void writeContainerWithoutChildrenDepthTest() throws Exception { final ParameterAwareNormalizedNodeWriter parameterWriter = ParameterAwareNormalizedNodeWriter.forStreamWriter( - writer, DepthParameter.min(), null); + writer, DepthParam.min(), null); parameterWriter.write(containerNodeData); @@ -152,7 +152,7 @@ public class ParameterAwareNormalizedNodeWriterDepthTest { @Test public void writeContainerWithChildrenDepthTest() throws Exception { final ParameterAwareNormalizedNodeWriter parameterWriter = ParameterAwareNormalizedNodeWriter.forStreamWriter( - writer, DepthParameter.max(), null); + writer, DepthParam.max(), null); parameterWriter.write(containerNodeData); @@ -172,7 +172,7 @@ public class ParameterAwareNormalizedNodeWriterDepthTest { @Test public void writeMapNodeWithoutChildrenDepthTest() throws Exception { final ParameterAwareNormalizedNodeWriter parameterWriter = ParameterAwareNormalizedNodeWriter.forStreamWriter( - writer, DepthParameter.min(), null); + writer, DepthParam.min(), null); parameterWriter.write(mapNodeData); @@ -194,7 +194,7 @@ public class ParameterAwareNormalizedNodeWriterDepthTest { @Test public void writeMapNodeWithChildrenDepthTest() throws Exception { final ParameterAwareNormalizedNodeWriter parameterWriter = ParameterAwareNormalizedNodeWriter.forStreamWriter( - writer, DepthParameter.max(), null); + writer, DepthParam.max(), null); parameterWriter.write(mapNodeData); @@ -221,7 +221,7 @@ public class ParameterAwareNormalizedNodeWriterDepthTest { @Test public void writeLeafSetNodeWithoutChildrenDepthTest() throws Exception { final ParameterAwareNormalizedNodeWriter parameterWriter = ParameterAwareNormalizedNodeWriter.forStreamWriter( - writer, DepthParameter.min(), null); + writer, DepthParam.min(), null); parameterWriter.write(leafSetNodeData); @@ -238,7 +238,7 @@ public class ParameterAwareNormalizedNodeWriterDepthTest { @Test public void writeLeafSetNodeWithChildrenDepthTest() throws Exception { final ParameterAwareNormalizedNodeWriter parameterWriter = ParameterAwareNormalizedNodeWriter.forStreamWriter( - writer, DepthParameter.max(), null); + writer, DepthParam.max(), null); parameterWriter.write(leafSetNodeData); @@ -257,7 +257,7 @@ public class ParameterAwareNormalizedNodeWriterDepthTest { @Test public void writeLeafSetEntryNodeDepthTest() throws Exception { final ParameterAwareNormalizedNodeWriter parameterWriter = ParameterAwareNormalizedNodeWriter.forStreamWriter( - writer, DepthParameter.max(), null); + writer, DepthParam.max(), null); parameterWriter.write(leafSetEntryNodeData); @@ -275,7 +275,7 @@ public class ParameterAwareNormalizedNodeWriterDepthTest { @Test public void writeMapEntryNodeUnorderedOnlyKeysDepthTest() throws Exception { final ParameterAwareNormalizedNodeWriter parameterWriter = ParameterAwareNormalizedNodeWriter.forStreamWriter( - writer, false, DepthParameter.min(), null); + writer, false, DepthParam.min(), null); parameterWriter.write(mapEntryNodeData); @@ -295,7 +295,7 @@ public class ParameterAwareNormalizedNodeWriterDepthTest { @Test public void writeMapEntryNodeUnorderedDepthTest() throws Exception { final ParameterAwareNormalizedNodeWriter parameterWriter = ParameterAwareNormalizedNodeWriter.forStreamWriter( - writer, false, DepthParameter.max(), null); + writer, false, DepthParam.max(), null); parameterWriter.write(mapEntryNodeData); @@ -316,7 +316,7 @@ public class ParameterAwareNormalizedNodeWriterDepthTest { @Test public void writeMapEntryNodeOrderedWithoutChildrenTest() throws Exception { final ParameterAwareNormalizedNodeWriter parameterWriter = ParameterAwareNormalizedNodeWriter.forStreamWriter( - writer, true, DepthParameter.min(), null); + writer, true, DepthParam.min(), null); parameterWriter.write(mapEntryNodeData); @@ -337,7 +337,7 @@ public class ParameterAwareNormalizedNodeWriterDepthTest { @Test public void writeMapEntryNodeOrderedTest() throws Exception { final ParameterAwareNormalizedNodeWriter parameterWriter = ParameterAwareNormalizedNodeWriter.forStreamWriter( - writer, true, DepthParameter.max(), null); + writer, true, DepthParam.max(), null); parameterWriter.write(mapEntryNodeData); diff --git a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/ParameterAwareNormalizedNodeWriterParametersTest.java b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/ParameterAwareNormalizedNodeWriterParametersTest.java index 5f056e3bbc..5443e4b8b8 100644 --- a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/ParameterAwareNormalizedNodeWriterParametersTest.java +++ b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/ParameterAwareNormalizedNodeWriterParametersTest.java @@ -21,7 +21,7 @@ import org.mockito.InOrder; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; -import org.opendaylight.restconf.nb.rfc8040.DepthParameter; +import org.opendaylight.restconf.nb.rfc8040.DepthParam; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue; @@ -100,7 +100,7 @@ public class ParameterAwareNormalizedNodeWriterParametersTest { limitedFields.add(Sets.newHashSet(leafSetEntryNodeIdentifier.getNodeType())); final ParameterAwareNormalizedNodeWriter parameterWriter = ParameterAwareNormalizedNodeWriter.forStreamWriter( - writer, DepthParameter.min(), limitedFields); + writer, DepthParam.min(), limitedFields); parameterWriter.write(containerNodeData); diff --git a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/ReadDataTransactionUtilTest.java b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/ReadDataTransactionUtilTest.java index 4ab11afa72..a4142f1feb 100644 --- a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/ReadDataTransactionUtilTest.java +++ b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/ReadDataTransactionUtilTest.java @@ -26,7 +26,7 @@ import org.opendaylight.mdsal.dom.api.DOMDataBroker; import org.opendaylight.mdsal.dom.api.DOMDataTreeReadTransaction; import org.opendaylight.netconf.dom.api.NetconfDataTreeService; import org.opendaylight.restconf.common.context.InstanceIdentifierContext; -import org.opendaylight.restconf.nb.rfc8040.ContentParameter; +import org.opendaylight.restconf.nb.rfc8040.ContentParam; import org.opendaylight.restconf.nb.rfc8040.rests.transactions.MdsalRestconfStrategy; import org.opendaylight.restconf.nb.rfc8040.rests.transactions.NetconfRestconfStrategy; import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfStrategy; @@ -76,10 +76,10 @@ public class ReadDataTransactionUtilTest { doReturn(immediateFluentFuture(Optional.of(DATA.data3))).when(read) .read(LogicalDatastoreType.CONFIGURATION, DATA.path); doReturn(immediateFluentFuture(Optional.of(DATA.data3))).when(netconfService).getConfig(DATA.path); - NormalizedNode normalizedNode = readData(ContentParameter.CONFIG, DATA.path, mdsalStrategy); + NormalizedNode normalizedNode = readData(ContentParam.CONFIG, DATA.path, mdsalStrategy); assertEquals(DATA.data3, normalizedNode); - normalizedNode = readData(ContentParameter.CONFIG, DATA.path, netconfStrategy); + normalizedNode = readData(ContentParam.CONFIG, DATA.path, netconfStrategy); assertEquals(DATA.data3, normalizedNode); } @@ -91,10 +91,10 @@ public class ReadDataTransactionUtilTest { .read(LogicalDatastoreType.OPERATIONAL, DATA.path); doReturn(immediateFluentFuture(Optional.of(DATA.data3))).when(netconfService).getConfig(DATA.path); doReturn(immediateFluentFuture(Optional.empty())).when(netconfService).get(DATA.path); - NormalizedNode normalizedNode = readData(ContentParameter.ALL, DATA.path, mdsalStrategy); + NormalizedNode normalizedNode = readData(ContentParam.ALL, DATA.path, mdsalStrategy); assertEquals(DATA.data3, normalizedNode); - normalizedNode = readData(ContentParameter.ALL, DATA.path, netconfStrategy); + normalizedNode = readData(ContentParam.ALL, DATA.path, netconfStrategy); assertEquals(DATA.data3, normalizedNode); } @@ -106,10 +106,10 @@ public class ReadDataTransactionUtilTest { .read(LogicalDatastoreType.CONFIGURATION, DATA.path2); doReturn(immediateFluentFuture(Optional.of(DATA.data2))).when(netconfService).get(DATA.path2); doReturn(immediateFluentFuture(Optional.empty())).when(netconfService).getConfig(DATA.path2); - NormalizedNode normalizedNode = readData(ContentParameter.ALL, DATA.path2, mdsalStrategy); + NormalizedNode normalizedNode = readData(ContentParam.ALL, DATA.path2, mdsalStrategy); assertEquals(DATA.data2, normalizedNode); - normalizedNode = readData(ContentParameter.ALL, DATA.path2, netconfStrategy); + normalizedNode = readData(ContentParam.ALL, DATA.path2, netconfStrategy); assertEquals(DATA.data2, normalizedNode); } @@ -118,10 +118,10 @@ public class ReadDataTransactionUtilTest { doReturn(immediateFluentFuture(Optional.of(DATA.data2))).when(read) .read(LogicalDatastoreType.OPERATIONAL, DATA.path2); doReturn(immediateFluentFuture(Optional.of(DATA.data2))).when(netconfService).get(DATA.path2); - NormalizedNode normalizedNode = readData(ContentParameter.NONCONFIG, DATA.path2, mdsalStrategy); + NormalizedNode normalizedNode = readData(ContentParam.NONCONFIG, DATA.path2, mdsalStrategy); assertEquals(DATA.data2, normalizedNode); - normalizedNode = readData(ContentParameter.NONCONFIG, DATA.path2, netconfStrategy); + normalizedNode = readData(ContentParam.NONCONFIG, DATA.path2, netconfStrategy); assertEquals(DATA.data2, normalizedNode); } @@ -139,10 +139,10 @@ public class ReadDataTransactionUtilTest { .withChild(DATA.contentLeaf) .withChild(DATA.contentLeaf2) .build(); - NormalizedNode normalizedNode = readData(ContentParameter.ALL, DATA.path, mdsalStrategy); + NormalizedNode normalizedNode = readData(ContentParam.ALL, DATA.path, mdsalStrategy); assertEquals(checkingData, normalizedNode); - normalizedNode = readData(ContentParameter.ALL, DATA.path, netconfStrategy); + normalizedNode = readData(ContentParam.ALL, DATA.path, netconfStrategy); assertEquals(checkingData, normalizedNode); } @@ -160,10 +160,10 @@ public class ReadDataTransactionUtilTest { .withChild(DATA.contentLeaf) .withChild(DATA.contentLeaf2) .build(); - NormalizedNode normalizedNode = readData(ContentParameter.ALL, DATA.path, mdsalStrategy); + NormalizedNode normalizedNode = readData(ContentParam.ALL, DATA.path, mdsalStrategy); assertEquals(checkingData, normalizedNode); - normalizedNode = readData(ContentParameter.ALL, DATA.path, netconfStrategy); + normalizedNode = readData(ContentParam.ALL, DATA.path, netconfStrategy); assertEquals(checkingData, normalizedNode); } @@ -180,10 +180,10 @@ public class ReadDataTransactionUtilTest { .withNodeIdentifier(new NodeIdentifier(QName.create("ns", "2016-02-28", "list"))) .withChild(DATA.checkData) .build(); - NormalizedNode normalizedNode = readData(ContentParameter.ALL, DATA.path3, mdsalStrategy); + NormalizedNode normalizedNode = readData(ContentParam.ALL, DATA.path3, mdsalStrategy); assertEquals(checkingData, normalizedNode); - normalizedNode = readData(ContentParameter.ALL, DATA.path3, netconfStrategy); + normalizedNode = readData(ContentParam.ALL, DATA.path3, netconfStrategy); assertEquals(checkingData, normalizedNode); } @@ -200,11 +200,11 @@ public class ReadDataTransactionUtilTest { .withNodeIdentifier(new NodeIdentifier(DATA.listQname)) .withChild(DATA.checkData) .build(); - NormalizedNode normalizedNode = readData(ContentParameter.ALL, DATA.path3, + NormalizedNode normalizedNode = readData(ContentParam.ALL, DATA.path3, mdsalStrategy); assertEquals(expectedData, normalizedNode); - normalizedNode = readData(ContentParameter.ALL, DATA.path3, netconfStrategy); + normalizedNode = readData(ContentParam.ALL, DATA.path3, netconfStrategy); assertEquals(expectedData, normalizedNode); } @@ -223,10 +223,10 @@ public class ReadDataTransactionUtilTest { .withNodeIdentifier(new NodeIdentifier(DATA.listQname)) .withChild(DATA.unkeyedListEntryNode1.body().iterator().next()) .withChild(DATA.unkeyedListEntryNode2.body().iterator().next()).build()).build(); - NormalizedNode normalizedNode = readData(ContentParameter.ALL, DATA.path3, mdsalStrategy); + NormalizedNode normalizedNode = readData(ContentParam.ALL, DATA.path3, mdsalStrategy); assertEquals(expectedData, normalizedNode); - normalizedNode = readData(ContentParameter.ALL, DATA.path3, netconfStrategy); + normalizedNode = readData(ContentParam.ALL, DATA.path3, netconfStrategy); assertEquals(expectedData, normalizedNode); } @@ -247,11 +247,11 @@ public class ReadDataTransactionUtilTest { .addAll(DATA.leafSetNode2.body()) .build()) .build(); - NormalizedNode normalizedNode = readData(ContentParameter.ALL, DATA.leafSetNodePath, + NormalizedNode normalizedNode = readData(ContentParam.ALL, DATA.leafSetNodePath, mdsalStrategy); assertEquals(expectedData, normalizedNode); - normalizedNode = readData(ContentParameter.ALL, DATA.leafSetNodePath, netconfStrategy); + normalizedNode = readData(ContentParam.ALL, DATA.leafSetNodePath, netconfStrategy); assertEquals(expectedData, normalizedNode); } @@ -272,11 +272,11 @@ public class ReadDataTransactionUtilTest { .addAll(DATA.orderedLeafSetNode2.body()) .build()) .build(); - NormalizedNode normalizedNode = readData(ContentParameter.ALL, DATA.leafSetNodePath, + NormalizedNode normalizedNode = readData(ContentParam.ALL, DATA.leafSetNodePath, mdsalStrategy); assertEquals(expectedData, normalizedNode); - normalizedNode = readData(ContentParameter.ALL, DATA.leafSetNodePath, netconfStrategy); + normalizedNode = readData(ContentParam.ALL, DATA.leafSetNodePath, netconfStrategy); assertEquals(expectedData, normalizedNode); } @@ -285,10 +285,10 @@ public class ReadDataTransactionUtilTest { doReturn(immediateFluentFuture(Optional.empty())).when(read) .read(LogicalDatastoreType.CONFIGURATION, DATA.path2); doReturn(immediateFluentFuture(Optional.empty())).when(netconfService).getConfig(DATA.path2); - NormalizedNode normalizedNode = readData(ContentParameter.CONFIG, DATA.path2, mdsalStrategy); + NormalizedNode normalizedNode = readData(ContentParam.CONFIG, DATA.path2, mdsalStrategy); assertNull(normalizedNode); - normalizedNode = readData(ContentParameter.CONFIG, DATA.path2, netconfStrategy); + normalizedNode = readData(ContentParam.CONFIG, DATA.path2, netconfStrategy); assertNull(normalizedNode); } @@ -299,7 +299,7 @@ public class ReadDataTransactionUtilTest { * @param strategy {@link RestconfStrategy} - wrapper for variables * @return {@link NormalizedNode} */ - private @Nullable NormalizedNode readData(final @NonNull ContentParameter content, + private @Nullable NormalizedNode readData(final @NonNull ContentParam content, final YangInstanceIdentifier path, final @NonNull RestconfStrategy strategy) { return ReadDataTransactionUtil.readData(content, path, strategy, null, schemaContext); } diff --git a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/streams/listeners/ListenerAdapterTest.java b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/streams/listeners/ListenerAdapterTest.java index aa1bab6682..40a0f67efb 100644 --- a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/streams/listeners/ListenerAdapterTest.java +++ b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/streams/listeners/ListenerAdapterTest.java @@ -34,7 +34,7 @@ import org.opendaylight.mdsal.dom.api.DOMDataBroker; import org.opendaylight.mdsal.dom.api.DOMDataTreeChangeService; import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier; import org.opendaylight.mdsal.dom.api.DOMSchemaService; -import org.opendaylight.restconf.nb.rfc8040.StartTimeParameter; +import org.opendaylight.restconf.nb.rfc8040.StartTimeParam; import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler; import org.opendaylight.yang.gen.v1.instance.identifier.patch.module.rev151121.PatchCont; import org.opendaylight.yang.gen.v1.instance.identifier.patch.module.rev151121.patch.cont.MyList1; @@ -120,7 +120,7 @@ public class ListenerAdapterTest extends AbstractConcurrentDataBrokerTest { final NotificationOutputTypeGrouping.NotificationOutputType outputType, final boolean leafNodesOnly, final boolean skipNotificationData) { super(path, streamName, outputType); - setQueryParams(StartTimeParameter.forUriValue("1970-01-01T00:00:00Z"), null, null, leafNodesOnly, + setQueryParams(StartTimeParam.forUriValue("1970-01-01T00:00:00Z"), null, null, leafNodesOnly, skipNotificationData); }