Search in sources :

Example 56 with VespaModel

use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.

the class IndexingAndDocprocRoutingTest method noContentClustersOneDocprocCluster.

@Test
public void noContentClustersOneDocprocCluster() throws ParseException, IOException, SAXException {
    String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services version='1.0'>\n" + "  <admin version='2.0'>\n" + "    <adminserver hostalias='node0'/>\n" + "  </admin>\n" + "  <jdisc version='1.0' id='dokprok'>\n" + "    <document-processing />\n" + "    <nodes>\n" + "      <node hostalias='node0'/>\n" + "    </nodes>\n" + "  </jdisc>\n" + "</services>\n";
    List<String> sds = ApplicationPackageUtils.generateSearchDefinitions("music", "title", "artist");
    VespaModel model = new VespaModelCreatorWithMockPkg(getHosts(), services, sds).create();
    assertIndexing(model, new DocprocClusterSpec("dokprok"));
}
Also used : VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 57 with VespaModel

use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.

the class IndexingAndDocprocRoutingTest method oneContentOneDoctypeImplicitIndexingClusterImplicitIndexingChain.

@Test
public void oneContentOneDoctypeImplicitIndexingClusterImplicitIndexingChain() throws IOException, SAXException, ParseException {
    final String CLUSTERNAME = "musiccluster";
    SearchClusterSpec searchCluster = new SearchClusterSpec(CLUSTERNAME, null, null);
    searchCluster.searchDefs.add(new SearchDefSpec("music", "artist", "album"));
    VespaModel model = getIndexedContentVespaModel(Collections.<DocprocClusterSpec>emptyList(), Arrays.asList(searchCluster));
    assertIndexing(model, new DocprocClusterSpec(CLUSTERNAME + ".indexing", new DocprocChainSpec("docproc/cluster." + CLUSTERNAME + ".indexing/chain.indexing")));
    assertFeedingRoute(model, CLUSTERNAME, "docproc/cluster." + CLUSTERNAME + ".indexing/chain.indexing");
}
Also used : VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 58 with VespaModel

use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.

the class StorageContentTest method doTestRouting.

public void doTestRouting(String cluster1docs, String cluster2docs, String expectedRoutes) throws Exception {
    VespaModel model = getStorageVespaModel(cluster1docs, cluster2docs);
    if (expectedRoutes == null) {
        return;
    }
    Routing routing = model.getRouting();
    assertNotNull(routing);
    assertEquals(0, routing.getErrors().size());
    assertEquals(1, routing.getProtocols().size());
    DocumentProtocol protocol = (DocumentProtocol) routing.getProtocols().get(0);
    RoutingTableSpec spec = protocol.getRoutingTableSpec();
    assertEquals(1, spec.getNumHops());
    assertEquals("indexing", spec.getHop(0).getName());
    assertEquals("[DocumentRouteSelector]", spec.getHop(0).getSelector());
    Map<String, RouteSpec> routes = new TreeMap<>();
    for (int i = 0; i < spec.getNumRoutes(); ++i) {
        RouteSpec r = spec.getRoute(i);
        routes.put(r.getName(), r);
    }
    {
        RouteSpec r = routes.get("default");
        assertEquals(1, r.getNumHops());
        assertEquals("indexing", r.getHop(0));
    }
    Set<String> configuredRoutes = new TreeSet<>();
    DocumentrouteselectorpolicyConfig.Builder builder = new DocumentrouteselectorpolicyConfig.Builder();
    protocol.getConfig(builder);
    DocumentrouteselectorpolicyConfig config = new DocumentrouteselectorpolicyConfig(builder);
    for (DocumentrouteselectorpolicyConfig.Route r : config.route()) {
        configuredRoutes.add(r.name() + " : " + r.selector());
    }
    StringBuilder routeStr = new StringBuilder();
    for (String r : configuredRoutes) {
        routeStr.append(r).append('\n');
    }
    assertEquals(expectedRoutes, routeStr.toString());
}
Also used : Routing(com.yahoo.vespa.model.routing.Routing) RouteSpec(com.yahoo.messagebus.routing.RouteSpec) DocumentProtocol(com.yahoo.vespa.model.routing.DocumentProtocol) DocumentrouteselectorpolicyConfig(com.yahoo.documentapi.messagebus.protocol.DocumentrouteselectorpolicyConfig) RoutingTableSpec(com.yahoo.messagebus.routing.RoutingTableSpec) VespaModel(com.yahoo.vespa.model.VespaModel)

Example 59 with VespaModel

use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.

the class IndexedTest method requireIndexedOnlyServices.

