Search in sources :

Example 26 with VespaModelCreatorWithMockPkg

use of com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg in project vespa by vespa-engine.

the class IndexedTest method testContentSummaryStore.

@Test
public void testContentSummaryStore() {
    String services = "<services version='1.0'>" + "<admin version='2.0'><adminserver hostalias='node0' /></admin>" + "<content id='docstore' version='1.0'>\n" + "    <redundancy>1</redundancy>\n" + "    <documents>\n" + "      <document mode='index' type='docstorebench'/>\n" + "    </documents>\n" + "    <group>\n" + "      <node distribution-key='0' hostalias='node0'/>\n" + "    </group>\n" + "    <engine>\n" + "      <proton>\n" + "        <searchable-copies>1</searchable-copies>\n" + "        <tuning>\n" + "          <searchnode>\n" + "            <summary>\n" + "              <store>\n" + "                <logstore>\n" + "                  <chunk>\n" + "                    <maxsize>2048</maxsize>\n" + "                  </chunk>\n" + "                </logstore>\n" + "              </store>\n" + "            </summary>\n" + "          </searchnode>\n" + "        </tuning>\n" + "      </proton>\n" + "    </engine>\n" + "  </content>\n" + "  </services>";
    List<String> sds = ApplicationPackageUtils.generateSearchDefinitions("docstorebench");
    VespaModel model = new VespaModelCreatorWithMockPkg(getHosts(), services, sds).create();
    ProtonConfig.Builder pb = new ProtonConfig.Builder();
    model.getConfig(pb, "docstore/search/cluster.docstore/0");
}
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)

Example 27 with VespaModelCreatorWithMockPkg

use of com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg in project vespa by vespa-engine.

the class DocumentDatabaseTestCase method requireThatWeCanHaveMultipleSearchDefinitions.

@Test
public void requireThatWeCanHaveMultipleSearchDefinitions() throws IOException, SAXException, ParseException {
    final List<String> sds = Arrays.asList("type1", "type2", "type3");
    VespaModel model = new VespaModelCreatorWithMockPkg(vespaHosts, createVespaServices(sds, "index"), ApplicationPackageUtils.generateSearchDefinitions(sds)).create();
    IndexedSearchCluster indexedSearchCluster = (IndexedSearchCluster) model.getSearchClusters().get(0);
    ContentSearchCluster contentSearchCluster = model.getContentClusters().get("test").getSearch();
    String type1Id = "test/search/cluster.test/type1";
    String type2Id = "test/search/cluster.test/type2";
    String type3Id = "test/search/cluster.test/type3";
    {
        assertEquals(3, indexedSearchCluster.getDocumentDbs().size());
        ProtonConfig proton = getProtonCfg(contentSearchCluster);
        assertEquals(3, proton.documentdb().size());
        assertEquals("type1", proton.documentdb(0).inputdoctypename());
        assertEquals(type1Id, proton.documentdb(0).configid());
        assertEquals("type2", proton.documentdb(1).inputdoctypename());
        assertEquals(type2Id, proton.documentdb(1).configid());
        assertEquals("type3", proton.documentdb(2).inputdoctypename());
        assertEquals(type3Id, proton.documentdb(2).configid());
    }
    assertDocTypeConfig(model, type1Id, "f1", "f2");
    assertDocTypeConfig(model, type2Id, "f3", "f4");
    assertDocTypeConfig(model, type3Id, "f5", "f6");
    {
        IndexInfoConfig iicfg = model.getConfig(IndexInfoConfig.class, "test/search/cluster.test");
        assertEquals(3, iicfg.indexinfo().size());
        assertEquals("type1", iicfg.indexinfo().get(0).name());
        assertEquals("type2", iicfg.indexinfo().get(1).name());
        assertEquals("type3", iicfg.indexinfo().get(2).name());
    }
    {
        AttributesConfig rac1 = model.getConfig(AttributesConfig.class, type1Id);
        assertEquals(2, rac1.attribute().size());
        assertEquals("f2", rac1.attribute(0).name());
        assertEquals("f2_nfa", rac1.attribute(1).name());
        AttributesConfig rac2 = model.getConfig(AttributesConfig.class, type2Id);
        assertEquals(2, rac2.attribute().size());
        assertEquals("f4", rac2.attribute(0).name());
        assertEquals("f4_nfa", rac2.attribute(1).name());
    }
    {
        IlscriptsConfig icfg = model.getConfig(IlscriptsConfig.class, "test/search/cluster.test");
        assertEquals(3, icfg.ilscript().size());
        assertEquals("type1", icfg.ilscript(0).doctype());
        assertEquals("type2", icfg.ilscript(1).doctype());
        assertEquals("type3", icfg.ilscript(2).doctype());
    }
}
Also used : ContentSearchCluster(com.yahoo.vespa.model.content.ContentSearchCluster) ProtonConfig(com.yahoo.vespa.config.search.core.ProtonConfig) IndexedSearchCluster(com.yahoo.vespa.model.search.IndexedSearchCluster) VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) IlscriptsConfig(com.yahoo.vespa.configdefinition.IlscriptsConfig) VespaModel(com.yahoo.vespa.model.VespaModel) AttributesConfig(com.yahoo.vespa.config.search.AttributesConfig) IndexInfoConfig(com.yahoo.search.config.IndexInfoConfig) Test(org.junit.Test)

