Search in sources :

Example 6 with AppConfig

use of com.yahoo.foo.AppConfig in project vespa by vespa-engine.

the class ConfigGetterTest method testGetConfig.

@Test
public void testGetConfig() {
    int times = 11;
    String message = "testGetConfig";
    String a0 = "a0";
    String configId = "raw:times " + times + "\nmessage " + message + "\na[1]\na[0].name " + a0;
    ConfigGetter<AppConfig> getter = new ConfigGetter<>(AppConfig.class);
    AppConfig config = getter.getConfig(configId);
    assertThat(config.times(), is(times));
    assertThat(config.message(), is(message));
    assertThat(config.a().size(), is(1));
    assertThat(config.a(0).name(), is(a0));
    AppService service = new AppService(configId, sourceSet);
    AppConfig serviceConfig = service.getConfig();
    assertTrue(service.isConfigured());
    assertThat(config, is(serviceConfig));
}
Also used : AppConfig(com.yahoo.foo.AppConfig) Test(org.junit.Test)

Example 7 with AppConfig

use of com.yahoo.foo.AppConfig in project vespa by vespa-engine.

the class ConfigGetterTest method testGetFromFile.

@Test
public void testGetFromFile() {
    ConfigGetter<AppConfig> getter = new ConfigGetter<>(AppConfig.class);
    AppConfig config = getter.getConfig("file:src/test/resources/configs/foo/app.cfg");
    verifyFooValues(config);
}
Also used : AppConfig(com.yahoo.foo.AppConfig) Test(org.junit.Test)

Example 8 with AppConfig

use of com.yahoo.foo.AppConfig in project vespa by vespa-engine.

the class ConfigGetterTest method testGetFromRawSource.

@Test
public void testGetFromRawSource() {
    ConfigGetter<AppConfig> getter = new ConfigGetter<>(new RawSource("message \"one\""), AppConfig.class);
    AppConfig config = getter.getConfig("test");
    assertThat(config.message(), is("one"));
}
Also used : AppConfig(com.yahoo.foo.AppConfig) Test(org.junit.Test)

Example 9 with AppConfig

use of com.yahoo.foo.AppConfig in project vespa by vespa-engine.

the class ConfigGetterTest method testGetFromDir.

@Test
public void testGetFromDir() {
    ConfigGetter<AppConfig> getter = new ConfigGetter<>(AppConfig.class);
    AppConfig config = getter.getConfig("dir:src/test/resources/configs/foo/");
    verifyFooValues(config);
}
Also used : AppConfig(com.yahoo.foo.AppConfig) Test(org.junit.Test)

Example 10 with AppConfig

use of com.yahoo.foo.AppConfig in project vespa by vespa-engine.

the class ConfigGetterTest method testGetFromDirSource.

@Test
public void testGetFromDirSource() {
    AppConfig config = ConfigGetter.getConfig(AppConfig.class, "test", new DirSource(new File("src/test/resources/configs/foo/")));
    verifyFooValues(config);
}
Also used : AppConfig(com.yahoo.foo.AppConfig) File(java.io.File) Test(org.junit.Test)

Aggregations

AppConfig (com.yahoo.foo.AppConfig)13 Test (org.junit.Test)13 TimingValues (com.yahoo.vespa.config.TimingValues)2 File (java.io.File)2 SimpletypesConfig (com.yahoo.foo.SimpletypesConfig)1 Ignore (org.junit.Ignore)1