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