use of org.jboss.resteasy.plugins.providers.atom.Feed in project candlepin by candlepin.
the class EventAdapterTest method emptyList.
@Test
public void emptyList() {
EventAdapter ea = new EventAdapterImpl(new ConfigForTesting(), i18n);
Feed f = ea.toFeed(new LinkedList<>(), "/some/path");
assertNotNull(f);
assertNotNull(f.getEntries());
assertTrue(f.getEntries().isEmpty());
}
use of org.jboss.resteasy.plugins.providers.atom.Feed in project candlepin by candlepin.
the class AtomFeedResourceTest method getEmptyFeed.
@Test
public void getEmptyFeed() {
CandlepinQuery cqmock = mock(CandlepinQuery.class);
when(cqmock.list()).thenReturn(new ArrayList<Event>());
when(ec.listMostRecent(eq(1000))).thenReturn(cqmock);
Feed f = afr.getFeed();
assertNotNull(f);
assertTrue(f.getEntries().isEmpty());
}
use of org.jboss.resteasy.plugins.providers.atom.Feed in project candlepin by candlepin.
the class ConsumerResource method getConsumerAtomFeed.
@ApiOperation(notes = "Retrieves and Event Atom Feed for a Consumer", value = "getConsumerAtomFeed")
@ApiResponses({ @ApiResponse(code = 404, message = "") })
@GET
@Produces("application/atom+xml")
@Path("/{consumer_uuid}/atom")
public Feed getConsumerAtomFeed(@PathParam("consumer_uuid") @Verify(Consumer.class) String consumerUuid) {
String path = String.format("/consumers/%s/atom", consumerUuid);
Consumer consumer = consumerCurator.verifyAndLookupConsumer(consumerUuid);
Feed feed = this.eventAdapter.toFeed(this.eventCurator.listMostRecent(FEED_LIMIT, consumer).list(), path);
feed.setTitle("Event feed for consumer " + consumer.getUuid());
return feed;
}
use of org.jboss.resteasy.plugins.providers.atom.Feed in project candlepin by candlepin.
the class OwnerResource method getOwnerAtomFeed.
/**
* Retrieves an Event
*
* @return a Feed object
* @httpcode 404
* @httpcode 200
*/
@GET
@Produces("application/atom+xml")
@Path("{owner_key}/atom")
@ApiOperation(notes = "Retrieves an Event Atom Feed for an owner", value = "Get Atom Feed")
@ApiResponses({ @ApiResponse(code = 404, message = "Owner not found") })
public Feed getOwnerAtomFeed(@PathParam("owner_key") @Verify(Owner.class) String ownerKey) {
Owner o = findOwnerByKey(ownerKey);
String path = String.format("/owners/%s/atom", ownerKey);
Feed feed = this.eventAdapter.toFeed(this.eventCurator.listMostRecent(FEED_LIMIT, o).list(), path);
feed.setTitle("Event feed for owner " + o.getDisplayName());
return feed;
}
use of org.jboss.resteasy.plugins.providers.atom.Feed in project candlepin by candlepin.
the class AtomFeedResource method getFeed.
@ApiOperation(notes = "Retrieves an Event Atom Feed", value = "getFeed")
@GET
@Produces({ "application/atom+xml", MediaType.APPLICATION_JSON })
public Feed getFeed() {
List<Event> events = eventCurator.listMostRecent(ATOM_FEED_LIMIT).list();
Feed feed = this.adapter.toFeed(events, "/atom");
feed.setTitle("Event Feed");
return feed;
}
Aggregations