lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yo...@apache.org
Subject svn commit: r430568 [7/8] - in /lucene/java/trunk/contrib/gdata-server: ./ lib/ src/java/org/apache/lucene/gdata/data/ src/java/org/apache/lucene/gdata/search/ src/java/org/apache/lucene/gdata/search/analysis/ src/java/org/apache/lucene/gdata/search/co...
Date Thu, 10 Aug 2006 22:32:47 GMT
Added: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/index/TestIndexController.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/index/TestIndexController.java?rev=430568&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/index/TestIndexController.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/index/TestIndexController.java Thu Aug 10 15:32:40 2006
@@ -0,0 +1,381 @@
+/**
+ * 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.
+ */
+package org.apache.lucene.gdata.search.index;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+
+import junit.framework.TestCase;
+
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.gdata.data.ServerBaseEntry;
+import org.apache.lucene.gdata.search.GDataSearcher;
+import org.apache.lucene.gdata.search.config.IndexSchema;
+import org.apache.lucene.gdata.search.config.IndexSchemaField;
+import org.apache.lucene.gdata.search.config.IndexSchemaField.ContentType;
+import org.apache.lucene.gdata.search.index.IndexController.ServiceIndex;
+import org.apache.lucene.gdata.server.registry.GDataServerRegistry;
+import org.apache.lucene.gdata.utils.ProvidedServiceStub;
+import org.apache.lucene.gdata.utils.ReferenceCounter;
+import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.Term;
+import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.TermQuery;
+
+
+/**
+ * @author Simon Willnauer
+ * 
+ */
+public class TestIndexController extends TestCase {
+    IndexController controller;
+
+    IndexSchema schema;
+
+    File indexLocation;
+
+    protected void setUp() throws Exception {
+        this.controller = new IndexController();
+        GDataServerRegistry reg = GDataServerRegistry.getRegistry();
+
+        this.indexLocation = new File(System.getProperty("java.io.tmpdir"));
+        
+        
+        ProvidedServiceStub stub = new ProvidedServiceStub();
+        this.schema = new IndexSchema();
+        // must be set
+        this.schema.setDefaultSearchField("content");
+        this.schema.setName(ProvidedServiceStub.SERVICE_NAME);
+        this.schema.setIndexLocation(this.indexLocation.getAbsolutePath());
+        IndexSchemaField field = new IndexSchemaField();
+        field.setName("content");
+        field.setPath("/somePath");
+        field.setContentType(ContentType.TEXT);
+        this.schema.addSchemaField(field);
+        stub.setIndexSchema(this.schema);
+
+        reg.registerService(stub);
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        GDataServerRegistry.getRegistry().destroy();
+        this.controller.destroy();
+        /*
+         * this file will be created by the controller
+         */
+        File toDel = new File(this.indexLocation,
+                ProvidedServiceStub.SERVICE_NAME);
+        delAllFiles(toDel);
+    }
+
+    /*
+     * del all created files
+     */
+    private void delAllFiles(File dir) {
+        if (dir == null || !dir.exists())
+            return;
+        File[] files = dir.listFiles();
+        for (int i = 0; i < files.length; i++) {
+            while (!files[i].canWrite()) {
+            }
+            ;
+            files[i].delete();
+        }
+        dir.delete();
+    }
+
+    /*
+     * Test method for
+     * 'org.apache.lucene.gdata.search.index.IndexController.initialize()'
+     */
+    public void testInitialize() {
+        this.controller.initialize();
+        assertTrue(this.controller.indexerMap
+                .containsKey(ProvidedServiceStub.SERVICE_NAME));
+        ServiceIndex bean = this.controller.indexerMap
+                .get(ProvidedServiceStub.SERVICE_NAME);
+        assertNotNull(bean);
+        assertNotNull(bean.getIndexer());
+        assertSame(this.schema, bean.getSchema());
+        assertTrue(GDataServerRegistry.getRegistry().getEntryEventMediator()
+                .isListenerRegistered(this.controller));
+
+    }
+
+    /*
+     * Test method for
+     * 'org.apache.lucene.gdata.search.index.IndexController.initialize()'
+     */
+    public void testInitializeValueMissing() {
+        this.schema.setIndexLocation(null);
+        try {
+
+            this.controller.initialize();
+            fail("missing index location");
+        } catch (RuntimeException e) {
+        }
+    }
+
+    /*
+     * Test method for
+     * 'org.apache.lucene.gdata.search.index.IndexController.addIndexSchema(IndexSchema)'
+     */
+    public void testAddIndexSchema() {
+        this.controller.initialize();
+        assertEquals(1, this.controller.indexerMap.size());
+        try {
+            this.controller.addIndexSchema(this.schema);
+            fail("schema already added");
+        } catch (IllegalStateException e) {
+
+        }
+        this.schema.setName(null);
+        try {
+            this.controller.addIndexSchema(this.schema);
+            fail("schema name is null");
+        } catch (IllegalStateException e) {
+
+        }
+
+        this.schema.setName("someOthername");
+        this.controller.addIndexSchema(this.schema);
+        assertEquals(2, this.controller.indexerMap.size());
+
+    }
+
+    /*
+     * Test method for
+     * 'org.apache.lucene.gdata.search.index.IndexController.createIndexer(IndexSchema)'
+     */
+    public void testCreateIndexDirectory() throws IOException {
+        File f = new File(System.getProperty("java.io.tmpdir"), "gdataindexdir"
+                + System.currentTimeMillis());
+        f.mkdir();
+        f.deleteOnExit();
+        IndexWriter w = new IndexWriter(f, new StandardAnalyzer(), true);
+        Document d = new Document();
+        d.add(new Field("test", "test", Field.Store.NO, Field.Index.TOKENIZED));
+        w.addDocument(d);
+        w.close();
+        assertFalse(this.controller.createIndexDirectory(f));
+        // throw away files in the directory
+        delAllFiles(f);
+        File f1 = new File(System.getProperty("java.io.tmpdir"), "newIndexDir"
+                + System.currentTimeMillis());
+        f1.mkdir();
+        f1.deleteOnExit();
+        assertTrue(this.controller.createIndexDirectory(f1));
+    }
+
+    /*
+     * Test method for
+     * 'org.apache.lucene.gdata.search.index.IndexController.createIndexLocation(String,
+     * String)'
+     */
+    public void testCreateIndexLocation() throws IOException {
+        File f = new File(System.getProperty("java.io.tmpdir"), "gdatadir"
+                + System.currentTimeMillis());
+        f.mkdir();
+        f.deleteOnExit();
+
+        assertEquals(f.getAbsolutePath(), this.controller.createIndexLocation(
+                f.getParent(), f.getName()).getAbsolutePath());
+        ;
+        File pFile = new File(System.getProperty("java.io.tmpdir"), "gdatafile"
+                + System.currentTimeMillis());
+        pFile.deleteOnExit();
+        try{
+        this.controller.createIndexLocation(pFile.getParent(),pFile.getAbsolutePath());
+        fail("can not create dir");
+        }catch (RuntimeException e) {
+            
+        }
+        assertTrue(pFile.createNewFile());
+        try {
+            this.controller.createIndexLocation(pFile.getParent(), pFile
+                    .getName());
+            fail("file is not a directory");
+        } catch (IllegalArgumentException e) {
+
+        }
+        try {
+            this.controller.createIndexLocation(pFile.getName(), pFile
+                    .getName());
+            fail("parent is not a directory");
+        } catch (IllegalArgumentException e) {
+
+        }
+        try{
+            this.controller.createIndexLocation(null,null);
+            fail("null");
+        }catch (GdataIndexerException e) {
+
+        }
+    }
+
+    /*
+     * Test method for
+     * 'org.apache.lucene.gdata.search.index.IndexController.getServiceSearcher(ProvidedService)'
+     */
+    public void testGetServiceSearcher() {
+
+        this.controller.initialize();
+        ReferenceCounter<IndexSearcher> refCounter = this.controller.indexerMap
+                .get(ProvidedServiceStub.SERVICE_NAME).getSearcher();
+        GDataSearcher searcher = this.controller
+                .getServiceSearcher(new ProvidedServiceStub());
+        assertNotNull(searcher);
+        GDataSearcher sameSearcher = this.controller
+                .getServiceSearcher(new ProvidedServiceStub());
+        assertSame(refCounter, this.controller.indexerMap.get(
+                ProvidedServiceStub.SERVICE_NAME).getSearcher());
+
+        this.controller.commitCallBack(ProvidedServiceStub.SERVICE_NAME);
+        GDataSearcher newSearcher = this.controller
+                .getServiceSearcher(new ProvidedServiceStub());
+        assertNotSame(refCounter, this.controller.indexerMap.get(
+                ProvidedServiceStub.SERVICE_NAME).getSearcher());
+
+        sameSearcher.close();
+        searcher.close();
+        newSearcher.close();
+
+    }
+
+    public void testDestroy() {
+        this.controller.initialize();
+        try {
+            this.controller.initialize();
+            fail("controller is initialized");
+        } catch (IllegalStateException e) {
+        }
+        this.controller.destroy();
+        try {
+            this.controller.getServiceSearcher(null);
+            fail("controller is closed");
+        } catch (IllegalStateException e) {
+        }
+        try {
+            this.controller.commitCallBack("null");
+            fail("controller is closed");
+        } catch (IllegalStateException e) {
+        }
+        
+        try {
+            this.controller.destroy();
+            fail("controller is closed");
+        } catch (IllegalStateException e) {
+        }   
+        try {
+            this.controller.addIndexSchema(null);
+            fail("controller is closed");
+        } catch (IllegalStateException e) {
+        }
+        /*
+         * init again to destroy in teardown
+         */
+        this.controller.initialize();
+    }
+    
+    
+    public void testfireInsertEvent(){
+        try{
+        this.controller.fireInsertEvent(null);
+        fail("not initialized");
+        }catch (IllegalStateException e) {
+            // TODO: handle exception
+        }
+        this.controller.initialize();
+        ServerBaseEntry e = new ServerBaseEntry();
+        e.setId("someId");
+        e.setFeedId("someId");
+        e.setServiceConfig(new ProvidedServiceStub());
+        this.controller.fireInsertEvent(e);
+    }
+    
+    public void testCreateNewIndexTask() throws InterruptedException, IOException{
+        this.schema.setCommitAfterDocuments(1);
+        this.schema.setOptimizeAfterCommit(1);
+        IndexSchemaField f = new IndexSchemaField();
+        f.setName("myField");
+        f.setContentType(ContentType.KEYWORD);
+        f.setPath("entry/id");
+        this.schema.addSchemaField(f);
+        this.controller.initialize();
+        ServerBaseEntry e = new ServerBaseEntry();
+        e.setId("someId");
+        e.setFeedId("someId");
+        e.setServiceConfig(new ProvidedServiceStub());
+        CommitListener l = new CommitListener();
+        l.createLatch(1);
+        ServiceIndex sIndex = this.controller.indexerMap.get(this.schema.getName());
+        sIndex.getIndexer().registerIndexEventListener(l);
+        this.controller.fireInsertEvent(e);
+        l.waitOnLatch();      
+       
+       assertEquals(1,sIndex.getIndexer().optimized.get());
+       assertEquals(1,sIndex.getIndexer().committed.get());
+       
+       sIndex.getIndexer().removeIndexEventListener(l);
+       
+       
+       e = new ServerBaseEntry();
+       e.setId("someId");
+       e.setFeedId("someId");
+       e.setServiceConfig(new ProvidedServiceStub());
+       l = new CommitListener();
+       l.createLatch(1);
+        sIndex = this.controller.indexerMap.get(this.schema.getName());
+       sIndex.getIndexer().registerIndexEventListener(l);
+       this.controller.fireUpdateEvent(e);
+       l.waitOnLatch();      
+      
+      assertEquals(2,sIndex.getIndexer().optimized.get());
+      assertEquals(2,sIndex.getIndexer().committed.get());
+      
+      GDataSearcher<String> searcher = this.controller.getServiceSearcher(e.getServiceConfig());
+      List<String> results = searcher.search(new TermQuery(new Term(IndexDocument.FIELD_ENTRY_ID,"someId")),10,0,"someId");
+      assertEquals(1,results.size());
+      searcher.close();
+      
+       
+        
+    }
+    
+    static class CommitListener implements IndexEventListener{
+        public CountDownLatch latch;
+        
+        public void createLatch(int count){
+            this.latch = new CountDownLatch(count);
+        }
+        public void waitOnLatch() throws InterruptedException{
+            if(latch != null)
+            latch.await();
+        }
+
+        public void commitCallBack(String service) {
+            if(this.latch != null)
+            this.latch.countDown();
+        }
+        
+    }
+
+}

