You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2012/09/29 18:35:12 UTC

svn commit: r1391835 - in /lucene/dev/trunk/lucene: codecs/src/test/org/apache/lucene/codecs/appending/ codecs/src/test/org/apache/lucene/codecs/block/ codecs/src/test/org/apache/lucene/codecs/blockterms/ codecs/src/test/org/apache/lucene/codecs/bloom/...

Author: rmuir
Date: Sat Sep 29 16:35:11 2012
New Revision: 1391835

URL: http://svn.apache.org/viewvc?rev=1391835&view=rev
Log:
LUCENE-4449: commit current state to calm jenkins

Added:
    lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/appending/TestAppendingPostingsFormat.java   (with props)
    lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/block/TestBlockPostingsFormat.java   (with props)
    lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/blockterms/
    lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/blockterms/TestFixedGapPostingsFormat.java   (with props)
    lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/bloom/
    lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/bloom/TestBloomPostingsFormat.java   (with props)
    lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/intblock/TestFixedIntBlockPostingsFormat.java   (with props)
    lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/intblock/TestVariableIntBlockPostingsFormat.java   (with props)
    lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/codecs/perfield/TestPerFieldPostingsFormat.java   (with props)
Modified:
    lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java
    lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/_TestUtil.java

Added: lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/appending/TestAppendingPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/appending/TestAppendingPostingsFormat.java?rev=1391835&view=auto
==============================================================================
--- lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/appending/TestAppendingPostingsFormat.java (added)
+++ lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/appending/TestAppendingPostingsFormat.java Sat Sep 29 16:35:11 2012
@@ -0,0 +1,34 @@
+package org.apache.lucene.codecs.appending;
+
+/*
+ * 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 org.apache.lucene.codecs.Codec;
+import org.apache.lucene.codecs.lucene40.Lucene40Codec;
+import org.apache.lucene.index.BasePostingsFormatTestCase;
+
+/**
+ * Tests AppendingPostingsFormat
+ */
+public class TestAppendingPostingsFormat extends BasePostingsFormatTestCase {
+  private final Codec codec = new AppendingCodec();
+
+  @Override
+  protected Codec getCodec() {
+    return codec;
+  }
+}

Added: lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/block/TestBlockPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/block/TestBlockPostingsFormat.java?rev=1391835&view=auto
==============================================================================
--- lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/block/TestBlockPostingsFormat.java (added)
+++ lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/block/TestBlockPostingsFormat.java Sat Sep 29 16:35:11 2012
@@ -0,0 +1,43 @@
+package org.apache.lucene.codecs.block;
+
+/*
+ * 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 org.apache.lucene.codecs.Codec;
+import org.apache.lucene.codecs.PostingsFormat;
+import org.apache.lucene.codecs.appending.AppendingCodec;
+import org.apache.lucene.codecs.block.BlockPostingsFormat;
+import org.apache.lucene.codecs.lucene40.Lucene40Codec;
+import org.apache.lucene.index.BasePostingsFormatTestCase;
+
+/**
+ * Tests BlockPostingsFormat
+ */
+public class TestBlockPostingsFormat extends BasePostingsFormatTestCase {
+  private final PostingsFormat postings = new BlockPostingsFormat();
+  private final Codec codec = new Lucene40Codec() {
+    @Override
+    public PostingsFormat getPostingsFormatForField(String field) {
+      return postings;
+    }
+  };
+
+  @Override
+  protected Codec getCodec() {
+    return codec;
+  }
+}

Added: lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/blockterms/TestFixedGapPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/blockterms/TestFixedGapPostingsFormat.java?rev=1391835&view=auto
==============================================================================
--- lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/blockterms/TestFixedGapPostingsFormat.java (added)
+++ lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/blockterms/TestFixedGapPostingsFormat.java Sat Sep 29 16:35:11 2012
@@ -0,0 +1,44 @@
+package org.apache.lucene.codecs.blockterms;
+
+/*
+ * 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 org.apache.lucene.codecs.Codec;
+import org.apache.lucene.codecs.PostingsFormat;
+import org.apache.lucene.codecs.lucene40.Lucene40Codec;
+import org.apache.lucene.codecs.lucene40ords.Lucene40WithOrds;
+import org.apache.lucene.index.BasePostingsFormatTestCase;
+
+/**
+ * Basic tests of a PF using FixedGap terms dictionary
+ */
+// TODO: we should add an instantiation for VarGap too to TestFramework, and a test in this package
+// TODO: ensure both of these are also in rotation in RandomCodec
+public class TestFixedGapPostingsFormat extends BasePostingsFormatTestCase {
+  private final PostingsFormat postings = new Lucene40WithOrds();
+  private final Codec codec = new Lucene40Codec() {
+    @Override
+    public PostingsFormat getPostingsFormatForField(String field) {
+      return postings;
+    }
+  };
+
+  @Override
+  protected Codec getCodec() {
+    return codec;
+  }
+}

