Examples of PingTargetData


Examples of org.apache.roller.pojos.PingTargetData

     * Test basic persistence operations ... Create, Update, Delete
     */
    public void testPingTargetCRUD() throws Exception {
       
        PingTargetManager mgr = RollerFactory.getRoller().getPingTargetManager();
        PingTargetData ping = null;
       
        // create common ping
        mgr.savePingTarget(testCommonPing);
        String commonId = testCommonPing.getId();
        TestUtils.endSession(true);
       
        // make sure common ping was stored
        ping = null;
        ping = mgr.getPingTarget(commonId);
        assertNotNull(ping);
        assertEquals(testCommonPing.getPingUrl(), ping.getPingUrl());
       
        // create custom ping
        testCustomPing.setWebsite(testWeblog);
        mgr.savePingTarget(testCustomPing);
        String customId = testCustomPing.getId();
        TestUtils.endSession(true);
       
        // make sure custom ping was stored
        ping = null;
        ping = mgr.getPingTarget(customId);
        assertNotNull(ping);
        assertEquals(testCustomPing.getPingUrl(), ping.getPingUrl());
       
        // update common ping
        ping = null;
        ping = mgr.getPingTarget(commonId);
        ping.setName("testtestCommon");
        mgr.savePingTarget(ping);
        TestUtils.endSession(true);
       
        // make sure common ping was updated
        ping = null;
        ping = mgr.getPingTarget(commonId);
        assertNotNull(ping);
        assertEquals("testtestCommon", ping.getName());
       
        // update custom ping
        ping = null;
        ping = mgr.getPingTarget(customId);
        ping.setName("testtestCustom");
        mgr.savePingTarget(ping);
        TestUtils.endSession(true);
       
        // make sure custom ping was updated
        ping = null;
        ping = mgr.getPingTarget(customId);
        assertNotNull(ping);
        assertEquals("testtestCustom", ping.getName());
       
        // delete common ping
        ping = null;
        ping = mgr.getPingTarget(commonId);
        mgr.removePingTarget(ping);
View Full Code Here

Examples of org.apache.roller.pojos.PingTargetData

     * Test lookup mechanisms ... id, all common, all custom for weblog
     */
    public void testPingTargetLookups() throws Exception {
       
        PingTargetManager mgr = RollerFactory.getRoller().getPingTargetManager();
        PingTargetData ping = null;
       
        // create common ping
        mgr.savePingTarget(testCommonPing);
        String commonId = testCommonPing.getId();
        TestUtils.endSession(true);
       
        // create custom ping
        testCustomPing.setWebsite(testWeblog);
        mgr.savePingTarget(testCustomPing);
        String customId = testCustomPing.getId();
        TestUtils.endSession(true);
       
        // lookup by id
        ping = null;
        ping = mgr.getPingTarget(commonId);
        assertNotNull(ping);
        assertEquals(testCommonPing.getName(), ping.getName());
       
        // lookup all common pings
        List commonPings = mgr.getCommonPingTargets();
        assertNotNull(commonPings);
        assertEquals(1, commonPings.size());
View Full Code Here

Examples of org.apache.roller.pojos.PingTargetData

       
        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());
        TestUtils.endSession(true);
    }
View Full Code Here

Examples of org.apache.roller.pojos.PingTargetData

       
        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);
View Full Code Here

Examples of org.apache.roller.pojos.PingTargetData

       
        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

Examples of org.apache.roller.pojos.PingTargetData

        // add any auto enabled ping targets
        PingTargetManager pingTargetMgr = RollerFactory.getRoller().getPingTargetManager();
        AutoPingManager autoPingMgr = RollerFactory.getRoller().getAutopingManager();
       
        Iterator pingTargets = pingTargetMgr.getCommonPingTargets().iterator();
        PingTargetData pingTarget = null;
        while(pingTargets.hasNext()) {
            pingTarget = (PingTargetData) pingTargets.next();
           
            if(pingTarget.isAutoEnabled()) {
                AutoPingData autoPing = new AutoPingData(null, pingTarget, newWeblog);
                autoPingMgr.saveAutoPing(autoPing);
            }
        }
    }
View Full Code Here

Examples of org.apache.roller.pojos.PingTargetData

            Matcher m = NESTED_BRACE_PAIR.matcher(thisTarget);
            if (m.matches() && m.groupCount() == 2) {
                String name = m.group(1).trim();
                String url = m.group(2).trim();
                logger.info("Creating common ping target '" + name + "' from configuration properties.");
                PingTargetData pingTarget = new PingTargetData(null, name, url, null, false);
                pingTargetMgr.savePingTarget(pingTarget);
            } else {
                logger.error("Unable to parse configured initial ping target '" + thisTarget + "'. Skipping this target. Check your setting of the property " + PINGS_INITIAL_COMMON_TARGETS_PROP);
            }
        }
View Full Code Here

Examples of org.apache.roller.pojos.PingTargetData

    /*
     * Create a new ping target (blank). Here we create a custom ping target for the website.
     */
    protected PingTargetData createPingTarget(RollerRequest rreq, PingTargetForm pingTargetForm) throws RollerException {
        return new PingTargetData(null, pingTargetForm.getName(), pingTargetForm.getPingUrl(), rreq.getWebsite(), false);
    }
View Full Code Here

Examples of org.apache.roller.pojos.PingTargetData

    /*
    * Set a ping target auto enabled to true.
    */
    public ActionForward enableSelected(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res) throws Exception {
        RollerRequest rreq = RollerRequest.getRollerRequest(req);
        PingTargetData pingTarget = select(rreq);
        try {
            if (!hasRequiredRights(rreq, rreq.getWebsite())) {
                return mapping.findForward("access-denied");
            }
            pingTarget.setAutoEnabled(true);
            RollerFactory.getRoller().flush();

            return view(mapping, form, req, res);
        } catch (Exception e) {
            mLogger.error("ERROR in action", e);
View Full Code Here

Examples of org.apache.roller.pojos.PingTargetData

    /*
     * Set a pint target auto enabled to false.
     */
    public ActionForward disableSelected(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res) throws Exception {
        RollerRequest rreq = RollerRequest.getRollerRequest(req);
        PingTargetData pingTarget = select(rreq);
        try {
            if (!hasRequiredRights(rreq, rreq.getWebsite())) {
                return mapping.findForward("access-denied");
            }
            pingTarget.setAutoEnabled(false);
            RollerFactory.getRoller().flush();

            return view(mapping, form, req, res);
        } catch (Exception e) {
            mLogger.error("ERROR in action", 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.