EntitiesResource { @GET @Produces(MediaType.APPLICATION_JSON) public List<ChatEntity> getAllEntites(@QueryParam(START_TIME) String startTimeStr, @QueryParam(END_TIME) String endTimeStr, @QueryParam(USER) List<String> users, @QueryParam(ROOM) List<String> rooms, @QueryParam(BOT) String botStr) { LOG.debug("All entities query for starttime={}, endtime={}, users={}, rooms={}, botStr={}", startTimeStr, endTimeStr, users, rooms); Interval interval = DateTimeUtils.getIntervalFromParameters(startTimeStr, endTimeStr, dtz); boolean withBots = ResourceUtils.getOptionalForParameterAsBool(botStr).or(false); users = ResourceUtils.getListFromNullable(users); rooms = ResourceUtils.getListFromNullable(rooms); return entityDao.getAllMentions(interval, rooms, users, withBots); } EntitiesResource(ChatAlyticsConfig config); @GET @Path("trending") @Produces(MediaType.APPLICATION_JSON) Map<String, Long> getTrendingTopics(@QueryParam(START_TIME) String startTimeStr,
                                               @QueryParam(END_TIME) String endTimeStr,
                                               @QueryParam(USER) List<String> users,
                                               @QueryParam(ROOM) List<String> rooms,
                                               @QueryParam(TOP_N) String topNStr,
                                               @QueryParam(BOT) String botStr); @GET @Produces(MediaType.APPLICATION_JSON) List<ChatEntity> getAllEntites(@QueryParam(START_TIME) String startTimeStr,
                                          @QueryParam(END_TIME) String endTimeStr,
                                          @QueryParam(USER) List<String> users,
                                          @QueryParam(ROOM) List<String> rooms,
                                          @QueryParam(BOT) String botStr); @GET @Path("similarities") @Produces(MediaType.APPLICATION_JSON) LabeledDenseMatrix<String> getSimilarities(
            @QueryParam(START_TIME) String startTimeStr,
            @QueryParam(END_TIME) String endTimeStr,
            @QueryParam(FIRST_SIMILARITY_DIM) String firstDimStr,
            @QueryParam(SECOND_SIMILARITY_DIM) String secondDimStr,
            @QueryParam(BOT) String botStr); @GET @Path("active") @Produces(MediaType.APPLICATION_JSON) Map<String, Double> getActive(@QueryParam(START_TIME) String startTimeStr,
                                         @QueryParam(END_TIME) String endTimeStr,
                                         @QueryParam(DIM) String dimensionStr,
                                         @QueryParam(METHOD) String methodStr,
                                         @QueryParam(TOP_N) String topNStr,
                                         @QueryParam(BOT) String botStr); static final String ENTITIES_ENDPOINT; static final String FIRST_SIMILARITY_DIM; static final String SECOND_SIMILARITY_DIM; static final String DIM; static final String METHOD; }
@Test public void testGetAllEntities() throws Exception { DateTimeFormatter dtf = DateTimeUtils.PARAMETER_WITH_DAY_DTF.withZone(dtZone); String startTimeStr = dtf.print(mentionTime.minusDays(1)); String endTimeStr = dtf.print(mentionTime.plusDays(1)); List<ChatEntity> result = underTest.getAllEntites(startTimeStr, endTimeStr, null, null, null); assertEquals(entities.size(), result.size()); Set<ChatEntity> resultEntitySet = Sets.newHashSet(result); for (ChatEntity expectedEntity : entities) { assertTrue(resultEntitySet.contains(expectedEntity)); } }