use of com.yahoo.component.ComponentId in project vespa by vespa-engine.
the class DomSearchChainsBuilderTest method checkInnerSearcherIdIsNestedInSearchChainId.
private void checkInnerSearcherIdIsNestedInSearchChainId(ChainsConfig config, String partOfSearcherName, String searchChainName) {
Components searcher = getSearcherConfig(config.components(), partOfSearcherName);
ComponentId searcherId = ComponentId.fromString(searcher.id());
assertThat(searcherId.getNamespace(), is(getSearchChain(searchChainName).getComponentId()));
Chains searchChain = getSearchChainConfig(config.chains(), searchChainName);
assertThat(ComponentId.fromString(searchChain.components(0)), is(searcherId));
}
use of com.yahoo.component.ComponentId in project vespa by vespa-engine.
the class TensorTransformTestCase method setupQueryProfileTypes.
private static QueryProfileRegistry setupQueryProfileTypes() {
QueryProfileRegistry registry = new QueryProfileRegistry();
QueryProfileTypeRegistry typeRegistry = registry.getTypeRegistry();
QueryProfileType type = new QueryProfileType(new ComponentId("testtype"));
type.addField(new FieldDescription("ranking.features.query(q)", FieldType.fromString("tensor(x{})", typeRegistry)), typeRegistry);
type.addField(new FieldDescription("ranking.features.query(n)", FieldType.fromString("integer", typeRegistry)), typeRegistry);
typeRegistry.register(type);
return registry;
}
use of com.yahoo.component.ComponentId in project vespa by vespa-engine.
the class BindingsOverviewHandler method renderRequestHandlers.
static JSONArray renderRequestHandlers(JdiscBindingsConfig bindingsConfig, Map<ComponentId, ? extends RequestHandler> handlersById) {
JSONArray ret = new JSONArray();
for (Map.Entry<ComponentId, ? extends RequestHandler> handlerEntry : handlersById.entrySet()) {
String id = handlerEntry.getKey().stringValue();
RequestHandler handler = handlerEntry.getValue();
JSONObject handlerJson = renderComponent(handler, handlerEntry.getKey());
addBindings(bindingsConfig, id, handlerJson);
ret.put(handlerJson);
}
return ret;
}
use of com.yahoo.component.ComponentId in project vespa by vespa-engine.
the class ApplicationStatusHandler method renderRequestHandlers.
static JSONArray renderRequestHandlers(JdiscBindingsConfig bindingsConfig, Map<ComponentId, ? extends RequestHandler> handlersById) {
JSONArray ret = new JSONArray();
for (Map.Entry<ComponentId, ? extends RequestHandler> handlerEntry : handlersById.entrySet()) {
String id = handlerEntry.getKey().stringValue();
RequestHandler handler = handlerEntry.getValue();
JSONObject handlerJson = renderComponent(handler, handlerEntry.getKey());
addBindings(bindingsConfig, id, handlerJson);
ret.put(handlerJson);
}
return ret;
}
use of com.yahoo.component.ComponentId in project vespa by vespa-engine.
the class FilterBindingsProviderTest method requireThatConfigWithUnknownReferenceFails.
@Test
public void requireThatConfigWithUnknownReferenceFails() {
// Set up config.
configBuilder.filter(new ServerConfig.Filter.Builder().id("someFilter").binding("http://*/*"));
// Set up registry.
final FilterChainRepository filterChainRepository = new FilterChainRepository(new ChainsConfig(new ChainsConfig.Builder()), new ComponentRegistry<>(), new ComponentRegistry<>(), new ComponentRegistry<>(), new ComponentRegistry<>());
try {
new FilterBindingsProvider(new ComponentId("foo"), new ServerConfig(configBuilder), filterChainRepository, new ComponentRegistry<>());
fail("Config with unknown filter reference should not be accepted");
} catch (RuntimeException e) {
assertThat(e.getMessage(), containsString("Invalid config"));
}
}
Aggregations