diff options
author | Geir Storli <geirst@oath.com> | 2017-12-13 15:22:52 +0100 |
---|---|---|
committer | Geir Storli <geirst@oath.com> | 2017-12-13 15:22:52 +0100 |
commit | c7a6e96d8755119342993ce426332274d642c5b0 (patch) | |
tree | 5d7775b266124c84634e9f8644f59fee6411c642 /config-model/src/test/java/com/yahoo | |
parent | f3e55bba1a7862223d3bc1e5d4852c02e9be0480 (diff) |
Produce bucketspaces config for entire content cluster.
Diffstat (limited to 'config-model/src/test/java/com/yahoo')
-rw-r--r-- | config-model/src/test/java/com/yahoo/vespa/model/content/ContentSearchClusterTest.java | 20 | ||||
-rw-r--r-- | config-model/src/test/java/com/yahoo/vespa/model/content/DistributorTest.java | 21 |
2 files changed, 21 insertions, 20 deletions
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentSearchClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentSearchClusterTest.java index ee4fa5c1725..8489aefc57a 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentSearchClusterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentSearchClusterTest.java @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.content; +import com.yahoo.vespa.config.content.core.BucketspacesConfig; import com.yahoo.vespa.config.search.core.ProtonConfig; import com.yahoo.vespa.model.content.cluster.ContentCluster; import com.yahoo.vespa.model.content.utils.ContentClusterBuilder; @@ -115,4 +116,23 @@ public class ContentSearchClusterTest { searchDefinitions); } + private static BucketspacesConfig getBucketspacesConfig(ContentCluster cluster) { + BucketspacesConfig.Builder builder = new BucketspacesConfig.Builder(); + cluster.getConfig(builder); + return new BucketspacesConfig(builder); + } + + private static void assertDocumentType(String expName, String expBucketSpace, BucketspacesConfig.Documenttype docType) { + assertEquals(expName, docType.name()); + assertEquals(expBucketSpace, docType.bucketspace()); + } + + @Test + public void require_that_bucket_spaces_config_is_produced_for_content_cluster() throws Exception { + BucketspacesConfig config = getBucketspacesConfig(createClusterWithGlobalType()); + assertEquals(2, config.documenttype().size()); + assertDocumentType("global", "global", config.documenttype(0)); + assertDocumentType("regular", "default", config.documenttype(1)); + } + } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/DistributorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/DistributorTest.java index 30fe336a932..48b7ccdad6b 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/DistributorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/DistributorTest.java @@ -1,7 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.content; -import com.yahoo.vespa.config.content.core.BucketspacesConfig; import com.yahoo.vespa.config.content.core.StorCommunicationmanagerConfig; import com.yahoo.vespa.config.content.core.StorDistributormanagerConfig; import com.yahoo.vespa.config.content.core.StorServerConfig; @@ -17,6 +16,7 @@ import java.util.List; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; import static org.hamcrest.Matchers.*; + /** * Test for content DistributorCluster. */ @@ -346,23 +346,4 @@ public class DistributorTest { assertThat(config.disable_bucket_activation(), is(true)); } - private BucketspacesConfig clusterXmlToBucketspacesConfig(String xml) { - BucketspacesConfig.Builder builder = new BucketspacesConfig.Builder(); - parse(xml).getConfig(builder); - return new BucketspacesConfig(builder); - } - - private void assertDocumentType(String expName, String expBucketSpace, BucketspacesConfig.Documenttype docType) { - assertEquals(expName, docType.name()); - assertEquals(expBucketSpace, docType.bucketspace()); - } - - @Test - public void bucket_spaces_config_is_produced_for_distributor_cluster() { - BucketspacesConfig config = clusterXmlToBucketspacesConfig( - generateXmlForDocTypes(DocType.index("music"), DocType.indexGlobal("movies"))); - assertEquals(2, config.documenttype().size()); - assertDocumentType("movies", "global", config.documenttype(0)); - assertDocumentType("music", "default", config.documenttype(1)); - } } |