Search in sources :

Example 1 with ProcessingChain

use of com.yahoo.vespa.model.container.processing.ProcessingChain in project vespa by vespa-engine.

the class ProcessingChainsTest method testProcessingChainConfiguration.

@Test
public void testProcessingChainConfiguration() {
    ProcessingChain defaultChain = processingChains.allChains().getComponent("default");
    assertEquals("default", defaultChain.getId().stringValue());
    assertEquals(1, defaultChain.getInnerComponents().size());
    Collection<ChainedComponent<?>> outerProcessors = processingChains.getComponentGroup().getComponents();
    assertEquals(1, outerProcessors.size());
    assertEquals("processor1", outerProcessors.iterator().next().getComponentId().toString());
    Collection<Processor> innerProcessors = defaultChain.getInnerComponents();
    assertEquals("processor2", innerProcessors.iterator().next().getComponentId().toString());
}
Also used : Processor(com.yahoo.vespa.model.container.processing.Processor) ProcessingChain(com.yahoo.vespa.model.container.processing.ProcessingChain) ChainedComponent(com.yahoo.vespa.model.container.component.chain.ChainedComponent) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 2 with ProcessingChain

use of com.yahoo.vespa.model.container.processing.ProcessingChain in project vespa by vespa-engine.

the class ContainerIncludeTest method include.

@Test
public void include() {
    VespaModelCreatorWithFilePkg creator = new VespaModelCreatorWithFilePkg("src/test/cfg/container/data/containerinclude/");
    VespaModel model = creator.create();
    assertThat(model.getContainerClusters().size(), is(1));
    ContainerCluster cluster = model.getContainerClusters().values().iterator().next();
    assertThat(cluster.getSearchChains(), notNullValue());
    Map<String, SearchChain> searchChainMap = new HashMap<>();
    for (SearchChain searchChain : cluster.getSearchChains().allChains().allComponents()) {
        searchChainMap.put(searchChain.getId().stringValue(), searchChain);
    }
    assertThat(searchChainMap.get("searchchain1"), notNullValue());
    assertThat(searchChainMap.get("searchchain1").getInnerComponents().size(), is(1));
    assertThat(searchChainMap.get("searchchain1").getInnerComponents().iterator().next().getComponentId().stringValue(), is("com.yahoo.Searcher1"));
    assertThat(searchChainMap.get("searchchain2"), notNullValue());
    assertThat(searchChainMap.get("searchchain2").getInnerComponents().size(), is(1));
    assertThat(searchChainMap.get("searchchain2").getInnerComponents().iterator().next().getComponentId().stringValue(), is("com.yahoo.Searcher2"));
    assertThat(searchChainMap.get("searchchain3"), notNullValue());
    assertThat(searchChainMap.get("searchchain3").getInnerComponents().size(), is(1));
    assertThat(searchChainMap.get("searchchain3").getInnerComponents().iterator().next().getComponentId().stringValue(), is("com.yahoo.Searcher3"));
    assertThat(searchChainMap.get("searchchain4"), notNullValue());
    assertThat(searchChainMap.get("searchchain4").getInnerComponents().size(), is(1));
    assertThat(searchChainMap.get("searchchain4").getInnerComponents().iterator().next().getComponentId().stringValue(), is("com.yahoo.Searcher4"));
    assertThat(cluster.getDocprocChains(), notNullValue());
    Map<String, DocprocChain> docprocChainMap = new HashMap<>();
    for (DocprocChain docprocChain : cluster.getDocprocChains().allChains().allComponents()) {
        docprocChainMap.put(docprocChain.getId().stringValue(), docprocChain);
    }
    assertThat(docprocChainMap.get("docprocchain1"), notNullValue());
    assertThat(docprocChainMap.get("docprocchain1").getInnerComponents().size(), is(1));
    assertThat(docprocChainMap.get("docprocchain1").getInnerComponents().iterator().next().getComponentId().stringValue(), is("com.yahoo.DocumentProcessor1"));
    assertThat(docprocChainMap.get("docprocchain2"), notNullValue());
    assertThat(docprocChainMap.get("docprocchain2").getInnerComponents().size(), is(1));
    assertThat(docprocChainMap.get("docprocchain2").getInnerComponents().iterator().next().getComponentId().stringValue(), is("com.yahoo.DocumentProcessor2"));
    assertThat(cluster.getProcessingChains(), notNullValue());
    Map<String, ProcessingChain> processingChainMap = new HashMap<>();
    for (ProcessingChain processingChain : cluster.getProcessingChains().allChains().allComponents()) {
        processingChainMap.put(processingChain.getId().stringValue(), processingChain);
    }
    assertThat(processingChainMap.get("processingchain1"), notNullValue());
    assertThat(processingChainMap.get("processingchain1").getInnerComponents().size(), is(1));
    assertThat(processingChainMap.get("processingchain1").getInnerComponents().iterator().next().getComponentId().stringValue(), is("com.yahoo.Processor1"));
    assertThat(processingChainMap.get("processingchain2"), notNullValue());
    assertThat(processingChainMap.get("processingchain2").getInnerComponents().size(), is(1));
    assertThat(processingChainMap.get("processingchain2").getInnerComponents().iterator().next().getComponentId().stringValue(), is("com.yahoo.Processor2"));
}
Also used : VespaModelCreatorWithFilePkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithFilePkg) ProcessingChain(com.yahoo.vespa.model.container.processing.ProcessingChain) HashMap(java.util.HashMap) VespaModel(com.yahoo.vespa.model.VespaModel) DocprocChain(com.yahoo.vespa.model.container.docproc.DocprocChain) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) SearchChain(com.yahoo.vespa.model.container.search.searchchain.SearchChain) Test(org.junit.Test)

