Search in sources :

Example 6 with VespaModelCreatorWithMockPkg

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

the class ContentBuilderTest method handleIndexedOnlyWithoutPersistence.

@Test
public void handleIndexedOnlyWithoutPersistence() throws Exception {
    VespaModel m = new VespaModelCreatorWithMockPkg(createAppWithMusic(getHosts(), getBasicServices())).create();
    ContentCluster c = CollectionUtil.first(m.getContentClusters().values());
    ContentSearchCluster s = c.getSearch();
    assertTrue(s.hasIndexedCluster());
    assertEquals(1, s.getClusters().size());
    assertNotNull(s.getIndexed());
    assertEquals("clu", s.getIndexed().getClusterName());
    assertEquals(7.3, s.getIndexed().getQueryTimeout(), 0.0);
    assertTrue(c.getPersistence() instanceof ProtonEngine.Factory);
    assertEquals(1, c.getStorageNodes().getChildren().size());
    assertEquals("clu", c.getConfigId());
    // assertEquals("content/a/0", a.getRootGroup().getNodes().get(0).getConfigId()); // This is how it should look like in an ideal world.
    // Due to reuse.
    assertEquals("clu/storage/0", c.getRootGroup().getNodes().get(0).getConfigId());
    assertEquals(1, c.getRoot().getHostSystem().getHosts().size());
    HostResource h = c.getRoot().getHostSystem().getHost("mockhost");
    String[] expectedServices = { "logd", "configproxy", "config-sentinel", "qrserver", "storagenode", "searchnode", "distributor", "topleveldispatch", "transactionlogserver" };
    // TODO        assertServices(h, expectedServices);
    assertEquals("clu/storage/0", h.getService("storagenode").getConfigId());
    assertEquals("clu/search/cluster.clu/0", h.getService("searchnode").getConfigId());
    assertEquals("clu/distributor/0", h.getService("distributor").getConfigId());
    assertEquals("clu/search/cluster.clu/tlds/qrc.0.tld.0", h.getService("topleveldispatch").getConfigId());
    // assertEquals("tcp/node0:19104", h.getService("topleveldispatch").getConfig("partitions", "").innerArray("dataset").value("0").innerArray("engine").value("0").getString("name_and_port"));
    PartitionsConfig partitionsConfig = new PartitionsConfig((PartitionsConfig.Builder) m.getConfig(new PartitionsConfig.Builder(), "clu/search/cluster.clu/tlds/qrc.0.tld.0"));
    assertTrue(partitionsConfig.dataset(0).engine(0).name_and_port().startsWith("tcp/node0:191"));
}
Also used : ContentSearchCluster(com.yahoo.vespa.model.content.ContentSearchCluster) HostResource(com.yahoo.vespa.model.HostResource) VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) VespaModel(com.yahoo.vespa.model.VespaModel) ProtonEngine(com.yahoo.vespa.model.content.engines.ProtonEngine) Matchers.containsString(org.hamcrest.Matchers.containsString) PartitionsConfig(com.yahoo.vespa.config.search.core.PartitionsConfig) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 7 with VespaModelCreatorWithMockPkg

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

the class ContentBuilderTest method createContentWithBooksToo.

private ContentCluster createContentWithBooksToo(String xml) throws Exception {
    String combined = "" + "<services>" + "  <admin version='2.0'>" + "    <adminserver hostalias='mockhost'/>" + "  </admin>" + xml + "</services>";
    VespaModel m = new VespaModelCreatorWithMockPkg(new MockApplicationPackage.Builder().withHosts(getHosts()).withServices(combined).withSearchDefinitions(Arrays.asList(MockApplicationPackage.MUSIC_SEARCHDEFINITION, MockApplicationPackage.BOOK_SEARCHDEFINITION)).build()).create();
    return m.getContentClusters().isEmpty() ? null : m.getContentClusters().values().iterator().next();
}
Also used : VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) VespaModel(com.yahoo.vespa.model.VespaModel) ConfigPayloadBuilder(com.yahoo.vespa.config.ConfigPayloadBuilder) Matchers.containsString(org.hamcrest.Matchers.containsString)

Example 8 with VespaModelCreatorWithMockPkg

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

the class ContentBuilderTest method createContent.

private ContentCluster createContent(String xml) throws Exception {
    String combined = "" + "<services>" + "  <admin version='2.0'>" + "    <adminserver hostalias='mockhost'/>" + "  </admin>" + xml + "</services>";
    VespaModel m = new VespaModelCreatorWithMockPkg(new MockApplicationPackage.Builder().withHosts(getHosts()).withServices(combined).withSearchDefinition(MockApplicationPackage.MUSIC_SEARCHDEFINITION).build()).create();
    return m.getContentClusters().isEmpty() ? null : m.getContentClusters().values().iterator().next();
}
Also used : VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) VespaModel(com.yahoo.vespa.model.VespaModel) ConfigPayloadBuilder(com.yahoo.vespa.config.ConfigPayloadBuilder) Matchers.containsString(org.hamcrest.Matchers.containsString)

Example 9 with VespaModelCreatorWithMockPkg

use of com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg 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 10 with VespaModelCreatorWithMockPkg

use of com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg 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

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