Propchange: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/index/TestIndexController.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/index/TestIndexController.java
------------------------------------------------------------------------------
    svn:executable = *

Added: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/index/TestIndexLogReader.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/index/TestIndexLogReader.java?rev=430568&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/index/TestIndexLogReader.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/index/TestIndexLogReader.java Thu Aug 10 15:32:40 2006
@@ -0,0 +1,139 @@
+/** 
+ * 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. 
+ */
+package org.apache.lucene.gdata.search.index;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.xml.sax.SAXException;
+
+import junit.framework.TestCase;
+
+/**
+ * @author Simon Willnauer
+ *
+ */
+public class TestIndexLogReader extends TestCase {
+    File logFile;
+    Map<String, IndexAction> actions;
+    protected void setUp() throws Exception {
+        this.logFile = new File(System.getProperty("java.io.tmpdir"),"log");
+        this.logFile.deleteOnExit();
+        this.logFile.createNewFile();
+        this.actions = new HashMap<String,IndexAction>();
+   
+        
+    }
+    private IndexLogWriter writeLog() throws IOException{
+        this.actions = new HashMap<String,IndexAction>();
+        IndexLogWriter writer = new IndexLogWriter(this.logFile);
+        boolean totwice = true;
+        for (int i = 0; i < 10; i++) {
+            IndexAction a = null;
+            if(i%3 ==0)
+                a= IndexAction.INSERT;
+            if(i%3 ==1)
+                a= IndexAction.UPDATE;
+            if(i%3 ==2)
+                a= IndexAction.DELETE;
+            this.actions.put(""+i,a);
+            writer.writeAction(""+i,a);
+            /*
+             * double action
+             */
+            if(i == 9 && totwice){
+                i = 0;
+                totwice = false;
+            }
+        }
+        return writer;
+    }
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        this.logFile.delete();
+    }
+
+    /*
+     * Test method for 'org.apache.lucene.gdata.search.index.IndexLogReader.readIndexLog(File, Map<String, IndexAction>)'
+     */
+    public void testReadIndexLog() throws SAXException, IOException {
+        writeLog().close();
+        
+        Map<String,IndexAction> readActionMap = new HashMap<String,IndexAction>();
+        IndexLogReader.readIndexLog(this.logFile,readActionMap);
+        Set<String> keySet = this.actions.keySet();
+        assertEquals(10,keySet.size());
+        for (String string : keySet) {
+            assertTrue(readActionMap.get(string).equals(actions.get(string)));
+        }
+        
+       
+        
+    }
+    
+    /*
+     * Test method for 'org.apache.lucene.gdata.search.index.IndexLogReader.readIndexLog(File, Map<String, IndexAction>)'
+     */
+    public void testReadIndexLogNoInputMap() throws SAXException, IOException {
+        writeLog().close();
+      
+        Map<String,IndexAction> readActionMap = IndexLogReader.readIndexLog(this.logFile,null);
+        Set<String> keySet = this.actions.keySet();
+        assertEquals(10,keySet.size());
+        for (String string : keySet) {
+            assertTrue(readActionMap.get(string).equals(actions.get(string)));
+        }
+        
+    }
+    
+    /*
+     * Test method for 'org.apache.lucene.gdata.search.index.IndexLogReader.readIndexLog(File, Map<String, IndexAction>)'
+     */
+    public void testReadIndexLogFixLogFile() throws SAXException, IOException {
+        writeLog();
+          
+        Map<String,IndexAction> readActionMap = IndexLogReader.readIndexLog(this.logFile,null);
+        Set<String> keySet = this.actions.keySet();
+        assertEquals(10,keySet.size());
+        for (String string : keySet) {
+            assertTrue(readActionMap.get(string).equals(actions.get(string)));
+        }
+        
+    }
+    
+    public void testWriterClosed()throws SAXException, IOException{
+        IndexLogWriter writer = writeLog();
+        writer.close();
+        try{
+            writer.writeAction(null,null);
+            fail("writer is closed");
+        }catch (IllegalStateException e) {
+          
+        }
+        try{
+            writer.close();
+            fail("writer is closed");
+        }catch (IllegalStateException e) {
+          
+        }
+        
+        
+    }
+
+}

