Author: veithen
Date: Sat Aug  8 09:54:06 2009
New Revision: 802331

URL: http://svn.apache.org/viewvc?rev=802331&view=rev
Log:
Reduced the number of unclosed StAX parsers created by the unit tests.

Modified:
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/xpath/AXIOMXPathTestBase.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/StAXDialectTest.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/AttachmentsTest.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/ImageSampleTest.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/MessagesTest.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/NamespaceTest.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMCachingTest.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDTDTest.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDiscardTest.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMElementCloneTest.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMTest.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/SpacesTest.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/builder/StAXOMBuilderTest.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/MessagesTest.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/OMDOMTestCase.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/ElementSerializerTest.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/NoNamespaceSerializerTest.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/OMFaultSerializerTest.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/OMSerializerTest.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPEnvelopeBuildTest.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFactoryTest.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPRoleTest.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11SerializerTest.java

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/xpath/AXIOMXPathTestBase.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/xpath/AXIOMXPathTestBase.java?rev=802331&r1=802330&r2=802331&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/xpath/AXIOMXPathTestBase.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/om/xpath/AXIOMXPathTestBase.java
 Sat Aug  8 09:54:06 2009
@@ -21,11 +21,15 @@
 
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
 
 import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
+import org.apache.axiom.om.OMDocument;
 import org.apache.axiom.om.OMMetaFactory;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 import org.apache.axiom.om.util.StAXUtils;
@@ -80,12 +84,21 @@
     }
     
     final OMMetaFactory omMetaFactory;
+    final List documents = new ArrayList();
     
     public AXIOMXPathTestBase(String name, OMMetaFactory omMetaFactory) {
         super(name);
         this.omMetaFactory = omMetaFactory;
     }
 
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        for (Iterator it = documents.iterator(); it.hasNext(); ) {
+            ((OMDocument)it.next()).close(false);
+        }
+        documents.clear();
+    }
+
     protected Object getDocument(String url) throws Exception {
         // This method is actually never used in XPathTestBase; it only uses 
Navigator#getDocument
         return null;
@@ -101,7 +114,10 @@
                     URL url = new URL(TESTS_ROOT + uri);
                     XMLStreamReader reader = new RootWhitespaceFilter(
                             StAXUtils.createXMLStreamReader(url.openStream()));
-                    return new StAXOMBuilder(omMetaFactory.getOMFactory(), 
reader).getDocument();
+                    OMDocument document = new 
StAXOMBuilder(omMetaFactory.getOMFactory(),
+                            reader).getDocument();
+                    documents.add(document);
+                    return document;
                 } catch (Exception ex) {
                     throw new FunctionCallException(ex);
                 }

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/StAXDialectTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/StAXDialectTest.java?rev=802331&r1=802330&r2=802331&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/StAXDialectTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/StAXDialectTest.java
 Sat Aug  8 09:54:06 2009
@@ -65,6 +65,7 @@
         } catch (IllegalStateException ex) {
             // Expected
         }
+        reader.close();
     }
 
     public void testGetVersion() throws Exception {
@@ -78,6 +79,7 @@
         } catch (IllegalStateException ex) {
             // Expected
         }
+        reader.close();
     }
 
     public void testIsStandalone() throws Exception {
@@ -91,6 +93,7 @@
         } catch (IllegalStateException ex) {
             // Expected
         }
+        reader.close();
     }
 
     public void testStandaloneSet() throws Exception {
@@ -104,6 +107,7 @@
         } catch (IllegalStateException ex) {
             // Expected
         }
+        reader.close();
     }
 
     public void testGetCharacterEncodingScheme() throws Exception {
@@ -117,5 +121,6 @@
         } catch (IllegalStateException ex) {
             // Expected
         }
+        reader.close();
     }
 }

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/AttachmentsTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/AttachmentsTest.java?rev=802331&r1=802330&r2=802331&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/AttachmentsTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/AttachmentsTest.java
 Sat Aug  8 09:54:06 2009