Example 28 with VespaModelCreatorWithMockPkg

use of com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg in project vespa by vespa-engine.

the class DocumentDatabaseTestCase method assertSingleSD.

private void assertSingleSD(String mode) {
    final List<String> sds = Arrays.asList("type1");
    VespaModel model = new VespaModelCreatorWithMockPkg(vespaHosts, createVespaServices(sds, mode), ApplicationPackageUtils.generateSearchDefinitions(sds)).create();
    IndexedSearchCluster indexedSearchCluster = (IndexedSearchCluster) model.getSearchClusters().get(0);
    ContentSearchCluster contentSearchCluster = model.getContentClusters().get("test").getSearch();
    assertEquals(1, indexedSearchCluster.getDocumentDbs().size());
    String type1Id = "test/search/cluster.test/type1";
    ProtonConfig proton = getProtonCfg(contentSearchCluster);
    assertEquals(1, proton.documentdb().size());
    assertEquals("type1", proton.documentdb(0).inputdoctypename());
    assertEquals(type1Id, proton.documentdb(0).configid());
}
Also used : ContentSearchCluster(com.yahoo.vespa.model.content.ContentSearchCluster) ProtonConfig(com.yahoo.vespa.config.search.core.ProtonConfig) IndexedSearchCluster(com.yahoo.vespa.model.search.IndexedSearchCluster) VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) VespaModel(com.yahoo.vespa.model.VespaModel)

Example 29 with VespaModelCreatorWithMockPkg

use of com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg in project vespa by vespa-engine.

the class DocumentDatabaseTestCase method assertDocumentDBConfigAvailableForStreaming.

private void assertDocumentDBConfigAvailableForStreaming(String mode) {
    final List<String> sds = Arrays.asList("type");
    VespaModel model = new VespaModelCreatorWithMockPkg(vespaHosts, createVespaServices(sds, mode), ApplicationPackageUtils.generateSearchDefinitions(sds)).create();
    DocumentdbInfoConfig dcfg = model.getConfig(DocumentdbInfoConfig.class, "test/search/cluster.test.type");
    assertEquals(1, dcfg.documentdb().size());
    DocumentdbInfoConfig.Documentdb db = dcfg.documentdb(0);
    assertEquals("type", db.name());
}
Also used : VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) DocumentdbInfoConfig(com.yahoo.prelude.fastsearch.DocumentdbInfoConfig) VespaModel(com.yahoo.vespa.model.VespaModel)

Example 30 with VespaModelCreatorWithMockPkg

use of com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg in project vespa by vespa-engine.

the class SearchClusterTest method search_model_is_connected_to_container_clusters_two_content_clusters.