Propchange: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/index/TestIndexLogReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/index/TestIndexLogReader.java
------------------------------------------------------------------------------
    svn:executable = *

Added: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/index/TestindexDocumentBuilderTask.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/index/TestindexDocumentBuilderTask.java?rev=430568&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/index/TestindexDocumentBuilderTask.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/index/TestindexDocumentBuilderTask.java Thu Aug 10 15:32:40 2006
@@ -0,0 +1,163 @@
+/** 
+ * 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. 
+ */
+package org.apache.lucene.gdata.search.index;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+import junit.framework.TestCase;
+
+import org.apache.lucene.gdata.data.ServerBaseEntry;
+import org.apache.lucene.gdata.search.config.IndexSchema;
+import org.apache.lucene.gdata.search.config.IndexSchemaField;
+import org.apache.lucene.gdata.search.config.IndexSchemaField.ContentType;
+import org.apache.lucene.gdata.utils.ProvidedServiceStub;
+
+import com.google.gdata.data.PlainTextConstruct;
+
+/**
+ * @author Simon Willnauer
+ *
+ */
+public class TestindexDocumentBuilderTask extends TestCase {
+    IndexDocumentBuilder fineBuilder;
+    IndexDocumentBuilder failInStrategyBuilder;
+    IndexDocumentBuilder builder;
+    IndexDocumentBuilderTask zeroFields;
+    static String ID = "someId";
+    static String CONTENT_FIELD = "someId";
+    static String CONTENT = "foo bar";
+    protected void setUp() throws Exception {
+        ServerBaseEntry entry = new ServerBaseEntry();
+        entry.setVersionId("1");
+        entry.setFeedId("myFeed");
+        entry.setId(ID);
+        entry.setContent(new PlainTextConstruct(CONTENT));
+        entry.setServiceConfig(new ProvidedServiceStub());
+        IndexSchema schema = new IndexSchema();
+        schema.setName("mySchema");
+        IndexSchemaField field = new IndexSchemaField();
+        field.setName(CONTENT_FIELD);
+        field.setPath("/entry/content");
+        field.setContentType(ContentType.TEXT);
+        schema.addSchemaField(field);
+        this.fineBuilder = new IndexDocumentBuilderTask(entry,schema,IndexAction.INSERT,true,true);
+        
+        /*
+         * two fields, one will fail due to broken xpath.
+         * One will remain.
+         */
+        schema = new IndexSchema();
+        schema.setName("mySchema");
+        field = new IndexSchemaField();
+        field.setName("someContent");
+        //broken xpath
+        field.setPath("/entry///wrongXPath");
+        field.setContentType(ContentType.TEXT);
+        schema.addSchemaField(field);
+        field = new IndexSchemaField();
+        field.setName(CONTENT_FIELD);
+        field.setPath("/entry/content");
+        field.setContentType(ContentType.TEXT);
+        schema.addSchemaField(field);
+        this.failInStrategyBuilder = new IndexDocumentBuilderTask(entry,schema,IndexAction.INSERT,false,false);
+        //fail with no fields
+        schema = new IndexSchema();
+        schema.setName("mySchema");
+        this.zeroFields = new IndexDocumentBuilderTask(entry,schema,IndexAction.INSERT,false,false);
+        
+        
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    /*
+     * Test method for 'org.apache.lucene.gdata.search.index.IndexDocumentBuilderTask.IndexDocumentBuilderTask(ServerBaseEntry, IndexSchema, IndexAction, boolean)'
+     */
+    public void testIndexDocumentBuilderTask() {
+        IndexDocument doc = this.fineBuilder.call();
+        assertNotNull(doc.getDeletealbe());
+        assertNotNull(doc.getWriteable());
+        assertEquals(IndexDocument.FIELD_ENTRY_ID,doc.getDeletealbe().field());
+        assertEquals(ID,doc.getDeletealbe().text());
+        assertEquals(ID,doc.getWriteable().getField(IndexDocument.FIELD_ENTRY_ID).stringValue());
+        assertNotNull(doc.getWriteable().getField(CONTENT_FIELD).stringValue());
+      
+        /*
+         * the broken xpath fails but the other fields will be indexed
+         */
+        doc = this.failInStrategyBuilder.call();
+        assertNotNull(doc.getDeletealbe());
+        assertNotNull(doc.getWriteable());
+        assertEquals(IndexDocument.FIELD_ENTRY_ID,doc.getDeletealbe().field());
+        assertEquals(ID,doc.getDeletealbe().text());
+        assertEquals(ID,doc.getWriteable().getField(IndexDocument.FIELD_ENTRY_ID).stringValue());
+        assertNotNull(doc.getWriteable().getField(CONTENT_FIELD).stringValue());
+        
+        try{
+        this.zeroFields.call();
+        fail("zero fields in document");
+        }catch (GdataIndexerException e) {}
+    }
+
+    /*
+     * Test method for 'org.apache.lucene.gdata.search.index.IndexDocumentBuilderTask.call()'
+     */
+    public void testCall() throws InterruptedException, ExecutionException {
+        ExecutorService service = Executors.newSingleThreadExecutor();
+        Future<IndexDocument> future = service.submit(this.fineBuilder);
+        IndexDocument doc = future.get();
+        assertNotNull(doc.getDeletealbe());
+        assertNotNull(doc.getWriteable());
+        assertEquals(IndexDocument.FIELD_ENTRY_ID,doc.getDeletealbe().field());
+        assertEquals(ID,doc.getDeletealbe().text());
+        assertEquals(ID,doc.getWriteable().getField(IndexDocument.FIELD_ENTRY_ID).stringValue());
+        assertNotNull(doc.getWriteable().getField(CONTENT_FIELD).stringValue());
+        assertTrue(doc.commitAfter());
+        assertTrue(doc.optimizeAfter());
+      
+        /*
+         * the broken xpath fails but the other fields will be indexed
+         */
+        future = service.submit(this.failInStrategyBuilder);
+         doc = future.get();
+        
+        assertNotNull(doc.getDeletealbe());
+        assertNotNull(doc.getWriteable());
+        assertEquals(IndexDocument.FIELD_ENTRY_ID,doc.getDeletealbe().field());
+        assertEquals(ID,doc.getDeletealbe().text());
+        assertEquals(ID,doc.getWriteable().getField(IndexDocument.FIELD_ENTRY_ID).stringValue());
+        assertNotNull(doc.getWriteable().getField(CONTENT_FIELD).stringValue());
+        future = service.submit(this.zeroFields);
+        
+        try{
+         future.get();
+        fail("zero fields in document");
+        }catch (ExecutionException e) {
+            assertTrue(e.getCause().getClass() == GdataIndexerException.class);
+            
+        }
+        service.shutdownNow();
+    }
+    
+    
+    
+
+}

Propchange: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/index/TestindexDocumentBuilderTask.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/index/TestindexDocumentBuilderTask.java
------------------------------------------------------------------------------
    svn:executable = *

Added: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/query/TestGdataQueryParser.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/query/TestGdataQueryParser.java?rev=430568&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/query/TestGdataQueryParser.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/query/TestGdataQueryParser.java Thu Aug 10 15:32:40 2006
@@ -0,0 +1,36 @@
+/** 
+ * 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. 
+ */
+package org.apache.lucene.gdata.search.query;
+
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+import org.apache.lucene.gdata.search.config.IndexSchema;
+import org.apache.lucene.queryParser.QueryParser.Operator;
+
+import junit.framework.TestCase;
+
+public class TestGdataQueryParser extends TestCase {
+
+    
+    public void testConstructor(){
+        String field = "someField";
+        IndexSchema s = new IndexSchema();
+        s.setDefaultSearchField(field);
+        GDataQueryParser p = new GDataQueryParser(s);
+        assertEquals(field,p.getField());
+        assertEquals(Operator.AND,p.getDefaultOperator());
+        assertEquals(StandardAnalyzer.class,p.getAnalyzer().getClass());
+    }
+}

Propchange: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/query/TestGdataQueryParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/query/TestGdataQueryParser.java
------------------------------------------------------------------------------
    svn:executable = *

Added: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/query/TestQueryTranslator.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/query/TestQueryTranslator.java?rev=430568&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/query/TestQueryTranslator.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/query/TestQueryTranslator.java Thu Aug 10 15:32:40 2006
@@ -0,0 +1,106 @@
+/** 
+ * 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. 
+ */ 
+package org.apache.lucene.gdata.search.query;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.lucene.gdata.search.config.IndexSchema;
+import org.apache.lucene.gdata.search.config.IndexSchemaField;
+import org.apache.lucene.gdata.search.config.IndexSchemaField.ContentType;
+import org.apache.lucene.gdata.utils.ProvidedServiceStub;
+import org.apache.lucene.index.Term;
+import org.apache.lucene.search.RangeQuery;
+
+import junit.framework.TestCase;
+
+/**
+ * @author Simon Willnauer
+ *
+ */
+public class TestQueryTranslator extends TestCase {
+    private static final String CONTENT_FIELD = "content";
+    private static final String UPDATED_FIELD = "updated";
+    private IndexSchema schema;
+    Map<String,String[]> parameterMap;
+    /*
+     * @see junit.framework.TestCase#setUp()
+     */
+    @Override
+    protected void setUp() throws Exception {
+        this.schema = new IndexSchema();
+        //must be set
+        this.schema.setDefaultSearchField(CONTENT_FIELD);
+        this.schema.setIndexLocation("/tmp/");
+        this.schema.setName(ProvidedServiceStub.SERVICE_NAME);
+        IndexSchemaField field = new IndexSchemaField();
+        
+        field.setName(CONTENT_FIELD);
+        field.setContentType(ContentType.TEXT);
+        
+        IndexSchemaField field1 = new IndexSchemaField();
+        field1.setName(UPDATED_FIELD);
+        field1.setContentType(ContentType.GDATADATE);
+        this.schema.addSchemaField(field);
+        this.schema.addSchemaField(field1);
+        parameterMap = new HashMap<String,String[]>();
+        
+
+    }
+
+    /*
+     * Test method for 'org.apache.lucene.gdata.search.query.QueryTranslator.translateHttpSearchRequest(IndexSchema, Map<String, String>, String, String)'
+     */
+    public void testTranslateHttpSearchRequest() {
+        assertNull(QueryTranslator.translateHttpSearchRequest(this.schema,this.parameterMap,null));
+        String contentQuery = "content1 -content2 \"exact Content\""; 
+        parameterMap.put("q", new String[]{contentQuery});
+        String expected = CONTENT_FIELD+":("+contentQuery+") ";
+      
+        assertEquals(expected,QueryTranslator.translateHttpSearchRequest(this.schema,this.parameterMap,null));
+        parameterMap.put("updated-min", new String[]{"2005-08-09T10:57:00-08:00"});
+        parameterMap.put("updated-max", new String[]{"2005-10-09T10:57:00-08:00"});
+        parameterMap.put("max-results", new String[]{"3"});
+        parameterMap.remove("q");
+        parameterMap.put(CONTENT_FIELD, new String[]{"apache"});
+        
+        String tranlatedQuery = QueryTranslator.translateHttpSearchRequest(this.schema,this.parameterMap,"test |{urn:google.com} {urn:apache.org}");
+        assertTrue(tranlatedQuery.contains("updated:[1123613820000 TO 1128884219999]"));
+        assertTrue(tranlatedQuery.contains(CONTENT_FIELD+":(apache)"));
+        
+        parameterMap.remove("updated-max");
+        tranlatedQuery = QueryTranslator.translateHttpSearchRequest(this.schema,this.parameterMap,"test |{urn:google.com} {urn:apache.org}");
+        assertTrue(tranlatedQuery.contains("updated:[1123613820000 TO "+Long.MAX_VALUE+"]"));
+        assertTrue(tranlatedQuery.contains(CONTENT_FIELD+":(apache)"));
+        parameterMap.put("updated-max", new String[]{"2005-10-09T10:57:00-08:00"});
+        parameterMap.remove("updated-min");
+        tranlatedQuery = QueryTranslator.translateHttpSearchRequest(this.schema,this.parameterMap,"test |{urn:google.com} {urn:apache.org}");
+        assertTrue(tranlatedQuery.contains("updated:["+0+" TO 1128884219999]"));
+        assertTrue(tranlatedQuery.contains(CONTENT_FIELD+":(apache)"));
+        
+        
+        
+        parameterMap.put("wrong-parameter", new String[]{"3"});
+        try{
+        QueryTranslator.translateHttpSearchRequest(this.schema,this.parameterMap,"test |{urn:google.com} {urn:apache.org}");
+        fail("illegal parameter");
+        }catch (RuntimeException e) {
+           
+        }
+       
+    }
+
+}

Propchange: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/query/TestQueryTranslator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/query/TestQueryTranslator.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/TestGDataRequest.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/TestGDataRequest.java?rev=430568&r1=430567&r2=430568&view=diff
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/TestGDataRequest.java (original)
+++ lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/TestGDataRequest.java Thu Aug 10 15:32:40 2006
@@ -16,17 +16,21 @@
 package org.apache.lucene.gdata.server; 
  
 import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.StringTokenizer;
 
 import javax.servlet.http.HttpServletRequest;
 
 import junit.framework.TestCase;
 
+import org.apache.lucene.gdata.search.config.IndexSchema;
+import org.apache.lucene.gdata.search.config.IndexSchemaField;
+import org.apache.lucene.gdata.search.config.IndexSchemaField.ContentType;
 import org.apache.lucene.gdata.server.GDataRequest.GDataRequestType;
 import org.apache.lucene.gdata.server.GDataRequest.OutputFormat;
 import org.apache.lucene.gdata.server.registry.GDataServerRegistry;
 import org.apache.lucene.gdata.server.registry.ProvidedService;
-import org.apache.lucene.gdata.server.registry.RegistryException;
 import org.apache.lucene.gdata.utils.ProvidedServiceStub;
 import org.apache.lucene.gdata.utils.StorageStub;
 import org.easymock.MockControl;
@@ -43,6 +47,7 @@
  
     private GDataRequest feedRequest; 
     
+    private Map parametermap = new HashMap();
     
     @Override 
     protected void setUp() throws Exception {
@@ -52,8 +57,14 @@
 
         }
         ProvidedService configurator = new ProvidedServiceStub();
-        GDataServerRegistry.getRegistry().registerService(configurator); 
+        GDataServerRegistry.getRegistry().registerService(configurator);
+        IndexSchema schema = new IndexSchema();
+        //must be set
+        schema.setDefaultSearchField("field");
+        schema.setIndexLocation("/tmp/");
+        schema.setName(ProvidedServiceStub.SERVICE_NAME);
         
+        ((ProvidedServiceStub)configurator).setIndexSchema(schema);
             
         this.control = MockControl.createControl(HttpServletRequest.class); 
         this.request = (HttpServletRequest) this.control.getMock(); 
@@ -64,6 +75,7 @@
     protected void tearDown() throws Exception { 
         super.tearDown(); 
         this.control.reset(); 
+        GDataServerRegistry.getRegistry().destroy();
     } 
  
     public void testConstructor() { 
@@ -88,9 +100,9 @@
     } 
  
     public void testGetFeedId() throws GDataRequestException { 
- 
+        this.control.expectAndDefaultReturn(this.request.getParameterMap(),this.parametermap);
         this.control.expectAndDefaultReturn(this.request.getPathInfo(), 
-                "/feed/1/1"); 
+                "/"+ProvidedServiceStub.SERVICE_NAME+"/feed/1/1"); 
         this.control.expectAndDefaultReturn(this.request.getParameter("alt"), 
                 null); 
         this.control.replay(); 
@@ -118,8 +130,9 @@
     } 
  
     public void testGetFeedIdWithoutEntry() throws GDataRequestException { 
+        this.control.expectAndDefaultReturn(this.request.getParameterMap(),this.parametermap);
         this.control 
-                .expectAndDefaultReturn(this.request.getPathInfo(), "/feed"); 
+                .expectAndDefaultReturn(this.request.getPathInfo(), "/"+ProvidedServiceStub.SERVICE_NAME+"/feed"); 
         this.control.expectAndDefaultReturn(this.request.getParameter("alt"), 
                 null); 
         this.control.replay(); 
@@ -128,9 +141,9 @@
     } 
  
     public void testGetEntyId() throws GDataRequestException { 
- 
+        this.control.expectAndDefaultReturn(this.request.getParameterMap(),this.parametermap);
         this.control.expectAndDefaultReturn(this.request.getPathInfo(), 
-                "/feed/1/15"); 
+                "/"+ProvidedServiceStub.SERVICE_NAME+"/feed/1/15"); 
         this.control.expectAndDefaultReturn(this.request.getParameter("alt"), 
                 null); 
         this.control.replay(); 
