Package org.apache.roller.weblogger.pojos

Examples of org.apache.roller.weblogger.pojos.AutoPing


     */
    public String enable() {
       
        if(getPingTarget() != null) try {
            AutoPingManager autoPingMgr = WebloggerFactory.getWeblogger().getAutopingManager();
            AutoPing autoPing = new AutoPing(null, getPingTarget(), getActionWeblog());
            autoPingMgr.saveAutoPing(autoPing);
            WebloggerFactory.getWeblogger().flush();
        } catch(Exception ex) {
            log.error("Error saving auto ping for target - "+getPingTargetId(), ex);
            // TODO: i18n
View Full Code Here


            log.error("Error looking up auto pings for weblog - "+getActionWeblog().getHandle(), ex);
        }
       
        // Add the enabled auto ping configs with TRUE
        for (Iterator i = autopings.iterator(); i.hasNext();) {
            AutoPing autoPing = (AutoPing) i.next();
            isEnabled.put(autoPing.getPingTarget().getId(), Boolean.TRUE);
        }
       
        // Somewhat awkward, but the two loops save building a separate combined list.
        // Add disabled common ones with FALSE
        for (Iterator i = getCommonPingTargets().iterator(); i.hasNext();) {
View Full Code Here

            throws Exception {
       
        AutoPingManager mgr = WebloggerFactory.getWeblogger().getAutopingManager();
       
        // store auto ping
        AutoPing autoPing = new AutoPing(null, ping, getManagedWebsite(weblog) );
        mgr.saveAutoPing(autoPing);
       
        // flush to db
        WebloggerFactory.getWeblogger().flush();
       
        // query for it
        autoPing = mgr.getAutoPing(autoPing.getId());
       
        if(autoPing == null)
            throw new WebloggerException("error setting up auto ping");
       
        return autoPing;
View Full Code Here

     */
    public static void teardownAutoPing(String id) throws Exception {
       
        // query for it
        AutoPingManager mgr = WebloggerFactory.getWeblogger().getAutopingManager();
        AutoPing autoPing = mgr.getAutoPing(id);
       
        // remove the auto ping
        mgr.removeAutoPing(autoPing);
       
        // flush to db
View Full Code Here

        }

        PingQueueManager pingQueueMgr = roller.getPingQueueManager();
        List applicableAutopings = getApplicableAutoPings(changedWeblogEntry);
        for (Iterator i = applicableAutopings.iterator(); i.hasNext();) {
            AutoPing autoPing = (AutoPing) i.next();
            pingQueueMgr.addQueueEntry(autoPing);
        }
    }
View Full Code Here

     * Test basic persistence operations ... Create, Update, Delete
     */
    public void testAutoPingCRUD() throws Exception {
       
        AutoPingManager mgr = WebloggerFactory.getWeblogger().getAutopingManager();
        AutoPing autoPing = null;
       
        // create ping target to use for tests
        PingTarget pingTarget = TestUtils.setupPingTarget("fooPing", "http://foo/null");
        PingTarget pingTarget2 = TestUtils.setupPingTarget("blahPing", "http://blah/null");
        TestUtils.endSession(true);
       
        // create autoPing
        autoPing = new AutoPing(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);
       
View Full Code Here

     */
    public void testPingTargetRemovals() throws Exception {
       
        AutoPingManager mgr = WebloggerFactory.getWeblogger().getAutopingManager();
        PingTargetManager ptmgr = WebloggerFactory.getWeblogger().getPingTargetManager();
        AutoPing testAutoPing = null;
       
        // create ping target to use for tests
        PingTarget pingTarget = TestUtils.setupPingTarget("fooPing", "http://foo/null");
        PingTarget pingTarget2 = TestUtils.setupPingTarget("blahPing", "http://blah/null");
        PingTarget pingTarget3 = TestUtils.setupPingTarget("gahPing", "http://gah/null");
       
        try {
       
            // create auto pings for test
            testWeblog = TestUtils.getManagedWebsite(testWeblog);
            AutoPing autoPing = TestUtils.setupAutoPing(pingTarget, testWeblog);
            AutoPing autoPing2 = TestUtils.setupAutoPing(pingTarget2, testWeblog);
            AutoPing autoPing3 = TestUtils.setupAutoPing(pingTarget3, testWeblog);
            TestUtils.endSession(true);

            // remove by weblog/target
            testWeblog = TestUtils.getManagedWebsite(testWeblog);
            pingTarget = ptmgr.getPingTarget(pingTarget.getId());
            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();
            autoPing2 = mgr.getAutoPing(autoPing2.getId()); //Get managed version of autoPing2
            autoPings.add(autoPing2);
            autoPing3 = mgr.getAutoPing(autoPing3.getId()); //Get managed version of autoPing2
            autoPings.add(autoPing3);
            mgr.removeAutoPings(autoPings);
            TestUtils.endSession(true);

            // make sure delete was successful
View Full Code Here

     */
    public void testAutoPingLookups() throws Exception {
       
        AutoPingManager mgr = WebloggerFactory.getWeblogger().getAutopingManager();
        PingTargetManager ptmgr = WebloggerFactory.getWeblogger().getPingTargetManager();
        AutoPing autoPing = null;
       
        // create autoPing target to use for tests
        PingTarget pingTarget = TestUtils.setupPingTarget("fooPing", "http://foo/null");
        TestUtils.endSession(true);
       
        // create autoPing
        testWeblog = TestUtils.getManagedWebsite(testWeblog);
        pingTarget = ptmgr.getPingTarget(pingTarget.getId());
        autoPing = new AutoPing(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
        pingTarget = ptmgr.getPingTarget(pingTarget.getId());
        List autoPings = mgr.getAutoPingsByTarget(pingTarget);
        assertNotNull(autoPings);
        assertEquals(1, autoPings.size());
       
        // lookup by weblog
        autoPings = null;
        testWeblog = TestUtils.getManagedWebsite(testWeblog);
        autoPings = mgr.getAutoPingsByWebsite(testWeblog);
        assertNotNull(autoPing);
        assertEquals(1, autoPings.size());
       
        // delete autoPing
        autoPing = mgr.getAutoPing(autoPing.getId());
        mgr.removeAutoPing(autoPing);
        TestUtils.endSession(true);
       
        // teardown test ping target
        TestUtils.teardownPingTarget(pingTarget.getId());
View Full Code Here

            throws Exception {
       
        AutoPingManager mgr = WebloggerFactory.getWeblogger().getAutopingManager();
       
        // store auto ping
        AutoPing autoPing = new AutoPing(null, ping, getManagedWebsite(weblog) );
        mgr.saveAutoPing(autoPing);
       
        // flush to db
        WebloggerFactory.getWeblogger().flush();
       
        // query for it
        autoPing = mgr.getAutoPing(autoPing.getId());
       
        if(autoPing == null)
            throw new WebloggerException("error setting up auto ping");
       
        return autoPing;
View Full Code Here

     */
    public static void teardownAutoPing(String id) throws Exception {
       
        // query for it
        AutoPingManager mgr = WebloggerFactory.getWeblogger().getAutopingManager();
        AutoPing autoPing = mgr.getAutoPing(id);
       
        // remove the auto ping
        mgr.removeAutoPing(autoPing);
       
        // flush to db
View Full Code Here

TOP

Related Classes of org.apache.roller.weblogger.pojos.AutoPing

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.