diff --git a/presto-local-file/src/main/java/io/prestosql/plugin/localfile/LocalFileConfig.java b/presto-local-file/src/main/java/io/prestosql/plugin/localfile/LocalFileConfig.java index afef665781820..a8d1f610d6e4d 100644 --- a/presto-local-file/src/main/java/io/prestosql/plugin/localfile/LocalFileConfig.java +++ b/presto-local-file/src/main/java/io/prestosql/plugin/localfile/LocalFileConfig.java @@ -15,12 +15,14 @@ import io.airlift.configuration.Config; import io.airlift.configuration.ConfigDescription; +import io.airlift.configuration.validation.FileExists; public class LocalFileConfig { private String httpRequestLogLocation = "var/log/http-request.log"; private String httpRequestLogFileNamePattern; + @FileExists public String getHttpRequestLogLocation() { return httpRequestLogLocation; diff --git a/presto-local-file/src/test/java/io/prestosql/plugin/localfile/TestLocalFileConfig.java b/presto-local-file/src/test/java/io/prestosql/plugin/localfile/TestLocalFileConfig.java index b5a4b546d0e8f..97298b453caef 100644 --- a/presto-local-file/src/test/java/io/prestosql/plugin/localfile/TestLocalFileConfig.java +++ b/presto-local-file/src/test/java/io/prestosql/plugin/localfile/TestLocalFileConfig.java @@ -16,6 +16,9 @@ import com.google.common.collect.ImmutableMap; import org.testng.annotations.Test; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.Map; import static io.airlift.configuration.testing.ConfigAssertions.assertFullMapping; @@ -34,14 +37,17 @@ public void testDefaults() @Test public void testExplicitPropertyMappings() + throws IOException { + Path httpRequestLogFile = Files.createTempFile(null, null); + Map properties = new ImmutableMap.Builder() - .put("presto-logs.http-request-log.location", "/data/foo.log") + .put("presto-logs.http-request-log.location", httpRequestLogFile.toString()) .put("presto-logs.http-request-log.pattern", "bar") .build(); LocalFileConfig expected = new LocalFileConfig() - .setHttpRequestLogLocation("/data/foo.log") + .setHttpRequestLogLocation(httpRequestLogFile.toString()) .setHttpRequestLogFileNamePattern("bar"); assertFullMapping(properties, expected);