Example 3 with ProcessingChain

use of com.yahoo.vespa.model.container.processing.ProcessingChain in project vespa by vespa-engine.

the class ProcessingChainsTest method require_that_processors_have_correct_class.

@Test
public void require_that_processors_have_correct_class() {
    ChainedComponent<?> processor1 = processingChains.getComponentGroup().getComponents().iterator().next();
    assertEquals("com.yahoo.test.Processor1", processor1.model.bundleInstantiationSpec.classId.stringValue());
    ProcessingChain defaultChain = processingChains.allChains().getComponent("default");
    Processor processor2 = defaultChain.getInnerComponents().iterator().next();
    assertEquals("com.yahoo.test.Processor2", processor2.model.bundleInstantiationSpec.classId.stringValue());
}
Also used : Processor(com.yahoo.vespa.model.container.processing.Processor) ProcessingChain(com.yahoo.vespa.model.container.processing.ProcessingChain) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 4 with ProcessingChain

use of com.yahoo.vespa.model.container.processing.ProcessingChain in project vespa by vespa-engine.

the class ProcessingChainsTest method setupProcessingChains.

@Before
public void setupProcessingChains() {
    DomProcessingBuilder processingBuilder = new DomProcessingBuilder(null);
    processingBuilder.build(root, servicesXml());
    processingChains = (Chains<ProcessingChain>) root.getChildren().get("processing");
}
Also used : DomProcessingBuilder(com.yahoo.vespa.model.builder.xml.dom.chains.processing.DomProcessingBuilder) ProcessingChain(com.yahoo.vespa.model.container.processing.ProcessingChain) Before(org.junit.Before)

Aggregations

ProcessingChain (com.yahoo.vespa.model.container.processing.ProcessingChain)4 Test (org.junit.Test)3 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)2 Processor (com.yahoo.vespa.model.container.processing.Processor)2 VespaModel (com.yahoo.vespa.model.VespaModel)1 DomProcessingBuilder (com.yahoo.vespa.model.builder.xml.dom.chains.processing.DomProcessingBuilder)1 ChainedComponent (com.yahoo.vespa.model.container.component.chain.ChainedComponent)1 DocprocChain (com.yahoo.vespa.model.container.docproc.DocprocChain)1 SearchChain (com.yahoo.vespa.model.container.search.searchchain.SearchChain)1 VespaModelCreatorWithFilePkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithFilePkg)1 HashMap (java.util.HashMap)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 Before (org.junit.Before)1