Search in sources :

Example 1 with FederationSearcher

use of com.yahoo.vespa.model.container.search.searchchain.FederationSearcher in project vespa by vespa-engine.

the class DomFederationSearcherBuilderTest method ensureCorrectModel.

@Test
public void ensureCorrectModel() {
    FederationSearcher searcher = new DomFederationSearcherBuilder().doBuild(root, parse("<federation id='theId'>", "    <provides>p2</provides>", "    <source-set inherits=\"default\" />", "    <source id='source1'>", "        <federationoptions optional='true' />", "    </source>", "    <source id='source2' />", "</federation>"));
    FederationSearcherModel model = searcher.model;
    assertEquals("theId", model.bundleInstantiationSpec.id.stringValue());
    assertEquals(com.yahoo.search.federation.FederationSearcher.class.getName(), model.bundleInstantiationSpec.classId.stringValue());
    assertEquals(2, model.targets.size());
    assertTrue("source-set option was ignored", model.inheritDefaultSources);
    assertThat(targetNames(model.targets), hasItems("source1", "source2"));
}
Also used : FederationSearcher(com.yahoo.vespa.model.container.search.searchchain.FederationSearcher) FederationSearcherModel(com.yahoo.search.searchchain.model.federation.FederationSearcherModel) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 2 with FederationSearcher

use of com.yahoo.vespa.model.container.search.searchchain.FederationSearcher in project vespa by vespa-engine.

the class DomFederationSearcherBuilderTest method require_that_target_selector_can_be_configured.

@Test
public void require_that_target_selector_can_be_configured() {
    FederationSearcher searcher = new DomFederationSearcherBuilder().doBuild(root, parse("<federation id='federation-id'>", "    <target-selector id='my-id' class='my-class' />", "</federation>"));
    String targetSelectorId = "my-id@federation-id";
    AbstractConfigProducer<?> targetSelector = searcher.getChildren().get(targetSelectorId);
    assertNotNull("No target selector child found", targetSelector);
    FederationConfig.Builder builder = new FederationConfig.Builder();
    searcher.getConfig(builder);
    assertThat(new FederationConfig(builder).targetSelector(), is(targetSelectorId));
}
Also used : FederationSearcher(com.yahoo.vespa.model.container.search.searchchain.FederationSearcher) FederationConfig(com.yahoo.search.federation.FederationConfig) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 3 with FederationSearcher

use of com.yahoo.vespa.model.container.search.searchchain.FederationSearcher in project vespa by vespa-engine.

the class DomFederationSearcherBuilder method doBuild.

protected FederationSearcher doBuild(AbstractConfigProducer ancestor, Element searcherElement) {
    FederationSearcherModel model = new FederationSearcherModelBuilder(searcherElement).build();
    Optional<Component> targetSelector = buildTargetSelector(ancestor, searcherElement, model.getComponentId());
    return new FederationSearcher(model, targetSelector);
}
Also used : FederationSearcher(com.yahoo.vespa.model.container.search.searchchain.FederationSearcher) Component(com.yahoo.vespa.model.container.component.Component) FederationSearcherModel(com.yahoo.search.searchchain.model.federation.FederationSearcherModel)

Aggregations

FederationSearcher (com.yahoo.vespa.model.container.search.searchchain.FederationSearcher)3 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)2 FederationSearcherModel (com.yahoo.search.searchchain.model.federation.FederationSearcherModel)2 Test (org.junit.Test)2 FederationConfig (com.yahoo.search.federation.FederationConfig)1 Component (com.yahoo.vespa.model.container.component.Component)1