use of com.yahoo.vespa.config.TimingValues 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.vespa.config.TimingValues 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));
}
Aggregations