use of com.yahoo.config.subscription.ConfigSubscriber in project vespa by vespa-engine.
the class JRTConfigRequesterTest method testClosedSubscription.
@Test
public void testClosedSubscription() {
ConfigSubscriber subscriber = new ConfigSubscriber();
final TimingValues timingValues = getTestTimingValues();
JRTConfigSubscription<SimpletypesConfig> sub = createSubscription(subscriber, timingValues);
sub.close();
final MockConnection connection = new MockConnection(new MockConnection.OKResponseHandler());
JRTConfigRequester requester = new JRTConfigRequester(connection, timingValues);
requester.request(sub);
assertThat(connection.getNumberOfRequests(), is(1));
// Check that no further request was sent?
try {
Thread.sleep(timingValues.getFixedDelay() * 2);
} catch (InterruptedException e) {
e.printStackTrace();
}
assertThat(connection.getNumberOfRequests(), is(1));
}
use of com.yahoo.config.subscription.ConfigSubscriber in project vespa by vespa-engine.
the class JRTConfigRequesterTest method testFatalErrorSubscribed.
@Test
public void testFatalErrorSubscribed() {
ConfigSubscriber subscriber = new ConfigSubscriber();
final TimingValues timingValues = getTestTimingValues();
JRTConfigSubscription<SimpletypesConfig> sub = createSubscription(subscriber, timingValues);
sub.setConfig(1L, config());
final MockConnection connection = new MockConnection(new ErrorResponseHandler());
JRTConfigRequester requester = new JRTConfigRequester(connection, timingValues);
requester.request(sub);
waitUntilResponse(connection);
assertThat(requester.getFatalFailures(), is(1));
assertThat(requester.getTransientFailures(), is(0));
}
use of com.yahoo.config.subscription.ConfigSubscriber in project vespa by vespa-engine.
the class ExternalSlobrokPolicy method subscribe.
private ConfigSubscriber subscribe(String configId, final ConfigSourceSet configSourceSet) {
ConfigSubscriber subscriber = new ConfigSubscriber(configSourceSet);
subscriber.subscribe(this, SlobroksConfig.class, configId);
return subscriber;
}
Aggregations