FileDocCategorySizeDatePackage
TestGdataIndexWriter.javaAPI DocApache Lucene 2.1.03741Wed Feb 14 10:46:02 GMT 2007org.apache.lucene.gdata.search.index

TestGdataIndexWriter

public class TestGdataIndexWriter extends TestCase
author
Simon Willnauer

Fields Summary
org.apache.lucene.gdata.search.config.IndexSchema
schemaNoPerFielAnalyzer
org.apache.lucene.gdata.search.config.IndexSchema
schemaPerFielAnalyzer
long
VALUE_GT_DEFAULT_LONG
int
VALUE_GT_DEFAULT_INT
Constructors Summary
Methods Summary
protected voidsetUp()

    
         
        this.schemaNoPerFielAnalyzer = new IndexSchema();
        this.schemaPerFielAnalyzer = new IndexSchema();
        IndexSchemaField field = new IndexSchemaField();
        field.setName("someField");
        field.setAnalyzerClass(StopAnalyzer.class);
        this.schemaPerFielAnalyzer.addSchemaField(field);
        this.schemaPerFielAnalyzer.setCommitLockTimeout(VALUE_GT_DEFAULT_LONG);
        this.schemaPerFielAnalyzer.setMaxBufferedDocs(VALUE_GT_DEFAULT_INT);
        this.schemaPerFielAnalyzer.setMaxFieldLength(VALUE_GT_DEFAULT_INT);
        this.schemaPerFielAnalyzer.setMaxMergeDocs(VALUE_GT_DEFAULT_INT);
        this.schemaPerFielAnalyzer.setMergeFactor(VALUE_GT_DEFAULT_INT);
        this.schemaPerFielAnalyzer.setWriteLockTimeout(VALUE_GT_DEFAULT_LONG);
        this.schemaPerFielAnalyzer.setUseCompoundFile(true);
    
public voidtestGDataIndexWriter()
Test method for 'org.apache.lucene.gdata.search.index.GDataIndexWriter.GDataIndexWriter(Directory, boolean, IndexSchema)'

throws
IOException

        try{
        new GDataIndexWriter(new RAMDirectory(),true,null);
        fail("no index schema");
        }catch (IllegalArgumentException e) {}
        GDataIndexWriter writer = new GDataIndexWriter(new RAMDirectory(),true,this.schemaNoPerFielAnalyzer);
        assertTrue(writer.getAnalyzer().getClass() == StandardAnalyzer.class);
        
        writer = new GDataIndexWriter(new RAMDirectory(),true,this.schemaPerFielAnalyzer);
        assertTrue(writer.getAnalyzer().getClass() == PerFieldAnalyzerWrapper.class);
        //TODO fix this - index writer has no commitlocktimeout setter anymore (lockless commits)
//        assertEquals(VALUE_GT_DEFAULT_LONG,writer.getCommitLockTimeout());
        assertEquals(VALUE_GT_DEFAULT_LONG,writer.getWriteLockTimeout());
        assertEquals(VALUE_GT_DEFAULT_INT,writer.getMaxBufferedDocs());
        assertEquals(VALUE_GT_DEFAULT_INT,writer.getMaxMergeDocs());
        assertEquals(VALUE_GT_DEFAULT_INT,writer.getMaxFieldLength());
        assertEquals(VALUE_GT_DEFAULT_INT,writer.getMergeFactor());
        assertTrue(writer.getUseCompoundFile());