From 9a82a3194c89a9d1ed90b72587d2ad1b964c5390 Mon Sep 17 00:00:00 2001 From: antelder Date: Wed, 7 Sep 2011 15:20:44 +0000 Subject: Fix testcase so that if the initial file delete does work (which happens on non-windows systems) then the testcase doesn't fail git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1166222 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/runtime/ClassLoaderReleaseTestCase.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'sca-java-2.x/trunk/modules/domain-node/src/test') diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/ClassLoaderReleaseTestCase.java b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/ClassLoaderReleaseTestCase.java index 50f212ebf3..4488458f5a 100644 --- a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/ClassLoaderReleaseTestCase.java +++ b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/ClassLoaderReleaseTestCase.java @@ -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> 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> 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 { -- cgit v1.2.3