Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 202D1200CC4 for ; Thu, 29 Jun 2017 07:16:33 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 1E979160BFE; Thu, 29 Jun 2017 05:16:33 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 3BC24160BF7 for ; Thu, 29 Jun 2017 07:16:31 +0200 (CEST) Received: (qmail 84121 invoked by uid 500); 29 Jun 2017 05:16:30 -0000 Mailing-List: contact commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list commits@lucene.apache.org Received: (qmail 84112 invoked by uid 99); 29 Jun 2017 05:16:30 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Jun 2017 05:16:30 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id DFEB2E968D; Thu, 29 Jun 2017 05:16:28 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ishan@apache.org To: commits@lucene.apache.org Date: Thu, 29 Jun 2017 05:16:28 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/4] lucene-solr:master: SOLR-10272: Adding user _default configset to test-files, fixing solr & solr.cmd script bugs archived-at: Thu, 29 Jun 2017 05:16:33 -0000 Repository: lucene-solr Updated Branches: refs/heads/master 8f71bb40a -> 85069cacf http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/85069cac/solr/core/src/test-files/solr/configsets/_default/conf/solrconfig.xml ---------------------------------------------------------------------- diff --git a/solr/core/src/test-files/solr/configsets/_default/conf/solrconfig.xml b/solr/core/src/test-files/solr/configsets/_default/conf/solrconfig.xml index 09d8e5a..f75303f 100644 --- a/solr/core/src/test-files/solr/configsets/_default/conf/solrconfig.xml +++ b/solr/core/src/test-files/solr/configsets/_default/conf/solrconfig.xml @@ -1,5 +1,4 @@ - - + + + + + + 7.0.0 + + + + + + + + + + + + + + + + + + + + ${solr.data.dir:} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${solr.lock.type:native} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${solr.ulog.dir:} + ${solr.ulog.numVersionBuckets:65536} + + + + + ${solr.autoCommit.maxTime:15000} + false + + + + + + ${solr.autoSoftCommit.maxTime:-1} + + + + + + + + + + + + + + + + + 1024 + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + 20 + + + 200 + + + + + + + + + + + + + + + + false + + + + + + + + + + + + + + + + + + + + + + explicit + 10 + + + + + + + + + + + + + + + explicit + json + true + + + + + + + + explicit + + + + + + _text_ + + + + + + + true + ignored_ + _text_ + + + + + + + + + text_general + + + + + + default + _text_ + solr.DirectSolrSpellChecker + + internal + + 0.5 + + 2 + + 1 + + 5 + + 4 + + 0.01 + + + + + + + + + + + + default + on + true + 10 + 5 + 5 + true + true + 10 + 5 + + + spellcheck + + + + + + + + + + true + + + tvComponent + - + + + + + + + + + true + false + + + terms + + + + + + + + string + elevate.xml + + + + + + explicit + + + elevator + + + + + + + + + + + 100 + + + + + + + + 70 + + 0.5 + + [-\w ,/\n\"']{20,200} + + + + + + + ]]> + ]]> + + + + + + + + + + + + + + + + + + + + + + + + ,, + ,, + ,, + ,, + ,]]> + ]]> + + + + + + 10 + .,!? + + + + + + + WORD + + + en + US + + + + + + + + + + + + [^\w-\.] + _ + + + + + + + yyyy-MM-dd'T'HH:mm:ss.SSSZ + yyyy-MM-dd'T'HH:mm:ss,SSSZ + yyyy-MM-dd'T'HH:mm:ss.SSS + yyyy-MM-dd'T'HH:mm:ss,SSS + yyyy-MM-dd'T'HH:mm:ssZ + yyyy-MM-dd'T'HH:mm:ss + yyyy-MM-dd'T'HH:mmZ + yyyy-MM-dd'T'HH:mm + yyyy-MM-dd HH:mm:ss.SSSZ + yyyy-MM-dd HH:mm:ss,SSSZ + yyyy-MM-dd HH:mm:ss.SSS + yyyy-MM-dd HH:mm:ss,SSS + yyyy-MM-dd HH:mm:ssZ + yyyy-MM-dd HH:mm:ss + yyyy-MM-dd HH:mmZ + yyyy-MM-dd HH:mm + yyyy-MM-dd + + + + strings + + java.lang.Boolean + booleans + + + java.util.Date + pdates + + + java.lang.Long + java.lang.Integer + plongs + + + java.lang.Number + pdoubles + + + + + + + + + + + + + + + + + + + + + + + + + + text/plain; charset=UTF-8 + + + + + ${velocity.template.base.dir:} + ${velocity.solr.resource.loader.enabled:true} + ${velocity.params.resource.loader.enabled:false} + + + + + 5 + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/85069cac/solr/core/src/test-files/solr/configsets/_default/conf/stopwords.txt ---------------------------------------------------------------------- diff --git a/solr/core/src/test-files/solr/configsets/_default/conf/stopwords.txt b/solr/core/src/test-files/solr/configsets/_default/conf/stopwords.txt new file mode 100644 index 0000000..ae1e83e --- /dev/null +++ b/solr/core/src/test-files/solr/configsets/_default/conf/stopwords.txt @@ -0,0 +1,14 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/85069cac/solr/core/src/test-files/solr/configsets/_default/conf/synonyms.txt ---------------------------------------------------------------------- diff --git a/solr/core/src/test-files/solr/configsets/_default/conf/synonyms.txt b/solr/core/src/test-files/solr/configsets/_default/conf/synonyms.txt new file mode 100644 index 0000000..eab4ee8 --- /dev/null +++ b/solr/core/src/test-files/solr/configsets/_default/conf/synonyms.txt @@ -0,0 +1,29 @@ +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#----------------------------------------------------------------------- +#some test synonym mappings unlikely to appear in real input text +aaafoo => aaabar +bbbfoo => bbbfoo bbbbar +cccfoo => cccbar cccbaz +fooaaa,baraaa,bazaaa + +# Some synonym groups specific to this example +GB,gib,gigabyte,gigabytes +MB,mib,megabyte,megabytes +Television, Televisions, TV, TVs +#notice we use "gib" instead of "GiB" so any WordDelimiterGraphFilter coming +#after us won't split it into two words. + +# Synonym mappings can be used for spelling correction too +pixima => pixma + http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/85069cac/solr/core/src/test/org/apache/solr/cloud/CollectionsAPISolrJTest.java ---------------------------------------------------------------------- diff --git a/solr/core/src/test/org/apache/solr/cloud/CollectionsAPISolrJTest.java b/solr/core/src/test/org/apache/solr/cloud/CollectionsAPISolrJTest.java index a4ed93f..f2027b0 100644 --- a/solr/core/src/test/org/apache/solr/cloud/CollectionsAPISolrJTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/CollectionsAPISolrJTest.java @@ -62,16 +62,27 @@ public class CollectionsAPISolrJTest extends SolrCloudTestCase { @Test public void testCreateWithDefaultConfigSet() throws Exception { String collectionName = "solrj_default_configset"; - CollectionAdminResponse response = CollectionAdminRequest.createCollection(collectionName, 2, 2) // no configset specified + CollectionAdminResponse response = CollectionAdminRequest.createCollection(collectionName, 2, 2) .process(cluster.getSolrClient()); - // The _default configset (for the tests) is designed to error out upon collection creation, - // so we just ensure that the correct error message was obtained. - assertFalse(response.isSuccess()); - System.out.println("Errors are: "+response.getErrorMessages()); - assertTrue(response.getErrorMessages() != null && response.getErrorMessages().size() > 0); - assertTrue(response.getErrorMessages().getVal(0).contains("This is the _default configset, which is designed" - + " to throw error upon collection creation")); + assertEquals(0, response.getStatus()); + assertTrue(response.isSuccess()); + Map> coresStatus = response.getCollectionCoresStatus(); + assertEquals(4, coresStatus.size()); + for (int i=0; i<4; i++) { + NamedList status = coresStatus.get(Assign.buildCoreName(collectionName, "shard" + (i/2+1), Replica.Type.NRT, (i%2+1))); + assertEquals(0, (int)status.get("status")); + assertTrue(status.get("QTime") > 0); + } + + response = CollectionAdminRequest.deleteCollection(collectionName).process(cluster.getSolrClient()); + + assertEquals(0, response.getStatus()); + assertTrue(response.isSuccess()); + Map> nodesStatus = response.getCollectionNodesStatus(); + assertEquals(4, nodesStatus.size()); + + waitForState("Expected " + collectionName + " to disappear from cluster state", collectionName, (n, c) -> c == null); } @Test http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/85069cac/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.java ---------------------------------------------------------------------- diff --git a/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.java b/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.java index 27fcfc0..a9e5837 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.java @@ -34,6 +34,10 @@ import java.lang.invoke.MethodHandles; import java.net.URI; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; +import java.nio.file.FileVisitResult; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.attribute.BasicFileAttributes; import java.util.Arrays; import java.util.Collection; import java.util.Deque; @@ -43,6 +47,7 @@ import java.util.LinkedList; import java.util.Map; import java.util.Properties; import java.util.Set; +import java.nio.file.SimpleFileVisitor; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; @@ -87,6 +92,7 @@ import org.apache.solr.common.util.Utils; import org.apache.solr.core.ConfigSetProperties; import org.apache.solr.core.TestDynamicLoading; import org.apache.solr.security.BasicAuthIntegrationTest; +import org.apache.solr.util.ExternalPaths; import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.KeeperException; import org.junit.After; @@ -714,7 +720,46 @@ public class TestConfigSetsAPI extends SolrTestCaseJ4 { solrClient.close(); } + + @Test + public void testUserAndTestDefaultConfigsetsAreSame() throws IOException { + File testDefaultConf = configset("_default").toFile(); + log.info("Test _default path: " + testDefaultConf); + + File userDefaultConf = new File(ExternalPaths.DEFAULT_CONFIGSET); + log.info("User _default path: " + userDefaultConf); + + compareDirectories(userDefaultConf, testDefaultConf); + } + private static void compareDirectories(File userDefault, File testDefault) throws IOException { + assertTrue("Test _default doesn't exist: " + testDefault.getAbsolutePath(), testDefault.exists()); + assertTrue("Test _default not a directory: " + testDefault.getAbsolutePath(),testDefault.isDirectory()); + assertTrue("User _default doesn't exist: " + userDefault.getAbsolutePath(), userDefault.exists()); + assertTrue("User _default not a directory: " + userDefault.getAbsolutePath(),userDefault.isDirectory()); + + Files.walkFileTree(userDefault.toPath(), new SimpleFileVisitor() { + @Override + public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { + FileVisitResult result = super.preVisitDirectory(dir, attrs); + Path relativePath = userDefault.toPath().relativize(dir); + File testDefaultFile = testDefault.toPath().resolve(relativePath).toFile(); + assertEquals("Mismatch in files", Arrays.toString(dir.toFile().list()), Arrays.toString(testDefaultFile.list())); + return result; + } + @Override + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { + FileVisitResult result = super.visitFile(file, attrs); + Path relativePath = userDefault.toPath().relativize(file); + File testDefaultFile = testDefault.toPath().resolve(relativePath).toFile(); + String userDefaultContents = FileUtils.readFileToString(file.toFile(), "UTF-8"); + String testDefaultContents = FileUtils.readFileToString(testDefaultFile, "UTF-8"); + assertEquals(testDefaultFile+" contents doesn't match expected ("+file+")", userDefaultContents, testDefaultContents); + return result; + } + }); + } + private StringBuilder getConfigSetProps(Map map) { return new StringBuilder(new String(Utils.toJSON(map), StandardCharsets.UTF_8)); }