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 2011/11/01 04:37:24 UTC

svn commit: r1195797 - in /lucene/dev/branches/lucene2621: dev-tools/eclipse/ lucene/ lucene/contrib/ lucene/src/test-framework/ lucene/src/test-framework/java/ lucene/src/test-framework/java/org/ lucene/src/test-framework/java/org/apache/lucene/index/...

Author: rmuir
Date: Tue Nov  1 03:37:23 2011
New Revision: 1195797

URL: http://svn.apache.org/viewvc?rev=1195797&view=rev
Log:
LUCENE-3490: add test-framework Codec SPI

Added:
    lucene/dev/branches/lucene2621/lucene/src/test-framework/java/
    lucene/dev/branches/lucene2621/lucene/src/test-framework/java/org/
      - copied from r1195788, lucene/dev/branches/lucene2621/lucene/src/test-framework/org/
    lucene/dev/branches/lucene2621/lucene/src/test-framework/java/org/apache/lucene/index/codecs/spi/
    lucene/dev/branches/lucene2621/lucene/src/test-framework/java/org/apache/lucene/index/codecs/spi/_TestCodecProvider.java   (with props)
    lucene/dev/branches/lucene2621/lucene/src/test-framework/java/overview.html
      - copied unchanged from r1195788, lucene/dev/branches/lucene2621/lucene/src/test-framework/overview.html
    lucene/dev/branches/lucene2621/lucene/src/test-framework/resources/
Removed:
    lucene/dev/branches/lucene2621/lucene/src/test-framework/org/
    lucene/dev/branches/lucene2621/lucene/src/test-framework/overview.html
Modified:
    lucene/dev/branches/lucene2621/dev-tools/eclipse/dot.classpath
    lucene/dev/branches/lucene2621/lucene/build.xml
    lucene/dev/branches/lucene2621/lucene/common-build.xml
    lucene/dev/branches/lucene2621/lucene/contrib/contrib-build.xml
    lucene/dev/branches/lucene2621/lucene/src/test-framework/java/org/apache/lucene/index/codecs/mockintblock/MockFixedIntBlockPostingsFormat.java
    lucene/dev/branches/lucene2621/lucene/src/test-framework/java/org/apache/lucene/index/codecs/mockintblock/MockVariableIntBlockPostingsFormat.java
    lucene/dev/branches/lucene2621/lucene/src/test-framework/java/org/apache/lucene/index/codecs/mockrandom/MockRandomPostingsFormat.java

Modified: lucene/dev/branches/lucene2621/dev-tools/eclipse/dot.classpath
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/dev-tools/eclipse/dot.classpath?rev=1195797&r1=1195796&r2=1195797&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/dev-tools/eclipse/dot.classpath (original)
+++ lucene/dev/branches/lucene2621/dev-tools/eclipse/dot.classpath Tue Nov  1 03:37:23 2011
@@ -2,7 +2,8 @@
 <classpath>
 	<classpathentry kind="src" path="lucene/src/java"/>
 	<classpathentry kind="src" path="lucene/src/resources"/>
-	<classpathentry kind="src" path="lucene/src/test-framework"/>
+	<classpathentry kind="src" path="lucene/src/test-framework/java"/>
+	<classpathentry kind="src" path="lucene/src/test-framework/resources"/>
 	<classpathentry kind="src" path="lucene/src/test"/>
 	<classpathentry kind="src" path="lucene/contrib/demo/src/java"/>
 	<classpathentry kind="src" path="lucene/contrib/demo/src/resources"/>

Modified: lucene/dev/branches/lucene2621/lucene/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/build.xml?rev=1195797&r1=1195796&r2=1195797&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/build.xml (original)
+++ lucene/dev/branches/lucene2621/lucene/build.xml Tue Nov  1 03:37:23 2011
@@ -30,15 +30,15 @@
   </path>
 
   <path id="test.classpath">
-  	<path refid="classpath"/>
-    <path refid="junit-path"/>
     <pathelement location="${build.dir}/classes/test-framework"/>
+    <path refid="classpath"/>
+    <path refid="junit-path"/>
     <pathelement location="${build.dir}/classes/test"/>
   </path>
 
   <path id="junit.classpath">
-    <path refid="junit-path"/>
     <pathelement location="${build.dir}/classes/test-framework"/>
+    <path refid="junit-path"/>
     <pathelement location="${build.dir}/classes/test"/>
     <pathelement location="${build.dir}/classes/java"/>
     <pathelement path="${java.class.path}"/>

Modified: lucene/dev/branches/lucene2621/lucene/common-build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/common-build.xml?rev=1195797&r1=1195796&r2=1195797&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/common-build.xml (original)
+++ lucene/dev/branches/lucene2621/lucene/common-build.xml Tue Nov  1 03:37:23 2011
@@ -471,8 +471,13 @@
   </path>
   
   <target name="compile-test-framework" depends="compile-core">
-  	<compile-test-macro srcdir="${tests-framework.src.dir}" destdir="${common.dir}/build/classes/test-framework"
+  	<compile-test-macro srcdir="${tests-framework.src.dir}/java" destdir="${common.dir}/build/classes/test-framework"
   						test.classpath="test-framework.classpath"/>
+            <!-- Copy the resources folder (if existent) -->
+        <copy todir="${build.dir}/classes/test-framework" includeEmptyDirs="false">
+          <globmapper from="resources/*" to="*" handledirsep="yes"/>
+          <fileset dir="${tests-framework.src.dir}" includes="resources/**"/>
+       </copy>
   </target>
 
   <target name="compile-tools">

