blob: bba0c76255872fe6037ade55fd3e7ba21bcbe60b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
// 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 com.yahoo.config.application.api.FileRegistry;
import com.yahoo.net.HostName;
import java.util.ArrayList;
import java.util.List;
/**
* A file registry for testing, and, it seems, doubling as a null registry in some code paths.
*
* @author Tony Vaagenes
* @author hmusum
*/
public class MockFileRegistry implements FileRegistry {
private final List<Entry> entries = new ArrayList<>();
public FileReference addFile(String relativePath) {
FileReference fileReference = new FileReference(relativePath);
entries.add(new Entry("", fileReference));
return fileReference;
}
@Override
public String fileSourceHost() { return HostName.getLocalhost(); }
public List<Entry> export() { return entries; }
@Override
public FileReference addUri(String uri) {
throw new IllegalArgumentException("FileReference addUri(String uri) is not implemented for " + getClass().getCanonicalName());
}
}
|