Search in sources :

Example 16 with TimingValues

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));
}
Also used : SimpletypesConfig(com.yahoo.foo.SimpletypesConfig) ConfigSubscriber(com.yahoo.config.subscription.ConfigSubscriber) TimingValues(com.yahoo.vespa.config.TimingValues) Test(org.junit.Test)

Example 17 with TimingValues

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));
}
Also used : SimpletypesConfig(com.yahoo.foo.SimpletypesConfig) ConfigSubscriber(com.yahoo.config.subscription.ConfigSubscriber) TimingValues(com.yahoo.vespa.config.TimingValues) Test(org.junit.Test)

Aggregations

TimingValues (com.yahoo.vespa.config.TimingValues)17 Test (org.junit.Test)17 ConfigSubscriber (com.yahoo.config.subscription.ConfigSubscriber)12 SimpletypesConfig (com.yahoo.foo.SimpletypesConfig)10 JRTConfigSubscription (com.yahoo.config.subscription.impl.JRTConfigSubscription)3 AppConfig (com.yahoo.foo.AppConfig)3 ConfigSet (com.yahoo.config.subscription.ConfigSet)2 GenericConfigSubscriber (com.yahoo.config.subscription.impl.GenericConfigSubscriber)2 ConfigSourceSet (com.yahoo.config.subscription.ConfigSourceSet)1 DirSource (com.yahoo.config.subscription.DirSource)1 MockConnection (com.yahoo.config.subscription.impl.MockConnection)1 FunctionTestConfig (com.yahoo.foo.FunctionTestConfig)1 TestReferenceConfig (com.yahoo.foo.TestReferenceConfig)1 Request (com.yahoo.jrt.Request)1 ConfigKey (com.yahoo.vespa.config.ConfigKey)1 JRTServerConfigRequestV3 (com.yahoo.vespa.config.protocol.JRTServerConfigRequestV3)1 File (java.io.File)1 Random (java.util.Random)1