Java Code Examples for org.junit.jupiter.api.condition.OS#WINDOWS
The following examples show how to use
org.junit.jupiter.api.condition.OS#WINDOWS .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BuilderTest.java From gocd with Apache License 2.0 | 6 votes |
@Test @DisabledOnOs(OS.WINDOWS) void shouldReportErrorWhenCancelCommandDoesNotExist() { StubBuilder stubBuilder = new StubBuilder(); CommandBuilder cancelBuilder = new CommandBuilder("echo2", "cancel task", new File("."), new RunIfConfigs(FAILED), stubBuilder, ""); CommandBuilder builder = new CommandBuilder("echo", "normal task", new File("."), new RunIfConfigs(FAILED), cancelBuilder, ""); builder.cancel(goPublisher, new EnvironmentVariableContext(), null, null, "utf-8"); assertThat(goPublisher.getMessage()).contains("Error happened while attempting to execute 'echo2 cancel task'"); }
Example 2
Source File: LocalDeployerPropertiesTests.java From spring-cloud-deployer-local with Apache License 2.0 | 6 votes |
@Test @EnabledOnOs(OS.WINDOWS) public void testOnWindows() { this.contextRunner .withInitializer(context -> { Map<String, Object> map = new HashMap<>(); map.put("spring.cloud.deployer.local.working-directories-root", "file:/C:/tmp"); context.getEnvironment().getPropertySources().addLast(new SystemEnvironmentPropertySource( StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, map)); }) .withUserConfiguration(Config1.class) .run((context) -> { LocalDeployerProperties properties = context.getBean(LocalDeployerProperties.class); assertThat(properties.getWorkingDirectoriesRoot()).isNotNull(); assertThat(properties.getWorkingDirectoriesRoot().toString()).isEqualTo("C:\\tmp"); }); }
Example 3
Source File: CommandLineTest.java From gocd with Apache License 2.0 | 6 votes |
@Test @DisabledOnOs(OS.WINDOWS) void shouldLogPasswordsOnEnvironemntAsStarsUnderLinux() { CommandLine line = CommandLine.createCommandLine("echo") .withArg("My Password is:") .withArg("secret") .withArg(new PasswordArgument("secret")) .withEncoding("utf-8"); EnvironmentVariableContext environmentVariableContext = new EnvironmentVariableContext(); environmentVariableContext.setProperty("ENV_PASSWORD", "secret", false); InMemoryStreamConsumer output = new InMemoryStreamConsumer(); InMemoryStreamConsumer forDisplay = InMemoryStreamConsumer.inMemoryConsumer(); ProcessWrapper processWrapper = line.execute(output, environmentVariableContext, null); processWrapper.waitForExit(); assertThat(forDisplay.getAllOutput(), not(containsString("secret"))); assertThat(output.getAllOutput(), containsString("secret")); }
Example 4
Source File: ResolverConfigTest.java From dnsjava with BSD 2-Clause "Simplified" License | 6 votes |
@Test @EnabledOnOs(OS.WINDOWS) void windowsServersContainedInJndi() throws InitializationException { JndiContextResolverConfigProvider jndi = new JndiContextResolverConfigProvider(); jndi.initialize(); WindowsResolverConfigProvider win = new WindowsResolverConfigProvider(); win.initialize(); // the servers returned via Windows API must be in the JNDI list, but not necessarily the other // way round. Unless there IPv6 servers which are not in the registry and Java <= 15 does not // find. for (InetSocketAddress winServer : win.servers()) { assertTrue( jndi.servers().contains(winServer), winServer + " not found in JNDI, " + win.servers() + "; " + jndi.servers()); } }
Example 5
Source File: SvnCommandTest.java From gocd with Apache License 2.0 | 5 votes |
@Test @DisabledOnOs(OS.WINDOWS) void shouldSupportUTF8CheckInMessageAndFilename() throws Exception { String message = "司徒空在此"; String filename = "司徒空在此.scn"; testRepo.checkInOneFile(filename, message); Modification modification = subversion.latestModification().get(0); assertThat(modification.getComment()).isEqualTo(message); assertThat(modification.getModifiedFiles().get(0).getFileName()).contains(filename); }
Example 6
Source File: BuildWorkTest.java From gocd with Apache License 2.0 | 5 votes |
@Test @EnabledOnOs(OS.WINDOWS) void nantTest() throws Exception { buildWork = (BuildWork) getWork(NANT, PIPELINE_NAME); buildWork.doWork(environmentVariableContext, new AgentWorkContext(agentIdentifier, buildRepository, artifactManipulator, new AgentRuntimeInfo(agentIdentifier, AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie"), packageRepositoryExtension, scmExtension, taskExtension, null, pluginRequestProcessorRegistry)); assertThat(artifactManipulator.consoleOut()).contains("Usage : NAnt [options] <target> <target> ..."); }
Example 7
Source File: CommandLineTest.java From gocd with Apache License 2.0 | 5 votes |
@Test @DisabledOnOs(OS.WINDOWS) void shouldNotRunLocalCommandsThatAreNotExecutable() throws IOException { createScript("echo", "echo 'this should not be here'"); CommandLine line = CommandLine.createCommandLine("echo") .withArg("Using the REAL echo") .withWorkingDir(subFolder) .withEncoding("utf-8"); InMemoryStreamConsumer out = new InMemoryStreamConsumer(); line.execute(out, new EnvironmentVariableContext(), null).waitForExit(); assertThat(out.getAllOutput(), containsString("Using the REAL echo")); }
Example 8
Source File: NantTaskBuilderTest.java From gocd with Apache License 2.0 | 5 votes |
@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")); }
Example 9
Source File: FileUtilTest.java From gocd with Apache License 2.0 | 5 votes |
@Test @DisabledOnOs(OS.WINDOWS) void shouldCreateFileURIForFile() { assertThat(FileUtil.toFileURI(new File("/var/lib/foo/"))).isEqualTo("file:///var/lib/foo"); assertThat(FileUtil.toFileURI(new File("/var/a dir with spaces/foo"))).isEqualTo("file:///var/a%20dir%20with%20spaces/foo"); assertThat(FileUtil.toFileURI(new File("/var/司徒空在此/foo"))).isEqualTo("file:///var/%E5%8F%B8%E5%BE%92%E7%A9%BA%E5%9C%A8%E6%AD%A4/foo"); }
Example 10
Source File: CommandLineTest.java From gocd with Apache License 2.0 | 5 votes |
@Test @DisabledOnOs(OS.WINDOWS) void shouldBeAbleToRunCommandsInSubdirectoriesWithNoWorkingDir() throws IOException { File shellScript = createScript("hello-world.sh", "echo 'Hello World!'"); assertThat(shellScript.setExecutable(true), is(true)); CommandLine line = CommandLine.createCommandLine("subFolder/hello-world.sh").withWorkingDir(temporaryFolder.getRoot()).withEncoding("utf-8"); InMemoryStreamConsumer out = new InMemoryStreamConsumer(); line.execute(out, new EnvironmentVariableContext(), null).waitForExit(); assertThat(out.getAllOutput(), containsString("Hello World!")); }
Example 11
Source File: ScriptRunnerTest.java From gocd with Apache License 2.0 | 5 votes |
@Test @EnabledOnOs(OS.WINDOWS) void shouldReplaceSecretsOnTheOutputUnderWindows() throws CheckedCommandLineException { CommandLine command = CommandLine.createCommandLine("cmd") .withArg("/c") .withArg("echo") .withArg("My password is ") .withArg(new PasswordArgument("secret")) .withEncoding("utf-8"); InMemoryConsumer output = new InMemoryConsumer(); command.runScript(new ExecScript("FOO"), output, new EnvironmentVariableContext(), null); assertThat(output.toString()).doesNotContain("secret"); }
Example 12
Source File: ExecTaskBuilderTest.java From gocd with Apache License 2.0 | 5 votes |
@Test @DisabledOnOs(OS.WINDOWS) void shouldNormalizeWorkingDirectory() { ExecTask execTask = new ExecTask("ant", "", "folder\\child"); CommandBuilder builder = (CommandBuilder) execTaskBuilder.createBuilder(builderFactory, execTask, pipelineStub("label", "."), resolver); assertThat(builder.getWorkingDir().getPath()).isEqualTo("./folder/child"); }
Example 13
Source File: StartStopTest.java From 2018-highload-kv with Apache License 2.0 | 5 votes |
@Test @DisabledOnOs(OS.WINDOWS) void create() { assertTimeoutPreemptively(TIMEOUT, () -> { assertThrows(PoolException.class, this::status); }); }
Example 14
Source File: HgMaterialTest.java From gocd with Apache License 2.0 | 5 votes |
@Test @DisabledOnOs(OS.WINDOWS) void shouldNotRefreshWorkingFolderWhenFileProtocolIsUsedOnLinux() throws Exception { final UrlArgument repoUrl = hgTestRepo.url(); new HgCommand(null, workingFolder, "default", repoUrl.originalArgument(), null).clone(inMemoryConsumer(), repoUrl); File testFile = createNewFileInWorkingFolder(); hgMaterial = MaterialsMother.hgMaterial("file://" + hgTestRepo.projectRepositoryUrl()); updateMaterial(hgMaterial, new StringRevision("0")); String workingUrl = new HgCommand(null, workingFolder, "default", repoUrl.originalArgument(), null).workingRepositoryUrl().outputAsString(); assertThat(workingUrl).isEqualTo(hgTestRepo.projectRepositoryUrl()); assertThat(testFile.exists()).isTrue(); }
Example 15
Source File: CommandRepositoryDirectoryWalkerTest.java From gocd with Apache License 2.0 | 5 votes |
@Test @DisabledOnOs(OS.WINDOWS) void shouldUpdateServerHealthServiceIfTheCommandRepositoryDirectoryIsActuallyAFile() throws IOException { walker.getAllCommandSnippets(xmlFile.getPath()); verify(serverHealthService).update(serverHealthWarningMessageWhichContains("Failed to access command repository located in Go Server Directory at " + xmlFile.getPath() + ". The directory does not exist or Go does not have sufficient permissions to access it.")); }
Example 16
Source File: PidTests.java From embedded-cassandra with Apache License 2.0 | 5 votes |
@Test @EnabledOnJre(JRE.JAVA_8) @EnabledOnOs(OS.WINDOWS) void constructProcessIdWindowsJava8() throws IOException { Process process = new ProcessBuilder("echo", "Hello world").start(); assertThat(Pid.get(process)).isEqualTo(-1); }
Example 17
Source File: ScriptRunnerTest.java From gocd with Apache License 2.0 | 5 votes |
@Test @DisabledOnOs(OS.WINDOWS) void shouldMaskOutOccuranceOfSecureEnvironmentVariablesValuesInTheScriptOutputOnLinux() throws CheckedCommandLineException { EnvironmentVariableContext environmentVariableContext = new EnvironmentVariableContext(); environmentVariableContext.setProperty("secret", "the_secret_password", true); CommandLine command = CommandLine.createCommandLine("echo").withArg("the_secret_password").withEncoding("utf-8"); InMemoryConsumer output = new InMemoryConsumer(); ExecScript script = new ExecScript("ERROR_STRING"); command.runScript(script, output, environmentVariableContext, null); assertThat(script.getExitCode()).isEqualTo(0); assertThat(output.contains("the_secret_password")).as(output.toString()).isFalse(); }
Example 18
Source File: CommandLineTest.java From gocd with Apache License 2.0 | 5 votes |
@Test @DisabledOnOs(OS.WINDOWS) void shouldNotLogPasswordsFromStream() { try (LogFixture logFixture = logFixtureFor(CommandLine.class, Level.DEBUG)) { CommandLine line = CommandLine.createCommandLine("/bin/echo").withArg("=>").withArg(new PasswordArgument("secret")).withEncoding("utf-8"); line.runOrBomb(null); assertThat(logFixture.getLog(), not(containsString("secret"))); assertThat(logFixture.getLog(), containsString("=> ******")); } }
Example 19
Source File: CommandLineTest.java From gocd with Apache License 2.0 | 5 votes |
@Test @DisabledOnOs(OS.WINDOWS) void shouldBeAbleToRunCommandsFromRelativeDirectories() throws IOException { File shellScript = temporaryFolder.newFile("hello-world.sh"); FileUtils.writeStringToFile(shellScript, "echo ${PWD}", UTF_8); assertThat(shellScript.setExecutable(true), is(true)); CommandLine line = CommandLine.createCommandLine("../hello-world.sh").withWorkingDir(subFolder).withEncoding("utf-8"); InMemoryStreamConsumer out = new InMemoryStreamConsumer(); line.execute(out, new EnvironmentVariableContext(), null).waitForExit(); assertThat(out.getAllOutput().trim(), endsWith("subFolder")); }
Example 20
Source File: ResolverConfigTest.java From dnsjava with BSD 2-Clause "Simplified" License | 4 votes |
@Test @DisabledOnOs(OS.WINDOWS) void windowsDisabledOnUnix() { WindowsResolverConfigProvider rc = new WindowsResolverConfigProvider(); assertFalse(rc.isEnabled()); }