continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From batkin...@apache.org
Subject svn commit: r1377542 - /continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ReleaseTest.java
Date Sun, 26 Aug 2012 23:10:16 GMT
Author: batkinson
Date: Sun Aug 26 23:10:16 2012
New Revision: 1377542

URL: http://svn.apache.org/viewvc?rev=1377542&view=rev
Log:
Fixed test failure on windows due to locked files.

Modified:
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ReleaseTest.java

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ReleaseTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ReleaseTest.java?rev=1377542&r1=1377541&r2=1377542&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ReleaseTest.java
(original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ReleaseTest.java
Sun Aug 26 23:10:16 2012
@@ -19,6 +19,7 @@ package org.apache.continuum.web.test;
  * under the License.
  */
 
+import org.apache.commons.io.IOUtils;
 import org.apache.continuum.web.test.parent.AbstractBuildAgentsTest;
 import org.testng.Assert;
 import org.testng.annotations.AfterMethod;
@@ -398,17 +399,28 @@ public class ReleaseTest
         File file = new File( "target/conf/prepared-releases.xml" );
         Assert.assertTrue( file.exists(), "prepared-releases.xml was not created" );
 
-        FileInputStream fis = new FileInputStream( file );
-        BufferedReader reader = new BufferedReader( new InputStreamReader( fis ) );
+        FileInputStream fis = null;
+        BufferedReader reader = null;
 
-        String strLine;
-        StringBuilder str = new StringBuilder();
-        while ( ( strLine = reader.readLine() ) != null )
+        try
         {
-            str.append( strLine );
-        }
+            fis = new FileInputStream( file );
+            reader = new BufferedReader( new InputStreamReader( fis ) );
+
+            String strLine;
+            StringBuilder str = new StringBuilder();
+            while ( ( strLine = reader.readLine() ) != null )
+            {
+                str.append( strLine );
+            }
 
-        Assert.assertTrue( str.toString().contains( "<buildAgentUrl>" + buildAgentUrl
+ "</buildAgentUrl>" ),
-                           "prepared-releases.xml was not populated" );
+            Assert.assertTrue( str.toString().contains( "<buildAgentUrl>" + buildAgentUrl
+ "</buildAgentUrl>" ),
+                               "prepared-releases.xml was not populated" );
+        }
+        finally
+        {
+            IOUtils.closeQuietly( reader );
+            IOUtils.closeQuietly( fis );
+        }
     }
 }



Mime
View raw message