FileDocCategorySizeDatePackage
TestDb4oStorage.javaAPI DocApache Lucene 2.1.033522Wed Feb 14 10:46:02 GMT 2007org.apache.lucene.gdata.storage.db4o

TestDb4oStorage

public class TestDb4oStorage extends TestCase
Copyright 2004 The Apache Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Fields Summary
private static final String
FEEDID
private static final String
ACCOUNTNAME
private static final String
SERVICENAME
DB4oController
controller
static volatile boolean
fail
Constructors Summary
Methods Summary
private voidclearDB()

        ObjectContainer container = this.controller.releaseContainer();
        ObjectSet set = container.get(new Object());

        for (Object object : set) {
            container.delete(object);
        }
        container.ext().purge();
        container.close();
    
private static org.apache.lucene.gdata.data.ServerBaseEntrycreateServerBaseEntry()

        ServerBaseEntry e = new ServerBaseEntry();
        e.setId(System.currentTimeMillis() + "");
        ProvidedServiceConfig conf = new ProvidedServiceConfig();
        conf.setName(SERVICENAME);
        e.setServiceConfig(conf);
        e.setUpdated(DateTime.now());
        e.setFeedId(FEEDID);
        try {
            Thread.sleep(2);
        } catch (InterruptedException e1) {

            e1.printStackTrace();
        }
        return e;
    
com.db4o.ObjectContainergetContainer()

        return this.controller.releaseContainer();
    
private java.lang.ThreadgetDelThread(org.apache.lucene.gdata.storage.StorageController c, org.apache.lucene.gdata.data.ServerBaseEntry e, boolean conflictExpected)

        Thread t1 = new Thread(new Runner(c, e, conflictExpected,
                StorageOperation.DELETE));
        t1.setPriority(Thread.MAX_PRIORITY);
        return t1;
    
private org.apache.lucene.gdata.utils.VisitorgetMonitorVisitor(java.lang.Object monitor, java.util.concurrent.atomic.AtomicBoolean reached)

        /*
         * The executing thread stops at a defined position while holding the
         * semaphore inside the storageImpl
         */
        return new Visitor() {
            public void execute(Object[] o) {
                synchronized (monitor) {
                    try {
                        reached.set(true);
                        monitor.wait();
                        reached.set(false);

                    } catch (InterruptedException e) {
                        //                   
                    }
                }
            }
        };
    
private java.lang.ThreadgetUpdThread(org.apache.lucene.gdata.storage.StorageController c, org.apache.lucene.gdata.data.ServerBaseEntry e, boolean conflictExpected)

        Thread t1 = new Thread(new Runner(c, e, conflictExpected,
                StorageOperation.UPDATE));
        t1.setPriority(Thread.MAX_PRIORITY);
        return t1;
    
protected voidsetUp()


         
        this.controller = new DB4oController();
        this.controller.setContainerPoolSize(2);
        this.controller.setFilePath("test.yap");
        this.controller.setRunAsServer(true);
        this.controller.setPassword("");
        this.controller.setUser("");
        this.controller.setUseWeakReferences(true);
        this.controller.setPort(0);
        this.controller.initialize();
        this.controller.visiteInitialize();
        clearDB();
    
private org.apache.lucene.gdata.data.ServerBaseFeedstoreServerBaseFeed()

        ServerBaseFeed f = new ServerBaseFeed();
        ProvidedServiceConfig conf = new ProvidedServiceConfig();
        conf.setName(SERVICENAME);
        f.setServiceConfig(conf);
        f.setId(System.currentTimeMillis() + "");
        f.setId(FEEDID);
        f.setUpdated(DateTime.now());
        ObjectContainer con = this.controller.releaseContainer();
        con.set(f);
        con.commit();

        con.close();
        return f;
    
protected voidtearDown()

        clearDB();
        fail = false;
        this.controller.getStorage().close();
        this.controller.visiteDestroy();
        this.controller.destroy();
        File dbFile = new File("test.yap");
        assertTrue(dbFile.delete());
    
public voidtestDeleteAccount()

        GDataAccount account = new GDataAccount();
        account.setName("simon");
        account.setPassword("somepass");
        Storage storage = this.controller.getStorage();
        storage.storeAccount(account);
        ObjectContainer container = getContainer();
        Query q = container.query();
        q.constrain(GDataAccount.class);
        q.descend("name").constrain(account.getName());
        ObjectSet set = q.execute();
        assertEquals(1, set.size());

        storage.deleteAccount(account.getName());
        container.close();
        container = getContainer();
        q = container.query();
        q.constrain(GDataAccount.class);
        q.descend("name").constrain(account.getName());
        set = q.execute();
        assertEquals(0, set.size());
        try {
            storage.deleteAccount("notstored");
            fail("account not stored");
        } catch (Exception e) {
            // 
        }
        try {
            storage.deleteAccount(null);
            fail("name is null");
        } catch (Exception e) {
            // 
        }
        container.close();
    
