Examples of PingTargetManager


Examples of org.apache.roller.weblogger.business.pings.PingTargetManager

    /**
     * Test basic persistence operations ... Create, Update, Delete
     */
    public void testPingTargetCRUD() throws Exception {
       
        PingTargetManager mgr = WebloggerFactory.getWeblogger().getPingTargetManager();
        PingTarget 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(TestUtils.getManagedWebsite(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);
        TestUtils.endSession(true);
       
        // make sure common ping was deleted
        ping = null;
        ping = mgr.getPingTarget(commonId);
        assertNull(ping);
       
        // delete custom ping
        ping = null;
        ping = mgr.getPingTarget(customId);
        mgr.removePingTarget(ping);
        TestUtils.endSession(true);
       
        // make sure custom ping was deleted
        ping = null;
        ping = mgr.getPingTarget(customId);
        assertNull(ping);
    }
View Full Code Here

Examples of org.apache.roller.weblogger.business.pings.PingTargetManager

    /**
     * Test lookup mechanisms ... id, all common, all custom for weblog
     */
    public void testPingTargetLookups() throws Exception {
       
        PingTargetManager mgr = WebloggerFactory.getWeblogger().getPingTargetManager();
        PingTarget ping = null;
       
        // create common ping
        mgr.savePingTarget(testCommonPing);
        String commonId = testCommonPing.getId();
        TestUtils.endSession(true);
       
        // create custom ping
        testWeblog = TestUtils.getManagedWebsite(testWeblog);
        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);
        // correct answer is: 6 pings in config + 1 new one = 7
        assertEquals(7, commonPings.size());
       
        // lookup all custom pings for weblog
        testWeblog = TestUtils.getManagedWebsite(testWeblog);
        List customPings = mgr.getCustomPingTargets(testWeblog);
        assertNotNull(customPings);
        assertEquals(1, customPings.size());
       
        // delete common ping
        ping = null;
        ping = mgr.getPingTarget(commonId);
        mgr.removePingTarget(ping);
        TestUtils.endSession(true);
       
        // delete custom ping
        ping = null;
        ping = mgr.getPingTarget(customId);
        mgr.removePingTarget(ping);
        TestUtils.endSession(true);
    }
View Full Code Here

Examples of org.apache.roller.weblogger.business.pings.PingTargetManager

     * Test special ping target removal methods ... by weblog/target, collection, all
     */
    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;
View Full Code Here

Examples of org.apache.roller.weblogger.business.pings.PingTargetManager

     * Test lookup mechanisms ... id, ping target, weblog
     */
    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
View Full Code Here

Examples of org.apache.roller.weblogger.business.pings.PingTargetManager

        PingTarget testPing = new PingTarget();
        testPing.setName("testCommonPing");
        testPing.setPingUrl("http://localhost/testCommonPing");
       
        // store ping
        PingTargetManager pingMgr = WebloggerFactory.getWeblogger().getPingTargetManager();
        pingMgr.savePingTarget(testPing);
       
        // flush to db
        WebloggerFactory.getWeblogger().flush();
       
        // query for it
        PingTarget ping = pingMgr.getPingTarget(testPing.getId());
       
        if(ping == null)
            throw new WebloggerException("error setting up ping target");
       
        return ping;
View Full Code Here

Examples of org.apache.roller.weblogger.business.pings.PingTargetManager

     * Convenience method for removing a ping target.
     */
    public static void teardownPingTarget(String id) throws Exception {
       
        // query for it
        PingTargetManager pingMgr = WebloggerFactory.getWeblogger().getPingTargetManager();
        PingTarget ping = pingMgr.getPingTarget(id);
       
        // remove the ping
        pingMgr.removePingTarget(ping);
       
        // flush to db
        WebloggerFactory.getWeblogger().flush();
    }
View Full Code Here

Examples of org.apache.roller.weblogger.business.pings.PingTargetManager

    /**
     * Test basic persistence operations ... Create, Update, Delete
     */
    public void testPingTargetCRUD() throws Exception {
       
        PingTargetManager mgr = WebloggerFactory.getWeblogger().getPingTargetManager();
        PingTarget 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(TestUtils.getManagedWebsite(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);
        TestUtils.endSession(true);
       
        // make sure common ping was deleted
        ping = null;
        ping = mgr.getPingTarget(commonId);
        assertNull(ping);
       
        // delete custom ping
        ping = null;
        ping = mgr.getPingTarget(customId);
        mgr.removePingTarget(ping);
        TestUtils.endSession(true);
       
        // make sure custom ping was deleted
        ping = null;
        ping = mgr.getPingTarget(customId);
        assertNull(ping);
    }
View Full Code Here

Examples of org.apache.roller.weblogger.business.pings.PingTargetManager

    /**
     * Test lookup mechanisms ... id, all common, all custom for weblog
     */
    public void testPingTargetLookups() throws Exception {
       
        PingTargetManager mgr = WebloggerFactory.getWeblogger().getPingTargetManager();
        PingTarget ping = null;
       
        // create common ping
        mgr.savePingTarget(testCommonPing);
        String commonId = testCommonPing.getId();
        TestUtils.endSession(true);
       
        // create custom ping
        testWeblog = TestUtils.getManagedWebsite(testWeblog);
        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);
        // correct answer is: 6 pings in config + 1 new one = 7
        assertEquals(7, commonPings.size());
       
        // lookup all custom pings for weblog
        testWeblog = TestUtils.getManagedWebsite(testWeblog);
        List customPings = mgr.getCustomPingTargets(testWeblog);
        assertNotNull(customPings);
        assertEquals(1, customPings.size());
       
        // delete common ping
        ping = null;
        ping = mgr.getPingTarget(commonId);
        mgr.removePingTarget(ping);
        TestUtils.endSession(true);
       
        // delete custom ping
        ping = null;
        ping = mgr.getPingTarget(customId);
        mgr.removePingTarget(ping);
        TestUtils.endSession(true);
    }
View Full Code Here

Examples of org.apache.roller.weblogger.business.pings.PingTargetManager

     * Test basic persistence operations ... Create, Update, Delete
     */
    public void testAutoPingCRUD() throws Exception {
       
        AutoPingManager mgr = WebloggerFactory.getWeblogger().getAutopingManager();
        PingTargetManager pingMgr = WebloggerFactory.getWeblogger().getPingTargetManager();
        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(pingMgr.getPingTarget(pingTarget2.getId()));
        mgr.saveAutoPing(autoPing);
        TestUtils.endSession(true);
       
        // make sure autoPing was updated
        autoPing = null;
View Full Code Here

Examples of org.apache.roller.weblogger.business.pings.PingTargetManager

     * Test special ping target removal methods ... by weblog/target, collection, all
     */
    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;
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.