@Test @Ignore public void getDailySnapshot() throws Exception { DailySnapshot snapshot = new DailySnapshot(); Response resp = snapshot.getDailySnapshot("2016-12-12"); Assert.assertNotNull(resp); }
@GET @Path("/dailysnapshot/{day}") public Response getDailySnapshot(@PathParam("day") @NotNull String day) { OperationStats opStats = new OperationStats("cmdb_api", "get_dailysnapshot", new HashMap<>()); Map<String, String> tags = new HashMap<>(); try { DateTime time = DateTime.parse(day, DateTimeFormat.forPattern("yyyy-MM-dd")); DailySnapshotStore dailySnapshot = factory.getDailyStore(time); Iterator<EsDailySnapshotInstance> iter = dailySnapshot.getSnapshotInstances(); List<EsDailySnapshotInstance> ret = IteratorUtils.toList(iter); logger.info("Success: getDailySnapshot - {}", day); return Response.status(Response.Status.OK) .type(MediaType.APPLICATION_JSON) .entity(ret) .build(); } catch (Exception e) { return Utils.responseException(e, logger, opStats, tags); } }
DailySnapshot { @GET @Path("/dailysnapshot/{day}") public Response getDailySnapshot(@PathParam("day") @NotNull String day) { OperationStats opStats = new OperationStats("cmdb_api", "get_dailysnapshot", new HashMap<>()); Map<String, String> tags = new HashMap<>(); try { DateTime time = DateTime.parse(day, DateTimeFormat.forPattern("yyyy-MM-dd")); DailySnapshotStore dailySnapshot = factory.getDailyStore(time); Iterator<EsDailySnapshotInstance> iter = dailySnapshot.getSnapshotInstances(); List<EsDailySnapshotInstance> ret = IteratorUtils.toList(iter); logger.info("Success: getDailySnapshot - {}", day); return Response.status(Response.Status.OK) .type(MediaType.APPLICATION_JSON) .entity(ret) .build(); } catch (Exception e) { return Utils.responseException(e, logger, opStats, tags); } } }
DailySnapshot { @GET @Path("/dailysnapshot/{day}") public Response getDailySnapshot(@PathParam("day") @NotNull String day) { OperationStats opStats = new OperationStats("cmdb_api", "get_dailysnapshot", new HashMap<>()); Map<String, String> tags = new HashMap<>(); try { DateTime time = DateTime.parse(day, DateTimeFormat.forPattern("yyyy-MM-dd")); DailySnapshotStore dailySnapshot = factory.getDailyStore(time); Iterator<EsDailySnapshotInstance> iter = dailySnapshot.getSnapshotInstances(); List<EsDailySnapshotInstance> ret = IteratorUtils.toList(iter); logger.info("Success: getDailySnapshot - {}", day); return Response.status(Response.Status.OK) .type(MediaType.APPLICATION_JSON) .entity(ret) .build(); } catch (Exception e) { return Utils.responseException(e, logger, opStats, tags); } }  }
DailySnapshot { @GET @Path("/dailysnapshot/{day}") public Response getDailySnapshot(@PathParam("day") @NotNull String day) { OperationStats opStats = new OperationStats("cmdb_api", "get_dailysnapshot", new HashMap<>()); Map<String, String> tags = new HashMap<>(); try { DateTime time = DateTime.parse(day, DateTimeFormat.forPattern("yyyy-MM-dd")); DailySnapshotStore dailySnapshot = factory.getDailyStore(time); Iterator<EsDailySnapshotInstance> iter = dailySnapshot.getSnapshotInstances(); List<EsDailySnapshotInstance> ret = IteratorUtils.toList(iter); logger.info("Success: getDailySnapshot - {}", day); return Response.status(Response.Status.OK) .type(MediaType.APPLICATION_JSON) .entity(ret) .build(); } catch (Exception e) { return Utils.responseException(e, logger, opStats, tags); } }  @GET @Path("/dailysnapshot/{day}") Response getDailySnapshot(@PathParam("day")
                                   @NotNull String day); }
DailySnapshot { @GET @Path("/dailysnapshot/{day}") public Response getDailySnapshot(@PathParam("day") @NotNull String day) { OperationStats opStats = new OperationStats("cmdb_api", "get_dailysnapshot", new HashMap<>()); Map<String, String> tags = new HashMap<>(); try { DateTime time = DateTime.parse(day, DateTimeFormat.forPattern("yyyy-MM-dd")); DailySnapshotStore dailySnapshot = factory.getDailyStore(time); Iterator<EsDailySnapshotInstance> iter = dailySnapshot.getSnapshotInstances(); List<EsDailySnapshotInstance> ret = IteratorUtils.toList(iter); logger.info("Success: getDailySnapshot - {}", day); return Response.status(Response.Status.OK) .type(MediaType.APPLICATION_JSON) .entity(ret) .build(); } catch (Exception e) { return Utils.responseException(e, logger, opStats, tags); } }  @GET @Path("/dailysnapshot/{day}") Response getDailySnapshot(@PathParam("day")
                                   @NotNull String day);  }