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());
}
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);
}
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));
}
Aggregations