Author: ffang
Date: Fri Aug 3 01:00:14 2007
New Revision: 562378
URL: http://svn.apache.org/viewvc?view=rev&rev=562378
Log:
add test to ensure when CachedOutputStream is closed, the tmp file is removed
as well
Modified:
incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/transport/CachedOutputStreamTest.java
Modified:
incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/transport/CachedOutputStreamTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/transport/CachedOutputStreamTest.java?view=diff&rev=562378&r1=562377&r2=562378
==============================================================================
---
incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/transport/CachedOutputStreamTest.java
(original)
+++
incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/transport/CachedOutputStreamTest.java
Fri Aug 3 01:00:14 2007
@@ -38,6 +38,19 @@
assertEquals("The test stream content isn't same ", test , result);
}
+ @Test
+ public void testDeleteTmpFile() throws IOException {
+ CachedOutputStream cos = new CachedOutputStream();
+ //ensure output data size larger then 64k which will generate tmp file
+ String result = initTestData(65);
+ cos.write(result.getBytes());
+ //assert tmp file is generated
+ assertTrue(cos.getTempFile().exists());
+ cos.close();
+ //assert tmp file is deleted after close the CachedOutputStream
+ assertFalse(cos.getTempFile().exists());
+ }
+
String initTestData(int packetSize) {
String temp = "[EMAIL PROTECTED]&*()_+?><[]/0123456789";
String result = new String();