Search in sources :

Example 1 with JRTServerConfigRequestV3

use of com.yahoo.vespa.config.protocol.JRTServerConfigRequestV3 in project vespa by vespa-engine.

the class JRTConfigRequesterTest method testFirstRequestAfterSubscribing.

@Test
public void testFirstRequestAfterSubscribing() {
    ConfigSubscriber subscriber = new ConfigSubscriber();
    final TimingValues timingValues = getTestTimingValues();
    JRTConfigSubscription<SimpletypesConfig> sub = createSubscription(subscriber, timingValues);
    final MockConnection connection = new MockConnection();
    JRTConfigRequester requester = new JRTConfigRequester(connection, timingValues);
    assertThat(requester.getConnectionPool(), is(connection));
    requester.request(sub);
    final Request request = connection.getRequest();
    assertNotNull(request);
    assertThat(connection.getNumberOfRequests(), is(1));
    JRTServerConfigRequestV3 receivedRequest = JRTServerConfigRequestV3.createFromRequest(request);
    assertTrue(receivedRequest.validateParameters());
    assertThat(receivedRequest.getTimeout(), is(timingValues.getSubscribeTimeout()));
    assertThat(requester.getFatalFailures(), is(0));
    assertThat(requester.getTransientFailures(), is(0));
}
Also used : SimpletypesConfig(com.yahoo.foo.SimpletypesConfig) ConfigSubscriber(com.yahoo.config.subscription.ConfigSubscriber) TimingValues(com.yahoo.vespa.config.TimingValues) Request(com.yahoo.jrt.Request) JRTServerConfigRequestV3(com.yahoo.vespa.config.protocol.JRTServerConfigRequestV3) Test(org.junit.Test)

Example 2 with JRTServerConfigRequestV3

use of com.yahoo.vespa.config.protocol.JRTServerConfigRequestV3 in project vespa by vespa-engine.

the class RpcServer method getConfigV3.

/**
 * Called by reflection from RPC.
 * Handles RPC method "config.v3.getConfig" requests.
 * Uses the template pattern to call methods in classes that extend RpcServer.
 */
@SuppressWarnings({ "UnusedDeclaration" })
public final void getConfigV3(Request req) {
    if (log.isLoggable(LogLevel.SPAM)) {
        log.log(LogLevel.SPAM, getConfigMethodName);
    }
    req.detach();
    JRTServerConfigRequestV3 request = JRTServerConfigRequestV3.createFromRequest(req);
    addToRequestQueue(request);
    hostLivenessTracker.receivedRequestFrom(request.getClientHostName());
}
Also used : JRTServerConfigRequestV3(com.yahoo.vespa.config.protocol.JRTServerConfigRequestV3)

Example 3 with JRTServerConfigRequestV3

use of com.yahoo.vespa.config.protocol.JRTServerConfigRequestV3 in project vespa by vespa-engine.

the class SuperModelControllerTest method test_unknown_config_definition.

@Test(expected = UnknownConfigDefinitionException.class)
public void test_unknown_config_definition() {
    String md5 = "asdfasf";
    Request request = JRTClientConfigRequestV3.createWithParams(new ConfigKey<>("foo", "id", "bar", md5, null), DefContent.fromList(Collections.emptyList()), "fromHost", md5, 1, 1, Trace.createDummy(), CompressionType.UNCOMPRESSED, Optional.empty()).getRequest();
    JRTServerConfigRequestV3 v3Request = JRTServerConfigRequestV3.createFromRequest(request);
    handler.resolveConfig(v3Request);
}
Also used : ConfigKey(com.yahoo.vespa.config.ConfigKey) Request(com.yahoo.jrt.Request) JRTServerConfigRequestV3(com.yahoo.vespa.config.protocol.JRTServerConfigRequestV3) Test(org.junit.Test)

Aggregations

JRTServerConfigRequestV3 (com.yahoo.vespa.config.protocol.JRTServerConfigRequestV3)3 Request (com.yahoo.jrt.Request)2 Test (org.junit.Test)2 ConfigSubscriber (com.yahoo.config.subscription.ConfigSubscriber)1 SimpletypesConfig (com.yahoo.foo.SimpletypesConfig)1 ConfigKey (com.yahoo.vespa.config.ConfigKey)1 TimingValues (com.yahoo.vespa.config.TimingValues)1