Package org.apache.lucene.gdata.data

Examples of org.apache.lucene.gdata.data.ServerBaseEntry


        }

    }
   
    private ServerBaseEntry getServerEntry(BaseEntry e){
        ServerBaseEntry en = new ServerBaseEntry(e);
        en.setFeedId(feedId);
        en.setServiceConfig(this.configurator);
        return en;
    }
View Full Code Here


        public void run() {
            for (int i = idIndex; i < idIndex + 10; i++) {

                BaseEntry e = buildEntry("" + i);
                try {
                    ServerBaseEntry en = new ServerBaseEntry(e);
                    en.setFeedId(feedId);
                    en.setServiceConfig(configurator);
                    StorageEntryWrapper wrapper = new StorageEntryWrapper(en,
                            StorageOperation.INSERT);
                    modifier.insertEntry(wrapper);
//                    System.out.println("insert: "+i+" Thread: "+Thread.currentThread().getName());
                } catch (Exception e1) {
View Full Code Here

    String compareDelete = "D;"+FEEDID+";"+ENTRYID+";"+TIMESTAMP+";"+RecoverWriter.META_DATA_ENTRY_SEPARATOR+RecoverWriter.STORAGE_OPERATION_SEPARATOR+RecoverWriter.META_DATA_ENTRY_SEPARATOR;
    StorageEntryWrapper wrapper;
    StorageEntryWrapper deleteWrapper;

    protected void setUp() throws Exception {
        ServerBaseEntry entry = new ServerBaseEntry(new Entry());
        entry.setId(ENTRYID);
       
        entry.setUpdated(new DateTime(TIMESTAMP,0));
        entry.setTitle(new PlainTextConstruct(TITLE));
        ProvidedService config = new ProvidedServiceStub();
        entry.setFeedId(FEEDID);
        entry.setServiceConfig(config);
        this.wrapper = new StorageEntryWrapper(entry,StorageOperation.INSERT);
        this.deleteWrapper = new StorageEntryWrapper(entry,StorageOperation.DELETE);
       
       
    }
View Full Code Here

         feed = this.storage.getFeed(requestFeed);
        }catch (StorageException e) {
            throw new ServiceException("Search Failed -- can not get feed, feed not stored ",e,GDataResponse.NOT_FOUND);
        }
        for (String entryId : result) {
            ServerBaseEntry requestEntry = new ServerBaseEntry();
            requestEntry.setId(entryId);
            requestEntry.setServiceConfig(service);
            try{
            BaseEntry entry = this.storage.getEntry(requestEntry);
            feed.getEntries().add(entry);
            }catch (StorageException e) {
               
View Full Code Here

     * @throws StorageException
     */
    public void insertEntries(int entrycount) throws IOException,InterruptedException, StorageException{
        List<StorageEntryWrapper> tempList = new ArrayList<StorageEntryWrapper>();
        for (int i = 0; i <= entrycount ; i++) {
            ServerBaseEntry entry = new ServerBaseEntry(new Entry());
            entry.setId(""+i);
            entry.setServiceConfig(this.configurator);
            entry.setUpdated(new DateTime(System.currentTimeMillis(),0));
            entry.setFeedId(feedId);
            StorageEntryWrapper wrapper = new StorageEntryWrapper(entry,StorageOperation.INSERT);
            tempList.add(i,wrapper);
          
            // force different timestamps --> DateTime 2006-06-05T13:37:55.724Z
            Thread.sleep(10);
View Full Code Here

      assertTrue(this.query.get().isEntryStored(""+(this.count-1),feedId));
      assertFalse(this.query.get().isEntryStored("someOther",feedId));
    }
   
    public void testGetEntryLastModied() throws IOException, StorageException{
        ServerBaseEntry entry = new ServerBaseEntry(new Entry());
        entry.setId("test");
        entry.setServiceConfig(this.configurator);
        entry.setUpdated(new DateTime(System.currentTimeMillis(),0));
        entry.setFeedId(feedId);
        StorageEntryWrapper wrapper = new StorageEntryWrapper(entry,StorageOperation.INSERT);
       
        this.modifier.insertEntry(wrapper);
        assertEquals(entry.getUpdated().getValue(),this.query.get().getEntryLastModified("test",feedId));
        this.modifier.forceWrite();
        assertEquals(entry.getUpdated().getValue(),this.query.get().getEntryLastModified("test",feedId));
        this.query = this.controller.getStorageQuery();
        assertEquals(entry.getUpdated().getValue(),this.query.get().getEntryLastModified("test",feedId));
        try{
        this.query.get().getEntryLastModified("some",feedId);
        fail("exception expected");
        }catch (Exception e) {
            e.printStackTrace();
View Full Code Here

            e.printStackTrace();
        }
    }
   
    public void testGetFeedLastModified() throws StorageException, IOException{
        ServerBaseEntry entry = new ServerBaseEntry(new Entry());
        entry.setId("test");
        entry.setServiceConfig(this.configurator);
        entry.setUpdated(new DateTime(System.currentTimeMillis(),0));
        entry.setFeedId(feedId);
        StorageEntryWrapper wrapper = new StorageEntryWrapper(entry,StorageOperation.INSERT);
        this.modifier.insertEntry(wrapper);
        assertEquals(entry.getUpdated().getValue(),this.query.get().getFeedLastModified(feedId));
        this.modifier.forceWrite();
        assertEquals(entry.getUpdated().getValue(),this.query.get().getFeedLastModified(feedId));
        this.query = this.controller.getStorageQuery();
        assertEquals(entry.getUpdated().getValue(),this.query.get().getFeedLastModified(feedId));
    }
View Full Code Here

    }
   
    public void testCheckVersionId() throws IOException, StorageException{
        this.modifier.forceWrite();
        ReferenceCounter<StorageQuery> sQuery = this.controller.getStorageQuery();
        ServerBaseEntry entry = new ServerBaseEntry(new Entry());
        entry.setId("test");
        entry.setServiceConfig(this.configurator);
        entry.setUpdated(new DateTime(System.currentTimeMillis(),0));
        entry.setFeedId(feedId);
        entry.setVersion(5);
        StorageEntryWrapper wrapper = new StorageEntryWrapper(entry,StorageOperation.INSERT);
        this.modifier.insertEntry(wrapper);
        //test in buffer
        assertTrue(sQuery.get().checkEntryVersion(entry.getId(),entry.getFeedId(),entry.getVersion()));
        assertFalse(sQuery.get().checkEntryVersion(entry.getId(),entry.getFeedId(),10000));
        assertFalse(sQuery.get().checkEntryVersion(entry.getId(),"someOtherFeed",entry.getVersion()));
        assertFalse(sQuery.get().checkEntryVersion("foobar",entry.getFeedId(),entry.getVersion()));
       
       
        this.modifier.forceWrite();
        //test in buffer after written
        assertTrue(sQuery.get().checkEntryVersion(entry.getId(),entry.getFeedId(),entry.getVersion()));
        assertFalse(sQuery.get().checkEntryVersion(entry.getId(),entry.getFeedId(),10000));
        assertFalse(sQuery.get().checkEntryVersion(entry.getId(),"someOtherFeed",entry.getVersion()));
        assertFalse(sQuery.get().checkEntryVersion("foobar",entry.getFeedId(),entry.getVersion()));
        sQuery.decrementRef();
        sQuery = this.controller.getStorageQuery();
        //test in index
        assertTrue(sQuery.get().checkEntryVersion(entry.getId(),entry.getFeedId(),entry.getVersion()));
        assertFalse(sQuery.get().checkEntryVersion(entry.getId(),entry.getFeedId(),10000));
        assertFalse(sQuery.get().checkEntryVersion("foobar",entry.getFeedId(),entry.getVersion()));
        sQuery.decrementRef();
       
       
       
       
View Full Code Here

    /*
     * Test method for 'org.apache.lucene.gdata.storage.lucenestorage.recover.RecoverController.storageModified(StorageEntryWrapper)'
     */
    public void testStorageModified() throws IOException, RecoverException {
        this.writeController.initialize();
        ServerBaseEntry entry = new ServerBaseEntry();
        entry.setFeedId(this.feedId);
        entry.setId(entryId);
        entry.setUpdated(DateTime.now());
        entry.setServiceConfig(new ProvidedServiceStub());
        StorageEntryWrapper wrapper = new StorageEntryWrapper(entry,StorageOperation.INSERT);
        this.writeController.storageModified(wrapper);
        assertEquals(1,this.recDir.listFiles().length);
        this.writeController.destroy();
    }
View Full Code Here

            this.storage.storeEntry(null);
            fail("entry is null");
        } catch (StorageException e) {
            //
        }
        ServerBaseEntry entry = new ServerBaseEntry();
        entry.setServiceConfig(new ProvidedServiceStub());

        try {
            this.storage.storeEntry(entry);
            fail("feed is null");
        } catch (StorageException e) {
            //
        }

        entry.setFeedId("someID");
        try {
            this.storage.storeEntry(entry);

        } catch (StorageException e1) {
            fail("unexpected exception");

        }
        entry.setServiceConfig(null);
        try {
            this.storage.storeEntry(entry);
            fail("no service config");
        } catch (StorageException e) {

        }
        entry.setVersion(5);
        try {
            this.storage.storeEntry(entry);
            fail("version is greater than 1");
        } catch (StorageException e) {
View Full Code Here

TOP

Related Classes of org.apache.lucene.gdata.data.ServerBaseEntry

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.