use of com.yahoo.config.subscription.impl.GenericConfigSubscriber in project vespa by vespa-engine.
the class GenericConfigSubscriberTest method testSubscribeGeneric.
@Test
public void testSubscribeGeneric() {
Map<ConfigSourceSet, JRTConfigRequester> requesters = new HashMap<>();
ConfigSourceSet sourceSet = new ConfigSourceSet("blabla");
requesters.put(sourceSet, JRTConfigRequester.get(new MockConnection(), JRTConfigRequesterTest.getTestTimingValues()));
GenericConfigSubscriber sub = new GenericConfigSubscriber(requesters);
final List<String> defContent = Arrays.asList("myVal int");
GenericConfigHandle handle = sub.subscribe(new ConfigKey<>("simpletypes", "id", "config"), defContent, sourceSet, JRTConfigRequesterTest.getTestTimingValues());
assertTrue(sub.nextConfig());
assertTrue(handle.isChanged());
// MockConnection returns empty string
assertThat(handle.getRawConfig().getPayload().withCompression(CompressionType.UNCOMPRESSED).toString(), is("{}"));
assertFalse(sub.nextConfig());
assertFalse(handle.isChanged());
}
use of com.yahoo.config.subscription.impl.GenericConfigSubscriber in project vespa by vespa-engine.
the class UpstreamConfigSubscriber method subscribe.
void subscribe() {
subscriber = new GenericConfigSubscriber(requesterPool);
ConfigKey<?> key = config.getKey();
handle = subscriber.subscribe(new ConfigKey<RawConfig>(key.getName(), key.getConfigId(), key.getNamespace()), config.getDefContent(), configSourceSet, timingValues);
}
Aggregations