@Test public void getBegin() throws Exception { Mockito.when(influxDB.query(Mockito.any(), Mockito.any())) .thenReturn(new JsonQueryResult("InfluxHistory_getBegin").getQueryResult()); assertThat(history.getBegin(), Matchers.equalTo(Optional.of(new DateTime(1505241470000L, DateTimeZone.UTC)))); verify(influxDB, times(1)).query( Mockito.argThat( Matchers.allOf( Matchers.hasProperty("command", Matchers.equalToIgnoringCase("select * from /.*/ order by time asc limit 1")), Matchers.hasProperty("database", Matchers.equalTo(DATABASE)))), Mockito.eq(TimeUnit.MILLISECONDS) ); verifyNoMoreInteractions(influxDB); }
public Optional<DateTime> getBegin() { final QueryResult result = getInfluxDB().query(new Query("select * from /.*/ order by time asc limit 1", getDatabase()), TimeUnit.MILLISECONDS); throwOnResultError(result); return extractTimestamps(result) .min(Comparator.naturalOrder()); }
InfluxHistory extends InfluxUtil implements CollectHistory, AutoCloseable { public Optional<DateTime> getBegin() { final QueryResult result = getInfluxDB().query(new Query("select * from /.*/ order by time asc limit 1", getDatabase()), TimeUnit.MILLISECONDS); throwOnResultError(result); return extractTimestamps(result) .min(Comparator.naturalOrder()); } }
InfluxHistory extends InfluxUtil implements CollectHistory, AutoCloseable { public Optional<DateTime> getBegin() { final QueryResult result = getInfluxDB().query(new Query("select * from /.*/ order by time asc limit 1", getDatabase()), TimeUnit.MILLISECONDS); throwOnResultError(result); return extractTimestamps(result) .min(Comparator.naturalOrder()); } InfluxHistory(InfluxDB influxDB, String database);  InfluxHistory(InfluxDB influxDB, String database, boolean verifyDatabaseConnection); }
InfluxHistory extends InfluxUtil implements CollectHistory, AutoCloseable { public Optional<DateTime> getBegin() { final QueryResult result = getInfluxDB().query(new Query("select * from /.*/ order by time asc limit 1", getDatabase()), TimeUnit.MILLISECONDS); throwOnResultError(result); return extractTimestamps(result) .min(Comparator.naturalOrder()); } InfluxHistory(InfluxDB influxDB, String database);  InfluxHistory(InfluxDB influxDB, String database, boolean verifyDatabaseConnection); @Override void close(); @Override boolean add(@NonNull TimeSeriesCollection tsdata); @Override boolean addAll(@NonNull Collection<? extends TimeSeriesCollection> c); @Override boolean addAll(@NonNull Iterator<? extends TimeSeriesCollection> i); int getTargetBatchSize(); void setTargetBatchSize(int targetBatchSize); @Override long getFileSize(); @Override DateTime getEnd(); Optional<DateTime> getBegin(); @Override Stream<TimeSeriesCollection> streamReversed(); @Override Stream<TimeSeriesCollection> stream(); Stream<TimeSeriesCollection> stream(@NonNull TimeSeriesMetricFilter filter); Stream<TimeSeriesCollection> stream(@NonNull Duration stepsize, @NonNull TimeSeriesMetricFilter filter); @Override Stream<TimeSeriesCollection> stream(DateTime begin); Stream<TimeSeriesCollection> stream(@NonNull DateTime begin, @NonNull TimeSeriesMetricFilter filter); Stream<TimeSeriesCollection> stream(DateTime begin, Duration stepsize, TimeSeriesMetricFilter filter); @Override Stream<TimeSeriesCollection> stream(DateTime begin, DateTime end); Stream<TimeSeriesCollection> stream(@NonNull DateTime begin, @NonNull DateTime end, @NonNull TimeSeriesMetricFilter filter); Stream<TimeSeriesCollection> stream(DateTime begin, DateTime end, Duration stepsize, TimeSeriesMetricFilter filter); @Override Stream<Context> getContext(Duration stepsize, ExpressionLookBack lookback, TimeSeriesMetricFilter filter); @Override Stream<Context> getContext(DateTime begin, Duration stepsize, ExpressionLookBack lookback, TimeSeriesMetricFilter filter); @Override Stream<Context> getContext(DateTime begin, DateTime end, Duration stepsize, ExpressionLookBack lookback, TimeSeriesMetricFilter filter); }
InfluxHistory extends InfluxUtil implements CollectHistory, AutoCloseable { public Optional<DateTime> getBegin() { final QueryResult result = getInfluxDB().query(new Query("select * from /.*/ order by time asc limit 1", getDatabase()), TimeUnit.MILLISECONDS); throwOnResultError(result); return extractTimestamps(result) .min(Comparator.naturalOrder()); } InfluxHistory(InfluxDB influxDB, String database);  InfluxHistory(InfluxDB influxDB, String database, boolean verifyDatabaseConnection); @Override void close(); @Override boolean add(@NonNull TimeSeriesCollection tsdata); @Override boolean addAll(@NonNull Collection<? extends TimeSeriesCollection> c); @Override boolean addAll(@NonNull Iterator<? extends TimeSeriesCollection> i); int getTargetBatchSize(); void setTargetBatchSize(int targetBatchSize); @Override long getFileSize(); @Override DateTime getEnd(); Optional<DateTime> getBegin(); @Override Stream<TimeSeriesCollection> streamReversed(); @Override Stream<TimeSeriesCollection> stream(); Stream<TimeSeriesCollection> stream(@NonNull TimeSeriesMetricFilter filter); Stream<TimeSeriesCollection> stream(@NonNull Duration stepsize, @NonNull TimeSeriesMetricFilter filter); @Override Stream<TimeSeriesCollection> stream(DateTime begin); Stream<TimeSeriesCollection> stream(@NonNull DateTime begin, @NonNull TimeSeriesMetricFilter filter); Stream<TimeSeriesCollection> stream(DateTime begin, Duration stepsize, TimeSeriesMetricFilter filter); @Override Stream<TimeSeriesCollection> stream(DateTime begin, DateTime end); Stream<TimeSeriesCollection> stream(@NonNull DateTime begin, @NonNull DateTime end, @NonNull TimeSeriesMetricFilter filter); Stream<TimeSeriesCollection> stream(DateTime begin, DateTime end, Duration stepsize, TimeSeriesMetricFilter filter); @Override Stream<Context> getContext(Duration stepsize, ExpressionLookBack lookback, TimeSeriesMetricFilter filter); @Override Stream<Context> getContext(DateTime begin, Duration stepsize, ExpressionLookBack lookback, TimeSeriesMetricFilter filter); @Override Stream<Context> getContext(DateTime begin, DateTime end, Duration stepsize, ExpressionLookBack lookback, TimeSeriesMetricFilter filter);  }