@@ -188,6 +188,7 @@
                                       attachments);
         OMElement om = builder.getDocumentElement();
         om.serialize(writer);
+        om.close(false);
         String outNormal = baos.toString();
         
         assertTrue(outNormal.indexOf("base64") == -1);
@@ -203,6 +204,7 @@
                                       attachments);
         om = builder.getDocumentElement();
         om.serialize(writer);
+        om.close(false);
         String outBase64 = baos.toString();
         
         
@@ -225,6 +227,7 @@
                                       attachments2);
         om = builder.getDocumentElement();
         om.serialize(writer);
+        om.close(false);
         String outBase64ToNormal = baos.toString();
         
         assertTrue(outBase64ToNormal.indexOf("base64") == -1);
@@ -240,6 +243,7 @@
                                       attachments2);
         om = builder.getDocumentElement();
         om.serialize(writer);
+        om.close(false);
         String outBase64ToBase64 = baos.toString();
         
         // Do a quick check to see if the data is base64 and is

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/ImageSampleTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/ImageSampleTest.java?rev=802331&r1=802330&r2=802331&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/ImageSampleTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/ImageSampleTest.java
 Sat Aug  8 09:54:06 2009
@@ -133,6 +133,8 @@
         actualDH = (DataHandler) blob.getDataHandler();
         BufferedImage bufferedImage = 
ImageIO.read(actualDH.getDataSource().getInputStream());
         this.saveImage("image/jpeg", bufferedImage, new 
FileOutputStream(imageOutFileName));
+        
+        root.close(false);
     }
 
     /**

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/MessagesTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/MessagesTest.java?rev=802331&r1=802330&r2=802331&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/MessagesTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/MessagesTest.java
 Sat Aug  8 09:54:06 2009
@@ -35,6 +35,7 @@
                         getTestResource(TestConstants.WHITESPACE_MESSAGE))
                         .getDocumentElement();
         OMTestUtils.walkThrough(soapEnvelope);
+        soapEnvelope.close(false);
     }
 
     public void testMinimalMessage() throws OMException, Exception {
@@ -43,6 +44,7 @@
                         getTestResource(TestConstants.MINIMAL_MESSAGE))
                         .getDocumentElement();
         OMTestUtils.walkThrough(soapEnvelope);
+        soapEnvelope.close(false);
     }
 
     public void testReallyBigMessage() throws OMException, Exception {
@@ -51,6 +53,7 @@
                         getTestResource(TestConstants.REALLY_BIG_MESSAGE))
                         .getDocumentElement();
         OMTestUtils.walkThrough(soapEnvelope);
+        soapEnvelope.close(false);
     }
 
     public void testEmptyBodiedMessage() throws OMException, Exception {
@@ -59,6 +62,7 @@
                         getTestResource(TestConstants.EMPTY_BODY_MESSAGE))
                         .getDocumentElement();
         OMTestUtils.walkThrough(soapEnvelope);
+        soapEnvelope.close(false);
     }
 
 

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/NamespaceTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/NamespaceTest.java?rev=802331&r1=802330&r2=802331&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/NamespaceTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/NamespaceTest.java
 Sat Aug  8 09:54:06 2009
@@ -194,6 +194,7 @@
                     .getDocumentElement();
             String actualXML = documentElement.toString();
             assertXMLEqual(xml, actualXML);
+            documentElement.close(false);
         } catch (Exception e) {
             e.printStackTrace();
             fail();
@@ -342,6 +343,8 @@
         String output = stringWriter.toString();
 
         content = output;
+        
+        element.close(false);
 
         // reread and rebuild XML content
         reader = new StringReader(output);
@@ -357,6 +360,8 @@
             count++;
         }
         assertEquals(3, count);
+        
+        element.close(false);
     }
 
     public void testAxis2_3155() {

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMCachingTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMCachingTest.java?rev=802331&r1=802330&r2=802331&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMCachingTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMCachingTest.java
 Sat Aug  8 09:54:06 2009
@@ -60,6 +60,7 @@
             assertTrue(true);
         }
 
+        documentElement.close(false);
     }
 
     /** This will first serialize the OMElement with caching and again will 
try to serialize. */
@@ -79,6 +80,7 @@
             fail("Parser should not failt as the element was serialized with 
caching");
         }
 
