Author: veithen Date: Sun Dec 14 09:30:13 2008 New Revision: 726501 URL: http://svn.apache.org/viewvc?rev=726501&view=rev Log: WSCOMMONS-412: Use DOOMDocumentBuilderFactory in unit tests.
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/DocumentImplTest.java webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ElementImplTest.java Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/DocumentImplTest.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/DocumentImplTest.java?rev=726501&r1=726500&r2=726501&view=diff ============================================================================== --- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/DocumentImplTest.java (original) +++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/DocumentImplTest.java Sun Dec 14 09:30:13 2008 @@ -21,15 +21,13 @@ import junit.framework.TestCase; import org.apache.axiom.om.impl.dom.factory.OMDOMFactory; -import org.apache.axiom.om.impl.dom.jaxp.DocumentBuilderFactoryImpl; +import org.apache.axiom.om.impl.dom.jaxp.DOOMDocumentBuilderFactory; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.Text; -import javax.xml.parsers.DocumentBuilderFactory; - public class DocumentImplTest extends TestCase { public DocumentImplTest() { @@ -91,8 +89,7 @@ public void testDocumentSiblings() { try { - DocumentBuilderFactoryImpl.setDOOMRequired(true); - Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); + Document doc = new DOOMDocumentBuilderFactory().newDocumentBuilder().newDocument(); Element elem = doc.createElement("test"); doc.appendChild(elem); @@ -102,7 +99,6 @@ assertNull("Document's previous sibling has to be null", node2); Node node3 = doc.getParentNode(); assertNull("Document's parent has to be null", node3); - DocumentBuilderFactoryImpl.setDOOMRequired(false); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ElementImplTest.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ElementImplTest.java?rev=726501&r1=726500&r2=726501&view=diff ============================================================================== --- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ElementImplTest.java (original) +++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ElementImplTest.java Sun Dec 14 09:30:13 2008 @@ -23,7 +23,7 @@ import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMText; import org.apache.axiom.om.impl.dom.factory.OMDOMFactory; -import org.apache.axiom.om.impl.dom.jaxp.DocumentBuilderFactoryImpl; +import org.apache.axiom.om.impl.dom.jaxp.DOOMDocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; @@ -113,9 +113,7 @@ String childTextValue = "text value of the child text node"; //Apending am Element node - DocumentBuilderFactoryImpl.setDOOMRequired(true); - Document doc = - DocumentBuilderFactoryImpl.newInstance().newDocumentBuilder().newDocument(); + Document doc = new DOOMDocumentBuilderFactory().newDocumentBuilder().newDocument(); Element elem = doc.createElement(elementName); Element childElem = doc.createElement(childElemName); @@ -136,8 +134,6 @@ } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); - } finally { - DocumentBuilderFactoryImpl.setDOOMRequired(false); } } @@ -146,10 +142,7 @@ try { String childElementLN = "Child"; - DocumentBuilderFactoryImpl.setDOOMRequired(true); - - Document doc = - DocumentBuilderFactoryImpl.newInstance().newDocumentBuilder().newDocument(); + Document doc = new DOOMDocumentBuilderFactory().newDocumentBuilder().newDocument(); Element docElem = doc.getDocumentElement(); assertNull("The document element shoudl be null", docElem); @@ -169,8 +162,6 @@ } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); - } finally { - DocumentBuilderFactoryImpl.setDOOMRequired(false); } } @@ -179,9 +170,7 @@ String childElementLN = "test:Child"; String childElementNS = "http://ws.apache.org/ns/axis2/dom"; - DocumentBuilderFactoryImpl.setDOOMRequired(true); - Document doc = - DocumentBuilderFactoryImpl.newInstance().newDocumentBuilder().newDocument(); + Document doc = new DOOMDocumentBuilderFactory().newDocumentBuilder().newDocument(); Element docElem = doc.getDocumentElement(); assertNull("The document element shoudl be null", docElem); @@ -202,8 +191,6 @@ } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); - } finally { - DocumentBuilderFactoryImpl.setDOOMRequired(false); } } }