From 9f89562caf16b58154c31366d89f54b8bebced21 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 5 Nov 2018 10:50:46 +0000 Subject: [PATCH 1/7] [rt-felix] 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. --- .../brooklyn/rt/felix/EmbeddedFelixFrameworkTest.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/utils/rt-felix/src/test/java/org/apache/brooklyn/rt/felix/EmbeddedFelixFrameworkTest.java b/utils/rt-felix/src/test/java/org/apache/brooklyn/rt/felix/EmbeddedFelixFrameworkTest.java index 11dfe2777c..cde02b1a51 100644 --- a/utils/rt-felix/src/test/java/org/apache/brooklyn/rt/felix/EmbeddedFelixFrameworkTest.java +++ b/utils/rt-felix/src/test/java/org/apache/brooklyn/rt/felix/EmbeddedFelixFrameworkTest.java @@ -66,7 +66,11 @@ public static void tearDownOsgiFramework(Framework framework, File storageTempDi EmbeddedFelixFramework.stopFramework(framework); framework = null; if (storageTempDir != null) { - FileUtils.deleteDirectory(storageTempDir); + try { + FileUtils.deleteDirectory(storageTempDir); + } catch (IOException e) { + log.warn(e.getMessage()); + } storageTempDir = null; } } From fbb6a6f2e678dcaac66a7ad15de701f856823965 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 5 Nov 2018 14:05:18 +0000 Subject: [PATCH 2/7] [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. --- .../apache/brooklyn/util/core/osgi/OsgiTestBase.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 4bc1e583c3..31b8065661 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.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 @@ */ 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 static void tearDownOsgiFramework(Framework framework, File storageTempDi Osgis.ungetFramework(framework); framework = null; if (storageTempDir != null) { - FileUtils.deleteDirectory(storageTempDir); + try { + FileUtils.deleteDirectory(storageTempDir); + } catch (IOException e) { + log.warn(e.getMessage()); + } storageTempDir = null; } } From c2af743b6c7daa392b1301946e9b5632b4a61fc1 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 5 Nov 2018 22:03:15 +0000 Subject: [PATCH 3/7] [utils] Extract FileUtil.deleteDirectory() from duplicated code --- .../brooklyn/util/core/osgi/OsgiTestBase.java | 21 ++++++------------- .../org/apache/brooklyn/util/io/FileUtil.java | 17 +++++++++++++++ .../rt/felix/EmbeddedFelixFrameworkTest.java | 18 ++++------------ 3 files changed, 27 insertions(+), 29 deletions(-) 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 31b8065661..4bcadbde0b 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 @@ -16,15 +16,14 @@ package org.apache.brooklyn.util.core.osgi; import java.io.File; -import java.io.IOException; import org.apache.brooklyn.api.mgmt.ManagementContext; import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal; import org.apache.brooklyn.test.support.TestResourceUnavailableException; import org.apache.brooklyn.util.exceptions.Exceptions; +import org.apache.brooklyn.util.io.FileUtil; import org.apache.brooklyn.util.os.Os; import org.apache.brooklyn.util.osgi.OsgiTestResources; -import org.apache.commons.io.FileUtils; import org.osgi.framework.Bundle; import org.osgi.framework.BundleException; import org.osgi.framework.launch.Framework; @@ -44,7 +43,7 @@ public class OsgiTestBase { 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; - protected Bundle install(String url) throws BundleException { + protected Bundle install(String url) { try { return Osgis.install(framework, url); } catch (Exception e) { @@ -52,7 +51,7 @@ protected Bundle install(String url) throws BundleException { } } - protected Bundle installFromClasspath(String resourceName) throws BundleException { + protected Bundle installFromClasspath(String resourceName) { TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), resourceName); try { return Osgis.install(framework, String.format("classpath:%s", resourceName)); @@ -71,21 +70,13 @@ public void setUp() throws Exception { } @AfterMethod(alwaysRun = true) - public void tearDown() throws BundleException, IOException, InterruptedException { + public void tearDown() { tearDownOsgiFramework(framework, storageTempDir); } - public static void tearDownOsgiFramework(Framework framework, File storageTempDir) throws BundleException, InterruptedException, IOException { + public static void tearDownOsgiFramework(Framework framework, File storageTempDir) { Osgis.ungetFramework(framework); - framework = null; - if (storageTempDir != null) { - try { - FileUtils.deleteDirectory(storageTempDir); - } catch (IOException e) { - log.warn(e.getMessage()); - } - storageTempDir = null; - } + FileUtil.deleteDirectory(storageTempDir); } public static void preinstallLibrariesLowLevelToPreventCatalogBomParsing(ManagementContext mgmt, String ...libraries) { diff --git a/utils/common/src/main/java/org/apache/brooklyn/util/io/FileUtil.java b/utils/common/src/main/java/org/apache/brooklyn/util/io/FileUtil.java index a4908f2498..176ad821a5 100644 --- a/utils/common/src/main/java/org/apache/brooklyn/util/io/FileUtil.java +++ b/utils/common/src/main/java/org/apache/brooklyn/util/io/FileUtil.java @@ -184,4 +184,21 @@ private static boolean createNewFile(File file) throws IOException { } return file.createNewFile(); } + + /** + * Recursively delete a directory. + * + *

Any IOException that might be raised is logged and not thrown.

+ * + * @param file The directory to be deleted + */ + public static void deleteDirectory(final File file) { + if (file != null) { + try { + FileUtils.deleteDirectory(file); + } catch (IOException e) { + LOG.warn(e.getMessage()); + } + } + } } diff --git a/utils/rt-felix/src/test/java/org/apache/brooklyn/rt/felix/EmbeddedFelixFrameworkTest.java b/utils/rt-felix/src/test/java/org/apache/brooklyn/rt/felix/EmbeddedFelixFrameworkTest.java index cde02b1a51..0c837cd8b4 100644 --- a/utils/rt-felix/src/test/java/org/apache/brooklyn/rt/felix/EmbeddedFelixFrameworkTest.java +++ b/utils/rt-felix/src/test/java/org/apache/brooklyn/rt/felix/EmbeddedFelixFrameworkTest.java @@ -16,7 +16,6 @@ package org.apache.brooklyn.rt.felix; import java.io.File; -import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.util.Enumeration; @@ -25,11 +24,10 @@ import org.apache.brooklyn.test.support.TestResourceUnavailableException; import org.apache.brooklyn.util.collections.MutableSet; +import org.apache.brooklyn.util.io.FileUtil; import org.apache.brooklyn.util.os.Os; import org.apache.brooklyn.util.osgi.OsgiTestResources; import org.apache.brooklyn.util.stream.Streams; -import org.apache.commons.io.FileUtils; -import org.osgi.framework.BundleException; import org.osgi.framework.launch.Framework; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,21 +56,13 @@ public void setUp() throws Exception { } @AfterMethod(alwaysRun = true) - public void tearDown() throws BundleException, IOException, InterruptedException { + public void tearDown() { tearDownOsgiFramework(framework, storageTempDir); } - public static void tearDownOsgiFramework(Framework framework, File storageTempDir) throws BundleException, InterruptedException, IOException { + private static void tearDownOsgiFramework(Framework framework, File storageTempDir) { EmbeddedFelixFramework.stopFramework(framework); - framework = null; - if (storageTempDir != null) { - try { - FileUtils.deleteDirectory(storageTempDir); - } catch (IOException e) { - log.warn(e.getMessage()); - } - storageTempDir = null; - } + FileUtil.deleteDirectory(storageTempDir); } @Test From 18f65e1ebffa6bfc55bc2f706098747296ec429c Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 5 Nov 2018 22:06:18 +0000 Subject: [PATCH 4/7] [core] Fix syntax for maven-compiler plugin --- core/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/pom.xml b/core/pom.xml index e7e7236201..28de44e9a6 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -261,9 +261,9 @@ groovy-eclipse-compiler - + **/*.groovy - + true false ${java.version} From c5a851d626cf5069fe06c9dceac174f238892dbb Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 6 Nov 2018 10:15:26 +0000 Subject: [PATCH 5/7] [test-support] Add @DisableOnWindows annotation for TestNG tests --- parent/pom.xml | 1 + .../brooklyn/test/DisableOnWindows.java | 40 +++++++++++++ .../test/DisableOnWindowsListener.java | 57 +++++++++++++++++++ .../services/org.testng.ITestNGListener | 1 + .../brooklyn/test/DisableOnWindowsTest.java | 41 +++++++++++++ 5 files changed, 140 insertions(+) create mode 100644 test-support/src/main/java/org/apache/brooklyn/test/DisableOnWindows.java create mode 100644 test-support/src/main/java/org/apache/brooklyn/test/DisableOnWindowsListener.java create mode 100644 test-support/src/main/resources/META-INF/services/org.testng.ITestNGListener create mode 100644 test-support/src/test/java/org/apache/brooklyn/test/DisableOnWindowsTest.java diff --git a/parent/pom.xml b/parent/pom.xml index d6feccfc23..971c76ebaa 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -1110,6 +1110,7 @@ **/src/main/license/** **/src/test/license/** **/MANIFEST.MF + **/META-INF/services/** **/test-output/** **/*.pem.pub **/*.pem diff --git a/test-support/src/main/java/org/apache/brooklyn/test/DisableOnWindows.java b/test-support/src/main/java/org/apache/brooklyn/test/DisableOnWindows.java new file mode 100644 index 0000000000..9fa2998cdd --- /dev/null +++ b/test-support/src/main/java/org/apache/brooklyn/test/DisableOnWindows.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.brooklyn.test; + +import java.lang.annotation.*; + +/** + * Used to indicate that a test should ne be executed on Windows. + * + *

You must add the following to the class where this annotation is being used: + * {@code @Listeners(DisableOnWindows)}

+ */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +@Documented +public @interface DisableOnWindows { + + /**3 + * Explain the reason for the test being disabled. + * + *

e.g. "Needs an ssh server listening on port 22 on localhost."

+ */ + String reason(); +} diff --git a/test-support/src/main/java/org/apache/brooklyn/test/DisableOnWindowsListener.java b/test-support/src/main/java/org/apache/brooklyn/test/DisableOnWindowsListener.java new file mode 100644 index 0000000000..743edde9bd --- /dev/null +++ b/test-support/src/main/java/org/apache/brooklyn/test/DisableOnWindowsListener.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.brooklyn.test; + +import org.apache.brooklyn.util.os.Os; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testng.IAnnotationTransformer; +import org.testng.annotations.ITestAnnotation; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; + +/** + * Scans all tests annotated with {@link DisableOnWindows} and, on Windows, sets {@code enabled=false} if the current + * environment is Windows.. + */ +public class DisableOnWindowsListener implements IAnnotationTransformer { + + private static final Logger LOG = LoggerFactory.getLogger(DisableOnWindowsListener.class); + + @Override + public void transform( + final ITestAnnotation annotation, + final Class testClass, + final Constructor testConstructor, + final Method testMethod + ) { + if (testMethod != null ) { + final DisableOnWindows disableOnWindows = testMethod.getAnnotation(DisableOnWindows.class); + if (disableOnWindows != null && Os.isMicrosoftWindows()) { + annotation.setEnabled(false); + LOG.info(String.format("Disabled: %s.%s - %s", + testMethod.getDeclaringClass().getName(), + testMethod.getName(), + disableOnWindows.reason())); + } + } + } + +} diff --git a/test-support/src/main/resources/META-INF/services/org.testng.ITestNGListener b/test-support/src/main/resources/META-INF/services/org.testng.ITestNGListener new file mode 100644 index 0000000000..584861a390 --- /dev/null +++ b/test-support/src/main/resources/META-INF/services/org.testng.ITestNGListener @@ -0,0 +1 @@ +org.apache.brooklyn.test.DisableOnWindowsListener \ No newline at end of file diff --git a/test-support/src/test/java/org/apache/brooklyn/test/DisableOnWindowsTest.java b/test-support/src/test/java/org/apache/brooklyn/test/DisableOnWindowsTest.java new file mode 100644 index 0000000000..9929f666ef --- /dev/null +++ b/test-support/src/test/java/org/apache/brooklyn/test/DisableOnWindowsTest.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.brooklyn.test; + +import org.apache.brooklyn.util.os.Os; +import org.testng.annotations.Test; + +import static org.apache.brooklyn.test.Asserts.assertTrue; +import static org.apache.brooklyn.test.Asserts.fail; + +public class DisableOnWindowsTest { + + @Test + public void alwaysRun() { + assertTrue(true); + } + + @Test + @DisableOnWindows(reason = "unit test") + public void isDisabledOnWindows() { + if (Os.isMicrosoftWindows()) { + fail("Test should have been disabled on windows"); + } + } +} From 2ba7ce671973fdf49ad099f3c744b2f38807860c Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 6 Nov 2018 10:23:50 +0000 Subject: [PATCH 6/7] [core] Disable BashCommandsIntegrationTest test on Windows --- .../core/ssh/BashCommandsIntegrationTest.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/core/src/test/java/org/apache/brooklyn/util/core/ssh/BashCommandsIntegrationTest.java b/core/src/test/java/org/apache/brooklyn/util/core/ssh/BashCommandsIntegrationTest.java index 3f99ee3ac2..311bce7d38 100644 --- a/core/src/test/java/org/apache/brooklyn/util/core/ssh/BashCommandsIntegrationTest.java +++ b/core/src/test/java/org/apache/brooklyn/util/core/ssh/BashCommandsIntegrationTest.java @@ -35,6 +35,7 @@ import org.apache.brooklyn.core.test.BrooklynMgmtUnitTestSupport; import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; +import org.apache.brooklyn.test.DisableOnWindows; import org.apache.brooklyn.util.core.ResourceUtils; import org.apache.brooklyn.util.core.task.BasicExecutionContext; import org.apache.brooklyn.util.core.task.ssh.SshTasks; @@ -133,6 +134,7 @@ public void tearDown() throws Exception { } @Test(groups="Integration") + @DisableOnWindows(reason = "Needs a bash shell available on localhost") public void testRemoveRequireTtyFromSudoersFile() throws Exception { String cmds = BashCommands.dontRequireTtyForSudo(); @@ -154,6 +156,7 @@ public void testRemoveRequireTtyFromSudoersFile() throws Exception { } @Test(groups="Integration") + @DisableOnWindows(reason = "Needs a whoami command available on localhost") public void testSudo() throws Exception { ByteArrayOutputStream outStream = new ByteArrayOutputStream(); ByteArrayOutputStream errStream = new ByteArrayOutputStream(); @@ -177,6 +180,7 @@ public void testDownloadUrl() throws Exception { } @Test(groups="Integration") + @DisableOnWindows(reason = "Needs a bash shell available on localhost") public void testDownloadFirstSuccessfulFile() throws Exception { List cmds = BashCommands.commandsToDownloadUrlsAs( ImmutableList.of(sourceNonExistantFileUrl, sourceFileUrl1, sourceFileUrl2), @@ -188,6 +192,7 @@ public void testDownloadFirstSuccessfulFile() throws Exception { } @Test(groups="Integration") + @DisableOnWindows(reason = "Needs an ssh server listening on port 22 on localhost") public void testDownloadToStdout() throws Exception { ProcessTaskWrapper t = SshTasks.newSshExecTaskFactory(loc, "cd "+destFile.getParentFile().getAbsolutePath(), @@ -199,6 +204,7 @@ public void testDownloadToStdout() throws Exception { } @Test(groups="Integration") + @DisableOnWindows(reason = "Needs an ssh server listening on port 22 on localhost") public void testAlternativesWhereFirstSucceeds() throws Exception { ProcessTaskWrapper t = SshTasks.newSshExecTaskFactory(loc) .add(BashCommands.alternatives(Arrays.asList("echo first", "exit 88"))) @@ -213,6 +219,7 @@ public void testAlternativesWhereFirstSucceeds() throws Exception { } @Test(groups="Integration") + @DisableOnWindows(reason = "Needs an ssh server listening on port 22 on localhost") public void testAlternatives() throws Exception { ProcessTaskWrapper t = SshTasks.newSshExecTaskFactory(loc) .add(BashCommands.alternatives(Arrays.asList("asdfj_no_such_command_1", "exit 88"))) @@ -224,6 +231,7 @@ public void testAlternatives() throws Exception { } @Test(groups="Integration") + @DisableOnWindows(reason = "Needs an ssh server listening on port 22 on localhost") public void testRequireTestHandlesFailure() throws Exception { ProcessTaskWrapper t = SshTasks.newSshExecTaskFactory(loc) .add(BashCommands.requireTest("-f "+sourceNonExistantFile.getPath(), @@ -236,6 +244,7 @@ public void testRequireTestHandlesFailure() throws Exception { } @Test(groups="Integration") + @DisableOnWindows(reason = "Needs an ssh server listening on port 22 on localhost") public void testRequireTestHandlesSuccess() throws Exception { ProcessTaskWrapper t = SshTasks.newSshExecTaskFactory(loc) .add(BashCommands.requireTest("-f "+sourceFile1.getPath(), @@ -247,6 +256,7 @@ public void testRequireTestHandlesSuccess() throws Exception { } @Test(groups="Integration") + @DisableOnWindows(reason = "Needs an ssh server listening on port 22 on localhost") public void testRequireFileHandlesFailure() throws Exception { ProcessTaskWrapper t = SshTasks.newSshExecTaskFactory(loc) .add(BashCommands.requireFile(sourceNonExistantFile.getPath())).newTask(); @@ -260,6 +270,7 @@ public void testRequireFileHandlesFailure() throws Exception { } @Test(groups="Integration") + @DisableOnWindows(reason = "Needs an ssh server listening on port 22 on localhost") public void testRequireFileHandlesSuccess() throws Exception { ProcessTaskWrapper t = SshTasks.newSshExecTaskFactory(loc) .add(BashCommands.requireFile(sourceFile1.getPath())).newTask(); @@ -270,6 +281,7 @@ public void testRequireFileHandlesSuccess() throws Exception { } @Test(groups="Integration") + @DisableOnWindows(reason = "Needs an ssh server listening on port 22 on localhost") public void testRequireFailureExitsImmediately() throws Exception { ProcessTaskWrapper t = SshTasks.newSshExecTaskFactory(loc) .add(BashCommands.requireTest("-f "+sourceNonExistantFile.getPath(), @@ -284,6 +296,7 @@ public void testRequireFailureExitsImmediately() throws Exception { } @Test(groups="Integration") + @DisableOnWindows(reason = "Needs a bash shell available on localhost") public void testPipeMultiline() throws Exception { String output = execRequiringZeroAndReturningStdout(loc, BashCommands.pipeTextTo("hello world\n"+"and goodbye\n", "wc")).get(); @@ -292,6 +305,7 @@ public void testPipeMultiline() throws Exception { } @Test(groups="Integration") + @DisableOnWindows(reason = "Needs a bash shell available on localhost") public void testWaitForFileContentsWhenAbortingOnFail() throws Exception { String fileContent = "mycontents"; String cmd = BashCommands.waitForFileContents(destFile.getAbsolutePath(), fileContent, Duration.ONE_SECOND, true); @@ -305,6 +319,7 @@ public void testWaitForFileContentsWhenAbortingOnFail() throws Exception { } @Test(groups="Integration") + @DisableOnWindows(reason = "Needs a bash shell available on localhost") public void testWaitForFileContentsWhenNotAbortingOnFail() throws Exception { String fileContent = "mycontents"; String cmd = BashCommands.waitForFileContents(destFile.getAbsolutePath(), fileContent, Duration.ONE_SECOND, false); @@ -318,6 +333,7 @@ public void testWaitForFileContentsWhenNotAbortingOnFail() throws Exception { } @Test(groups="Integration") + @DisableOnWindows(reason = "Needs a bash shell available on localhost") public void testWaitForFileContentsWhenContentsAppearAfterStart() throws Exception { String fileContent = "mycontents"; @@ -335,6 +351,7 @@ public void testWaitForFileContentsWhenContentsAppearAfterStart() throws Excepti } @Test(groups="Integration") + @DisableOnWindows(reason = "Needs a bash shell available on localhost") public void testWaitForFileExistsWhenAbortingOnFail() throws Exception { String cmd = BashCommands.waitForFileExists(destFile.getAbsolutePath(), Duration.ONE_SECOND, true); @@ -347,6 +364,7 @@ public void testWaitForFileExistsWhenAbortingOnFail() throws Exception { } @Test(groups="Integration") + @DisableOnWindows(reason = "Needs a bash shell available on localhost") public void testWaitForFileExistsWhenNotAbortingOnFail() throws Exception { String cmd = BashCommands.waitForFileExists(destFile.getAbsolutePath(), Duration.ONE_SECOND, false); @@ -359,6 +377,7 @@ public void testWaitForFileExistsWhenNotAbortingOnFail() throws Exception { } @Test(groups="Integration", dependsOnMethods="testSudo") + @DisableOnWindows(reason = "Needs a bash shell available on localhost") public void testWaitForPortFreeWhenAbortingOnTimeout() throws Exception { ServerSocket serverSocket = openServerSocket(); try { @@ -378,6 +397,7 @@ public void testWaitForPortFreeWhenAbortingOnTimeout() throws Exception { } @Test(groups="Integration", dependsOnMethods="testSudo") + @DisableOnWindows(reason = "Needs a bash shell available on localhost") public void testWaitForPortFreeWhenNotAbortingOnTimeout() throws Exception { ServerSocket serverSocket = openServerSocket(); try { @@ -397,6 +417,7 @@ public void testWaitForPortFreeWhenNotAbortingOnTimeout() throws Exception { } @Test(groups="Integration", dependsOnMethods="testSudo") + @DisableOnWindows(reason = "Needs a bash shell available on localhost") public void testWaitForPortFreeWhenFreedAfterStart() throws Exception { ServerSocket serverSocket = openServerSocket(); try { From 6dddc5d102bcecfeb15f5076fe8e2675c7db76c6 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 6 Nov 2018 15:31:58 +0000 Subject: [PATCH 7/7] [core] Remove unused Logger in OsgiTestBase --- .../java/org/apache/brooklyn/util/core/osgi/OsgiTestBase.java | 2 -- 1 file changed, 2 deletions(-) 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 4bcadbde0b..0569ffb15b 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 @@ -38,8 +38,6 @@ */ 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;