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());
}
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"));
}
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());
}
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");
}
Aggregations