SOLR-4952: get SolrCoreCheckLockOnStartupTest using solrconfig.snippet.randomindexconfig.xml

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1511134 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris M. Hostetter 2013-08-06 22:13:40 +00:00
parent e778f261ad
commit c19a5527d8
4 changed files with 12 additions and 71 deletions

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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();