Search in sources :

Example 1 with ConfigSet

use of com.yahoo.config.subscription.ConfigSet in project vespa by vespa-engine.

the class JRTConfigRequestBase method created_from_subscription.

@Test
public void created_from_subscription() {
    ConfigSubscriber subscriber = new ConfigSubscriber();
    JRTConfigSubscription<SimpletypesConfig> sub = new JRTConfigSubscription<>(new ConfigKey<>(SimpletypesConfig.class, configId), subscriber, new ConfigSet(), new TimingValues());
    JRTClientConfigRequest request = createReq(sub, Trace.createNew(9));
    assertThat(request.getConfigKey().getName(), is(SimpletypesConfig.CONFIG_DEF_NAME));
    JRTServerConfigRequest serverRequest = createReq(request.getRequest());
    assertTrue(serverRequest.validateParameters());
}
Also used : SimpletypesConfig(com.yahoo.foo.SimpletypesConfig) GenericConfigSubscriber(com.yahoo.config.subscription.impl.GenericConfigSubscriber) ConfigSubscriber(com.yahoo.config.subscription.ConfigSubscriber) TimingValues(com.yahoo.vespa.config.TimingValues) JRTConfigSubscription(com.yahoo.config.subscription.impl.JRTConfigSubscription) ConfigSet(com.yahoo.config.subscription.ConfigSet) Test(org.junit.Test)

Example 2 with ConfigSet

use of com.yahoo.config.subscription.ConfigSet 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);
}
Also used : FunctionTestConfig(com.yahoo.foo.FunctionTestConfig) ConfigSubscriber(com.yahoo.config.subscription.ConfigSubscriber) TimingValues(com.yahoo.vespa.config.TimingValues) JRTConfigSubscription(com.yahoo.config.subscription.impl.JRTConfigSubscription) ConfigSet(com.yahoo.config.subscription.ConfigSet) Test(org.junit.Test)

Example 3 with ConfigSet

use of com.yahoo.config.subscription.ConfigSet in project vespa by vespa-engine.

the class ConfigAgentTestCase method testRoutingConfig.

@Test
public void testRoutingConfig() throws InterruptedException, IOException {
    LocalHandler handler = new LocalHandler();
    assertFalse(testHalf(handler.spec));
    assertFalse(testFull(handler.spec));
    ConfigSet set = new ConfigSet();
    set.addBuilder("test", writeFull());
    ConfigAgent agent = new ConfigAgent(ConfigURI.createFromIdAndSource("test", set), handler);
    assertFalse(testHalf(handler.spec));
    assertFalse(testFull(handler.spec));
    agent.subscribe();
    assertFalse(testHalf(handler.spec));
    assertTrue(testFull(handler.spec));
    handler.reset();
    set.addBuilder("test", writeHalf());
    assertTrue(handler.await(120, TimeUnit.SECONDS));
    assertTrue(testHalf(handler.spec));
    assertFalse(testFull(handler.spec));
    handler.reset();
    set.addBuilder("test", writeFull());
    assertTrue(handler.await(120, TimeUnit.SECONDS));
    assertTrue(testFull(handler.spec));
    assertFalse(testHalf(handler.spec));
}
Also used : ConfigSet(com.yahoo.config.subscription.ConfigSet) Test(org.junit.Test)

Aggregations

ConfigSet (com.yahoo.config.subscription.ConfigSet)3 Test (org.junit.Test)3 ConfigSubscriber (com.yahoo.config.subscription.ConfigSubscriber)2 JRTConfigSubscription (com.yahoo.config.subscription.impl.JRTConfigSubscription)2 TimingValues (com.yahoo.vespa.config.TimingValues)2 GenericConfigSubscriber (com.yahoo.config.subscription.impl.GenericConfigSubscriber)1 FunctionTestConfig (com.yahoo.foo.FunctionTestConfig)1 SimpletypesConfig (com.yahoo.foo.SimpletypesConfig)1