Search in sources :

Example 51 with VespaModel

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

the class IndexingModeChangeValidatorTest method testChangingIndexMode.

@Test
public void testChangingIndexMode() throws IOException, SAXException {
    ValidationTester tester = new ValidationTester();
    VespaModel oldModel = tester.deploy(null, getServices(AbstractSearchCluster.IndexingMode.REALTIME), validationOverrides).getFirst();
    List<ConfigChangeAction> changeActions = tester.deploy(oldModel, getServices(AbstractSearchCluster.IndexingMode.STREAMING), validationOverrides).getSecond();
    assertRefeedChange(// allowed=true due to validation override
    true, "Cluster 'default' changed indexing mode from 'indexed' to 'streaming'", changeActions);
}
Also used : VespaModel(com.yahoo.vespa.model.VespaModel) ValidationTester(com.yahoo.vespa.model.application.validation.ValidationTester) ConfigChangeAction(com.yahoo.config.model.api.ConfigChangeAction) Test(org.junit.Test)

Example 52 with VespaModel

use of com.yahoo.vespa.model.VespaModel 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 53 with VespaModel

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

the class IndexingAndDocprocRoutingTest method twoContentTwoDoctypesExplicitIndexingInDifferentIndexingClustersExplicitChainIncorrectInheritance.

@Test(expected = IllegalArgumentException.class)
public void twoContentTwoDoctypesExplicitIndexingInDifferentIndexingClustersExplicitChainIncorrectInheritance() throws IOException, SAXException, ParseException {
    final String MUSIC = "musiccluster";
    SearchClusterSpec musicCluster = new SearchClusterSpec(MUSIC, "dpmusiccluster", "dpmusicchain");
    musicCluster.searchDefs.add(new SearchDefSpec("music", "artist", "album"));
    final String BOOKS = "bookscluster";
    SearchClusterSpec booksCluster = new SearchClusterSpec(BOOKS, "dpbookscluster", "dpbookschain");
    booksCluster.searchDefs.add(new SearchDefSpec("book", "author", "title"));
    DocprocClusterSpec dpMusicCluster = new DocprocClusterSpec("dpmusiccluster", new DocprocChainSpec("dpmusicchain"));
    DocprocClusterSpec dpBooksCluster = new DocprocClusterSpec("dpbookscluster", new DocprocChainSpec("dpbookschain"));
    VespaModel model = getIndexedContentVespaModel(Arrays.asList(dpMusicCluster, dpBooksCluster), Arrays.asList(musicCluster, booksCluster));
    // after we generated model, add indexing chains for validation:
    dpMusicCluster.chains.clear();
    dpMusicCluster.chains.add(new DocprocChainSpec("dpmusiccluster/chain.indexing"));
    dpMusicCluster.chains.add(new DocprocChainSpec("dpmusiccluster/chain.dpmusicchain"));
    dpBooksCluster.chains.clear();
    dpBooksCluster.chains.add(new DocprocChainSpec("dpbookscluster/chain.indexing"));
    dpBooksCluster.chains.add(new DocprocChainSpec("dpbookscluster/chain.dpbookschain"));
    assertIndexing(model, dpMusicCluster, dpBooksCluster);
    assertFeedingRoute(model, MUSIC, "dpmusiccluster/chain.dpmusicchain");
    assertFeedingRoute(model, BOOKS, "dpbookscluster/chain.dpbookschain");
}
Also used : VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 54 with VespaModel

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

the class IndexingAndDocprocRoutingTest method oneSearchOneDoctypeExplicitIndexingClusterExplicitIndexingChain.

@Test
public void oneSearchOneDoctypeExplicitIndexingClusterExplicitIndexingChain() throws IOException, SAXException, ParseException {
    String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<services version=\"1.0\">\n" + "  <admin version=\"2.0\">\n" + "    <adminserver hostalias=\"node0\"/>    \n" + "  </admin>\n" + "\n" + "    <content id=\"searchcluster\" version=\"1.0\">\n" + "            <redundancy>2</redundancy>\n" + "            <documents>\n" + "                <document-processing cluster='dpcluster' chain='fooindexing'/>\n" + "                <document type=\"music\" mode=\"index\"/>\n" + "            </documents>\n" + "                <nodes>\n" + "                    <node hostalias=\"node0\" distribution-key=\"0\"/>\n" + "                </nodes>\n" + "    </content>\n" + "  \n" + "  <jdisc version='1.0' id='dpcluster'>\n" + "    <document-processing>\n" + "      <chain id='fooindexing' inherits='indexing '/>\n" + "    </document-processing>\n" + "    <nodes>\n" + "      <node hostalias='node0'/>\n" + "    </nodes>\n" + "    <http>\n" + "      <server id='dpcluster' port='8000'/>\n" + "    </http>\n" + "  </jdisc>\n" + "</services>\n";
    VespaModel model = getIndexedSearchVespaModel(xml);
    assertIndexing(model, new DocprocClusterSpec("dpcluster", new DocprocChainSpec("dpcluster/chain.fooindexing", "indexing"), new DocprocChainSpec("dpcluster/chain.indexing")));
    assertFeedingRouteIndexed(model, "searchcluster", "dpcluster/chain.fooindexing");
}
Also used : VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 55 with VespaModel

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

the class IndexingAndDocprocRoutingTest method twoContentTwoDoctypesImplicitIndexingClusterImplicitIndexingChain.

@Test
public void twoContentTwoDoctypesImplicitIndexingClusterImplicitIndexingChain() throws IOException, SAXException, ParseException {
    final String MUSIC = "musiccluster";
    SearchClusterSpec musicCluster = new SearchClusterSpec(MUSIC, null, null);
    musicCluster.searchDefs.add(new SearchDefSpec("music", "artist", "album"));
    final String BOOKS = "bookscluster";
    SearchClusterSpec booksCluster = new SearchClusterSpec(BOOKS, null, null);
    booksCluster.searchDefs.add(new SearchDefSpec("book", "author", "title"));
    VespaModel model = getIndexedContentVespaModel(Collections.<DocprocClusterSpec>emptyList(), Arrays.asList(musicCluster, booksCluster));
    assertIndexing(model, new DocprocClusterSpec(MUSIC + ".indexing", new DocprocChainSpec("docproc/cluster." + MUSIC + ".indexing/chain.indexing")), new DocprocClusterSpec(BOOKS + ".indexing", new DocprocChainSpec("docproc/cluster." + BOOKS + ".indexing/chain.indexing")));
    assertFeedingRoute(model, MUSIC, "docproc/cluster." + MUSIC + ".indexing/chain.indexing");
    assertFeedingRoute(model, BOOKS, "docproc/cluster." + BOOKS + ".indexing/chain.indexing");
}
Also used : 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