Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Decouple config and netconf subsystems.
[controller.git]
/
opendaylight
/
netconf
/
netconf-api
/
src
/
test
/
java
/
org
/
opendaylight
/
controller
/
netconf
/
api
/
NetconfDocumentedExceptionTest.java
diff --git
a/opendaylight/netconf/netconf-api/src/test/java/org/opendaylight/controller/netconf/api/NetconfDocumentedExceptionTest.java
b/opendaylight/netconf/netconf-api/src/test/java/org/opendaylight/controller/netconf/api/NetconfDocumentedExceptionTest.java
index cdf8b913ecd807deb9de6b1e39e7727716e523fc..3621f83312982d5570d29c37541a5f8a6b51349f 100644
(file)
--- a/
opendaylight/netconf/netconf-api/src/test/java/org/opendaylight/controller/netconf/api/NetconfDocumentedExceptionTest.java
+++ b/
opendaylight/netconf/netconf-api/src/test/java/org/opendaylight/controller/netconf/api/NetconfDocumentedExceptionTest.java
@@
-11,26
+11,21
@@
package org.opendaylight.controller.netconf.api;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import com.google.common.collect.ImmutableMap;
import java.util.Collections;
import java.util.Iterator;
import java.util.Collections;
import java.util.Iterator;
-
import javax.xml.namespace.NamespaceContext;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import javax.xml.namespace.NamespaceContext;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
-
import org.junit.Before;
import org.junit.Test;
import org.junit.Before;
import org.junit.Test;
-import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorSeverity;
-import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorTag;
-import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorType;
+import org.opendaylight.controller.config.util.xml.DocumentedException;
import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
-import com.google.common.collect.ImmutableMap;
-
/**
* Unit tests for NetconfDocumentedException.
/**
* Unit tests for NetconfDocumentedException.
@@
-66,10
+61,10
@@
public class NetconfDocumentedExceptionTest {
@Test
public void testToAndFromXMLDocument() throws XPathExpressionException {
String errorMessage = "mock error message";
@Test
public void testToAndFromXMLDocument() throws XPathExpressionException {
String errorMessage = "mock error message";
-
Netconf
DocumentedException ex = new NetconfDocumentedException( errorMessage, null,
- ErrorType.protocol,
- ErrorTag.data_exists,
- ErrorSeverity.warning,
+ DocumentedException ex = new NetconfDocumentedException( errorMessage, null,
+
DocumentedException.
ErrorType.protocol,
+
DocumentedException.
ErrorTag.data_exists,
+
DocumentedException.
ErrorSeverity.warning,
ImmutableMap.of( "foo", "bar" ) );
Document doc = ex.toXMLDocument();
ImmutableMap.of( "foo", "bar" ) );
Document doc = ex.toXMLDocument();
@@
-85,17
+80,17
@@
public class NetconfDocumentedExceptionTest {
Node errorTypeNode = getNode( "netconf:error-type", rpcErrorNode );
assertNotNull( "error-type not found", errorTypeNode );
Node errorTypeNode = getNode( "netconf:error-type", rpcErrorNode );
assertNotNull( "error-type not found", errorTypeNode );
- assertEquals( "error-type", ErrorType.protocol.getTagValue(),
+ assertEquals( "error-type",
DocumentedException.
ErrorType.protocol.getTagValue(),
errorTypeNode.getTextContent() );
Node errorTagNode = getNode( "netconf:error-tag", rpcErrorNode );
assertNotNull( "error-tag not found", errorTagNode );
errorTypeNode.getTextContent() );
Node errorTagNode = getNode( "netconf:error-tag", rpcErrorNode );
assertNotNull( "error-tag not found", errorTagNode );
- assertEquals( "error-tag", ErrorTag.data_exists.getTagValue(),
+ assertEquals( "error-tag",
DocumentedException.
ErrorTag.data_exists.getTagValue(),
errorTagNode.getTextContent() );
Node errorSeverityNode = getNode( "netconf:error-severity", rpcErrorNode );
assertNotNull( "error-severity not found", errorSeverityNode );
errorTagNode.getTextContent() );
Node errorSeverityNode = getNode( "netconf:error-severity", rpcErrorNode );
assertNotNull( "error-severity not found", errorSeverityNode );
- assertEquals( "error-severity", ErrorSeverity.warning.getTagValue(),
+ assertEquals( "error-severity",
DocumentedException.
ErrorSeverity.warning.getTagValue(),
errorSeverityNode.getTextContent() );
Node errorInfoNode = getNode( "netconf:error-info/netconf:foo", rpcErrorNode );
errorSeverityNode.getTextContent() );
Node errorInfoNode = getNode( "netconf:error-info/netconf:foo", rpcErrorNode );
@@
-108,12
+103,12
@@
public class NetconfDocumentedExceptionTest {
// Test fromXMLDocument
// Test fromXMLDocument
- ex =
Netconf
DocumentedException.fromXMLDocument( doc );
+ ex = DocumentedException.fromXMLDocument( doc );
assertNotNull( "NetconfDocumentedException is null", ex );
assertNotNull( "NetconfDocumentedException is null", ex );
- assertEquals( "getErrorSeverity", ErrorSeverity.warning, ex.getErrorSeverity() );
- assertEquals( "getErrorTag", ErrorTag.data_exists, ex.getErrorTag() );
- assertEquals( "getErrorType", ErrorType.protocol, ex.getErrorType() );
+ assertEquals( "getErrorSeverity",
DocumentedException.
ErrorSeverity.warning, ex.getErrorSeverity() );
+ assertEquals( "getErrorTag",
DocumentedException.
ErrorTag.data_exists, ex.getErrorTag() );
+ assertEquals( "getErrorType",
DocumentedException.
ErrorType.protocol, ex.getErrorType() );
assertEquals( "getLocalizedMessage", errorMessage, ex.getLocalizedMessage() );
assertEquals( "getErrorInfo", ImmutableMap.of( "foo", "bar" ), ex.getErrorInfo() );
}
assertEquals( "getLocalizedMessage", errorMessage, ex.getLocalizedMessage() );
assertEquals( "getErrorInfo", ImmutableMap.of( "foo", "bar" ), ex.getErrorInfo() );
}