Package org.apache.roller.planet.pojos

Examples of org.apache.roller.planet.pojos.Subscription


            throws Exception {
       
        PlanetManager mgr = PlanetFactory.getPlanet().getPlanetManager();
       
        // store
        Subscription testSub = new Subscription();
        testSub.setFeedURL(feedUrl);
        testSub.setTitle(feedUrl);
        mgr.saveSubscription(testSub);
       
        // flush
        PlanetFactory.getPlanet().flush();
       
        // query to make sure we return the persisted object
        Subscription sub = mgr.getSubscriptionById(testSub.getId());
       
        if(sub == null)
            throw new PlanetException("error inserting new subscription");
       
        return sub;
View Full Code Here


     */
    public static void teardownSubscription(String id) throws Exception {
       
        // lookup
        PlanetManager mgr = PlanetFactory.getPlanet().getPlanetManager();
        Subscription sub = mgr.getSubscriptionById(id);
       
        // remove
        mgr.deleteSubscription(sub);
       
        // flush
View Full Code Here

            throws Exception {
       
        PlanetManager mgr = PlanetFactory.getPlanet().getPlanetManager();
       
        // make sure we are using a persistent object
        Subscription testSub = mgr.getSubscriptionById(sub.getId());
       
        // store
        SubscriptionEntry testEntry = new SubscriptionEntry();
        testEntry.setPermalink(title);
        testEntry.setTitle(title);
        testEntry.setPubTime(new java.sql.Timestamp(System.currentTimeMillis()));
        testEntry.setSubscription(testSub);
        testSub.getEntries().add(testEntry);
        mgr.saveEntry(testEntry);
       
        // flush
        PlanetFactory.getPlanet().flush();
       
View Full Code Here

        // setup planet
        TestUtils.setupPlanet();

        PlanetManager mgr = PlanetFactory.getPlanet().getPlanetManager();
       
        Subscription testSub = new Subscription();
        testSub.setFeedURL("test_title");
        testSub.setTitle("test_title");
       
        Subscription sub = mgr.getSubscription(testSub.getFeedURL());
        assertNull(sub);
       
        // add
        mgr.saveSubscription(testSub);
        TestUtils.endSession(true);
       
        // verify
        sub = null;
        sub = mgr.getSubscriptionById(testSub.getId());
        assertNotNull(sub);
        assertEquals("test_title", sub.getFeedURL());
       
        // modify
        sub.setTitle("foo");
        mgr.saveSubscription(sub);
        TestUtils.endSession(true);
       
        // verify
        sub = null;
        sub = mgr.getSubscriptionById(testSub.getId());
        assertNotNull(sub);
        assertEquals("foo", sub.getTitle());
       
        // remove
        mgr.deleteSubscription(sub);
        TestUtils.endSession(true);
       
View Full Code Here

                setError("PlanetSubscriptionForm.error.groupNull");
                return INPUT;
            }
           
            // check if this subscription already exists before adding it
            Subscription sub = pMgr.getSubscription(getAddSubUrl());
            if(sub == null) {
                // sub doesn't exist yet, so we need to fetch it
                FeedFetcher fetcher = PlanetFactory.getPlanet().getFeedFetcher();
                sub = fetcher.fetchSubscription(getAddSubUrl());
               
                // save new sub
                pMgr.saveSubscription(sub);
            }
           
            // add the sub to the group
            group.getSubscriptions().add(sub);
            sub.getGroups().add(group);
            pMgr.saveGroup(group);
           
            // flush changes
            PlanetFactory.getPlanet().flush();
           
View Full Code Here

        log.debug("Deleting Planet Subscription ...");
       
        PlanetManager pmgr = PlanetFactory.getPlanet().getPlanetManager();
        try {
            if(!StringUtils.isEmpty(getSubid())) {
                Subscription sub = pmgr.getSubscriptionById(getSubid());
                if(sub == null) {
                    setError("PlanetGroupForm.error.nullSubscription");
                    return INPUT;
                } else {
                    PlanetGroup group = getGroup();
                    group.getSubscriptions().remove(sub);
                    sub.getGroups().remove(group);
                    pmgr.saveGroup(group);
                    PlanetFactory.getPlanet().flush();
                }
               
                setSuccess("PlanetGroupForm.message.subscriptionDeleteSucceeded", sub.getTitle());
            } else {
                setError("PlanetGroupForm.error.subscriptionNull");
            }
           
            return INPUT;
View Full Code Here

        // setup planet
        TestUtils.setupPlanet();
       
        // add test subscription
        PlanetManager mgr = PlanetFactory.getPlanet().getPlanetManager();
        testSub = new Subscription();
        testSub.setTitle(feed_url);
        testSub.setFeedURL(feed_url);
        mgr.saveSubscription(testSub);
        PlanetFactory.getPlanet().flush();
    }
View Full Code Here

   
   
    public void testUpdateSubscription() throws Exception {
       
        PlanetManager mgr = PlanetFactory.getPlanet().getPlanetManager();
        Subscription sub = mgr.getSubscriptionById(testSub.getId());
       
        // update the subscription
        FeedUpdater updater = new SingleThreadedFeedUpdater();
        updater.updateSubscription(sub);
        TestUtils.endSession(true);
       
        // verify the results
        sub = mgr.getSubscription(feed_url);
        assertNotNull(sub);
        assertEquals(feed_url, sub.getFeedURL());
        assertEquals("http://rollerweblogger.org/roller/", sub.getSiteURL());
        assertEquals("Blogging Roller", sub.getTitle());
        assertNotNull(sub.getLastUpdated());
        assertTrue(sub.getEntries().size() > 0);
    }
View Full Code Here

    public void testSubscriptionLookups() throws Exception {
       
        PlanetManager mgr = PlanetFactory.getPlanet().getPlanetManager();
       
        // by id
        Subscription sub = mgr.getSubscriptionById(testSub1.getId());
        assertNotNull(sub);
        assertEquals("subFuncTest1", sub.getFeedURL());
       
        // by feed url
        sub = null;
        sub = mgr.getSubscription(testSub2.getFeedURL());
        assertNotNull(sub);
        assertEquals("subFuncTest2", sub.getFeedURL());
       
        // count
        assertEquals(2, mgr.getSubscriptionCount());
    }
View Full Code Here

    public void testSubscriptionGroupCRUD() throws Exception {
       
        PlanetManager planet = PlanetFactory.getPlanet().getPlanetManager();
       
        // retrieve subscriptions and add to group
        Subscription sub1 = planet.getSubscriptionById(testSub1.getId());
        Subscription sub2 = planet.getSubscriptionById(testSub2.getId());
        PlanetGroup group = planet.getGroupById(testGroup1.getId());
       
        // make sure no subs in group yet
        assertEquals(0, group.getSubscriptions().size());
       
        // add
        group.getSubscriptions().add(sub1);
        sub1.getGroups().add(group);

        group.getSubscriptions().add(sub2);
        sub2.getGroups().add(group);
       
        planet.saveGroup(group);
        TestUtils.endSession(true);
       
        // verify
        group = null;
        group = planet.getGroupById(testGroup1.getId());
        sub1 = planet.getSubscriptionById(testSub1.getId());
        sub2 = planet.getSubscriptionById(testSub2.getId());
        assertEquals(2, group.getSubscriptions().size());
       
        // remove
        group.getSubscriptions().remove(sub1);
        sub1.getGroups().remove(group);
       
        group.getSubscriptions().remove(sub2);
        sub2.getGroups().remove(group);

        planet.saveGroup(group);
        TestUtils.endSession(true);
       
        // verify
View Full Code Here

TOP

Related Classes of org.apache.roller.planet.pojos.Subscription

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.