Skip to content

Commit

Permalink
Vert.x Cache Directory configuration ignored
Browse files Browse the repository at this point in the history
Signed-off-by: Lin Gao <lgao@redhat.com>
  • Loading branch information
gaol committed Aug 8, 2024
1 parent a34e10f commit ae770c3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ private static VertxOptions convertToVertxOptions(VertxConfiguration conf, Vertx
.setClassPathResolvingEnabled(conf.classpathResolving());

String fileCacheDir = System.getProperty(CACHE_DIR_BASE_PROP_NAME);
if (fileCacheDir != null) {
if (fileCacheDir == null) {
fileCacheDir = conf.cacheDirectory().orElse(null);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.quarkus.vertx.core.runtime;

import static io.vertx.core.file.impl.FileResolverImpl.CACHE_DIR_BASE_PROP_NAME;

import java.time.Duration;
import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -221,6 +223,24 @@ public void accept(VertxOptions vertxOptions) {
Assertions.assertTrue(called.get(), "Customizer should get called during initialization");
}

@Test
public void vertxCacheDirectoryBySystemProperty() {
final String cacheDir = System.getProperty("user.dir");
try {
System.setProperty(CACHE_DIR_BASE_PROP_NAME, cacheDir);
VertxOptionsCustomizer customizers = new VertxOptionsCustomizer(List.of(
vertxOptions -> {
Assertions.assertNotNull(vertxOptions.getFileSystemOptions());
Assertions.assertEquals(cacheDir, vertxOptions.getFileSystemOptions().getFileCacheDir());
}));
VertxCoreRecorder.initialize(new DefaultVertxConfiguration(), customizers, ThreadPoolConfig.empty(),
null,
LaunchMode.TEST);
} finally {
System.clearProperty(CACHE_DIR_BASE_PROP_NAME);
}
}

private static class DefaultVertxConfiguration implements VertxConfiguration {
@Override
public boolean caching() {
Expand Down

0 comments on commit ae770c3

Please sign in to comment.