Added: lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/bloom/TestBloomPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/bloom/TestBloomPostingsFormat.java?rev=1391835&view=auto
==============================================================================
--- lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/bloom/TestBloomPostingsFormat.java (added)
+++ lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/bloom/TestBloomPostingsFormat.java Sat Sep 29 16:35:11 2012
@@ -0,0 +1,41 @@
+package org.apache.lucene.codecs.bloom;
+
+/*
+ * 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 org.apache.lucene.codecs.Codec;
+import org.apache.lucene.codecs.PostingsFormat;
+import org.apache.lucene.codecs.lucene40.Lucene40Codec;
+import org.apache.lucene.index.BasePostingsFormatTestCase;
+
+/**
+ * Basic tests for BloomPostingsFormat
+ */
+public class TestBloomPostingsFormat extends BasePostingsFormatTestCase {
+  private final PostingsFormat postings = new TestBloomFilteredLucene40Postings();
+  private final Codec codec = new Lucene40Codec() {
+    @Override
+    public PostingsFormat getPostingsFormatForField(String field) {
+      return postings;
+    }
+  };
+
+  @Override
+  protected Codec getCodec() {
+    return codec;
+  }
+}

Added: lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/intblock/TestFixedIntBlockPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/intblock/TestFixedIntBlockPostingsFormat.java?rev=1391835&view=auto
==============================================================================
--- lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/intblock/TestFixedIntBlockPostingsFormat.java (added)
+++ lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/intblock/TestFixedIntBlockPostingsFormat.java Sat Sep 29 16:35:11 2012
@@ -0,0 +1,43 @@
+package org.apache.lucene.codecs.intblock;
+
+/*
+ * 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 org.apache.lucene.codecs.Codec;
+import org.apache.lucene.codecs.PostingsFormat;
+import org.apache.lucene.codecs.lucene40.Lucene40Codec;
+import org.apache.lucene.codecs.mockintblock.MockFixedIntBlockPostingsFormat;
+import org.apache.lucene.index.BasePostingsFormatTestCase;
+
+/**
+ * Basic tests for FixedIntBlock
+ */
+public class TestFixedIntBlockPostingsFormat extends BasePostingsFormatTestCase {
+  // TODO: randomize blocksize
+  private final PostingsFormat postings = new MockFixedIntBlockPostingsFormat();
+  private final Codec codec = new Lucene40Codec() {
+    @Override
+    public PostingsFormat getPostingsFormatForField(String field) {
+      return postings;
+    }
+  };
+
+  @Override
+  protected Codec getCodec() {
+    return codec;
+  }
+}

Added: lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/intblock/TestVariableIntBlockPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/intblock/TestVariableIntBlockPostingsFormat.java?rev=1391835&view=auto
==============================================================================
--- lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/intblock/TestVariableIntBlockPostingsFormat.java (added)
+++ lucene/dev/trunk/lucene/codecs/src/test/org/apache/lucene/codecs/intblock/TestVariableIntBlockPostingsFormat.java Sat Sep 29 16:35:11 2012
@@ -0,0 +1,43 @@
+package org.apache.lucene.codecs.intblock;
+
+/*
+ * 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 org.apache.lucene.codecs.Codec;
+import org.apache.lucene.codecs.PostingsFormat;
+import org.apache.lucene.codecs.lucene40.Lucene40Codec;
+import org.apache.lucene.codecs.mockintblock.MockVariableIntBlockPostingsFormat;
+import org.apache.lucene.index.BasePostingsFormatTestCase;
+
+/**
+ * Basic tests for VariableIntBlock
+ */
+public class TestVariableIntBlockPostingsFormat extends BasePostingsFormatTestCase {
+  // TODO: randomize blocksize
+  private final PostingsFormat postings = new MockVariableIntBlockPostingsFormat();
+  private final Codec codec = new Lucene40Codec() {
+    @Override
+    public PostingsFormat getPostingsFormatForField(String field) {
+      return postings;
+    }
+  };
+
+  @Override
+  protected Codec getCodec() {
+    return codec;
+  }
+}