+        documentElement.close(false);
     }
 
     private XMLStreamReader getXMLStreamReader() throws XMLStreamException, 
FileNotFoundException {

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDTDTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDTDTest.java?rev=802331&r1=802330&r2=802331&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDTDTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDTDTest.java
 Sat Aug  8 09:54:06 2009
@@ -42,6 +42,10 @@
         }
     }
 
+    protected void tearDown() throws Exception {
+        document.close(false);
+    }
+
     public void testDTDSerialization() {
         try {
 
@@ -96,5 +100,6 @@
            }
         }
         assertTrue(docType != null);
+        root.close(false);
     }
 }

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDiscardTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDiscardTest.java?rev=802331&r1=802330&r2=802331&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDiscardTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDiscardTest.java
 Sat Aug  8 09:54:06 2009
@@ -50,6 +50,7 @@
         } catch (Exception e) {
             fail("discarding an element should work!");
         }
+        documentElement.close(false);
     }
 
     private XMLStreamReader getXMLStreamReader() throws XMLStreamException, 
FileNotFoundException {

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMElementCloneTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMElementCloneTest.java?rev=802331&r1=802330&r2=802331&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMElementCloneTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMElementCloneTest.java
 Sat Aug  8 09:54:06 2009
@@ -59,6 +59,7 @@
         assertNotSame(body.getParent(), secondClonedBodyElement.getParent());
         assertNotSame(firstClonedBodyElement.getParent(), 
secondClonedBodyElement.getParent());
 
+        soapEnvelope.close(false);
     }
 
     public void testElementCloningUsingOMElementMethod() throws Exception {
@@ -84,6 +85,7 @@
         assertNotSame(body.getParent(), secondClonedBodyElement.getParent());
         assertNotSame(firstClonedBodyElement.getParent(), 
secondClonedBodyElement.getParent());
 
+        soapEnvelope.close(false);
     }
 
     public Document newDocument(String xml)

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMTest.java?rev=802331&r1=802330&r2=802331&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMTest.java
 Sat Aug  8 09:54:06 2009
@@ -42,6 +42,10 @@
         envelope = (SOAPEnvelope) builder.getDocumentElement();
     }
 
+    protected void tearDown() throws Exception {
+        envelope.close(false);
+    }
+
     /** Sometime the hasNext() in the childeren iterator is true yet the 
next() is null */
     public void testNullInChilderen() {
         isNullChildrenThere(envelope);

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/SpacesTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/SpacesTest.java?rev=802331&r1=802330&r2=802331&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/SpacesTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/SpacesTest.java
 Sat Aug  8 09:54:06 2009
@@ -70,6 +70,7 @@
             Document dom2 = newDocument(resultXML);
             Diff diff = compareXML(dom1, dom2);
             assertXMLEqual(diff, true);
+            rootElement.close(false);
         } catch (XMLStreamException e) {
             fail(e.getMessage());
             throw new Exception(e);

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/builder/StAXOMBuilderTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/builder/StAXOMBuilderTest.java?rev=802331&r1=802330&r2=802331&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/builder/StAXOMBuilderTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/builder/StAXOMBuilderTest.java
 Sat Aug  8 09:54:06 2009
@@ -46,6 +46,10 @@
                                 getTestResource("non_soap.xml")));
     }
 
+    protected void tearDown() throws Exception {
+        stAXOMBuilder.close();
+    }
+
     public void testGetRootElement() throws Exception {
         rootElement = stAXOMBuilder.getDocumentElement();
         assertTrue("Root element can not be null", rootElement != null);

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/MessagesTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/MessagesTest.java?rev=802331&r1=802330&r2=802331&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/MessagesTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/MessagesTest.java
 Sat Aug  8 09:54:06 2009
@@ -33,6 +33,7 @@
                         getTestResource(TestConstants.WHITESPACE_MESSAGE))
                         .getDocumentElement();
         OMTestUtils.walkThrough(soapEnvelope);
