tmf: Add getDocumentFromFile() to XmlUtils
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.analysis.xml.core.tests / common / org / eclipse / tracecompass / tmf / analysis / xml / core / tests / common / TmfXmlTestFiles.java
index 810f6def56dfcb657ced98eaec273542a5227057..384b5c27896904bace7b5cd452543326e321e4d2 100644 (file)
@@ -17,12 +17,11 @@ import static org.junit.Assert.fail;
 import java.io.File;
 import java.io.IOException;
 
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
+import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.module.XmlUtils;
 import org.eclipse.tracecompass.tmf.analysis.xml.core.tests.Activator;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
@@ -41,8 +40,12 @@ public enum TmfXmlTestFiles {
     ATTRIBUTE_FILE("test_xml_files/test_valid/test_attributes.xml"),
     /** A valid file for conditions tests */
     CONDITION_FILE("test_xml_files/test_valid/test_conditions.xml"),
+    /** A valid file for doubles tests */
+    DOUBLES_FILE("test_xml_files/test_valid/test_doubles.xml"),
     /** A valid file for pattern tests */
-    VALID_PATTERN_FILE("test_xml_files/test_valid/test_valid_pattern.xml");
+    VALID_PATTERN_FILE("test_xml_files/test_valid/test_valid_pattern.xml"),
+    /** A valid pattern file to test the pattern segment **/
+    VALID_PATTERN_SEGMENT("test_xml_files/test_valid/test_pattern_segment.xml");
 
     private final String fPath;
 
@@ -81,10 +84,7 @@ public enum TmfXmlTestFiles {
         /* Initialize the state provider module */
         Document doc = null;
         try {
-            DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
-            DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
-            doc = dBuilder.parse(getFile());
-            doc.getDocumentElement().normalize();
+            doc = XmlUtils.getDocumentFromFile(getFile());
         } catch (ParserConfigurationException e) {
             fail("Xml document parse exception");
         } catch (SAXException e) {
This page took 0.024799 seconds and 5 git commands to generate.