*/
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