[core] embedded framework test survives teardown When deleting files during teardown, if a temporary file can't be deleted then the test should not fail for that reason. Log that the file could not be delete and carry on.
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/fbb6a6f2 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/fbb6a6f2 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/fbb6a6f2 Branch: refs/heads/master Commit: fbb6a6f2e678dcaac66a7ad15de701f856823965 Parents: 9f89562 Author: Paul Campbell <pcampb...@kemitix.net> Authored: Mon Nov 5 14:05:18 2018 +0000 Committer: Paul Campbell <pcampb...@kemitix.net> Committed: Tue Nov 6 15:15:53 2018 +0000 ---------------------------------------------------------------------- .../org/apache/brooklyn/util/core/osgi/OsgiTestBase.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/fbb6a6f2/core/src/test/java/org/apache/brooklyn/util/core/osgi/OsgiTestBase.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/util/core/osgi/OsgiTestBase.java b/core/src/test/java/org/apache/brooklyn/util/core/osgi/OsgiTestBase.java index 4bc1e58..31b8065 100644 --- a/core/src/test/java/org/apache/brooklyn/util/core/osgi/OsgiTestBase.java +++ b/core/src/test/java/org/apache/brooklyn/util/core/osgi/OsgiTestBase.java @@ -28,6 +28,8 @@ import org.apache.commons.io.FileUtils; import org.osgi.framework.Bundle; import org.osgi.framework.BundleException; import org.osgi.framework.launch.Framework; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; @@ -37,6 +39,8 @@ import org.testng.annotations.BeforeMethod; */ public class OsgiTestBase { + private static final Logger log = LoggerFactory.getLogger(OsgiTestBase.class); + public static final String BROOKLYN_OSGI_TEST_A_0_1_0_PATH = OsgiTestResources.BROOKLYN_OSGI_TEST_A_0_1_0_PATH; public static final String BROOKLYN_OSGI_TEST_A_0_1_0_URL = "classpath:"+BROOKLYN_OSGI_TEST_A_0_1_0_PATH; @@ -75,7 +79,11 @@ public class OsgiTestBase { Osgis.ungetFramework(framework); framework = null; if (storageTempDir != null) { - FileUtils.deleteDirectory(storageTempDir); + try { + FileUtils.deleteDirectory(storageTempDir); + } catch (IOException e) { + log.warn(e.getMessage()); + } storageTempDir = null; } }