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

TestGdataIndexDocument

public class TestGdataIndexDocument extends TestCase
Copyright 2004 The Apache Software Foundation Licensed 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.

Fields Summary
static String
ENTRYID
static String
FEEDID
GDataIndexDocument
delDocument
GDataIndexDocument
updDocument
GDataIndexDocument
insDocument
Constructors Summary
Methods Summary
protected voidsetUp()

         
        this.delDocument = new GDataIndexDocument(IndexAction.DELETE,ENTRYID,FEEDID,false,true);
        this.insDocument = new GDataIndexDocument(IndexAction.INSERT,ENTRYID,FEEDID,true,false);
        this.updDocument = new GDataIndexDocument(IndexAction.UPDATE,ENTRYID,FEEDID,false,true);
    
protected voidtearDown()

        super.tearDown();
    
public voidtestAddField()

        assertEquals(0,this.delDocument.fields.size());    
        this.delDocument.addField(null);
        assertEquals(0,this.delDocument.fields.size());
        IndexSchemaField ifield = new IndexSchemaField();
        ifield.setContentType(ContentType.TEXT);
        this.delDocument.addField(ContentStrategy.getFieldStrategy(ifield));
        assertEquals(1,this.delDocument.fields.size());
    
public voidtestCommitAfter()

        assertTrue(this.insDocument.commitAfter());
        assertFalse(this.updDocument.commitAfter());
        assertFalse(this.delDocument.commitAfter());
    
public voidtestGetDeletealbe()

        assertNotNull(this.insDocument.getDeletealbe());
        Term t = this.insDocument.getDeletealbe();
        assertEquals(IndexDocument.FIELD_ENTRY_ID,t.field());
        assertEquals(ENTRYID,t.text());
    
public voidtestGetWriteable()

        assertNotNull(this.insDocument.getWriteable());
        Document doc = this.insDocument.getWriteable();
        assertEquals(2,doc.getFields().size());
        assertEquals(ENTRYID,doc.getField(GDataIndexDocument.FIELD_ENTRY_ID).stringValue());
        assertEquals(FEEDID,doc.getField(GDataIndexDocument.FIELD_FEED_ID).stringValue());
        
        
    
public voidtestIsDelete()

        assertFalse(this.insDocument.isDelete());
        assertFalse(this.updDocument.isDelete());
        assertTrue(this.delDocument.isDelete());
    
public voidtestIsInsert()

        assertTrue(this.insDocument.isInsert());
        assertFalse(this.updDocument.isInsert());
        assertFalse(this.delDocument.isInsert());
    
public voidtestIsUpdate()

        assertFalse(this.insDocument.isUpdate());
        assertTrue(this.updDocument.isUpdate());
        assertFalse(this.delDocument.isUpdate());
    
public voidtestOptimizeAfter()

        assertFalse(this.insDocument.optimizeAfter());
        assertTrue(this.updDocument.optimizeAfter());
        assertTrue(this.delDocument.optimizeAfter());