Package org.apache.roller.planet.business

Examples of org.apache.roller.planet.business.PlanetManager


        }
    }
   
    public void testRefreshEntries() {
        try {     
            PlanetManager planet = PlanetFactory.getPlanet().getPlanetManager();
           
            // run sync task to fill aggregator with websites created by super
            SyncWebsitesTask syncTask = new SyncWebsitesTask();
            syncTask.init();
            syncTask.run();          
           
            RefreshRollerPlanetTask refreshTask = new RefreshRollerPlanetTask();
            refreshTask.run();
           
            Planet planetObject = planet.getPlanet("default");
            PlanetGroup group = planet.getGroup(planetObject, "all");
            List agg = planet.getEntries(group, 0, -1);
            assertEquals(3, agg.size());
        }
        catch (Exception e) {
            e.printStackTrace();
            fail();
View Full Code Here


     * @param len         Max number of results to return
     */
    public List getRankedSubscriptions(String groupHandle, int sinceDays, int length) {
        List list = new ArrayList();
        try {
            PlanetManager planetManager = PlanetFactory.getPlanet().getPlanetManager();
            Planet defaultPlanet = planetManager.getPlanet(DEFAULT_PLANET_HANDLE);
            PlanetGroup planetGroup = planetManager.getGroup(defaultPlanet, groupHandle);
            List subs = planetManager.getTopSubscriptions(planetGroup, 0, length);
            for (Iterator it = subs.iterator(); it.hasNext();) {
                Subscription sub = (Subscription) it.next();
                // TODO needs pojo wrapping from planet
                list.add(sub);
            }
View Full Code Here

    public static Planet setupPlanet(String handle) throws Exception {
       
        Planet testPlanet = new Planet(handle, handle, handle);
       
        // store
        PlanetManager mgr = PlanetFactory.getPlanet().getPlanetManager();
        mgr.savePlanet(testPlanet);
       
        // flush
        PlanetFactory.getPlanet().flush();
       
        // query to make sure we return the persisted object
        Planet planet = mgr.getPlanet(handle);
       
        if(planet == null)
            throw new PlanetException("error inserting new planet");
       
        return planet;
View Full Code Here

     * Convenience method for removing a planet.
     */
    public static void teardownPlanet(String id) throws Exception {
       
        // lookup
        PlanetManager mgr = PlanetFactory.getPlanet().getPlanetManager();
        Planet planet = mgr.getPlanetById(id);
       
        // remove
        mgr.deletePlanet(planet);
       
        // flush
        PlanetFactory.getPlanet().flush();
    }
View Full Code Here

     * Convenience method that creates a group and stores it.
     */
    public static PlanetGroup setupGroup(Planet planet, String handle)
            throws Exception {
       
        PlanetManager mgr = PlanetFactory.getPlanet().getPlanetManager();
       
        // make sure we are using a persistent object
        Planet testPlanet = mgr.getPlanetById(planet.getId());
       
        // store
        PlanetGroup testGroup = new PlanetGroup(testPlanet, handle, handle, handle);
        testPlanet.getGroups().add(testGroup);
        mgr.saveGroup(testGroup);
       
        // flush
        PlanetFactory.getPlanet().flush();
       
        // query to make sure we return the persisted object
        PlanetGroup group = mgr.getGroupById(testGroup.getId());
       
        if(group == null)
            throw new PlanetException("error inserting new group");
       
        return group;
View Full Code Here

     * Convenience method for removing a group.
     */
    public static void teardownGroup(String id) throws Exception {
       
        // lookup
        PlanetManager mgr = PlanetFactory.getPlanet().getPlanetManager();
        PlanetGroup group = mgr.getGroupById(id);
       
        // remove
        mgr.deleteGroup(group);
        group.getPlanet().getGroups().remove(group);
       
        // flush
        PlanetFactory.getPlanet().flush();
    }
View Full Code Here

     * Convenience method that creates a sub and stores it.
     */
    public static Subscription setupSubscription(String feedUrl)
            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

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

     * Convenience method that creates an entry and stores it.
     */
    public static SubscriptionEntry setupEntry(Subscription sub, String title)
            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();
       
        // query to make sure we return the persisted object
        SubscriptionEntry entry = mgr.getEntryById(testEntry.getId());
       
        if(entry == null)
            throw new PlanetException("error inserting new entry");
       
        return entry;
View Full Code Here

     * Convenience method for removing an entry.
     */
    public static void teardownEntry(String id) throws Exception {
       
        // lookup
        PlanetManager mgr = PlanetFactory.getPlanet().getPlanetManager();
        SubscriptionEntry entry = mgr.getEntryById(id);
       
        // remove
        mgr.deleteEntry(entry);
        entry.getSubscription().getEntries().remove(entry);
       
        // flush
        PlanetFactory.getPlanet().flush();
    }
View Full Code Here

TOP

Related Classes of org.apache.roller.planet.business.PlanetManager

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.