@Test
public void search_model_is_connected_to_container_clusters_two_content_clusters() throws Exception {
    String services = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + "<services version=\"1.0\">" + "  <admin version='2.0'>" + "    <adminserver hostalias='node0' />" + "  </admin>\n" + "  <jdisc version='1.0' id='j1'>\n" + "    <search>" + "      <chain id='s1Chain'>" + "        <searcher id='S1ClusterSearcher'/>" + "      </chain>" + "      <provider cluster='normal' id='normal' type='local'/>\n" + "    </search>" + "    <nodes>" + "      <node hostalias=\"node0\" />" + "    </nodes>" + "  </jdisc>" + "  <jdisc version='1.0' id='j2'>" + "    <search>" + "      <chain id='s2Chain'>" + "        <searcher id='S2ClusterSearcher'/>" + "      </chain>" + "      <provider cluster='xbulk' id='xbulk' type='local'/>" + "    </search>" + "    <nodes>" + "      <node hostalias=\"node2\" />" + "    </nodes>" + "  </jdisc>" + "  <content id='xbulk' version=\"1.0\">" + "     <redundancy>2</redundancy>" + "     <documents>" + "       <document mode='index' type=\"music\" />" + "     </documents>" + "         <nodes>" + "            <node hostalias=\"node0\" distribution-key=\"0\" />" + "         </nodes>" + "  </content>" + "  <content id=\"normal\" version='1.0'>" + "     <redundancy>2</redundancy>" + "     <documents>" + "       <document mode='index' type=\"music\" />" + "     </documents>" + "         <nodes>" + "            <node hostalias=\"node2\" distribution-key=\"0\" />" + "         </nodes>" + "  </content>" + "</services>";
    VespaModel model = new VespaModelCreatorWithMockPkg(vespaHosts, services, ApplicationPackageUtils.generateSearchDefinitions("music")).create();
    ContainerCluster cluster1 = (ContainerCluster) model.getConfigProducer("j1").get();
    assertFalse(cluster1.getSearch().getChains().localProviders().isEmpty());
    ContainerCluster cluster2 = (ContainerCluster) model.getConfigProducer("j2").get();
    assertFalse(cluster2.getSearch().getChains().localProviders().isEmpty());
    QrSearchersConfig.Builder builder = new QrSearchersConfig.Builder();
    cluster1.getConfig(builder);
    QrSearchersConfig config = new QrSearchersConfig(builder);
    assertThat(config.searchcluster().size(), is(2));
    int normalId = 0;
    int bulkId = 1;
    assertThat(config.searchcluster().get(normalId).name(), is("normal"));
    assertThat(config.searchcluster().get(bulkId).name(), is("xbulk"));
    ClusterConfig.Builder clusterConfigBuilder = new ClusterConfig.Builder();
    model.getConfig(clusterConfigBuilder, "j1/searchchains/chain/normal/component/com.yahoo.prelude.cluster.ClusterSearcher");
    ClusterConfig clusterConfig = new ClusterConfig(clusterConfigBuilder);
    assertThat(clusterConfig.clusterId(), is(normalId));
    assertThat(clusterConfig.clusterName(), is("normal"));
    ClusterConfig.Builder clusterConfigBuilder2 = new ClusterConfig.Builder();
    model.getConfig(clusterConfigBuilder2, "j2/searchchains/chain/xbulk/component/com.yahoo.prelude.cluster.ClusterSearcher");
    ClusterConfig clusterConfig2 = new ClusterConfig(clusterConfigBuilder2);
    assertThat(clusterConfig2.clusterId(), is(bulkId));
    assertThat(clusterConfig2.clusterName(), is("xbulk"));
}
Also used : VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) VespaModel(com.yahoo.vespa.model.VespaModel) SearchBuilder(com.yahoo.searchdefinition.SearchBuilder) QrSearchersConfig(com.yahoo.container.QrSearchersConfig) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) ClusterConfig(com.yahoo.search.config.ClusterConfig) Test(org.junit.Test)

Aggregations

VespaModelCreatorWithMockPkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg)31 VespaModel (com.yahoo.vespa.model.VespaModel)26 Test (org.junit.Test)22 DeployState (com.yahoo.config.model.deploy.DeployState)5 ProtonConfig (com.yahoo.vespa.config.search.core.ProtonConfig)5 Matchers.containsString (org.hamcrest.Matchers.containsString)5 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)4 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)4 DeployProperties (com.yahoo.config.model.deploy.DeployProperties)4 ContentSearchCluster (com.yahoo.vespa.model.content.ContentSearchCluster)4 InMemoryProvisioner (com.yahoo.config.model.provision.InMemoryProvisioner)3 ConfigPayloadBuilder (com.yahoo.vespa.config.ConfigPayloadBuilder)3 AttributesConfig (com.yahoo.vespa.config.search.AttributesConfig)3 PartitionsConfig (com.yahoo.vespa.config.search.core.PartitionsConfig)3 ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)3 IndexedSearchCluster (com.yahoo.vespa.model.search.IndexedSearchCluster)3 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)2 DocumentdbInfoConfig (com.yahoo.prelude.fastsearch.DocumentdbInfoConfig)2 ProtonEngine (com.yahoo.vespa.model.content.engines.ProtonEngine)2 ContentClusterBuilder (com.yahoo.vespa.model.content.utils.ContentClusterBuilder)2