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));
}
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));
}
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));
}
Aggregations