+        soapEnvelope.close(false);
     }
 
     public void testMinimalMessage() throws OMException, Exception {
@@ -41,6 +42,7 @@
                         getTestResource(TestConstants.MINIMAL_MESSAGE))
                         .getDocumentElement();
         OMTestUtils.walkThrough(soapEnvelope);
+        soapEnvelope.close(false);
     }
 
     public void testReallyBigMessage() throws OMException, Exception {
@@ -49,6 +51,7 @@
                         getTestResource(TestConstants.REALLY_BIG_MESSAGE))
                         .getDocumentElement();
         OMTestUtils.walkThrough(soapEnvelope);
+        soapEnvelope.close(false);
     }
 
     public void testEmptyBodiedMessage() throws OMException, Exception {
@@ -57,6 +60,7 @@
                         getTestResource(TestConstants.EMPTY_BODY_MESSAGE))
                         .getDocumentElement();
         OMTestUtils.walkThrough(soapEnvelope);
+        soapEnvelope.close(false);
     }
 
 

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/OMDOMTestCase.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/OMDOMTestCase.java?rev=802331&r1=802330&r2=802331&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/OMDOMTestCase.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/OMDOMTestCase.java
 Sat Aug  8 09:54:06 2009
@@ -49,6 +49,11 @@
         soapEnvelope = (SOAPEnvelope) getOMBuilder("").getDocumentElement();
     }
 
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        soapEnvelope.close(false);
+    }
+
     protected StAXSOAPModelBuilder getOMBuilder(String fileName) throws 
Exception {
         if ("".equals(fileName) || fileName == null) {
             fileName = IN_FILE_NAME;

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/ElementSerializerTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/ElementSerializerTest.java?rev=802331&r1=802330&r2=802331&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/ElementSerializerTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/ElementSerializerTest.java
 Sat Aug  8 09:54:06 2009
@@ -127,6 +127,7 @@
     }
 
     protected void tearDown() throws Exception {
+        reader.close();
         tempFile.delete();
     }
 }

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/NoNamespaceSerializerTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/NoNamespaceSerializerTest.java?rev=802331&r1=802330&r2=802331&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/NoNamespaceSerializerTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/NoNamespaceSerializerTest.java
 Sat Aug  8 09:54:06 2009
@@ -90,6 +90,12 @@
                         OMAbstractFactory.getSOAP11Factory(), readerTwo);
     }
 
+    protected void tearDown() throws Exception {
+        readerOne.close();
+        readerTwo.close();
+        writer.close();
+    }
+
     public void testSerilizationWithDefaultNamespaces() throws Exception {
         SOAPEnvelope env = (SOAPEnvelope) builderTwo.getDocumentElement();
         env.serialize(writer);

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/OMFaultSerializerTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/OMFaultSerializerTest.java?rev=802331&r1=802330&r2=802331&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/OMFaultSerializerTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/OMFaultSerializerTest.java
 Sat Aug  8 09:54:06 2009
@@ -40,6 +40,11 @@
 
     }
 
