Search in sources :

Example 1 with ComponentsConfig

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

the class MultipleRestApisTest method jersey_bundles_component_for_each_rest_api_is_included_in_components_config.

@Test
public void jersey_bundles_component_for_each_rest_api_is_included_in_components_config() {
    ComponentsConfig config = root.getConfig(ComponentsConfig.class, CLUSTER_ID);
    assertThat(config.toString(), containsString(".id \"" + REST_API_CONTEXT_ID_1 + "\""));
    assertThat(config.toString(), containsString(".id \"" + REST_API_CONTEXT_ID_2 + "\""));
}
Also used : ComponentsConfig(com.yahoo.container.ComponentsConfig) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 2 with ComponentsConfig

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

the class ContainerModelBuilderTest method default_root_handler_is_disabled_when_user_adds_a_handler_with_same_binding.

@Test
public void default_root_handler_is_disabled_when_user_adds_a_handler_with_same_binding() throws Exception {
    Element clusterElem = DomBuilderTest.parse("<jdisc id='default' version='1.0'>" + "  <handler id='userRootHandler'>" + "    <binding>" + ContainerCluster.ROOT_HANDLER_BINDING + "</binding>" + "  </handler>" + "</jdisc>");
    createModel(root, clusterElem);
    ComponentsConfig.Components userRootHandler = getComponent(componentsConfig(), BindingsOverviewHandler.class.getName());
    assertThat(userRootHandler, nullValue());
}
Also used : ComponentsConfig(com.yahoo.container.ComponentsConfig) Element(org.w3c.dom.Element) BindingsOverviewHandler(com.yahoo.container.usability.BindingsOverviewHandler) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest) Test(org.junit.Test)

Example 3 with ComponentsConfig

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

the class RestApiTest method restApiContext_is_included_in_components_config.

@Test
public void restApiContext_is_included_in_components_config() throws Exception {
    setup();
    ComponentsConfig config = root.getConfig(ComponentsConfig.class, ClusterId);
    assertThat(config.toString(), containsString(".id \"" + RestApiContextId + "\""));
}
Also used : ComponentsConfig(com.yahoo.container.ComponentsConfig) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 4 with ComponentsConfig

use of com.yahoo.container.ComponentsConfig 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 ComponentsConfig

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

the class RestApiTest method all_non_restApi_components_are_injected_to_RestApiContext.

@Test
public void all_non_restApi_components_are_injected_to_RestApiContext() throws Exception {
    setup();
    ComponentsConfig componentsConfig = root.getConfig(ComponentsConfig.class, ClusterId);
    Set<ComponentId> clusterChildrenComponentIds = getContainerCluster(ClusterId).getAllComponents().stream().map(Component::getComponentId).collect(Collectors.toSet());
    Set<ComponentId> restApiChildrenComponentIds = restApi.getChildren().values().stream().map(child -> ((Component<?, ?>) child).getComponentId()).collect(Collectors.toSet());
    // TODO: Review: replace with filtering against RestApiContext.isCycleGeneratingComponent
    ComponentId cycleInducingComponents = ComponentId.fromString("com.yahoo.container.handler.observability.ApplicationStatusHandler");
    Set<ComponentId> expectedInjectedConfigIds = new HashSet<>(clusterChildrenComponentIds);
    expectedInjectedConfigIds.removeAll(restApiChildrenComponentIds);
    expectedInjectedConfigIds.remove(cycleInducingComponents);
    Set<ComponentId> injectedConfigIds = restApiContextConfig(componentsConfig).inject().stream().map(inject -> ComponentId.fromString(inject.id())).collect(Collectors.toSet());
    // Verify that the two sets are equal. Split in two asserts to get decent failure messages.
    assertThat("Not all required components are injected", injectedConfigIds, containsInAnyOrder(expectedInjectedConfigIds.toArray()));
    assertThat("We inject some components that should not be injected", expectedInjectedConfigIds, containsInAnyOrder(injectedConfigIds.toArray()));
}
Also used : ComponentsConfig(com.yahoo.container.ComponentsConfig) CoreMatchers.is(org.hamcrest.CoreMatchers.is) CoreMatchers.hasItem(org.hamcrest.CoreMatchers.hasItem) Handler(com.yahoo.vespa.model.container.component.Handler) ComponentId(com.yahoo.component.ComponentId) CoreMatchers.not(org.hamcrest.CoreMatchers.not) HashSet(java.util.HashSet) RestApiContext(com.yahoo.vespa.model.container.jersey.RestApiContext) JerseyBundlesConfig(com.yahoo.container.di.config.JerseyBundlesConfig) RestApi(com.yahoo.vespa.model.container.jersey.RestApi) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) CoreMatchers.nullValue(org.hamcrest.CoreMatchers.nullValue) JerseyInitConfig(com.yahoo.container.config.jersey.JerseyInitConfig) Component(com.yahoo.vespa.model.container.component.Component) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) CoreMatchers.hasItems(org.hamcrest.CoreMatchers.hasItems) JdiscBindingsConfig(com.yahoo.container.jdisc.JdiscBindingsConfig) JerseyHandler(com.yahoo.vespa.model.container.jersey.JerseyHandler) Set(java.util.Set) Test(org.junit.Test) ContainerModelBuilderTestBase(com.yahoo.vespa.model.container.xml.ContainerModelBuilderTestBase) Collectors(java.util.stream.Collectors) JerseyInjectionConfig(com.yahoo.container.di.config.JerseyInjectionConfig) Ignore(org.junit.Ignore) Matchers.contains(org.hamcrest.Matchers.contains) Matchers.containsInAnyOrder(org.hamcrest.Matchers.containsInAnyOrder) ComponentsConfig(com.yahoo.container.ComponentsConfig) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest) Component(com.yahoo.vespa.model.container.component.Component) ComponentId(com.yahoo.component.ComponentId) HashSet(java.util.HashSet) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Aggregations

ComponentsConfig (com.yahoo.container.ComponentsConfig)7 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)6 Test (org.junit.Test)6 ComponentId (com.yahoo.component.ComponentId)1 DocprocConfig (com.yahoo.config.docproc.DocprocConfig)1 SchemamappingConfig (com.yahoo.config.docproc.SchemamappingConfig)1 BundlesConfig (com.yahoo.container.BundlesConfig)1 JerseyInitConfig (com.yahoo.container.config.jersey.JerseyInitConfig)1 ChainsConfig (com.yahoo.container.core.ChainsConfig)1 JerseyBundlesConfig (com.yahoo.container.di.config.JerseyBundlesConfig)1 JerseyInjectionConfig (com.yahoo.container.di.config.JerseyInjectionConfig)1 ContainerMbusConfig (com.yahoo.container.jdisc.ContainerMbusConfig)1 JdiscBindingsConfig (com.yahoo.container.jdisc.JdiscBindingsConfig)1 BindingsOverviewHandler (com.yahoo.container.usability.BindingsOverviewHandler)1 DocumentmanagerConfig (com.yahoo.document.config.DocumentmanagerConfig)1 QrStartConfig (com.yahoo.search.config.QrStartConfig)1 ContainerModel (com.yahoo.vespa.model.container.ContainerModel)1 Component (com.yahoo.vespa.model.container.component.Component)1 Handler (com.yahoo.vespa.model.container.component.Handler)1 JerseyHandler (com.yahoo.vespa.model.container.jersey.JerseyHandler)1