mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smar...@apache.org
Subject svn commit: r1496589 - in /mahout/trunk/integration/src/test/java/org/apache/mahout/text: LuceneSegmentInputSplitTest.java LuceneStorageConfigurationTest.java doc/MultipleFieldsDocument.java doc/UnstoredFieldsDocument.java
Date Tue, 25 Jun 2013 18:57:25 GMT
Author: smarthi
Date: Tue Jun 25 18:57:25 2013
New Revision: 1496589

URL: http://svn.apache.org/r1496589
Log:
MAHOUT-1269: Cleanup deprecated Lucene 3.x API calls from lucene2seq utility unit tests

Modified:
    mahout/trunk/integration/src/test/java/org/apache/mahout/text/LuceneSegmentInputSplitTest.java
    mahout/trunk/integration/src/test/java/org/apache/mahout/text/LuceneStorageConfigurationTest.java
    mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/MultipleFieldsDocument.java
    mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/UnstoredFieldsDocument.java

Modified: mahout/trunk/integration/src/test/java/org/apache/mahout/text/LuceneSegmentInputSplitTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/test/java/org/apache/mahout/text/LuceneSegmentInputSplitTest.java?rev=1496589&r1=1496588&r2=1496589&view=diff
==============================================================================
--- mahout/trunk/integration/src/test/java/org/apache/mahout/text/LuceneSegmentInputSplitTest.java
(original)
+++ mahout/trunk/integration/src/test/java/org/apache/mahout/text/LuceneSegmentInputSplitTest.java
Tue Jun 25 18:57:25 2013
@@ -33,16 +33,16 @@ import static java.util.Arrays.asList;
 
 public class LuceneSegmentInputSplitTest extends AbstractLuceneStorageTest {
 
-  private Configuration conf;
+  private Configuration configuration;
 
   @Before
   public void before() throws IOException {
-    conf = new Configuration();
+    configuration = new Configuration();
   }
 
   @After
   public void after() throws IOException {
-    HadoopUtil.delete(conf, indexPath1);
+    HadoopUtil.delete(configuration, indexPath1);
   }
 
   @Test
@@ -73,12 +73,12 @@ public class LuceneSegmentInputSplitTest
     }
 
     LuceneSegmentInputSplit inputSplit = new LuceneSegmentInputSplit(indexPath1, "_3", 1000);
-    inputSplit.getSegment(conf);
+    inputSplit.getSegment(configuration);
   }
 
   private void assertSegmentContainsOneDoc(String segmentName) throws IOException {
     LuceneSegmentInputSplit inputSplit = new LuceneSegmentInputSplit(indexPath1, segmentName,
1000);
-    SegmentInfoPerCommit segment = inputSplit.getSegment(conf);
+    SegmentInfoPerCommit segment = inputSplit.getSegment(configuration);
     SegmentReader segmentReader = new SegmentReader(segment, 1, IOContext.READ);//SegmentReader.get(true,
segment, 1);
     assertEquals(segmentName, segment.info.name);
     assertEquals(1, segmentReader.numDocs());

Modified: mahout/trunk/integration/src/test/java/org/apache/mahout/text/LuceneStorageConfigurationTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/test/java/org/apache/mahout/text/LuceneStorageConfigurationTest.java?rev=1496589&r1=1496588&r2=1496589&view=diff
==============================================================================
--- mahout/trunk/integration/src/test/java/org/apache/mahout/text/LuceneStorageConfigurationTest.java
(original)
+++ mahout/trunk/integration/src/test/java/org/apache/mahout/text/LuceneStorageConfigurationTest.java
Tue Jun 25 18:57:25 2013
@@ -29,16 +29,17 @@ public class LuceneStorageConfigurationT
   
   @Test
   public void testSerialization() throws Exception {
-    Configuration conf = new Configuration();
+    Configuration configuration = new Configuration();
     Path indexPath = new Path("indexPath");
     Path outputPath = new Path("outputPath");
-    LuceneStorageConfiguration luceneStorageConf = new LuceneStorageConfiguration(conf, asList(indexPath),
outputPath, "id", asList("field"));
+    LuceneStorageConfiguration luceneStorageConfiguration =
+      new LuceneStorageConfiguration(configuration, asList(indexPath), outputPath, "id",
asList("field"));
 
-    Configuration serializedConf = luceneStorageConf.serialize();
+    Configuration serializedConfiguration = luceneStorageConfiguration.serialize();
 
-    LuceneStorageConfiguration deserializedConf = new LuceneStorageConfiguration(serializedConf);
+    LuceneStorageConfiguration deSerializedConfiguration = new LuceneStorageConfiguration(serializedConfiguration);
 
-    assertEquals(luceneStorageConf, deserializedConf);
+    assertEquals(luceneStorageConfiguration, deSerializedConfiguration);
   }
   
   @Test(expected = IllegalArgumentException.class)

Modified: mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/MultipleFieldsDocument.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/MultipleFieldsDocument.java?rev=1496589&r1=1496588&r2=1496589&view=diff
==============================================================================
--- mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/MultipleFieldsDocument.java
(original)
+++ mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/MultipleFieldsDocument.java
Tue Jun 25 18:57:25 2013
@@ -18,6 +18,7 @@ package org.apache.mahout.text.doc;
 
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
+import org.apache.lucene.document.TextField;
 
 /**
  * Used for testing lucene2seq
@@ -48,11 +49,8 @@ public class MultipleFieldsDocument exte
   public Document asLuceneDocument() {
     Document document = super.asLuceneDocument();
 
-    Field field1 = new Field(FIELD1, this.field1, Field.Store.YES, Field.Index.ANALYZED);
-    Field field2 = new Field(FIELD2, this.field2, Field.Store.YES, Field.Index.ANALYZED);
-
-    document.add(field1);
-    document.add(field2);
+    document.add(new TextField(FIELD1, this.field1, Field.Store.YES));
+    document.add(new TextField(FIELD2, this.field2, Field.Store.YES));
 
     return document;
   }

Modified: mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/UnstoredFieldsDocument.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/UnstoredFieldsDocument.java?rev=1496589&r1=1496588&r2=1496589&view=diff
==============================================================================
--- mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/UnstoredFieldsDocument.java
(original)
+++ mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/UnstoredFieldsDocument.java
Tue Jun 25 18:57:25 2013
@@ -18,6 +18,7 @@ package org.apache.mahout.text.doc;
 
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
+import org.apache.lucene.document.StringField;
 
 /**
  * Used for testing lucene2seq
@@ -34,9 +35,7 @@ public class UnstoredFieldsDocument exte
   public Document asLuceneDocument() {
     Document document = super.asLuceneDocument();
 
-    Field unStoredField = new Field(UNSTORED_FIELD, "", Field.Store.NO, Field.Index.NOT_ANALYZED);
-
-    document.add(unStoredField);
+    document.add(new StringField(UNSTORED_FIELD, "", Field.Store.NO));
 
     return document;
   }



Mime
View raw message