use of org.junit.jupiter.api.condition.DisabledOnOs in project dropwizard by dropwizard.
the class DropwizardSSLConnectionSocketFactoryTest method shouldReturn200IfAbleToClientAuthSpecifyingCertAliasForGoodCert.
@Test
// https://github.com/dropwizard/dropwizard/issues/4330
@DisabledOnOs(OS.WINDOWS)
void shouldReturn200IfAbleToClientAuthSpecifyingCertAliasForGoodCert() throws Exception {
tlsConfiguration.setKeyStorePath(toFile("stores/client/twokeys.p12"));
tlsConfiguration.setKeyStorePassword("password");
tlsConfiguration.setKeyStoreType("PKCS12");
tlsConfiguration.setCertAlias("1");
final Client client = new JerseyClientBuilder(TLS_APP_RULE.getEnvironment()).using(jerseyClientConfiguration).build("client_auth_using_cert_alias_working");
final Response response = client.target(String.format("https://localhost:%d", TLS_APP_RULE.getPort(2))).request().get();
assertThat(response.getStatus()).isEqualTo(200);
}
use of org.junit.jupiter.api.condition.DisabledOnOs in project neo4j by neo4j.
the class SingleFilePageSwapperTest method mustCloseFilesIfTakingFileLockThrows.
@Test
@DisabledOnOs(OS.WINDOWS)
void mustCloseFilesIfTakingFileLockThrows() throws Exception {
final AtomicInteger openFilesCounter = new AtomicInteger();
PageSwapperFactory factory = createSwapperFactory(new DelegatingFileSystemAbstraction(fileSystem) {
@Override
public StoreChannel open(Path fileName, Set<OpenOption> options) throws IOException {
openFilesCounter.getAndIncrement();
return new DelegatingStoreChannel(super.open(fileName, options)) {
@Override
public void close() throws IOException {
openFilesCounter.getAndDecrement();
super.close();
}
};
}
});
Path file = testDir.file("file");
try (StoreChannel ch = fileSystem.write(file);
FileLock ignore = ch.tryLock()) {
createSwapper(factory, file, 4, NO_CALLBACK, false).close();
fail("Creating a page swapper for a locked channel should have thrown");
} catch (FileLockException e) {
// As expected.
}
assertThat(openFilesCounter.get()).isEqualTo(0);
}
use of org.junit.jupiter.api.condition.DisabledOnOs in project neo4j by neo4j.
the class SingleFilePageSwapperTest method mustUnlockFileWhenThePageSwapperIsClosed.
@Test
@DisabledOnOs(OS.WINDOWS)
void mustUnlockFileWhenThePageSwapperIsClosed() throws Exception {
PageSwapperFactory factory = createSwapperFactory(fileSystem);
Path file = testDir.file("file");
((StoreChannel) fileSystem.write(file)).close();
createSwapper(factory, file, 4, NO_CALLBACK, false).close();
try (StoreFileChannel channel = fileSystem.write(file);
FileLock fileLock = channel.tryLock()) {
assertThat(fileLock).isNotNull();
}
}
use of org.junit.jupiter.api.condition.DisabledOnOs in project neo4j by neo4j.
the class LoaderTest method shouldGiveAClearErrorMessageIfTheDestinationsParentDirectoryIsNotWritable.
@Test
@DisabledOnOs(OS.WINDOWS)
@DisabledForRoot
void shouldGiveAClearErrorMessageIfTheDestinationsParentDirectoryIsNotWritable() throws IOException {
Path archive = testDirectory.file("the-archive.dump");
Path destination = testDirectory.directory("subdir/the-destination");
DatabaseLayout databaseLayout = DatabaseLayout.ofFlat(destination);
Path parentPath = databaseLayout.databaseDirectory().getParent();
try (Closeable ignored = withPermissions(parentPath, emptySet())) {
AccessDeniedException exception = assertThrows(AccessDeniedException.class, () -> new Loader().load(archive, databaseLayout));
assertEquals(parentPath.toString(), exception.getMessage());
}
}
use of org.junit.jupiter.api.condition.DisabledOnOs in project neo4j by neo4j.
the class DefaultFileSystemWatcherTest method shouldHandleMultipleSubscribersToSameFile.
@Test
@DisabledOnOs(OS.WINDOWS)
void shouldHandleMultipleSubscribersToSameFile() throws Exception {
try (OtherThreadExecutor executor = new OtherThreadExecutor("watcher");
DefaultFileSystemWatcher watcher = new DefaultFileSystemWatcher(FileSystems.getDefault().newWatchService())) {
// Given
AssertableFileEventListener listener = new AssertableFileEventListener();
watcher.addFileWatchEventListener(listener);
Path foo = testDirectory.createFile("foo");
Path bar = testDirectory.createFile("bar");
executor.executeDontWait(() -> {
try {
watcher.startWatching();
} catch (Exception ignored) {
// Expected
}
return null;
});
WatchedResource firstWatch = watcher.watch(testDirectory.homePath());
firstWatch.close();
assertThat(firstWatch.getWatchKey().isValid()).isFalse();
WatchedResource secondWatch = watcher.watch(testDirectory.homePath());
WatchedResource thirdWatch = watcher.watch(testDirectory.homePath());
executor.waitUntilWaiting(location -> location.isAt(DefaultFileSystemWatcher.class, "startWatching"));
// When
testDirectory.getFileSystem().delete(foo);
// Then
assertEventually("Foo deleted", () -> listener.containsDeleted("foo"), TRUE, 30, SECONDS);
// When
// Closing the first should still allow the second to observe deletions
secondWatch.close();
assertThat(thirdWatch.getWatchKey().isValid()).isTrue();
testDirectory.getFileSystem().delete(bar);
assertEventually("Bar deleted", () -> listener.containsDeleted("bar"), TRUE, 30, SECONDS);
thirdWatch.close();
assertThat(thirdWatch.getWatchKey().isValid()).isFalse();
}
}
Aggregations