HibernateCollectionAdapter extends BasicAdapter { @Override public Feed getFeed() throws Exception { Session session = getSessionFactory().openSession(); String queryName = config.getFeedId() + "-get-feed"; Query query = session.getNamedQuery(queryName); Feed feed = createFeed(); query.setResultTransformer(new AtomEntryResultTransformer( config.getServerConfiguration().getServerUri() + "/" + config.getFeedId(), this.getAbdera(), feed)); query.list(); session.close(); return feed; } HibernateCollectionAdapter(Abdera abdera, FeedConfiguration config); @Override Entry createEntry(Entry entry); @Override boolean deleteEntry(Object entryId); @Override Entry getEntry(Object entryId); @Override Feed getFeed(); @Override Entry updateEntry(Object entryId, Entry entry); static final String HIBERNATE_ANNOTATION_CONFIG; static final String HIBERNATE_CFG_PATH; static final String ENTRY_MAPPING_CLASS_NAME; }
@Test public void testGetFeed() { ClientResponse resp = client.get("http: assertNotNull(resp); assertEquals(ResponseType.SUCCESS, resp.getType()); assertTrue(MimeTypeHelper.isMatch(resp.getContentType().toString(), Constants.ATOM_MEDIA_TYPE)); Document<Feed> doc = resp.getDocument(); Feed feed = doc.getRoot(); assertEquals("http: assertEquals("david", feed.getAuthor().getName()); assertEquals(0, feed.getEntries().size()); resp.release(); }