Examples of PlanetManager


Examples of org.apache.roller.model.PlanetManager

   
   
    public void testSubscriptionCount() throws Exception {
       
        try {
            PlanetManager planet = RollerFactory.getRoller().getPlanetManager();
           
            String feed_url1 = "http://rollerweblogger.org/rss/roller";
            String feed_url2 = "http://linuxintegrators.com/acoliver/?flavor=rss2";
           
            {
                PlanetSubscriptionData sub1 = new PlanetSubscriptionData();
                sub1.setFeedUrl(feed_url1);
                planet.saveSubscription(sub1);
                PlanetSubscriptionData sub2 = new PlanetSubscriptionData();
                sub2.setFeedUrl(feed_url2);
                planet.saveSubscription(sub2);
                TestUtils.endSession(true);
               
                assertEquals(2, planet.getSubscriptionCount());
               
                planet.deleteSubscription(planet.getSubscription(feed_url1));
                planet.deleteSubscription(planet.getSubscription(feed_url2));
                TestUtils.endSession(true);
            }
        } catch (Exception e) {
            e.printStackTrace();
            fail();
View Full Code Here

Examples of org.apache.roller.model.PlanetManager

        super.tearDown();
        super.tearDownTestWeblogs();
    }
    public void testRefreshEntries() {
        try {     
            PlanetManager planet = getRoller().getPlanetManager();
           
            // run sync task to fill aggregator with websites created by super
            SyncWebsitesTask syncTask = new SyncWebsitesTask();
            syncTask.init(getRoller(), "dummy");
            syncTask.run();          
           
            RefreshEntriesTask refreshTask = new RefreshEntriesTask();
            refreshTask.init(getRoller(), "dummy");
            refreshTask.run();
           
            List agg = planet.getAggregation(10000);
            int size = agg.size();
            assertEquals(mBlogCount * mExpectedPublishedEntryCount, size);
        }
        catch (Exception e) {
            e.printStackTrace();
View Full Code Here

Examples of org.apache.roller.model.PlanetManager

        RollerConfig.setPlanetCachePath("." + File.separator + "planet-cache");
    }
   
    public void testConfigurationStorage() throws Exception {
       
        PlanetManager planet = RollerFactory.getRoller().getPlanetManager();
       
        {   // retrieve config
            PlanetConfigData config = planet.getConfiguration();
            assertNotNull(config);
            assertEquals("test_title", config.getTitle());
            assertEquals("test_admin_email", config.getAdminEmail());
            assertNull(config.getSiteUrl());
        }
        {   // save config
            PlanetConfigData config = planet.getConfiguration();
            config.setSiteUrl("http://footest/lskdf/null");
            planet.saveConfiguration(config);
            TestUtils.endSession(true);
        }
        {
            // make sure config was saved
            PlanetConfigData config = planet.getConfiguration();
            assertNotNull(config);
            assertEquals("http://footest/lskdf/null", config.getSiteUrl());
        }
    }
View Full Code Here

Examples of org.apache.roller.model.PlanetManager

    }
   
   
    public void testGroupStorage() throws Exception {
       
        PlanetManager planet = RollerFactory.getRoller().getPlanetManager();
       
        {   // save group
            PlanetGroupData group = new PlanetGroupData();
            group.setDescription("test_group_desc");
            group.setHandle("test_handle");
            group.setTitle("test_title");
            planet.saveGroup(group);
            TestUtils.endSession(true);
        }
        {   // retrieve group
            PlanetGroupData group = planet.getGroup("test_handle");
            assertEquals("test_group_desc",group.getDescription());
            assertEquals("test_title",group.getTitle());
            assertTrue(planet.getGroupHandles().size() > 0);
        }
        {   // remove group
            PlanetGroupData group = planet.getGroup("test_handle");
            planet.deleteGroup(group);
            TestUtils.endSession(true);
        }
        {   // verify that it is gone
            PlanetGroupData group = planet.getGroup("test_handle");
            assertNull(group);
        }
    }
View Full Code Here

Examples of org.apache.roller.model.PlanetManager

    }
   
   
    public void testSubscriptionStorage() throws Exception {
       
        PlanetManager planet = RollerFactory.getRoller().getPlanetManager();
       
        {   // save subscription
            PlanetSubscriptionData sub = new PlanetSubscriptionData();
            sub.setFeedUrl("test_url");
            planet.saveSubscription(sub);
            TestUtils.endSession(true);
        }
        {   // retrieve subscription and add to group
            PlanetGroupData group = new PlanetGroupData();
            group.setDescription("test_group_desc");
            group.setHandle("test_handle");
            group.setTitle("test_title");
            planet.saveGroup(group);
           
            PlanetSubscriptionData sub = planet.getSubscription("test_url");
            assertNotNull(sub);
            group.addSubscription(sub);
           
            PlanetSubscriptionData sub1 = new PlanetSubscriptionData();
            sub1.setFeedUrl("test_url1");
            planet.saveSubscription(sub1);
           
            List subs = new ArrayList();
            subs.add(sub1);
            group.addSubscriptions(subs);
           
            planet.saveGroup(group);
            TestUtils.endSession(true);
        }
        {   // get group and check it's subscriptions, remove it
            PlanetGroupData group = planet.getGroup("test_handle");
            Set subs = group.getSubscriptions();
            assertEquals(2, subs.size());
            planet.deleteGroup(group);
            TestUtils.endSession(true);
        }
        {   // make sure group gone, subs still there, then remove them too
            PlanetGroupData group = planet.getGroup("test_handle");
            assertNull(group);
            PlanetSubscriptionData sub = planet.getSubscription("test_url");
            assertNotNull(sub);
            PlanetSubscriptionData sub1 = planet.getSubscription("test_url1");
            assertNotNull(sub1);
            planet.deleteSubscription(sub);
            planet.deleteSubscription(sub1);
            TestUtils.endSession(true);
        }
        {   // make sure subscriptions are gone
            PlanetSubscriptionData sub = planet.getSubscription("test_url");
            assertNull(sub);
            PlanetSubscriptionData sub1 = planet.getSubscription("test_url1");
            assertNull(sub1);
        }
    }