@Test
public void requireIndexedOnlyServices() {
    VespaModel model = getIndexedVespaModel();
    HostResource h = model.getHostSystem().getHosts().get(0);
    String[] expectedServices = { "logserver", "configserver", "adminserver", "slobrok", "logd", "configproxy", "config-sentinel", "qrserver", "fleetcontroller", "topleveldispatch", "docprocservice", "storagenode", "searchnode", "distributor", "transactionlogserver" };
    // TODO DomContentBuilderTest.assertServices(h, expectedServices);
    Routing routing = model.getRouting();
    assertNotNull(routing);
    assertEquals("[]", routing.getErrors().toString());
    assertEquals(1, routing.getProtocols().size());
    DocumentProtocol protocol = (DocumentProtocol) routing.getProtocols().get(0);
    RoutingTableSpec spec = protocol.getRoutingTableSpec();
    assertEquals(2, spec.getNumHops());
    assertEquals("docproc/cluster.test.indexing/chain.indexing", spec.getHop(0).getName());
    assertEquals("indexing", spec.getHop(1).getName());
    RouteSpec r;
    r = spec.getRoute(0);
    assertEquals("default", r.getName());
    assertEquals(1, r.getNumHops());
    assertEquals("indexing", r.getHop(0));
    r = spec.getRoute(1);
    assertEquals("storage/cluster.test", r.getName());
    assertEquals(1, r.getNumHops());
    assertEquals("route:test", r.getHop(0));
    r = spec.getRoute(2);
    assertEquals("test", r.getName());
    assertEquals(1, r.getNumHops());
    assertEquals("[MessageType:test]", r.getHop(0));
    r = spec.getRoute(3);
    assertEquals("test-direct", r.getName());
    assertEquals(1, r.getNumHops());
    assertEquals("[Content:cluster=test]", r.getHop(0));
    r = spec.getRoute(4);
    assertEquals("test-index", r.getName());
    assertEquals(2, r.getNumHops());
    assertEquals("docproc/cluster.test.indexing/chain.indexing", r.getHop(0));
    assertEquals("[Content:cluster=test]", r.getHop(1));
}
Also used : HostResource(com.yahoo.vespa.model.HostResource) RoutingTableSpec(com.yahoo.messagebus.routing.RoutingTableSpec) VespaModel(com.yahoo.vespa.model.VespaModel) Routing(com.yahoo.vespa.model.routing.Routing) RouteSpec(com.yahoo.messagebus.routing.RouteSpec) DocumentProtocol(com.yahoo.vespa.model.routing.DocumentProtocol) Test(org.junit.Test)

Example 60 with VespaModel

use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.

the class IndexedTest method testMixedIndexAndStoreOnly.

@Test
public void testMixedIndexAndStoreOnly() {
    String services = "<services version='1.0'>" + "  <admin version='2.0'><adminserver hostalias='node0' /></admin>" + "  <content id='docstore' version=\"1.0\">" + "    <redundancy>1</redundancy>" + "    <documents>" + "      <document type=\"index_me\" mode=\"index\"/>" + "      <document type=\"store_me\" mode=\"store-only\"/>" + "    </documents>" + "    <group>" + "      <node distribution-key=\"0\" hostalias=\"node0\"/>" + "    </group>" + "  </content>" + "</services>";
    List<String> sds = ApplicationPackageUtils.generateSearchDefinitions("index_me", "store_me");
    VespaModel model = new VespaModelCreatorWithMockPkg(getHosts(), services, sds).create();
    ProtonConfig.Builder pb = new ProtonConfig.Builder();
    model.getConfig(pb, "docstore/search/cluster.docstore/0");
    ProtonConfig protonConfig = new ProtonConfig(pb);
    assertEquals(2, protonConfig.documentdb().size());
    assertEquals("index_me", protonConfig.documentdb(0).inputdoctypename());
    assertEquals("docstore/search/cluster.docstore/index_me", protonConfig.documentdb(0).configid());
    assertEquals("store_me", protonConfig.documentdb(1).inputdoctypename());
    assertEquals("docstore/search", protonConfig.documentdb(1).configid());
}
Also used : ProtonConfig(com.yahoo.vespa.config.search.core.ProtonConfig) VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Aggregations

VespaModel (com.yahoo.vespa.model.VespaModel)153 Test (org.junit.Test)135 VespaModelTester (com.yahoo.vespa.model.test.VespaModelTester)35 VespaModelCreatorWithMockPkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg)26 ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)22 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)21 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)18 DeployState (com.yahoo.config.model.deploy.DeployState)18 NullConfigModelRegistry (com.yahoo.config.model.NullConfigModelRegistry)15 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)14 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)13 Matchers.containsString (org.hamcrest.Matchers.containsString)12 File (java.io.File)8 ProtonConfig (com.yahoo.vespa.config.search.core.ProtonConfig)6 ValidationTester (com.yahoo.vespa.model.application.validation.ValidationTester)6 ContentSearchCluster (com.yahoo.vespa.model.content.ContentSearchCluster)6 LogdConfig (com.yahoo.cloud.config.log.LogdConfig)5 FilesApplicationPackage (com.yahoo.config.model.application.provider.FilesApplicationPackage)5 InMemoryProvisioner (com.yahoo.config.model.provision.InMemoryProvisioner)5 HostResource (com.yahoo.vespa.model.HostResource)5