Decouple config and netconf subsystems.
[controller.git] / opendaylight / config / config-util / src / test / java / org / opendaylight / controller / config / util / xml / XmlUtilTest.java
similarity index 79%
rename from opendaylight/netconf/netconf-util/src/test/java/org/opendaylight/controller/netconf/util/xml/XmlUtilTest.java
rename to opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/xml/XmlUtilTest.java
index 79aa565df9bcf7a0392938be0184384393275c43..5ccee8679a2d052f4e510734371d1602cc0a3ac2 100644 (file)
@@ -6,15 +6,14 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.controller.netconf.util.xml;
+package org.opendaylight.controller.config.util.xml;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import com.google.common.base.Optional;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpression;
+import java.io.ByteArrayInputStream;
 import org.custommonkey.xmlunit.Diff;
 import org.custommonkey.xmlunit.XMLUnit;
 import org.junit.Test;
@@ -53,7 +52,7 @@ public class XmlUtilTest {
     public void testLoadSchema() throws Exception {
         XmlUtil.loadSchema();
         try {
-            XmlUtil.loadSchema(getClass().getResourceAsStream("/netconfMessages/commit.xml"));
+            XmlUtil.loadSchema(new ByteArrayInputStream(xml.getBytes()));
             fail("Input stream does not contain xsd");
         } catch (final IllegalStateException e) {
             assertTrue(e.getCause() instanceof SAXParseException);
@@ -73,14 +72,4 @@ public class XmlUtilTest {
                 "  </hello>]]>]]>");
     }
 
-    @Test
-    public void testXPath() throws Exception {
-        final XPathExpression correctXPath = XMLNetconfUtil.compileXPath("/top/innerText");
-        try {
-            XMLNetconfUtil.compileXPath("!@(*&$!");
-            fail("Incorrect xpath should fail");
-        } catch (IllegalStateException e) {}
-        final Object value = XmlUtil.evaluateXPath(correctXPath, XmlUtil.readXmlToDocument("<top><innerText>value</innerText></top>"), XPathConstants.NODE);
-        assertEquals("value", ((Element) value).getTextContent());
-    }
 }
\ No newline at end of file