Author: veithen Date: Sun Mar 8 13:55:20 2009 New Revision: 751424 URL: http://svn.apache.org/viewvc?rev=751424&view=rev Log: No need to use a temporary file to dump a SOAPEnvelope. A ByteArrayOutputStream is enough.
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMNavigatorTest.java Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMNavigatorTest.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMNavigatorTest.java?rev=751424&r1=751423&r2=751424&view=diff ============================================================================== --- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMNavigatorTest.java (original) +++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMNavigatorTest.java Sun Mar 8 13:55:20 2009 @@ -27,14 +27,12 @@ import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; -import java.io.File; -import java.io.FileOutputStream; + +import java.io.ByteArrayOutputStream; public class OMNavigatorTest extends AbstractTestCase { private SOAPEnvelope envelope = null; private OMXMLParserWrapper builder; - private File tempFile; - private XMLStreamWriter output; public OMNavigatorTest(String testName) { super(testName); @@ -45,15 +43,14 @@ createXMLStreamReader(getTestResource(TestConstants.SOAP_SOAPMESSAGE1)); builder = new StAXSOAPModelBuilder(xmlStreamReader, null); envelope = (SOAPEnvelope) builder.getDocumentElement(); - tempFile = File.createTempFile("temp", "xml"); - output = - XMLOutputFactory.newInstance().createXMLStreamWriter( - new FileOutputStream(tempFile), OMConstants.DEFAULT_CHAR_SET_ENCODING); } public void testnavigatorFullyBuilt() throws Exception { assertNotNull(envelope); //dump the out put to a temporary file + XMLStreamWriter output = + XMLOutputFactory.newInstance().createXMLStreamWriter( + new ByteArrayOutputStream(), OMConstants.DEFAULT_CHAR_SET_ENCODING); envelope.serialize(output); //now the OM is fully created -> test the navigation @@ -95,9 +92,4 @@ } } - - protected void tearDown() throws Exception { - tempFile.delete(); - } - }