View Full Code Here

Examples of org.apache.roller.model.PlanetManager

    }
   
   
    public void testSubscriptionEntryStorage() throws Exception {
       
        PlanetManager planet = RollerFactory.getRoller().getPlanetManager();
       
        {   // save subscription
            PlanetSubscriptionData sub = new PlanetSubscriptionData();
            sub.setFeedUrl("test_url");
            planet.saveSubscription(sub);
            TestUtils.endSession(true);
        }
        {   // retrieve subscription and add entries
            PlanetSubscriptionData sub = planet.getSubscription("test_url");
            assertNotNull(sub);
           
            PlanetEntryData entry1 = new PlanetEntryData();
            entry1.setPermalink("test_entry1");
            entry1.setCategoriesString("test,test2");
            entry1.setSubscription(sub);
            entry1.setPublished(new Date());
            sub.addEntry(entry1);
           
            PlanetEntryData entry2 = new PlanetEntryData();
            entry2.setPermalink("test_entry2");
            entry2.setCategoriesString("test_cat1,test_cat2,test_cat3");
            entry2.setSubscription(sub);
            entry2.setPublished(new Date());
            sub.addEntry(entry2);
           
            // save entries
            planet.saveSubscription(sub);
            TestUtils.endSession(true);
           
            // get sub and check it's entries
            sub = planet.getSubscription("test_url");
            assertEquals(2, sub.getEntries().size());
        }
        {
            // add a single entry
            PlanetSubscriptionData sub = planet.getSubscription("test_url");
            assertNotNull(sub);
           
            PlanetEntryData entry3 = new PlanetEntryData();
            entry3.setPermalink("test_entry3");
            entry3.setCategoriesString("test,test3");
            entry3.setSubscription(sub);
            entry3.setPublished(new Date());
            planet.saveEntry(entry3);
            TestUtils.endSession(true);
           
            // verify entry was added
            sub = planet.getSubscription("test_url");
            assertEquals(3, sub.getEntries().size());
        }
        {
            // purge entries
            PlanetSubscriptionData sub = planet.getSubscription("test_url");
            sub.purgeEntries();
            planet.saveSubscription(sub);
            TestUtils.endSession(true);
           
            // make sure they were removed
            sub = planet.getSubscription("test_url");
            assertEquals(0, sub.getEntries().size());
        }
        {
            // remove test subscription
            PlanetSubscriptionData sub = planet.getSubscription("test_url");
            planet.deleteSubscription(sub);
            TestUtils.endSession(true);
           
            // make sure sub is gone
            sub = planet.getSubscription("test_url");
            assertNull(sub);
        }
    }
View Full Code Here

