ScalingHistoryRestApi { @GET @Produces (MediaType.APPLICATION_JSON) public Response getHistoryList(@Context final HttpServletRequest httpServletRequest, @QueryParam ("appId") String appId, @QueryParam ("startTime") String startTime, @QueryParam ("endTime") String endTime, @QueryParam ("status") String status, @QueryParam ("metrics") String metrics, @QueryParam ("offset") String offset, @QueryParam ("maxCount") String maxCount, @QueryParam ("scaleType") String scaleType, @QueryParam ("timeZone") String timeZone){ logger.debug( "Get scaling history list. App ID is " + appId); try { ScalingHistoryFilter filter = new ScalingHistoryFilter(); filter.setAppId(appId); if (!ValidateUtil.isNull(startTime)){ filter.setStartTime(Long.parseLong(startTime)); } if (!ValidateUtil.isNull(endTime)){ filter.setEndTime(Long.parseLong(endTime)); } if (!ValidateUtil.isNull(scaleType)){ filter.setScaleType(scaleType); } filter.setStatus(status); filter.setMetrics(metrics); if (maxCount != null) filter.setMaxCount(Integer.parseInt(maxCount)); if (offset != null) filter.setOffset(Integer.parseInt(offset)); ScalingHistoryManager manager = ScalingHistoryManager.getInstance(); List<ScalingHistory> historyList = manager.getHistoryList(filter, timeZone); return RestApiResponseHandler.getResponseOk(mapper.writeValueAsString(historyList)); } catch (IOException e) { return RestApiResponseHandler.getResponseError(MESSAGE_KEY.RestResponseErrorMsg_build_JSON_error, e, httpServletRequest.getLocale()); } catch (DataStoreException e) { return RestApiResponseHandler.getResponseError(MESSAGE_KEY.RestResponseErrorMsg_database_error, e, httpServletRequest.getLocale()); } }  @GET @Produces (MediaType.APPLICATION_JSON) Response getHistoryList(@Context final HttpServletRequest httpServletRequest, @QueryParam ("appId") String appId, @QueryParam ("startTime") String startTime, 
			@QueryParam ("endTime") String endTime, @QueryParam ("status") String status,
			@QueryParam ("metrics") String metrics, @QueryParam ("offset") String offset,
			@QueryParam ("maxCount") String maxCount, @QueryParam ("scaleType") String scaleType, @QueryParam ("timeZone") String timeZone); @Path ("/count") @GET @Produces (MediaType.APPLICATION_JSON) Response getHistoryCount(@Context final HttpServletRequest httpServletRequest, @QueryParam ("appId") String appId, @QueryParam ("startTime") String startTime, 
			@QueryParam ("endTime") String endTime, @QueryParam ("status") String status,
			@QueryParam ("metrics") String metrics,@QueryParam ("scaleType") String scaleType);  }
@Test public void testGetHistoryList(){ WebResource webResource = resource(); MultivaluedMap<String, String> paramMap = new MultivaluedMapImpl(); paramMap.add("appId", TESTAPPID); paramMap.add("startTime", String.valueOf(0)); paramMap.add("endTime", String.valueOf(System.currentTimeMillis() * 2)); paramMap.add("status", "3"); paramMap.add("scaleType", "scaleIn"); ClientResponse response = webResource.path("/history").queryParams(paramMap).type(MediaType.APPLICATION_JSON).get(ClientResponse.class); String jsonStr = response.getEntity(String.class); JSONArray ja = new JSONArray(jsonStr); assertEquals(ja.length(), 1); assertEquals(response.getStatus(), STATUS200); }