aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java/com/yahoo/vespa/model/filedistribution/FileReferencesRepositoryTestCase.java
blob: 628e87e24c5ac4f3ad2ca068e14d3a1152d9d5eb (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.filedistribution;

import com.yahoo.config.FileReference;
import com.yahoo.config.application.api.FileRegistry;
import com.yahoo.config.model.application.provider.MockFileRegistry;
import org.junit.jupiter.api.Test;

import java.util.Set;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

/**
 * @author bratseth
 */
public class FileReferencesRepositoryTestCase {

    @Test
    void fileDistributor() {
        FileRegistry fileRegistry = new MockFileRegistry();
        FileReferencesRepository fileReferencesRepository = new FileReferencesRepository(fileRegistry);

        String file1 = "component/path1";
        String file2 = "component/path2";
        FileReference ref1 = fileRegistry.addFile(file1);
        FileReference ref2 = fileRegistry.addFile(file2);

        assertEquals(Set.of(ref1, ref2), fileReferencesRepository.allFileReferences());
        assertNotNull(ref1);
        assertNotNull(ref2);
    }

}