From d18ac7a0881b82282f7db542f1f228f540875326 Mon Sep 17 00:00:00 2001 From: wght Date: Fri, 15 Jun 2007 21:06:27 +0000 Subject: [PATCH] Test to validate the wellformedness of PackOut.xml --- .../src/test/functional/XMLValidateTest.java | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 extend/src/test/functional/XMLValidateTest.java diff --git a/extend/src/test/functional/XMLValidateTest.java b/extend/src/test/functional/XMLValidateTest.java new file mode 100644 index 0000000000..100612e09a --- /dev/null +++ b/extend/src/test/functional/XMLValidateTest.java @@ -0,0 +1,47 @@ +//XMLValidateTest.java +package test.functional; + +import java.io.FileInputStream; +import java.util.Properties; +import java.util.logging.Level; + +import junit.framework.TestCase; + +import org.compiere.model.MLocation; +import org.compiere.util.CLogMgt; +import org.compiere.util.DB; +import org.compiere.util.Ini; +import org.adempiere.pipo.*; +import org.compiere.util.*; + +import javax.xml.parsers.*; +import org.w3c.dom.*; +import java.io.File; +import org.xml.sax.SAXException; +import java.io.IOException; + + +public class XMLValidateTest extends TestCase { + + public void testValidateXML() { + try { + DocumentBuilder parser = + DocumentBuilderFactory.newInstance().newDocumentBuilder(); + Document document = parser.parse(new File("PackOut.xml")); + } catch (ParserConfigurationException e) { + // exception handling + System.out.println("ParserConfigurationException: " + e.getMessage()); + assertTrue("testValidateXML", false); + } catch (SAXException e) { + // exception handling - document not valid! + System.out.println("SAXException: " + e.getMessage()); + assertTrue("testValidateXML", false); + } catch (IOException e) { + // exception handling + System.out.println("IOException: " + e.getMessage()); + assertTrue("testValidateXML", false); + } + + assertTrue("testValidateXML", true); + } +}