Search in sources :

Example 6 with GenericConfigSubscriber

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());
}
Also used : GenericConfigHandle(com.yahoo.config.subscription.impl.GenericConfigHandle) JRTConfigRequester(com.yahoo.config.subscription.impl.JRTConfigRequester) GenericConfigSubscriber(com.yahoo.config.subscription.impl.GenericConfigSubscriber) MockConnection(com.yahoo.config.subscription.impl.MockConnection) JRTConfigRequesterTest(com.yahoo.config.subscription.impl.JRTConfigRequesterTest) Test(org.junit.Test)

Example 7 with GenericConfigSubscriber

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);
}
Also used : ConfigKey(com.yahoo.vespa.config.ConfigKey) GenericConfigSubscriber(com.yahoo.config.subscription.impl.GenericConfigSubscriber)

Aggregations

GenericConfigSubscriber (com.yahoo.config.subscription.impl.GenericConfigSubscriber)7 Test (org.junit.Test)6 JRTConfigRequesterTest (com.yahoo.config.subscription.impl.JRTConfigRequesterTest)5 JRTConfigRequester (com.yahoo.config.subscription.impl.JRTConfigRequester)2 MockConnection (com.yahoo.config.subscription.impl.MockConnection)2 ConfigSourceSet (com.yahoo.config.subscription.ConfigSourceSet)1 ConfigSubscriber (com.yahoo.config.subscription.ConfigSubscriber)1 GenericConfigHandle (com.yahoo.config.subscription.impl.GenericConfigHandle)1 JRTConfigSubscription (com.yahoo.config.subscription.impl.JRTConfigSubscription)1 SimpletypesConfig (com.yahoo.foo.SimpletypesConfig)1 ConfigKey (com.yahoo.vespa.config.ConfigKey)1 JRTConnectionPool (com.yahoo.vespa.config.JRTConnectionPool)1 TimingValues (com.yahoo.vespa.config.TimingValues)1