summaryrefslogtreecommitdiffstats
path: root/config-application-package/src/main/java/com/yahoo/config/model/application/provider/MockFileRegistry.java
blob: ca0b37d8cc3e9810d86718b1a481e4b58d8661b4 (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
37
38
// 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 java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;

/**
 * A file registry for testing, and, it seems, doubling as a null registry in some code paths.
 *
 * @author tonytv
 */
public class MockFileRegistry implements FileRegistry {

    public FileReference addFile(String relativePath) {
        return FileReferenceCreator.create("0123456789abcdef");
    }

    @Override
    public String fileSourceHost() {
        return "localhost.fortestingpurposesonly";
    }

    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<>();
        result.add(entry1);
        result.add(entry2);
        return result;
    }

}