public voidtestDeleteEntry()

        ObjectContainer container = getContainer();
        storeServerBaseFeed();
        Storage storage = this.controller.getStorage();
        
        try {

            storage.deleteEntry(null);
            fail("entry is null");
        } catch (StorageException e) {
            //
        }
        ServerBaseEntry exEntry = new ServerBaseEntry();
        exEntry.setFeedId("some");
        try {

            storage.deleteEntry(exEntry);
            fail("entry id is null");
        } catch (StorageException e) {
            //
        }
        exEntry.setId("someID");
        exEntry.setFeedId(null);
        try {

            storage.storeEntry(exEntry);
            fail("feed id is null");
        } catch (StorageException e) {
            //
        }
        
        
        ServerBaseEntry e = createServerBaseEntry();
        storage.storeEntry(e);
        ServerBaseEntry e1 = createServerBaseEntry();
        storage.storeEntry(e1);

        storage.deleteEntry(e);

        container.close();
        container = getContainer();
        Query query = container.query();
        query.constrain(BaseEntry.class);
        query.descend("id").constrain(e.getId());
        ObjectSet resultSet = query.execute();
        assertEquals(0, resultSet.size());

        // #### test version matching
        ServerBaseEntry eVersion = createServerBaseEntry();
        storage.storeEntry(eVersion);
        eVersion.setVersion(33);
        try {
            storage.deleteEntry(eVersion);
            fail("version does not match");
        } catch (Exception ex) {
            // TODO: handle exception
        }
        try {
            storage.deleteEntry(null);
            fail("entry id is null");
        } catch (Exception ex) {
            // TODO: handle exception
        }
        storage = this.controller.getStorage();
        storage.deleteEntry(e1);
        container.close();
        container = getContainer();
        query = container.query();
        query.constrain(BaseEntry.class);
        query.descend("id").constrain(e1.getId());
        resultSet = query.execute();
        assertEquals(0, resultSet.size());

        // ############ test concurrency

        // ############ test concurrency
        Object monitor = new Object();
        AtomicBoolean reached = new AtomicBoolean(false);
        MultiThreadEntryStub concuEntry = new MultiThreadEntryStub();
        concuEntry.setId(System.currentTimeMillis() + "");
        ProvidedServiceConfig conf = new ProvidedServiceConfig();
        conf.setName(SERVICENAME);
        concuEntry.setServiceConfig(conf);
        concuEntry.setUpdated(DateTime.now());
        concuEntry.setFeedId(FEEDID);

        storage = this.controller.getStorage();

        storage.storeEntry(concuEntry);
        storage.close();
        concuEntry.acceptGetVersionVisitor(getMonitorVisitor(monitor, reached));

        Thread t1 = getDelThread(controller, concuEntry, false);

        Thread t2 = getDelThread(controller, concuEntry, true);
        t1.start();
        /*
         * Wait active -- not nice but works fine here wait until thread parked
         */

        while (true) {
            synchronized (monitor) {
                if (reached.get())
                    break;
                monitor.wait(10);
            }
        }
        t2.start();
        t2.join(800);
        /*
         * Wait active -- not nice but works fine here wake up the waiting
         * thread
         */
        while (true) {
            synchronized (monitor) {
                if (!reached.get())
                    break;
                monitor.notifyAll();
            }
        }
        t1.join(300);
        if (fail)
            fail("thread failed -- see stacktrace");

        container.close();

    
public voidtestDeleteFeed()


        ServerBaseFeed feed = new ServerBaseFeed();
        feed.setId(FEEDID);
        GDataAccount account = new GDataAccount();
        account.setName(ACCOUNTNAME);
        account.setPassword("somePass");
        ObjectContainer container = getContainer();
        container.set(account);
        container.commit();
        container.close();
        Storage storage = this.controller.getStorage();
        ProvidedServiceConfig conf = new ProvidedServiceConfig();
        conf.setName(SERVICENAME);
        feed.setServiceConfig(conf);
        storage.storeFeed(feed, ACCOUNTNAME);

        storage.deleteFeed(FEEDID);
        container = getContainer();
        Query query = container.query();
        query.constrain(ServerBaseFeed.class);
        query.descend("feed").descend("id").constrain(FEEDID);
        ObjectSet set = query.execute();
        assertEquals(0, set.size());

        query = getContainer().query();
        query.constrain(BaseFeed.class);
        query.descend("id").constrain(FEEDID);
        set = query.execute();
        assertEquals(0, set.size());
        container.close();
    
