mirror of https://github.com/apache/lucene.git
if -Dtests.postingsformat is specified, don't use Lucene3x codec
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1345506 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f7707d7d91
commit
2dee011e58
|
@ -1,5 +1,22 @@
|
|||
package org.apache.lucene.util;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
|
@ -23,29 +40,9 @@ import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
|
|||
import com.carrotsearch.randomizedtesting.RandomizedContext;
|
||||
|
||||
import static org.apache.lucene.util.LuceneTestCase.*;
|
||||
import static org.apache.lucene.util.LuceneTestCase.INFOSTREAM;
|
||||
import static org.apache.lucene.util.LuceneTestCase.TEST_CODEC;
|
||||
import static org.apache.lucene.util.LuceneTestCase.VERBOSE;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Setup and restore suite-level environment (fine grained junk that
|
||||
* doesn't fit anywhere else).
|
||||
|
@ -89,9 +86,9 @@ final class TestRuleSetupAndRestoreClassEnv extends AbstractBeforeAfterRule {
|
|||
final Object spiLoader = spiLoaderField.get(null);
|
||||
final java.lang.reflect.Field modifiableServicesField = NamedSPILoader.class.getDeclaredField("modifiableServices");
|
||||
modifiableServicesField.setAccessible(true);
|
||||
/* note: re-enable this if we make a Lucene4x impersonator
|
||||
@SuppressWarnings({"unchecked","rawtypes"}) final Map<String,Codec> serviceMap =
|
||||
(Map) modifiableServicesField.get(spiLoader);
|
||||
/* note: re-enable this if we make a Lucene4x impersonator
|
||||
if (!(Codec.forName("Lucene3x") instanceof PreFlexRWCodec)) {
|
||||
if (Constants.JAVA_VENDOR.startsWith("IBM")) {
|
||||
// definitely a buggy version
|
||||
|
@ -157,7 +154,10 @@ final class TestRuleSetupAndRestoreClassEnv extends AbstractBeforeAfterRule {
|
|||
savedCodec = Codec.getDefault();
|
||||
int randomVal = random.nextInt(10);
|
||||
/* note: re-enable this if we make a 4.x impersonator
|
||||
* if ("Lucene3x".equals(TEST_CODEC) || ("random".equals(TEST_CODEC) && randomVal < 2 && !shouldAvoidCodec("Lucene3x"))) { // preflex-only setup
|
||||
if ("Lucene3x".equals(TEST_CODEC) || ("random".equals(TEST_CODEC) &&
|
||||
"random".equals(TEST_POSTINGSFORMAT) &&
|
||||
randomVal < 2 &&
|
||||
!shouldAvoidCodec("Lucene3x"))) { // preflex-only setup
|
||||
codec = Codec.forName("Lucene3x");
|
||||
assert (codec instanceof PreFlexRWCodec) : "fix your classpath to have tests-framework.jar before lucene-core.jar";
|
||||
PREFLEX_IMPERSONATION_IS_ACTIVE = true;
|
||||
|
|
Loading…
Reference in New Issue