Package org.apache.lucene.gdata.utils

Examples of org.apache.lucene.gdata.utils.ProvidedServiceStub


        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);
    }
View Full Code Here


        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();
View Full Code Here

        }
        this.controller.initialize();
        ServerBaseEntry e = new ServerBaseEntry();
        e.setId("someId");
        e.setFeedId("someId");
        e.setServiceConfig(new ProvidedServiceStub());
        this.controller.fireInsertEvent(e);
    }
View Full Code Here

           
        } catch (NotIndexableException e2) {
           
            fail("unexp. exception");  
        }
        e.setServiceConfig(new ProvidedServiceStub());
        try {
            new DomIndexable(e);
        } catch (NotIndexableException e1) {
         fail("unexp. exception");  
        
View Full Code Here

        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);
View Full Code Here

     */
    public void testApplyPath() throws NotIndexableException, XPathExpressionException {
        String content = "fooo bar<br>";
        ServerBaseEntry entry = new ServerBaseEntry();
        entry.setContent(new HtmlTextConstruct(content));
        entry.setServiceConfig(new ProvidedServiceStub());
       
            Indexable ind = new DomIndexable(entry);
            Node n = ind.applyPath("/entry/content");
            assertNotNull(n);
            assertEquals(content,n.getTextContent());
View Full Code Here

        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");
View Full Code Here

        this.controller.setOptimizeInterval(10);
        this.controller.setRecover(false);
        this.controller.setBufferSize(10);
        this.controller.setPersistFactor(10);
        this.controller.initialize();
        this.configurator = new ProvidedServiceStub();
        this.modifier = this.controller.getStorageModifier();
        this.dir = this.controller.getDirectory();

    }
View Full Code Here

     * Test method for 'org.apache.lucene.gdata.server.GDataResponse.sendResponse(BaseFeed, ExtensionProfile)'
     */
    public void testSendResponseBaseFeedExtensionProfile() throws IOException {
        try{
            Feed f = null;
            this.response.sendResponse(f, new ProvidedServiceStub());
            fail("Exception expected");
        }catch (IllegalArgumentException e) {
            //
        }
        
        try{
            Feed f = createFeed();
            this.response.sendResponse(f,null);
            fail("Exception expected");
        }catch (IllegalArgumentException e) {
            //
        }
        StringWriter stringWriter = new StringWriter();
        PrintWriter writer = new PrintWriter(stringWriter);
        
        this.control.expectAndReturn(this.httpResponse.getWriter(),writer);
        this.httpResponse.setContentType(GDataResponse.XMLMIME_ATOM);
        this.response.setOutputFormat(OutputFormat.ATOM);
        this.control.replay();
        
        this.response.sendResponse(createFeed(), new ProvidedServiceStub());
        assertEquals("Simple XML representation",stringWriter.toString(),generatedFeedAtom);
        this.control.reset();
        
        stringWriter = new StringWriter();
        writer = new PrintWriter(stringWriter);
        
        this.control.expectAndReturn(this.httpResponse.getWriter(),writer);
        this.response.setOutputFormat(OutputFormat.RSS);
        this.httpResponse.setContentType(GDataResponse.XMLMIME_RSS);
        this.control.replay();
        
        this.response.sendResponse(createFeed(), new ProvidedServiceStub());
        assertEquals("Simple XML representation",stringWriter.toString(),generatedFeedRSS);
        
        
        
View Full Code Here

     * Test method for 'org.apache.lucene.gdata.server.GDataResponse.sendResponse(BaseEntry, ExtensionProfile)'
     */
    public void testSendResponseBaseEntryExtensionProfile() throws IOException {
        try{
            Entry e = null;
            this.response.sendResponse(e, new ProvidedServiceStub());
            fail("Exception expected");
        }catch (IllegalArgumentException e) {
            //
        }
        try{
            Entry e = createEntry();
            this.response.sendResponse(e,null);
            fail("Exception expected");
        }catch (IllegalArgumentException e) {
            //
        }
//        // test Atom output
        StringWriter stringWriter = new StringWriter();
        PrintWriter writer = new PrintWriter(stringWriter);
        
        this.control.expectAndReturn(this.httpResponse.getWriter(),writer);
        this.httpResponse.setContentType(GDataResponse.XMLMIME_ATOM);
        this.response.setOutputFormat(OutputFormat.ATOM);
        this.control.replay();
        
        this.response.sendResponse(createEntry(), new ProvidedServiceStub());
        assertEquals("Simple XML representation ATOM",stringWriter.toString(),generatedEntryAtom);
        
        // test rss output
        this.control.reset();
        stringWriter = new StringWriter();
        writer = new PrintWriter(stringWriter);
        
        this.control.expectAndReturn(this.httpResponse.getWriter(),writer);
        this.httpResponse.setContentType(GDataResponse.XMLMIME_RSS);
        this.response.setOutputFormat(OutputFormat.RSS);
        this.control.replay();
        
        this.response.sendResponse(createEntry(), new ProvidedServiceStub());
        
        assertEquals("Simple XML representation RSS",stringWriter.toString(),generatedEntryRSS);
        
        
        
View Full Code Here

TOP

Related Classes of org.apache.lucene.gdata.utils.ProvidedServiceStub

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.