public voidtestEntryLastModified()

        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) {

        }

    
public voidtestFeedLastModified()

        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) {

        }

    
public voidtestGetAccount()

        GDataAccount account = new GDataAccount();
        account.setName(ACCOUNTNAME);
        account.setPassword("somePass");
        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) {
            // 
        }
    
public voidtestGetEntry()

        storeServerBaseFeed();
        Storage storage = this.controller.getStorage();
        ServerBaseEntry exEntry = createServerBaseEntry();
        exEntry.setId(null);
        try{
        storage.getEntry(exEntry);
        fail("id is null");
        }catch (StorageException e) {

        }
        ServerBaseEntry e = createServerBaseEntry();
        storage.storeEntry(e);
        ServerBaseEntry e1 = createServerBaseEntry();
        storage.storeEntry(e1);
        
        storage = this.controller.getStorage();
        BaseEntry result = storage.getEntry(e);
        assertNotNull(result);
        assertEquals(e.getId(), result.getId());
        try {
            e1.setId("hello");
            result = storage.getEntry(e1);
            fail("no such entry");
        } catch (StorageException ex) {
            ex.printStackTrace();
        }

    
public voidtestGetFeed()

        storeServerBaseFeed();
        Storage storage = this.controller.getStorage();
        ServerBaseFeed feed = new ServerBaseFeed();
        feed.setItemsPerPage(25);
        feed.setStartIndex(1);
        feed.setServiceType(SERVICENAME);
        try{
        storage.getFeed(feed);
        fail("feedid is null");
        }catch (StorageException e) {
            // 
        }
        
        feed.setId(FEEDID);
        BaseFeed result = storage.getFeed(feed);
        assertNotNull(result);
        assertEquals(0, result.getEntries().size());
        List<String> idlist = new ArrayList<String>(30);
        ServerBaseEntry e1 = null;
        for (int i = 0; i < 30; i++) {
            e1 = createServerBaseEntry();
            storage.storeEntry(e1);
            idlist.add(0, e1.getId());
        }
        String firstId = e1.getId();

        storage = this.controller.getStorage();
        result = storage.getFeed(feed);
        assertNotNull(result);
        assertEquals(25, result.getEntries().size());
        for (int i = 0; i < 25; i++) {
            assertEquals(idlist.get(i),
                    ((BaseEntry) result.getEntries().get(i)).getId());
        }

        storage = this.controller.getStorage();
        feed.setItemsPerPage(5);
        result = storage.getFeed(feed);
        assertNotNull(result);
        assertEquals(5, result.getEntries().size());
        for (int i = 0; i < 5; i++) {
            assertEquals(idlist.get(i),
                    ((BaseEntry) result.getEntries().get(i)).getId());
        }

        storage = this.controller.getStorage();
        feed.setItemsPerPage(1);
        feed.setStartIndex(1);
        result = storage.getFeed(feed);
        assertNotNull(result);
        assertEquals(1, result.getEntries().size());

        assertEquals(idlist.get(0), ((BaseEntry) result.getEntries().get(0))
                .getId());

        storage = this.controller.getStorage();
        feed.setItemsPerPage(50);
        feed.setStartIndex(28);
        result = storage.getFeed(feed);
        assertNotNull(result);
        assertEquals(3, result.getEntries().size());

        assertEquals(idlist.get(27), ((BaseEntry) result.getEntries().get(0))
                .getId());
        assertEquals(idlist.get(28), ((BaseEntry) result.getEntries().get(1))
                .getId());
        assertEquals(idlist.get(29), ((BaseEntry) result.getEntries().get(2))
                .getId());

        storage = this.controller.getStorage();
        feed.setItemsPerPage(50);
        feed.setStartIndex(30);
        result = storage.getFeed(feed);
        assertNotNull(result);
        assertEquals(1, result.getEntries().size());

        assertEquals(idlist.get(29), ((BaseEntry) result.getEntries().get(0))
                .getId());

        // assertNotSame(firstId,((BaseEntry)result.getEntries().get(0)).getId());
    
public voidtestGetServiceForFeed()

        ServerBaseFeed feed = new ServerBaseFeed();
        ProvidedServiceConfig conf = new ProvidedServiceConfig();
        conf.setName(SERVICENAME);
        feed.setServiceConfig(conf);
        feed.setId(FEEDID);
        GDataAccount account = new GDataAccount();
        account.setName(ACCOUNTNAME);
        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) {
            // 
        }

    
