You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2012/06/02 15:11:40 UTC
svn commit: r1345506 - in /lucene/dev/trunk: ./
lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java
Author: mikemccand
Date: Sat Jun 2 13:11:40 2012
New Revision: 1345506
URL: http://svn.apache.org/viewvc?rev=1345506&view=rev
Log:
if -Dtests.postingsformat is specified, don't use Lucene3x codec
Modified:
lucene/dev/trunk/ (props changed)
lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java?rev=1345506&r1=1345505&r2=1345506&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java Sat Jun 2 13:11:40 2012
@@ -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,28 +40,8 @@ import org.apache.lucene.util.LuceneTest
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
@@ -89,9 +86,9 @@ final class TestRuleSetupAndRestoreClass
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 TestRuleSetupAndRestoreClass
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;