From aaef7de62d2fc60a6f62ca940f0b652f647ebb7b Mon Sep 17 00:00:00 2001 From: Brian Murphy Date: Wed, 26 Nov 2014 14:07:33 +0000 Subject: [PATCH] TEST: This test got forgotten when I squash the commits. Original commit: elastic/x-pack-elasticsearch@5109b4bea6121258071217de01495d3027f67e0e --- .../alerts/ActionHistoryIndexNameTest.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/test/java/org/elasticsearch/alerts/ActionHistoryIndexNameTest.java diff --git a/src/test/java/org/elasticsearch/alerts/ActionHistoryIndexNameTest.java b/src/test/java/org/elasticsearch/alerts/ActionHistoryIndexNameTest.java new file mode 100644 index 00000000000..e7a99abdd7f --- /dev/null +++ b/src/test/java/org/elasticsearch/alerts/ActionHistoryIndexNameTest.java @@ -0,0 +1,28 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +package org.elasticsearch.alerts; + +import org.elasticsearch.alerts.actions.AlertActionManager; +import org.elasticsearch.common.joda.time.DateTime; +import org.elasticsearch.common.joda.time.DateTimeZone; +import org.elasticsearch.test.ElasticsearchTestCase; +import org.junit.Test; + +import static org.hamcrest.core.IsEqual.equalTo; + +/** + */ +public class ActionHistoryIndexNameTest extends ElasticsearchTestCase { + + @Test + public void testActionHistoryNameTest() { + assertThat(AlertActionManager.getAlertHistoryIndexNameForTime(new DateTime(0, DateTimeZone.UTC)), equalTo(".alert_history_1970-01-01")); + assertThat(AlertActionManager.getAlertHistoryIndexNameForTime(new DateTime(100000000000L, DateTimeZone.UTC)), equalTo(".alert_history_1973-03-03")); + assertThat(AlertActionManager.getAlertHistoryIndexNameForTime(new DateTime(1416582852000L, DateTimeZone.UTC)), equalTo(".alert_history_2014-11-21")); + assertThat(AlertActionManager.getAlertHistoryIndexNameForTime(new DateTime(2833165811000L, DateTimeZone.UTC)), equalTo(".alert_history_2059-10-12")); + } + +}