public voidtestStoreAccount()

        GDataAccount account = new GDataAccount();
        account.setName("simon");
        account.setPassword("somepass");
        Storage storage = this.controller.getStorage();
        storage.storeAccount(account);
        ObjectContainer container = getContainer();
        Query q = container.query();
        q.constrain(GDataAccount.class);
        q.descend("name").constrain(account.getName());
        ObjectSet set = q.execute();
        assertEquals(1, set.size());
        assertEquals(account.getPassword(), ((GDataAccount) set.next())
                .getPassword());
        try {
            storage.storeAccount(account);
            fail("Account already stored");
        } catch (Exception e) {

        }
        container.close();
    
public voidtestStoreEntry()

        Storage storage = this.controller.getStorage();
        try {
            ServerBaseEntry e = createServerBaseEntry();
            storage.storeEntry(e);
            fail("excption exp. for feed for the entry");
        } catch (StorageException e) {
            //
        }

        try {

            storage.storeEntry(null);
            fail("entry is null");
        } catch (StorageException e) {
            //
        }
        ServerBaseEntry exEntry = new ServerBaseEntry();
        exEntry.setFeedId("some");
        try {

            storage.storeEntry(exEntry);
            fail("entry id is null");
        } catch (StorageException e) {
            //
        }
        exEntry.setId("someID");
        exEntry.setFeedId(null);
        try {

            storage.storeEntry(exEntry);
            fail("feed id is null");
        } catch (StorageException e) {
            //
        }

        storeServerBaseFeed();
        ServerBaseEntry e = createServerBaseEntry();
        storage.storeEntry(e);
        ServerBaseEntry e1 = createServerBaseEntry();
        storage.storeEntry(e1);

        storage = this.controller.getStorage();
        Query query = getContainer().query();
        query.constrain(BaseEntry.class);
        query.descend("id").constrain(e.getId());
        ObjectSet resultSet = query.execute();
        assertEquals(1, resultSet.size());
        BaseEntry storedEntry = (BaseEntry) resultSet.next();
        assertEquals("1", storedEntry.getVersionId());

        ServerBaseFeed bFeed = new ServerBaseFeed();
        bFeed.setItemsPerPage(25);
        bFeed.setId(FEEDID);
        bFeed.setStartIndex(1);
        bFeed.setServiceType(SERVICENAME);
        BaseFeed<BaseFeed, BaseEntry> feed = storage.getFeed(bFeed);
        assertEquals(2, feed.getEntries().size());
        assertEquals(e.getId(), feed.getEntries().get(1).getId()); // last post
        // ->
        // previously
        // created
        assertEquals(e1.getId(), feed.getEntries().get(0).getId()); // first pos
        // -> last
        // created
        assertEquals(feed.getUpdated(), feed.getEntries().get(0).getUpdated());
    
public voidtestStoreFeed()

        ObjectContainer container = getContainer();
        ServerBaseFeed feed = new ServerBaseFeed();
        feed.setId(FEEDID);
        ProvidedServiceConfig conf = new ProvidedServiceConfig();
        conf.setName(SERVICENAME);
        feed.setServiceConfig(conf);

        Storage storage = this.controller.getStorage();
        try {
            storage.storeFeed(feed, ACCOUNTNAME);
            fail("no accoutn stored");
        } catch (Exception e) {
            // 
        }
        GDataAccount account = new GDataAccount();
        account.setName(ACCOUNTNAME);
        account.setPassword("somePass");
        container.set(account);
        container.commit();
        container.close();
        storage.storeFeed(feed, ACCOUNTNAME);

        container = getContainer();
        Query query = container.query();
        query.constrain(ServerBaseFeed.class);
        query.descend("feed").descend("id").constrain(FEEDID);
        ObjectSet set = query.execute();
        assertEquals(1, set.size());

        assertEquals(feed.getId(), ((ServerBaseFeed) set.next()).getId());
        container.close();

    
public voidtestUpdateAccount()

        GDataAccount account = new GDataAccount();
        account.setName("simon");
        account.setPassword("somepass");

        Storage storage = this.controller.getStorage();
        try {
            storage.updateAccount(account);
            fail("Account does not exist");
        } catch (Exception e) {
            //
        }
        try {
            storage.updateAccount(null);
            fail("Account is null");
        } catch (Exception e) {
            //
        }
        storage.storeAccount(account);
        ObjectContainer container = getContainer();
        Query q = container.query();
        q.constrain(GDataAccount.class);
        q.descend("name").constrain(account.getName());
        ObjectSet set = q.execute();
        assertEquals(1, set.size());
        assertEquals(account.getPassword(), ((GDataAccount) set.next())
                .getPassword());
        account = new GDataAccount();
        account.setName("simon");
        account.setPassword("newPass");
        storage.updateAccount(account);
        container.close();
        container = getContainer();
        q = container.query();
        q.constrain(GDataAccount.class);
        q.descend("name").constrain(account.getName());
        set = q.execute();
        assertEquals(1, set.size());
        assertEquals(account.getPassword(), ((GDataAccount) set.next())
                .getPassword());
        container.close();
    
