diff options
author | Harald Musum <musum@yahoo-inc.com> | 2017-11-10 13:25:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-10 13:25:45 +0100 |
commit | 2c88e4fbaea77c6c79cf2e7f60632a340dbf4789 (patch) | |
tree | 3858bdbf2d73a4d64a7da5ecd465e37e62ad5e5d | |
parent | 545c8c5b2bc971418ae90b0b7e5404d563375e5e (diff) | |
parent | 638590dcc41d0500a6e40008cd775f2b9237cea2 (diff) |
Merge pull request #4084 from vespa-engine/revert-4067-balder/wire-in-filecopy-on-deploy-the-new-way
Revert "Wire in deployment so that we can copy the file in when the old way i…"
16 files changed, 88 insertions, 270 deletions
diff --git a/config-application-package/src/main/java/com/yahoo/config/model/application/provider/FileReferenceCreator.java b/config-application-package/src/main/java/com/yahoo/config/model/application/provider/FileReferenceCreator.java new file mode 100644 index 00000000000..7e1d247281c --- /dev/null +++ b/config-application-package/src/main/java/com/yahoo/config/model/application/provider/FileReferenceCreator.java @@ -0,0 +1,26 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.config.model.application.provider; + +import com.yahoo.config.FileReference; + +import java.lang.reflect.Constructor; + +/** + * Convenience for creating a {@link com.yahoo.config.FileReference}. + * + * @author gjoranv + */ +public class FileReferenceCreator { + + public static FileReference create(String stringVal) { + try { + Constructor<FileReference> ctor = FileReference.class.getDeclaredConstructor(String.class); + ctor.setAccessible(true); + return ctor.newInstance(stringVal); + } catch (Exception e) { + throw new RuntimeException("Could not create a new " + FileReference.class.getName() + + ". This should never happen!", e); + } + } + +} diff --git a/config-application-package/src/main/java/com/yahoo/config/model/application/provider/MockFileRegistry.java b/config-application-package/src/main/java/com/yahoo/config/model/application/provider/MockFileRegistry.java index d635fe90ded..ca0b37d8cc3 100644 --- a/config-application-package/src/main/java/com/yahoo/config/model/application/provider/MockFileRegistry.java +++ b/config-application-package/src/main/java/com/yahoo/config/model/application/provider/MockFileRegistry.java @@ -17,7 +17,7 @@ import java.util.Set; public class MockFileRegistry implements FileRegistry { public FileReference addFile(String relativePath) { - return new FileReference("0123456789abcdef"); + return FileReferenceCreator.create("0123456789abcdef"); } @Override @@ -25,8 +25,8 @@ public class MockFileRegistry implements FileRegistry { return "localhost.fortestingpurposesonly"; } - public static final Entry entry1 = new Entry("component/path1", new FileReference("1234")); - public static final Entry entry2 = new Entry("component/path2", new FileReference("56789")); + public static final Entry entry1 = new Entry("component/path1", FileReferenceCreator.create("1234")); + public static final Entry entry2 = new Entry("component/path2", FileReferenceCreator.create("56789")); public List<Entry> export() { List<Entry> result = new ArrayList<>(); diff --git a/config-application-package/src/main/java/com/yahoo/config/model/application/provider/PreGeneratedFileRegistry.java b/config-application-package/src/main/java/com/yahoo/config/model/application/provider/PreGeneratedFileRegistry.java index 0b0b799f47f..29e83e00305 100644 --- a/config-application-package/src/main/java/com/yahoo/config/model/application/provider/PreGeneratedFileRegistry.java +++ b/config-application-package/src/main/java/com/yahoo/config/model/application/provider/PreGeneratedFileRegistry.java @@ -70,7 +70,7 @@ public class PreGeneratedFileRegistry implements FileRegistry { } public FileReference addFile(String relativePath) { - return new FileReference(path2Hash.get(relativePath)); + return FileReferenceCreator.create(path2Hash.get(relativePath)); } @Override @@ -86,7 +86,7 @@ public class PreGeneratedFileRegistry implements FileRegistry { public List<Entry> export() { List<Entry> entries = new ArrayList<>(); for (Map.Entry<String, String> entry : path2Hash.entrySet()) { - entries.add(new Entry(entry.getKey(), new FileReference(entry.getValue()))); + entries.add(new Entry(entry.getKey(), FileReferenceCreator.create(entry.getValue()))); } return entries; } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/FileDistributor.java b/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/FileDistributor.java index f6cc9203d00..8860f5c2249 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/FileDistributor.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/FileDistributor.java @@ -110,5 +110,11 @@ public class FileDistributor { public void reloadDeployFileDistributor(FileDistribution dbHandler) { dbHandler.reloadDeployFileDistributor(); } + + private Set<String> union(Set<String> hosts, String... additionalHosts) { + Set<String> result = new HashSet<>(hosts); + result.addAll(asList(additionalHosts)); + return result; + } } diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/AddFileInterface.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/AddFileInterface.java deleted file mode 100644 index 61c376a7256..00000000000 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/AddFileInterface.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.config.server.filedistribution; - -import com.yahoo.config.FileReference; - -public interface AddFileInterface { - FileReference addFile(String relativePath); - FileReference addFile(String relativePath, FileReference reference); -} diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/ApplicationFileManager.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/ApplicationFileManager.java deleted file mode 100644 index 0d1aae97690..00000000000 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/ApplicationFileManager.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.config.server.filedistribution; - -import com.yahoo.config.FileReference; -import java.io.File; - -public class ApplicationFileManager implements AddFileInterface { - private final File applicationDir; - private final FileDirectory master; - - ApplicationFileManager(File applicationDir, FileDirectory master) { - this.applicationDir = applicationDir; - this.master = master; - } - - @Override - public FileReference addFile(String relativePath, FileReference reference) { - return master.addFile(new File(applicationDir, relativePath), reference); - } - - @Override - public FileReference addFile(String relativePath) { - return master.addFile(new File(applicationDir, relativePath)); - } -} diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/CombinedLegacyDistribution.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/CombinedLegacyDistribution.java deleted file mode 100644 index 588f2d1d63f..00000000000 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/CombinedLegacyDistribution.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.config.server.filedistribution; - -import com.yahoo.config.FileReference; -import com.yahoo.config.model.api.FileDistribution; - -import java.util.Collection; -import java.util.Set; - -public class CombinedLegacyDistribution implements FileDistribution { - private final FileDistribution legacy; - - CombinedLegacyDistribution(FileDBHandler legacy) { - this.legacy = legacy; - } - @Override - public void sendDeployedFiles(String hostName, Set<FileReference> fileReferences) { - legacy.sendDeployedFiles(hostName, fileReferences); - } - - @Override - public void reloadDeployFileDistributor() { - legacy.reloadDeployFileDistributor(); - } - - @Override - public void removeDeploymentsThatHaveDifferentApplicationId(Collection<String> targetHostnames) { - legacy.removeDeploymentsThatHaveDifferentApplicationId(targetHostnames); - } -} diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/CombinedLegacyRegistry.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/CombinedLegacyRegistry.java deleted file mode 100644 index 1f5b19290fe..00000000000 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/CombinedLegacyRegistry.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.config.server.filedistribution; - -import com.yahoo.config.FileReference; -import com.yahoo.config.application.api.FileRegistry; - -import java.util.List; - -public class CombinedLegacyRegistry implements FileRegistry { - private final FileDBRegistry legacy; - private final FileDBRegistry future; - - CombinedLegacyRegistry(FileDBRegistry legacy, FileDBRegistry future) { - this.legacy = legacy; - this.future = future; - } - @Override - public FileReference addFile(String relativePath) { - FileReference reference = legacy.addFile(relativePath); - // TODO: Enable when system tested future.addFile(relativePath, reference); - return reference; - } - - @Override - public String fileSourceHost() { - return future.fileSourceHost(); - } - - @Override - public List<Entry> export() { - return future.export(); - } -} diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDBRegistry.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDBRegistry.java index 1a76454fbed..d921d8d4f8d 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDBRegistry.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDBRegistry.java @@ -4,41 +4,29 @@ package com.yahoo.vespa.config.server.filedistribution; import com.yahoo.config.FileReference; import com.yahoo.config.application.api.FileRegistry; import com.yahoo.net.HostName; +import com.yahoo.vespa.filedistribution.FileDistributionManager; +import com.yahoo.config.model.application.provider.FileReferenceCreator; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; +import java.util.*; /** * @author tonytv */ public class FileDBRegistry implements FileRegistry { - private final AddFileInterface manager; + private final FileDistributionManager manager; private List<Entry> entries = new ArrayList<>(); private final Map<String, FileReference> fileReferenceCache = new HashMap<>(); - public FileDBRegistry(AddFileInterface manager) { + public FileDBRegistry(FileDistributionManager manager) { this.manager = manager; } - public synchronized FileReference addFile(String relativePath, FileReference reference) { - Optional<FileReference> cachedReference = Optional.ofNullable(fileReferenceCache.get(relativePath)); - return cachedReference.orElseGet(() -> { - FileReference newRef = manager.addFile(relativePath, reference); - entries.add(new Entry(relativePath, newRef)); - fileReferenceCache.put(relativePath, newRef); - return newRef; - }); - } - @Override public synchronized FileReference addFile(String relativePath) { Optional<FileReference> cachedReference = Optional.ofNullable(fileReferenceCache.get(relativePath)); return cachedReference.orElseGet(() -> { - FileReference newRef = manager.addFile(relativePath); + FileReference newRef = FileReferenceCreator.create(manager.addFile(relativePath)); entries.add(new Entry(relativePath, newRef)); fileReferenceCache.put(relativePath, newRef); return newRef; diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDirectory.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDirectory.java deleted file mode 100644 index 5a7bc4e7e82..00000000000 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDirectory.java +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -package com.yahoo.vespa.config.server.filedistribution; - -import com.yahoo.config.FileReference; -import com.yahoo.config.model.api.FileDistribution; -import com.yahoo.io.IOUtils; -import com.yahoo.text.Utf8; -import net.jpountz.xxhash.XXHash64; -import net.jpountz.xxhash.XXHashFactory; - -import java.io.File; -import java.io.FilenameFilter; -import java.io.IOException; -import java.nio.ByteBuffer; -import java.util.logging.Logger; - -public class FileDirectory { - private static final Logger log = Logger.getLogger(FileDirectory.class.getName()); - private final File root; - - public FileDirectory() { - this(FileDistribution.getDefaultFileDBPath()); - } - - public FileDirectory(File rootDir) { - root = rootDir; - try { - ensureRootExist(); - } catch (IllegalArgumentException e) { - log.warning("Failed creating directory in constructor, will retry on demand : " + e.toString()); - } - } - - private void ensureRootExist() { - if (! root.exists()) { - if ( ! root.mkdir()) { - throw new IllegalArgumentException("Failed creating root dir '" + root.getAbsolutePath() + "'."); - } - } else if (!root.isDirectory()) { - throw new IllegalArgumentException("'" + root.getAbsolutePath() + "' is not a directory"); - } - } - - static private class Filter implements FilenameFilter { - @Override - public boolean accept(File dir, String name) { - return !".".equals(name) && !"..".equals(name) ; - } - } - - String getPath(FileReference ref) { - return root.getAbsolutePath() + "/" + ref.value(); - } - - File getFile(FileReference reference) { - ensureRootExist(); - File dir = new File(getPath(reference)); - if (!dir.exists()) { - throw new IllegalArgumentException("File reference '" + reference.toString() + "' with absolute path '" + dir.getAbsolutePath() + "' does not exist."); - } - if (!dir.isDirectory()) { - throw new IllegalArgumentException("File reference '" + reference.toString() + "' with absolute path '" + dir.getAbsolutePath() + "' is not a directory."); - } - File [] files = dir.listFiles(new Filter()); - if (files.length != 1) { - StringBuilder msg = new StringBuilder(); - for (File f: files) { - msg.append(f.getName()).append("\n"); - } - throw new IllegalArgumentException("File reference '" + reference.toString() + "' with absolute path '" + dir.getAbsolutePath() + " does not contain exactly one file, but [" + msg.toString() + "]"); - } - return files[0]; - } - - private Long computeReference(File file) throws IOException { - byte [] wholeFile = IOUtils.readFileBytes(file); - XXHash64 hasher = XXHashFactory.fastestInstance().hash64(); - return hasher.hash(ByteBuffer.wrap(wholeFile), hasher.hash(ByteBuffer.wrap(Utf8.toBytes(file.getName())), 0)); - } - - public FileReference addFile(File source) { - try { - Long hash = computeReference(source); - FileReference reference = new FileReference(Long.toHexString(hash)); - return addFile(source, reference); - } catch (IOException e) { - throw new IllegalArgumentException(e); - } - } - public FileReference addFile(File source, FileReference reference) { - ensureRootExist(); - try { - File destinationDir = new File(root, reference.value()); - if (!destinationDir.exists()) { - destinationDir.mkdir(); - File tempDestinationDir = File.createTempFile("writing", null, root); - tempDestinationDir.mkdir(); - File destination = new File(tempDestinationDir, source.getName()); - IOUtils.copy(source, destination); - if (!destinationDir.exists()) { - if ( ! tempDestinationDir.renameTo(destinationDir)) { - log.warning("Failed moving '" + tempDestinationDir.getAbsolutePath() + "' to '" + destination.getAbsolutePath() + "'."); - } - } - IOUtils.recursiveDeleteDir(tempDestinationDir); - } - return reference; - } catch (IOException e) { - throw new IllegalArgumentException(e); - } - } -} diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionProvider.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionProvider.java index 59c3a54897d..36b0138ad36 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionProvider.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileDistributionProvider.java @@ -1,7 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.config.server.filedistribution; -import com.yahoo.config.FileReference; import com.yahoo.config.model.api.FileDistribution; import com.yahoo.config.application.api.FileRegistry; import com.yahoo.vespa.filedistribution.FileDistributionManager; @@ -20,32 +19,13 @@ public class FileDistributionProvider { private final FileRegistry fileRegistry; private final FileDistribution fileDistribution; - static private class ManagerWrapper implements AddFileInterface { - private final FileDistributionManager manager; - ManagerWrapper(FileDistributionManager manager) { - this.manager = manager; - } - @Override - public FileReference addFile(String relativePath) { - return new FileReference(manager.addFile(relativePath)); - } - - @Override - public FileReference addFile(String relativePath, FileReference reference) { - throw new IllegalStateException("addFile with external reference is not possible with legacy filedistribution."); - } - } - - public FileDistributionProvider(File applicationDir, String zooKeepersSpec, - String applicationId, Lock fileDistributionLock) - { + public FileDistributionProvider(File applicationDir, String zooKeepersSpec, String applicationId, Lock fileDistributionLock) { ensureDirExists(FileDistribution.getDefaultFileDBPath()); final FileDistributionManager manager = new FileDistributionManager( FileDistribution.getDefaultFileDBPath(), applicationDir, zooKeepersSpec, applicationId, fileDistributionLock); - this.fileDistribution = new CombinedLegacyDistribution(new FileDBHandler(manager)); - this.fileRegistry = new CombinedLegacyRegistry(new FileDBRegistry(new ManagerWrapper(manager)), - new FileDBRegistry(new ApplicationFileManager(applicationDir, new FileDirectory()))); + this.fileDistribution = new FileDBHandler(manager); + this.fileRegistry = new FileDBRegistry(manager); } public FileDistributionProvider(FileRegistry fileRegistry, FileDistribution fileDistribution) { diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java index 0cbf35b98d1..1c77ee66d0c 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java @@ -1,4 +1,3 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.config.server.filedistribution; import com.google.inject.Inject; @@ -7,6 +6,7 @@ import com.yahoo.config.model.api.FileDistribution; import com.yahoo.io.IOUtils; import java.io.File; +import java.io.FilenameFilter; import java.io.IOException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -14,7 +14,7 @@ import java.util.logging.Logger; public class FileServer { private static final Logger log = Logger.getLogger(FileServer.class.getName()); - private final FileDirectory root; + private final String rootDir; private final ExecutorService executor; public static class ReplayStatus { @@ -33,17 +33,46 @@ public class FileServer { void receive(FileReference reference, String filename, byte [] content, ReplayStatus status); } + private String getPath(FileReference ref) { + return rootDir + "/" + ref.value(); + } + + static private class Filter implements FilenameFilter { + @Override + public boolean accept(File dir, String name) { + return !".".equals(name) && !"..".equals(name) ; + } + } + private File getFile(FileReference reference) { + File dir = new File(getPath(reference)); + if (!dir.exists()) { + throw new IllegalArgumentException("File reference '" + reference.toString() + "' with absolute path '" + dir.getAbsolutePath() + "' does not exist."); + } + if (!dir.isDirectory()) { + throw new IllegalArgumentException("File reference '" + reference.toString() + "' with absolute path '" + dir.getAbsolutePath() + "' is not a directory."); + } + File [] files = dir.listFiles(new Filter()); + if (files.length != 1) { + StringBuilder msg = new StringBuilder(); + for (File f: files) { + msg.append(f.getName()).append("\n"); + } + throw new IllegalArgumentException("File reference '" + reference.toString() + "' with absolute path '" + dir.getAbsolutePath() + " does not contain exactly one file, but [" + msg.toString() + "]"); + } + return files[0]; + } + @Inject public FileServer() { - this(FileDistribution.getDefaultFileDBPath()); + this(FileDistribution.getDefaultFileDBRoot()); } - public FileServer(File rootDir) { + public FileServer(String rootDir) { this(rootDir, Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors())); } - public FileServer(File rootDir, ExecutorService executor) { - this.root = new FileDirectory(rootDir); + public FileServer(String rootDir, ExecutorService executor) { + this.rootDir = rootDir; this.executor = executor; } public boolean hasFile(String fileName) { @@ -51,7 +80,7 @@ public class FileServer { } public boolean hasFile(FileReference reference) { try { - return root.getFile(reference).exists(); + return getFile(reference).exists(); } catch (IllegalArgumentException e) { log.warning("Failed locating file reference '" + reference + "' with error " + e.toString()); } @@ -59,7 +88,7 @@ public class FileServer { } public boolean startFileServing(String fileName, Receiver target) { FileReference reference = new FileReference(fileName); - File file = root.getFile(reference); + File file = getFile(reference); if (file.exists()) { executor.execute(() -> serveFile(reference, target)); @@ -69,7 +98,7 @@ public class FileServer { private void serveFile(FileReference reference, Receiver target) { - File file = root.getFile(reference); + File file = getFile(reference); byte [] blob = new byte [0]; boolean success = false; String errorDescription = "OK"; diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/InjectedGlobalComponentRegistryTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/InjectedGlobalComponentRegistryTest.java index dec9dd991de..acda60049ab 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/InjectedGlobalComponentRegistryTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/InjectedGlobalComponentRegistryTest.java @@ -63,7 +63,7 @@ public class InjectedGlobalComponentRegistryTest { serverDB = new ConfigServerDB(configserverConfig); sessionPreparer = new SessionTest.MockSessionPreparer(); rpcServer = new RpcServer(configserverConfig, null, Metrics.createTestMetrics(), - new HostRegistries(), new ConfigRequestHostLivenessTracker(), new FileServer(FileDistribution.getDefaultFileDBPath())); + new HostRegistries(), new ConfigRequestHostLivenessTracker(), new FileServer(FileDistribution.getDefaultFileDBRoot())); generationCounter = new SuperModelGenerationCounter(curator); defRepo = new StaticConfigDefinitionRepo(); permanentApplicationPackage = new PermanentApplicationPackage(configserverConfig); diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/filedistribution/FileServerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/filedistribution/FileServerTest.java index 4913798e5ad..0c2ace38389 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/filedistribution/FileServerTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/filedistribution/FileServerTest.java @@ -1,4 +1,3 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.config.server.filedistribution; import com.yahoo.config.FileReference; @@ -18,7 +17,7 @@ import static org.junit.Assert.assertFalse; public class FileServerTest { - FileServer fs = new FileServer(new File(".")); + FileServer fs = new FileServer("."); List<File> created = new LinkedList<>(); private void createCleanDir(String name) throws IOException{ diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/MockRpc.java b/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/MockRpc.java index 4c2a4b56751..b094a741f34 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/MockRpc.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/MockRpc.java @@ -39,7 +39,7 @@ public class MockRpc extends RpcServer { public MockRpc(int port, boolean createDefaultTenant, boolean pretendToHaveLoadedAnyApplication) { super(createConfig(port), null, Metrics.createTestMetrics(), - new HostRegistries(), new ConfigRequestHostLivenessTracker(), new FileServer(FileDistribution.getDefaultFileDBPath())); + new HostRegistries(), new ConfigRequestHostLivenessTracker(), new FileServer(FileDistribution.getDefaultFileDBRoot())); if (createDefaultTenant) { onTenantCreate(TenantName.from("default"), new MockTenantProvider(pretendToHaveLoadedAnyApplication)); } diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/TestWithRpc.java b/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/TestWithRpc.java index 12dc584f055..933cb770dd1 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/TestWithRpc.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/TestWithRpc.java @@ -90,7 +90,7 @@ public class TestWithRpc { emptyNodeFlavors(), generationCounter)), Metrics.createTestMetrics(), new HostRegistries(), - hostLivenessTracker, new FileServer(FileDistribution.getDefaultFileDBPath())); + hostLivenessTracker, new FileServer(FileDistribution.getDefaultFileDBRoot())); rpcServer.onTenantCreate(TenantName.from("default"), tenantProvider); t = new Thread(rpcServer); t.start(); |