blob: 60fe343153589eae866321ecc4f17161f260177c (
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
39
40
41
|
// 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;
import com.google.common.io.Files;
import com.yahoo.io.IOUtils;
import org.junit.Before;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
/**
* @author lulf
* @since 5.1
*/
public class ConfigServerDBTest {
private ConfigServerDB serverDB;
private File tempDir;
@Before
public void setup() {
tempDir = Files.createTempDir();
serverDB = ConfigServerDB.createTestConfigServerDb(tempDir.getAbsolutePath());
}
private ConfigServerDB createInitializer() throws IOException {
File existingDef = new File(serverDB.classes(), "test.def");
IOUtils.writeFile(existingDef, "hello", false);
return ConfigServerDB.createTestConfigServerDb(tempDir.getAbsolutePath());
}
@Test
public void require_that_existing_def_files_are_copied() throws IOException {
assertThat(serverDB.serverdefs().listFiles().length, is(0));
createInitializer();
assertThat(serverDB.serverdefs().listFiles().length, is(1));
}
}
|