use of com.yahoo.vespa.config.TimingValues in project vespa by vespa-engine.
the class JRTConfigRequesterTest method testUnknownConfigDefinitionError.
@Test
public void testUnknownConfigDefinitionError() {
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(ErrorCode.UNKNOWN_DEFINITION));
JRTConfigRequester requester = new JRTConfigRequester(connection, timingValues);
assertThat(requester.getConnectionPool(), is(connection));
requester.request(sub);
waitUntilResponse(connection);
assertThat(requester.getFatalFailures(), is(1));
assertThat(requester.getTransientFailures(), is(0));
// TODO Check that no further request was sent?
}
use of com.yahoo.vespa.config.TimingValues in project vespa by vespa-engine.
the class JRTConfigRequesterTest method testFatalError.
@Test
public void testFatalError() {
ConfigSubscriber subscriber = new ConfigSubscriber();
final TimingValues timingValues = getTestTimingValues();
final MockConnection connection = new MockConnection(new ErrorResponseHandler());
JRTConfigRequester requester = new JRTConfigRequester(connection, timingValues);
requester.request(createSubscription(subscriber, timingValues));
waitUntilResponse(connection);
assertThat(requester.getFatalFailures(), is(1));
assertThat(requester.getTransientFailures(), is(0));
}
use of com.yahoo.vespa.config.TimingValues in project vespa by vespa-engine.
the class JRTConfigRequesterTest method testTimeout.
@Test
public void testTimeout() {
ConfigSubscriber subscriber = new ConfigSubscriber();
final TimingValues timingValues = getTestTimingValues();
JRTConfigSubscription<SimpletypesConfig> sub = createSubscription(subscriber, timingValues);
sub.close();
final MockConnection connection = new MockConnection(new DelayedResponseHandler(timingValues.getSubscribeTimeout()), // fake that we have more than one source
2);
JRTConfigRequester requester = new JRTConfigRequester(connection, timingValues);
requester.request(createSubscription(subscriber, timingValues));
// Check that no further request was sent?
try {
Thread.sleep(timingValues.getFixedDelay() * 2);
} catch (InterruptedException e) {
e.printStackTrace();
}
assertTrue(connection.getNumberOfFailovers() >= 1);
}
use of com.yahoo.vespa.config.TimingValues in project vespa by vespa-engine.
the class JRTConfigRequesterTest method testTransientError.
@Test
public void testTransientError() {
ConfigSubscriber subscriber = new ConfigSubscriber();
final TimingValues timingValues = getTestTimingValues();
final MockConnection connection = new MockConnection(new ErrorResponseHandler(com.yahoo.jrt.ErrorCode.TIMEOUT));
JRTConfigRequester requester = new JRTConfigRequester(connection, timingValues);
requester.request(createSubscription(subscriber, timingValues));
waitUntilResponse(connection);
assertThat(requester.getFatalFailures(), is(0));
assertThat(requester.getTransientFailures(), is(1));
}
use of com.yahoo.vespa.config.TimingValues in project vespa by vespa-engine.
the class JRTConfigRequestFactoryTest method testCreateFromSub.
@Test
public void testCreateFromSub() {
ConfigSubscriber subscriber = new ConfigSubscriber();
Class<FunctionTestConfig> clazz = FunctionTestConfig.class;
final String configId = "foo";
JRTConfigSubscription<FunctionTestConfig> sub = new JRTConfigSubscription<>(new ConfigKey<>(clazz, configId), subscriber, new ConfigSet(), new TimingValues());
// Default vespa version
JRTClientConfigRequest request = JRTConfigRequestFactory.createFromSub(sub);
assertThat(request.getProtocolVersion(), is(3L));
assertThat(request.getVespaVersion().get(), is(defaultVespaVersion));
// Create with vespa version set
String version = "5.37.38";
System.setProperty(JRTConfigRequestFactory.VESPA_VERSION, version);
request = JRTConfigRequestFactory.createFromSub(sub);
assertThat(request.getProtocolVersion(), is(3L));
assertThat(request.getVespaVersion().get(), is(VespaVersion.fromString(version)));
System.clearProperty(JRTConfigRequestFactory.VESPA_VERSION);
}
Aggregations