aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/chains/search/DomSearcherBuilderTest.java
blob: 8b3a38852dd5baaa95c3fd0cc3dfc6e75c0b61c1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.builder.xml.dom.chains.search;

import com.yahoo.component.chain.model.ChainedComponentModel;
import com.yahoo.config.model.builder.xml.test.DomBuilderTest;
import com.yahoo.container.bundle.BundleInstantiationSpecification;
import com.yahoo.vespa.model.container.component.chain.ChainedComponent;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

/**
 * @author Tony Vaagenes
 */
public class DomSearcherBuilderTest extends DomBuilderTest {

    @Test
    void ensureCorrectModel() {
        ChainedComponent<ChainedComponentModel> searcher = new DomSearcherBuilder().doBuild(root.getDeployState(), root, parse(
                "<searcher id='theId' class='theclassid' bundle='thebundle' provides='p1'>",
                "    <provides>p2</provides>",
                "</searcher>"));

        ChainedComponentModel model = searcher.model;
        assertEquals(2, model.dependencies.provides().size());

        BundleInstantiationSpecification instantiationSpecification = model.bundleInstantiationSpec;
        assertEquals("theId", instantiationSpecification.id.stringValue());
        assertEquals("theclassid", instantiationSpecification.classId.stringValue());
        assertEquals("thebundle", instantiationSpecification.bundle.stringValue());
    }

}