use of com.yahoo.config.subscription.impl.GenericConfigSubscriber in project vespa by vespa-engine.
the class JRTConfigRequestBase method created_from_existing_subscription.
@Test
public void created_from_existing_subscription() {
System.setProperty("VESPA_CONFIG_PROTOCOL_VERSION", getProtocolVersion());
MockConnection connection = new MockConnection(new MockConnection.AbstractResponseHandler() {
@Override
protected void createResponse() {
JRTServerConfigRequest serverRequest = createReq(request);
serverRequest.addOkResponse(createPayload(), currentGeneration, configMd5);
}
});
ConfigSourceSet src = new ConfigSourceSet();
ConfigSubscriber subscriber = new GenericConfigSubscriber(Collections.singletonMap(src, JRTConfigRequester.get(connection, new TimingValues())));
JRTConfigSubscription<SimpletypesConfig> sub = new JRTConfigSubscription<>(new ConfigKey<>(SimpletypesConfig.class, configId), subscriber, src, new TimingValues());
sub.subscribe(120_0000);
assertTrue(sub.nextConfig(120_0000));
sub.close();
JRTClientConfigRequest nextReq = createReq(sub, Trace.createNew());
SimpletypesConfig config = sub.getConfigState().getConfig();
assertThat(nextReq.getRequestConfigMd5(), is(config.getConfigMd5()));
assertThat(nextReq.getRequestGeneration(), is(currentGeneration));
System.setProperty("VESPA_CONFIG_PROTOCOL_VERSION", "");
}
use of com.yahoo.config.subscription.impl.GenericConfigSubscriber in project vespa by vespa-engine.
the class GenericConfigSubscriberTest method testOverriddenSubscribeInvalid2.
@Test(expected = UnsupportedOperationException.class)
public void testOverriddenSubscribeInvalid2() {
GenericConfigSubscriber sub = new GenericConfigSubscriber();
sub.subscribe(null, null, 0L);
}
use of com.yahoo.config.subscription.impl.GenericConfigSubscriber in project vespa by vespa-engine.
the class GenericConfigSubscriberTest method testGenericRequesterPooling.
@Test
public void testGenericRequesterPooling() {
ConfigSourceSet source1 = new ConfigSourceSet("tcp/foo:78");
ConfigSourceSet source2 = new ConfigSourceSet("tcp/bar:79");
JRTConfigRequester req1 = JRTConfigRequester.get(new JRTConnectionPool(source1), JRTConfigRequesterTest.getTestTimingValues());
JRTConfigRequester req2 = JRTConfigRequester.get(new JRTConnectionPool(source2), JRTConfigRequesterTest.getTestTimingValues());
Map<ConfigSourceSet, JRTConfigRequester> requesters = new LinkedHashMap<>();
requesters.put(source1, req1);
requesters.put(source2, req2);
GenericConfigSubscriber sub = new GenericConfigSubscriber(requesters);
assertEquals(sub.requesters().get(source1).getConnectionPool().getCurrent().getAddress(), "tcp/foo:78");
assertEquals(sub.requesters().get(source2).getConnectionPool().getCurrent().getAddress(), "tcp/bar:79");
}
use of com.yahoo.config.subscription.impl.GenericConfigSubscriber in project vespa by vespa-engine.
the class GenericConfigSubscriberTest method testOverriddenSubscribeInvalid1.
@Test(expected = UnsupportedOperationException.class)
public void testOverriddenSubscribeInvalid1() {
GenericConfigSubscriber sub = new GenericConfigSubscriber();
sub.subscribe(null, null);
}
use of com.yahoo.config.subscription.impl.GenericConfigSubscriber in project vespa by vespa-engine.
the class GenericConfigSubscriberTest method testOverriddenSubscribeInvalid3.
@Test(expected = UnsupportedOperationException.class)
public void testOverriddenSubscribeInvalid3() {
GenericConfigSubscriber sub = new GenericConfigSubscriber();
sub.subscribe(null, null, "");
}
Aggregations