@Test public void testAbout() throws Exception { WebResource r = resource(); ClientResponse response = r.path("ws").path("v1").path("timeline") .accept(MediaType.APPLICATION_JSON) .get(ClientResponse.class); assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType()); TimelineWebServices.AboutInfo about = response.getEntity(TimelineWebServices.AboutInfo.class); Assert.assertNotNull(about); Assert.assertEquals("AMS API", about.getAbout()); }
@GET @Produces({ MediaType.APPLICATION_JSON }) public AboutInfo about( @Context HttpServletRequest req, @Context HttpServletResponse res) { init(res); return new AboutInfo("AMS API"); }
TimelineWebServices { @GET @Produces({ MediaType.APPLICATION_JSON }) public AboutInfo about( @Context HttpServletRequest req, @Context HttpServletResponse res) { init(res); return new AboutInfo("AMS API"); } }
TimelineWebServices { @GET @Produces({ MediaType.APPLICATION_JSON }) public AboutInfo about( @Context HttpServletRequest req, @Context HttpServletResponse res) { init(res); return new AboutInfo("AMS API"); } @Inject  TimelineWebServices(TimelineMetricStore timelineMetricStore); }
TimelineWebServices { @GET @Produces({ MediaType.APPLICATION_JSON }) public AboutInfo about( @Context HttpServletRequest req, @Context HttpServletResponse res) { init(res); return new AboutInfo("AMS API"); } @Inject  TimelineWebServices(TimelineMetricStore timelineMetricStore); @GET @Produces({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) AboutInfo about(
      @Context HttpServletRequest req,
      @Context HttpServletResponse res); @Path("/metrics") @POST @Consumes({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) TimelinePutResponse postMetrics(
    @Context HttpServletRequest req,
    @Context HttpServletResponse res,
    TimelineMetrics metrics); @Path("/metrics/aggregated") @POST @Consumes({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) TimelinePutResponse postAggregatedMetrics(
    @Context HttpServletRequest req,
    @Context HttpServletResponse res,
    AggregationResult metrics); @Path("/containermetrics") @POST @Consumes({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) TimelinePutResponse postContainerMetrics(
      @Context HttpServletRequest req,
      @Context HttpServletResponse res,
      List<ContainerMetric> metrics); @GET @Path("/metrics") @Produces({ MediaType.APPLICATION_JSON }) TimelineMetrics getTimelineMetrics(
    @Context HttpServletRequest req,
    @Context HttpServletResponse res,
    @QueryParam("metricNames") String metricNames,
    @QueryParam("appId") String appId,
    @QueryParam("instanceId") String instanceId,
    @QueryParam("hostname") String hostname,
    @QueryParam("startTime") String startTime,
    @QueryParam("endTime") String endTime,
    @QueryParam("precision") String precision,
    @QueryParam("limit") String limit,
    @QueryParam("grouped") String grouped,
    @QueryParam("topN") String topN,
    @QueryParam("topNFunction") String topNFunction,
    @QueryParam("isBottomN") String isBottomN,
    @QueryParam("seriesAggregateFunction") String seriesAggregateFunction
  ); @GET @Path("metrics/{instanceId}") @Produces({ MediaType.APPLICATION_JSON }) TimelineMetrics getTimelineMetricsForInstance(
    @Context HttpServletRequest req,
    @Context HttpServletResponse res,
    @PathParam("instanceId") String instanceId,
    @QueryParam("metricNames") String metricNames,
    @QueryParam("appId") String appId,
    @QueryParam("hostname") String hostname,
    @QueryParam("startTime") String startTime,
    @QueryParam("endTime") String endTime,
    @QueryParam("precision") String precision,
    @QueryParam("limit") String limit,
    @QueryParam("grouped") String grouped,
    @QueryParam("topN") String topN,
    @QueryParam("topNFunction") String topNFunction,
    @QueryParam("isBottomN") String isBottomN,
    @QueryParam("seriesAggregateFunction") String seriesAggregateFunction
  ); @GET @Path("/metrics/summary") @Produces({ MediaType.APPLICATION_JSON }) TimelineMetricServiceSummary getTimelineMetricServiceSummary(
    @Context HttpServletRequest req,
    @Context HttpServletResponse res); @GET @Path("/metrics/metadata") @Produces({ MediaType.APPLICATION_JSON }) Map<String, List<TimelineMetricMetadata>> getTimelineMetricMetadata(
    @Context HttpServletRequest req,
    @Context HttpServletResponse res,
    @QueryParam("appId") String appId,
    @QueryParam("metricName") String metricPattern,
    @QueryParam("includeAll") String includeBlacklistedMetrics
    ); @GET @Path("/metrics/{instanceId}/metadata") @Produces({ MediaType.APPLICATION_JSON }) Map<String, List<TimelineMetricMetadata>> getTimelineMetricMetadataForInstance(
    @Context HttpServletRequest req,
    @Context HttpServletResponse res,
    @QueryParam("appId") String appId,
    @QueryParam("metricName") String metricPattern,
    @QueryParam("includeAll") String includeBlacklistedMetrics
  ); @GET @Path("/metrics/hosts") @Produces({ MediaType.APPLICATION_JSON }) Map<String, Set<String>> getHostedAppsMetadata(
    @Context HttpServletRequest req,
    @Context HttpServletResponse res
  ); @GET @Path("/metrics/instance") @Produces({ MediaType.APPLICATION_JSON }) Map<String, Map<String, Set<String>>> getClusterHostsMetadata(
    @Context HttpServletRequest req,
    @Context HttpServletResponse res,
    @QueryParam("appId") String appId,
    @QueryParam("instanceId") String instanceId
  ); @GET @Path("/metrics/{instanceId}/instance") @Produces({ MediaType.APPLICATION_JSON }) Map<String, Map<String, Set<String>>> getClusterHostsMetadataForInstance(
    @Context HttpServletRequest req,
    @Context HttpServletResponse res,
    @QueryParam("appId") String appId,
    @PathParam("instanceId") String instanceId
  ); @GET @Path("/metrics/uuid") @Produces({ MediaType.APPLICATION_JSON }) byte[] getUuid(
    @Context HttpServletRequest req,
    @Context HttpServletResponse res,
    @QueryParam("metricName") String metricName,
    @QueryParam("appId") String appId,
    @QueryParam("instanceId") String instanceId,
    @QueryParam("hostname") String hostname
    ); @GET @Path("/metrics/livenodes") @Produces({ MediaType.APPLICATION_JSON }) List<String> getLiveCollectorNodes(
    @Context HttpServletRequest req,
    @Context HttpServletResponse res
  ); }
TimelineWebServices { @GET @Produces({ MediaType.APPLICATION_JSON }) public AboutInfo about( @Context HttpServletRequest req, @Context HttpServletResponse res) { init(res); return new AboutInfo("AMS API"); } @Inject  TimelineWebServices(TimelineMetricStore timelineMetricStore); @GET @Produces({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) AboutInfo about(
      @Context HttpServletRequest req,
      @Context HttpServletResponse res); @Path("/metrics") @POST @Consumes({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) TimelinePutResponse postMetrics(
    @Context HttpServletRequest req,
    @Context HttpServletResponse res,
    TimelineMetrics metrics); @Path("/metrics/aggregated") @POST @Consumes({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) TimelinePutResponse postAggregatedMetrics(
    @Context HttpServletRequest req,
    @Context HttpServletResponse res,
    AggregationResult metrics); @Path("/containermetrics") @POST @Consumes({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) TimelinePutResponse postContainerMetrics(
      @Context HttpServletRequest req,
      @Context HttpServletResponse res,
      List<ContainerMetric> metrics); @GET @Path("/metrics") @Produces({ MediaType.APPLICATION_JSON }) TimelineMetrics getTimelineMetrics(
    @Context HttpServletRequest req,
    @Context HttpServletResponse res,
    @QueryParam("metricNames") String metricNames,
    @QueryParam("appId") String appId,
    @QueryParam("instanceId") String instanceId,
    @QueryParam("hostname") String hostname,
    @QueryParam("startTime") String startTime,
    @QueryParam("endTime") String endTime,
    @QueryParam("precision") String precision,
    @QueryParam("limit") String limit,
    @QueryParam("grouped") String grouped,
    @QueryParam("topN") String topN,
    @QueryParam("topNFunction") String topNFunction,
    @QueryParam("isBottomN") String isBottomN,
    @QueryParam("seriesAggregateFunction") String seriesAggregateFunction
  ); @GET @Path("metrics/{instanceId}") @Produces({ MediaType.APPLICATION_JSON }) TimelineMetrics getTimelineMetricsForInstance(
    @Context HttpServletRequest req,
    @Context HttpServletResponse res,
    @PathParam("instanceId") String instanceId,
    @QueryParam("metricNames") String metricNames,
    @QueryParam("appId") String appId,
    @QueryParam("hostname") String hostname,
    @QueryParam("startTime") String startTime,
    @QueryParam("endTime") String endTime,
    @QueryParam("precision") String precision,
    @QueryParam("limit") String limit,
    @QueryParam("grouped") String grouped,
    @QueryParam("topN") String topN,
    @QueryParam("topNFunction") String topNFunction,
    @QueryParam("isBottomN") String isBottomN,
    @QueryParam("seriesAggregateFunction") String seriesAggregateFunction
  ); @GET @Path("/metrics/summary") @Produces({ MediaType.APPLICATION_JSON }) TimelineMetricServiceSummary getTimelineMetricServiceSummary(
    @Context HttpServletRequest req,
    @Context HttpServletResponse res); @GET @Path("/metrics/metadata") @Produces({ MediaType.APPLICATION_JSON }) Map<String, List<TimelineMetricMetadata>> getTimelineMetricMetadata(
    @Context HttpServletRequest req,
    @Context HttpServletResponse res,
    @QueryParam("appId") String appId,
    @QueryParam("metricName") String metricPattern,
    @QueryParam("includeAll") String includeBlacklistedMetrics
    ); @GET @Path("/metrics/{instanceId}/metadata") @Produces({ MediaType.APPLICATION_JSON }) Map<String, List<TimelineMetricMetadata>> getTimelineMetricMetadataForInstance(
    @Context HttpServletRequest req,
    @Context HttpServletResponse res,
    @QueryParam("appId") String appId,
    @QueryParam("metricName") String metricPattern,
    @QueryParam("includeAll") String includeBlacklistedMetrics
  ); @GET @Path("/metrics/hosts") @Produces({ MediaType.APPLICATION_JSON }) Map<String, Set<String>> getHostedAppsMetadata(
    @Context HttpServletRequest req,
    @Context HttpServletResponse res
  ); @GET @Path("/metrics/instance") @Produces({ MediaType.APPLICATION_JSON }) Map<String, Map<String, Set<String>>> getClusterHostsMetadata(
    @Context HttpServletRequest req,
    @Context HttpServletResponse res,
    @QueryParam("appId") String appId,
    @QueryParam("instanceId") String instanceId
  ); @GET @Path("/metrics/{instanceId}/instance") @Produces({ MediaType.APPLICATION_JSON }) Map<String, Map<String, Set<String>>> getClusterHostsMetadataForInstance(
    @Context HttpServletRequest req,
    @Context HttpServletResponse res,
    @QueryParam("appId") String appId,
    @PathParam("instanceId") String instanceId
  ); @GET @Path("/metrics/uuid") @Produces({ MediaType.APPLICATION_JSON }) byte[] getUuid(
    @Context HttpServletRequest req,
    @Context HttpServletResponse res,
    @QueryParam("metricName") String metricName,
    @QueryParam("appId") String appId,
    @QueryParam("instanceId") String instanceId,
    @QueryParam("hostname") String hostname
    ); @GET @Path("/metrics/livenodes") @Produces({ MediaType.APPLICATION_JSON }) List<String> getLiveCollectorNodes(
    @Context HttpServletRequest req,
    @Context HttpServletResponse res
  );  }