MessageSummaryDAOImpl extends AbstractIdleService implements IMessageSummaryDAO { @Override public Map<String, Double> getActiveRoomsByMethod(Interval interval, ActiveMethod method, int resultSize, boolean withBots) { if (method == ActiveMethod.ToTV) { return occurrenceStatsDAO.getActiveColumnsByToTV("roomName", interval, resultSize, withBots); } else if (method == ActiveMethod.ToMV) { return occurrenceStatsDAO.getActiveColumnsByToMV("roomName", interval, resultSize, withBots); } else { throw new UnsupportedOperationException(String.format("Method %s not supported", method)); } } MessageSummaryDAOImpl(EntityManagerFactory emf); @Override void persistMessageSummary(MessageSummary messageSummary); @Override MessageSummary getMessageSummary(MessageSummary messageSummary); @Override List<MessageSummary> getAllMessageSummariesForType(MessageType type,
                                                              Interval interval,
                                                              List<String> roomNames,
                                                              List<String> usernames); @Override List<MessageSummary> getAllMessageSummaries(Interval interval,
                                                       List<String> roomNames,
                                                       List<String> usernames,
                                                       boolean withBots); @Override int getTotalMessageSummaries(Interval interval, List<String> roomNames,
                                        List<String> usernames, boolean withBots); @Override int getTotalMessageSummariesForType(MessageType type,
                                               Interval interval,
                                               List<String> roomNames,
                                               List<String> usernames,
                                               boolean withBots); @Override Map<String, Double> getActiveUsersByMethod(Interval interval,
                                                      ActiveMethod method,
                                                      int resultSize,
                                                      boolean withBots); @Override Map<String, Double> getActiveRoomsByMethod(Interval interval,
                                                      ActiveMethod method,
                                                      int resultSize,
                                                      boolean withBots);  }
@Test public void testGetTopRoomsByMethod() { Interval interval = new Interval(mentionDate.minusMillis(1), mentionDate.plusMillis(1)); Map<String, Double> result = underTest.getActiveRoomsByMethod(interval, ActiveMethod.ToTV, 10, true); assertEquals(2, result.size()); assertEquals(0.5, result.get("room1"), 0); assertEquals(0.5, result.get("room2"), 0); result = underTest.getActiveRoomsByMethod(interval, ActiveMethod.ToMV, 10, true); assertEquals(2, result.size()); assertEquals(1.0, result.get("room1"), 0); assertEquals(1.0, result.get("room2"), 0); }