Esempio n. 1
0
 @Test
 public void shouldGetFeedWhenOffsetMarkerIsSet() throws Exception {
   generateData(66, null);
   markerService.markEvents(new String[] {"Cat-0", "Cat-1", ""}, 20);
   Assert.assertEquals(5, feedGenerator.getFeedForId(1, "Cat-0").getEvents().size());
   Assert.assertEquals(5, feedGenerator.getFeedForId(2, "Cat-0").getEvents().size());
   Assert.assertEquals(3, feedGenerator.getFeedForId(7, "Cat-0").getEvents().size());
   Assert.assertEquals(5, feedGenerator.getFeedForId(1, "Cat-1").getEvents().size());
   Assert.assertEquals(5, feedGenerator.getFeedForId(2, "Cat-1").getEvents().size());
   Assert.assertEquals(3, feedGenerator.getFeedForId(7, "Cat-1").getEvents().size());
 }
Esempio n. 2
0
 @Test
 public void shouldGetFeedWithMultipleChunkingHistoriesWithMarkers() throws Exception {
   generateData(48, "Cat-1");
   markerService.markEvents(new String[] {"Cat-1", ""}, 20);
   Assert.assertEquals(5, feedGenerator.getFeedForId(1, "Cat-1").getEvents().size());
   Assert.assertEquals(5, feedGenerator.getFeedForId(9, "Cat-1").getEvents().size());
   Assert.assertEquals(3, feedGenerator.getRecentFeed("Cat-1").getEvents().size());
   addChunkingHistory(9, 49);
   FeedGenerator newFeedGenerator =
       new NumberFeedGenerator(allEventRecords, allEventRecordsOffsetMarkers, chunkingEntries);
   Assert.assertEquals(3, newFeedGenerator.getRecentFeed("Cat-1").getEvents().size());
   Assert.assertEquals(3, newFeedGenerator.getFeedForId(10, "Cat-1").getEvents().size());
   generateData(49, "Cat-1");
   markerService.markEvents(new String[] {"Cat-1", ""}, 50);
   Assert.assertEquals(3, newFeedGenerator.getFeedForId(10, "Cat-1").getEvents().size());
   Assert.assertEquals(9, newFeedGenerator.getFeedForId(11, "Cat-1").getEvents().size());
   Assert.assertEquals(4, newFeedGenerator.getFeedForId(16, "Cat-1").getEvents().size());
   markerService.markEvents(new String[] {"Cat-1", ""}, 97);
   Assert.assertEquals(3, newFeedGenerator.getFeedForId(10, "Cat-1").getEvents().size());
   Assert.assertEquals(9, newFeedGenerator.getFeedForId(11, "Cat-1").getEvents().size());
   Assert.assertEquals(4, newFeedGenerator.getFeedForId(16, "Cat-1").getEvents().size());
 }