Modified: lucene/dev/branches/lucene2621/lucene/contrib/contrib-build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/contrib/contrib-build.xml?rev=1195797&r1=1195796&r2=1195797&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/contrib/contrib-build.xml (original)
+++ lucene/dev/branches/lucene2621/lucene/contrib/contrib-build.xml Tue Nov  1 03:37:23 2011
@@ -39,8 +39,8 @@
   <path id="classpath" refid="base.classpath"/>
   
   <path id="test.base.classpath">
-    <path refid="classpath"/>
     <pathelement location="${common.dir}/build/classes/test-framework"/>
+    <path refid="classpath"/>
     <path refid="junit-path"/>
     <pathelement location="${build.dir}/classes/java"/>
   </path>

Modified: lucene/dev/branches/lucene2621/lucene/src/test-framework/java/org/apache/lucene/index/codecs/mockintblock/MockFixedIntBlockPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/test-framework/java/org/apache/lucene/index/codecs/mockintblock/MockFixedIntBlockPostingsFormat.java?rev=1195797&r1=1195788&r2=1195797&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/test-framework/java/org/apache/lucene/index/codecs/mockintblock/MockFixedIntBlockPostingsFormat.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/test-framework/java/org/apache/lucene/index/codecs/mockintblock/MockFixedIntBlockPostingsFormat.java Tue Nov  1 03:37:23 2011
@@ -57,6 +57,7 @@ import org.apache.lucene.util.IOUtils;
  * used here just writes each block as a series of vInt.
  */
 
+// nocommit: does this write blocksize into the postings? it needs to!
 public class MockFixedIntBlockPostingsFormat extends PostingsFormat {
 
   private final int blockSize;

Modified: lucene/dev/branches/lucene2621/lucene/src/test-framework/java/org/apache/lucene/index/codecs/mockintblock/MockVariableIntBlockPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/test-framework/java/org/apache/lucene/index/codecs/mockintblock/MockVariableIntBlockPostingsFormat.java?rev=1195797&r1=1195788&r2=1195797&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/test-framework/java/org/apache/lucene/index/codecs/mockintblock/MockVariableIntBlockPostingsFormat.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/test-framework/java/org/apache/lucene/index/codecs/mockintblock/MockVariableIntBlockPostingsFormat.java Tue Nov  1 03:37:23 2011
@@ -61,6 +61,7 @@ import org.apache.lucene.util.IOUtils;
  * int is <= 3, else 2*baseBlockSize.
  */
 
+//nocommit: does this write blocksize into the postings? it needs to!
 public class MockVariableIntBlockPostingsFormat extends PostingsFormat {
   private final int baseBlockSize;
   

Modified: lucene/dev/branches/lucene2621/lucene/src/test-framework/java/org/apache/lucene/index/codecs/mockrandom/MockRandomPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/test-framework/java/org/apache/lucene/index/codecs/mockrandom/MockRandomPostingsFormat.java?rev=1195797&r1=1195788&r2=1195797&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/test-framework/java/org/apache/lucene/index/codecs/mockrandom/MockRandomPostingsFormat.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/test-framework/java/org/apache/lucene/index/codecs/mockrandom/MockRandomPostingsFormat.java Tue Nov  1 03:37:23 2011
@@ -73,6 +73,11 @@ public class MockRandomPostingsFormat ex
   private final Random seedRandom;
   private final String SEED_EXT = "sd";
   
+  public MockRandomPostingsFormat() {
+    // just for reading, we are gonna setSeed from the .seed file... right?
+    this(new Random());
+  }
+  
   public MockRandomPostingsFormat(Random random) {
     super("MockRandom");
     this.seedRandom = new Random(random.nextLong());

Added: lucene/dev/branches/lucene2621/lucene/src/test-framework/java/org/apache/lucene/index/codecs/spi/_TestCodecProvider.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/test-framework/java/org/apache/lucene/index/codecs/spi/_TestCodecProvider.java?rev=1195797&view=auto
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/test-framework/java/org/apache/lucene/index/codecs/spi/_TestCodecProvider.java (added)
+++ lucene/dev/branches/lucene2621/lucene/src/test-framework/java/org/apache/lucene/index/codecs/spi/_TestCodecProvider.java Tue Nov  1 03:37:23 2011
@@ -0,0 +1,47 @@
+package org.apache.lucene.index.codecs.spi;
+
+/**
+ * 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 org.apache.lucene.index.codecs.Codec;
+import org.apache.lucene.index.codecs.PostingsFormat;
+
+import org.apache.lucene.index.codecs.mockintblock.MockFixedIntBlockPostingsFormat;
+import org.apache.lucene.index.codecs.mockintblock.MockVariableIntBlockPostingsFormat;
+import org.apache.lucene.index.codecs.mockrandom.MockRandomPostingsFormat;
+import org.apache.lucene.index.codecs.mocksep.MockSepPostingsFormat;
+import org.apache.lucene.index.codecs.preflexrw.PreFlexRWCodec;
+
+public final class _TestCodecProvider extends SimpleCodecProvider {
+
+  public _TestCodecProvider() {
+    super(
+      Arrays.<Codec>asList(
+        new PreFlexRWCodec()
+      ),
+      Arrays.<PostingsFormat>asList(
+        new MockRandomPostingsFormat(),
+        new MockFixedIntBlockPostingsFormat(1),
+        new MockVariableIntBlockPostingsFormat(1),
+        new MockSepPostingsFormat()
+      )
+    );
+  }
+
+}