/**
* Test basic persistence operations ... Create, Update, Delete
*/
public void testRefererCRUD() throws Exception {
RefererManager mgr = WebloggerFactory.getWeblogger().getRefererManager();
WeblogReferrer referer = null;
testWeblog = TestUtils.getManagedWebsite(testWeblog);
WeblogReferrer testReferer = new WeblogReferrer();
testReferer.setWebsite(testWeblog);
testReferer.setDateString("20060420");
testReferer.setRefererUrl("blah");
testReferer.setRefererPermalink("blah");
testReferer.setRequestUrl("foo");
testReferer.setTitle("lksdjf");
testReferer.setTotalHits(new Integer(3));
testReferer.setDayHits(new Integer(2));
testReferer.setVisible(Boolean.TRUE);
testReferer.setDuplicate(Boolean.FALSE);
testReferer.setExcerpt("");
// save referer
mgr.saveReferer(testReferer);
String id = testReferer.getId();
TestUtils.endSession(true);
// check that create was successful
referer = null;
referer = mgr.getReferer(id);
assertNotNull(referer);
assertEquals(testReferer, referer);
// update referer
referer.setTitle("testtesttest");
mgr.saveReferer(referer);
TestUtils.endSession(true);
// check that update was successful
referer = null;
referer = mgr.getReferer(id);
assertNotNull(referer);
assertEquals("testtesttest", referer.getTitle());
// delete referer
mgr.removeReferer(referer);
TestUtils.endSession(true);
// check that delete was successful
referer = null;
referer = mgr.getReferer(id);
assertNull(referer);
}