Examples of org.apache.roller.model.PlanetManager

    }
   
   
    public void testRefreshEntries() throws Exception {
       
        PlanetManager planet = RollerFactory.getRoller().getPlanetManager();
       
        String feed_url1 = "http://rollerweblogger.org/rss/roller";
       
        {
            PlanetGroupData group = new PlanetGroupData();
            group.setDescription("test_group_desc");
            group.setHandle("test_handle");
            group.setTitle("test_title");
            planet.saveGroup(group);
           
            PlanetSubscriptionData sub = new PlanetSubscriptionData();
            sub.setFeedUrl(feed_url1);
            planet.saveSubscription(sub);
           
            group.addSubscription(sub);
            planet.saveGroup(group);
            TestUtils.endSession(true);
        }
        {
            planet.refreshEntries();
            TestUtils.endSession(true);
           
            PlanetSubscriptionData sub = planet.getSubscription(feed_url1);
            int entriesSize = sub.getEntries().size();
           
            PlanetGroupData group = planet.getGroup("test_handle");
            assertNotNull(group);
           
            planet.deleteGroup(group);
            planet.deleteSubscription(sub);
            TestUtils.endSession(true);
           
            assertTrue(entriesSize > 0);
        }
    }
View Full Code Here

Examples of org.apache.roller.model.PlanetManager

   
   
    public void testAggregations() throws Exception {
       
        try {
            PlanetManager planet = RollerFactory.getRoller().getPlanetManager();
           
            String feed_url1 = "http://rollerweblogger.org/rss/roller";
            String feed_url2 = "http://linuxintegrators.com/acoliver/?flavor=rss2";
           
            {
                PlanetGroupData group = new PlanetGroupData();
                group.setDescription("test_group_desc");
                group.setHandle("test_handle");
                group.setTitle("test_title");
                planet.saveGroup(group);
               
                PlanetSubscriptionData sub1 = new PlanetSubscriptionData();
                sub1.setFeedUrl(feed_url1);
                planet.saveSubscription(sub1);
               
                PlanetSubscriptionData sub2 = new PlanetSubscriptionData();
                sub2.setFeedUrl(feed_url2);
                planet.saveSubscription(sub2);
               
                group.addSubscription(sub1);
                group.addSubscription(sub2);
                planet.saveGroup(group);
                TestUtils.endSession(true);
            }
            {
                planet.refreshEntries();
                TestUtils.endSession(true);
               
                int count = 0;
                Iterator subs = planet.getAllSubscriptions();
                while  (subs.hasNext()) {
                    PlanetSubscriptionData sub= (PlanetSubscriptionData)subs.next();
                    count += sub.getEntries().size();
                }
                PlanetSubscriptionData sub1 = planet.getSubscription(feed_url1);
                assertTrue(sub1.getEntries().size() > 0);
                PlanetSubscriptionData sub2 = planet.getSubscription(feed_url2);
                assertTrue(sub2.getEntries().size() > 0);
                assertEquals(count, sub1.getEntries().size() + sub2.getEntries().size());
               
                PlanetGroupData group = planet.getGroup("test_handle");
                assertNotNull(group);
               
                List bigag = planet.getAggregation(group, 30);
                assertEquals(30, bigag.size());
               
                List littleag = planet.getAggregation(group, 10);
                assertEquals(10, littleag.size());
               
                planet.deleteGroup(group);
                planet.deleteSubscription(sub1);
                planet.deleteSubscription(sub2);
                TestUtils.endSession(true);
            }
        } catch (Exception e) {
            e.printStackTrace();
            fail();
View Full Code Here

Examples of org.apache.roller.model.PlanetManager

        RollerPropertyData prop =
                (RollerPropertyData)props.get("site.absoluteurl");
        prop.setValue("http://localhost:8080/roller");
        propmgr.saveProperties(props);
       
        PlanetManager planet = getRoller().getPlanetManager();
        PlanetConfigData config = config = new PlanetConfigData();
        config.setCacheDir("");
        config.setTitle("Test");
        config.setAdminEmail("admin@example.com");
        planet.saveConfiguration(config);
       
        PlanetGroupData group = new PlanetGroupData();
        group.setHandle("external");
        group.setTitle("external");
        planet.saveGroup(group);
    }
View Full Code Here

Examples of org.apache.roller.model.PlanetManager

     *
     * @see TestCase#tearDown()
     */
    public void tearDown() throws Exception {
        try {
            PlanetManager planet = getRoller().getPlanetManager();
            PlanetConfigData config = planet.getConfiguration();
            PlanetGroupData group = planet.getGroup("external");
            planet.deleteGroup(group);
           
            deleteWebsite(testUsername);
        } catch (RollerException e) {
            mLogger.error("Tearing down",e);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.