Package org.apache.roller.model

Examples of org.apache.roller.model.AutoPingManager


        Criteria criteria = session.createCriteria(PingQueueEntryData.class);
        criteria.add(Expression.eq("pingTarget", ping));
        List queueEntries = criteria.list();
       
        // Remove the website's auto ping configurations
        AutoPingManager autoPingMgr = RollerFactory.getRoller().getAutopingManager();
        List autopings = autoPingMgr.getAutoPingsByTarget(ping);
        Iterator it = autopings.iterator();
        while(it.hasNext()) {
            this.strategy.remove((AutoPingData) it.next());
        }
    }
View Full Code Here


        Criteria criteria = session.createCriteria(PingQueueEntryData.class);
        criteria.add(Expression.eq("website", website));
        List queueEntries = criteria.list();
       
        // Remove the website's auto ping configurations
        AutoPingManager autoPingMgr = RollerFactory.getRoller().getAutopingManager();
        List autopings = autoPingMgr.getAutoPingsByWebsite(website);
        Iterator it = autopings.iterator();
        while(it.hasNext()) {
            this.strategy.remove((AutoPingData) it.next());
        }
       
View Full Code Here

     * Convenience method for creating an auto ping.
     */
    public static AutoPingData setupAutoPing(PingTargetData ping, WebsiteData weblog)
            throws Exception {
       
        AutoPingManager mgr = RollerFactory.getRoller().getAutopingManager();
       
        // store auto ping
        AutoPingData autoPing = new AutoPingData(null, ping, weblog);
        mgr.saveAutoPing(autoPing);
       
        // query for it
        autoPing = mgr.getAutoPing(autoPing.getId());
       
        if(autoPing == null)
            throw new RollerException("error setting up auto ping");
       
        return autoPing;
View Full Code Here

     * Convenience method for removing an auto ping.
     */
    public static void teardownAutoPing(String id) throws Exception {
       
        // query for it
        AutoPingManager mgr = RollerFactory.getRoller().getAutopingManager();
        AutoPingData autoPing = mgr.getAutoPing(id);
       
        // remove the auto ping
        mgr.removeAutoPing(autoPing);
    }
View Full Code Here

     * based on whether the ping target is enabled (has a corresponding auto ping configuration).
     */
    private Map buildIsEnabledMap(RollerRequest rreq, List commonPingTargets, List customPingTargets)
        throws RollerException
    {
        AutoPingManager autoPingMgr = RollerFactory.getRoller().getAutopingManager();
        WebsiteData website = rreq.getWebsite();

        // Build isEnabled map (keyed by ping target id and values Boolean.TRUE/Boolean.FALSE)
        Map isEnabled = new HashMap();
        List autopings = autoPingMgr.getAutoPingsByWebsite(website);
        // Add the enabled auto ping configs with TRUE
        for (Iterator i = autopings.iterator(); i.hasNext();)
        {
            AutoPingData autoPing = (AutoPingData) i.next();
            isEnabled.put(autoPing.getPingTarget().getId(), Boolean.TRUE);
View Full Code Here

    public ActionForward enableSelected(ActionMapping mapping, ActionForm form,
                                        HttpServletRequest req, HttpServletResponse res)
        throws Exception
    {
        RollerRequest rreq = RollerRequest.getRollerRequest(req);
        AutoPingManager autoPingMgr = RollerFactory.getRoller().getAutopingManager();
        PingTargetData pingTarget = select(rreq);
        try
        {
            if (!isAuthorized(rreq, rreq.getWebsite()))
            {
                return mapping.findForward("access-denied");
            }
            AutoPingData autoPing = new AutoPingData(null, pingTarget, rreq.getWebsite());
            autoPingMgr.saveAutoPing(autoPing);
            RollerFactory.getRoller().flush();

            return view(mapping, form, req, res);
        }
        catch (Exception e)
View Full Code Here

    public ActionForward disableSelected(ActionMapping mapping, ActionForm form,
                                         HttpServletRequest req, HttpServletResponse res)
        throws Exception
    {
        RollerRequest rreq = RollerRequest.getRollerRequest(req);
        AutoPingManager autoPingMgr = RollerFactory.getRoller().getAutopingManager();
        PingTargetData pingTarget = select(rreq);
        try
        {
            if (!isAuthorized(rreq, rreq.getWebsite()))
            {
                return mapping.findForward("access-denied");
            }
            autoPingMgr.removeAutoPing(pingTarget, rreq.getWebsite());
            RollerFactory.getRoller().flush();
       
            return view(mapping, form, req, res);
        }
        catch (Exception e)
View Full Code Here

    /**
     * Test basic persistence operations ... Create, Update, Delete
     */
    public void testAutoPingCRUD() throws Exception {
       
        AutoPingManager mgr = RollerFactory.getRoller().getAutopingManager();
        AutoPingData autoPing = null;
       
        // create ping target to use for tests
        PingTargetData pingTarget = TestUtils.setupPingTarget("fooPing", "http://foo/null");
        PingTargetData pingTarget2 = TestUtils.setupPingTarget("blahPing", "http://blah/null");
        TestUtils.endSession(true);
       
        // create autoPing
        autoPing = new AutoPingData(null, pingTarget, testWeblog);
        mgr.saveAutoPing(autoPing);
        String id = autoPing.getId();
        TestUtils.endSession(true);
       
        // make sure autoPing was stored
        autoPing = null;
        autoPing = mgr.getAutoPing(id);
        assertNotNull(autoPing);
        assertEquals(pingTarget, autoPing.getPingTarget());
       
        // update autoPing
        autoPing.setPingTarget(pingTarget2);
        mgr.saveAutoPing(autoPing);
        TestUtils.endSession(true);
       
        // make sure autoPing was updated
        autoPing = null;
        autoPing = mgr.getAutoPing(id);
        assertNotNull(autoPing);
        assertEquals(pingTarget2, autoPing.getPingTarget());
       
        // delete autoPing
        mgr.removeAutoPing(autoPing);
        TestUtils.endSession(true);
       
        // make sure common autoPing was deleted
        autoPing = null;
        autoPing = mgr.getAutoPing(id);
        assertNull(autoPing);
       
        // teardown test ping target
        TestUtils.teardownPingTarget(pingTarget.getId());
        TestUtils.teardownPingTarget(pingTarget2.getId());
View Full Code Here

    /**
     * Test special ping target removal methods ... by weblog/target, collection, all
     */
    public void testPingTargetRemovals() throws Exception {
       
        AutoPingManager mgr = RollerFactory.getRoller().getAutopingManager();
        AutoPingData testAutoPing = null;
       
        // create ping target to use for tests
        PingTargetData pingTarget = TestUtils.setupPingTarget("fooPing", "http://foo/null");
        PingTargetData pingTarget2 = TestUtils.setupPingTarget("blahPing", "http://blah/null");
        PingTargetData pingTarget3 = TestUtils.setupPingTarget("gahPing", "http://gah/null");
       
        // create auto pings for test
        AutoPingData autoPing = TestUtils.setupAutoPing(pingTarget, testWeblog);
        AutoPingData autoPing2 = TestUtils.setupAutoPing(pingTarget2, testWeblog);
        AutoPingData autoPing3 = TestUtils.setupAutoPing(pingTarget3, testWeblog);
        TestUtils.endSession(true);
       
        // remove by weblog/target
        mgr.removeAutoPing(pingTarget, testWeblog);
        TestUtils.endSession(true);
       
        // make sure remove succeeded
        testAutoPing = null;
        testAutoPing = mgr.getAutoPing(autoPing.getId());
        assertNull(testAutoPing);
       
        // remove a collection
        List autoPings = new ArrayList();
        autoPings.add(autoPing2);
        autoPings.add(autoPing3);
        mgr.removeAutoPings(autoPings);
        TestUtils.endSession(true);
       
        // make sure delete was successful
        autoPings = mgr.getAutoPingsByWebsite(testWeblog);
        assertNotNull(autoPings);
        assertEquals(0, autoPings.size());
       
        // need to create more test pings
        autoPing = TestUtils.setupAutoPing(pingTarget, testWeblog);
        autoPing2 = TestUtils.setupAutoPing(pingTarget2, testWeblog);
        autoPing3 = TestUtils.setupAutoPing(pingTarget3, testWeblog);
        TestUtils.endSession(true);
       
        // remove all
        mgr.removeAllAutoPings();
        TestUtils.endSession(true);
       
        // make sure remove succeeded
        autoPings = mgr.getAutoPingsByWebsite(testWeblog);
        assertNotNull(autoPings);
        assertEquals(0, autoPings.size());
       
        // teardown test ping target
        TestUtils.teardownPingTarget(pingTarget.getId());
View Full Code Here

    /**
     * Test lookup mechanisms ... id, ping target, weblog
     */
    public void testAutoPingLookups() throws Exception {
       
        AutoPingManager mgr = RollerFactory.getRoller().getAutopingManager();
        AutoPingData autoPing = null;
       
        // create autoPing target to use for tests
        PingTargetData pingTarget = TestUtils.setupPingTarget("fooPing", "http://foo/null");
        TestUtils.endSession(true);
       
        // create autoPing
        autoPing = new AutoPingData(null, pingTarget, testWeblog);
        mgr.saveAutoPing(autoPing);
        String id = autoPing.getId();
        TestUtils.endSession(true);
       
        // lookup by id
        autoPing = null;
        autoPing = mgr.getAutoPing(id);
        assertNotNull(autoPing);
        assertEquals(pingTarget, autoPing.getPingTarget());
       
        // lookup by ping target
        List autoPings = mgr.getAutoPingsByTarget(pingTarget);
        assertNotNull(autoPings);
        assertEquals(1, autoPings.size());
       
        // lookup by weblog
        autoPings = null;
        autoPings = mgr.getAutoPingsByWebsite(testWeblog);
        assertNotNull(autoPing);
        assertEquals(1, autoPings.size());
       
        // delete autoPing
        mgr.removeAutoPing(autoPing);
        TestUtils.endSession(true);
       
        // teardown test ping target
        TestUtils.teardownPingTarget(pingTarget.getId());
        TestUtils.endSession(true);
View Full Code Here

TOP

Related Classes of org.apache.roller.model.AutoPingManager

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.