public voidtestUpdateEntry()

        storeServerBaseFeed();
        Storage storage = this.controller.getStorage();
        ServerBaseEntry exEntry = new ServerBaseEntry();
        

        try {

            storage.updateEntry(null);
            fail("entry is null");
        } catch (StorageException e) {
            //
        }

        try {

            storage.updateEntry(exEntry);
            fail("entry id is null");
        } catch (StorageException e) {
            //
        }
        exEntry.setId("someID");
        try {

            storage.updateEntry(exEntry);
            fail("feed id is null");
        } catch (StorageException e) {
            //
        }
        
        
        
        ServerBaseEntry e = createServerBaseEntry();
        ServerBaseEntry e1 = createServerBaseEntry();
        try {
            storage.updateEntry(e);
            fail("entry does not exist");
        } catch (StorageException ex) {
            ex.printStackTrace();
        }
        storage.storeEntry(e);

        storage = this.controller.getStorage();

        storage.storeEntry(e1);
        ServerBaseEntry e2 = createServerBaseEntry();
        e2.setId(e.getId());
        e2.setTitle(new PlainTextConstruct("new"));
        e2.setUpdated(DateTime.now());
        storage.updateEntry(e2);
        ObjectContainer container = getContainer();
        Query query = container.query();
        query.constrain(BaseEntry.class);
        query.descend("id").constrain(e.getId());
        ObjectSet resultSet = query.execute();
        assertEquals(1, resultSet.size());
        BaseEntry result = (BaseEntry) resultSet.next();
        assertEquals("new", result.getTitle().getPlainText());
        assertEquals("2", result.getVersionId());

        ServerBaseFeed bFeed = new ServerBaseFeed();
        bFeed.setItemsPerPage(25);
        bFeed.setId(FEEDID);
        bFeed.setStartIndex(1);
        bFeed.setServiceType(SERVICENAME);
        storage = this.controller.getStorage();
        BaseFeed<BaseFeed, BaseEntry> feed = storage.getFeed(bFeed);

        assertEquals(2, feed.getEntries().size());
        assertEquals(e.getId(), feed.getEntries().get(0).getId());
        assertEquals(feed.getUpdated(), feed.getEntries().get(0).getUpdated());

        storage = this.controller.getStorage();
        storage.storeEntry(e);

        e2.setVersion(5);
        try {
            storage.updateEntry(e2);
            fail("version does not match");
        } catch (Exception ex) {
            // TODO: handle exception
        }

        // ############ test concurrency
        Object monitor = new Object();
        AtomicBoolean reached = new AtomicBoolean(false);

        MultiThreadEntryStub concuEntry = new MultiThreadEntryStub();
        concuEntry.setId(System.currentTimeMillis() + "");
        ProvidedServiceConfig conf = new ProvidedServiceConfig();
        conf.setName(SERVICENAME);
        concuEntry.setServiceConfig(conf);
        concuEntry.setUpdated(DateTime.now());
        concuEntry.setFeedId(FEEDID);

        storage = this.controller.getStorage();

        storage.storeEntry(concuEntry);
        storage.close();
        concuEntry.acceptGetEntryVisitor(getMonitorVisitor(monitor, reached));

        Thread t1 = getUpdThread(controller, concuEntry, false);

        Thread t2 = getUpdThread(controller, concuEntry, true);
        t1.start();
        /*
         * Wait active -- not nice but works fine here wait until thread parked
         */

        while (true) {
            synchronized (monitor) {
                if (reached.get())
                    break;
                monitor.wait(10);
            }
        }
        t2.start();
        t2.join(800);
        /*
         * Wait active -- not nice but works fine here wake up the waiting
         * thread
         */
        while (true) {
            synchronized (monitor) {
                if (!reached.get())
                    break;
                monitor.notifyAll();
            }
        }
        t1.join(300);
        if (fail)
            fail("thread failed -- see stacktrace");
        container.close();
    
public voidtestUpdateFeed()

        ObjectContainer container = getContainer();
        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) {
            // 
        }