Search in sources :

Example 6 with ComponentId

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));
}
Also used : Components(com.yahoo.container.core.ChainsConfig.Components) Chains(com.yahoo.container.core.ChainsConfig.Chains) ComponentId(com.yahoo.component.ComponentId)

Example 7 with ComponentId

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;
}
Also used : QueryProfileTypeRegistry(com.yahoo.search.query.profile.types.QueryProfileTypeRegistry) QueryProfileRegistry(com.yahoo.search.query.profile.QueryProfileRegistry) QueryProfileType(com.yahoo.search.query.profile.types.QueryProfileType) ComponentId(com.yahoo.component.ComponentId) FieldDescription(com.yahoo.search.query.profile.types.FieldDescription)

Example 8 with ComponentId

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;
}
Also used : RequestHandler(com.yahoo.jdisc.handler.RequestHandler) AbstractRequestHandler(com.yahoo.jdisc.handler.AbstractRequestHandler) JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray) Map(java.util.Map) ComponentId(com.yahoo.component.ComponentId)

Example 9 with ComponentId

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;
}
Also used : RequestHandler(com.yahoo.jdisc.handler.RequestHandler) AbstractRequestHandler(com.yahoo.jdisc.handler.AbstractRequestHandler) JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray) Map(java.util.Map) ComponentId(com.yahoo.component.ComponentId)

Example 10 with ComponentId

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"));
    }
}
Also used : ServerConfig(com.yahoo.jdisc.http.ServerConfig) RequestFilter(com.yahoo.jdisc.http.filter.RequestFilter) SecurityRequestFilter(com.yahoo.jdisc.http.filter.SecurityRequestFilter) ResponseFilter(com.yahoo.jdisc.http.filter.ResponseFilter) SecurityResponseFilter(com.yahoo.jdisc.http.filter.SecurityResponseFilter) ChainsConfig(com.yahoo.container.core.ChainsConfig) FilterChainRepository(com.yahoo.container.http.filter.FilterChainRepository) ComponentId(com.yahoo.component.ComponentId) Test(org.junit.Test)

Aggregations

ComponentId (com.yahoo.component.ComponentId)68 Test (org.junit.Test)25 Result (com.yahoo.search.Result)14 Query (com.yahoo.search.Query)13 Execution (com.yahoo.search.searchchain.Execution)13 ArrayList (java.util.ArrayList)10 Chain (com.yahoo.component.chain.Chain)8 Searcher (com.yahoo.search.Searcher)8 ComponentRegistry (com.yahoo.component.provider.ComponentRegistry)7 QueryProfileType (com.yahoo.search.query.profile.types.QueryProfileType)7 FederationSearcher (com.yahoo.search.federation.FederationSearcher)6 Hit (com.yahoo.search.result.Hit)6 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)6 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)4 ChainsConfig (com.yahoo.container.core.ChainsConfig)4 FilterChainRepository (com.yahoo.container.http.filter.FilterChainRepository)4 FieldDescription (com.yahoo.search.query.profile.types.FieldDescription)4 QueryProfileTypeRegistry (com.yahoo.search.query.profile.types.QueryProfileTypeRegistry)4 Component (com.yahoo.vespa.model.container.component.Component)4 HashMap (java.util.HashMap)4