+    protected void tearDown() throws Exception {
+        reader1.close();
+        reader2.close();
+    }
+
     /**
      * Test SOAPFault that does not disable the default namespace (i.e. does 
not use xmlns="")
      * 

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/OMSerializerTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/OMSerializerTest.java?rev=802331&r1=802330&r2=802331&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/OMSerializerTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/OMSerializerTest.java
 Sat Aug  8 09:54:06 2009
@@ -152,6 +152,7 @@
     }
 
     protected void tearDown() throws Exception {
+        reader.close();
         tempFile.delete();
     }
 }

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java?rev=802331&r1=802330&r2=802331&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java
 Sat Aug  8 09:54:06 2009
@@ -59,6 +59,7 @@
     }
 
     protected void tearDown() throws Exception {
+        envelope.close(false);
         tempFile.delete();
     }
 }

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPEnvelopeBuildTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPEnvelopeBuildTest.java?rev=802331&r1=802330&r2=802331&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPEnvelopeBuildTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPEnvelopeBuildTest.java
 Sat Aug  8 09:54:06 2009
@@ -73,6 +73,8 @@
                se.serialize(sw);
 
                checkBodyExists(sw.toString());
+               
+               se.close(false);
        }
 
        public void testBodyPreservedSerializeAndConsume() throws Exception{
@@ -85,6 +87,8 @@
                se.serializeAndConsume(sw);
 
                checkBodyExists(sw.toString());
+        
+        se.close(false);
        }
 
     public void testBodyPreservedSerializeAndConsumeAsXML() throws Exception{
@@ -98,6 +102,8 @@
                se.serializeAndConsume(sw);
 
                checkBodyExists(sw.toString());
+        
+        se.close(false);
        }
 
     public void testBodyPreservedSerializeAndConsumeDoesntTouchHeaders() 
throws Exception{
@@ -109,6 +115,8 @@
                se.serializeAndConsume(sw);
 
                checkBodyExists(sw.toString());
+        
+        se.close(false);
        }
 
        public void testBodyPreservedSerializeAndConsumeTouchesBody() throws 
Exception{
@@ -123,6 +131,8 @@
                se.serializeAndConsume(sw);
 
                checkBodyExists(sw.toString());
+        
+        se.close(false);
        }
 
        private void checkBodyExists(String str) throws Exception{
@@ -137,6 +147,8 @@
                if(!children.hasNext()){
                        fail("No children of the Body element");
                }
+        
+        se.close(false);
        }
         
         public void testTrace() throws Exception{
@@ -149,7 +161,8 @@
                 long length = CommonUtils.logDebug(se, log);
                 assertTrue(length > 100);
                 assertTrue(log.outputText.indexOf("x:Content") > 0);
-                           
+                
+                se.close(false);
         }
         
         class MyDebugLogger implements Log {

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFactoryTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFactoryTest.java?rev=802331&r1=802330&r2=802331&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFactoryTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFactoryTest.java
 Sat Aug  8 09:54:06 2009
@@ -37,11 +37,13 @@
                         
createXMLStreamReader(getTestResource(SOAP11_FILE_NAME)), null)
                         .getDocumentElement();
         assertNotNull(soapEnvelope);
+        soapEnvelope.close(false);
 
         soapEnvelope = (SOAPEnvelope) new StAXSOAPModelBuilder(StAXUtils.
                 createXMLStreamReader(getTestResource(SOAP12_FILE_NAME)), null)
                 .getDocumentElement();
         assertNotNull(soapEnvelope);
+        soapEnvelope.close(false);
     }
 
 }

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPRoleTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPRoleTest.java?rev=802331&r1=802330&r2=802331&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPRoleTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPRoleTest.java
 Sat Aug  8 09:54:06 2009
@@ -104,6 +104,8 @@
         }
 
         assertEquals("Didn't get right number of headers (no custom role)", 3, 
numHeaders);
+        
+        env.close(false);
     }
 
     public void testSOAP12Roles() throws Exception {
@@ -152,5 +154,7 @@
         }
 
         assertEquals("Didn't get right number of headers (no custom role)", 1, 
numHeaders);
+        
+        env.close(false);
     }
 }

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11SerializerTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11SerializerTest.java?rev=802331&r1=802330&r2=802331&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11SerializerTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11SerializerTest.java
 Sat Aug  8 09:54:06 2009
@@ -36,12 +36,14 @@
     }
 
     protected void setUp() throws Exception {
-        super.setUp();
         soapEnvelope =
                 (SOAPEnvelope) getOMBuilder("soap/soap11/soap11fault.xml")
                         .getDocumentElement();
     }
 
+    protected void tearDown() throws Exception {
+    }
+
     /**
      * This will check whether we can call the serialize method two times, if 
the first calls makes
      * the object model.


Reply via email to