@@ -143,10 +156,11 @@
     } 
  
     public void testSetResponseFormatAtom() throws GDataRequestException { 
+        this.control.expectAndDefaultReturn(this.request.getParameterMap(),this.parametermap);
         this.control.expectAndDefaultReturn(this.request.getParameter("alt"), 
                 "atom"); 
         this.control 
-                .expectAndDefaultReturn(this.request.getPathInfo(), "/feed"); 
+                .expectAndDefaultReturn(this.request.getPathInfo(),"/"+ProvidedServiceStub.SERVICE_NAME+ "/feed"); 
         this.control.replay(); 
         this.feedRequest.initializeRequest(); 
         assertEquals("ResponseFromat Atom", this.feedRequest 
@@ -155,10 +169,11 @@
     } 
  
     public void testSetResponseFormatRSS() throws GDataRequestException { 
+        this.control.expectAndDefaultReturn(this.request.getParameterMap(),this.parametermap);
         this.control.expectAndDefaultReturn(this.request.getParameter("alt"), 
                 "rss"); 
         this.control 
-                .expectAndDefaultReturn(this.request.getPathInfo(), "/feed"); 
+                .expectAndDefaultReturn(this.request.getPathInfo(), "/"+ProvidedServiceStub.SERVICE_NAME+"/feed"); 
         this.control.replay(); 
         this.feedRequest.initializeRequest(); 
         assertEquals("ResponseFromat RSS", this.feedRequest 
@@ -167,10 +182,11 @@
     } 
  
     public void testSetResponseFormatKeepAtom() throws GDataRequestException { 
+        this.control.expectAndDefaultReturn(this.request.getParameterMap(),this.parametermap);
         this.control.expectAndDefaultReturn(this.request.getParameter("alt"), 
                 "fooBar"); 
         this.control 
-                .expectAndDefaultReturn(this.request.getPathInfo(), "/feed"); 
+                .expectAndDefaultReturn(this.request.getPathInfo(), "/"+ProvidedServiceStub.SERVICE_NAME+"/feed"); 
         this.control.replay(); 
         this.feedRequest.initializeRequest(); 
         assertEquals("ResponseFromat Atom", this.feedRequest 
@@ -179,11 +195,12 @@
     } 
  
     public void testSetResponseFormatNull() throws GDataRequestException { 
+        this.control.expectAndDefaultReturn(this.request.getParameterMap(),this.parametermap);
         this.control.expectAndDefaultReturn(this.request.getParameter("alt"), 
                 null); 
  
         this.control 
-                .expectAndDefaultReturn(this.request.getPathInfo(), "/feed"); 
+                .expectAndDefaultReturn(this.request.getPathInfo(), "/"+ProvidedServiceStub.SERVICE_NAME+"/feed"); 
         this.control.replay(); 
         this.feedRequest.initializeRequest(); 
         assertEquals("ResponseFromat Atom", this.feedRequest 
@@ -223,11 +240,12 @@
      
     public void testGetSelfId() throws GDataRequestException{ 
         String host = "www.apache.org"; 
-        String feedAndEntryID = "/feed/entryid"; 
+        String feedAndEntryID = "/"+ProvidedServiceStub.SERVICE_NAME+"/feed/entryid"; 
         String queryString = "max-results=25"; 
+        this.control.expectAndDefaultReturn(this.request.getParameterMap(),this.parametermap);
         this.control.expectAndDefaultReturn(this.request.getHeader("Host"),host); 
-        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/host/feed/entryId/15/"); 
-        this.control.expectAndDefaultReturn(this.request.getPathInfo(),"/feed/entryId/15"); 
+        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/host"+"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/entryId/15/"); 
+        this.control.expectAndDefaultReturn(this.request.getPathInfo(),"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/entryId/15"); 
         this.control.expectAndReturn(this.request.getParameter("max-results"),"25",2); 
         this.control.expectAndDefaultReturn(this.request.getParameter("alt"), 
                 null); 
@@ -235,15 +253,16 @@
                 queryString); 
         this.control.replay(); 
         this.feedRequest.initializeRequest(); 
-        String selfID = "http://"+host+"/host/feed/entryId/15?"+queryString; 
+        String selfID = "http://"+host+"/host"+"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/entryId/15?"+queryString; 
         assertEquals("Self ID",selfID,this.feedRequest.getSelfId()); 
         this.control.reset(); 
          
          
-        queryString = "alt=rss&max-results=25"; 
+        queryString = "alt=rss&max-results=25";
+        this.control.expectAndDefaultReturn(this.request.getParameterMap(),this.parametermap);
         this.control.expectAndDefaultReturn(this.request.getHeader("Host"),host); 
-        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/host/feed/entryId/15"); 
-        this.control.expectAndDefaultReturn(this.request.getPathInfo(),"/feed/entryId/15"); 
+        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/host"+"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/entryId/15/"); 
+        this.control.expectAndDefaultReturn(this.request.getPathInfo(),"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/entryId/15"); 
         this.control.expectAndReturn(this.request.getParameter("max-results"),"25",2); 
         this.control.expectAndDefaultReturn(this.request.getParameter("alt"), 
                 null); 
@@ -251,15 +270,16 @@
                 queryString); 
         this.control.replay(); 
         this.feedRequest.initializeRequest(); 
-        selfID = "http://"+host+"/host/feed/entryId/15?"+queryString; 
+        selfID = "http://"+host+"/host"+"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/entryId/15?"+queryString; 
      
         assertEquals("Self ID",selfID,this.feedRequest.getSelfId()); 
         this.control.reset(); 
          
         queryString = ""; 
+        this.control.expectAndDefaultReturn(this.request.getParameterMap(),this.parametermap);
         this.control.expectAndDefaultReturn(this.request.getHeader("Host"),host); 
-        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/host/feed/entryId/15"); 
-        this.control.expectAndDefaultReturn(this.request.getPathInfo(),"/feed/entryId/15"); 
+        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/host"+"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/entryId/15/"); 
+        this.control.expectAndDefaultReturn(this.request.getPathInfo(),"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/entryId/15"); 
         this.control.expectAndDefaultReturn(this.request.getParameter("max-results"),null); 
         this.control.expectAndDefaultReturn(this.request.getParameter("alt"), 
                 null); 
@@ -267,7 +287,7 @@
                 null); 
         this.control.replay(); 
         this.feedRequest.initializeRequest(); 
-        selfID = "http://"+host+"/host/feed/entryId/15"+"?max-results=25"; 
+        selfID = "http://"+host+"/host"+"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/entryId/15"+"?max-results=25"; 
      
         assertEquals("Self ID",selfID,this.feedRequest.getSelfId()); 
         this.control.reset(); 
@@ -311,10 +331,10 @@
     public void testIsFeedRequest() throws GDataRequestException{ 
         String host = "www.apache.org"; 
         String feedAndEntryID = "/feed"; 
-         
+        this.control.expectAndDefaultReturn(this.request.getParameterMap(),this.parametermap);
         this.control.expectAndDefaultReturn(this.request.getHeader("Host"),host); 
-        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/host/feed"); 
-        this.control.expectAndDefaultReturn(this.request.getPathInfo(),"/feed"); 
+        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/host"+"/"+ProvidedServiceStub.SERVICE_NAME+"/feed"); 
+        this.control.expectAndDefaultReturn(this.request.getPathInfo(),"/"+ProvidedServiceStub.SERVICE_NAME+"/feed"); 
          
         this.control.expectAndDefaultReturn(this.request.getParameter("alt"), 
                 null); 
@@ -329,10 +349,10 @@
         this.control.reset(); 
          
         host = "www.apache.org"; 
-        feedAndEntryID = "/feed/1"; 
-         
+        feedAndEntryID = "/"+ProvidedServiceStub.SERVICE_NAME+"/feed/1"; 
+        this.control.expectAndDefaultReturn(this.request.getParameterMap(),this.parametermap);
         this.control.expectAndDefaultReturn(this.request.getHeader("Host"),host); 
-        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/host/feed/1"); 
+        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/host"+"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/1"); 
         this.control.expectAndDefaultReturn(this.request.getPathInfo(),feedAndEntryID); 
          
         this.control.expectAndDefaultReturn(this.request.getParameter("alt"), 
@@ -346,6 +366,46 @@
         assertFalse(this.feedRequest.isFeedRequested()); 
         assertTrue(this.feedRequest.isEntryRequested()); 
         this.control.reset(); 
+        
+        host = "www.apache.org"; 
+        feedAndEntryID = "/"+ProvidedServiceStub.SERVICE_NAME+"/feed/1"; 
+        this.control.expectAndDefaultReturn(this.request.getParameterMap(),this.parametermap);
+        this.control.expectAndDefaultReturn(this.request.getHeader("Host"),host); 
+        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/host"+"/"+"NOTREGISTERED"+"/feed/1"); 
+        this.control.expectAndDefaultReturn(this.request.getPathInfo(),"/"+"NOTREGISTERED"+"/feed/1"); 
+         
+        this.control.expectAndDefaultReturn(this.request.getParameter("alt"), 
+                null); 
+        this.control.expectAndDefaultReturn(this.request.getQueryString(), 
+                null); 
+        this.control.replay(); 
+        try{
+        this.feedRequest.initializeRequest();
+        fail("service not registered");
+        }catch (GDataRequestException e) {
+            //
+        }
+        this.control.reset(); 
+        
+        host = "www.apache.org"; 
+        feedAndEntryID = "/"+ProvidedServiceStub.SERVICE_NAME+"/feed/1"; 
+        this.control.expectAndDefaultReturn(this.request.getParameterMap(),this.parametermap);
+        this.control.expectAndDefaultReturn(this.request.getHeader("Host"),host); 
+        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/host"+"/"+ProvidedServiceStub.SERVICE_NAME+"/"); 
+        this.control.expectAndDefaultReturn(this.request.getPathInfo(),"/"+ProvidedServiceStub.SERVICE_NAME+"/"); 
+         
+        this.control.expectAndDefaultReturn(this.request.getParameter("alt"), 
+                null); 
+        this.control.expectAndDefaultReturn(this.request.getQueryString(), 
+                null); 
+        this.control.replay(); 
+        try{
+        this.feedRequest.initializeRequest();
+        fail("service not registered");
+        }catch (GDataRequestException e) {
+//
+        }
+        this.control.reset(); 
          
          
     } 
@@ -356,21 +416,45 @@
         this.control.verify();
         this.control.reset();
         
+        this.control.expectAndDefaultReturn(this.request.getHeader("Authentication"),null);
+        this.control.replay();
+        assertNull(this.feedRequest.getAuthToken());
+        this.control.verify();
+        this.control.reset();
+        
     } 
+    
+    public void testGetStartIndex(){
+        this.control.expectAndDefaultReturn(this.request.getParameter("start-index"),"5");
+        this.control.replay();
+        assertEquals(5,this.feedRequest.getStartIndex());
+        this.control.verify();
+        this.control.reset();
+        this.control.expectAndDefaultReturn(this.request.getParameter("start-index"),"-5");
+        this.control.replay();
+        assertEquals(1,this.feedRequest.getStartIndex());
+        this.control.verify();
+        this.control.reset();
+        this.control.expectAndDefaultReturn(this.request.getParameter("start-index"),"unparsable");
+        this.control.replay();
+        assertEquals(1,this.feedRequest.getStartIndex());
+        this.control.verify();
+        this.control.reset();
+    }
      
     public void testGetNextId() throws GDataRequestException{ 
         String host = "www.apache.org"; 
-        String feedAndEntryID = "/feed/entryid"; 
-        String queryString = "?max-results=25"; 
-        String startIndex = "&start-index=26"; 
+        String feedAndEntryID = "/"+ProvidedServiceStub.SERVICE_NAME+"/feed/entryid"; 
+        String queryString = "max-results=25"; 
+        String startIndex = "start-index=26"; 
         Enumeration enu = new StringTokenizer("max-results",",");
         
-        
+        this.control.expectAndDefaultReturn(this.request.getParameterMap(),this.parametermap);
         this.control.expectAndDefaultReturn(this.request.getParameterNames(),enu);
         this.control.expectAndDefaultReturn(this.request.getHeader("Host"),host); 
-        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/feed/"); 
-        this.control.expectAndDefaultReturn(this.request.getPathInfo(),"/feed/"); 
-        this.control.expectAndReturn(this.request.getParameter("max-results"),"25",4); 
+        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/"); 
+        this.control.expectAndDefaultReturn(this.request.getPathInfo(),"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/"); 
+        this.control.expectAndReturn(this.request.getParameter("max-results"),"25",3); 
         this.control.expectAndReturn(this.request.getParameter("start-index"),null); 
         this.control.expectAndDefaultReturn(this.request.getParameter("alt"), 
                 null); 
@@ -379,24 +463,24 @@
         this.control.replay(); 
 
         this.feedRequest.initializeRequest(); 
-        String nextID = "http://"+host+"/feed"+queryString+startIndex; 
+        String nextID = "http://"+host+"/"+ProvidedServiceStub.SERVICE_NAME+"/feed?"+startIndex+"&"+queryString; 
      
         assertEquals("Next ID",nextID,this.feedRequest.getNextId());
         this.control.verify();
         this.control.reset(); 
          
         enu = new StringTokenizer("alt,max-results,start-index",",");
-        queryString = "?alt=rss&max-results=25"; 
-         
+        queryString = "alt=rss&max-results=25"; 
+        this.control.expectAndDefaultReturn(this.request.getParameterMap(),this.parametermap);
         this.control.expectAndDefaultReturn(this.request.getHeader("Host"),host); 
-        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/feed/"); 
-        this.control.expectAndDefaultReturn(this.request.getPathInfo(),"/feed/"); 
+        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/"); 
+        this.control.expectAndDefaultReturn(this.request.getPathInfo(),"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/"); 
         this.control.expectAndReturn(this.request.getParameter("max-results"),"25",4); 
         this.control.expectAndReturn(this.request.getParameter("start-index"),"26",4); 
         this.control.expectAndDefaultReturn(this.request.getParameter("alt"), 
                 "rss"); 
         this.control.expectAndDefaultReturn(this.request.getQueryString(), 
-                queryString+startIndex); 
+                queryString+"&"+startIndex); 
         
         this.control.expectAndDefaultReturn(this.request.getParameterNames(),enu);
         
@@ -404,15 +488,16 @@
         this.control.replay(); 
         this.feedRequest.initializeRequest(); 
         startIndex = "&start-index=51"; 
-        nextID = "http://"+host+"/feed"+queryString+startIndex; 
+        nextID = "http://"+host+"/"+ProvidedServiceStub.SERVICE_NAME+"/feed?"+queryString+startIndex; 
      
         assertEquals("Next ID 51",nextID,this.feedRequest.getNextId()); 
         this.control.reset(); 
          
         queryString = ""; 
+        this.control.expectAndDefaultReturn(this.request.getParameterMap(),this.parametermap);
         this.control.expectAndDefaultReturn(this.request.getHeader("Host"),host); 
-        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/feed/"); 
-        this.control.expectAndDefaultReturn(this.request.getPathInfo(),"/feed/entryId/15"); 
+        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/"); 
+        this.control.expectAndDefaultReturn(this.request.getPathInfo(),"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/entryId/15"); 
         this.control.expectAndDefaultReturn(this.request.getParameter("max-results"),null); 
         this.control.expectAndDefaultReturn(this.request.getParameter("alt"), 
                 null); 
@@ -420,29 +505,177 @@
                 null); 
         this.control.replay(); 
         this.feedRequest.initializeRequest(); 
-        String selfID = "http://"+host+"/feed"+"?max-results=25"; 
+        String nextId = "http://"+host+"/"+ProvidedServiceStub.SERVICE_NAME+"/feed"+"?max-results=25&start-index=26"; 
      
-        assertEquals("Self ID",selfID,this.feedRequest.getSelfId()); 
+        assertEquals("next ID",nextId,this.feedRequest.getNextId()); 
+        this.control.reset();
+
+        
+        this.control.expectAndDefaultReturn(this.request.getParameterMap(),this.parametermap);
+        this.control.expectAndDefaultReturn(this.request.getHeader("Host"),host); 
+        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/"); 
+        this.control.expectAndDefaultReturn(this.request.getPathInfo(),"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/entryId/15"); 
+        this.control.expectAndReturn(this.request.getParameter("max-results"),null,3); 
+        this.control.expectAndReturn(this.request.getParameter("start-index"),null,3);
+        this.control.expectAndDefaultReturn(this.request.getParameter("alt"), 
+                null); 
+        this.control.expectAndDefaultReturn(this.request.getQueryString(), 
+                null); 
+        this.control.replay(); 
+        this.feedRequest.initializeRequest(); 
+        nextId = "http://"+host+"/"+ProvidedServiceStub.SERVICE_NAME+"/feed"+"?max-results=25&start-index=26"; 
+        assertEquals("nextID",nextId,this.feedRequest.getNextId());
+    } 
+    
+    public void testGetpreviousId() throws GDataRequestException{ 
+        String host = "www.apache.org"; 
+        String feedAndEntryID = "/"+ProvidedServiceStub.SERVICE_NAME+"/feed/entryid"; 
+        String queryString = "max-results=25"; 
+         
+        Enumeration enu = new StringTokenizer("max-results",",");
+        
+        this.control.expectAndDefaultReturn(this.request.getParameterMap(),this.parametermap);
+        this.control.expectAndDefaultReturn(this.request.getParameterNames(),enu);
+        this.control.expectAndDefaultReturn(this.request.getHeader("Host"),host); 
+        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/"); 
+        this.control.expectAndDefaultReturn(this.request.getPathInfo(),"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/"); 
+        this.control.expectAndReturn(this.request.getParameter("start-index"),null); 
+        this.control.expectAndDefaultReturn(this.request.getParameter("alt"), 
+                null); 
+        this.control.expectAndDefaultReturn(this.request.getQueryString(), 
+                queryString); 
+        this.control.replay(); 
+
+        this.feedRequest.initializeRequest(); 
+         
+     
+        assertNull(this.feedRequest.getPreviousId());
+        this.control.verify();
+        this.control.reset(); 
+        String startIndex = "start-index="; 
+        enu = new StringTokenizer("alt,max-results,start-index",",");
+        queryString = "alt=rss&max-results=25&start-index=26"; 
+        this.control.expectAndDefaultReturn(this.request.getParameterMap(),this.parametermap);
+        this.control.expectAndDefaultReturn(this.request.getHeader("Host"),host); 
+        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/"); 
+        this.control.expectAndDefaultReturn(this.request.getPathInfo(),"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/"); 
+        this.control.expectAndReturn(this.request.getParameter("max-results"),"25",4); 
+        this.control.expectAndReturn(this.request.getParameter("start-index"),"26",4); 
+        this.control.expectAndDefaultReturn(this.request.getParameter("alt"), 
+                "rss"); 
+        this.control.expectAndDefaultReturn(this.request.getQueryString(), 
+                queryString); 
+        
+        this.control.expectAndDefaultReturn(this.request.getParameterNames(),enu);
+        
+        
+        this.control.replay(); 
+        this.feedRequest.initializeRequest(); 
+        
+        String prevId = "http://"+host+"/"+ProvidedServiceStub.SERVICE_NAME+"/feed"+"?alt=rss&max-results=25&start-index=1"; 
+        assertEquals("prevID",prevId,this.feedRequest.getPreviousId());
+        
         this.control.reset(); 
+         
+        queryString = ""; 
+        this.control.expectAndDefaultReturn(this.request.getParameterMap(),this.parametermap);
+        this.control.expectAndDefaultReturn(this.request.getHeader("Host"),host); 
+        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/"); 
+        this.control.expectAndDefaultReturn(this.request.getPathInfo(),"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/entryId/15"); 
+        this.control.expectAndDefaultReturn(this.request.getParameter("max-results"),null); 
+        this.control.expectAndDefaultReturn(this.request.getParameter("alt"), 
+                null); 
+        this.control.expectAndDefaultReturn(this.request.getQueryString(), 
+                null); 
+        this.control.replay(); 
+        this.feedRequest.initializeRequest(); 
+        assertNull(this.feedRequest.getPreviousId());
+     
+        
+        this.control.reset(); 
+        
+        this.control.expectAndDefaultReturn(this.request.getParameterMap(),this.parametermap);
+        this.control.expectAndDefaultReturn(this.request.getHeader("Host"),host); 
+        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/"); 
+        this.control.expectAndDefaultReturn(this.request.getPathInfo(),"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/entryId/15"); 
+        this.control.expectAndReturn(this.request.getParameter("max-results"),"35",3); 
+        this.control.expectAndReturn(this.request.getParameter("start-index"),"5",3);
+        this.control.expectAndDefaultReturn(this.request.getParameter("alt"), 
+                null); 
+        this.control.expectAndDefaultReturn(this.request.getQueryString(), 
+                "max-results=35&start-index=5"); 
+        this.control.replay(); 
+        this.feedRequest.initializeRequest(); 
+        prevId = "http://"+host+"/"+ProvidedServiceStub.SERVICE_NAME+"/feed"+"?max-results=35&start-index=1"; 
+        assertEquals("prevID",prevId,this.feedRequest.getPreviousId());
+        
+        
+        
+        
     } 
     
     public void testGetContextPath(){
         String host = "www.apache.org"; 
         this.control.expectAndDefaultReturn(this.request.getHeader("Host"),host); 
-        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/feed/id/"); 
-        this.control.expectAndDefaultReturn(this.request.getPathInfo(),"/feed/id/"); 
+        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/id/"); 
+        this.control.expectAndDefaultReturn(this.request.getPathInfo(),"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/id/"); 
         this.control.replay();
-        String result = "http://"+host+"/feed/id/";
+        String result = "http://"+host+"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/id/";
         assertEquals(result,this.feedRequest.getContextPath());
         this.control.verify();
         this.control.reset();
         this.control.expectAndDefaultReturn(this.request.getHeader("Host"),host); 
-        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/feed/id"); 
-        this.control.expectAndDefaultReturn(this.request.getPathInfo(),"/feed/id"); 
+        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/id"); 
+        this.control.expectAndDefaultReturn(this.request.getPathInfo(),"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/id"); 
         this.control.replay();
         
         assertEquals(result,this.feedRequest.getContextPath());
         this.control.verify();
         
     }
+    
+    public void testCategoryQuery() throws GDataRequestException{
+        String host = "www.apache.org"; 
+        String feedAndEntryID = "/feed"; 
+        this.control.expectAndDefaultReturn(this.request.getParameterMap(),this.parametermap);
+        this.control.expectAndDefaultReturn(this.request.getHeader("Host"),host); 
+        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/host"+"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/-/test"); 
+        this.control.expectAndDefaultReturn(this.request.getPathInfo(),"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/-/test"); 
+         
+        this.control.expectAndDefaultReturn(this.request.getParameter("alt"), 
+                null); 
+        this.control.expectAndDefaultReturn(this.request.getQueryString(), 
+                null); 
+        this.control.replay(); 
+        this.feedRequest.initializeRequest(); 
+         
+     
+        assertTrue(this.feedRequest.isFeedRequested()); 
+        assertFalse(this.feedRequest.isEntryRequested()); 
+        assertNotNull(this.feedRequest.getTranslatedQuery());
+        this.control.verify();
+        this.control.reset();
+        this.feedRequest = new GDataRequest(this.request,GDataRequestType.GET); 
+        this.control.expectAndDefaultReturn(this.request.getParameterMap(),this.parametermap);
+        this.control.expectAndDefaultReturn(this.request.getHeader("Host"),host); 
+        this.control.expectAndDefaultReturn(this.request.getRequestURI(),"/host"+"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/"); 
+        this.control.expectAndDefaultReturn(this.request.getPathInfo(),"/"+ProvidedServiceStub.SERVICE_NAME+"/feed/"); 
+         
+        this.control.expectAndDefaultReturn(this.request.getParameter("alt"), 
+                null); 
+        this.control.expectAndDefaultReturn(this.request.getQueryString(), 
+                null); 
+        this.control.replay(); 
+        this.feedRequest.initializeRequest(); 
+         
+     
+        assertTrue(this.feedRequest.isFeedRequested()); 
+        assertFalse(this.feedRequest.isEntryRequested()); 
+        assertNull(this.feedRequest.getTranslatedQuery());
+        this.control.verify();
+        this.control.reset(); 
+    }
+    
+    
+    
 } 

