Apache Lucene open-source search software
SOLR-4952: get SolrCoreCheckLockOnStartupTest using solrconfig.snippet.randomindexconfig.xml
Chris M. Hostetterc19a5527d86e
diff --git a/solr/core/src/test-files/solr/collection1/conf/solrconfig-nativelock.xml b/solr/core/src/test-files/solr/collection1/conf/solrconfig-nativelock.xmldeleted file mode 100644index 7b5b6f7de93..00000000000--- a/solr/core/src/test-files/solr/collection1/conf/solrconfig-nativelock.xml+++ /dev/null@@ -1,34 +0,0 @@-<?xml version="1.0" ?>--<!--- 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.--->-<config>- <!--- Config file used by SolrCoreCheckLockOnStartupTest#testNativeLockErrorOnStartup- It requires the native lockType- -->- <jmx />-- <dataDir>${solr.data.dir:}</dataDir>-- <luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>-- <indexConfig>- <useCompoundFile>${useCompoundFile:false}</useCompoundFile>- <lockType>native</lockType>- </indexConfig>-</config>diff --git a/solr/core/src/test-files/solr/collection1/conf/solrconfig-simplelock.xml b/solr/core/src/test-files/solr/collection1/conf/solrconfig-simplelock.xmldeleted file mode 100644index 7981b846850..00000000000--- a/solr/core/src/test-files/solr/collection1/conf/solrconfig-simplelock.xml+++ /dev/null@@ -1,34 +0,0 @@-<?xml version="1.0" ?>--<!--- 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.--->-<config>- <!--- Config file used by SolrCoreCheckLockOnStartupTest#testSimpleLockErrorOnStartup- It requires the simple lockType- -->- <jmx />-- <dataDir>${solr.data.dir:}</dataDir>-- <luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>-- <indexConfig>- <useCompoundFile>${useCompoundFile:false}</useCompoundFile>- <lockType>simple</lockType>- </indexConfig>-</config>diff --git a/solr/core/src/test-files/solr/collection1/conf/solrconfig.snippet.randomindexconfig.xml b/solr/core/src/test-files/solr/collection1/conf/solrconfig.snippet.randomindexconfig.xmlindex 0733d5c19dd..7514aa4788b 100644--- a/solr/core/src/test-files/solr/collection1/conf/solrconfig.snippet.randomindexconfig.xml+++ b/solr/core/src/test-files/solr/collection1/conf/solrconfig.snippet.randomindexconfig.xml@@ -38,5 +38,10 @@ A solrconfig.xml snippet containing indexConfig settings for randomized testing.<writeLockTimeout>1000</writeLockTimeout><commitLockTimeout>10000</commitLockTimeout>- <lockType>single</lockType>++ <!-- this sys property is not set by SolrTestCaseJ4 because almost all tests should+ use the single process lockType for speed - but tests that explicitly need+ to vary the lockType canset it as needed.+ -->+ <lockType>${solr.tests.lockType:single}</lockType></indexConfig>diff --git a/solr/core/src/test/org/apache/solr/core/SolrCoreCheckLockOnStartupTest.java b/solr/core/src/test/org/apache/solr/core/SolrCoreCheckLockOnStartupTest.javaindex e6ce1da1ff0..e07b5ed6b75 100644--- a/solr/core/src/test/org/apache/solr/core/SolrCoreCheckLockOnStartupTest.java+++ b/solr/core/src/test/org/apache/solr/core/SolrCoreCheckLockOnStartupTest.java@@ -62,12 +62,14 @@ public class SolrCoreCheckLockOnStartupTest extends SolrTestCaseJ4 {ignoreException("locked");try {+ System.setProperty("solr.tests.lockType","simple");//opening a new core on the same index- initCore("solrconfig-simplelock.xml", "schema.xml");+ initCore("solrconfig-basic.xml", "schema.xml");if (checkForCoreInitException(LockObtainFailedException.class))return;fail("Expected " + LockObtainFailedException.class.getSimpleName());} finally {+ System.clearProperty("solr.tests.lockType");unIgnoreException("locked");indexWriter.close();directory.close();@@ -86,13 +88,15 @@ public class SolrCoreCheckLockOnStartupTest extends SolrTestCaseJ4 {ignoreException("locked");try {+ System.setProperty("solr.tests.lockType","native");//opening a new core on the same index- initCore("solrconfig-nativelock.xml", "schema.xml");+ initCore("solrconfig-basic.xml", "schema.xml");CoreContainer cc = h.getCoreContainer();if (checkForCoreInitException(LockObtainFailedException.class))return;fail("Expected " + LockObtainFailedException.class.getSimpleName());} finally {+ System.clearProperty("solr.tests.lockType");unIgnoreException("locked");indexWriter.close();directory.close();