use of com.lordofthejars.nosqlunit.annotation.UsingDataSet in project graylog2-server by Graylog2.
the class SearchesTest method countRecordsMetrics.
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.CLEAN_INSERT)
public void countRecordsMetrics() throws Exception {
CountResult result = searches.count("*", AbsoluteRange.create(new DateTime(2015, 1, 1, 0, 0, DateTimeZone.UTC), new DateTime(2015, 1, 2, 0, 0, DateTimeZone.UTC)));
assertThat(metricRegistry.getTimers()).containsKey(REQUEST_TIMER_NAME);
assertThat(metricRegistry.getHistograms()).containsKey(RANGES_HISTOGRAM_NAME);
Timer timer = metricRegistry.timer(REQUEST_TIMER_NAME);
assertThat(timer.getCount()).isEqualTo(1L);
}
use of com.lordofthejars.nosqlunit.annotation.UsingDataSet in project graylog2-server by Graylog2.
the class SearchesTest method fieldHistogramRecordsMetrics.
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.CLEAN_INSERT)
public void fieldHistogramRecordsMetrics() throws Exception {
final AbsoluteRange range = AbsoluteRange.create(new DateTime(2015, 1, 1, 0, 0, DateTimeZone.UTC), new DateTime(2015, 1, 2, 0, 0, DateTimeZone.UTC));
HistogramResult h = searches.fieldHistogram("*", "n", Searches.DateHistogramInterval.MINUTE, null, range, false);
assertThat(metricRegistry.getTimers()).containsKey(REQUEST_TIMER_NAME);
assertThat(metricRegistry.getHistograms()).containsKey(RANGES_HISTOGRAM_NAME);
Timer timer = metricRegistry.timer(REQUEST_TIMER_NAME);
assertThat(timer.getCount()).isEqualTo(1L);
Histogram histogram = metricRegistry.histogram(RANGES_HISTOGRAM_NAME);
assertThat(histogram.getCount()).isEqualTo(1L);
assertThat(histogram.getSnapshot().getValues()).containsExactly(86400L);
}
use of com.lordofthejars.nosqlunit.annotation.UsingDataSet in project graylog2-server by Graylog2.
the class SearchesTest method testTerms.
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.CLEAN_INSERT)
public void testTerms() throws Exception {
TermsResult result = searches.terms("n", 25, "*", AbsoluteRange.create(new DateTime(2015, 1, 1, 0, 0, DateTimeZone.UTC), new DateTime(2015, 1, 2, 0, 0, DateTimeZone.UTC)));
assertThat(result.getTotal()).isEqualTo(10L);
assertThat(result.getMissing()).isEqualTo(2L);
assertThat(result.getTerms()).hasSize(4).containsEntry("1", 2L).containsEntry("2", 2L).containsEntry("3", 3L).containsEntry("4", 1L);
}
use of com.lordofthejars.nosqlunit.annotation.UsingDataSet in project graylog2-server by Graylog2.
the class SearchesTest method testTermsStats.
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.CLEAN_INSERT)
public void testTermsStats() throws Exception {
TermsStatsResult r = searches.termsStats("message", "n", Searches.TermsStatsOrder.COUNT, 25, "*", AbsoluteRange.create(new DateTime(2015, 1, 1, 0, 0, DateTimeZone.UTC), new DateTime(2015, 1, 2, 0, 0, DateTimeZone.UTC)));
assertThat(r.getResults()).hasSize(2);
assertThat(r.getResults().get(0)).hasSize(7).containsEntry("key_field", "ho");
}
use of com.lordofthejars.nosqlunit.annotation.UsingDataSet in project graylog2-server by Graylog2.
the class SearchesTest method histogramRecordsMetrics.
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.CLEAN_INSERT)
public void histogramRecordsMetrics() throws Exception {
final AbsoluteRange range = AbsoluteRange.create(new DateTime(2015, 1, 1, 0, 0, DateTimeZone.UTC), new DateTime(2015, 1, 2, 0, 0, DateTimeZone.UTC));
HistogramResult h = searches.histogram("*", Searches.DateHistogramInterval.MINUTE, range);
assertThat(metricRegistry.getTimers()).containsKey(REQUEST_TIMER_NAME);
assertThat(metricRegistry.getHistograms()).containsKey(RANGES_HISTOGRAM_NAME);
Timer timer = metricRegistry.timer(REQUEST_TIMER_NAME);
assertThat(timer.getCount()).isEqualTo(1L);
Histogram histogram = metricRegistry.histogram(RANGES_HISTOGRAM_NAME);
assertThat(histogram.getCount()).isEqualTo(1L);
assertThat(histogram.getSnapshot().getValues()).containsExactly(86400L);
}
Aggregations