Search in sources :

Example 31 with DisabledOnOs

use of org.junit.jupiter.api.condition.DisabledOnOs in project gocd by gocd.

the class AgentBootstrapperFunctionalTest method shouldDownloadJarIfItDoesNotExist.

@Test
@DisabledOnOs(OS.WINDOWS)
public void shouldDownloadJarIfItDoesNotExist() throws Exception {
    File agentJar = new File("agent.jar");
    agentJar.delete();
    new AgentBootstrapper() {

        @Override
        void jvmExit(int returnValue) {
        }
    }.go(false, new AgentBootstrapperArgs().setServerUrl(new URL("http://" + "localhost" + ":" + server.getPort() + "/go")).setRootCertFile(null).setSslVerificationMode(AgentBootstrapperArgs.SslMode.NONE));
    assertTrue(agentJar.exists(), "No agent downloaded");
    agentJar.delete();
}
Also used : AgentBootstrapperArgs(com.thoughtworks.go.agent.common.AgentBootstrapperArgs) File(java.io.File) URL(java.net.URL) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) Test(org.junit.jupiter.api.Test)

Example 32 with DisabledOnOs

use of org.junit.jupiter.api.condition.DisabledOnOs in project gocd by gocd.

the class PackageLevelClassWithPublicInnerClass method shouldRegisterANestedClassImplementingGoPluginAsAnOSGiService.

@Test
@DisabledOnOs(OS.WINDOWS)
void shouldRegisterANestedClassImplementingGoPluginAsAnOSGiService() throws Exception {
    File bundleWithActivator = createBundleWithActivator(BUNDLE_DIR_WHICH_HAS_PROPER_ACTIVATOR, TestPluginOuterClass.class, TestPluginOuterClass.NestedClass.class, TestPluginOuterClass.InnerClass.class, TestPluginOuterClass.InnerClass.SecondLevelInnerClass.class, TestPluginOuterClass.InnerClass.SecondLevelInnerClass.TestPluginThirdLevelInnerClass.class, TestPluginOuterClass.InnerClass.SecondLevelSiblingInnerClassNoDefaultConstructor.class);
    BundleContext installedBundledContext = bundleContext(installBundleFoundInDirectory(bundleWithActivator));
    ServiceReference<?>[] references = installedBundledContext.getServiceReferences(GoPlugin.class.getName(), null);
    String[] services = toSortedServiceClassNames(installedBundledContext, references);
    assertThat(services.length).as(Arrays.toString(services)).isEqualTo(4);
    assertThat(services[0]).isEqualTo(TestPluginOuterClass.class.getName());
    assertThat(services[1]).isEqualTo(TestPluginOuterClass.InnerClass.class.getName());
    assertThat(services[2]).isEqualTo(TestPluginOuterClass.InnerClass.SecondLevelInnerClass.TestPluginThirdLevelInnerClass.class.getName());
    assertThat(services[3]).isEqualTo(TestPluginOuterClass.NestedClass.class.getName());
}
Also used : GoPlugin(com.thoughtworks.go.plugin.api.GoPlugin) File(java.io.File) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) Test(org.junit.jupiter.api.Test)

Example 33 with DisabledOnOs

use of org.junit.jupiter.api.condition.DisabledOnOs in project gocd by gocd.

the class NantTaskBuilderTest method shouldUseAbsoluteNantPathIfAbsoluteNantPathIsSpecifiedOnLinux.

@Test
@DisabledOnOs(OS.WINDOWS)
void shouldUseAbsoluteNantPathIfAbsoluteNantPathIsSpecifiedOnLinux() {
    NantTask nantTask = new NantTask();
    nantTask.setNantPath("/usr/bin");
    CommandBuilder builder = (CommandBuilder) nantTaskBuilder.createBuilder(builderFactory, nantTask, pipeline, resolver);
    assertThat(new File(builder.getCommand())).isEqualTo(new File("/usr/bin/nant"));
}
Also used : NantTask(com.thoughtworks.go.config.NantTask) CommandBuilder(com.thoughtworks.go.domain.builder.CommandBuilder) File(java.io.File) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) Test(org.junit.jupiter.api.Test)

Example 34 with DisabledOnOs

use of org.junit.jupiter.api.condition.DisabledOnOs in project gocd by gocd.

the class NantTaskBuilderTest method nantTaskShouldNormalizeWorkingDirectory.

@Test
@DisabledOnOs(OS.WINDOWS)
void nantTaskShouldNormalizeWorkingDirectory() {
    NantTask nantTask = new NantTask();
    nantTask.setWorkingDirectory("folder1\\folder2");
    CommandBuilder builder = (CommandBuilder) nantTaskBuilder.createBuilder(builderFactory, nantTask, ExecTaskBuilderTest.pipelineStub("label", "/var/cruise-agent/pipelines/cruise"), resolver);
    assertThat(builder.getWorkingDir()).isEqualTo(new File("/var/cruise-agent/pipelines/cruise/folder1/folder2"));
}
Also used : NantTask(com.thoughtworks.go.config.NantTask) CommandBuilder(com.thoughtworks.go.domain.builder.CommandBuilder) File(java.io.File) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) Test(org.junit.jupiter.api.Test)

Example 35 with DisabledOnOs

use of org.junit.jupiter.api.condition.DisabledOnOs in project gocd by gocd.

the class RakeTaskBuilderTest method rakeTaskShouldNormalizeWorkingDirectory.

@Test
@DisabledOnOs(OS.WINDOWS)
void rakeTaskShouldNormalizeWorkingDirectory() {
    RakeTask task = new RakeTask();
    task.setWorkingDirectory("folder1\\folder2");
    CommandBuilder commandBuilder = (CommandBuilder) rakeTaskBuilder.createBuilder(builderFactory, task, ExecTaskBuilderTest.pipelineStub("label", "/var/cruise-agent/pipelines/cruise"), resolver);
    assertThat(commandBuilder.getWorkingDir().getPath()).isEqualTo("/var/cruise-agent/pipelines/cruise/folder1/folder2");
}
Also used : RakeTask(com.thoughtworks.go.config.RakeTask) CommandBuilder(com.thoughtworks.go.domain.builder.CommandBuilder) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) Test(org.junit.jupiter.api.Test)

Aggregations

DisabledOnOs (org.junit.jupiter.api.condition.DisabledOnOs)85 Test (org.junit.jupiter.api.Test)78 Path (java.nio.file.Path)38 File (java.io.File)24 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)15 PathsBaseTest (org.assertj.core.internal.PathsBaseTest)12 AssertionsUtil.expectAssertionError (org.assertj.core.util.AssertionsUtil.expectAssertionError)11 PosixFilePermission (java.nio.file.attribute.PosixFilePermission)6 PageSwapperFactory (org.neo4j.io.pagecache.PageSwapperFactory)6 PageSwapperTest (org.neo4j.io.pagecache.PageSwapperTest)6 CommandBuilder (com.thoughtworks.go.domain.builder.CommandBuilder)5 DelegatingStoreChannel (org.neo4j.io.fs.DelegatingStoreChannel)5 StoreChannel (org.neo4j.io.fs.StoreChannel)5 DisabledForRoot (org.neo4j.test.extension.DisabledForRoot)5 Closeable (java.io.Closeable)4 URI (java.net.URI)4 FileUtils.writeByteArrayToFile (org.apache.commons.io.FileUtils.writeByteArrayToFile)4 ShouldBeFile.shouldBeFile (org.assertj.core.error.ShouldBeFile.shouldBeFile)4 FilesBaseTest (org.assertj.core.internal.FilesBaseTest)4 Files.newFile (org.assertj.core.util.Files.newFile)4