Java Code Examples for org.junit.jupiter.api.condition.OS#LINUX

The following examples show how to use org.junit.jupiter.api.condition.OS#LINUX . 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: LocalDeployerPropertiesTests.java    From spring-cloud-deployer-local with Apache License 2.0 6 votes vote down vote up
@Test
@EnabledOnOs(OS.LINUX)
public void defaultNoPropertiesSet() {
	this.contextRunner
		.withUserConfiguration(Config1.class)
		.run((context) -> {
			LocalDeployerProperties properties = context.getBean(LocalDeployerProperties.class);
			assertThat(properties.getDebugPort()).isNull();
			assertThat(properties.getDebugSuspend()).isNull();
			assertThat(properties.isDeleteFilesOnExit()).isTrue();
			assertThat(properties.getEnvVarsToInherit()).containsExactly("TMP", "LANG", "LANGUAGE", "LC_.*",
						"PATH", "SPRING_APPLICATION_JSON");
			assertThat(properties.isInheritLogging()).isFalse();
			assertThat(properties.getJavaCmd()).contains("java");
			assertThat(properties.getJavaOpts()).isNull();
			assertThat(properties.getMaximumConcurrentTasks()).isEqualTo(20);
			assertThat(properties.getPortRange()).isNotNull();
			assertThat(properties.getPortRange().getLow()).isEqualTo(20000);
			assertThat(properties.getPortRange().getHigh()).isEqualTo(61000);
			assertThat(properties.getShutdownTimeout()).isEqualTo(30);
			assertThat(properties.isUseSpringApplicationJson()).isTrue();
			assertThat(properties.getDocker().getNetwork()).isEqualTo("bridge");
		});
}
 
Example 2
Source File: LocalDeployerPropertiesTests.java    From spring-cloud-deployer-local with Apache License 2.0 6 votes vote down vote up
@Test
@EnabledOnOs(OS.LINUX)
public void testOnLinux() {
	this.contextRunner
		.withInitializer(context -> {
			Map<String, Object> map = new HashMap<>();
			map.put("spring.cloud.deployer.local.working-directories-root", "/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("/tmp");
		});
}
 
Example 3
Source File: ConfigurationTest.java    From benchmarks with Apache License 2.0 6 votes vote down vote up
@Test
@EnabledOnOs({ OS.LINUX, OS.MAC })
void throwsIllegalArgumentExceptionIfOutputDirectoryIsNotWriteable(final @TempDir Path tempDir) throws IOException
{
    final Path outputDirectory = Files.createDirectory(tempDir.resolve("read-only"),
        PosixFilePermissions.asFileAttribute(EnumSet.of(PosixFilePermission.OWNER_READ)));

    final Builder builder = new Builder()
        .numberOfMessages(4)
        .messageTransceiverClass(InMemoryMessageTransceiver.class)
        .outputDirectory(outputDirectory);

    final IllegalArgumentException ex = assertThrows(IllegalArgumentException.class, builder::build);

    assertEquals("output directory is not writeable: " + outputDirectory, ex.getMessage());
}
 
Example 4
Source File: ConfigurationTest.java    From benchmarks with Apache License 2.0 6 votes vote down vote up
@Test
@EnabledOnOs({ OS.LINUX, OS.MAC })
void throwsIllegalArgumentExceptionIfOutputDirectoryCannotBeCreated(final @TempDir Path tempDir) throws IOException
{
    final Path rootDirectory = Files.createDirectory(tempDir.resolve("read-only"),
        PosixFilePermissions.asFileAttribute(EnumSet.of(PosixFilePermission.OWNER_READ)));
    final Path outputDirectory = rootDirectory.resolve("actual-dir");

    final Builder builder = new Builder()
        .numberOfMessages(4)
        .messageTransceiverClass(InMemoryMessageTransceiver.class)
        .outputDirectory(outputDirectory);

    final IllegalArgumentException ex = assertThrows(IllegalArgumentException.class, builder::build);

    assertEquals("failed to create output directory: " + outputDirectory, ex.getMessage());
}
 
Example 5
Source File: ShellTaskTest.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Test
@Deployment
@EnabledOnOs(OS.LINUX)
public void testEchoShellLinux() {
    if (osType == OsType.LINUX) {

        ProcessInstance pi = runtimeService.startProcessInstanceByKey("echoShellLinux");

        String st = (String) runtimeService.getVariable(pi.getId(), "resultVar");
        assertThat(st).isNotNull();
        assertThat(st).startsWith("EchoTest");
    }
}
 
Example 6
Source File: ZipUtilTest.java    From gocd with Apache License 2.0 5 votes vote down vote up
@Test
@EnabledOnOs(OS.LINUX)
void shouldZipFileWhoseNameHasSpecialCharactersOnLinux() throws IOException {
    File specialFile = new File(srcDir, "$`#?@!()?-_{}^'~.+=[];,a.txt");
    FileUtils.writeStringToFile(specialFile, "specialFile", UTF_8);

    zipFile = zipUtil.zip(srcDir, temporaryFolder.newFile(), Deflater.NO_COMPRESSION);
    zipUtil.unzip(zipFile, destDir);
    File baseDir = new File(destDir, srcDir.getName());

    File actualSpecialFile = new File(baseDir, specialFile.getName());
    assertThat(actualSpecialFile.isFile()).isTrue();
    assertThat(fileContent(actualSpecialFile)).isEqualTo(fileContent(specialFile));
}
 
Example 7
Source File: ScriptRunnerTest.java    From gocd with Apache License 2.0 5 votes vote down vote up
@Test
@EnabledOnOs(OS.LINUX)
void shouldReplaceSecretsOnTheOutputUnderLinux() throws CheckedCommandLineException {
    CommandLine command = CommandLine.createCommandLine("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 8
Source File: DisableTest.java    From demo-junit-5 with Creative Commons Zero v1.0 Universal 4 votes vote down vote up
@Test
@EnabledOnOs(OS.LINUX)
@DisabledOnJre(JRE.JAVA_10)
void conflictingConditions_executed() {
	assertTrue(true);
}