Modified: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/TestGDataResponse.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/TestGDataResponse.java?rev=430568&r1=430567&r2=430568&view=diff
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/TestGDataResponse.java (original)
+++ lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/TestGDataResponse.java Thu Aug 10 15:32:40 2006
@@ -1,3 +1,18 @@
+/** 
+ * 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. 
+ */
 package org.apache.lucene.gdata.server; 
  
 import java.io.IOException; 

Modified: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/administration/TestAccountBuilder.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/administration/TestAccountBuilder.java?rev=430568&r1=430567&r2=430568&view=diff
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/administration/TestAccountBuilder.java (original)
+++ lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/administration/TestAccountBuilder.java Thu Aug 10 15:32:40 2006
@@ -1,3 +1,18 @@
+/** 
+ * 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. 
+ */
 package org.apache.lucene.gdata.server.administration;
 
 import java.io.IOException;

Added: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/registry/TestProvidedServiceConfig.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/registry/TestProvidedServiceConfig.java?rev=430568&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/registry/TestProvidedServiceConfig.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/registry/TestProvidedServiceConfig.java Thu Aug 10 15:32:40 2006
@@ -0,0 +1,105 @@
+/** 
+ * 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. 
+ */
+package org.apache.lucene.gdata.server.registry;
+
+import junit.framework.TestCase;
+
+import com.google.gdata.data.Entry;
+import com.google.gdata.data.ExtensionProfile;
+import com.google.gdata.data.Feed;
+
+public class TestProvidedServiceConfig extends TestCase {
+    ProvidedServiceConfig instance;
+    protected void setUp() throws Exception {
+        instance = new ProvidedServiceConfig();
+        instance.setExtensionProfileClass(ExtensionProfile.class);
+        instance.setFeedType(Feed.class);
+        instance.setEntryType(Entry.class);
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        instance.destroy();
+    }
+
+    /*
+     * Test method for 'org.apache.lucene.gdata.server.registry.ProvidedServiceConfig.getExtensionProfile()'
+     */
+    public void testGetExtensionProfile() {
+        try{
+        this.instance.setExtensionProfile(null);
+        fail("value must not be null");
+        }catch (IllegalArgumentException e) {
+
+        }
+        ExtensionProfile profile = this.instance.getExtensionProfile();
+        assertNotNull(profile);
+        assertSame(profile,this.instance.getExtensionProfile());
+        this.instance.visiteInitialize();
+        assertSame(profile,this.instance.getExtensionProfile());
+        assertNull(new ProvidedServiceConfig().getExtensionProfile());
+    }
+
+    /*
+     * Test method for 'org.apache.lucene.gdata.server.registry.ProvidedServiceConfig.setExtensionProfile(ExtensionProfile)'
+     */
+    public void testSetPoolSize() throws InstantiationException, IllegalAccessException {
+        assertEquals(5,instance.getPoolSize());
+        instance.destroy();
+        instance = new ProvidedServiceConfig();
+        instance.setExtensionProfileClass(ExtensionProfile.class);
+        instance.setFeedType(Feed.class);
+        instance.setEntryType(Entry.class);
+        instance.setPoolSize(30);
+        instance.visiteInitialize();
+        assertEquals(30,instance.getPoolSize());
+        instance.destroy();
+        instance = new ProvidedServiceConfig();
+        instance.setExtensionProfileClass(ExtensionProfile.class);
+        instance.setFeedType(Feed.class);
+        instance.setEntryType(Entry.class);
+        instance.setPoolSize(-5);
+        instance.visiteInitialize();
+        assertEquals(5,instance.getPoolSize());
+    }
+
+   
+   
+   
+    /*
+     * Test method for 'org.apache.lucene.gdata.server.registry.ProvidedServiceConfig.visiteInitialize()'
+     */
+    public void testVisiteInitialize() {
+        instance.visiteInitialize();
+        assertNull(instance.extProfThreadLocal.get());
+        instance.getExtensionProfile();
+        assertNotNull(instance.extProfThreadLocal.get());
+    }
+
+    /*
+     * Test method for 'org.apache.lucene.gdata.server.registry.ProvidedServiceConfig.visiteDestroy()'
+     */
+    public void testVisiteDestroy() {
+        ExtensionProfile profile = this.instance.getExtensionProfile();
+        assertNotNull(profile);
+        assertNotNull(instance.extProfThreadLocal.get());
+        instance.visiteDestroy();
+        assertNull(instance.extProfThreadLocal.get());
+        instance.visiteDestroy();
+        assertNull(instance.extProfThreadLocal.get());
+    }
+
+}

