use of com.lordofthejars.nosqlunit.annotation.UsingDataSet in project graylog2-server by Graylog2.
the class IndicesTest method testDelete.
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.CLEAN_INSERT)
public void testDelete() throws Exception {
final IndicesExistsRequest beforeRequest = client.admin().indices().prepareExists(INDEX_NAME).request();
final IndicesExistsResponse beforeResponse = client.admin().indices().exists(beforeRequest).actionGet(ES_TIMEOUT);
assertThat(beforeResponse.isExists()).isTrue();
indices.delete(INDEX_NAME);
final IndicesExistsRequest request = client.admin().indices().prepareExists(INDEX_NAME).request();
final IndicesExistsResponse response = client.admin().indices().exists(request).actionGet(ES_TIMEOUT);
assertThat(response.isExists()).isFalse();
}
use of com.lordofthejars.nosqlunit.annotation.UsingDataSet in project graylog2-server by Graylog2.
the class IndicesTest method testTimestampStatsOfIndexWithEmptyIndex.
@Test
@UsingDataSet(locations = "IndicesTest-EmptyIndex.json", loadStrategy = LoadStrategyEnum.CLEAN_INSERT)
public void testTimestampStatsOfIndexWithEmptyIndex() throws Exception {
IndexRangeStats stats = indices.indexRangeStatsOfIndex(INDEX_NAME);
assertThat(stats.min()).isEqualTo(new DateTime(0L, DateTimeZone.UTC));
assertThat(stats.max()).isEqualTo(new DateTime(0L, DateTimeZone.UTC));
}
use of com.lordofthejars.nosqlunit.annotation.UsingDataSet in project graylog2-server by Graylog2.
the class IndicesTest method indexCreationDateReturnsIndexCreationDateOfExistingIndexAsDateTime.
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.DELETE_ALL)
public void indexCreationDateReturnsIndexCreationDateOfExistingIndexAsDateTime() {
final DateTime now = DateTime.now(DateTimeZone.UTC);
indices.create("index_creation_date_test", indexSet);
final DateTime indexCreationDate = indices.indexCreationDate("index_creation_date_test");
org.assertj.jodatime.api.Assertions.assertThat(indexCreationDate).isAfterOrEqualTo(now);
indices.delete("index_creation_date_test");
}
use of com.lordofthejars.nosqlunit.annotation.UsingDataSet in project graylog2-server by Graylog2.
the class IndicesTest method testTimestampStatsOfIndex.
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.CLEAN_INSERT)
public void testTimestampStatsOfIndex() throws Exception {
IndexRangeStats stats = indices.indexRangeStatsOfIndex(INDEX_NAME);
assertThat(stats.min()).isEqualTo(new DateTime(2015, 1, 1, 1, 0, DateTimeZone.UTC));
assertThat(stats.max()).isEqualTo(new DateTime(2015, 1, 1, 5, 0, DateTimeZone.UTC));
}
use of com.lordofthejars.nosqlunit.annotation.UsingDataSet in project graylog2-server by Graylog2.
the class IndicesTest method testClose.
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.CLEAN_INSERT)
public void testClose() throws Exception {
final ClusterStateRequest beforeRequest = client.admin().cluster().prepareState().setIndices(INDEX_NAME).request();
final ClusterStateResponse beforeResponse = client.admin().cluster().state(beforeRequest).actionGet(ES_TIMEOUT);
assertThat(beforeResponse.getState().getMetaData().getConcreteAllOpenIndices()).containsExactly(INDEX_NAME);
indices.close(INDEX_NAME);
final ClusterStateRequest request = client.admin().cluster().prepareState().setIndices(INDEX_NAME).request();
final ClusterStateResponse response = client.admin().cluster().state(request).actionGet(ES_TIMEOUT);
assertThat(response.getState().getMetaData().getConcreteAllClosedIndices()).containsExactly(INDEX_NAME);
}
Aggregations