Added: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/codecs/perfield/TestPerFieldPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/codecs/perfield/TestPerFieldPostingsFormat.java?rev=1391835&view=auto
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/codecs/perfield/TestPerFieldPostingsFormat.java (added)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/codecs/perfield/TestPerFieldPostingsFormat.java Sat Sep 29 16:35:11 2012
@@ -0,0 +1,43 @@
+package org.apache.lucene.codecs.perfield;
+
+/*
+ * 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.Collections;
+import java.util.Random;
+
+import org.apache.lucene.codecs.Codec;
+import org.apache.lucene.index.BasePostingsFormatTestCase;
+import org.apache.lucene.index.RandomCodec;
+
+/**
+ * Basic tests of PerFieldPostingsFormat
+ */
+public class TestPerFieldPostingsFormat extends BasePostingsFormatTestCase {
+  private Codec codec;
+  
+  @Override
+  public void setUp() throws Exception {
+    super.setUp();
+    codec = new RandomCodec(new Random(random().nextLong()), Collections.EMPTY_SET);
+  }
+  
+  @Override
+  protected Codec getCodec() {
+    return codec;
+  }
+}

Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java?rev=1391835&r1=1391834&r2=1391835&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java Sat Sep 29 16:35:11 2012
@@ -135,10 +135,10 @@ public abstract class BasePostingsFormat
   }
 
   // Holds all postings:
-  private static Map<String,Map<BytesRef,List<Posting>>> fields = new TreeMap<String,Map<BytesRef,List<Posting>>>();
+  private static Map<String,Map<BytesRef,List<Posting>>> fields;
 
   // Holds only live doc postings:
-  private static Map<String,Map<BytesRef,List<Posting>>> fieldsLive = new TreeMap<String,Map<BytesRef,List<Posting>>>();
+  private static Map<String,Map<BytesRef,List<Posting>>> fieldsLive;
 
   private static FieldInfos fieldInfos;
 
@@ -153,6 +153,8 @@ public abstract class BasePostingsFormat
 
   @BeforeClass
   public static void createPostings() throws IOException {
+    fields = new TreeMap<String,Map<BytesRef,List<Posting>>>();
+    fieldsLive = new TreeMap<String,Map<BytesRef,List<Posting>>>();
 
     final int numFields = _TestUtil.nextInt(random(), 1, 5);
     if (VERBOSE) {
@@ -368,7 +370,7 @@ public abstract class BasePostingsFormat
     for(int fieldUpto=0;fieldUpto<fields.size();fieldUpto++) {
       FieldInfo oldFieldInfo = fieldInfos.fieldInfo(fieldUpto);
 
-      String pf = _TestUtil.getPostingsFormat(oldFieldInfo.name);
+      String pf = _TestUtil.getPostingsFormat(codec, oldFieldInfo.name);
       int fieldMaxIndexOption;
       if (doesntSupportOffsets.contains(pf)) {
         fieldMaxIndexOption = Math.min(maxIndexOptionNoOffsets, maxIndexOption);

Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/_TestUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/_TestUtil.java?rev=1391835&r1=1391834&r2=1391835&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/_TestUtil.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/_TestUtil.java Sat Sep 29 16:35:11 2012
@@ -662,7 +662,11 @@ public class _TestUtil {
   // TODO: generalize all 'test-checks-for-crazy-codecs' to
   // annotations (LUCENE-3489)
   public static String getPostingsFormat(String field) {
-    PostingsFormat p = Codec.getDefault().postingsFormat();
+    return getPostingsFormat(Codec.getDefault(), field);
+  }
+  
+  public static String getPostingsFormat(Codec codec, String field) {
+    PostingsFormat p = codec.postingsFormat();
     if (p instanceof PerFieldPostingsFormat) {
       return ((PerFieldPostingsFormat)p).getPostingsFormatForField(field).getName();
     } else {