From 0cc245d37ebbe6d9d5933bcb0034a1ed9c5b093a Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Mon, 26 Jul 2021 16:39:56 +0200 Subject: [PATCH] Remove RestconfError.ErrorType yang-common is providing us with a replacement, switch to using it, which allows us to ditch some amount of legacy code. JIRA: NETCONF-793 Change-Id: Id71b5f7a992456ff17b53795e54e7a8b49120586 Signed-off-by: Robert Varga --- .../errors/RestconfDocumentedException.java | 13 +++-- .../restconf/common/errors/RestconfError.java | 53 ++----------------- .../common/util/RestconfSchemaUtil.java | 3 +- .../validation/RestconfValidationUtils.java | 3 +- .../schema/SchemaRetrievalServiceImpl.java | 2 +- .../impl/JsonNormalizedNodeBodyReader.java | 2 +- .../sal/rest/impl/JsonToPatchBodyReader.java | 2 +- .../sal/rest/impl/PatchJsonBodyWriter.java | 2 +- .../sal/rest/impl/PatchXmlBodyWriter.java | 2 +- .../RestconfDocumentedExceptionMapper.java | 2 +- .../impl/XmlNormalizedNodeBodyReader.java | 2 +- .../sal/rest/impl/XmlToPatchBodyReader.java | 2 +- .../sal/restconf/impl/BrokerFacade.java | 9 ++-- .../sal/restconf/impl/ControllerContext.java | 2 +- .../impl/JSONRestconfServiceImpl.java | 20 +------ .../restconf/impl/QueryParametersParser.java | 5 +- .../sal/restconf/impl/RestconfImpl.java | 2 +- .../test/providers/TestXmlBodyReader.java | 3 +- .../TestXmlBodyReaderMountPoint.java | 3 +- .../to/cnsn/test/RestPutListDataTest.java | 2 +- .../restconf/impl/test/BrokerFacadeTest.java | 2 +- .../impl/test/InvokeRpcMethodTest.java | 2 +- ...RestconfDocumentedExceptionMapperTest.java | 6 +-- .../restconf/impl/test/RestconfErrorTest.java | 16 ++---- .../restconf/impl/test/RestconfImplTest.java | 2 +- .../JsonNormalizedNodeBodyReader.java | 2 +- .../XmlNormalizedNodeBodyReader.java | 2 +- .../RestconfDocumentedExceptionMapper.java | 2 +- .../providers/patch/JsonPatchBodyReader.java | 2 +- .../patch/JsonPatchStatusBodyWriter.java | 2 +- .../providers/patch/XmlPatchBodyReader.java | 2 +- .../patch/XmlPatchStatusBodyWriter.java | 2 +- .../rests/services/impl/CreateStreamUtil.java | 2 +- .../impl/RestconfDataServiceImpl.java | 17 +++--- .../impl/RestconfDataStreamServiceImpl.java | 2 +- .../RestconfInvokeOperationsServiceImpl.java | 2 +- .../impl/RestconfOperationsServiceImpl.java | 2 +- .../services/impl/SubscribeToStreamUtil.java | 2 +- .../MdsalRestconfTransaction.java | 3 +- .../utils/DeleteDataTransactionUtil.java | 2 +- .../rfc8040/rests/utils/FutureCallbackTx.java | 8 +-- .../rests/utils/PatchDataTransactionUtil.java | 2 +- .../rests/utils/PostDataTransactionUtil.java | 4 +- .../rests/utils/PutDataTransactionUtil.java | 10 ++-- .../rests/utils/ReadDataTransactionUtil.java | 14 ++--- .../utils/RestconfInvokeOperationsUtil.java | 2 +- .../utils/parser/ParserFieldsParameter.java | 2 +- .../utils/parser/ParserIdentifier.java | 2 +- .../YangInstanceIdentifierDeserializer.java | 2 +- .../YangInstanceIdentifierSerializer.java | 2 +- .../XmlBodyReaderMountPointTest.java | 3 +- ...RestconfDocumentedExceptionMapperTest.java | 2 +- .../test/AbstractBodyReaderTest.java | 2 +- .../providers/test/XmlBodyReaderTest.java | 3 +- .../impl/RestconfSchemaServiceTest.java | 17 +++--- .../utils/DeleteDataTransactionUtilTest.java | 3 +- .../utils/PatchDataTransactionUtilTest.java | 4 +- .../utils/ReadDataTransactionUtilTest.java | 2 +- .../parser/ParserFieldsParameterTest.java | 2 +- .../utils/parser/ParserIdentifierTest.java | 20 +++---- .../utils/parser/RestconfValidationTest.java | 13 ++--- ...angInstanceIdentifierDeserializerTest.java | 9 ++-- 62 files changed, 131 insertions(+), 205 deletions(-) diff --git a/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/errors/RestconfDocumentedException.java b/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/errors/RestconfDocumentedException.java index 6bc02fe733..66ead84da2 100644 --- a/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/errors/RestconfDocumentedException.java +++ b/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/errors/RestconfDocumentedException.java @@ -18,7 +18,7 @@ import javax.ws.rs.core.Response.Status; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.OperationFailedException; import org.opendaylight.yangtools.yang.common.RpcError; import org.opendaylight.yangtools.yang.common.YangError; @@ -50,7 +50,7 @@ public class RestconfDocumentedException extends WebApplicationException { * A string which provides a plain text string describing the error. */ public RestconfDocumentedException(final String message) { - this(message, RestconfError.ErrorType.APPLICATION, RestconfError.ErrorTag.OPERATION_FAILED); + this(message, ErrorType.APPLICATION, RestconfError.ErrorTag.OPERATION_FAILED); } /** @@ -67,8 +67,7 @@ public class RestconfDocumentedException extends WebApplicationException { */ public RestconfDocumentedException(final String message, final ErrorType errorType, final ErrorTag errorTag, final Throwable cause) { - this(cause, new RestconfError(errorType, errorTag, message, null, - cause.getMessage(), null)); + this(cause, new RestconfError(errorType, errorTag, message, null, cause.getMessage(), null)); } /** @@ -112,7 +111,7 @@ public class RestconfDocumentedException extends WebApplicationException { * The underlying exception cause. */ public RestconfDocumentedException(final String message, final Throwable cause) { - this(cause, new RestconfError(RestconfError.ErrorType.APPLICATION, RestconfError.ErrorTag.OPERATION_FAILED, + this(cause, new RestconfError(ErrorType.APPLICATION, RestconfError.ErrorTag.OPERATION_FAILED, message, null, cause.getMessage(), null)); } @@ -133,7 +132,7 @@ public class RestconfDocumentedException extends WebApplicationException { if (!errors.isEmpty()) { this.errors = ImmutableList.copyOf(errors); } else { - this.errors = ImmutableList.of(new RestconfError(RestconfError.ErrorType.APPLICATION, + this.errors = ImmutableList.of(new RestconfError(ErrorType.APPLICATION, RestconfError.ErrorTag.OPERATION_FAILED, message)); } @@ -239,7 +238,7 @@ public class RestconfDocumentedException extends WebApplicationException { public static void throwIfYangError(final Throwable cause) { if (cause instanceof YangError) { final YangError error = (YangError) cause; - throw new RestconfDocumentedException(cause, new RestconfError(ErrorType.valueOf(error.getErrorType()), + throw new RestconfDocumentedException(cause, new RestconfError(error.getErrorType().toNetconf(), // FIXME: this is a special-case until we have YangError.getTag() cause instanceof YangInvalidValueException ? ErrorTag.INVALID_VALUE : ErrorTag.MALFORMED_MESSAGE, error.getErrorMessage().orElse(null), error.getErrorAppTag().orElse(null))); diff --git a/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/errors/RestconfError.java b/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/errors/RestconfError.java index 13eb681aac..db193ddd9c 100644 --- a/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/errors/RestconfError.java +++ b/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/errors/RestconfError.java @@ -11,7 +11,7 @@ import static java.util.Objects.requireNonNull; import java.io.Serializable; import java.util.Locale; -import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.RpcError; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.slf4j.Logger; @@ -31,52 +31,6 @@ public class RestconfError implements Serializable { private static final Logger LOG = LoggerFactory.getLogger(RestconfError.class); private static final long serialVersionUID = 1L; - // FIXME: remove this enum in favor of RpcError.ErrorType (or its equivalent) - public enum ErrorType { - /** - * Errors relating to the transport layer. - */ - TRANSPORT, - /** - * Errors relating to the RPC or notification layer. - */ - RPC, - /** - * Errors relating to the protocol operation layer. - */ - PROTOCOL, - /** - * Errors relating to the server application layer. - */ - APPLICATION; - - public String getErrorTypeTag() { - return name().toLowerCase(Locale.ROOT); - } - - public static ErrorType valueOfCaseInsensitive(final String value) { - try { - return ErrorType.valueOf(ErrorType.class, value.toUpperCase(Locale.ROOT)); - } catch (IllegalArgumentException e) { - return APPLICATION; - } - } - - public static @NonNull ErrorType valueOf(final RpcError.ErrorType errorType) { - switch (errorType) { - case PROTOCOL: - return PROTOCOL; - case RPC: - return RPC; - case TRANSPORT: - return TRANSPORT; - case APPLICATION: - default: - return APPLICATION; - } - } - } - public enum ErrorTag { IN_USE("in-use", 409 /* Conflict */), INVALID_VALUE("invalid-value", 400 /* Bad Request */), @@ -252,8 +206,7 @@ public class RestconfError implements Serializable { */ public RestconfError(final RpcError rpcError) { - this.errorType = rpcError.getErrorType() == null ? ErrorType.APPLICATION : ErrorType - .valueOfCaseInsensitive(rpcError.getErrorType().name()); + this.errorType = rpcError.getErrorType().toNetconf(); this.errorTag = rpcError.getTag() == null ? ErrorTag.OPERATION_FAILED : ErrorTag .valueOfCaseInsensitive(rpcError.getTag()); @@ -304,7 +257,7 @@ public class RestconfError implements Serializable { @Override public String toString() { return "RestconfError [" - + "error-type: " + errorType.getErrorTypeTag() + ", error-tag: " + errorTag.getTagValue() + + "error-type: " + errorType.elementBody() + ", error-tag: " + errorTag.getTagValue() + (errorAppTag != null ? ", error-app-tag: " + errorAppTag : "") + (errorMessage != null ? ", error-message: " + errorMessage : "") + (errorInfo != null ? ", error-info: " + errorInfo : "") diff --git a/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/util/RestconfSchemaUtil.java b/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/util/RestconfSchemaUtil.java index 261e32a4e7..bc3e676eb8 100644 --- a/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/util/RestconfSchemaUtil.java +++ b/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/util/RestconfSchemaUtil.java @@ -10,7 +10,7 @@ package org.opendaylight.restconf.common.util; import java.util.Collection; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; import org.opendaylight.yangtools.yang.model.api.SchemaNode; @@ -46,5 +46,4 @@ public final class RestconfSchemaUtil { throw new RestconfDocumentedException("Schema node " + schemaNodeName + " does not exist in module.", ErrorType.PROTOCOL, ErrorTag.DATA_MISSING); } - } diff --git a/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/validation/RestconfValidationUtils.java b/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/validation/RestconfValidationUtils.java index b8e955770e..4317446922 100644 --- a/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/validation/RestconfValidationUtils.java +++ b/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/validation/RestconfValidationUtils.java @@ -5,12 +5,11 @@ * 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.common.validation; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; +import org.opendaylight.yangtools.yang.common.ErrorType; /** * sal-rest-connector diff --git a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/md/sal/rest/schema/SchemaRetrievalServiceImpl.java b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/md/sal/rest/schema/SchemaRetrievalServiceImpl.java index 8cff24c393..801b16bffb 100644 --- a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/md/sal/rest/schema/SchemaRetrievalServiceImpl.java +++ b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/md/sal/rest/schema/SchemaRetrievalServiceImpl.java @@ -16,9 +16,9 @@ import org.opendaylight.netconf.sal.restconf.impl.ControllerContext; import org.opendaylight.restconf.common.context.InstanceIdentifierContext; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.restconf.common.schema.SchemaExportContext; import org.opendaylight.restconf.common.validation.RestconfValidationUtils; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.Revision; import org.opendaylight.yangtools.yang.model.api.Module; import org.opendaylight.yangtools.yang.model.api.SchemaContext; diff --git a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonNormalizedNodeBodyReader.java b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonNormalizedNodeBodyReader.java index 3b03a0d6fb..cda7ab7135 100644 --- a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonNormalizedNodeBodyReader.java +++ b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonNormalizedNodeBodyReader.java @@ -32,8 +32,8 @@ import org.opendaylight.restconf.common.context.InstanceIdentifierContext; import org.opendaylight.restconf.common.context.NormalizedNodeContext; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.restconf.common.util.RestUtil; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode; import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode; diff --git a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonToPatchBodyReader.java b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonToPatchBodyReader.java index bd1b47803c..d0686046cf 100644 --- a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonToPatchBodyReader.java +++ b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonToPatchBodyReader.java @@ -38,11 +38,11 @@ import org.opendaylight.netconf.sal.restconf.impl.ControllerContext; import org.opendaylight.restconf.common.context.InstanceIdentifierContext; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.restconf.common.patch.PatchContext; import org.opendaylight.restconf.common.patch.PatchEditOperation; import org.opendaylight.restconf.common.patch.PatchEntity; import org.opendaylight.restconf.common.util.RestUtil; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; diff --git a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/PatchJsonBodyWriter.java b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/PatchJsonBodyWriter.java index cf7c9fa8fe..cdca49d7ca 100644 --- a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/PatchJsonBodyWriter.java +++ b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/PatchJsonBodyWriter.java @@ -99,7 +99,7 @@ public class PatchJsonBodyWriter implements MessageBodyWriter for (final RestconfError restconfError : errors) { writer.writeStartElement("error-type"); - writer.writeCharacters(restconfError.getErrorType().getErrorTypeTag()); + writer.writeCharacters(restconfError.getErrorType().elementBody()); writer.writeEndElement(); writer.writeStartElement("error-tag"); diff --git a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/RestconfDocumentedExceptionMapper.java b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/RestconfDocumentedExceptionMapper.java index b99110ee42..22fa6c71f6 100644 --- a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/RestconfDocumentedExceptionMapper.java +++ b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/RestconfDocumentedExceptionMapper.java @@ -169,7 +169,7 @@ public class RestconfDocumentedExceptionMapper implements ExceptionMapper 1 or \"unbounded\"")); } wpBuilder.setDepth(depth); } catch (final NumberFormatException e) { throw new RestconfDocumentedException(e, new RestconfError( - RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.INVALID_VALUE, + ErrorType.PROTOCOL, RestconfError.ErrorTag.INVALID_VALUE, "Invalid depth parameter: " + e.getMessage(), null, "The depth parameter must be an integer > 1 or \"unbounded\"")); } diff --git a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java index 6d7333a493..503fc62b62 100644 --- a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java +++ b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java @@ -75,7 +75,6 @@ import org.opendaylight.restconf.common.context.InstanceIdentifierContext; import org.opendaylight.restconf.common.context.NormalizedNodeContext; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.restconf.common.patch.PatchContext; import org.opendaylight.restconf.common.patch.PatchStatusContext; import org.opendaylight.restconf.common.util.DataChangeScope; @@ -83,6 +82,7 @@ import org.opendaylight.restconf.common.util.OperationsResourceUtils; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; import org.opendaylight.yang.gen.v1.urn.sal.restconf.event.subscription.rev140708.NotificationOutputTypeGrouping.NotificationOutputType; import org.opendaylight.yangtools.yang.common.Empty; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.QNameModule; import org.opendaylight.yangtools.yang.common.Revision; diff --git a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/rest/impl/test/providers/TestXmlBodyReader.java b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/rest/impl/test/providers/TestXmlBodyReader.java index 79f6a51085..6eea15d81e 100644 --- a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/rest/impl/test/providers/TestXmlBodyReader.java +++ b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/rest/impl/test/providers/TestXmlBodyReader.java @@ -26,6 +26,7 @@ import org.opendaylight.netconf.sal.rest.impl.XmlNormalizedNodeBodyReader; import org.opendaylight.restconf.common.context.NormalizedNodeContext; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.QNameModule; import org.opendaylight.yangtools.yang.common.Revision; @@ -279,7 +280,7 @@ public class TestXmlBodyReader extends AbstractBodyReaderTest { Assert.fail("Test should fail due to malformed PUT operation message"); } catch (final RestconfDocumentedException exception) { final RestconfError restconfError = exception.getErrors().get(0); - Assert.assertEquals(RestconfError.ErrorType.PROTOCOL, restconfError.getErrorType()); + Assert.assertEquals(ErrorType.PROTOCOL, restconfError.getErrorType()); Assert.assertEquals(RestconfError.ErrorTag.MALFORMED_MESSAGE, restconfError.getErrorTag()); } } diff --git a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/rest/impl/test/providers/TestXmlBodyReaderMountPoint.java b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/rest/impl/test/providers/TestXmlBodyReaderMountPoint.java index f7c4df0dd4..8ad7d0a8c1 100644 --- a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/rest/impl/test/providers/TestXmlBodyReaderMountPoint.java +++ b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/rest/impl/test/providers/TestXmlBodyReaderMountPoint.java @@ -26,6 +26,7 @@ import org.opendaylight.netconf.sal.rest.impl.XmlNormalizedNodeBodyReader; import org.opendaylight.restconf.common.context.NormalizedNodeContext; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.QNameModule; import org.opendaylight.yangtools.yang.common.Revision; @@ -211,7 +212,7 @@ public class TestXmlBodyReaderMountPoint extends AbstractBodyReaderTest { Assert.fail("Test should fail due to malformed PUT operation message"); } catch (final RestconfDocumentedException exception) { final RestconfError restconfError = exception.getErrors().get(0); - Assert.assertEquals(RestconfError.ErrorType.PROTOCOL, restconfError.getErrorType()); + Assert.assertEquals(ErrorType.PROTOCOL, restconfError.getErrorType()); Assert.assertEquals(RestconfError.ErrorTag.MALFORMED_MESSAGE, restconfError.getErrorTag()); } } diff --git a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/input/to/cnsn/test/RestPutListDataTest.java b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/input/to/cnsn/test/RestPutListDataTest.java index 058d89e01b..39d297e7bd 100644 --- a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/input/to/cnsn/test/RestPutListDataTest.java +++ b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/input/to/cnsn/test/RestPutListDataTest.java @@ -36,7 +36,7 @@ import org.opendaylight.restconf.common.context.NormalizedNodeContext; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier; diff --git a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/BrokerFacadeTest.java b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/BrokerFacadeTest.java index 01d08a12aa..c39251394b 100644 --- a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/BrokerFacadeTest.java +++ b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/BrokerFacadeTest.java @@ -67,12 +67,12 @@ 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.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.restconf.common.patch.PatchContext; import org.opendaylight.restconf.common.patch.PatchStatusContext; import org.opendaylight.restconf.common.util.DataChangeScope; import org.opendaylight.yang.gen.v1.urn.sal.restconf.event.subscription.rev140708.NotificationOutputTypeGrouping.NotificationOutputType; import org.opendaylight.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.RpcError; import org.opendaylight.yangtools.yang.common.RpcResultBuilder; diff --git a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/InvokeRpcMethodTest.java b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/InvokeRpcMethodTest.java index 588689424f..b744008d3d 100644 --- a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/InvokeRpcMethodTest.java +++ b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/InvokeRpcMethodTest.java @@ -47,7 +47,7 @@ import org.opendaylight.restconf.common.context.NormalizedNodeContext; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.RpcError; import org.opendaylight.yangtools.yang.common.RpcResultBuilder; diff --git a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfDocumentedExceptionMapperTest.java b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfDocumentedExceptionMapperTest.java index dea0b40d4c..fffd64e060 100644 --- a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfDocumentedExceptionMapperTest.java +++ b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfDocumentedExceptionMapperTest.java @@ -65,8 +65,8 @@ import org.opendaylight.restconf.common.context.NormalizedNodeContext; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.yangtools.util.xml.UntrustedXML; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -745,7 +745,7 @@ public class RestconfDocumentedExceptionMapperTest extends JerseyTest { } } - assertEquals("error-type", expErrorType.getErrorTypeTag(), leafMap.remove("error-type")); + assertEquals("error-type", expErrorType.elementBody(), leafMap.remove("error-type")); assertEquals("error-tag", expErrorTag.getTagValue(), leafMap.remove("error-tag")); verifyOptionalJsonLeaf(leafMap.remove("error-message"), expErrorMessage, "error-message"); @@ -795,7 +795,7 @@ public class RestconfDocumentedExceptionMapperTest extends JerseyTest { throws Exception { final String errorType = (String) ERROR_TYPE.evaluate(errorNode, XPathConstants.STRING); - assertEquals("error-type", expErrorType.getErrorTypeTag(), errorType); + assertEquals("error-type", expErrorType.elementBody(), errorType); final String errorTag = (String) ERROR_TAG.evaluate(errorNode, XPathConstants.STRING); assertEquals("error-tag", expErrorTag.getTagValue(), errorTag); diff --git a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfErrorTest.java b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfErrorTest.java index 469c6e0762..faddeca599 100644 --- a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfErrorTest.java +++ b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfErrorTest.java @@ -8,9 +8,9 @@ package org.opendaylight.controller.sal.restconf.impl.test; import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; import java.util.HashMap; import java.util.Map; @@ -20,7 +20,7 @@ import org.hamcrest.Matcher; import org.junit.Test; import org.opendaylight.restconf.common.errors.RestconfError; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.RpcError; import org.opendaylight.yangtools.yang.common.RpcResultBuilder; @@ -62,16 +62,6 @@ public class RestconfErrorTest { assertEquals("in-use", ErrorTag.IN_USE.getTagValue()); } - @Test - public void testErrorTypeGetErrorTypeTagIsLowerCase() { - assertEquals(ErrorType.APPLICATION.name().toLowerCase(), ErrorType.APPLICATION.getErrorTypeTag()); - } - - @Test - public void testErrorTypeValueOf() { - assertEquals(ErrorType.APPLICATION, ErrorType.valueOfCaseInsensitive(ErrorType.APPLICATION.getErrorTypeTag())); - } - @Test public void testErrorTagStatusCodes() { Map lookUpMap = new HashMap<>(); @@ -179,7 +169,7 @@ public class RestconfErrorTest { "warning", new RestconfError(rpcError)); // No fields set - edge case - rpcError = RpcResultBuilder.newError(null, null, null, null, null, null); + rpcError = RpcResultBuilder.newError(RpcError.ErrorType.APPLICATION, null, null, null, null, null); validateRestConfError(null, ErrorType.APPLICATION, ErrorTag.OPERATION_FAILED, null, "error", new RestconfError(rpcError)); diff --git a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java index 780dcf32f6..3b6cb71b41 100644 --- a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java +++ b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java @@ -56,8 +56,8 @@ import org.opendaylight.restconf.common.context.NormalizedNodeContext; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.yangtools.yang.common.Empty; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates; import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/JsonNormalizedNodeBodyReader.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/JsonNormalizedNodeBodyReader.java index eb334c2f57..6ea9c5a90f 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/JsonNormalizedNodeBodyReader.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/JsonNormalizedNodeBodyReader.java @@ -25,9 +25,9 @@ import org.opendaylight.restconf.common.context.InstanceIdentifierContext; import org.opendaylight.restconf.common.context.NormalizedNodeContext; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.restconf.nb.rfc8040.MediaTypes; import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode; import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode; diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/XmlNormalizedNodeBodyReader.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/XmlNormalizedNodeBodyReader.java index d0558b290c..3e28d04324 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/XmlNormalizedNodeBodyReader.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/XmlNormalizedNodeBodyReader.java @@ -29,10 +29,10 @@ import org.opendaylight.restconf.common.context.InstanceIdentifierContext; import org.opendaylight.restconf.common.context.NormalizedNodeContext; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.restconf.nb.rfc8040.MediaTypes; import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler; import org.opendaylight.yangtools.util.xml.UntrustedXML; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.MapNode; diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/errors/RestconfDocumentedExceptionMapper.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/errors/RestconfDocumentedExceptionMapper.java index 60aeaba843..9f6619c897 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/errors/RestconfDocumentedExceptionMapper.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/errors/RestconfDocumentedExceptionMapper.java @@ -144,7 +144,7 @@ public final class RestconfDocumentedExceptionMapper implements ExceptionMapper< final DataContainerNodeBuilder entryBuilder = ImmutableUnkeyedListEntryNodeBuilder.create() .withNodeIdentifier(NodeIdentifier.create(Error.QNAME)) - .withChild(ImmutableNodes.leafNode(ERROR_TYPE_QNAME, restconfError.getErrorType().getErrorTypeTag())) + .withChild(ImmutableNodes.leafNode(ERROR_TYPE_QNAME, restconfError.getErrorType().elementBody())) .withChild(ImmutableNodes.leafNode(ERROR_TAG_QNAME, restconfError.getErrorTag().getTagValue())); // filling in optional fields diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/patch/JsonPatchBodyReader.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/patch/JsonPatchBodyReader.java index b1dacdb10f..039a3de27c 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/patch/JsonPatchBodyReader.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/patch/JsonPatchBodyReader.java @@ -33,7 +33,6 @@ import org.opendaylight.mdsal.dom.api.DOMMountPointService; import org.opendaylight.restconf.common.context.InstanceIdentifierContext; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.restconf.common.patch.PatchContext; import org.opendaylight.restconf.common.patch.PatchEditOperation; import org.opendaylight.restconf.common.patch.PatchEntity; @@ -41,6 +40,7 @@ import org.opendaylight.restconf.nb.rfc8040.MediaTypes; import org.opendaylight.restconf.nb.rfc8040.codecs.StringModuleInstanceIdentifierCodec; import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler; import org.opendaylight.restconf.nb.rfc8040.utils.parser.ParserIdentifier; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/patch/JsonPatchStatusBodyWriter.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/patch/JsonPatchStatusBodyWriter.java index 8336798cdf..f000f7c133 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/patch/JsonPatchStatusBodyWriter.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/patch/JsonPatchStatusBodyWriter.java @@ -81,7 +81,7 @@ public class JsonPatchStatusBodyWriter extends AbstractPatchStatusBodyWriter { for (final RestconfError restconfError : errors) { jsonWriter.beginObject(); - jsonWriter.name("error-type").value(restconfError.getErrorType().getErrorTypeTag()); + jsonWriter.name("error-type").value(restconfError.getErrorType().elementBody()); jsonWriter.name("error-tag").value(restconfError.getErrorTag().getTagValue()); // optional node diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/patch/XmlPatchBodyReader.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/patch/XmlPatchBodyReader.java index b26899fe3d..e8baaf492b 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/patch/XmlPatchBodyReader.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/patch/XmlPatchBodyReader.java @@ -30,7 +30,6 @@ import org.opendaylight.mdsal.dom.api.DOMMountPointService; import org.opendaylight.restconf.common.context.InstanceIdentifierContext; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.restconf.common.patch.PatchContext; import org.opendaylight.restconf.common.patch.PatchEditOperation; import org.opendaylight.restconf.common.patch.PatchEntity; @@ -38,6 +37,7 @@ import org.opendaylight.restconf.nb.rfc8040.MediaTypes; import org.opendaylight.restconf.nb.rfc8040.codecs.StringModuleInstanceIdentifierCodec; import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler; import org.opendaylight.yangtools.util.xml.UntrustedXML; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.Revision; import org.opendaylight.yangtools.yang.common.XMLNamespace; diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/patch/XmlPatchStatusBodyWriter.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/patch/XmlPatchStatusBodyWriter.java index 914f39c0dd..8b279360bf 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/patch/XmlPatchStatusBodyWriter.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/patch/XmlPatchStatusBodyWriter.java @@ -93,7 +93,7 @@ public class XmlPatchStatusBodyWriter extends AbstractPatchStatusBodyWriter { for (final RestconfError restconfError : errors) { writer.writeStartElement("error-type"); - writer.writeCharacters(restconfError.getErrorType().getErrorTypeTag()); + writer.writeCharacters(restconfError.getErrorType().elementBody()); writer.writeEndElement(); writer.writeStartElement("error-tag"); diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/CreateStreamUtil.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/CreateStreamUtil.java index f68b7eacf5..d5016f29d1 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/CreateStreamUtil.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/CreateStreamUtil.java @@ -19,13 +19,13 @@ import org.opendaylight.mdsal.dom.spi.DefaultDOMRpcResult; import org.opendaylight.restconf.common.context.NormalizedNodeContext; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.restconf.common.util.DataChangeScope; import org.opendaylight.restconf.nb.rfc8040.rests.utils.RestconfStreamsConstants; import org.opendaylight.restconf.nb.rfc8040.streams.listeners.ListenersBroker; import org.opendaylight.restconf.nb.rfc8040.streams.listeners.NotificationListenerAdapter; import org.opendaylight.restconf.nb.rfc8040.utils.parser.ParserIdentifier; import org.opendaylight.yang.gen.v1.urn.sal.restconf.event.subscription.rev140708.NotificationOutputTypeGrouping.NotificationOutputType; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.QNameModule; import org.opendaylight.yangtools.yang.common.Revision; diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfDataServiceImpl.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfDataServiceImpl.java index e4085e18c3..12d1e5f6d4 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfDataServiceImpl.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfDataServiceImpl.java @@ -49,7 +49,6 @@ import org.opendaylight.restconf.common.context.WriterParameters; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.restconf.common.patch.PatchContext; import org.opendaylight.restconf.common.patch.PatchStatusContext; import org.opendaylight.restconf.nb.rfc8040.Rfc8040; @@ -73,6 +72,7 @@ import org.opendaylight.restconf.nb.rfc8040.utils.mapping.RestconfMappingNodeUti import org.opendaylight.restconf.nb.rfc8040.utils.parser.ParserIdentifier; import org.opendaylight.yang.gen.v1.urn.sal.restconf.event.subscription.rev140708.NotificationOutputTypeGrouping.NotificationOutputType; import org.opendaylight.yangtools.concepts.Immutable; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.Revision; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; @@ -171,8 +171,7 @@ public class RestconfDataServiceImpl implements RestconfDataService { if (node == null) { throw new RestconfDocumentedException( "Request could not be completed because the relevant data model content does not exist", - RestconfError.ErrorType.PROTOCOL, - RestconfError.ErrorTag.DATA_MISSING); + ErrorType.PROTOCOL, RestconfError.ErrorTag.DATA_MISSING); } if (parameters.getContent().equals(RestconfDataServiceConstant.ReadData.ALL) @@ -248,7 +247,7 @@ public class RestconfDataServiceImpl implements RestconfDataService { case INSERT: if (insertUsed) { throw new RestconfDocumentedException("Insert parameter can be used only once.", - RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT); + ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT); } insertUsed = true; @@ -256,13 +255,13 @@ public class RestconfDataServiceImpl implements RestconfDataService { insert = Insert.forValue(str); if (insert == null) { throw new RestconfDocumentedException("Unrecognized insert parameter value '" + str + "'", - RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT); + ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT); } break; case POINT: if (pointUsed) { throw new RestconfDocumentedException("Point parameter can be used only once.", - RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT); + ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT); } pointUsed = true; @@ -270,7 +269,7 @@ public class RestconfDataServiceImpl implements RestconfDataService { break; default: throw new RestconfDocumentedException("Bad parameter for post: " + entry.getKey(), - RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT); + ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT); } } @@ -282,13 +281,13 @@ public class RestconfDataServiceImpl implements RestconfDataService { if (pointUsed) { if (!insertUsed) { throw new RestconfDocumentedException("Point parameter can't be used without Insert parameter.", - RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT); + ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT); } if (insert != Insert.BEFORE && insert != Insert.AFTER) { throw new RestconfDocumentedException( "Point parameter can be used only with 'after' or 'before' values of Insert parameter.", - RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT); + ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ELEMENT); } } } diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfDataStreamServiceImpl.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfDataStreamServiceImpl.java index 520f631cb8..9f90352a40 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfDataStreamServiceImpl.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfDataStreamServiceImpl.java @@ -16,12 +16,12 @@ import javax.ws.rs.sse.SseEventSink; import org.opendaylight.controller.config.threadpool.ScheduledThreadPool; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.restconf.nb.rfc8040.rests.services.api.RestconfDataStreamService; import org.opendaylight.restconf.nb.rfc8040.streams.Configuration; import org.opendaylight.restconf.nb.rfc8040.streams.SSESessionHandler; import org.opendaylight.restconf.nb.rfc8040.streams.listeners.BaseListenerInterface; import org.opendaylight.restconf.nb.rfc8040.streams.listeners.ListenersBroker; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfInvokeOperationsServiceImpl.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfInvokeOperationsServiceImpl.java index d06814c4da..cb6283be6f 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfInvokeOperationsServiceImpl.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfInvokeOperationsServiceImpl.java @@ -22,11 +22,11 @@ import org.opendaylight.restconf.common.context.InstanceIdentifierContext; import org.opendaylight.restconf.common.context.NormalizedNodeContext; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler; import org.opendaylight.restconf.nb.rfc8040.rests.services.api.RestconfInvokeOperationsService; import org.opendaylight.restconf.nb.rfc8040.rests.utils.RestconfInvokeOperationsUtil; import org.opendaylight.restconf.nb.rfc8040.rests.utils.RestconfStreamsConstants; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.XMLNamespace; import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfOperationsServiceImpl.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfOperationsServiceImpl.java index 9a1c3f3821..8b34d287cb 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfOperationsServiceImpl.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfOperationsServiceImpl.java @@ -19,12 +19,12 @@ import org.opendaylight.restconf.common.context.InstanceIdentifierContext; import org.opendaylight.restconf.common.context.NormalizedNodeContext; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.restconf.common.util.OperationsResourceUtils; import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler; import org.opendaylight.restconf.nb.rfc8040.rests.services.api.RestconfOperationsService; import org.opendaylight.restconf.nb.rfc8040.utils.RestconfConstants; import org.opendaylight.restconf.nb.rfc8040.utils.parser.ParserIdentifier; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext; import org.opendaylight.yangtools.yang.model.api.SchemaContext; import org.slf4j.Logger; diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/SubscribeToStreamUtil.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/SubscribeToStreamUtil.java index 3f6d655755..b3aeb075cd 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/SubscribeToStreamUtil.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/SubscribeToStreamUtil.java @@ -22,7 +22,6 @@ import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteOperations; import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.restconf.nb.rfc8040.Rfc8040; import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler; import org.opendaylight.restconf.nb.rfc8040.rests.services.impl.RestconfStreamsSubscriptionServiceImpl.HandlersHolder; @@ -34,6 +33,7 @@ import org.opendaylight.restconf.nb.rfc8040.streams.listeners.NotificationListen import org.opendaylight.restconf.nb.rfc8040.utils.RestconfConstants; import org.opendaylight.restconf.nb.rfc8040.utils.mapping.RestconfMappingNodeUtil; import org.opendaylight.restconf.nb.rfc8040.utils.parser.IdentifierCodec; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode; import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext; import org.slf4j.Logger; diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/transactions/MdsalRestconfTransaction.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/transactions/MdsalRestconfTransaction.java index 0e7b2461f5..522b3b52ca 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/transactions/MdsalRestconfTransaction.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/transactions/MdsalRestconfTransaction.java @@ -24,6 +24,7 @@ import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError; import org.opendaylight.restconf.nb.rfc8040.rests.utils.DeleteDataTransactionUtil; import org.opendaylight.restconf.nb.rfc8040.rests.utils.TransactionUtil; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; import org.opendaylight.yangtools.yang.data.api.schema.MapNode; @@ -127,7 +128,7 @@ final class MdsalRestconfTransaction extends RestconfTransaction { final ReadFailedException e = failure.getValue(); if (e == null) { throw new RestconfDocumentedException("Data already exists", - RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.DATA_EXISTS, failure.getKey()); + ErrorType.PROTOCOL, RestconfError.ErrorTag.DATA_EXISTS, failure.getKey()); } throw new RestconfDocumentedException( diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/DeleteDataTransactionUtil.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/DeleteDataTransactionUtil.java index e26cba1f11..05080a4666 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/DeleteDataTransactionUtil.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/DeleteDataTransactionUtil.java @@ -13,9 +13,9 @@ import javax.ws.rs.core.Response.Status; import org.opendaylight.mdsal.common.api.CommitInfo; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfStrategy; import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfTransaction; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/FutureCallbackTx.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/FutureCallbackTx.java index 1e0697b46f..f73e9f1713 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/FutureCallbackTx.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/FutureCallbackTx.java @@ -23,6 +23,7 @@ import org.opendaylight.netconf.api.NetconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError; import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfStrategy; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.RpcError; import org.opendaylight.yangtools.yang.common.RpcResultBuilder; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; @@ -108,19 +109,18 @@ final class FutureCallbackTx { if (errorTag.equals(DocumentedException.ErrorTag.DATA_EXISTS)) { LOG.trace("Operation via Restconf was not executed because data at {} already exists", path); - throw new RestconfDocumentedException(e, new RestconfError(RestconfError.ErrorType.PROTOCOL, + throw new RestconfDocumentedException(e, new RestconfError(ErrorType.PROTOCOL, RestconfError.ErrorTag.DATA_EXISTS, "Data already exists", path)); } else if (errorTag.equals(DocumentedException.ErrorTag.DATA_MISSING)) { LOG.trace("Operation via Restconf was not executed because data at {} does not exist", path); - throw new RestconfDocumentedException(e, new RestconfError(RestconfError.ErrorType.PROTOCOL, + throw new RestconfDocumentedException(e, new RestconfError(ErrorType.PROTOCOL, RestconfError.ErrorTag.DATA_MISSING, "Data does not exist", path)); } } if (error instanceof NetconfDocumentedException) { throw new RestconfDocumentedException(error.getMessage(), - RestconfError.ErrorType.valueOfCaseInsensitive( - ((NetconfDocumentedException) error).getErrorType().elementBody()), + ((NetconfDocumentedException) error).getErrorType(), RestconfError.ErrorTag.valueOfCaseInsensitive( ((NetconfDocumentedException) error).getErrorTag().getTagValue()), e); } diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/PatchDataTransactionUtil.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/PatchDataTransactionUtil.java index 620b100778..a3b560de5c 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/PatchDataTransactionUtil.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/PatchDataTransactionUtil.java @@ -19,13 +19,13 @@ 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.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.restconf.common.patch.PatchContext; import org.opendaylight.restconf.common.patch.PatchEntity; import org.opendaylight.restconf.common.patch.PatchStatusContext; import org.opendaylight.restconf.common.patch.PatchStatusEntity; import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfStrategy; import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfTransaction; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext; 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 70008b7e13..869fd79d6c 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 @@ -22,11 +22,11 @@ import org.opendaylight.restconf.common.context.NormalizedNodeContext; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfStrategy; import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfTransaction; import org.opendaylight.restconf.nb.rfc8040.rests.utils.RestconfDataServiceConstant.PostPutQueryParameters.Insert; import org.opendaylight.restconf.nb.rfc8040.utils.parser.ParserIdentifier; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode; import org.opendaylight.yangtools.yang.data.api.schema.MapNode; @@ -139,7 +139,7 @@ public final class PostDataTransactionUtil { default: throw new RestconfDocumentedException( "Used bad value of insert parameter. Possible values are first, last, before or after, but was: " - + insert, RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ATTRIBUTE); + + insert, ErrorType.PROTOCOL, RestconfError.ErrorTag.BAD_ATTRIBUTE); } } 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 c9ca113e8c..316a048175 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 @@ -17,12 +17,12 @@ import org.opendaylight.mdsal.dom.api.DOMTransactionChain; import org.opendaylight.restconf.common.context.InstanceIdentifierContext; import org.opendaylight.restconf.common.context.NormalizedNodeContext; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; -import org.opendaylight.restconf.common.errors.RestconfError; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfStrategy; import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfTransaction; import org.opendaylight.restconf.nb.rfc8040.rests.utils.RestconfDataServiceConstant.PostPutQueryParameters.Insert; import org.opendaylight.restconf.nb.rfc8040.utils.parser.ParserIdentifier; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer; @@ -127,7 +127,7 @@ public final class PutDataTransactionUtil { default: throw new RestconfDocumentedException( "Used bad value of insert parameter. Possible values are first, last, before or after, " - + "but was: " + insert, RestconfError.ErrorType.PROTOCOL, ErrorTag.BAD_ATTRIBUTE); + + "but was: " + insert, ErrorType.PROTOCOL, ErrorTag.BAD_ATTRIBUTE); } } @@ -186,7 +186,7 @@ public final class PutDataTransactionUtil { if (dataSchemaNode instanceof ListSchemaNode) { if (!((ListSchemaNode) dataSchemaNode).isUserOrdered()) { throw new RestconfDocumentedException("Insert parameter can be used only with ordered-by user list.", - RestconfError.ErrorType.PROTOCOL, ErrorTag.BAD_ELEMENT); + ErrorType.PROTOCOL, ErrorTag.BAD_ELEMENT); } return dataSchemaNode; } @@ -194,11 +194,11 @@ public final class PutDataTransactionUtil { if (!((LeafListSchemaNode) dataSchemaNode).isUserOrdered()) { throw new RestconfDocumentedException( "Insert parameter can be used only with ordered-by user leaf-list.", - RestconfError.ErrorType.PROTOCOL, ErrorTag.BAD_ELEMENT); + ErrorType.PROTOCOL, ErrorTag.BAD_ELEMENT); } return dataSchemaNode; } throw new RestconfDocumentedException("Insert parameter can be used only with list or leaf-list", - RestconfError.ErrorType.PROTOCOL, ErrorTag.BAD_ELEMENT); + ErrorType.PROTOCOL, ErrorTag.BAD_ELEMENT); } } 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 d6bad685db..875438290a 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 @@ -32,9 +32,9 @@ import org.opendaylight.restconf.common.context.WriterParameters.WriterParameter import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfStrategy; import org.opendaylight.restconf.nb.rfc8040.rests.utils.RestconfDataServiceConstant.ReadData.WithDefaults; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.QNameModule; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; @@ -141,7 +141,7 @@ public final class ReadDataTransactionUtil { break; default: throw new RestconfDocumentedException( - new RestconfError(RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.INVALID_VALUE, + new RestconfError(ErrorType.PROTOCOL, RestconfError.ErrorTag.INVALID_VALUE, "Invalid content parameter: " + contentValue, null, "The content parameter value must be either config, nonconfig or all (default)")); } @@ -153,7 +153,7 @@ public final class ReadDataTransactionUtil { if (value == null || value < RestconfDataServiceConstant.ReadData.MIN_DEPTH || value > RestconfDataServiceConstant.ReadData.MAX_DEPTH) { throw new RestconfDocumentedException( - new RestconfError(RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.INVALID_VALUE, + new RestconfError(ErrorType.PROTOCOL, RestconfError.ErrorTag.INVALID_VALUE, "Invalid depth parameter: " + depth, null, "The depth parameter must be an integer between 1 and 65535 or \"unbounded\"")); } else { @@ -175,7 +175,7 @@ public final class ReadDataTransactionUtil { final String str = withDefaults.get(0); final WithDefaults val = WithDefaults.forValue(str); if (val == null) { - throw new RestconfDocumentedException(new RestconfError(RestconfError.ErrorType.PROTOCOL, + throw new RestconfDocumentedException(new RestconfError(ErrorType.PROTOCOL, RestconfError.ErrorTag.INVALID_VALUE, "Invalid with-defaults parameter: " + str, null, "The with-defaults parameter must be a string in " + WithDefaults.possibleValues())); } @@ -223,7 +223,7 @@ public final class ReadDataTransactionUtil { return readAllData(strategy, path, withDefa, ctx); default: throw new RestconfDocumentedException( - new RestconfError(RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.INVALID_VALUE, + new RestconfError(ErrorType.PROTOCOL, RestconfError.ErrorTag.INVALID_VALUE, "Invalid content parameter: " + valueOfContent, null, "The content parameter value must be either config, nonconfig or all (default)")); } @@ -259,7 +259,7 @@ public final class ReadDataTransactionUtil { case RestconfDataServiceConstant.ReadData.ALL: return readAllData(strategy, path, withDefa, ctx, fields); default: - throw new RestconfDocumentedException(new RestconfError(RestconfError.ErrorType.PROTOCOL, + throw new RestconfDocumentedException(new RestconfError(ErrorType.PROTOCOL, RestconfError.ErrorTag.INVALID_VALUE, "Invalid content parameter: " + valueOfContent, null, "The content parameter value must be either config, nonconfig or all (default)")); } @@ -295,7 +295,7 @@ public final class ReadDataTransactionUtil { .collect(Collectors.toSet()); throw new RestconfDocumentedException( "Not allowed parameters for " + READ_TYPE_TX + " operation: " + notAllowedParameters, - RestconfError.ErrorType.PROTOCOL, RestconfError.ErrorTag.INVALID_VALUE); + ErrorType.PROTOCOL, RestconfError.ErrorTag.INVALID_VALUE); } } diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/RestconfInvokeOperationsUtil.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/RestconfInvokeOperationsUtil.java index 03a7eb4559..ae76ab45b3 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/RestconfInvokeOperationsUtil.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/RestconfInvokeOperationsUtil.java @@ -19,7 +19,7 @@ import org.opendaylight.mdsal.dom.api.DOMRpcResult; import org.opendaylight.mdsal.dom.api.DOMRpcService; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.YangConstants; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/ParserFieldsParameter.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/ParserFieldsParameter.java index a5d7291d61..b5c6cdc6da 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/ParserFieldsParameter.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/ParserFieldsParameter.java @@ -22,7 +22,7 @@ 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.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.QNameModule; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/ParserIdentifier.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/ParserIdentifier.java index a913a5079f..b2ce05424d 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/ParserIdentifier.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/ParserIdentifier.java @@ -29,9 +29,9 @@ import org.opendaylight.mdsal.dom.api.DOMYangTextSourceProvider; import org.opendaylight.restconf.common.context.InstanceIdentifierContext; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.restconf.common.schema.SchemaExportContext; import org.opendaylight.restconf.nb.rfc8040.utils.RestconfConstants; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.Revision; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/YangInstanceIdentifierDeserializer.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/YangInstanceIdentifierDeserializer.java index db34403887..275b91a59c 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/YangInstanceIdentifierDeserializer.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/YangInstanceIdentifierDeserializer.java @@ -19,10 +19,10 @@ import java.util.List; import java.util.Optional; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.restconf.common.util.RestUtil; import org.opendaylight.restconf.common.util.RestconfSchemaUtil; import org.opendaylight.restconf.nb.rfc8040.codecs.RestCodec; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier; diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/YangInstanceIdentifierSerializer.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/YangInstanceIdentifierSerializer.java index 3c489ba6d5..acc9403244 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/YangInstanceIdentifierSerializer.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/YangInstanceIdentifierSerializer.java @@ -14,8 +14,8 @@ import java.util.Locale; import java.util.Map.Entry; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.yangtools.concepts.Serializer; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.QNameModule; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; diff --git a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/XmlBodyReaderMountPointTest.java b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/XmlBodyReaderMountPointTest.java index 8145d8d63e..962950a267 100644 --- a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/XmlBodyReaderMountPointTest.java +++ b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/XmlBodyReaderMountPointTest.java @@ -26,6 +26,7 @@ import org.opendaylight.restconf.common.errors.RestconfError; import org.opendaylight.restconf.nb.rfc8040.TestRestconfUtils; import org.opendaylight.restconf.nb.rfc8040.jersey.providers.test.AbstractBodyReaderTest; import org.opendaylight.restconf.nb.rfc8040.jersey.providers.test.XmlBodyReaderTest; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.QNameModule; import org.opendaylight.yangtools.yang.common.Revision; @@ -227,7 +228,7 @@ public class XmlBodyReaderMountPointTest extends AbstractBodyReaderTest { Assert.fail("Test should fail due to malformed PUT operation message"); } catch (final RestconfDocumentedException exception) { final RestconfError restconfError = exception.getErrors().get(0); - Assert.assertEquals(RestconfError.ErrorType.PROTOCOL, restconfError.getErrorType()); + Assert.assertEquals(ErrorType.PROTOCOL, restconfError.getErrorType()); Assert.assertEquals(RestconfError.ErrorTag.MALFORMED_MESSAGE, restconfError.getErrorTag()); } } diff --git a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/errors/RestconfDocumentedExceptionMapperTest.java b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/errors/RestconfDocumentedExceptionMapperTest.java index ea12aae2a5..4d37b3b3f9 100644 --- a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/errors/RestconfDocumentedExceptionMapperTest.java +++ b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/errors/RestconfDocumentedExceptionMapperTest.java @@ -29,9 +29,9 @@ import org.junit.runners.Parameterized.Parameters; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.restconf.nb.rfc8040.MediaTypes; import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.QNameModule; import org.opendaylight.yangtools.yang.common.Revision; diff --git a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/test/AbstractBodyReaderTest.java b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/test/AbstractBodyReaderTest.java index c5c11fb99b..2832e2ebd0 100644 --- a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/test/AbstractBodyReaderTest.java +++ b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/test/AbstractBodyReaderTest.java @@ -32,12 +32,12 @@ import org.opendaylight.restconf.common.context.NormalizedNodeContext; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.restconf.common.patch.PatchContext; import org.opendaylight.restconf.nb.rfc8040.TestRestconfUtils; import org.opendaylight.restconf.nb.rfc8040.TestUtils; import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler; import org.opendaylight.restconf.nb.rfc8040.jersey.providers.spi.AbstractIdentifierAwareJaxRsProvider; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext; diff --git a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/test/XmlBodyReaderTest.java b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/test/XmlBodyReaderTest.java index ecc7d860a5..abc193ba79 100644 --- a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/test/XmlBodyReaderTest.java +++ b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/test/XmlBodyReaderTest.java @@ -28,6 +28,7 @@ import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError; import org.opendaylight.restconf.nb.rfc8040.TestRestconfUtils; import org.opendaylight.restconf.nb.rfc8040.jersey.providers.XmlNormalizedNodeBodyReader; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.QNameModule; import org.opendaylight.yangtools.yang.common.Revision; @@ -280,7 +281,7 @@ public class XmlBodyReaderTest extends AbstractBodyReaderTest { Assert.fail("Test should fail due to malformed PUT operation message"); } catch (final RestconfDocumentedException exception) { final RestconfError restconfError = exception.getErrors().get(0); - Assert.assertEquals(RestconfError.ErrorType.PROTOCOL, restconfError.getErrorType()); + Assert.assertEquals(ErrorType.PROTOCOL, restconfError.getErrorType()); Assert.assertEquals(RestconfError.ErrorTag.MALFORMED_MESSAGE, restconfError.getErrorTag()); } } diff --git a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfSchemaServiceTest.java b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfSchemaServiceTest.java index f2a6dbe73f..e8eec5df89 100644 --- a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfSchemaServiceTest.java +++ b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfSchemaServiceTest.java @@ -33,6 +33,7 @@ import org.opendaylight.restconf.common.schema.SchemaExportContext; import org.opendaylight.restconf.nb.rfc8040.TestRestconfUtils; import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler; import org.opendaylight.restconf.nb.rfc8040.rests.services.api.RestconfSchemaService; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.Revision; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; @@ -257,7 +258,7 @@ public class RestconfSchemaServiceTest { this.schemaService.getSchema(""); fail("Test should fail due to invalid identifier"); } catch (final RestconfDocumentedException e) { - assertEquals(RestconfError.ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType()); + assertEquals(ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType()); assertEquals(RestconfError.ErrorTag.INVALID_VALUE, e.getErrors().get(0).getErrorTag()); assertEquals(400, e.getErrors().get(0).getErrorTag().getStatusCode()); } @@ -278,7 +279,7 @@ public class RestconfSchemaServiceTest { this.schemaService.getSchema(MOUNT_POINT + ""); fail("Test should fail due to invalid identifier"); } catch (final RestconfDocumentedException e) { - assertEquals(RestconfError.ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType()); + assertEquals(ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType()); assertEquals(RestconfError.ErrorTag.INVALID_VALUE, e.getErrors().get(0).getErrorTag()); assertEquals(400, e.getErrors().get(0).getErrorTag().getStatusCode()); } @@ -298,7 +299,7 @@ public class RestconfSchemaServiceTest { this.schemaService.getSchema("01_module/2016-01-01"); fail("Test should fail due to invalid identifier"); } catch (final RestconfDocumentedException e) { - assertEquals(RestconfError.ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType()); + assertEquals(ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType()); assertEquals(RestconfError.ErrorTag.INVALID_VALUE, e.getErrors().get(0).getErrorTag()); assertEquals(400, e.getErrors().get(0).getErrorTag().getStatusCode()); } @@ -319,7 +320,7 @@ public class RestconfSchemaServiceTest { this.schemaService.getSchema(MOUNT_POINT + "01_module/2016-01-01"); fail("Test should fail due to invalid identifier"); } catch (final RestconfDocumentedException e) { - assertEquals(RestconfError.ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType()); + assertEquals(ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType()); assertEquals(RestconfError.ErrorTag.INVALID_VALUE, e.getErrors().get(0).getErrorTag()); assertEquals(400, e.getErrors().get(0).getErrorTag().getStatusCode()); } @@ -342,7 +343,7 @@ public class RestconfSchemaServiceTest { this.schemaService.getSchema("2014-01-01"); fail("Test should fail due to invalid identifier"); } catch (final RestconfDocumentedException e) { - assertEquals(RestconfError.ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType()); + assertEquals(ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType()); assertEquals(RestconfError.ErrorTag.INVALID_VALUE, e.getErrors().get(0).getErrorTag()); assertEquals(400, e.getErrors().get(0).getErrorTag().getStatusCode()); } @@ -366,7 +367,7 @@ public class RestconfSchemaServiceTest { this.schemaService.getSchema(MOUNT_POINT + "2014-01-01"); fail("Test should fail due to invalid identifier"); } catch (final RestconfDocumentedException e) { - assertEquals(RestconfError.ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType()); + assertEquals(ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType()); assertEquals(RestconfError.ErrorTag.INVALID_VALUE, e.getErrors().get(0).getErrorTag()); assertEquals(400, e.getErrors().get(0).getErrorTag().getStatusCode()); } @@ -387,7 +388,7 @@ public class RestconfSchemaServiceTest { this.schemaService.getSchema("module"); fail("Test should fail due to invalid identifier"); } catch (final RestconfDocumentedException e) { - assertEquals(RestconfError.ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType()); + assertEquals(ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType()); assertEquals(RestconfError.ErrorTag.INVALID_VALUE, e.getErrors().get(0).getErrorTag()); assertEquals(400, e.getErrors().get(0).getErrorTag().getStatusCode()); } @@ -408,7 +409,7 @@ public class RestconfSchemaServiceTest { this.schemaService.getSchema(MOUNT_POINT + "module"); fail("Test should fail due to invalid identifier"); } catch (final RestconfDocumentedException e) { - assertEquals(RestconfError.ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType()); + assertEquals(ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType()); assertEquals(RestconfError.ErrorTag.INVALID_VALUE, e.getErrors().get(0).getErrorTag()); assertEquals(400, e.getErrors().get(0).getErrorTag().getStatusCode()); } diff --git a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/DeleteDataTransactionUtilTest.java b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/DeleteDataTransactionUtilTest.java index ba2af37eb3..3186cc5111 100644 --- a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/DeleteDataTransactionUtilTest.java +++ b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/DeleteDataTransactionUtilTest.java @@ -34,7 +34,6 @@ import org.opendaylight.netconf.api.NetconfDocumentedException; import org.opendaylight.netconf.dom.api.NetconfDataTreeService; 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.common.errors.RestconfError.ErrorTag; import org.opendaylight.restconf.nb.rfc8040.rests.transactions.MdsalRestconfStrategy; import org.opendaylight.restconf.nb.rfc8040.rests.transactions.NetconfRestconfStrategy; @@ -112,7 +111,7 @@ public class DeleteDataTransactionUtilTest { DeleteDataTransactionUtil.deleteData(strategy, context.getInstanceIdentifier()); fail("Delete operation should fail due to missing data"); } catch (final RestconfDocumentedException e) { - assertEquals(RestconfError.ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType()); + assertEquals(ErrorType.PROTOCOL, e.getErrors().get(0).getErrorType()); assertEquals(ErrorTag.DATA_MISSING, e.getErrors().get(0).getErrorTag()); } } diff --git a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/PatchDataTransactionUtilTest.java b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/PatchDataTransactionUtilTest.java index 785bae0dda..f14edee6fb 100644 --- a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/PatchDataTransactionUtilTest.java +++ b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/PatchDataTransactionUtilTest.java @@ -289,7 +289,7 @@ public class PatchDataTransactionUtilTest { PatchDataTransactionUtil.patchData(patchContext, strategy, this.refSchemaCtx); assertFalse(patchStatusContext.isOk()); - assertEquals(RestconfError.ErrorType.PROTOCOL, + assertEquals(ErrorType.PROTOCOL, patchStatusContext.getEditCollection().get(0).getEditErrors().get(0).getErrorType()); assertEquals(RestconfError.ErrorTag.DATA_MISSING, patchStatusContext.getEditCollection().get(0).getEditErrors().get(0).getErrorTag()); @@ -300,7 +300,7 @@ public class PatchDataTransactionUtilTest { PatchDataTransactionUtil.patchData(patchContext, strategy, this.refSchemaCtx); assertFalse(patchStatusContext.isOk()); - assertEquals(RestconfError.ErrorType.PROTOCOL, + assertEquals(ErrorType.PROTOCOL, patchStatusContext.getGlobalErrors().get(0).getErrorType()); assertEquals(RestconfError.ErrorTag.DATA_MISSING, patchStatusContext.getGlobalErrors().get(0).getErrorTag()); 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 ab4ae3e80a..be1e939bae 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 @@ -42,12 +42,12 @@ import org.opendaylight.restconf.common.context.WriterParameters; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError; import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; 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; import org.opendaylight.restconf.nb.rfc8040.rests.utils.RestconfDataServiceConstant.ReadData; import org.opendaylight.restconf.nb.rfc8040.rests.utils.RestconfDataServiceConstant.ReadData.WithDefaults; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier; diff --git a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/ParserFieldsParameterTest.java b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/ParserFieldsParameterTest.java index 49f5448b42..e5fd6b7aca 100644 --- a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/ParserFieldsParameterTest.java +++ b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/ParserFieldsParameterTest.java @@ -27,8 +27,8 @@ 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.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.restconf.nb.rfc8040.TestRestconfUtils; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.QNameModule; import org.opendaylight.yangtools.yang.common.Revision; diff --git a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/ParserIdentifierTest.java b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/ParserIdentifierTest.java index 1b1111b131..c782be9bb0 100644 --- a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/ParserIdentifierTest.java +++ b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/ParserIdentifierTest.java @@ -33,10 +33,10 @@ 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.common.errors.RestconfError.ErrorTag; -import org.opendaylight.restconf.common.errors.RestconfError.ErrorType; import org.opendaylight.restconf.common.schema.SchemaExportContext; import org.opendaylight.restconf.nb.rfc8040.TestRestconfUtils; import org.opendaylight.restconf.nb.rfc8040.utils.RestconfConstants; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.Revision; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; @@ -249,7 +249,7 @@ public class ParserIdentifierTest { RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class, () -> ParserIdentifier.toInstanceIdentifier("/yang-ext:mount", SCHEMA_CONTEXT, Optional.of(this.mountPointService))); - assertEquals("Not expected error type", RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); + assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); assertEquals("Not expected error tag", ErrorTag.RESOURCE_DENIED_TRANSPORT, ex.getErrors().get(0).getErrorTag()); } @@ -294,7 +294,7 @@ public class ParserIdentifierTest { public void makeQNameFromIdentifierInvalidIdentifierNegativeTest() { RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class, () -> ParserIdentifier.makeQNameFromIdentifier(TEST_MODULE_REVISION + "/" + TEST_MODULE_NAME)); - assertEquals("Not expected error type", RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); + assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); assertEquals("Not expected error tag", RestconfError.ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag()); assertEquals("Not expected error status code", 400, ex.getErrors().get(0).getErrorTag().getStatusCode()); @@ -309,7 +309,7 @@ public class ParserIdentifierTest { public void makeQNameFromIdentifierTooShortIdentifierNegativeTest() { RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class, () -> ParserIdentifier.makeQNameFromIdentifier(TEST_MODULE_NAME)); - assertEquals("Not expected error type", RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); + assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); assertEquals("Not expected error tag", RestconfError.ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag()); assertEquals("Not expected error status code", 400, ex.getErrors().get(0).getErrorTag().getStatusCode()); @@ -343,7 +343,7 @@ public class ParserIdentifierTest { RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class, () -> ParserIdentifier.makeQNameFromIdentifier( MOUNT_POINT_IDENT + "/" + TEST_MODULE_REVISION + "/" + TEST_MODULE_NAME)); - assertEquals("Not expected error type", RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); + assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); assertEquals("Not expected error tag", RestconfError.ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag()); assertEquals("Not expected error status code", 400, ex.getErrors().get(0).getErrorTag().getStatusCode()); @@ -358,7 +358,7 @@ public class ParserIdentifierTest { public void makeQNameFromIdentifierMountPointTooShortIdentifierNegativeTest() { RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class, () -> ParserIdentifier.makeQNameFromIdentifier(MOUNT_POINT_IDENT + "/" + TEST_MODULE_NAME)); - assertEquals("Not expected error type", RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); + assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); assertEquals("Not expected error tag", RestconfError.ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag()); assertEquals("Not expected error status code", 400, ex.getErrors().get(0).getErrorTag().getStatusCode()); @@ -382,7 +382,7 @@ public class ParserIdentifierTest { public void makeQNameFromIdentifierEmptyIdentifierNegativeTest() { RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class, () -> ParserIdentifier.makeQNameFromIdentifier("")); - assertEquals("Not expected error type", RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); + assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); assertEquals("Not expected error tag", RestconfError.ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag()); assertEquals("Not expected error status code", 400, ex.getErrors().get(0).getErrorTag().getStatusCode()); @@ -398,7 +398,7 @@ public class ParserIdentifierTest { public void makeQNameFromIdentifierDoubleSlashNegativeTest() { RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class, () -> ParserIdentifier.makeQNameFromIdentifier(TEST_MODULE_NAME + "//" + TEST_MODULE_REVISION)); - assertEquals("Not expected error type", RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); + assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); assertEquals("Not expected error tag", RestconfError.ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag()); assertEquals("Not expected error status code", 400, ex.getErrors().get(0).getErrorTag().getStatusCode()); @@ -455,7 +455,7 @@ public class ParserIdentifierTest { RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class, () -> ParserIdentifier.toSchemaExportContextFromIdentifier( SCHEMA_CONTEXT, TEST_MODULE_REVISION + "/" + TEST_MODULE_NAME, null, sourceProvider)); - assertEquals("Not expected error type", RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); + assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); assertEquals("Not expected error tag", RestconfError.ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag()); assertEquals("Not expected error status code", 400, ex.getErrors().get(0).getErrorTag().getStatusCode()); @@ -510,7 +510,7 @@ public class ParserIdentifierTest { MOUNT_POINT_IDENT + "/" + TEST_MODULE_REVISION + "/" + TEST_MODULE_NAME, this.mountPointService, sourceProvider)); - assertEquals("Not expected error type", RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); + assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); assertEquals("Not expected error tag", RestconfError.ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag()); assertEquals("Not expected error status code", 400, ex.getErrors().get(0).getErrorTag().getStatusCode()); diff --git a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/RestconfValidationTest.java b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/RestconfValidationTest.java index cf1a8cc15e..efa7f15ad7 100644 --- a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/RestconfValidationTest.java +++ b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/RestconfValidationTest.java @@ -20,6 +20,7 @@ import java.util.List; import org.junit.Test; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.Revision; /** @@ -48,7 +49,7 @@ public class RestconfValidationTest { final RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class, () -> ParserIdentifier.validateAndGetRevision(Collections.emptyIterator())); - assertEquals(RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); + assertEquals(ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); assertEquals(RestconfError.ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag()); assertEquals(400, ex.getErrors().get(0).getErrorTag().getStatusCode()); } @@ -82,7 +83,7 @@ public class RestconfValidationTest { public void validateAndGetModulNameNotSuppliedTest() { final RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class, () -> ParserIdentifier.validateAndGetModulName(Collections.emptyIterator())); - assertEquals(RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); + assertEquals(ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); assertEquals(RestconfError.ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag()); assertEquals(400, ex.getErrors().get(0).getErrorTag().getStatusCode()); } @@ -97,7 +98,7 @@ public class RestconfValidationTest { final RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class, () -> ParserIdentifier.validateAndGetModulName(Iterators.singletonIterator( "01-not-parsable-as-name-on-firts-char"))); - assertEquals(RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); + assertEquals(ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); assertEquals(RestconfError.ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag()); assertEquals(400, ex.getErrors().get(0).getErrorTag().getStatusCode()); } @@ -112,7 +113,7 @@ public class RestconfValidationTest { final RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class, () -> ParserIdentifier.validateAndGetModulName(Iterators.singletonIterator( "not-parsable-as-name-after-first-char*"))); - assertEquals(RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); + assertEquals(ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); assertEquals(RestconfError.ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag()); assertEquals(400, ex.getErrors().get(0).getErrorTag().getStatusCode()); } @@ -125,7 +126,7 @@ public class RestconfValidationTest { public void validateAndGetModuleNameNotParsableXmlTest() { final RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class, () -> ParserIdentifier.validateAndGetModulName(Iterators.singletonIterator("xMl-module-name"))); - assertEquals(RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); + assertEquals(ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); assertEquals(RestconfError.ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag()); assertEquals(400, ex.getErrors().get(0).getErrorTag().getStatusCode()); } @@ -138,7 +139,7 @@ public class RestconfValidationTest { public void validateAndGetModuleNameEmptyTest() { final RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class, () -> ParserIdentifier.validateAndGetModulName(Iterators.singletonIterator(""))); - assertEquals(RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); + assertEquals(ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); assertEquals(RestconfError.ErrorTag.INVALID_VALUE, ex.getErrors().get(0).getErrorTag()); assertEquals(400, ex.getErrors().get(0).getErrorTag().getStatusCode()); } diff --git a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/YangInstanceIdentifierDeserializerTest.java b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/YangInstanceIdentifierDeserializerTest.java index c596cbb40e..31217280cd 100644 --- a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/YangInstanceIdentifierDeserializerTest.java +++ b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/YangInstanceIdentifierDeserializerTest.java @@ -25,6 +25,7 @@ import org.junit.Test; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.common.errors.RestconfError; import org.opendaylight.restconf.nb.rfc8040.TestRestconfUtils; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.Revision; import org.opendaylight.yangtools.yang.common.Uint8; @@ -397,7 +398,7 @@ public class YangInstanceIdentifierDeserializerTest { public void prepareQnameNotValidContainerNameNegativeTest() { RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class, () -> YangInstanceIdentifierDeserializer.create(SCHEMA_CONTEXT, "deserializer-test:contA/leafB")); - assertEquals("Not expected error type", RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); + assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); assertEquals("Not expected error tag", RestconfError.ErrorTag.DATA_MISSING, ex.getErrors().get(0).getErrorTag()); } @@ -412,7 +413,7 @@ public class YangInstanceIdentifierDeserializerTest { RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class, () -> YangInstanceIdentifierDeserializer.create(SCHEMA_CONTEXT, "deserializer-test:list-no-key/disabled=false")); - assertEquals("Not expected error type", RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); + assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); assertEquals("Not expected error tag", RestconfError.ErrorTag.DATA_MISSING, ex.getErrors().get(0).getErrorTag()); } @@ -476,7 +477,7 @@ public class YangInstanceIdentifierDeserializerTest { RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class, () -> YangInstanceIdentifierDeserializer.create(SCHEMA_CONTEXT, "deserializer-test:list-multiple-keys=%3Afoo/string-value")); - assertEquals("Not expected error type", RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); + assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); assertEquals("Not expected error tag", RestconfError.ErrorTag.MISSING_ATTRIBUTE, ex.getErrors().get(0).getErrorTag()); assertEquals("Not expected error status code", 400, ex.getErrors().get(0).getErrorTag().getStatusCode()); @@ -532,7 +533,7 @@ public class YangInstanceIdentifierDeserializerTest { public void leafListMissingKeyNegativeTest() { RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class, () -> YangInstanceIdentifierDeserializer.create(SCHEMA_CONTEXT, "deserializer-test:leaf-list-0=")); - assertEquals("Not expected error type", RestconfError.ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); + assertEquals("Not expected error type", ErrorType.PROTOCOL, ex.getErrors().get(0).getErrorType()); assertEquals("Not expected error tag", RestconfError.ErrorTag.MISSING_ATTRIBUTE, ex.getErrors().get(0).getErrorTag()); assertEquals("Not expected error status code", 400, ex.getErrors().get(0).getErrorTag().getStatusCode()); -- 2.36.6