Search in sources :

Example 1 with ChainsConfig

use of com.yahoo.container.core.ChainsConfig in project vespa by vespa-engine.

the class ChainsModelBuilderTest method chainsModel.

private ChainsModel chainsModel() {
    ChainsConfig.Builder builder = new ChainsConfig.Builder().components(new Components.Builder().id("componentA")).components(new Components.Builder().id("componentB")).chains(new Chains.Builder().id("chain1").components("componentA").components("componentB")).chains(new Chains.Builder().id("inheritsChain1").inherits("chain1").excludes("componentA"));
    ChainsConfig config = new ChainsConfig(builder);
    ChainsModel model = ChainsModelBuilder.buildFromConfig(config);
    model.validate();
    return model;
}
Also used : Components(com.yahoo.container.core.ChainsConfig.Components) Chains(com.yahoo.container.core.ChainsConfig.Chains) ChainsConfig(com.yahoo.container.core.ChainsConfig)

Example 2 with ChainsConfig

use of com.yahoo.container.core.ChainsConfig in project vespa by vespa-engine.

the class DomSearchChainsBuilderTest method checkInnerSearcherIdIsNestedInSearchChainId.

@Test
public void checkInnerSearcherIdIsNestedInSearchChainId() {
    ChainsConfig.Builder builder = new ChainsConfig.Builder();
    searchChains.getConfig(builder);
    ChainsConfig config = new ChainsConfig(builder);
    checkInnerSearcherIdIsNestedInSearchChainId(config, "federationSearcher", "default");
    checkInnerSearcherIdIsNestedInSearchChainId(config, "VespaSearcher", "provider");
}
Also used : ChainsConfig(com.yahoo.container.core.ChainsConfig) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 3 with ChainsConfig

use of com.yahoo.container.core.ChainsConfig 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)

Example 4 with ChainsConfig

use of com.yahoo.container.core.ChainsConfig in project vespa by vespa-engine.

the class DocprocBuilderTest method setupCluster.

@Before
public void setupCluster() {
    ContainerModel model = new ContainerModelBuilder(false, Networking.disable).build(DeployState.createTestState(), null, root, servicesXml());
    cluster = model.getCluster();
    cluster.getDocproc().getChains().addServersAndClientsForChains();
    root.freezeModelTopology();
    containerMbusConfig = root.getConfig(ContainerMbusConfig.class, cluster.getContainers().get(0).getConfigId());
    componentsConfig = root.getConfig(ComponentsConfig.class, cluster.getConfigId());
    chainsConfig = root.getConfig(ChainsConfig.class, cluster.getConfigId() + "/component/com.yahoo.docproc.jdisc.DocumentProcessingHandler");
    documentmanagerConfig = root.getConfig(DocumentmanagerConfig.class, cluster.getConfigId());
    bundlesConfig = root.getConfig(BundlesConfig.class, cluster.getConfigId());
    schemamappingConfig = root.getConfig(SchemamappingConfig.class, cluster.getContainers().get(0).getConfigId());
    qrStartConfig = root.getConfig(QrStartConfig.class, cluster.getConfigId());
    docprocConfig = root.getConfig(DocprocConfig.class, cluster.getConfigId());
}
Also used : ComponentsConfig(com.yahoo.container.ComponentsConfig) BundlesConfig(com.yahoo.container.BundlesConfig) DocprocConfig(com.yahoo.config.docproc.DocprocConfig) SchemamappingConfig(com.yahoo.config.docproc.SchemamappingConfig) DocumentmanagerConfig(com.yahoo.document.config.DocumentmanagerConfig) ChainsConfig(com.yahoo.container.core.ChainsConfig) QrStartConfig(com.yahoo.search.config.QrStartConfig) ContainerMbusConfig(com.yahoo.container.jdisc.ContainerMbusConfig) ContainerModel(com.yahoo.vespa.model.container.ContainerModel) Before(org.junit.Before)

Example 5 with ChainsConfig

use of com.yahoo.container.core.ChainsConfig in project vespa by vespa-engine.

the class SearchChainsTest method subscribe.

@Before
public void subscribe() {
    ChainsConfig.Builder chainsBuilder = new ChainsConfig.Builder();
    chainsBuilder = (ChainsConfig.Builder) root.getConfig(chainsBuilder, "searchchains");
    chainsConfig = new ChainsConfig(chainsBuilder);
    ProviderConfig.Builder providerBuilder = new ProviderConfig.Builder();
    providerBuilder = (ProviderConfig.Builder) root.getConfig(providerBuilder, "searchchains/chain/provider:1/component/com.yahoo.search.federation.vespa.VespaSearcher");
    providerConfig = new ProviderConfig(providerBuilder);
    ClusterConfig.Builder clusterBuilder = new ClusterConfig.Builder();
    clusterBuilder = (ClusterConfig.Builder) root.getConfig(clusterBuilder, "searchchains/chain/cluster2/component/" + ClusterSearcher.class.getName());
    clusterConfig = new ClusterConfig(clusterBuilder);
}
Also used : ProviderConfig(com.yahoo.search.federation.ProviderConfig) ChainsConfig(com.yahoo.container.core.ChainsConfig) ClusterConfig(com.yahoo.search.config.ClusterConfig) Before(org.junit.Before)

Aggregations

ChainsConfig (com.yahoo.container.core.ChainsConfig)8 Test (org.junit.Test)5 ComponentId (com.yahoo.component.ComponentId)4 FilterChainRepository (com.yahoo.container.http.filter.FilterChainRepository)4 ServerConfig (com.yahoo.jdisc.http.ServerConfig)4 RequestFilter (com.yahoo.jdisc.http.filter.RequestFilter)3 ResponseFilter (com.yahoo.jdisc.http.filter.ResponseFilter)3 SecurityRequestFilter (com.yahoo.jdisc.http.filter.SecurityRequestFilter)3 SecurityResponseFilter (com.yahoo.jdisc.http.filter.SecurityResponseFilter)3 ComponentRegistry (com.yahoo.component.provider.ComponentRegistry)2 FilterBindings (com.yahoo.jdisc.http.server.FilterBindings)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)2 Before (org.junit.Before)2 DocprocConfig (com.yahoo.config.docproc.DocprocConfig)1 SchemamappingConfig (com.yahoo.config.docproc.SchemamappingConfig)1 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)1 BundlesConfig (com.yahoo.container.BundlesConfig)1 ComponentsConfig (com.yahoo.container.ComponentsConfig)1 Chains (com.yahoo.container.core.ChainsConfig.Chains)1 Components (com.yahoo.container.core.ChainsConfig.Components)1