Propchange: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/registry/TestProvidedServiceConfig.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/registry/TestProvidedServiceConfig.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/registry/configuration/TestConfigurationBean.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/registry/configuration/TestConfigurationBean.java?rev=430568&r1=430567&r2=430568&view=diff
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/registry/configuration/TestConfigurationBean.java (original)
+++ lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/registry/configuration/TestConfigurationBean.java Thu Aug 10 15:32:40 2006
@@ -1,3 +1,18 @@
+/** 
+ * 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. 
+ */
 package org.apache.lucene.gdata.server.registry.configuration;
 
 import junit.framework.TestCase;

Modified: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/registry/configuration/TestPropertyInjector.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/registry/configuration/TestPropertyInjector.java?rev=430568&r1=430567&r2=430568&view=diff
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/registry/configuration/TestPropertyInjector.java (original)
+++ lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/registry/configuration/TestPropertyInjector.java Thu Aug 10 15:32:40 2006
@@ -1,3 +1,18 @@
+/** 
+ * 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. 
+ */
 package org.apache.lucene.gdata.server.registry.configuration;
 
 import junit.framework.TestCase;

Modified: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/servlet/TestAbstractGdataServlet.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/servlet/TestAbstractGdataServlet.java?rev=430568&r1=430567&r2=430568&view=diff
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/servlet/TestAbstractGdataServlet.java (original)
+++ lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/servlet/TestAbstractGdataServlet.java Thu Aug 10 15:32:40 2006
@@ -1,3 +1,18 @@
+/** 
+ * 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. 
+ */
 package org.apache.lucene.gdata.servlet; 
  
 import java.io.IOException; 

