aboutsummaryrefslogtreecommitdiffstats
path: root/model-evaluation/src/test
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2018-09-10 09:27:22 +0200
committerJon Bratseth <bratseth@oath.com>2018-09-10 09:27:22 +0200
commit80476877f811f0a90cc1e692d56b5fbd11fbe76c (patch)
tree8b6451c43e3d90bc0ddf9fbcf268dcbd6d1c2a05 /model-evaluation/src/test
parent48f9a4071b5f6f75114cd1b94eb09bec36f77061 (diff)
Use fileAcquirer
Diffstat (limited to 'model-evaluation/src/test')
-rw-r--r--model-evaluation/src/test/java/ai/vespa/models/evaluation/ModelTester.java10
-rw-r--r--model-evaluation/src/test/java/ai/vespa/models/evaluation/ModelsEvaluatorTest.java3
2 files changed, 9 insertions, 4 deletions
diff --git a/model-evaluation/src/test/java/ai/vespa/models/evaluation/ModelTester.java b/model-evaluation/src/test/java/ai/vespa/models/evaluation/ModelTester.java
index 0a400f7126f..0aceaccc3e0 100644
--- a/model-evaluation/src/test/java/ai/vespa/models/evaluation/ModelTester.java
+++ b/model-evaluation/src/test/java/ai/vespa/models/evaluation/ModelTester.java
@@ -1,8 +1,11 @@
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package ai.vespa.models.evaluation;
+import com.yahoo.config.FileReference;
import com.yahoo.config.subscription.ConfigGetter;
import com.yahoo.config.subscription.FileSource;
+import com.yahoo.filedistribution.fileacquirer.FileAcquirer;
+import com.yahoo.filedistribution.fileacquirer.MockFileAcquirer;
import com.yahoo.io.GrowableByteBuffer;
import com.yahoo.io.IOUtils;
import com.yahoo.path.Path;
@@ -42,7 +45,7 @@ public class ModelTester {
RankProfilesConfig.class).getConfig("");
RankingConstantsConfig constantsConfig = new ConfigGetter<>(new FileSource(configDir.append("ranking-constants.cfg").toFile()),
RankingConstantsConfig.class).getConfig("");
- return new RankProfilesConfigImporterWithMockedConstants(Path.fromString(path).append("constants"))
+ return new RankProfilesConfigImporterWithMockedConstants(Path.fromString(path).append("constants"), MockFileAcquirer.returnFile(null))
.importFrom(config, constantsConfig);
}
@@ -68,12 +71,13 @@ public class ModelTester {
private final Path constantsPath;
- public RankProfilesConfigImporterWithMockedConstants(Path constantsPath) {
+ public RankProfilesConfigImporterWithMockedConstants(Path constantsPath, FileAcquirer fileAcquirer) {
+ super(fileAcquirer);
this.constantsPath = constantsPath;
}
@Override
- protected Tensor readTensorFromFile(String name, TensorType type, String fileReference) {
+ protected Tensor readTensorFromFile(String name, TensorType type, FileReference fileReference) {
try {
return TypedBinaryFormat.decode(Optional.of(type),
GrowableByteBuffer.wrap(IOUtils.readFileBytes(constantsPath.append(name).toFile())));
diff --git a/model-evaluation/src/test/java/ai/vespa/models/evaluation/ModelsEvaluatorTest.java b/model-evaluation/src/test/java/ai/vespa/models/evaluation/ModelsEvaluatorTest.java
index 0708d872ff6..bd1ff6b8ed7 100644
--- a/model-evaluation/src/test/java/ai/vespa/models/evaluation/ModelsEvaluatorTest.java
+++ b/model-evaluation/src/test/java/ai/vespa/models/evaluation/ModelsEvaluatorTest.java
@@ -3,6 +3,7 @@ package ai.vespa.models.evaluation;
import com.yahoo.config.subscription.ConfigGetter;
import com.yahoo.config.subscription.FileSource;
+import com.yahoo.filedistribution.fileacquirer.MockFileAcquirer;
import com.yahoo.path.Path;
import com.yahoo.tensor.Tensor;
import com.yahoo.vespa.config.search.RankProfilesConfig;
@@ -47,7 +48,7 @@ public class ModelsEvaluatorTest {
RankProfilesConfig.class).getConfig("");
RankingConstantsConfig constantsConfig = new ConfigGetter<>(new FileSource(configDir.append("ranking-constants.cfg").toFile()),
RankingConstantsConfig.class).getConfig("");
- return new ModelsEvaluator(config, constantsConfig);
+ return new ModelsEvaluator(config, constantsConfig, MockFileAcquirer.returnFile(null));
}
}