Search in sources :

Example 61 with DisabledOnOs

use of org.junit.jupiter.api.condition.DisabledOnOs in project cucumber-jvm by cucumber.

the class ResourceScannerTest method scanForResourcesPathSymlink.

@Test
@DisabledOnOs(value = OS.WINDOWS, disabledReason = "Only works if repository is explicitly cloned activated symlinks and " + "developer mode in windows is activated")
void scanForResourcesPathSymlink() {
    File file = new File("src/test/resource-symlink/test/resource.txt");
    List<URI> resources = resourceScanner.scanForResourcesPath(file.toPath());
    assertThat(resources, contains(file.toURI()));
}
Also used : File(java.io.File) URI(java.net.URI) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) Test(org.junit.jupiter.api.Test)

Example 62 with DisabledOnOs

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

the class DumpCommandIT method shouldHandleDatabaseSymlink.

@Test
@DisabledOnOs(OS.WINDOWS)
void shouldHandleDatabaseSymlink() throws Exception {
    Path realDatabaseDir = testDirectory.directory("path-to-links/foo");
    Path dataDir = testDirectory.directory("some-other-path");
    Path databaseDir = dataDir.resolve("databases/foo");
    Path txLogsDir = dataDir.resolve(DEFAULT_TX_LOGS_ROOT_DIR_NAME + "/foo");
    Files.createDirectories(dataDir.resolve("databases"));
    Files.createSymbolicLink(databaseDir, realDatabaseDir);
    Files.write(configDir.resolve(Config.DEFAULT_CONFIG_FILE_NAME), singletonList(format("%s=%s", data_directory.name(), dataDir.toString().replace('\\', '/'))));
    putStoreInDirectory(buildConfig(), realDatabaseDir);
    execute("foo");
    verify(dumper).dump(eq(realDatabaseDir), eq(txLogsDir), any(), any(), any());
}
Also used : Path(java.nio.file.Path) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) Test(org.junit.jupiter.api.Test)

Example 63 with DisabledOnOs

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

the class DefaultFileSystemAbstractionTest method shouldFailGracefullyWhenPathCannotBeCreated.

@Test
// Windows doesn't seem to be able to set a directory read only without complex ACLs
@DisabledOnOs(OS.WINDOWS)
@DisabledForRoot
void shouldFailGracefullyWhenPathCannotBeCreated() throws Exception {
    Files.createDirectories(path);
    assertTrue(fsa.fileExists(path));
    Files.setPosixFilePermissions(path, EnumSet.of(PosixFilePermission.OWNER_READ, PosixFilePermission.GROUP_READ, PosixFilePermission.OTHERS_READ));
    path = path.resolve("some_file");
    IOException exception = assertThrows(IOException.class, () -> fsa.mkdirs(path));
    assertFalse(fsa.isDirectory(path));
    String expectedMessage = format(UNABLE_TO_CREATE_DIRECTORY_FORMAT, path);
    assertThat(exception.getMessage()).isEqualTo(expectedMessage);
    Throwable cause = exception.getCause();
    assertThat(cause).isInstanceOf(AccessDeniedException.class);
}
Also used : IOException(java.io.IOException) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) Test(org.junit.jupiter.api.Test) DisabledForRoot(org.neo4j.test.extension.DisabledForRoot)

Example 64 with DisabledOnOs

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

the class PageSwapperTest method directIOAllowedOnlyOnLinux.

@Test
@DisabledOnOs(OS.LINUX)
void directIOAllowedOnlyOnLinux() throws IOException {
    PageSwapperFactory factory = createSwapperFactory(getFs());
    Path file = file("file");
    var e = assertThrows(IllegalArgumentException.class, () -> createSwapperAndFile(factory, file, true));
    assertThat(e.getMessage()).contains("Linux");
}
Also used : Path(java.nio.file.Path) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) Test(org.junit.jupiter.api.Test)

Example 65 with DisabledOnOs

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

the class VersionAwareLogEntryReaderIT method readTillTheEndOfNotPreallocatedFile.

@Test
@DisabledOnOs(OS.LINUX)
void readTillTheEndOfNotPreallocatedFile() throws IOException {
    LogFiles logFiles = LogFilesBuilder.builder(databaseLayout, fs).withLogEntryReader(entryReader).withLogVersionRepository(new SimpleLogVersionRepository()).withTransactionIdStore(new SimpleTransactionIdStore()).withStoreId(StoreId.UNKNOWN).build();
    try (Lifespan lifespan = new Lifespan(logFiles)) {
        LogPosition logPosition = entryReader.lastPosition();
        assertEquals(0L, logPosition.getLogVersion());
        assertEquals(Files.size(logFiles.getLogFile().getHighestLogFile()), logPosition.getByteOffset());
    }
}
Also used : SimpleTransactionIdStore(org.neo4j.kernel.impl.transaction.SimpleTransactionIdStore) LogFiles(org.neo4j.kernel.impl.transaction.log.files.LogFiles) SimpleLogVersionRepository(org.neo4j.kernel.impl.transaction.SimpleLogVersionRepository) Lifespan(org.neo4j.kernel.lifecycle.Lifespan) LogPosition(org.neo4j.kernel.impl.transaction.log.LogPosition) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) Test(org.junit.jupiter.api.Test)

Aggregations

DisabledOnOs (org.junit.jupiter.api.condition.DisabledOnOs)87 Test (org.junit.jupiter.api.Test)80 Path (java.nio.file.Path)39 File (java.io.File)26 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