@Test public void getEventsXWIKI14719() throws Exception { DocumentReference userA = new DocumentReference("xwiki", "XWiki", "UserA"); Event event0 = createMockedEvent("update", userA, userA, new Date(1510567729000L), "1997830249-1510567729000-Puhs4MSa"); Event event1 = createMockedEvent("update", userA, userA, new Date(1510567724000L), "1997830249-1510567724000-aCjmsmSh"); Event event2 = createMockedEvent("update", userA, userA, new Date(1510567718000L), "1997830249-1510567718000-hEErMBp9"); Event event3 = createMockedEvent("update", userA, userA, new Date(1510567717000L), "1997830249-1510567718000-hEErMBp9"); Event event4 = createMockedEvent("update", userA, userA, new Date(1510567715000L), "1997830249-1510567715000-B723WWBC"); Event event5 = createMockedEvent("update", userA, userA, new Date(1510567715000L), "1997830249-1510567715000-B723WWBC"); Event event6 = createMockedEvent("update", userA, userA, new Date(1510567714000L), "1997830249-1510567714000-SHPmruCG"); Event event7 = createMockedEvent("update", userA, userA, new Date(1510567712000L), "1997830249-1510567712000-Fy19J0v1"); Event event8 = createMockedEvent("update", userA, userA, new Date(1510567711000L), "1997830249-1510567711000-zDfFnZbD"); Event event9 = createMockedEvent("update", userA, userA, new Date(1510567711000L), "1997830249-1510567711000-zDfFnZbD"); when(authorizationManager.hasAccess(eq(Right.VIEW), eq(userReference), any(DocumentReference.class))) .thenReturn(true); when(contextualAuthorizationManager.hasAccess(eq(Right.VIEW), any(DocumentReference.class))).thenReturn(true); when(eventStream.searchEvents(query)).thenReturn( Arrays.asList(event0, event1, event2, event3, event4, event5, event6, event7, event8, event9), Collections.emptyList()); NotificationParameters parameters = new NotificationParameters(); parameters.user = new DocumentReference("xwiki", "XWiki", "UserA"); parameters.expectedCount = 5; List<CompositeEvent> results = this.defaultParametrizedNotificationManager.getEvents(parameters); assertEquals(1, results.size()); }
@Override public List<CompositeEvent> getEvents(NotificationParameters parameters) throws NotificationException { if (Boolean.TRUE.equals(parameters.onlyUnread) && !parameters.filters.contains(eventReadAlertFilter)) { parameters.filters.add(eventReadAlertFilter); } if (Boolean.TRUE.equals(parameters.onlyUnread) && !parameters.filters.contains(eventReadEmailFilter)) { parameters.filters.add(eventReadEmailFilter); } return getEvents(new ArrayList<>(), parameters); }
DefaultParametrizedNotificationManager implements ParametrizedNotificationManager { @Override public List<CompositeEvent> getEvents(NotificationParameters parameters) throws NotificationException { if (Boolean.TRUE.equals(parameters.onlyUnread) && !parameters.filters.contains(eventReadAlertFilter)) { parameters.filters.add(eventReadAlertFilter); } if (Boolean.TRUE.equals(parameters.onlyUnread) && !parameters.filters.contains(eventReadEmailFilter)) { parameters.filters.add(eventReadEmailFilter); } return getEvents(new ArrayList<>(), parameters); } }
DefaultParametrizedNotificationManager implements ParametrizedNotificationManager { @Override public List<CompositeEvent> getEvents(NotificationParameters parameters) throws NotificationException { if (Boolean.TRUE.equals(parameters.onlyUnread) && !parameters.filters.contains(eventReadAlertFilter)) { parameters.filters.add(eventReadAlertFilter); } if (Boolean.TRUE.equals(parameters.onlyUnread) && !parameters.filters.contains(eventReadEmailFilter)) { parameters.filters.add(eventReadEmailFilter); } return getEvents(new ArrayList<>(), parameters); }  }
DefaultParametrizedNotificationManager implements ParametrizedNotificationManager { @Override public List<CompositeEvent> getEvents(NotificationParameters parameters) throws NotificationException { if (Boolean.TRUE.equals(parameters.onlyUnread) && !parameters.filters.contains(eventReadAlertFilter)) { parameters.filters.add(eventReadAlertFilter); } if (Boolean.TRUE.equals(parameters.onlyUnread) && !parameters.filters.contains(eventReadEmailFilter)) { parameters.filters.add(eventReadEmailFilter); } return getEvents(new ArrayList<>(), parameters); }  @Override List<CompositeEvent> getEvents(NotificationParameters parameters); }
DefaultParametrizedNotificationManager implements ParametrizedNotificationManager { @Override public List<CompositeEvent> getEvents(NotificationParameters parameters) throws NotificationException { if (Boolean.TRUE.equals(parameters.onlyUnread) && !parameters.filters.contains(eventReadAlertFilter)) { parameters.filters.add(eventReadAlertFilter); } if (Boolean.TRUE.equals(parameters.onlyUnread) && !parameters.filters.contains(eventReadEmailFilter)) { parameters.filters.add(eventReadEmailFilter); } return getEvents(new ArrayList<>(), parameters); }  @Override List<CompositeEvent> getEvents(NotificationParameters parameters);  }