Modified: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/servlet/handler/TestAbstractFeedHandler.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/servlet/handler/TestAbstractFeedHandler.java?rev=430568&r1=430567&r2=430568&view=diff
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/servlet/handler/TestAbstractFeedHandler.java (original)
+++ lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/servlet/handler/TestAbstractFeedHandler.java Thu Aug 10 15:32:40 2006
@@ -27,6 +27,7 @@
 
 import org.apache.lucene.gdata.data.GDataAccount;
 import org.apache.lucene.gdata.data.ServerBaseFeed;
+import org.apache.lucene.gdata.server.GDataResponse;
 import org.apache.lucene.gdata.server.ServiceException;
 import org.apache.lucene.gdata.server.ServiceFactory;
 import org.apache.lucene.gdata.server.administration.AdminService;
@@ -184,7 +185,7 @@
                 .getParameter(AbstractFeedHandler.PARAMETER_ACCOUNT), this.accountName);
         
         a.setName("helloworld");
-        this.adminServiceMockControl.expectAndDefaultThrow(this.adminService.getAccount(this.accountName),new ServiceException() );
+        this.adminServiceMockControl.expectAndDefaultThrow(this.adminService.getAccount(this.accountName),new ServiceException(GDataResponse.BAD_REQUEST) );
         this.requestMockControl.replay();
         this.adminServiceMockControl.replay();
          handler = new InsertFeedHandler();

Modified: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/servlet/handler/TestRequestAuthenticator.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/servlet/handler/TestRequestAuthenticator.java?rev=430568&r1=430567&r2=430568&view=diff
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/servlet/handler/TestRequestAuthenticator.java (original)
+++ lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/servlet/handler/TestRequestAuthenticator.java Thu Aug 10 15:32:40 2006
@@ -1,3 +1,18 @@
+/** 
+ * 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. 
+ */
 package org.apache.lucene.gdata.servlet.handler;
 
 import javax.servlet.http.Cookie;

Modified: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/storage/TestIDGenerator.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/storage/TestIDGenerator.java?rev=430568&r1=430567&r2=430568&view=diff
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/storage/TestIDGenerator.java (original)
+++ lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/storage/TestIDGenerator.java Thu Aug 10 15:32:40 2006
@@ -1,3 +1,18 @@
+/** 
+ * 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. 
+ */
 package org.apache.lucene.gdata.storage; 
  
 import java.util.ArrayList; 



Mime
View raw message