Search in sources :

Example 11 with AppConfig

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

the class ConfigSubscriptionTest method testEquals.

@Test
public void testEquals() {
    ConfigSubscriber sub = new ConfigSubscriber();
    final String payload = "boolval true";
    ConfigSubscription<SimpletypesConfig> a = ConfigSubscription.get(new ConfigKey<>(SimpletypesConfig.class, "test"), sub, new RawSource(payload), new TimingValues());
    ConfigSubscription<SimpletypesConfig> b = ConfigSubscription.get(new ConfigKey<>(SimpletypesConfig.class, "test"), sub, new RawSource(payload), new TimingValues());
    ConfigSubscription<SimpletypesConfig> c = ConfigSubscription.get(new ConfigKey<>(SimpletypesConfig.class, "test2"), sub, new RawSource(payload), new TimingValues());
    assertEquals(b, a);
    assertEquals(a, a);
    assertEquals(b, b);
    assertEquals(c, c);
    assertNotEquals(c, a);
    assertNotEquals(c, b);
    ConfigSubscriber subscriber = new ConfigSubscriber();
    ConfigSet configSet = new ConfigSet();
    AppConfig.Builder a0builder = new AppConfig.Builder().message("A message, 0").times(88);
    configSet.addBuilder("app/0", a0builder);
    AppConfig.Builder a1builder = new AppConfig.Builder().message("A message, 1").times(89);
    configSet.addBuilder("app/1", a1builder);
    ConfigSubscription<AppConfig> c1 = ConfigSubscription.get(new ConfigKey<>(AppConfig.class, "app/0"), subscriber, configSet, new TimingValues());
    ConfigSubscription<AppConfig> c2 = ConfigSubscription.get(new ConfigKey<>(AppConfig.class, "app/1"), subscriber, configSet, new TimingValues());
    assertTrue(c1.equals(c1));
    assertFalse(c1.equals(c2));
}
Also used : SimpletypesConfig(com.yahoo.foo.SimpletypesConfig) AppConfig(com.yahoo.foo.AppConfig) TimingValues(com.yahoo.vespa.config.TimingValues) Test(org.junit.Test)

Example 12 with AppConfig

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

the class BasicTest method testSubBasic.

@Test
public void testSubBasic() {
    ConfigSubscriber s = new ConfigSubscriber();
    ConfigHandle<AppConfig> h = s.subscribe(AppConfig.class, "raw:times 0");
    s.nextConfig(0);
    AppConfig c = h.getConfig();
    assertThat(c.times(), is(0));
}
Also used : AppConfig(com.yahoo.foo.AppConfig) Test(org.junit.Test)

Example 13 with AppConfig

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

the class BasicTest method testSubBasicGeneration.

@Test
public void testSubBasicGeneration() {
    ConfigSubscriber s = new ConfigSubscriber();
    ConfigHandle<AppConfig> h = s.subscribe(AppConfig.class, "raw:times 2");
    s.nextGeneration(0);
    AppConfig c = h.getConfig();
    assertThat(c.times(), is(2));
}
Also used : AppConfig(com.yahoo.foo.AppConfig) 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