Author: antelder
Date: Wed Sep  7 15:20:44 2011
New Revision: 1166222

URL: http://svn.apache.org/viewvc?rev=1166222&view=rev
Log:
Fix testcase so that if the initial file delete does work (which happens on 
non-windows systems) then the testcase doesn't fail

Modified:
    
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/ClassLoaderReleaseTestCase.java

Modified: 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/ClassLoaderReleaseTestCase.java
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/ClassLoaderReleaseTestCase.java?rev=1166222&r1=1166221&r2=1166222&view=diff
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/ClassLoaderReleaseTestCase.java
 (original)
+++ 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/ClassLoaderReleaseTestCase.java
 Wed Sep  7 15:20:44 2011
@@ -39,10 +39,13 @@ public class ClassLoaderReleaseTestCase 
     public void testInstallDeployable() throws IOException, 
ActivationException{
         File f = copyFile("src/test/resources/sample-helloworld.jar");
         Node node = TuscanyRuntime.runComposite(null, 
f.toURI().toURL().toString());
-        Assert.assertFalse(f.delete());
-        Map<String, List<String>> scuris = node.getStartedCompositeURIs();
-        
node.stopCompositeAndUninstallUnused(scuris.keySet().iterator().next(), 
scuris.get(scuris.keySet().iterator().next()).get(0));
-        Assert.assertTrue(f.delete());
+        // this delete should fail on Windows as the jar is locked, but the 
doesn't seem to happen in 'nix
+        boolean b = f.delete();
+        if (!b) {
+            Map<String, List<String>> scuris = node.getStartedCompositeURIs();
+            
node.stopCompositeAndUninstallUnused(scuris.keySet().iterator().next(), 
scuris.get(scuris.keySet().iterator().next()).get(0));
+            Assert.assertTrue(f.delete());
+        }
     }
     
     private File copyFile(String fileName) throws IOException {


Reply via email to