Package org.apache.lucene.gdata.storage

Examples of org.apache.lucene.gdata.storage.Storage


        account.setPassword("somePass");
        ObjectContainer container = getContainer();
        container.set(account);
        container.commit();
        container.close();
        Storage storage = this.controller.getStorage();
        storage.storeFeed(feed, ACCOUNTNAME);

        assertEquals(SERVICENAME, storage.getServiceForFeed(FEEDID));
        try {
            storage.getServiceForFeed(null);
            fail("ID is null");
        } catch (Exception e) {
            //
        }

        try {
            storage.getServiceForFeed("someOtherId");
            fail("feed for id is not stored");
        } catch (Exception e) {
            //
        }
View Full Code Here


        ObjectContainer container = getContainer();
        container.set(account);
        container.commit();
        container.close();

        Storage storage = this.controller.getStorage();
        assertNotNull(storage.getAccount(ACCOUNTNAME));
        assertEquals(account.getPassword(), storage.getAccount(ACCOUNTNAME)
                .getPassword());
        try {
            storage.getAccount(null);
            fail("accountname is null");
        } catch (Exception e) {
            //
        }
        try {
            storage.getAccount("someOtherAccount");
            fail("accountname is not stored");
        } catch (Exception e) {
            //
        }
    }
View Full Code Here

        ServerBaseFeed feed = new ServerBaseFeed();
        ProvidedServiceConfig conf = new ProvidedServiceConfig();
        conf.setName(SERVICENAME);
        feed.setId(FEEDID);
        feed.setServiceConfig(conf);
        Storage storage = this.controller.getStorage();
        GDataAccount account = new GDataAccount();
        account.setName(ACCOUNTNAME);
        account.setPassword("somePass");
        container.set(account);
        container.commit();
        container.close();
        storage.storeFeed(feed, ACCOUNTNAME);
        assertNull(feed.getTitle());
        ServerBaseFeed feedU = new ServerBaseFeed();
        feedU.setServiceConfig(conf);
        feedU.setId(FEEDID);
        feedU.setTitle(new PlainTextConstruct("someText"));
        feedU.setServiceType(SERVICENAME);

        storage.updateFeed(feedU, ACCOUNTNAME);
        ServerBaseFeed requestFeed = new ServerBaseFeed();
        requestFeed.setId(FEEDID);
        requestFeed.setServiceType(SERVICENAME);
        assertNotNull(storage.getFeed(requestFeed));
        assertEquals(feedU.getTitle(), storage.getFeed(requestFeed).getTitle());
        try {
            storage.updateFeed(null, ACCOUNTNAME);
            fail("feed is null");
        } catch (Exception e) {
            //
        }
        try {
            storage.updateFeed(feedU, null);
            fail("accountname is null");
        } catch (Exception e) {
            //
        }
        try {
            feedU.setServiceType(null);
            storage.updateFeed(feedU, ACCOUNTNAME);
            fail("servicetype is null");
        } catch (Exception e) {
            //
        }
View Full Code Here

        }
    }

    public void testFeedLastModified() {
        ServerBaseFeed feed = storeServerBaseFeed();
        Storage s = this.controller.getStorage();
        assertEquals(feed.getUpdated().getValue(), s
                .getFeedLastModified(FEEDID).longValue());
        try {
            s.getFeedLastModified(null);
            fail("id is null");
        } catch (StorageException e) {

        }
        try {
            s.getFeedLastModified("someOtherid");
            fail("no such feed");
        } catch (StorageException e) {

        }
View Full Code Here

    }

    public void testEntryLastModified() {
        ServerBaseFeed feed = storeServerBaseFeed();
        Storage s = this.controller.getStorage();
        ServerBaseEntry en = createServerBaseEntry();
        s.storeEntry(en);
        assertEquals(en.getUpdated().getValue(), s.getEntryLastModified(
                en.getId(), FEEDID).longValue());
        try {
            s.getEntryLastModified(null, null);
            fail("id is null");
        } catch (StorageException e) {

        }
        try {
            s.getEntryLastModified("someOtherid", "notinstorage");
            fail("no such Entry");
        } catch (StorageException e) {

        }
View Full Code Here

    /**
     * @see org.apache.lucene.gdata.storage.StorageController#getStorage()
     */
    public Storage getStorage() throws StorageException {
       Storage retVal = this.threadLocalStorage.get();
        if (retVal != null)
            return retVal;

        retVal = new DB4oStorage(this.containerPool.aquire(), this);

View Full Code Here

    }

    private void createAdminAccount() throws StorageException {
        GDataAccount adminAccount = GDataAccount.createAdminAccount();
        visiteInitialize();
        Storage sto = this.getStorage();
        try {
            sto.getAccount(adminAccount.getName());
        } catch (Exception e) {
            this.getStorage().storeAccount(adminAccount);
        } finally {
            visiteDestroy();
        }
View Full Code Here

     * @see org.apache.lucene.gdata.server.registry.ScopeVisitor#visiteInitialize()
     */
    public void visiteInitialize() {
        if (LOG.isInfoEnabled())
            LOG.info("Opened Storage -- request initialized");
        Storage storage = this.threadLocalStorage.get();
        if (storage != null) {
            LOG.warn("Storage already opened");
            return;
        }

View Full Code Here

    /**
     * @see org.apache.lucene.gdata.server.registry.ScopeVisitor#visiteDestroy()
     */
    public void visiteDestroy() {
        Storage storage = this.threadLocalStorage.get();
        if (storage == null) {
            LOG.warn("no Storage opened -- threadlocal returned null");
            return;
        }
        this.containerPool.release(((DB4oStorage)storage).getContainer());
View Full Code Here

TOP

Related Classes of org.apache.lucene.gdata.storage.Storage

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.