diff --git a/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/ExecutionVarsIT.java b/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/ExecutionVarsIT.java index dfe469fb446..166b6ea366b 100644 --- a/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/ExecutionVarsIT.java +++ b/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/ExecutionVarsIT.java @@ -25,8 +25,8 @@ import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBu import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.scriptCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; import static org.elasticsearch.xpack.watcher.transform.TransformBuilders.scriptTransform; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.cron; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.cron; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.Matchers.is; diff --git a/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/GroovyManualExecutionIT.java b/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/GroovyManualExecutionIT.java index cd3f3b864cb..aea978cb2d4 100644 --- a/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/GroovyManualExecutionIT.java +++ b/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/GroovyManualExecutionIT.java @@ -20,8 +20,8 @@ import org.elasticsearch.xpack.watcher.transport.actions.delete.DeleteWatchRespo import org.elasticsearch.xpack.watcher.transport.actions.get.GetWatchRequest; import org.elasticsearch.xpack.watcher.transport.actions.put.PutWatchRequest; import org.elasticsearch.xpack.watcher.transport.actions.put.PutWatchResponse; -import org.elasticsearch.xpack.watcher.trigger.manual.ManualTriggerEvent; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent; +import org.elasticsearch.xpack.trigger.manual.ManualTriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent; import org.elasticsearch.xpack.watcher.watch.Watch; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; @@ -34,8 +34,8 @@ import java.util.concurrent.TimeUnit; import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.loggingAction; import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBuilder; import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.cron; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.cron; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.greaterThanOrEqualTo; diff --git a/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/HistoryTemplateTransformMappingsIT.java b/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/HistoryTemplateTransformMappingsIT.java index ac70e85f308..8f406cf68ef 100644 --- a/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/HistoryTemplateTransformMappingsIT.java +++ b/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/HistoryTemplateTransformMappingsIT.java @@ -21,8 +21,8 @@ import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBu import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.alwaysCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; import static org.elasticsearch.xpack.watcher.transform.TransformBuilders.scriptTransform; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.hasKey; import static org.hamcrest.Matchers.is; diff --git a/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/IndexActionIT.java b/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/IndexActionIT.java index 6cb442b82ca..db88f0d0055 100644 --- a/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/IndexActionIT.java +++ b/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/IndexActionIT.java @@ -14,11 +14,11 @@ import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval; import org.elasticsearch.search.sort.SortOrder; import org.elasticsearch.xpack.watcher.history.HistoryStore; -import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils; +import org.elasticsearch.xpack.support.DateTimeUtils; import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase; import org.elasticsearch.xpack.watcher.transport.actions.execute.ExecuteWatchResponse; import org.elasticsearch.xpack.watcher.transport.actions.put.PutWatchResponse; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; @@ -33,8 +33,8 @@ import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBu import static org.elasticsearch.xpack.watcher.input.InputBuilders.searchInput; import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; import static org.elasticsearch.xpack.watcher.transform.TransformBuilders.scriptTransform; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.cron; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.cron; import static org.hamcrest.Matchers.hasEntry; import static org.hamcrest.Matchers.hasKey; import static org.hamcrest.Matchers.is; @@ -75,10 +75,10 @@ public class IndexActionIT extends AbstractWatcherIntegrationTestCase { assertThat(searchResponse.getHits().totalHits(), is(1L)); SearchHit hit = searchResponse.getHits().getAt(0); if (timeWarped()) { - assertThat(hit.getSource(), hasEntry("@timestamp", (Object) WatcherDateTimeUtils.formatDate(now))); + assertThat(hit.getSource(), hasEntry("@timestamp", (Object) DateTimeUtils.formatDate(now))); } else { assertThat(hit.getSource(), hasKey("@timestamp")); - DateTime timestamp = WatcherDateTimeUtils.parseDate((String) hit.getSource().get("@timestamp")); + DateTime timestamp = DateTimeUtils.parseDate((String) hit.getSource().get("@timestamp")); assertThat(timestamp.isEqual(now) || timestamp.isAfter(now), is(true)); } assertThat(hit.getSource(), hasEntry("foo", (Object) "bar")); @@ -111,10 +111,10 @@ public class IndexActionIT extends AbstractWatcherIntegrationTestCase { assertThat(searchResponse.getHits().totalHits(), is(1L)); SearchHit hit = searchResponse.getHits().getAt(0); if (timeWarped()) { - assertThat(hit.getSource(), hasEntry("@timestamp", (Object) WatcherDateTimeUtils.formatDate(now))); + assertThat(hit.getSource(), hasEntry("@timestamp", (Object) DateTimeUtils.formatDate(now))); } else { assertThat(hit.getSource(), hasKey("@timestamp")); - DateTime timestamp = WatcherDateTimeUtils.parseDate((String) hit.getSource().get("@timestamp")); + DateTime timestamp = DateTimeUtils.parseDate((String) hit.getSource().get("@timestamp")); assertThat(timestamp.isEqual(now) || timestamp.isAfter(now), is(true)); } assertThat(hit.getSource(), hasEntry("foo", (Object) "bar")); @@ -202,10 +202,10 @@ public class IndexActionIT extends AbstractWatcherIntegrationTestCase { int i = 0; for (SearchHit hit : searchResponse.getHits()) { if (timeWarped()) { - assertThat(hit.getSource(), hasEntry("@timestamp", (Object) WatcherDateTimeUtils.formatDate(now))); + assertThat(hit.getSource(), hasEntry("@timestamp", (Object) DateTimeUtils.formatDate(now))); } else { assertThat(hit.getSource(), hasKey("@timestamp")); - DateTime timestamp = WatcherDateTimeUtils.parseDate((String) hit.getSource().get("@timestamp")); + DateTime timestamp = DateTimeUtils.parseDate((String) hit.getSource().get("@timestamp")); assertThat(timestamp.isEqual(now) || timestamp.isAfter(now), is(true)); } assertThat(hit.getSource(), hasEntry("key", (Object) key.getMillis())); diff --git a/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/ScriptConditionTests.java b/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/ScriptConditionTests.java index 500d35e70da..9601c561628 100644 --- a/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/ScriptConditionTests.java +++ b/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/ScriptConditionTests.java @@ -36,7 +36,7 @@ import java.io.IOException; import static java.util.Collections.singletonMap; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.messy.tests.MessyTestUtils.getScriptServiceProxy; -import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument; +import static org.elasticsearch.xpack.support.Exceptions.illegalArgument; import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.mockExecutionContext; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.is; diff --git a/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/TransformIT.java b/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/TransformIT.java index 937b8c9e3e3..9e94ab4b7c5 100644 --- a/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/TransformIT.java +++ b/elasticsearch/qa/messy-test-watcher-with-groovy/src/test/java/org/elasticsearch/messy/tests/TransformIT.java @@ -36,8 +36,8 @@ import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; import static org.elasticsearch.xpack.watcher.transform.TransformBuilders.chainTransform; import static org.elasticsearch.xpack.watcher.transform.TransformBuilders.scriptTransform; import static org.elasticsearch.xpack.watcher.transform.TransformBuilders.searchTransform; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThanOrEqualTo; diff --git a/elasticsearch/qa/messy-test-xpack-with-mustache/src/test/java/org/elasticsearch/messy/tests/HipChatServiceIT.java b/elasticsearch/qa/messy-test-xpack-with-mustache/src/test/java/org/elasticsearch/messy/tests/HipChatServiceIT.java index bc889ded99d..099fe496e3d 100644 --- a/elasticsearch/qa/messy-test-xpack-with-mustache/src/test/java/org/elasticsearch/messy/tests/HipChatServiceIT.java +++ b/elasticsearch/qa/messy-test-xpack-with-mustache/src/test/java/org/elasticsearch/messy/tests/HipChatServiceIT.java @@ -30,8 +30,8 @@ import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.hipchatActi import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBuilder; import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.alwaysCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.lessThan; import static org.hamcrest.Matchers.notNullValue; diff --git a/elasticsearch/qa/messy-test-xpack-with-mustache/src/test/java/org/elasticsearch/messy/tests/NoMasterNodeIT.java b/elasticsearch/qa/messy-test-xpack-with-mustache/src/test/java/org/elasticsearch/messy/tests/NoMasterNodeIT.java index 2c382165c40..a16f08bdfa6 100644 --- a/elasticsearch/qa/messy-test-xpack-with-mustache/src/test/java/org/elasticsearch/messy/tests/NoMasterNodeIT.java +++ b/elasticsearch/qa/messy-test-xpack-with-mustache/src/test/java/org/elasticsearch/messy/tests/NoMasterNodeIT.java @@ -51,9 +51,9 @@ import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.always import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.compareCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.searchInput; import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.cron; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.cron; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.core.Is.is; diff --git a/elasticsearch/qa/messy-test-xpack-with-mustache/src/test/java/org/elasticsearch/messy/tests/PagerDutyServiceIT.java b/elasticsearch/qa/messy-test-xpack-with-mustache/src/test/java/org/elasticsearch/messy/tests/PagerDutyServiceIT.java index a60d8c9f81f..64cbea85bbe 100644 --- a/elasticsearch/qa/messy-test-xpack-with-mustache/src/test/java/org/elasticsearch/messy/tests/PagerDutyServiceIT.java +++ b/elasticsearch/qa/messy-test-xpack-with-mustache/src/test/java/org/elasticsearch/messy/tests/PagerDutyServiceIT.java @@ -32,8 +32,8 @@ import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.pagerDutyAc import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBuilder; import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.alwaysCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.lessThan; import static org.hamcrest.Matchers.notNullValue; diff --git a/elasticsearch/qa/messy-test-xpack-with-mustache/src/test/java/org/elasticsearch/messy/tests/SearchInputIT.java b/elasticsearch/qa/messy-test-xpack-with-mustache/src/test/java/org/elasticsearch/messy/tests/SearchInputIT.java index b2d46d4a4ac..65a2a93ca75 100644 --- a/elasticsearch/qa/messy-test-xpack-with-mustache/src/test/java/org/elasticsearch/messy/tests/SearchInputIT.java +++ b/elasticsearch/qa/messy-test-xpack-with-mustache/src/test/java/org/elasticsearch/messy/tests/SearchInputIT.java @@ -37,9 +37,9 @@ import org.elasticsearch.xpack.watcher.input.search.SearchInputFactory; import org.elasticsearch.xpack.watcher.input.simple.ExecutableSimpleInput; import org.elasticsearch.xpack.watcher.input.simple.SimpleInput; import org.elasticsearch.xpack.watcher.support.init.proxy.WatcherClientProxy; -import org.elasticsearch.xpack.watcher.trigger.schedule.IntervalSchedule; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTrigger; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.IntervalSchedule; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTrigger; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent; import org.elasticsearch.xpack.watcher.watch.Payload; import org.elasticsearch.xpack.watcher.watch.Watch; import org.elasticsearch.xpack.watcher.watch.WatchStatus; diff --git a/elasticsearch/qa/messy-test-xpack-with-mustache/src/test/java/org/elasticsearch/messy/tests/SearchTransformIT.java b/elasticsearch/qa/messy-test-xpack-with-mustache/src/test/java/org/elasticsearch/messy/tests/SearchTransformIT.java index d2b9f47bbd3..a303c639707 100644 --- a/elasticsearch/qa/messy-test-xpack-with-mustache/src/test/java/org/elasticsearch/messy/tests/SearchTransformIT.java +++ b/elasticsearch/qa/messy-test-xpack-with-mustache/src/test/java/org/elasticsearch/messy/tests/SearchTransformIT.java @@ -43,9 +43,9 @@ import org.elasticsearch.xpack.watcher.transform.TransformBuilders; import org.elasticsearch.xpack.watcher.transform.search.ExecutableSearchTransform; import org.elasticsearch.xpack.watcher.transform.search.SearchTransform; import org.elasticsearch.xpack.watcher.transform.search.SearchTransformFactory; -import org.elasticsearch.xpack.watcher.trigger.schedule.IntervalSchedule; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTrigger; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.IntervalSchedule; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTrigger; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent; import org.elasticsearch.xpack.watcher.watch.Payload; import org.elasticsearch.xpack.watcher.watch.Watch; import org.elasticsearch.xpack.watcher.watch.WatchStatus; @@ -74,7 +74,7 @@ import static org.elasticsearch.index.query.QueryBuilders.rangeQuery; import static org.elasticsearch.index.query.QueryBuilders.termQuery; import static org.elasticsearch.search.builder.SearchSourceBuilder.searchSource; import static org.elasticsearch.test.ESIntegTestCase.Scope.SUITE; -import static org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils.parseDate; +import static org.elasticsearch.xpack.support.DateTimeUtils.parseDate; import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.EMPTY_PAYLOAD; import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.getRandomSupportedSearchType; import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.mockExecutionContext; diff --git a/elasticsearch/qa/messy-test-xpack-with-mustache/src/test/java/org/elasticsearch/messy/tests/SlackServiceIT.java b/elasticsearch/qa/messy-test-xpack-with-mustache/src/test/java/org/elasticsearch/messy/tests/SlackServiceIT.java index 59e2468b866..2fe06fa1295 100644 --- a/elasticsearch/qa/messy-test-xpack-with-mustache/src/test/java/org/elasticsearch/messy/tests/SlackServiceIT.java +++ b/elasticsearch/qa/messy-test-xpack-with-mustache/src/test/java/org/elasticsearch/messy/tests/SlackServiceIT.java @@ -30,8 +30,8 @@ import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.slackAction import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBuilder; import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.alwaysCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.lessThan; import static org.hamcrest.Matchers.notNullValue; diff --git a/elasticsearch/qa/messy-test-xpack-with-mustache/src/test/java/org/elasticsearch/messy/tests/WatchAckIT.java b/elasticsearch/qa/messy-test-xpack-with-mustache/src/test/java/org/elasticsearch/messy/tests/WatchAckIT.java index 77774111be4..ca81cbf1d5b 100644 --- a/elasticsearch/qa/messy-test-xpack-with-mustache/src/test/java/org/elasticsearch/messy/tests/WatchAckIT.java +++ b/elasticsearch/qa/messy-test-xpack-with-mustache/src/test/java/org/elasticsearch/messy/tests/WatchAckIT.java @@ -46,8 +46,8 @@ import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.compar import static org.elasticsearch.xpack.watcher.input.InputBuilders.searchInput; import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.matchAllRequest; import static org.elasticsearch.xpack.watcher.transform.TransformBuilders.searchTransform; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.cron; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.cron; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.greaterThanOrEqualTo; diff --git a/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/common/http/HttpContentType.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/common/http/HttpContentType.java index 5ab4c09c02c..9fb972f3834 100644 --- a/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/common/http/HttpContentType.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/common/http/HttpContentType.java @@ -12,7 +12,7 @@ import org.elasticsearch.common.xcontent.XContentType; import java.io.IOException; import java.util.Locale; -import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument; +import static org.elasticsearch.xpack.support.Exceptions.illegalArgument; /** */ diff --git a/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/common/http/HttpRequest.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/common/http/HttpRequest.java index 8bc7e446796..afc640217a6 100644 --- a/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/common/http/HttpRequest.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/common/http/HttpRequest.java @@ -19,7 +19,7 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.rest.support.RestUtils; import org.elasticsearch.xpack.common.http.auth.HttpAuthRegistry; -import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils; +import org.elasticsearch.xpack.support.DateTimeUtils; import org.elasticsearch.xpack.watcher.support.WatcherUtils; import org.elasticsearch.xpack.common.http.auth.HttpAuth; @@ -272,14 +272,14 @@ public class HttpRequest implements ToXContent { builder.auth(httpAuthRegistry.parse(parser)); } else if (ParseFieldMatcher.STRICT.match(currentFieldName, Field.CONNECTION_TIMEOUT)) { try { - builder.connectionTimeout(WatcherDateTimeUtils.parseTimeValue(parser, Field.CONNECTION_TIMEOUT.toString())); + builder.connectionTimeout(DateTimeUtils.parseTimeValue(parser, Field.CONNECTION_TIMEOUT.toString())); } catch (ElasticsearchParseException pe) { throw new ElasticsearchParseException("could not parse http request. invalid time value for [{}] field", pe, currentFieldName); } } else if (ParseFieldMatcher.STRICT.match(currentFieldName, Field.READ_TIMEOUT)) { try { - builder.readTimeout(WatcherDateTimeUtils.parseTimeValue(parser, Field.READ_TIMEOUT.toString())); + builder.readTimeout(DateTimeUtils.parseTimeValue(parser, Field.READ_TIMEOUT.toString())); } catch (ElasticsearchParseException pe) { throw new ElasticsearchParseException("could not parse http request. invalid time value for [{}] field", pe, currentFieldName); diff --git a/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/common/http/HttpRequestTemplate.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/common/http/HttpRequestTemplate.java index a97aec967c2..01d09fc78a6 100644 --- a/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/common/http/HttpRequestTemplate.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/common/http/HttpRequestTemplate.java @@ -18,7 +18,7 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.support.RestUtils; import org.elasticsearch.xpack.common.http.auth.HttpAuth; import org.elasticsearch.xpack.common.http.auth.HttpAuthRegistry; -import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils; +import org.elasticsearch.xpack.support.DateTimeUtils; import org.elasticsearch.xpack.common.text.TextTemplate; import org.elasticsearch.xpack.common.text.TextTemplateEngine; import org.jboss.netty.handler.codec.http.HttpHeaders; @@ -283,7 +283,7 @@ public class HttpRequestTemplate implements ToXContent { builder.fromUrl(parser.text()); } else if (ParseFieldMatcher.STRICT.match(currentFieldName, HttpRequest.Field.CONNECTION_TIMEOUT)) { try { - builder.connectionTimeout(WatcherDateTimeUtils.parseTimeValue(parser, + builder.connectionTimeout(DateTimeUtils.parseTimeValue(parser, HttpRequest.Field.CONNECTION_TIMEOUT.toString())); } catch (ElasticsearchParseException pe) { throw new ElasticsearchParseException("could not parse http request template. invalid time value for [{}] field", @@ -291,7 +291,7 @@ public class HttpRequestTemplate implements ToXContent { } } else if (ParseFieldMatcher.STRICT.match(currentFieldName, HttpRequest.Field.READ_TIMEOUT)) { try { - builder.readTimeout(WatcherDateTimeUtils.parseTimeValue(parser, HttpRequest.Field.READ_TIMEOUT.toString())); + builder.readTimeout(DateTimeUtils.parseTimeValue(parser, HttpRequest.Field.READ_TIMEOUT.toString())); } catch (ElasticsearchParseException pe) { throw new ElasticsearchParseException("could not parse http request template. invalid time value for [{}] field", pe, currentFieldName); diff --git a/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/common/http/auth/HttpAuthRegistry.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/common/http/auth/HttpAuthRegistry.java index da461ba9aa6..5b12457d117 100644 --- a/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/common/http/auth/HttpAuthRegistry.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/common/http/auth/HttpAuthRegistry.java @@ -12,7 +12,7 @@ import org.elasticsearch.common.xcontent.XContentParser; import java.io.IOException; import java.util.Map; -import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument; +import static org.elasticsearch.xpack.support.Exceptions.illegalArgument; /** * diff --git a/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/notification/email/DataAttachment.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/notification/email/DataAttachment.java index a3c1d1a6619..be3909ea4ad 100644 --- a/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/notification/email/DataAttachment.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/notification/email/DataAttachment.java @@ -18,7 +18,7 @@ import java.io.IOException; import java.util.Locale; import java.util.Map; -import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument; +import static org.elasticsearch.xpack.support.Exceptions.illegalArgument; /** * diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/engine/SchedulerScheduleTriggerEngine.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/scheduler/SchedulerEngine.java similarity index 51% rename from elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/engine/SchedulerScheduleTriggerEngine.java rename to elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/scheduler/SchedulerEngine.java index 1b604d1a65d..d6de32ad489 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/engine/SchedulerScheduleTriggerEngine.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/scheduler/SchedulerEngine.java @@ -3,85 +3,132 @@ * 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.xpack.watcher.trigger.schedule.engine; +package org.elasticsearch.xpack.scheduler; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.EsExecutors; import org.elasticsearch.common.util.concurrent.FutureUtils; import org.elasticsearch.xpack.support.clock.Clock; -import org.elasticsearch.xpack.watcher.trigger.TriggerEvent; -import org.elasticsearch.xpack.watcher.trigger.schedule.Schedule; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleRegistry; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTrigger; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEngine; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent; -import org.joda.time.DateTime; -import org.joda.time.DateTimeZone; -import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; import static java.util.Collections.unmodifiableMap; /** * */ -public class SchedulerScheduleTriggerEngine extends ScheduleTriggerEngine { +public class SchedulerEngine { + + public static class Job { + private final String id; + private final Schedule schedule; + + public Job(String id, Schedule schedule) { + this.id = id; + this.schedule = schedule; + } + + public String getId() { + return id; + } + + public Schedule getSchedule() { + return schedule; + } + } + + public static class Event { + private final String jobName; + private final long triggeredTime; + private final long scheduledTime; + + public Event(String jobName, long triggeredTime, long scheduledTime) { + this.jobName = jobName; + this.triggeredTime = triggeredTime; + this.scheduledTime = scheduledTime; + } + + public String getJobName() { + return jobName; + } + + public long getTriggeredTime() { + return triggeredTime; + } + + public long getScheduledTime() { + return scheduledTime; + } + } + + public interface Listener { + void triggered(Event event); + } + + public interface Schedule { + + /** + * Returns the next scheduled time after the given time, according to this schedule. If the given schedule + * cannot resolve the next scheduled time, then {@code -1} is returned. It really depends on the type of + * schedule to determine when {@code -1} is returned. Some schedules (e.g. IntervalSchedule) will never return + * {@code -1} as they can always compute the next scheduled time. {@code Cron} based schedules are good example + * of schedules that may return {@code -1}, for example, when the schedule only points to times that are all + * before the given time (in which case, there is no next scheduled time for the given time). + * + * Example: + * + * cron 0 0 0 * 1 ? 2013 (only points to days in January 2013) + * + * time 2015-01-01 12:00:00 (this time is in 2015) + * + */ + long nextScheduledTimeAfter(long startTime, long now); + } private volatile Schedules schedules; private ScheduledExecutorService scheduler; + private final Clock clock; + private List listeners = new CopyOnWriteArrayList<>(); - @Inject - public SchedulerScheduleTriggerEngine(Settings settings, ScheduleRegistry scheduleRegistry, Clock clock) { - super(settings, scheduleRegistry, clock); + public SchedulerEngine(Clock clock) { + this.clock = clock; + } + + public void register(Listener listener) { + listeners.add(listener); } - @Override public void start(Collection jobs) { - logger.debug("starting schedule engine..."); this.scheduler = Executors.newScheduledThreadPool(1, EsExecutors.daemonThreadFactory("trigger_engine_scheduler")); long starTime = clock.millis(); - List schedules = new ArrayList<>(); - for (Job job : jobs) { - if (job.trigger() instanceof ScheduleTrigger) { - ScheduleTrigger trigger = (ScheduleTrigger) job.trigger(); - schedules.add(new ActiveSchedule(job.id(), trigger.getSchedule(), starTime)); - } - } + List schedules = jobs.stream() + .map(job -> new ActiveSchedule(job.getId(), job.getSchedule(), starTime)) + .collect(Collectors.toList()); this.schedules = new Schedules(schedules); - logger.debug("schedule engine started at [{}]", clock.nowUTC()); } - @Override public void stop() { - logger.debug("stopping schedule engine..."); scheduler.shutdownNow(); try { scheduler.awaitTermination(5, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } - logger.debug("schedule engine stopped"); } - @Override public void add(Job job) { - assert job.trigger() instanceof ScheduleTrigger; - ScheduleTrigger trigger = (ScheduleTrigger) job.trigger(); - ActiveSchedule schedule = new ActiveSchedule(job.id(), trigger.getSchedule(), clock.millis()); + ActiveSchedule schedule = new ActiveSchedule(job.getId(), job.getSchedule(), clock.millis()); schedules = schedules.add(schedule); } - @Override public boolean remove(String jobId) { Schedules newSchedules = schedules.remove(jobId); if (newSchedules == null) { @@ -92,12 +139,9 @@ public class SchedulerScheduleTriggerEngine extends ScheduleTriggerEngine { } protected void notifyListeners(String name, long triggeredTime, long scheduledTime) { - logger.trace("triggered job [{}] at [{}] (scheduled time was [{}])", name, new DateTime(triggeredTime, DateTimeZone.UTC), - new DateTime(scheduledTime, DateTimeZone.UTC)); - final ScheduleTriggerEvent event = new ScheduleTriggerEvent(name, new DateTime(triggeredTime, DateTimeZone.UTC), - new DateTime(scheduledTime, DateTimeZone.UTC)); + final Event event = new Event(name, triggeredTime, scheduledTime); for (Listener listener : listeners) { - listener.triggered(Arrays.asList(event)); + listener.triggered(event); } } @@ -139,68 +183,56 @@ public class SchedulerScheduleTriggerEngine extends ScheduleTriggerEngine { static class Schedules { - private final ActiveSchedule[] schedules; private final Map scheduleByName; Schedules(Collection schedules) { Map builder = new HashMap<>(); - this.schedules = new ActiveSchedule[schedules.size()]; - int i = 0; for (ActiveSchedule schedule : schedules) { builder.put(schedule.name, schedule); - this.schedules[i++] = schedule; } this.scheduleByName = unmodifiableMap(builder); } - public Schedules(ActiveSchedule[] schedules, Map scheduleByName) { - this.schedules = schedules; + public Schedules(Map scheduleByName) { this.scheduleByName = scheduleByName; } public Schedules add(ActiveSchedule schedule) { boolean replacing = scheduleByName.containsKey(schedule.name); if (!replacing) { - ActiveSchedule[] newSchedules = new ActiveSchedule[schedules.length + 1]; - System.arraycopy(schedules, 0, newSchedules, 0, schedules.length); - newSchedules[schedules.length] = schedule; Map newScheduleByName = new HashMap<>(scheduleByName); newScheduleByName.put(schedule.name, schedule); - return new Schedules(newSchedules, unmodifiableMap(newScheduleByName)); + return new Schedules(unmodifiableMap(newScheduleByName)); } - ActiveSchedule[] newSchedules = new ActiveSchedule[schedules.length]; - Map builder = new HashMap<>(); - for (int i = 0; i < schedules.length; i++) { - final ActiveSchedule sched; - if (schedules[i].name.equals(schedule.name)) { - sched = schedule; - schedules[i].cancel(); + Map builder = new HashMap<>(scheduleByName.size()); + for (Map.Entry scheduleEntry : scheduleByName.entrySet()) { + final String existingScheduleName = scheduleEntry.getKey(); + final ActiveSchedule existingSchedule = scheduleEntry.getValue(); + if (existingScheduleName.equals(schedule.name)) { + existingSchedule.cancel(); + builder.put(schedule.name, schedule); } else { - sched = schedules[i]; + builder.put(existingScheduleName, existingSchedule); } - newSchedules[i] = sched; - builder.put(sched.name, sched); } - return new Schedules(newSchedules, unmodifiableMap(builder)); + return new Schedules(unmodifiableMap(builder)); } public Schedules remove(String name) { if (!scheduleByName.containsKey(name)) { return null; } - Map builder = new HashMap<>(); - ActiveSchedule[] newSchedules = new ActiveSchedule[schedules.length - 1]; - int i = 0; - for (ActiveSchedule schedule : schedules) { - if (!schedule.name.equals(name)) { - newSchedules[i++] = schedule; - builder.put(schedule.name, schedule); + Map builder = new HashMap<>(scheduleByName.size() - 1); + for (Map.Entry scheduleEntry : scheduleByName.entrySet()) { + final String existingScheduleName = scheduleEntry.getKey(); + final ActiveSchedule existingSchedule = scheduleEntry.getValue(); + if (existingScheduleName.equals(name)) { + existingSchedule.cancel(); } else { - schedule.cancel(); + builder.put(existingScheduleName, existingSchedule); } } - return new Schedules(newSchedules, unmodifiableMap(builder)); + return new Schedules(unmodifiableMap(builder)); } } - } diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/WatcherDateTimeUtils.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/support/DateTimeUtils.java similarity index 98% rename from elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/WatcherDateTimeUtils.java rename to elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/support/DateTimeUtils.java index 6c0d1a12e29..563efb00bbf 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/WatcherDateTimeUtils.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/support/DateTimeUtils.java @@ -3,7 +3,7 @@ * 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.xpack.watcher.support; +package org.elasticsearch.xpack.support; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.io.stream.StreamInput; @@ -23,12 +23,12 @@ import java.util.concurrent.Callable; /** * */ -public class WatcherDateTimeUtils { +public class DateTimeUtils { public static final FormatDateTimeFormatter dateTimeFormatter = DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER; public static final DateMathParser dateMathParser = new DateMathParser(dateTimeFormatter); - private WatcherDateTimeUtils() { + private DateTimeUtils() { } public static DateTime convertToDate(Object value, Clock clock) { diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/Exceptions.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/support/Exceptions.java similarity index 97% rename from elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/Exceptions.java rename to elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/support/Exceptions.java index 6ec41119413..f130ce49d29 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/Exceptions.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/support/Exceptions.java @@ -3,7 +3,7 @@ * 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.xpack.watcher.support; +package org.elasticsearch.xpack.support; import org.elasticsearch.common.settings.SettingsException; import org.elasticsearch.script.GeneralScriptException; diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/Strings.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/support/Strings.java similarity index 94% rename from elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/Strings.java rename to elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/support/Strings.java index b55ae3298a1..b36f6dd03cf 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/Strings.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/support/Strings.java @@ -3,7 +3,7 @@ * 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.xpack.watcher.support; +package org.elasticsearch.xpack.support; import java.util.Objects; diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/AbstractTriggerEngine.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/AbstractTriggerEngine.java similarity index 94% rename from elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/AbstractTriggerEngine.java rename to elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/AbstractTriggerEngine.java index 27eafe415e2..0e75044c8c7 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/AbstractTriggerEngine.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/AbstractTriggerEngine.java @@ -3,7 +3,7 @@ * 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.xpack.watcher.trigger; +package org.elasticsearch.xpack.trigger; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.settings.Settings; diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/Trigger.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/Trigger.java similarity index 93% rename from elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/Trigger.java rename to elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/Trigger.java index eb3124cddc8..ca18f5d773c 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/Trigger.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/Trigger.java @@ -3,7 +3,7 @@ * 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.xpack.watcher.trigger; +package org.elasticsearch.xpack.trigger; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentParser; diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/TriggerBuilders.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/TriggerBuilders.java similarity index 71% rename from elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/TriggerBuilders.java rename to elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/TriggerBuilders.java index b8fd5dfb17c..8c2529bb590 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/TriggerBuilders.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/TriggerBuilders.java @@ -3,10 +3,10 @@ * 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.xpack.watcher.trigger; +package org.elasticsearch.xpack.trigger; -import org.elasticsearch.xpack.watcher.trigger.schedule.Schedule; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTrigger; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTrigger; +import org.elasticsearch.xpack.trigger.schedule.Schedule; /** * diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/TriggerEngine.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/TriggerEngine.java similarity index 89% rename from elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/TriggerEngine.java rename to elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/TriggerEngine.java index 24d192f90d6..102d65887b6 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/TriggerEngine.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/TriggerEngine.java @@ -3,7 +3,7 @@ * 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.xpack.watcher.trigger; +package org.elasticsearch.xpack.trigger; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.xcontent.XContentParser; @@ -43,7 +43,7 @@ public interface TriggerEngine { T parseTrigger(String context, XContentParser parser) throws IOException; - E parseTriggerEvent(TriggerService service, String watchId, String context, XContentParser parser) throws IOException; + E parseTriggerEvent(TriggerService service, String id, String context, XContentParser parser) throws IOException; interface Listener { diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/TriggerEvent.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/TriggerEvent.java similarity index 90% rename from elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/TriggerEvent.java rename to elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/TriggerEvent.java index 85c5ce6473f..28c87ee2e9b 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/TriggerEvent.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/TriggerEvent.java @@ -3,12 +3,12 @@ * 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.xpack.watcher.trigger; +package org.elasticsearch.xpack.trigger; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils; +import org.elasticsearch.xpack.support.DateTimeUtils; import org.joda.time.DateTime; import java.io.IOException; @@ -58,7 +58,7 @@ public abstract class TriggerEvent implements ToXContent { public void recordXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(); builder.field(Field.TYPE.getPreferredName(), type()); - WatcherDateTimeUtils.writeDate(Field.TRIGGERED_TIME.getPreferredName(), builder, triggeredTime); + DateTimeUtils.writeDate(Field.TRIGGERED_TIME.getPreferredName(), builder, triggeredTime); recordDataXContent(builder, params); builder.endObject(); } diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/TriggerModule.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/TriggerModule.java similarity index 87% rename from elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/TriggerModule.java rename to elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/TriggerModule.java index 236ba0a1b37..2c7d3321890 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/TriggerModule.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/TriggerModule.java @@ -3,13 +3,13 @@ * 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.xpack.watcher.trigger; +package org.elasticsearch.xpack.trigger; import org.elasticsearch.common.inject.AbstractModule; import org.elasticsearch.common.inject.multibindings.Multibinder; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.xpack.watcher.trigger.manual.ManualTriggerEngine; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleModule; +import org.elasticsearch.xpack.trigger.manual.ManualTriggerEngine; +import org.elasticsearch.xpack.trigger.schedule.ScheduleModule; import java.util.HashSet; import java.util.Set; diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/TriggerService.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/TriggerService.java similarity index 98% rename from elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/TriggerService.java rename to elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/TriggerService.java index 92ca3dce3f2..0fb23502800 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/TriggerService.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/TriggerService.java @@ -3,7 +3,7 @@ * 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.xpack.watcher.trigger; +package org.elasticsearch.xpack.trigger; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.component.AbstractComponent; @@ -20,7 +20,7 @@ import java.util.Set; import java.util.concurrent.CopyOnWriteArrayList; import static java.util.Collections.unmodifiableMap; -import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument; +import static org.elasticsearch.xpack.support.Exceptions.illegalArgument; /** * diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/manual/ManualTrigger.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/manual/ManualTrigger.java similarity index 92% rename from elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/manual/ManualTrigger.java rename to elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/manual/ManualTrigger.java index 68efc970975..336b4f5163a 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/manual/ManualTrigger.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/manual/ManualTrigger.java @@ -3,12 +3,12 @@ * 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.xpack.watcher.trigger.manual; +package org.elasticsearch.xpack.trigger.manual; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.watcher.trigger.Trigger; +import org.elasticsearch.xpack.trigger.Trigger; import java.io.IOException; diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/manual/ManualTriggerEngine.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/manual/ManualTriggerEngine.java similarity index 84% rename from elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/manual/ManualTriggerEngine.java rename to elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/manual/ManualTriggerEngine.java index 5773f3a3ea7..88f5a26f4ba 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/manual/ManualTriggerEngine.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/manual/ManualTriggerEngine.java @@ -3,19 +3,19 @@ * 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.xpack.watcher.trigger.manual; +package org.elasticsearch.xpack.trigger.manual; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.watcher.trigger.TriggerEngine; -import org.elasticsearch.xpack.watcher.trigger.TriggerService; +import org.elasticsearch.xpack.trigger.TriggerEngine; +import org.elasticsearch.xpack.trigger.TriggerService; import java.io.IOException; import java.util.Collection; import java.util.Map; -import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument; +import static org.elasticsearch.xpack.support.Exceptions.illegalArgument; /** */ @@ -79,8 +79,8 @@ public class ManualTriggerEngine implements TriggerEngine { + + String type(); + + S parse(XContentParser parser) throws IOException; + } +} diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/ScheduleModule.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/ScheduleModule.java similarity index 91% rename from elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/ScheduleModule.java rename to elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/ScheduleModule.java index 407362814cf..63ec2cfcd65 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/ScheduleModule.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/ScheduleModule.java @@ -3,15 +3,15 @@ * 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.xpack.watcher.trigger.schedule; +package org.elasticsearch.xpack.trigger.schedule; import org.elasticsearch.common.inject.AbstractModule; import org.elasticsearch.common.inject.multibindings.MapBinder; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.xpack.watcher.trigger.TriggerEngine; -import org.elasticsearch.xpack.watcher.trigger.schedule.engine.SchedulerScheduleTriggerEngine; -import org.elasticsearch.xpack.watcher.trigger.schedule.engine.TickerScheduleTriggerEngine; +import org.elasticsearch.xpack.trigger.schedule.engine.TickerScheduleTriggerEngine; +import org.elasticsearch.xpack.trigger.TriggerEngine; +import org.elasticsearch.xpack.trigger.schedule.engine.SchedulerScheduleTriggerEngine; import java.util.HashMap; import java.util.Locale; diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/ScheduleRegistry.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/ScheduleRegistry.java similarity index 97% rename from elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/ScheduleRegistry.java rename to elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/ScheduleRegistry.java index 236ec6049cf..1193f1f0cd9 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/ScheduleRegistry.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/ScheduleRegistry.java @@ -3,7 +3,7 @@ * 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.xpack.watcher.trigger.schedule; +package org.elasticsearch.xpack.trigger.schedule; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.inject.Inject; diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/ScheduleTrigger.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/ScheduleTrigger.java similarity index 93% rename from elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/ScheduleTrigger.java rename to elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/ScheduleTrigger.java index 55e519f634e..956b0845e40 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/ScheduleTrigger.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/ScheduleTrigger.java @@ -3,10 +3,10 @@ * 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.xpack.watcher.trigger.schedule; +package org.elasticsearch.xpack.trigger.schedule; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.xpack.watcher.trigger.Trigger; +import org.elasticsearch.xpack.trigger.Trigger; import java.io.IOException; diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/ScheduleTriggerEngine.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/ScheduleTriggerEngine.java similarity index 76% rename from elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/ScheduleTriggerEngine.java rename to elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/ScheduleTriggerEngine.java index cfc3644925d..5fe998728b0 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/ScheduleTriggerEngine.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/ScheduleTriggerEngine.java @@ -3,21 +3,21 @@ * 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.xpack.watcher.trigger.schedule; +package org.elasticsearch.xpack.trigger.schedule; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils; +import org.elasticsearch.xpack.trigger.AbstractTriggerEngine; +import org.elasticsearch.xpack.trigger.TriggerService; +import org.elasticsearch.xpack.support.DateTimeUtils; import org.elasticsearch.xpack.support.clock.Clock; -import org.elasticsearch.xpack.watcher.trigger.AbstractTriggerEngine; -import org.elasticsearch.xpack.watcher.trigger.TriggerService; import org.joda.time.DateTime; import java.io.IOException; import java.util.Map; -import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument; +import static org.elasticsearch.xpack.support.Exceptions.illegalArgument; /** * @@ -48,13 +48,13 @@ public abstract class ScheduleTriggerEngine extends AbstractTriggerEngine + notifyListeners(event.getJobName(), event.getTriggeredTime(), event.getScheduledTime())); + } + + @Override + public void start(Collection jobs) { + logger.debug("starting schedule engine..."); + final List schedulerJobs = new ArrayList<>(); + jobs.stream() + .filter(job -> job.trigger() instanceof ScheduleTrigger) + .forEach(job -> { + ScheduleTrigger trigger = (ScheduleTrigger) job.trigger(); + schedulerJobs.add(new SchedulerEngine.Job(job.id(), trigger.getSchedule())); + }); + schedulerEngine.start(schedulerJobs); + logger.debug("schedule engine started at [{}]", clock.nowUTC()); + } + + @Override + public void stop() { + logger.debug("stopping schedule engine..."); + schedulerEngine.stop(); + logger.debug("schedule engine stopped"); + } + + @Override + public void add(Job job) { + assert job.trigger() instanceof ScheduleTrigger; + ScheduleTrigger trigger = (ScheduleTrigger) job.trigger(); + schedulerEngine.add(new SchedulerEngine.Job(job.id(), trigger.getSchedule())); + } + + @Override + public boolean remove(String jobId) { + return schedulerEngine.remove(jobId); + } + + protected void notifyListeners(String name, long triggeredTime, long scheduledTime) { + logger.trace("triggered job [{}] at [{}] (scheduled time was [{}])", name, new DateTime(triggeredTime, DateTimeZone.UTC), + new DateTime(scheduledTime, DateTimeZone.UTC)); + final ScheduleTriggerEvent event = new ScheduleTriggerEvent(name, new DateTime(triggeredTime, DateTimeZone.UTC), + new DateTime(scheduledTime, DateTimeZone.UTC)); + for (Listener listener : listeners) { + listener.triggered(Collections.singletonList(event)); + } + } +} diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/engine/TickerScheduleTriggerEngine.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/engine/TickerScheduleTriggerEngine.java similarity index 92% rename from elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/engine/TickerScheduleTriggerEngine.java rename to elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/engine/TickerScheduleTriggerEngine.java index aa2850d6e2d..d9912a597be 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/engine/TickerScheduleTriggerEngine.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/engine/TickerScheduleTriggerEngine.java @@ -3,18 +3,18 @@ * 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.xpack.watcher.trigger.schedule.engine; +package org.elasticsearch.xpack.trigger.schedule.engine; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.xpack.support.clock.Clock; -import org.elasticsearch.xpack.watcher.trigger.TriggerEvent; -import org.elasticsearch.xpack.watcher.trigger.schedule.Schedule; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleRegistry; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTrigger; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEngine; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.ScheduleRegistry; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTrigger; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent; +import org.elasticsearch.xpack.trigger.TriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.Schedule; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEngine; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/support/DayOfWeek.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/support/DayOfWeek.java similarity index 97% rename from elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/support/DayOfWeek.java rename to elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/support/DayOfWeek.java index 1a366f233f3..946dbc11c54 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/support/DayOfWeek.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/support/DayOfWeek.java @@ -3,7 +3,7 @@ * 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.xpack.watcher.trigger.schedule.support; +package org.elasticsearch.xpack.trigger.schedule.support; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.xcontent.ToXContent; diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/support/DayTimes.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/support/DayTimes.java similarity index 98% rename from elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/support/DayTimes.java rename to elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/support/DayTimes.java index a2e1c4c7a13..ba6818eb80e 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/support/DayTimes.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/support/DayTimes.java @@ -3,7 +3,7 @@ * 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.xpack.watcher.trigger.schedule.support; +package org.elasticsearch.xpack.trigger.schedule.support; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.ParseFieldMatcher; @@ -16,8 +16,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument; -import static org.elasticsearch.xpack.watcher.support.Strings.join; +import static org.elasticsearch.xpack.support.Exceptions.illegalArgument; +import static org.elasticsearch.xpack.support.Strings.join; /** * diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/support/Month.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/support/Month.java similarity index 98% rename from elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/support/Month.java rename to elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/support/Month.java index 53e53ad6d79..9e4de291528 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/support/Month.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/support/Month.java @@ -3,7 +3,7 @@ * 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.xpack.watcher.trigger.schedule.support; +package org.elasticsearch.xpack.trigger.schedule.support; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.xcontent.ToXContent; diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/support/MonthTimes.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/support/MonthTimes.java similarity index 97% rename from elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/support/MonthTimes.java rename to elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/support/MonthTimes.java index 339cf0b9a55..5680d9a24b2 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/support/MonthTimes.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/support/MonthTimes.java @@ -3,7 +3,7 @@ * 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.xpack.watcher.trigger.schedule.support; +package org.elasticsearch.xpack.trigger.schedule.support; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.ParseFieldMatcher; @@ -19,8 +19,8 @@ import java.util.Locale; import java.util.Set; import static org.elasticsearch.common.util.set.Sets.newHashSet; -import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument; -import static org.elasticsearch.xpack.watcher.support.Strings.join; +import static org.elasticsearch.xpack.support.Exceptions.illegalArgument; +import static org.elasticsearch.xpack.support.Strings.join; /** * diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/support/Times.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/support/Times.java similarity index 91% rename from elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/support/Times.java rename to elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/support/Times.java index e281dc3eed6..ecefe32335b 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/support/Times.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/support/Times.java @@ -3,7 +3,7 @@ * 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.xpack.watcher.trigger.schedule.support; +package org.elasticsearch.xpack.trigger.schedule.support; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.xcontent.ToXContent; diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/support/WeekTimes.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/support/WeekTimes.java similarity index 98% rename from elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/support/WeekTimes.java rename to elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/support/WeekTimes.java index 994926f2056..3dafaaa0b09 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/support/WeekTimes.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/support/WeekTimes.java @@ -3,7 +3,7 @@ * 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.xpack.watcher.trigger.schedule.support; +package org.elasticsearch.xpack.trigger.schedule.support; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.ParseFieldMatcher; @@ -18,7 +18,7 @@ import java.util.HashSet; import java.util.Set; import static org.elasticsearch.common.util.set.Sets.newHashSet; -import static org.elasticsearch.xpack.watcher.support.Strings.join; +import static org.elasticsearch.xpack.support.Strings.join; /** * diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/support/YearTimes.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/support/YearTimes.java similarity index 97% rename from elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/support/YearTimes.java rename to elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/support/YearTimes.java index 57396b43d87..c0f38e36b3c 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/support/YearTimes.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/support/YearTimes.java @@ -3,7 +3,7 @@ * 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.xpack.watcher.trigger.schedule.support; +package org.elasticsearch.xpack.trigger.schedule.support; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.ParseFieldMatcher; @@ -21,8 +21,8 @@ import java.util.Locale; import java.util.Set; import static org.elasticsearch.common.util.set.Sets.newHashSet; -import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument; -import static org.elasticsearch.xpack.watcher.support.Strings.join; +import static org.elasticsearch.xpack.support.Exceptions.illegalArgument; +import static org.elasticsearch.xpack.support.Strings.join; /** * diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/tool/CronEvalTool.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/tool/CronEvalTool.java similarity index 95% rename from elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/tool/CronEvalTool.java rename to elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/tool/CronEvalTool.java index ef424056d39..c5d5bf5d8e6 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/tool/CronEvalTool.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/trigger/schedule/tool/CronEvalTool.java @@ -3,7 +3,7 @@ * 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.xpack.watcher.trigger.schedule.tool; +package org.elasticsearch.xpack.trigger.schedule.tool; import java.util.Arrays; import java.util.List; @@ -14,7 +14,7 @@ import org.elasticsearch.cli.Command; import org.elasticsearch.cli.ExitCodes; import org.elasticsearch.cli.UserError; import org.elasticsearch.cli.Terminal; -import org.elasticsearch.xpack.watcher.trigger.schedule.Cron; +import org.elasticsearch.xpack.trigger.schedule.Cron; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; import org.joda.time.format.DateTimeFormat; diff --git a/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/common/text/TextTemplateTests.java b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/common/text/TextTemplateTests.java index cc2199b79a5..d1cd9d4309c 100644 --- a/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/common/text/TextTemplateTests.java +++ b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/common/text/TextTemplateTests.java @@ -27,7 +27,7 @@ import java.util.Map; import static java.util.Collections.singletonMap; import static java.util.Collections.unmodifiableMap; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; -import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument; +import static org.elasticsearch.xpack.support.Exceptions.illegalArgument; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; diff --git a/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/notification/email/EmailSecretsIntegrationTests.java b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/notification/email/EmailSecretsIntegrationTests.java index ca67ea0c78a..a47ddfc44ca 100644 --- a/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/notification/email/EmailSecretsIntegrationTests.java +++ b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/notification/email/EmailSecretsIntegrationTests.java @@ -15,8 +15,8 @@ import org.elasticsearch.xpack.watcher.support.xcontent.XContentSource; import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase; import org.elasticsearch.xpack.watcher.transport.actions.execute.ExecuteWatchResponse; import org.elasticsearch.xpack.watcher.transport.actions.get.GetWatchResponse; -import org.elasticsearch.xpack.watcher.trigger.TriggerEvent; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent; +import org.elasticsearch.xpack.trigger.TriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent; import org.elasticsearch.xpack.watcher.watch.WatchStore; import org.elasticsearch.xpack.notification.email.support.EmailServer; import org.joda.time.DateTime; @@ -32,8 +32,8 @@ import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.emailAction import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBuilder; import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.alwaysCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.cron; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.cron; import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.not; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/support/WatcherDateTimeUtilsTests.java b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/support/DateTimeUtilsTests.java similarity index 76% rename from elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/support/WatcherDateTimeUtilsTests.java rename to elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/support/DateTimeUtilsTests.java index 13a2458ccb6..c99aced059f 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/support/WatcherDateTimeUtilsTests.java +++ b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/support/DateTimeUtilsTests.java @@ -3,7 +3,7 @@ * 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.xpack.watcher.support; +package org.elasticsearch.xpack.support; import org.elasticsearch.ElasticsearchParseException; @@ -22,7 +22,6 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.MINUTES; import static java.util.concurrent.TimeUnit.SECONDS; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; -import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.xContentParser; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.Matchers.either; import static org.hamcrest.Matchers.is; @@ -31,7 +30,7 @@ import static org.hamcrest.Matchers.notNullValue; /** * */ -public class WatcherDateTimeUtilsTests extends ESTestCase { +public class DateTimeUtilsTests extends ESTestCase { public void testParseTimeValueNumeric() throws Exception { TimeValue value = new TimeValue(randomInt(100), randomFrom(TimeUnit.values())); long millis = value.getMillis(); @@ -41,13 +40,14 @@ public class WatcherDateTimeUtilsTests extends ESTestCase { } else { xContentBuilder.field("value", Long.toString(millis)); } - XContentParser parser = xContentParser(xContentBuilder.endObject()); + final XContentBuilder builder = xContentBuilder.endObject(); + XContentParser parser = builder.contentType().xContent().createParser(builder.bytes()); parser.nextToken(); // start object parser.nextToken(); // field name parser.nextToken(); // value try { - WatcherDateTimeUtils.parseTimeValue(parser, "test"); + DateTimeUtils.parseTimeValue(parser, "test"); fail("Expected ElasticsearchParseException"); } catch (ElasticsearchParseException e) { assertThat(e.getMessage(), either(is("failed to parse time unit")) @@ -58,13 +58,14 @@ public class WatcherDateTimeUtilsTests extends ESTestCase { public void testParseTimeValueNumericNegative() throws Exception { TimeValue value = new TimeValue(randomIntBetween(1, 100), randomFrom(MILLISECONDS, SECONDS, MINUTES, HOURS, DAYS)); - XContentParser parser = xContentParser(jsonBuilder().startObject().field("value", -1 * value.getMillis()).endObject()); + final XContentBuilder builder = jsonBuilder().startObject().field("value", -1 * value.getMillis()).endObject(); + XContentParser parser = builder.contentType().xContent().createParser(builder.bytes()); parser.nextToken(); // start object parser.nextToken(); // field name parser.nextToken(); // value try { - WatcherDateTimeUtils.parseTimeValue(parser, "test"); + DateTimeUtils.parseTimeValue(parser, "test"); fail("Expected ElasticsearchParseException"); } catch (ElasticsearchParseException e) { assertThat(e.getMessage(), @@ -81,12 +82,13 @@ public class WatcherDateTimeUtilsTests extends ESTestCase { String key = randomFrom(values.keySet().toArray(new String[values.size()])); - XContentParser parser = xContentParser(jsonBuilder().startObject().field("value", key).endObject()); + final XContentBuilder builder = jsonBuilder().startObject().field("value", key).endObject(); + XContentParser parser = builder.contentType().xContent().createParser(builder.bytes()); parser.nextToken(); // start object parser.nextToken(); // field name parser.nextToken(); // value - TimeValue parsed = WatcherDateTimeUtils.parseTimeValue(parser, "test"); + TimeValue parsed = DateTimeUtils.parseTimeValue(parser, "test"); assertThat(parsed, notNullValue()); assertThat(parsed.millis(), is(values.get(key).millis())); } @@ -100,13 +102,14 @@ public class WatcherDateTimeUtilsTests extends ESTestCase { String key = randomFrom(values.keySet().toArray(new String[values.size()])); - XContentParser parser = xContentParser(jsonBuilder().startObject().field("value", key).endObject()); + final XContentBuilder builder = jsonBuilder().startObject().field("value", key).endObject(); + XContentParser parser = builder.contentType().xContent().createParser(builder.bytes()); parser.nextToken(); // start object parser.nextToken(); // field name parser.nextToken(); // value try { - WatcherDateTimeUtils.parseTimeValue(parser, "test"); + DateTimeUtils.parseTimeValue(parser, "test"); fail("Expected ElasticsearchParseException"); } catch (ElasticsearchParseException e) { assertThat(e.getMessage(), is("failed to parse time unit")); @@ -114,12 +117,13 @@ public class WatcherDateTimeUtilsTests extends ESTestCase { } public void testParseTimeValueNull() throws Exception { - XContentParser parser = xContentParser(jsonBuilder().startObject().nullField("value").endObject()); + final XContentBuilder builder = jsonBuilder().startObject().nullField("value").endObject(); + XContentParser parser = builder.contentType().xContent().createParser(builder.bytes()); parser.nextToken(); // start object parser.nextToken(); // field name parser.nextToken(); // value - TimeValue parsed = WatcherDateTimeUtils.parseTimeValue(parser, "test"); + TimeValue parsed = DateTimeUtils.parseTimeValue(parser, "test"); assertThat(parsed, nullValue()); } } diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/ScheduleTriggerEngineMock.java b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/ScheduleTriggerEngineMock.java similarity index 87% rename from elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/ScheduleTriggerEngineMock.java rename to elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/ScheduleTriggerEngineMock.java index 16a87d205bb..f6f27e29c4f 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/ScheduleTriggerEngineMock.java +++ b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/ScheduleTriggerEngineMock.java @@ -3,7 +3,7 @@ * 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.xpack.watcher.trigger; +package org.elasticsearch.xpack.trigger; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.logging.ESLogger; @@ -13,10 +13,10 @@ import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.xpack.support.clock.Clock; import org.elasticsearch.xpack.support.clock.ClockMock; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleRegistry; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTrigger; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEngine; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.ScheduleRegistry; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTrigger; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEngine; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; @@ -48,9 +48,9 @@ public class ScheduleTriggerEngineMock extends ScheduleTriggerEngine { } @Override - public ScheduleTriggerEvent parseTriggerEvent(TriggerService service, String watchId, String context, + public ScheduleTriggerEvent parseTriggerEvent(TriggerService service, String id, String context, XContentParser parser) throws IOException { - return ScheduleTriggerEvent.parse(parser, watchId, context, clock); + return ScheduleTriggerEvent.parse(parser, id, context, clock); } @Override diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/CronScheduleTests.java b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/CronScheduleTests.java similarity index 98% rename from elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/CronScheduleTests.java rename to elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/CronScheduleTests.java index c029f7052b0..707a0b1df79 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/CronScheduleTests.java +++ b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/CronScheduleTests.java @@ -3,7 +3,7 @@ * 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.xpack.watcher.trigger.schedule; +package org.elasticsearch.xpack.trigger.schedule; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.bytes.BytesReference; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/DailyScheduleTests.java b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/DailyScheduleTests.java similarity index 97% rename from elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/DailyScheduleTests.java rename to elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/DailyScheduleTests.java index 18d6ee385f6..6c4e0ae68ac 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/DailyScheduleTests.java +++ b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/DailyScheduleTests.java @@ -3,17 +3,17 @@ * 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.xpack.watcher.trigger.schedule; +package org.elasticsearch.xpack.trigger.schedule; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.json.JsonXContent; -import org.elasticsearch.xpack.watcher.trigger.schedule.support.DayTimes; +import org.elasticsearch.xpack.trigger.schedule.support.DayTimes; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; -import static org.elasticsearch.xpack.watcher.support.Strings.join; +import static org.elasticsearch.xpack.support.Strings.join; import static org.hamcrest.Matchers.arrayContaining; import static org.hamcrest.Matchers.arrayWithSize; import static org.hamcrest.Matchers.containsString; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/HourlyScheduleTests.java b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/HourlyScheduleTests.java similarity index 98% rename from elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/HourlyScheduleTests.java rename to elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/HourlyScheduleTests.java index 6602729b3f5..237db7dd57c 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/HourlyScheduleTests.java +++ b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/HourlyScheduleTests.java @@ -3,14 +3,14 @@ * 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.xpack.watcher.trigger.schedule; +package org.elasticsearch.xpack.trigger.schedule; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.json.JsonXContent; -import org.elasticsearch.xpack.watcher.support.Strings; +import org.elasticsearch.xpack.support.Strings; import java.util.Arrays; import java.util.stream.Collectors; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/IntervalScheduleTests.java b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/IntervalScheduleTests.java similarity index 98% rename from elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/IntervalScheduleTests.java rename to elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/IntervalScheduleTests.java index dec68cf1101..4c4096cbc2a 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/IntervalScheduleTests.java +++ b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/IntervalScheduleTests.java @@ -3,7 +3,7 @@ * 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.xpack.watcher.trigger.schedule; +package org.elasticsearch.xpack.trigger.schedule; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.bytes.BytesReference; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/MonthlyScheduleTests.java b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/MonthlyScheduleTests.java similarity index 96% rename from elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/MonthlyScheduleTests.java rename to elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/MonthlyScheduleTests.java index c361a5a7d28..400f7455cb0 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/MonthlyScheduleTests.java +++ b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/MonthlyScheduleTests.java @@ -3,18 +3,18 @@ * 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.xpack.watcher.trigger.schedule; +package org.elasticsearch.xpack.trigger.schedule; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.json.JsonXContent; -import org.elasticsearch.xpack.watcher.trigger.schedule.support.DayTimes; -import org.elasticsearch.xpack.watcher.trigger.schedule.support.MonthTimes; +import org.elasticsearch.xpack.trigger.schedule.support.DayTimes; +import org.elasticsearch.xpack.trigger.schedule.support.MonthTimes; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; -import static org.elasticsearch.xpack.watcher.support.Strings.join; +import static org.elasticsearch.xpack.support.Strings.join; import static org.hamcrest.Matchers.arrayContaining; import static org.hamcrest.Matchers.arrayWithSize; import static org.hamcrest.Matchers.hasItemInArray; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/ScheduleRegistryTests.java b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/ScheduleRegistryTests.java similarity index 98% rename from elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/ScheduleRegistryTests.java rename to elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/ScheduleRegistryTests.java index 6bdb46868ea..affc55dad96 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/ScheduleRegistryTests.java +++ b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/ScheduleRegistryTests.java @@ -3,7 +3,7 @@ * 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.xpack.watcher.trigger.schedule; +package org.elasticsearch.xpack.trigger.schedule; import org.elasticsearch.common.bytes.BytesReference; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/ScheduleTestCase.java b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/ScheduleTestCase.java similarity index 85% rename from elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/ScheduleTestCase.java rename to elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/ScheduleTestCase.java index d9a8e9bad07..868f1f2a5b8 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/ScheduleTestCase.java +++ b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/ScheduleTestCase.java @@ -3,29 +3,26 @@ * 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.xpack.watcher.trigger.schedule; +package org.elasticsearch.xpack.trigger.schedule; import org.elasticsearch.common.util.CollectionUtils; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.watcher.trigger.schedule.support.DayOfWeek; -import org.elasticsearch.xpack.watcher.trigger.schedule.support.DayTimes; -import org.elasticsearch.xpack.watcher.trigger.schedule.support.Month; -import org.elasticsearch.xpack.watcher.trigger.schedule.support.MonthTimes; -import org.elasticsearch.xpack.watcher.trigger.schedule.support.WeekTimes; -import org.elasticsearch.xpack.watcher.trigger.schedule.support.YearTimes; +import org.elasticsearch.xpack.trigger.schedule.support.DayOfWeek; +import org.elasticsearch.xpack.trigger.schedule.support.DayTimes; +import org.elasticsearch.xpack.trigger.schedule.support.Month; +import org.elasticsearch.xpack.trigger.schedule.support.MonthTimes; +import org.elasticsearch.xpack.trigger.schedule.support.WeekTimes; +import org.elasticsearch.xpack.trigger.schedule.support.YearTimes; import java.io.IOException; import java.util.EnumSet; import java.util.HashSet; import java.util.Set; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.daily; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.hourly; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.monthly; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.weekly; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.hourly; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; /** * @@ -46,44 +43,44 @@ public abstract class ScheduleTestCase extends ESTestCase { protected static MonthlySchedule randomMonthlySchedule() { switch (randomIntBetween(1, 4)) { - case 1: return monthly().build(); - case 2: return monthly().time(MonthTimes.builder().atMidnight()).build(); - case 3: return monthly().time(MonthTimes.builder().on(randomIntBetween(1, 31)).atMidnight()).build(); + case 1: return Schedules.monthly().build(); + case 2: return Schedules.monthly().time(MonthTimes.builder().atMidnight()).build(); + case 3: return Schedules.monthly().time(MonthTimes.builder().on(randomIntBetween(1, 31)).atMidnight()).build(); default: return new MonthlySchedule(validMonthTimes()); } } protected static WeeklySchedule randomWeeklySchedule() { switch (randomIntBetween(1, 4)) { - case 1: return weekly().build(); - case 2: return weekly().time(WeekTimes.builder().atMidnight()).build(); - case 3: return weekly().time(WeekTimes.builder().on(DayOfWeek.THURSDAY).atMidnight()).build(); + case 1: return Schedules.weekly().build(); + case 2: return Schedules.weekly().time(WeekTimes.builder().atMidnight()).build(); + case 3: return Schedules.weekly().time(WeekTimes.builder().on(DayOfWeek.THURSDAY).atMidnight()).build(); default: return new WeeklySchedule(validWeekTimes()); } } protected static DailySchedule randomDailySchedule() { switch (randomIntBetween(1, 4)) { - case 1: return daily().build(); - case 2: return daily().atMidnight().build(); - case 3: return daily().atNoon().build(); + case 1: return Schedules.daily().build(); + case 2: return Schedules.daily().atMidnight().build(); + case 3: return Schedules.daily().atNoon().build(); default: return new DailySchedule(validDayTimes()); } } protected static HourlySchedule randomHourlySchedule() { switch (randomIntBetween(1, 4)) { - case 1: return hourly().build(); - case 2: return hourly().minutes(randomIntBetween(0, 59)).build(); - case 3: return hourly(randomIntBetween(0, 59)); - default: return hourly().minutes(validMinutes()).build(); + case 1: return Schedules.hourly().build(); + case 2: return Schedules.hourly().minutes(randomIntBetween(0, 59)).build(); + case 3: return Schedules.hourly(randomIntBetween(0, 59)); + default: return Schedules.hourly().minutes(validMinutes()).build(); } } protected static IntervalSchedule randomIntervalSchedule() { switch (randomIntBetween(1, 3)) { - case 1: return interval(randomInterval().toString()); - case 2: return interval(randomIntBetween(1, 100), randomIntervalUnit()); + case 1: return Schedules.interval(randomInterval().toString()); + case 2: return Schedules.interval(randomIntBetween(1, 100), randomIntervalUnit()); default: return new IntervalSchedule(randomInterval()); } } diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/ScheduleTriggerEventTests.java b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/ScheduleTriggerEventTests.java similarity index 96% rename from elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/ScheduleTriggerEventTests.java rename to elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/ScheduleTriggerEventTests.java index cb0247a3d70..9d21fc0dcfe 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/ScheduleTriggerEventTests.java +++ b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/ScheduleTriggerEventTests.java @@ -3,7 +3,7 @@ * 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.xpack.watcher.trigger.schedule; +package org.elasticsearch.xpack.trigger.schedule; import org.elasticsearch.common.xcontent.XContentBuilder; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/WeeklyScheduleTests.java b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/WeeklyScheduleTests.java similarity index 94% rename from elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/WeeklyScheduleTests.java rename to elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/WeeklyScheduleTests.java index f0033de7725..4631c03c728 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/WeeklyScheduleTests.java +++ b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/WeeklyScheduleTests.java @@ -3,7 +3,7 @@ * 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.xpack.watcher.trigger.schedule; +package org.elasticsearch.xpack.trigger.schedule; import org.elasticsearch.ElasticsearchParseException; @@ -12,12 +12,12 @@ import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.json.JsonXContent; -import org.elasticsearch.xpack.watcher.trigger.schedule.support.DayOfWeek; -import org.elasticsearch.xpack.watcher.trigger.schedule.support.DayTimes; -import org.elasticsearch.xpack.watcher.trigger.schedule.support.WeekTimes; +import org.elasticsearch.xpack.trigger.schedule.support.DayOfWeek; +import org.elasticsearch.xpack.trigger.schedule.support.DayTimes; +import org.elasticsearch.xpack.trigger.schedule.support.WeekTimes; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; -import static org.elasticsearch.xpack.watcher.support.Strings.join; +import static org.elasticsearch.xpack.support.Strings.join; import static org.hamcrest.Matchers.arrayContaining; import static org.hamcrest.Matchers.arrayWithSize; import static org.hamcrest.Matchers.contains; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/YearlyScheduleTests.java b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/YearlyScheduleTests.java similarity index 96% rename from elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/YearlyScheduleTests.java rename to elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/YearlyScheduleTests.java index d230e1122ac..3c8c9593ece 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/YearlyScheduleTests.java +++ b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/YearlyScheduleTests.java @@ -3,7 +3,7 @@ * 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.xpack.watcher.trigger.schedule; +package org.elasticsearch.xpack.trigger.schedule; import org.elasticsearch.ElasticsearchParseException; @@ -12,11 +12,11 @@ import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.json.JsonXContent; -import org.elasticsearch.xpack.watcher.trigger.schedule.support.DayTimes; -import org.elasticsearch.xpack.watcher.trigger.schedule.support.YearTimes; +import org.elasticsearch.xpack.trigger.schedule.support.DayTimes; +import org.elasticsearch.xpack.trigger.schedule.support.YearTimes; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; -import static org.elasticsearch.xpack.watcher.support.Strings.join; +import static org.elasticsearch.xpack.support.Strings.join; import static org.hamcrest.Matchers.arrayContaining; import static org.hamcrest.Matchers.arrayWithSize; import static org.hamcrest.Matchers.hasItemInArray; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/engine/BaseTriggerEngineTestCase.java b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/engine/BaseTriggerEngineTestCase.java similarity index 88% rename from elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/engine/BaseTriggerEngineTestCase.java rename to elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/engine/BaseTriggerEngineTestCase.java index 5d5040a7fda..4d5dbb303d6 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/engine/BaseTriggerEngineTestCase.java +++ b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/engine/BaseTriggerEngineTestCase.java @@ -3,17 +3,18 @@ * 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.xpack.watcher.trigger.schedule.engine; +package org.elasticsearch.xpack.trigger.schedule.engine; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.xpack.support.clock.SystemClock; -import org.elasticsearch.xpack.watcher.trigger.Trigger; -import org.elasticsearch.xpack.watcher.trigger.TriggerEngine; -import org.elasticsearch.xpack.watcher.trigger.TriggerEvent; -import org.elasticsearch.xpack.watcher.trigger.schedule.Schedule; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTrigger; -import org.elasticsearch.xpack.watcher.trigger.schedule.support.DayOfWeek; -import org.elasticsearch.xpack.watcher.trigger.schedule.support.WeekTimes; +import org.elasticsearch.xpack.trigger.Trigger; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTrigger; +import org.elasticsearch.xpack.trigger.schedule.Schedules; +import org.elasticsearch.xpack.trigger.TriggerEngine; +import org.elasticsearch.xpack.trigger.TriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.Schedule; +import org.elasticsearch.xpack.trigger.schedule.support.DayOfWeek; +import org.elasticsearch.xpack.trigger.schedule.support.WeekTimes; import org.joda.time.DateTime; import org.junit.After; import org.junit.Before; @@ -25,10 +26,6 @@ import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.daily; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.hourly; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.weekly; import static org.hamcrest.Matchers.is; import static org.joda.time.DateTimeZone.UTC; @@ -52,7 +49,7 @@ public abstract class BaseTriggerEngineTestCase extends ESTestCase { final CountDownLatch latch = new CountDownLatch(count); List jobs = new ArrayList<>(); for (int i = 0; i < count; i++) { - jobs.add(new SimpleJob(String.valueOf(i), interval("1s"))); + jobs.add(new SimpleJob(String.valueOf(i), Schedules.interval("1s"))); } final BitSet bits = new BitSet(count); engine.register(new TriggerEngine.Listener() { @@ -104,7 +101,7 @@ public abstract class BaseTriggerEngineTestCase extends ESTestCase { int minute = minOfHour.value; logger.info("scheduling hourly job [{}]", minute); logger.info("current date [{}]", now); - engine.add(new SimpleJob(name, hourly(minute))); + engine.add(new SimpleJob(name, Schedules.hourly(minute))); long secondsToWait = now.getSecondOfMinute() < 29 ? 62 - now.getSecondOfMinute() : 122 - now.getSecondOfMinute(); logger.info("waiting at least [{}] seconds for response", secondsToWait); if (!latch.await(secondsToWait, TimeUnit.SECONDS)) { @@ -138,7 +135,7 @@ public abstract class BaseTriggerEngineTestCase extends ESTestCase { int hour = hourOfDay.value; logger.info("scheduling hourly job [{}:{}]", hour, minute); logger.info("current date [{}]", now); - engine.add(new SimpleJob(name, daily().at(hour, minute).build())); + engine.add(new SimpleJob(name, Schedules.daily().at(hour, minute).build())); // 30 sec is the default idle time for the scheduler long secondsToWait = now.getSecondOfMinute() < 29 ? 62 - now.getSecondOfMinute() : 122 - now.getSecondOfMinute(); logger.info("waiting at least [{}] seconds for response", secondsToWait); @@ -175,7 +172,7 @@ public abstract class BaseTriggerEngineTestCase extends ESTestCase { DayOfWeek day = dayOfWeek.day(); logger.info("scheduling hourly job [{} {}:{}]", day, hour, minute); logger.info("current date [{}]", now); - engine.add(new SimpleJob(name, weekly().time(WeekTimes.builder().on(day).at(hour, minute).build()).build())); + engine.add(new SimpleJob(name, Schedules.weekly().time(WeekTimes.builder().on(day).at(hour, minute).build()).build())); // 30 sec is the default idle time for the scheduler long secondsToWait = now.getSecondOfMinute() < 29 ? 62 - now.getSecondOfMinute() : 122 - now.getSecondOfMinute(); logger.info("waiting at least [{}] seconds for response", secondsToWait); @@ -196,7 +193,7 @@ public abstract class BaseTriggerEngineTestCase extends ESTestCase { int times = scaledRandomIntBetween(3, 30); for (int i = 0; i < times; i++) { - engine.add(new SimpleJob("_id", interval("10s"))); + engine.add(new SimpleJob("_id", Schedules.interval("10s"))); } } diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/engine/SchedulerScheduleEngineTests.java b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/engine/SchedulerScheduleEngineTests.java similarity index 80% rename from elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/engine/SchedulerScheduleEngineTests.java rename to elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/engine/SchedulerScheduleEngineTests.java index cdb7a9d0598..e8759263426 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/engine/SchedulerScheduleEngineTests.java +++ b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/engine/SchedulerScheduleEngineTests.java @@ -3,13 +3,13 @@ * 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.xpack.watcher.trigger.schedule.engine; +package org.elasticsearch.xpack.trigger.schedule.engine; import org.apache.lucene.util.LuceneTestCase.BadApple; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.xpack.support.clock.SystemClock; -import org.elasticsearch.xpack.watcher.trigger.TriggerEngine; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleRegistry; +import org.elasticsearch.xpack.trigger.TriggerEngine; +import org.elasticsearch.xpack.trigger.schedule.ScheduleRegistry; import static org.mockito.Mockito.mock; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/engine/TickerScheduleEngineTests.java b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/engine/TickerScheduleEngineTests.java similarity index 80% rename from elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/engine/TickerScheduleEngineTests.java rename to elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/engine/TickerScheduleEngineTests.java index 883e41600d6..c28bf098ed0 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/engine/TickerScheduleEngineTests.java +++ b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/engine/TickerScheduleEngineTests.java @@ -3,13 +3,13 @@ * 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.xpack.watcher.trigger.schedule.engine; +package org.elasticsearch.xpack.trigger.schedule.engine; import org.apache.lucene.util.LuceneTestCase.BadApple; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.xpack.support.clock.SystemClock; -import org.elasticsearch.xpack.watcher.trigger.TriggerEngine; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleRegistry; +import org.elasticsearch.xpack.trigger.schedule.ScheduleRegistry; +import org.elasticsearch.xpack.trigger.TriggerEngine; import static org.mockito.Mockito.mock; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/tool/CronEvalToolTests.java b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/tool/CronEvalToolTests.java similarity index 93% rename from elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/tool/CronEvalToolTests.java rename to elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/tool/CronEvalToolTests.java index 22388424948..0aa1af20be2 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/tool/CronEvalToolTests.java +++ b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/tool/CronEvalToolTests.java @@ -3,7 +3,7 @@ * 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.xpack.watcher.trigger.schedule.tool; +package org.elasticsearch.xpack.trigger.schedule.tool; import org.elasticsearch.cli.Command; import org.elasticsearch.cli.CommandTestCase; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/tool/EvalCron.java b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/tool/EvalCron.java similarity index 89% rename from elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/tool/EvalCron.java rename to elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/tool/EvalCron.java index 8d945304116..10d96e267a8 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/tool/EvalCron.java +++ b/elasticsearch/x-pack/src/test/java/org/elasticsearch/xpack/trigger/schedule/tool/EvalCron.java @@ -3,7 +3,7 @@ * 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.xpack.watcher.trigger.schedule.tool; +package org.elasticsearch.xpack.trigger.schedule.tool; import org.elasticsearch.cli.Terminal; diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/Watcher.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/Watcher.java index 3852826defd..e4d6ae942df 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/Watcher.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/Watcher.java @@ -63,8 +63,8 @@ import org.elasticsearch.xpack.watcher.transport.actions.service.TransportWatche import org.elasticsearch.xpack.watcher.transport.actions.service.WatcherServiceAction; import org.elasticsearch.xpack.watcher.transport.actions.stats.TransportWatcherStatsAction; import org.elasticsearch.xpack.watcher.transport.actions.stats.WatcherStatsAction; -import org.elasticsearch.xpack.watcher.trigger.TriggerModule; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleModule; +import org.elasticsearch.xpack.trigger.TriggerModule; +import org.elasticsearch.xpack.trigger.schedule.ScheduleModule; import org.elasticsearch.xpack.watcher.watch.WatchModule; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/WatcherService.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/WatcherService.java index aa1016d3b92..18a1fd2deb8 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/WatcherService.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/WatcherService.java @@ -18,7 +18,7 @@ import org.elasticsearch.index.engine.VersionConflictEngineException; import org.elasticsearch.xpack.watcher.execution.ExecutionService; import org.elasticsearch.xpack.watcher.support.WatcherIndexTemplateRegistry; import org.elasticsearch.xpack.support.clock.Clock; -import org.elasticsearch.xpack.watcher.trigger.TriggerService; +import org.elasticsearch.xpack.trigger.TriggerService; import org.elasticsearch.xpack.watcher.watch.Watch; import org.elasticsearch.xpack.watcher.watch.WatchLockService; import org.elasticsearch.xpack.watcher.watch.WatchStatus; @@ -30,9 +30,9 @@ import org.joda.time.PeriodType; import java.io.IOException; import java.util.concurrent.atomic.AtomicReference; -import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument; -import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalState; -import static org.elasticsearch.xpack.watcher.support.Exceptions.ioException; +import static org.elasticsearch.xpack.support.Exceptions.illegalArgument; +import static org.elasticsearch.xpack.support.Exceptions.illegalState; +import static org.elasticsearch.xpack.support.Exceptions.ioException; public class WatcherService extends AbstractComponent { diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/actions/ActionStatus.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/actions/ActionStatus.java index 1e6bc061dce..c3b15c01759 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/actions/ActionStatus.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/actions/ActionStatus.java @@ -21,8 +21,8 @@ import java.io.IOException; import java.util.Locale; import java.util.Objects; -import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument; -import static org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils.dateTimeFormatter; +import static org.elasticsearch.xpack.support.Exceptions.illegalArgument; +import static org.elasticsearch.xpack.support.DateTimeUtils.dateTimeFormatter; /** * diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/actions/ActionWrapper.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/actions/ActionWrapper.java index a2ff6376685..d36795a139d 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/actions/ActionWrapper.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/actions/ActionWrapper.java @@ -18,7 +18,7 @@ import org.elasticsearch.xpack.watcher.actions.throttler.ActionThrottler; import org.elasticsearch.xpack.watcher.actions.throttler.Throttler; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; import org.elasticsearch.xpack.watcher.WatcherLicensee; -import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils; +import org.elasticsearch.xpack.support.DateTimeUtils; import org.elasticsearch.xpack.support.clock.Clock; import org.elasticsearch.xpack.watcher.transform.ExecutableTransform; import org.elasticsearch.xpack.watcher.transform.Transform; @@ -158,7 +158,7 @@ public class ActionWrapper implements ToXContent { transform = transformRegistry.parse(watchId, parser); } else if (ParseFieldMatcher.STRICT.match(currentFieldName, Throttler.Field.THROTTLE_PERIOD)) { try { - throttlePeriod = WatcherDateTimeUtils.parseTimeValue(parser, Throttler.Field.THROTTLE_PERIOD.toString()); + throttlePeriod = DateTimeUtils.parseTimeValue(parser, Throttler.Field.THROTTLE_PERIOD.toString()); } catch (ElasticsearchParseException pe) { throw new ElasticsearchParseException("could not parse action [{}/{}]. failed to parse field [{}] as time value", pe, watchId, actionId, currentFieldName); diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/actions/index/ExecutableIndexAction.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/actions/index/ExecutableIndexAction.java index 1b90a7d10b6..e46a83b7e69 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/actions/index/ExecutableIndexAction.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/actions/index/ExecutableIndexAction.java @@ -20,7 +20,7 @@ import org.elasticsearch.xpack.watcher.actions.Action; import org.elasticsearch.xpack.watcher.actions.ExecutableAction; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; import org.elasticsearch.xpack.watcher.support.ArrayObjectIterator; -import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils; +import org.elasticsearch.xpack.support.DateTimeUtils; import org.elasticsearch.xpack.watcher.support.init.proxy.WatcherClientProxy; import org.elasticsearch.xpack.watcher.support.xcontent.XContentSource; import org.elasticsearch.xpack.watcher.watch.Payload; @@ -30,7 +30,7 @@ import java.util.HashMap; import java.util.Map; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; -import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalState; +import static org.elasticsearch.xpack.support.Exceptions.illegalState; public class ExecutableIndexAction extends ExecutableAction { @@ -71,9 +71,9 @@ public class ExecutableIndexAction extends ExecutableAction { if (!(data instanceof HashMap)) { data = new HashMap<>(data); // ensuring mutability } - data.put(action.executionTimeField, WatcherDateTimeUtils.formatDate(ctx.executionTime())); + data.put(action.executionTimeField, DateTimeUtils.formatDate(ctx.executionTime())); } else { - indexRequest.timestamp(WatcherDateTimeUtils.formatDate(ctx.executionTime())); + indexRequest.timestamp(DateTimeUtils.formatDate(ctx.executionTime())); } indexRequest.source(jsonBuilder().prettyPrint().map(data)); @@ -104,9 +104,9 @@ public class ExecutableIndexAction extends ExecutableAction { if (!(doc instanceof HashMap)) { doc = new HashMap<>(doc); // ensuring mutability } - doc.put(action.executionTimeField, WatcherDateTimeUtils.formatDate(ctx.executionTime())); + doc.put(action.executionTimeField, DateTimeUtils.formatDate(ctx.executionTime())); } else { - indexRequest.timestamp(WatcherDateTimeUtils.formatDate(ctx.executionTime())); + indexRequest.timestamp(DateTimeUtils.formatDate(ctx.executionTime())); } indexRequest.source(jsonBuilder().prettyPrint().map(doc)); bulkRequest.add(indexRequest); diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/actions/index/IndexAction.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/actions/index/IndexAction.java index df402b63c6e..58c3fb6195b 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/actions/index/IndexAction.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/actions/index/IndexAction.java @@ -13,7 +13,7 @@ import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.xpack.watcher.actions.Action; -import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils; +import org.elasticsearch.xpack.support.DateTimeUtils; import org.elasticsearch.xpack.watcher.support.xcontent.XContentSource; import org.joda.time.DateTimeZone; @@ -129,7 +129,7 @@ public class IndexAction implements Action { } else if (ParseFieldMatcher.STRICT.match(currentFieldName, Field.EXECUTION_TIME_FIELD)) { executionTimeField = parser.text(); } else if (ParseFieldMatcher.STRICT.match(currentFieldName, Field.TIMEOUT)) { - timeout = WatcherDateTimeUtils.parseTimeValue(parser, Field.TIMEOUT.toString()); + timeout = DateTimeUtils.parseTimeValue(parser, Field.TIMEOUT.toString()); } else if (ParseFieldMatcher.STRICT.match(currentFieldName, Field.DYNAMIC_NAME_TIMEZONE)) { if (token == XContentParser.Token.VALUE_STRING) { dynamicNameTimeZone = DateTimeZone.forID(parser.text()); diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/actions/throttler/AckThrottler.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/actions/throttler/AckThrottler.java index bb78e8ec111..29df5177f42 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/actions/throttler/AckThrottler.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/actions/throttler/AckThrottler.java @@ -9,7 +9,7 @@ import org.elasticsearch.xpack.watcher.actions.ActionStatus; import org.elasticsearch.xpack.watcher.actions.ActionStatus.AckStatus; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; -import static org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils.formatDate; +import static org.elasticsearch.xpack.support.DateTimeUtils.formatDate; /** * diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/client/WatchSourceBuilder.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/client/WatchSourceBuilder.java index f2e7758383e..283e0e4d512 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/client/WatchSourceBuilder.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/client/WatchSourceBuilder.java @@ -19,10 +19,10 @@ import org.elasticsearch.xpack.watcher.condition.Condition; import org.elasticsearch.xpack.watcher.condition.always.AlwaysCondition; import org.elasticsearch.xpack.watcher.input.Input; import org.elasticsearch.xpack.watcher.input.none.NoneInput; -import org.elasticsearch.xpack.watcher.support.Exceptions; +import org.elasticsearch.xpack.support.Exceptions; import org.elasticsearch.xpack.watcher.support.xcontent.XContentSource; import org.elasticsearch.xpack.watcher.transform.Transform; -import org.elasticsearch.xpack.watcher.trigger.Trigger; +import org.elasticsearch.xpack.trigger.Trigger; import org.elasticsearch.xpack.watcher.watch.Watch; import java.io.IOException; diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/condition/compare/AbstractExecutableCompareCondition.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/condition/compare/AbstractExecutableCompareCondition.java index 6cf82fc55bf..8db4918c4b5 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/condition/compare/AbstractExecutableCompareCondition.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/condition/compare/AbstractExecutableCompareCondition.java @@ -10,7 +10,7 @@ import org.elasticsearch.xpack.watcher.condition.Condition; import org.elasticsearch.xpack.watcher.condition.ExecutableCondition; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; import org.elasticsearch.xpack.watcher.support.Variables; -import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils; +import org.elasticsearch.xpack.support.DateTimeUtils; import org.elasticsearch.xpack.support.clock.Clock; import org.elasticsearch.xpack.watcher.support.xcontent.ObjectPath; import org.joda.time.DateTime; @@ -55,8 +55,8 @@ public abstract class AbstractExecutableCompareCondition { diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/ExecutionModule.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/ExecutionModule.java index 7a9c70113e4..9caccd968cb 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/ExecutionModule.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/ExecutionModule.java @@ -6,7 +6,7 @@ package org.elasticsearch.xpack.watcher.execution; import org.elasticsearch.common.inject.AbstractModule; -import org.elasticsearch.xpack.watcher.trigger.TriggerEngine; +import org.elasticsearch.xpack.trigger.TriggerEngine; /** */ diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/ExecutionService.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/ExecutionService.java index c885773f0d6..2cc2465456c 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/ExecutionService.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/ExecutionService.java @@ -21,7 +21,7 @@ import org.elasticsearch.xpack.watcher.input.Input; import org.elasticsearch.xpack.support.clock.Clock; import org.elasticsearch.xpack.watcher.support.validation.WatcherSettingsValidation; import org.elasticsearch.xpack.watcher.transform.Transform; -import org.elasticsearch.xpack.watcher.trigger.TriggerEvent; +import org.elasticsearch.xpack.trigger.TriggerEvent; import org.elasticsearch.xpack.watcher.watch.Watch; import org.elasticsearch.xpack.watcher.watch.WatchLockService; import org.elasticsearch.xpack.watcher.watch.WatchStore; diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/ManualExecutionContext.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/ManualExecutionContext.java index d424c4e105f..f4c0dc77ce7 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/ManualExecutionContext.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/ManualExecutionContext.java @@ -10,7 +10,7 @@ import org.elasticsearch.xpack.watcher.actions.Action; import org.elasticsearch.xpack.watcher.actions.ActionWrapper; import org.elasticsearch.xpack.watcher.condition.Condition; import org.elasticsearch.xpack.watcher.input.Input; -import org.elasticsearch.xpack.watcher.trigger.manual.ManualTriggerEvent; +import org.elasticsearch.xpack.trigger.manual.ManualTriggerEvent; import org.elasticsearch.xpack.watcher.watch.Watch; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/SyncTriggerListener.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/SyncTriggerListener.java index 36c28fc142e..31aced50c13 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/SyncTriggerListener.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/SyncTriggerListener.java @@ -9,9 +9,9 @@ import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.xpack.watcher.trigger.TriggerEngine; -import org.elasticsearch.xpack.watcher.trigger.TriggerEvent; -import org.elasticsearch.xpack.watcher.trigger.TriggerService; +import org.elasticsearch.xpack.trigger.TriggerEngine; +import org.elasticsearch.xpack.trigger.TriggerEvent; +import org.elasticsearch.xpack.trigger.TriggerService; import java.util.stream.StreamSupport; diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/TriggeredExecutionContext.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/TriggeredExecutionContext.java index b3d7ee82030..3bfc0b2b484 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/TriggeredExecutionContext.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/TriggeredExecutionContext.java @@ -6,7 +6,7 @@ package org.elasticsearch.xpack.watcher.execution; import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.xpack.watcher.trigger.TriggerEvent; +import org.elasticsearch.xpack.trigger.TriggerEvent; import org.elasticsearch.xpack.watcher.watch.Watch; import org.joda.time.DateTime; diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/TriggeredWatch.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/TriggeredWatch.java index 715735dfa7b..c23427a684c 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/TriggeredWatch.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/TriggeredWatch.java @@ -16,8 +16,8 @@ import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.watcher.trigger.TriggerEvent; -import org.elasticsearch.xpack.watcher.trigger.TriggerService; +import org.elasticsearch.xpack.trigger.TriggerEvent; +import org.elasticsearch.xpack.trigger.TriggerService; import java.io.IOException; diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/TriggeredWatchStore.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/TriggeredWatchStore.java index 5a4f6dd15bd..6dcf8d7dda1 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/TriggeredWatchStore.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/TriggeredWatchStore.java @@ -38,8 +38,8 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; -import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalState; -import static org.elasticsearch.xpack.watcher.support.Exceptions.ioException; +import static org.elasticsearch.xpack.support.Exceptions.illegalState; +import static org.elasticsearch.xpack.support.Exceptions.ioException; public class TriggeredWatchStore extends AbstractComponent { diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/WatchExecutionContext.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/WatchExecutionContext.java index 350056316c1..1bea6c187d1 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/WatchExecutionContext.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/WatchExecutionContext.java @@ -13,7 +13,7 @@ import org.elasticsearch.xpack.watcher.condition.Condition; import org.elasticsearch.xpack.watcher.history.WatchRecord; import org.elasticsearch.xpack.watcher.input.Input; import org.elasticsearch.xpack.watcher.transform.Transform; -import org.elasticsearch.xpack.watcher.trigger.TriggerEvent; +import org.elasticsearch.xpack.trigger.TriggerEvent; import org.elasticsearch.xpack.watcher.watch.Payload; import org.elasticsearch.xpack.watcher.watch.Watch; import org.joda.time.DateTime; diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/WatchExecutionResult.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/WatchExecutionResult.java index dc1abe0a297..62ffdd8cbe9 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/WatchExecutionResult.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/WatchExecutionResult.java @@ -12,7 +12,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.xpack.watcher.actions.ExecutableActions; import org.elasticsearch.xpack.watcher.condition.Condition; import org.elasticsearch.xpack.watcher.input.Input; -import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils; +import org.elasticsearch.xpack.support.DateTimeUtils; import org.elasticsearch.xpack.watcher.transform.Transform; import org.joda.time.DateTime; @@ -73,7 +73,7 @@ public class WatchExecutionResult implements ToXContent { public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(); - WatcherDateTimeUtils.writeDate(Field.EXECUTION_TIME.getPreferredName(), builder, executionTime); + DateTimeUtils.writeDate(Field.EXECUTION_TIME.getPreferredName(), builder, executionTime); builder.field(Field.EXECUTION_DURATION.getPreferredName(), executionDurationMs); if (inputResult != null) { diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/Wid.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/Wid.java index 9ccedf58014..043f37d2ca5 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/Wid.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/Wid.java @@ -9,7 +9,7 @@ import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.ISODateTimeFormat; -import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument; +import static org.elasticsearch.xpack.support.Exceptions.illegalArgument; /** * diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/history/HistoryStore.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/history/HistoryStore.java index 72ac3d09f88..a27791f5da8 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/history/HistoryStore.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/history/HistoryStore.java @@ -12,7 +12,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.engine.VersionConflictEngineException; -import org.elasticsearch.xpack.watcher.WatcherModule; import org.elasticsearch.xpack.watcher.execution.ExecutionState; import org.elasticsearch.xpack.watcher.support.WatcherIndexTemplateRegistry; import org.elasticsearch.xpack.watcher.support.init.proxy.WatcherClientProxy; @@ -26,7 +25,7 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; -import static org.elasticsearch.xpack.watcher.support.Exceptions.ioException; +import static org.elasticsearch.xpack.support.Exceptions.ioException; /** */ diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/history/WatchRecord.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/history/WatchRecord.java index bf8bdd57e57..ec66492f253 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/history/WatchRecord.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/history/WatchRecord.java @@ -17,7 +17,7 @@ import org.elasticsearch.xpack.watcher.execution.WatchExecutionResult; import org.elasticsearch.xpack.watcher.execution.Wid; import org.elasticsearch.xpack.watcher.input.ExecutableInput; import org.elasticsearch.xpack.watcher.support.xcontent.WatcherParams; -import org.elasticsearch.xpack.watcher.trigger.TriggerEvent; +import org.elasticsearch.xpack.trigger.TriggerEvent; import org.elasticsearch.xpack.watcher.watch.Watch; import java.io.IOException; diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/input/search/SearchInput.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/input/search/SearchInput.java index 71e9fff136e..0081ed344eb 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/input/search/SearchInput.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/input/search/SearchInput.java @@ -18,7 +18,7 @@ import org.elasticsearch.search.aggregations.AggregatorParsers; import org.elasticsearch.search.suggest.Suggesters; import org.elasticsearch.xpack.watcher.input.Input; import org.elasticsearch.xpack.watcher.support.SearchRequestEquivalence; -import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils; +import org.elasticsearch.xpack.support.DateTimeUtils; import org.elasticsearch.xpack.watcher.support.WatcherUtils; import org.elasticsearch.xpack.watcher.watch.Payload; import org.joda.time.DateTimeZone; @@ -149,7 +149,7 @@ public class SearchInput implements Input { watchId, currentFieldName); } } else if (ParseFieldMatcher.STRICT.match(currentFieldName, Field.TIMEOUT)) { - timeout = WatcherDateTimeUtils.parseTimeValue(parser, Field.TIMEOUT.toString()); + timeout = DateTimeUtils.parseTimeValue(parser, Field.TIMEOUT.toString()); } else if (ParseFieldMatcher.STRICT.match(currentFieldName, Field.DYNAMIC_NAME_TIMEZONE)) { if (token == XContentParser.Token.VALUE_STRING) { dynamicNameTimeZone = DateTimeZone.forID(parser.text()); diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java index 770ab071d9f..b1cd0aee7dd 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java @@ -28,7 +28,7 @@ import org.elasticsearch.xpack.watcher.support.xcontent.WatcherParams; import org.elasticsearch.xpack.watcher.transport.actions.execute.ExecuteWatchRequest; import org.elasticsearch.xpack.watcher.transport.actions.execute.ExecuteWatchRequestBuilder; import org.elasticsearch.xpack.watcher.transport.actions.execute.ExecuteWatchResponse; -import org.elasticsearch.xpack.watcher.trigger.TriggerService; +import org.elasticsearch.xpack.trigger.TriggerService; import java.io.IOException; diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/SearchRequestEquivalence.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/SearchRequestEquivalence.java index 9b7a76a3356..8a029790be5 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/SearchRequestEquivalence.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/SearchRequestEquivalence.java @@ -11,7 +11,7 @@ import org.elasticsearch.common.io.stream.BytesStreamOutput; import java.util.Arrays; -import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalState; +import static org.elasticsearch.xpack.support.Exceptions.illegalState; /** diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/WatcherUtils.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/WatcherUtils.java index 5d895c0a45c..477f0be2f0b 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/WatcherUtils.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/WatcherUtils.java @@ -6,7 +6,7 @@ package org.elasticsearch.xpack.watcher.support; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; -import static org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils.formatDate; +import static org.elasticsearch.xpack.support.DateTimeUtils.formatDate; import java.io.IOException; import java.lang.reflect.Array; diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/validation/WatcherSettingsValidation.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/validation/WatcherSettingsValidation.java index f87eb233891..0e0397a8468 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/validation/WatcherSettingsValidation.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/validation/WatcherSettingsValidation.java @@ -10,7 +10,7 @@ import org.elasticsearch.common.component.AbstractLifecycleComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.logging.LoggerMessageFormat; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.xpack.watcher.support.Exceptions; +import org.elasticsearch.xpack.support.Exceptions; import java.util.ArrayList; import java.util.List; diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/transform/script/ExecutableScriptTransform.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/transform/script/ExecutableScriptTransform.java index 11a289e0560..e4d2f71ded7 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/transform/script/ExecutableScriptTransform.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/transform/script/ExecutableScriptTransform.java @@ -18,7 +18,7 @@ import java.io.IOException; import java.util.HashMap; import java.util.Map; -import static org.elasticsearch.xpack.watcher.support.Exceptions.invalidScript; +import static org.elasticsearch.xpack.support.Exceptions.invalidScript; import static org.elasticsearch.xpack.watcher.support.Variables.createCtxModel; /** diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/transform/search/SearchTransform.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/transform/search/SearchTransform.java index 1acfdf239e9..ee4dc64c3a8 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/transform/search/SearchTransform.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/transform/search/SearchTransform.java @@ -17,7 +17,7 @@ import org.elasticsearch.index.query.QueryParseContext; import org.elasticsearch.search.aggregations.AggregatorParsers; import org.elasticsearch.search.suggest.Suggesters; import org.elasticsearch.xpack.watcher.support.SearchRequestEquivalence; -import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils; +import org.elasticsearch.xpack.support.DateTimeUtils; import org.elasticsearch.xpack.watcher.support.WatcherUtils; import org.elasticsearch.xpack.watcher.transform.Transform; import org.elasticsearch.xpack.watcher.watch.Payload; @@ -115,7 +115,7 @@ public class SearchTransform implements Transform { TYPE, watchId, currentFieldName); } } else if (ParseFieldMatcher.STRICT.match(currentFieldName, Field.TIMEOUT)) { - timeout = WatcherDateTimeUtils.parseTimeValue(parser, Field.TIMEOUT.toString()); + timeout = DateTimeUtils.parseTimeValue(parser, Field.TIMEOUT.toString()); } else if (ParseFieldMatcher.STRICT.match(currentFieldName, Field.DYNAMIC_NAME_TIMEZONE)) { if (token == XContentParser.Token.VALUE_STRING) { dynamicNameTimeZone = DateTimeZone.forID(parser.text()); diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/transport/actions/execute/ExecuteWatchRequest.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/transport/actions/execute/ExecuteWatchRequest.java index 478c0996914..666c48f828a 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/transport/actions/execute/ExecuteWatchRequest.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/transport/actions/execute/ExecuteWatchRequest.java @@ -16,7 +16,7 @@ import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.xpack.watcher.client.WatchSourceBuilder; import org.elasticsearch.xpack.watcher.execution.ActionExecutionMode; import org.elasticsearch.xpack.watcher.support.validation.Validation; -import org.elasticsearch.xpack.watcher.trigger.TriggerEvent; +import org.elasticsearch.xpack.trigger.TriggerEvent; import java.io.IOException; import java.util.HashMap; diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/transport/actions/execute/ExecuteWatchRequestBuilder.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/transport/actions/execute/ExecuteWatchRequestBuilder.java index 3ccea8ab05a..5d2ab31ebd2 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/transport/actions/execute/ExecuteWatchRequestBuilder.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/transport/actions/execute/ExecuteWatchRequestBuilder.java @@ -10,7 +10,7 @@ import org.elasticsearch.client.ElasticsearchClient; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.xpack.watcher.client.WatchSourceBuilder; import org.elasticsearch.xpack.watcher.execution.ActionExecutionMode; -import org.elasticsearch.xpack.watcher.trigger.TriggerEvent; +import org.elasticsearch.xpack.trigger.TriggerEvent; import java.io.IOException; import java.util.Map; diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/transport/actions/execute/TransportExecuteWatchAction.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/transport/actions/execute/TransportExecuteWatchAction.java index 705f07b885c..2e2c51a3566 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/transport/actions/execute/TransportExecuteWatchAction.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/transport/actions/execute/TransportExecuteWatchAction.java @@ -30,9 +30,9 @@ import org.elasticsearch.xpack.watcher.WatcherLicensee; import org.elasticsearch.xpack.support.clock.Clock; import org.elasticsearch.xpack.watcher.support.xcontent.WatcherParams; import org.elasticsearch.xpack.watcher.transport.actions.WatcherTransportAction; -import org.elasticsearch.xpack.watcher.trigger.TriggerEvent; -import org.elasticsearch.xpack.watcher.trigger.TriggerService; -import org.elasticsearch.xpack.watcher.trigger.manual.ManualTriggerEvent; +import org.elasticsearch.xpack.trigger.TriggerEvent; +import org.elasticsearch.xpack.trigger.TriggerService; +import org.elasticsearch.xpack.trigger.manual.ManualTriggerEvent; import org.elasticsearch.xpack.watcher.watch.Payload; import org.elasticsearch.xpack.watcher.watch.Watch; import org.elasticsearch.xpack.watcher.watch.WatchStore; @@ -41,7 +41,7 @@ import org.joda.time.DateTimeZone; import java.util.Map; -import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument; +import static org.elasticsearch.xpack.support.Exceptions.illegalArgument; /** * Performs the watch execution operation. diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/Schedule.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/Schedule.java deleted file mode 100644 index ce2a552a03b..00000000000 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/Schedule.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.xpack.watcher.trigger.schedule; - -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.XContentParser; - -import java.io.IOException; - -/** - * - */ -public interface Schedule extends ToXContent { - - String type(); - - /** - * Returns the next scheduled time after the given time, according to this schedule. If the given schedule - * cannot resolve the next scheduled time, then {@code -1} is returned. It really depends on the type of - * schedule to determine when {@code -1} is returned. Some schedules (e.g. IntervalSchedule) will never return - * {@code -1} as they can always compute the next scheduled time. {@code Cron} based schedules are good example - * of schedules that may return {@code -1}, for example, when the schedule only points to times that are all - * before the given time (in which case, there is no next scheduled time for the given time). - * - * Example: - * - * cron 0 0 0 * 1 ? 2013 (only points to days in January 2013) - * - * time 2015-01-01 12:00:00 (this time is in 2015) - * - */ - long nextScheduledTimeAfter(long startTime, long time); - - interface Parser { - - String type(); - - S parse(XContentParser parser) throws IOException; - } -} diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/watch/Watch.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/watch/Watch.java index 9b77e34f4a8..7dd219462c2 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/watch/Watch.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/watch/Watch.java @@ -30,7 +30,7 @@ import org.elasticsearch.xpack.watcher.condition.always.ExecutableAlwaysConditio import org.elasticsearch.xpack.watcher.input.ExecutableInput; import org.elasticsearch.xpack.watcher.input.InputRegistry; import org.elasticsearch.xpack.watcher.input.none.ExecutableNoneInput; -import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils; +import org.elasticsearch.xpack.support.DateTimeUtils; import org.elasticsearch.xpack.support.clock.Clock; import org.elasticsearch.xpack.support.clock.HaltedClock; import org.elasticsearch.xpack.common.secret.SecretService; @@ -38,9 +38,9 @@ import org.elasticsearch.xpack.watcher.support.xcontent.WatcherParams; import org.elasticsearch.xpack.watcher.support.xcontent.WatcherXContentParser; import org.elasticsearch.xpack.watcher.transform.ExecutableTransform; import org.elasticsearch.xpack.watcher.transform.TransformRegistry; -import org.elasticsearch.xpack.watcher.trigger.Trigger; -import org.elasticsearch.xpack.watcher.trigger.TriggerEngine; -import org.elasticsearch.xpack.watcher.trigger.TriggerService; +import org.elasticsearch.xpack.trigger.Trigger; +import org.elasticsearch.xpack.trigger.TriggerEngine; +import org.elasticsearch.xpack.trigger.TriggerService; import org.joda.time.DateTime; import org.joda.time.PeriodType; @@ -53,7 +53,7 @@ import java.util.concurrent.atomic.AtomicLong; import static java.util.Collections.unmodifiableMap; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.common.xcontent.XContentHelper.createParser; -import static org.elasticsearch.xpack.watcher.support.Exceptions.ioException; +import static org.elasticsearch.xpack.support.Exceptions.ioException; public class Watch implements TriggerEngine.Job, ToXContent { @@ -310,7 +310,7 @@ public class Watch implements TriggerEngine.Job, ToXContent { transform = transformRegistry.parse(id, parser); } else if (ParseFieldMatcher.STRICT.match(currentFieldName, Field.THROTTLE_PERIOD)) { try { - throttlePeriod = WatcherDateTimeUtils.parseTimeValue(parser, Field.THROTTLE_PERIOD.toString()); + throttlePeriod = DateTimeUtils.parseTimeValue(parser, Field.THROTTLE_PERIOD.toString()); } catch (ElasticsearchParseException pe) { throw new ElasticsearchParseException("could not parse watch [{}]. failed to parse time value for field [{}]", pe, id, currentFieldName); diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/watch/WatchLockService.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/watch/WatchLockService.java index 2aa1f9edc8b..565d94e911a 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/watch/WatchLockService.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/watch/WatchLockService.java @@ -16,7 +16,7 @@ import org.joda.time.PeriodType; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalState; +import static org.elasticsearch.xpack.support.Exceptions.illegalState; /** * diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/watch/WatchStatus.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/watch/WatchStatus.java index 8fb570b4290..506f3369d47 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/watch/WatchStatus.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/watch/WatchStatus.java @@ -30,11 +30,11 @@ import java.util.Map; import static java.util.Collections.emptyMap; import static java.util.Collections.unmodifiableMap; -import static org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils.parseDate; -import static org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils.readDate; -import static org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils.readOptionalDate; -import static org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils.writeDate; -import static org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils.writeOptionalDate; +import static org.elasticsearch.xpack.support.DateTimeUtils.parseDate; +import static org.elasticsearch.xpack.support.DateTimeUtils.readDate; +import static org.elasticsearch.xpack.support.DateTimeUtils.readOptionalDate; +import static org.elasticsearch.xpack.support.DateTimeUtils.writeDate; +import static org.elasticsearch.xpack.support.DateTimeUtils.writeOptionalDate; /** * diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/watch/WatchStore.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/watch/WatchStore.java index 5b91661cf94..7bbe0e38dd5 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/watch/WatchStore.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/xpack/watcher/watch/WatchStore.java @@ -40,7 +40,7 @@ import java.util.Set; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicBoolean; -import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalState; +import static org.elasticsearch.xpack.support.Exceptions.illegalState; /** */ diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/test/integration/HistoryIntegrationTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/test/integration/HistoryIntegrationTests.java index 8d13982b6d7..ec82cdaaba9 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/test/integration/HistoryIntegrationTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/test/integration/HistoryIntegrationTests.java @@ -16,8 +16,8 @@ import org.elasticsearch.xpack.watcher.client.WatchSourceBuilders; import org.elasticsearch.xpack.watcher.input.InputBuilders; import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase; import org.elasticsearch.xpack.watcher.transport.actions.put.PutWatchResponse; -import org.elasticsearch.xpack.watcher.trigger.TriggerBuilders; -import org.elasticsearch.xpack.watcher.trigger.schedule.Schedules; +import org.elasticsearch.xpack.trigger.TriggerBuilders; +import org.elasticsearch.xpack.trigger.schedule.Schedules; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/WatcherServiceTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/WatcherServiceTests.java index 998dffda5a3..f74933fb468 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/WatcherServiceTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/WatcherServiceTests.java @@ -18,9 +18,9 @@ import org.elasticsearch.xpack.watcher.execution.ExecutionService; import org.elasticsearch.xpack.watcher.support.WatcherIndexTemplateRegistry; import org.elasticsearch.xpack.support.clock.ClockMock; import org.elasticsearch.xpack.support.clock.SystemClock; -import org.elasticsearch.xpack.watcher.trigger.Trigger; -import org.elasticsearch.xpack.watcher.trigger.TriggerEngine; -import org.elasticsearch.xpack.watcher.trigger.TriggerService; +import org.elasticsearch.xpack.trigger.Trigger; +import org.elasticsearch.xpack.trigger.TriggerEngine; +import org.elasticsearch.xpack.trigger.TriggerService; import org.elasticsearch.xpack.watcher.watch.Watch; import org.elasticsearch.xpack.watcher.watch.WatchLockService; import org.elasticsearch.xpack.watcher.watch.WatchStatus; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/ActionErrorIntegrationTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/ActionErrorIntegrationTests.java index d62df74f188..241b51a348a 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/ActionErrorIntegrationTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/ActionErrorIntegrationTests.java @@ -28,8 +28,8 @@ import java.util.List; import static org.elasticsearch.index.query.QueryBuilders.termsQuery; import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBuilder; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.is; /** diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/TimeThrottleIntegrationTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/TimeThrottleIntegrationTests.java index 8bc312df0e9..474c8f6b2e9 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/TimeThrottleIntegrationTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/TimeThrottleIntegrationTests.java @@ -27,8 +27,8 @@ import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.compar import static org.elasticsearch.xpack.watcher.input.InputBuilders.searchInput; import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.matchAllRequest; import static org.elasticsearch.xpack.watcher.transform.TransformBuilders.searchTransform; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.greaterThanOrEqualTo; import static org.hamcrest.Matchers.is; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/email/EmailAttachmentTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/email/EmailAttachmentTests.java index 242675561d5..8deeae53060 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/email/EmailAttachmentTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/email/EmailAttachmentTests.java @@ -26,7 +26,7 @@ import org.elasticsearch.xpack.watcher.condition.compare.CompareCondition; import org.elasticsearch.xpack.common.http.HttpRequestTemplate; import org.elasticsearch.xpack.common.http.Scheme; import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase; -import org.elasticsearch.xpack.watcher.trigger.schedule.IntervalSchedule; +import org.elasticsearch.xpack.trigger.schedule.IntervalSchedule; import org.junit.After; import org.junit.Before; @@ -52,8 +52,8 @@ import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBu import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.compareCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.searchInput; import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.newInputSearchRequest; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/index/IndexActionIntegrationTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/index/IndexActionIntegrationTests.java index 4bbae26cc62..1077d8ff531 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/index/IndexActionIntegrationTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/index/IndexActionIntegrationTests.java @@ -13,11 +13,11 @@ import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval; import org.elasticsearch.search.sort.SortOrder; import org.elasticsearch.xpack.watcher.history.HistoryStore; -import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils; +import org.elasticsearch.xpack.support.DateTimeUtils; import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase; import org.elasticsearch.xpack.watcher.transport.actions.execute.ExecuteWatchResponse; import org.elasticsearch.xpack.watcher.transport.actions.put.PutWatchResponse; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; @@ -30,8 +30,8 @@ import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBu import static org.elasticsearch.xpack.watcher.input.InputBuilders.searchInput; import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; import static org.elasticsearch.xpack.watcher.transform.TransformBuilders.scriptTransform; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.cron; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.cron; import static org.hamcrest.Matchers.hasEntry; import static org.hamcrest.Matchers.hasKey; import static org.hamcrest.Matchers.is; @@ -65,10 +65,10 @@ public class IndexActionIntegrationTests extends AbstractWatcherIntegrationTestC assertThat(searchResponse.getHits().totalHits(), is(1L)); SearchHit hit = searchResponse.getHits().getAt(0); if (timeWarped()) { - assertThat(hit.getSource(), hasEntry("@timestamp", (Object) WatcherDateTimeUtils.formatDate(now))); + assertThat(hit.getSource(), hasEntry("@timestamp", (Object) DateTimeUtils.formatDate(now))); } else { assertThat(hit.getSource(), hasKey("@timestamp")); - DateTime timestamp = WatcherDateTimeUtils.parseDate((String) hit.getSource().get("@timestamp")); + DateTime timestamp = DateTimeUtils.parseDate((String) hit.getSource().get("@timestamp")); assertThat(timestamp.isEqual(now) || timestamp.isAfter(now), is(true)); } assertThat(hit.getSource(), hasEntry("foo", (Object) "bar")); @@ -101,10 +101,10 @@ public class IndexActionIntegrationTests extends AbstractWatcherIntegrationTestC assertThat(searchResponse.getHits().totalHits(), is(1L)); SearchHit hit = searchResponse.getHits().getAt(0); if (timeWarped()) { - assertThat(hit.getSource(), hasEntry("@timestamp", (Object) WatcherDateTimeUtils.formatDate(now))); + assertThat(hit.getSource(), hasEntry("@timestamp", (Object) DateTimeUtils.formatDate(now))); } else { assertThat(hit.getSource(), hasKey("@timestamp")); - DateTime timestamp = WatcherDateTimeUtils.parseDate((String) hit.getSource().get("@timestamp")); + DateTime timestamp = DateTimeUtils.parseDate((String) hit.getSource().get("@timestamp")); assertThat(timestamp.isEqual(now) || timestamp.isAfter(now), is(true)); } assertThat(hit.getSource(), hasEntry("foo", (Object) "bar")); @@ -192,10 +192,10 @@ public class IndexActionIntegrationTests extends AbstractWatcherIntegrationTestC int i = 0; for (SearchHit hit : searchResponse.getHits()) { if (timeWarped()) { - assertThat(hit.getSource(), hasEntry("@timestamp", (Object) WatcherDateTimeUtils.formatDate(now))); + assertThat(hit.getSource(), hasEntry("@timestamp", (Object) DateTimeUtils.formatDate(now))); } else { assertThat(hit.getSource(), hasKey("@timestamp")); - DateTime timestamp = WatcherDateTimeUtils.parseDate((String) hit.getSource().get("@timestamp")); + DateTime timestamp = DateTimeUtils.parseDate((String) hit.getSource().get("@timestamp")); assertThat(timestamp.isEqual(now) || timestamp.isAfter(now), is(true)); } assertThat(hit.getSource(), hasEntry("key", (Object) key.getMillis())); diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/index/IndexActionTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/index/IndexActionTests.java index 39dc979a77e..e8379cce4c3 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/index/IndexActionTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/index/IndexActionTests.java @@ -19,7 +19,7 @@ import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.xpack.watcher.actions.Action; import org.elasticsearch.xpack.watcher.actions.Action.Result.Status; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; -import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils; +import org.elasticsearch.xpack.support.DateTimeUtils; import org.elasticsearch.xpack.watcher.support.init.proxy.WatcherClientProxy; import org.elasticsearch.xpack.watcher.support.xcontent.XContentSource; import org.elasticsearch.xpack.watcher.test.WatcherTestUtils; @@ -104,7 +104,7 @@ public class IndexActionTests extends ESIntegTestCase { if (customTimestampField) { assertThat(hit.getSource().size(), is(2)); assertThat(hit.getSource(), hasEntry("foo", (Object) "bar")); - assertThat(hit.getSource(), hasEntry(timestampField, (Object) WatcherDateTimeUtils.formatDate(executionTime))); + assertThat(hit.getSource(), hasEntry(timestampField, (Object) DateTimeUtils.formatDate(executionTime))); } else { assertThat(hit.getSource().size(), is(1)); assertThat(hit.getSource(), hasEntry("foo", (Object) "bar")); @@ -168,7 +168,7 @@ public class IndexActionTests extends ESIntegTestCase { if (customTimestampField) { assertThat(hit.getSource().size(), is(2)); assertThat(hit.getSource(), hasEntry("foo", (Object) "bar")); - assertThat(hit.getSource(), hasEntry(timestampField, (Object) WatcherDateTimeUtils.formatDate(executionTime))); + assertThat(hit.getSource(), hasEntry(timestampField, (Object) DateTimeUtils.formatDate(executionTime))); } else { assertThat(hit.getSource().size(), is(1)); assertThat(hit.getSource(), hasEntry("foo", (Object) "bar")); @@ -177,7 +177,7 @@ public class IndexActionTests extends ESIntegTestCase { if (customTimestampField) { assertThat(hit.getSource().size(), is(2)); assertThat(hit.getSource(), hasEntry("foo", (Object) "bar1")); - assertThat(hit.getSource(), hasEntry(timestampField, (Object) WatcherDateTimeUtils.formatDate(executionTime))); + assertThat(hit.getSource(), hasEntry(timestampField, (Object) DateTimeUtils.formatDate(executionTime))); } else { assertThat(hit.getSource().size(), is(1)); assertThat(hit.getSource(), hasEntry("foo", (Object) "bar1")); diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/throttler/AckThrottlerTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/throttler/AckThrottlerTests.java index 462c906e0db..94ec1028cc5 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/throttler/AckThrottlerTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/throttler/AckThrottlerTests.java @@ -13,7 +13,7 @@ import org.elasticsearch.xpack.watcher.watch.Watch; import org.elasticsearch.xpack.watcher.watch.WatchStatus; import org.joda.time.DateTime; -import static org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils.formatDate; +import static org.elasticsearch.xpack.support.DateTimeUtils.formatDate; import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.EMPTY_PAYLOAD; import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.mockExecutionContext; import static org.hamcrest.CoreMatchers.nullValue; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/throttler/ActionThrottleTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/throttler/ActionThrottleTests.java index 84b6d2ac058..1363a44b0fe 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/throttler/ActionThrottleTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/throttler/ActionThrottleTests.java @@ -27,10 +27,10 @@ import org.elasticsearch.xpack.watcher.transport.actions.execute.ExecuteWatchRes import org.elasticsearch.xpack.watcher.transport.actions.get.GetWatchRequest; import org.elasticsearch.xpack.watcher.transport.actions.put.PutWatchRequest; import org.elasticsearch.xpack.watcher.transport.actions.put.PutWatchResponse; -import org.elasticsearch.xpack.watcher.trigger.manual.ManualTriggerEvent; -import org.elasticsearch.xpack.watcher.trigger.schedule.IntervalSchedule; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTrigger; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent; +import org.elasticsearch.xpack.trigger.manual.ManualTriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.IntervalSchedule; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTrigger; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent; import org.elasticsearch.xpack.notification.email.EmailTemplate; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; @@ -44,8 +44,8 @@ import java.util.concurrent.TimeUnit; import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.loggingAction; import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.webhookAction; import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBuilder; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookActionTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookActionTests.java index b215214efdb..e5dbee127eb 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookActionTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookActionTests.java @@ -34,7 +34,7 @@ import org.elasticsearch.xpack.common.text.TextTemplateEngine; import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase; import org.elasticsearch.xpack.watcher.test.MockTextTemplateEngine; import org.elasticsearch.xpack.watcher.test.WatcherTestUtils; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent; import org.elasticsearch.xpack.watcher.watch.Payload; import org.elasticsearch.xpack.watcher.watch.Watch; import org.elasticsearch.xpack.notification.email.Attachment; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookHttpsIntegrationTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookHttpsIntegrationTests.java index 5aed1126be6..879132353de 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookHttpsIntegrationTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookHttpsIntegrationTests.java @@ -35,8 +35,8 @@ import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBu import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.alwaysCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.xContentSource; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookIntegrationTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookIntegrationTests.java index c599e2c40c6..3cedb5b19a3 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookIntegrationTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookIntegrationTests.java @@ -32,8 +32,8 @@ import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBu import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.alwaysCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.xContentSource; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.anyOf; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/condition/script/ScriptConditionTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/condition/script/ScriptConditionTests.java index c24b79efd5e..cdb4e4742a0 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/condition/script/ScriptConditionTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/condition/script/ScriptConditionTests.java @@ -33,7 +33,7 @@ import java.io.IOException; import static java.util.Collections.singletonMap; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; -import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument; +import static org.elasticsearch.xpack.support.Exceptions.illegalArgument; import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.getScriptServiceProxy; import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.mockExecutionContext; import static org.hamcrest.Matchers.containsString; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/execution/ExecutionServiceTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/execution/ExecutionServiceTests.java index 8395da0acda..31e1aec95a1 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/execution/ExecutionServiceTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/execution/ExecutionServiceTests.java @@ -28,7 +28,7 @@ import org.elasticsearch.xpack.support.clock.ClockMock; import org.elasticsearch.xpack.watcher.support.validation.WatcherSettingsValidation; import org.elasticsearch.xpack.watcher.transform.ExecutableTransform; import org.elasticsearch.xpack.watcher.transform.Transform; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent; import org.elasticsearch.xpack.watcher.watch.Payload; import org.elasticsearch.xpack.watcher.watch.Watch; import org.elasticsearch.xpack.watcher.watch.WatchLockService; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/execution/ManualExecutionTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/execution/ManualExecutionTests.java index 0da9dff123c..816f553c673 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/execution/ManualExecutionTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/execution/ManualExecutionTests.java @@ -27,9 +27,9 @@ import org.elasticsearch.xpack.watcher.transport.actions.get.GetWatchRequest; import org.elasticsearch.xpack.watcher.transport.actions.get.GetWatchResponse; import org.elasticsearch.xpack.watcher.transport.actions.put.PutWatchRequest; import org.elasticsearch.xpack.watcher.transport.actions.put.PutWatchResponse; -import org.elasticsearch.xpack.watcher.trigger.TriggerEvent; -import org.elasticsearch.xpack.watcher.trigger.manual.ManualTriggerEvent; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent; +import org.elasticsearch.xpack.trigger.TriggerEvent; +import org.elasticsearch.xpack.trigger.manual.ManualTriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent; import org.elasticsearch.xpack.watcher.watch.Payload; import org.elasticsearch.xpack.watcher.watch.Watch; import org.joda.time.DateTime; @@ -47,8 +47,8 @@ import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBu import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.alwaysCondition; import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.neverCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.cron; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.cron; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/execution/TriggeredWatchStoreLifeCycleTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/execution/TriggeredWatchStoreLifeCycleTests.java index c5f992f9d58..b05a335073a 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/execution/TriggeredWatchStoreLifeCycleTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/execution/TriggeredWatchStoreLifeCycleTests.java @@ -11,7 +11,7 @@ import org.elasticsearch.xpack.watcher.condition.ExecutableCondition; import org.elasticsearch.xpack.watcher.condition.always.ExecutableAlwaysCondition; import org.elasticsearch.xpack.watcher.input.none.ExecutableNoneInput; import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent; import org.elasticsearch.xpack.watcher.watch.Watch; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/execution/TriggeredWatchTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/execution/TriggeredWatchTests.java index 852f80cf7d7..5acbc87160b 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/execution/TriggeredWatchTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/execution/TriggeredWatchTests.java @@ -10,7 +10,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase; import org.elasticsearch.xpack.watcher.test.WatcherTestUtils; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent; import org.elasticsearch.xpack.watcher.watch.Watch; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryStoreTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryStoreTests.java index 1f52b12c660..121067314ae 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryStoreTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryStoreTests.java @@ -10,12 +10,11 @@ import org.elasticsearch.action.index.IndexResponse; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.watcher.WatcherModule; import org.elasticsearch.xpack.watcher.execution.ExecutionState; import org.elasticsearch.xpack.watcher.execution.Wid; import org.elasticsearch.xpack.watcher.support.WatcherIndexTemplateRegistry; import org.elasticsearch.xpack.watcher.support.init.proxy.WatcherClientProxy; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent; import org.joda.time.DateTime; import org.junit.Before; import org.mockito.Matchers; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateEmailMappingsTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateEmailMappingsTests.java index fd358684e60..81a9accee17 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateEmailMappingsTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateEmailMappingsTests.java @@ -7,7 +7,6 @@ package org.elasticsearch.xpack.watcher.history; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.common.logging.ESLogger; -import org.elasticsearch.common.logging.ESLoggerFactory; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.search.aggregations.Aggregations; @@ -17,9 +16,7 @@ import org.elasticsearch.xpack.notification.email.support.EmailServer; import org.elasticsearch.xpack.watcher.execution.ExecutionState; import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase; import org.elasticsearch.xpack.watcher.transport.actions.put.PutWatchResponse; -import org.junit.After; import org.junit.AfterClass; -import org.junit.Before; import org.junit.BeforeClass; import static org.elasticsearch.search.aggregations.AggregationBuilders.terms; @@ -28,8 +25,8 @@ import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.emailAction import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBuilder; import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.alwaysCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateHttpMappingsTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateHttpMappingsTests.java index 7edbfeff8ea..5c131dffd46 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateHttpMappingsTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateHttpMappingsTests.java @@ -27,8 +27,8 @@ import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.webhookActi import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBuilder; import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.alwaysCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.httpInput; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateIndexActionMappingsTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateIndexActionMappingsTests.java index 1bb90565419..df68bd470d0 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateIndexActionMappingsTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateIndexActionMappingsTests.java @@ -16,8 +16,8 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.terms; import static org.elasticsearch.search.builder.SearchSourceBuilder.searchSource; import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.indexAction; import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBuilder; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateSearchInputMappingsTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateSearchInputMappingsTests.java index 066750967a3..4fe263f802e 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateSearchInputMappingsTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateSearchInputMappingsTests.java @@ -21,8 +21,8 @@ import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.loggingActi import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBuilder; import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.alwaysCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.searchInput; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateTimeMappingsTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateTimeMappingsTests.java index f59478281ca..252fc063a8c 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateTimeMappingsTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateTimeMappingsTests.java @@ -21,8 +21,8 @@ import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.loggingActi import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBuilder; import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.alwaysCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateTransformMappingsTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateTransformMappingsTests.java index 3a2085c8aa4..1195b28f166 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateTransformMappingsTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateTransformMappingsTests.java @@ -23,8 +23,8 @@ import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBu import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.alwaysCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; import static org.elasticsearch.xpack.watcher.transform.TransformBuilders.scriptTransform; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/input/chain/ChainInputTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/input/chain/ChainInputTests.java index 99263047e6e..fb97b0843ea 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/input/chain/ChainInputTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/input/chain/ChainInputTests.java @@ -26,9 +26,9 @@ import org.elasticsearch.xpack.watcher.input.simple.SimpleInput; import org.elasticsearch.xpack.watcher.input.simple.SimpleInputFactory; import org.elasticsearch.xpack.common.http.HttpRequestTemplate; import org.elasticsearch.xpack.common.http.auth.basic.BasicAuth; -import org.elasticsearch.xpack.watcher.trigger.schedule.IntervalSchedule; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTrigger; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.IntervalSchedule; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTrigger; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent; import org.elasticsearch.xpack.watcher.watch.Payload; import org.elasticsearch.xpack.watcher.watch.Watch; import org.elasticsearch.xpack.watcher.watch.WatchStatus; @@ -46,8 +46,8 @@ import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.script import static org.elasticsearch.xpack.watcher.input.InputBuilders.chainInput; import static org.elasticsearch.xpack.watcher.input.InputBuilders.httpInput; import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.hasEntry; import static org.hamcrest.Matchers.hasKey; import static org.hamcrest.Matchers.hasSize; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/input/chain/ChainIntegrationTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/input/chain/ChainIntegrationTests.java index 77b2029dc44..0a50a91a58e 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/input/chain/ChainIntegrationTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/input/chain/ChainIntegrationTests.java @@ -24,9 +24,9 @@ import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBu import static org.elasticsearch.xpack.watcher.input.InputBuilders.chainInput; import static org.elasticsearch.xpack.watcher.input.InputBuilders.httpInput; import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.IntervalSchedule.Interval.Unit.SECONDS; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.IntervalSchedule.Interval.Unit.SECONDS; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.containsString; public class ChainIntegrationTests extends AbstractWatcherIntegrationTestCase { diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/input/http/HttpInputIntegrationTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/input/http/HttpInputIntegrationTests.java index 2ff6a291474..79a739c02a8 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/input/http/HttpInputIntegrationTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/input/http/HttpInputIntegrationTests.java @@ -20,7 +20,7 @@ import org.elasticsearch.xpack.common.text.TextTemplate; import org.elasticsearch.xpack.watcher.support.xcontent.XContentSource; import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase; import org.elasticsearch.xpack.watcher.transport.actions.put.PutWatchResponse; -import org.elasticsearch.xpack.watcher.trigger.schedule.IntervalSchedule; +import org.elasticsearch.xpack.trigger.schedule.IntervalSchedule; import java.net.InetSocketAddress; @@ -33,8 +33,8 @@ import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBu import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.compareCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.httpInput; import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.xContentSource; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.equalTo; public class HttpInputIntegrationTests extends AbstractWatcherIntegrationTestCase { diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/input/http/HttpInputTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/input/http/HttpInputTests.java index 33dad76f532..9622848dfcf 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/input/http/HttpInputTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/input/http/HttpInputTests.java @@ -35,9 +35,9 @@ import org.elasticsearch.xpack.common.http.auth.basic.BasicAuthFactory; import org.elasticsearch.xpack.common.secret.SecretService; import org.elasticsearch.xpack.common.text.TextTemplate; import org.elasticsearch.xpack.common.text.TextTemplateEngine; -import org.elasticsearch.xpack.watcher.trigger.schedule.IntervalSchedule; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTrigger; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.IntervalSchedule; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTrigger; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent; import org.elasticsearch.xpack.watcher.watch.Payload; import org.elasticsearch.xpack.watcher.watch.Watch; import org.elasticsearch.xpack.watcher.watch.WatchStatus; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchActionTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchActionTests.java index 97bf5762fc6..6d2ed33e7d5 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchActionTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchActionTests.java @@ -16,7 +16,7 @@ import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.rest.FakeRestRequest; import org.elasticsearch.xpack.watcher.client.WatcherClient; import org.elasticsearch.xpack.watcher.transport.actions.execute.ExecuteWatchRequestBuilder; -import org.elasticsearch.xpack.watcher.trigger.TriggerService; +import org.elasticsearch.xpack.trigger.TriggerService; import static org.hamcrest.core.Is.is; import static org.mockito.Mockito.mock; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/shield/BasicShieldTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/shield/BasicShieldTests.java index e12c7565f2c..95f70891a5a 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/shield/BasicShieldTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/shield/BasicShieldTests.java @@ -15,17 +15,17 @@ import org.elasticsearch.xpack.watcher.transport.actions.execute.ExecuteWatchRes import org.elasticsearch.xpack.watcher.transport.actions.get.GetWatchResponse; import org.elasticsearch.xpack.watcher.transport.actions.put.PutWatchResponse; import org.elasticsearch.xpack.watcher.transport.actions.stats.WatcherStatsResponse; -import org.elasticsearch.xpack.watcher.trigger.TriggerEvent; -import org.elasticsearch.xpack.watcher.trigger.schedule.IntervalSchedule; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent; +import org.elasticsearch.xpack.trigger.TriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.IntervalSchedule; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent; import org.joda.time.DateTime; import java.util.Collections; import static org.elasticsearch.shield.authc.support.UsernamePasswordToken.basicAuthHeaderValue; import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBuilder; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.core.Is.is; import static org.joda.time.DateTimeZone.UTC; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/support/DynamicIndexNameIntegrationTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/support/DynamicIndexNameIntegrationTests.java index abcd33831cc..7c095cf7324 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/support/DynamicIndexNameIntegrationTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/support/DynamicIndexNameIntegrationTests.java @@ -12,7 +12,7 @@ import org.elasticsearch.common.util.Callback; import org.elasticsearch.xpack.watcher.client.WatcherClient; import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase; import org.elasticsearch.xpack.watcher.transport.actions.put.PutWatchResponse; -import org.elasticsearch.xpack.watcher.trigger.schedule.IntervalSchedule; +import org.elasticsearch.xpack.trigger.schedule.IntervalSchedule; import org.joda.time.format.DateTimeFormat; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; @@ -25,8 +25,8 @@ import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.always import static org.elasticsearch.xpack.watcher.input.InputBuilders.searchInput; import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; import static org.elasticsearch.xpack.watcher.transform.TransformBuilders.searchTransform; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.is; /** diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/support/VariablesTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/support/VariablesTests.java index 70614be781c..6189deb20bf 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/support/VariablesTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/support/VariablesTests.java @@ -9,8 +9,8 @@ import org.elasticsearch.test.ESTestCase; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; import org.elasticsearch.xpack.watcher.execution.Wid; import org.elasticsearch.xpack.watcher.test.WatcherTestUtils; -import org.elasticsearch.xpack.watcher.trigger.TriggerEvent; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent; +import org.elasticsearch.xpack.trigger.TriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent; import org.elasticsearch.xpack.watcher.watch.Payload; import org.joda.time.DateTime; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/support/WatcherUtilsTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/support/WatcherUtilsTests.java index 68eea0e90ae..e0d37ba7828 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/support/WatcherUtilsTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/support/WatcherUtilsTests.java @@ -8,7 +8,7 @@ package org.elasticsearch.xpack.watcher.support; import static java.util.Collections.singletonMap; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; -import static org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils.formatDate; +import static org.elasticsearch.xpack.support.DateTimeUtils.formatDate; import static org.elasticsearch.xpack.watcher.support.WatcherUtils.DEFAULT_INDICES_OPTIONS; import static org.elasticsearch.xpack.watcher.support.WatcherUtils.flattenModel; import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.getRandomSupportedSearchType; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/AbstractWatcherIntegrationTestCase.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/AbstractWatcherIntegrationTestCase.java index ac9d9a2b749..f19521c75db 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/AbstractWatcherIntegrationTestCase.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/AbstractWatcherIntegrationTestCase.java @@ -52,9 +52,9 @@ import org.elasticsearch.xpack.support.clock.ClockMock; import org.elasticsearch.xpack.common.http.HttpClient; import org.elasticsearch.xpack.common.ScriptServiceProxy; import org.elasticsearch.xpack.watcher.support.xcontent.XContentSource; -import org.elasticsearch.xpack.watcher.trigger.ScheduleTriggerEngineMock; -import org.elasticsearch.xpack.watcher.trigger.TriggerService; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleModule; +import org.elasticsearch.xpack.trigger.ScheduleTriggerEngineMock; +import org.elasticsearch.xpack.trigger.TriggerService; +import org.elasticsearch.xpack.trigger.schedule.ScheduleModule; import org.elasticsearch.xpack.watcher.watch.Watch; import org.elasticsearch.xpack.TimeWarpedXPackPlugin; import org.elasticsearch.xpack.XPackClient; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/TimeWarpedWatcher.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/TimeWarpedWatcher.java index 6b2c75a5d6d..e8173a31589 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/TimeWarpedWatcher.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/TimeWarpedWatcher.java @@ -12,9 +12,9 @@ import org.elasticsearch.xpack.watcher.Watcher; import org.elasticsearch.xpack.watcher.execution.ExecutionModule; import org.elasticsearch.xpack.watcher.execution.SyncTriggerListener; import org.elasticsearch.xpack.watcher.execution.WatchExecutor; -import org.elasticsearch.xpack.watcher.trigger.ScheduleTriggerEngineMock; -import org.elasticsearch.xpack.watcher.trigger.TriggerModule; -import org.elasticsearch.xpack.watcher.trigger.manual.ManualTriggerEngine; +import org.elasticsearch.xpack.trigger.ScheduleTriggerEngineMock; +import org.elasticsearch.xpack.trigger.TriggerModule; +import org.elasticsearch.xpack.trigger.manual.ManualTriggerEngine; import java.util.ArrayList; import java.util.Collection; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/WatchExecutionContextMockBuilder.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/WatchExecutionContextMockBuilder.java index 16b9144c1c1..9fd65d0008c 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/WatchExecutionContextMockBuilder.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/WatchExecutionContextMockBuilder.java @@ -8,8 +8,8 @@ package org.elasticsearch.xpack.watcher.test; import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; import org.elasticsearch.xpack.watcher.execution.Wid; -import org.elasticsearch.xpack.watcher.trigger.TriggerEvent; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent; +import org.elasticsearch.xpack.trigger.TriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent; import org.elasticsearch.xpack.watcher.watch.Payload; import org.elasticsearch.xpack.watcher.watch.Watch; import org.joda.time.DateTime; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/WatcherTestUtils.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/WatcherTestUtils.java index e576cfd50ab..a86b804bdda 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/WatcherTestUtils.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/WatcherTestUtils.java @@ -62,9 +62,9 @@ import org.elasticsearch.xpack.watcher.support.xcontent.ObjectPath; import org.elasticsearch.xpack.watcher.support.xcontent.XContentSource; import org.elasticsearch.xpack.watcher.transform.search.ExecutableSearchTransform; import org.elasticsearch.xpack.watcher.transform.search.SearchTransform; -import org.elasticsearch.xpack.watcher.trigger.TriggerEvent; -import org.elasticsearch.xpack.watcher.trigger.schedule.CronSchedule; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTrigger; +import org.elasticsearch.xpack.trigger.TriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.CronSchedule; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTrigger; import org.elasticsearch.xpack.watcher.watch.Payload; import org.elasticsearch.xpack.watcher.watch.Watch; import org.elasticsearch.xpack.watcher.watch.WatchStatus; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/bench/ScheduleEngineTriggerBenchmark.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/bench/ScheduleEngineTriggerBenchmark.java index ac7adf19353..9512c21a409 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/bench/ScheduleEngineTriggerBenchmark.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/bench/ScheduleEngineTriggerBenchmark.java @@ -10,16 +10,16 @@ import org.elasticsearch.common.SuppressForbidden; import org.elasticsearch.common.metrics.MeanMetric; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.xpack.support.clock.SystemClock; -import org.elasticsearch.xpack.watcher.trigger.Trigger; -import org.elasticsearch.xpack.watcher.trigger.TriggerEngine; -import org.elasticsearch.xpack.watcher.trigger.TriggerEvent; -import org.elasticsearch.xpack.watcher.trigger.schedule.Schedule; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleRegistry; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTrigger; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEngine; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent; -import org.elasticsearch.xpack.watcher.trigger.schedule.engine.SchedulerScheduleTriggerEngine; -import org.elasticsearch.xpack.watcher.trigger.schedule.engine.TickerScheduleTriggerEngine; +import org.elasticsearch.xpack.trigger.Trigger; +import org.elasticsearch.xpack.trigger.TriggerEngine; +import org.elasticsearch.xpack.trigger.TriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.Schedule; +import org.elasticsearch.xpack.trigger.schedule.ScheduleRegistry; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTrigger; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEngine; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.engine.SchedulerScheduleTriggerEngine; +import org.elasticsearch.xpack.trigger.schedule.engine.TickerScheduleTriggerEngine; import java.util.ArrayList; import java.util.Arrays; @@ -29,7 +29,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import static java.util.Collections.emptyMap; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; /** * diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/bench/WatcherExecutorServiceBenchmark.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/bench/WatcherExecutorServiceBenchmark.java index 250d58d6f0b..a803ab894e9 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/bench/WatcherExecutorServiceBenchmark.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/bench/WatcherExecutorServiceBenchmark.java @@ -19,8 +19,8 @@ import org.elasticsearch.xpack.watcher.client.WatchSourceBuilder; import org.elasticsearch.xpack.watcher.client.WatcherClient; import org.elasticsearch.xpack.common.http.HttpRequestTemplate; import org.elasticsearch.xpack.watcher.transport.actions.put.PutWatchRequest; -import org.elasticsearch.xpack.watcher.trigger.ScheduleTriggerEngineMock; -import org.elasticsearch.xpack.watcher.trigger.TriggerModule; +import org.elasticsearch.xpack.trigger.ScheduleTriggerEngineMock; +import org.elasticsearch.xpack.trigger.TriggerModule; import org.elasticsearch.xpack.XPackPlugin; import java.util.ArrayList; @@ -32,8 +32,8 @@ import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.indexAction import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.scriptCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.httpInput; import static org.elasticsearch.xpack.watcher.input.InputBuilders.searchInput; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; /** * Starts a master only node with watcher and benchmarks the executor service side, so no scheduling. The benchmark diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/bench/WatcherScheduleEngineBenchmark.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/bench/WatcherScheduleEngineBenchmark.java index bec1608e710..965a0d71cd8 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/bench/WatcherScheduleEngineBenchmark.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/bench/WatcherScheduleEngineBenchmark.java @@ -50,8 +50,8 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.percenti import static org.elasticsearch.search.aggregations.AggregationBuilders.terms; import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.scriptCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.searchInput; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; /** */ diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/BasicWatcherTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/BasicWatcherTests.java index b552439b30e..05becfd857c 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/BasicWatcherTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/BasicWatcherTests.java @@ -26,10 +26,10 @@ import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase; import org.elasticsearch.xpack.watcher.transport.actions.delete.DeleteWatchResponse; import org.elasticsearch.xpack.watcher.transport.actions.get.GetWatchResponse; import org.elasticsearch.xpack.watcher.transport.actions.put.PutWatchResponse; -import org.elasticsearch.xpack.watcher.trigger.schedule.IntervalSchedule; -import org.elasticsearch.xpack.watcher.trigger.schedule.Schedules; -import org.elasticsearch.xpack.watcher.trigger.schedule.support.MonthTimes; -import org.elasticsearch.xpack.watcher.trigger.schedule.support.WeekTimes; +import org.elasticsearch.xpack.trigger.schedule.IntervalSchedule; +import org.elasticsearch.xpack.trigger.schedule.Schedules; +import org.elasticsearch.xpack.trigger.schedule.support.MonthTimes; +import org.elasticsearch.xpack.trigger.schedule.support.WeekTimes; import org.elasticsearch.xpack.watcher.watch.WatchStore; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; @@ -48,13 +48,13 @@ import static org.elasticsearch.xpack.watcher.input.InputBuilders.searchInput; import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.newInputSearchRequest; import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.xContentSource; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.cron; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.daily; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.hourly; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.monthly; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.weekly; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.cron; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.daily; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.hourly; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.monthly; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.weekly; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/BootStrapTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/BootStrapTests.java index 210e295db79..79251abc4b8 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/BootStrapTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/BootStrapTests.java @@ -23,7 +23,7 @@ import org.elasticsearch.xpack.watcher.history.HistoryStore; import org.elasticsearch.xpack.watcher.history.WatchRecord; import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase; import org.elasticsearch.xpack.watcher.transport.actions.stats.WatcherStatsResponse; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent; import org.elasticsearch.xpack.watcher.watch.Watch; import org.elasticsearch.xpack.watcher.watch.WatchStore; import org.hamcrest.Matchers; @@ -42,8 +42,8 @@ import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.always import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.compareCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.searchInput; import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.newInputSearchRequest; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.cron; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.cron; import static org.hamcrest.Matchers.is; import static org.hamcrest.core.IsEqual.equalTo; import static org.joda.time.DateTimeZone.UTC; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/ExecutionVarsIntegrationTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/ExecutionVarsIntegrationTests.java index 66cd8bba4ba..0639a1fecfb 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/ExecutionVarsIntegrationTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/ExecutionVarsIntegrationTests.java @@ -24,8 +24,8 @@ import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBu import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.scriptCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; import static org.elasticsearch.xpack.watcher.transform.TransformBuilders.scriptTransform; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.cron; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.cron; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/HttpSecretsIntegrationTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/HttpSecretsIntegrationTests.java index 948ee132b39..ce82c15c5c9 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/HttpSecretsIntegrationTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/HttpSecretsIntegrationTests.java @@ -22,8 +22,8 @@ import org.elasticsearch.xpack.watcher.support.xcontent.XContentSource; import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase; import org.elasticsearch.xpack.watcher.transport.actions.execute.ExecuteWatchResponse; import org.elasticsearch.xpack.watcher.transport.actions.get.GetWatchResponse; -import org.elasticsearch.xpack.watcher.trigger.TriggerEvent; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent; +import org.elasticsearch.xpack.trigger.TriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent; import org.elasticsearch.xpack.watcher.watch.WatchStore; import org.joda.time.DateTime; import org.junit.After; @@ -39,8 +39,8 @@ import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBu import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.alwaysCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.httpInput; import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.cron; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.cron; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/WatchMetadataTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/WatchMetadataTests.java index b458cce21aa..d8f0a68de3e 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/WatchMetadataTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/integration/WatchMetadataTests.java @@ -18,8 +18,8 @@ import org.elasticsearch.xpack.watcher.support.xcontent.ObjectPath; import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase; import org.elasticsearch.xpack.watcher.test.WatcherTestUtils; import org.elasticsearch.xpack.watcher.transport.actions.execute.ExecuteWatchResponse; -import org.elasticsearch.xpack.watcher.trigger.TriggerEvent; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent; +import org.elasticsearch.xpack.trigger.TriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent; import org.joda.time.DateTime; import java.util.ArrayList; @@ -34,8 +34,8 @@ import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.loggingActi import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBuilder; import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.compareCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.searchInput; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.cron; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.cron; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; import static org.joda.time.DateTimeZone.UTC; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transform/TransformIntegrationTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transform/TransformIntegrationTests.java index 989c17e4a25..48868ab50ad 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transform/TransformIntegrationTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transform/TransformIntegrationTests.java @@ -34,8 +34,8 @@ import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; import static org.elasticsearch.xpack.watcher.transform.TransformBuilders.chainTransform; import static org.elasticsearch.xpack.watcher.transform.TransformBuilders.scriptTransform; import static org.elasticsearch.xpack.watcher.transform.TransformBuilders.searchTransform; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThanOrEqualTo; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transform/script/ScriptTransformTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transform/script/ScriptTransformTests.java index 910ee7a8341..5e2bac7538b 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transform/script/ScriptTransformTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transform/script/ScriptTransformTests.java @@ -32,7 +32,7 @@ import java.util.Map; import static java.util.Collections.singleton; import static java.util.Collections.singletonMap; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; -import static org.elasticsearch.xpack.watcher.support.Exceptions.illegalArgument; +import static org.elasticsearch.xpack.support.Exceptions.illegalArgument; import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.EMPTY_PAYLOAD; import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.getScriptServiceProxy; import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.mockExecutionContext; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/activate/ActivateWatchTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/activate/ActivateWatchTests.java index 20a096a3662..cd7b831d771 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/activate/ActivateWatchTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/activate/ActivateWatchTests.java @@ -28,9 +28,9 @@ import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.indexAction import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBuilder; import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.alwaysCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.cron; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.cron; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/delete/DeleteWatchTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/delete/DeleteWatchTests.java index cf6d61ebbc1..845964d7447 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/delete/DeleteWatchTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/delete/DeleteWatchTests.java @@ -15,8 +15,8 @@ import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.loggingActi import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBuilder; import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.alwaysCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/delete/ForceDeleteWatchTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/delete/ForceDeleteWatchTests.java index 51c5883cc6b..d6f389ba755 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/delete/ForceDeleteWatchTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/delete/ForceDeleteWatchTests.java @@ -20,8 +20,8 @@ import java.util.List; import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.loggingAction; import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBuilder; import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.scriptCondition; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/execute/ExecuteWatchTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/execute/ExecuteWatchTests.java index 73841fc1ca5..59b0c90b203 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/execute/ExecuteWatchTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/execute/ExecuteWatchTests.java @@ -11,7 +11,7 @@ import org.elasticsearch.xpack.watcher.actions.ActionStatus; import org.elasticsearch.xpack.watcher.client.WatcherClient; import org.elasticsearch.xpack.watcher.execution.ActionExecutionMode; import org.elasticsearch.xpack.watcher.execution.Wid; -import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils; +import org.elasticsearch.xpack.support.DateTimeUtils; import org.elasticsearch.xpack.watcher.support.xcontent.XContentSource; import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase; import org.elasticsearch.xpack.watcher.transport.actions.ack.AckWatchRequestBuilder; @@ -20,7 +20,7 @@ import org.elasticsearch.xpack.watcher.transport.actions.execute.ExecuteWatchReq import org.elasticsearch.xpack.watcher.transport.actions.execute.ExecuteWatchResponse; import org.elasticsearch.xpack.watcher.transport.actions.get.GetWatchResponse; import org.elasticsearch.xpack.watcher.transport.actions.put.PutWatchResponse; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEvent; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEvent; import org.elasticsearch.xpack.watcher.watch.WatchStatus; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; @@ -34,9 +34,9 @@ import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBu import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.alwaysCondition; import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.neverCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.cron; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.cron; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; @@ -132,9 +132,9 @@ public class ExecuteWatchTests extends AbstractWatcherIntegrationTestCase { ExecuteWatchRequestBuilder requestBuilder = watcherClient.prepareExecuteWatch("_id"); if (randomBoolean()) { Map data = new HashMap<>(); - data.put("triggered_time", WatcherDateTimeUtils.formatDate(triggeredTime)); + data.put("triggered_time", DateTimeUtils.formatDate(triggeredTime)); if (scheduledTime != triggeredTime) { - data.put("scheduled_time", WatcherDateTimeUtils.formatDate(scheduledTime)); + data.put("scheduled_time", DateTimeUtils.formatDate(scheduledTime)); } requestBuilder.setTriggerData(data); } else { @@ -151,8 +151,8 @@ public class ExecuteWatchTests extends AbstractWatcherIntegrationTestCase { XContentSource record = response.getRecordSource(); assertValue(record, "watch_id", is("_id")); assertValue(record, "trigger_event.type", is("manual")); - assertValue(record, "trigger_event.triggered_time", is(WatcherDateTimeUtils.formatDate(triggeredTime))); - assertValue(record, "trigger_event.manual.schedule.scheduled_time", is(WatcherDateTimeUtils.formatDate(scheduledTime))); + assertValue(record, "trigger_event.triggered_time", is(DateTimeUtils.formatDate(triggeredTime))); + assertValue(record, "trigger_event.manual.schedule.scheduled_time", is(DateTimeUtils.formatDate(scheduledTime))); assertValue(record, "state", is("executed")); assertValue(record, "input.simple.foo", is("bar")); assertValue(record, "condition.always", notNullValue()); diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/execute/ExecuteWatchWithDateMathTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/execute/ExecuteWatchWithDateMathTests.java index b47f2d1c0cb..d7ad17c79c9 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/execute/ExecuteWatchWithDateMathTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/execute/ExecuteWatchWithDateMathTests.java @@ -8,7 +8,7 @@ package org.elasticsearch.xpack.watcher.transport.action.execute; import org.apache.lucene.util.LuceneTestCase.BadApple; import org.elasticsearch.xpack.watcher.client.WatcherClient; import org.elasticsearch.xpack.watcher.execution.Wid; -import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils; +import org.elasticsearch.xpack.support.DateTimeUtils; import org.elasticsearch.xpack.watcher.support.xcontent.XContentSource; import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase; import org.elasticsearch.xpack.watcher.transport.actions.execute.ExecuteWatchResponse; @@ -22,8 +22,8 @@ import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.loggingActi import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBuilder; import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.alwaysCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.cron; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.cron; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; @@ -69,8 +69,8 @@ public class ExecuteWatchWithDateMathTests extends AbstractWatcherIntegrationTes XContentSource record = response.getRecordSource(); assertValue(record, "watch_id", is("_id")); assertValue(record, "trigger_event.type", is("manual")); - assertValue(record, "trigger_event.triggered_time", is(WatcherDateTimeUtils.formatDate(triggeredTime))); - assertValue(record, "trigger_event.manual.schedule.scheduled_time", is(WatcherDateTimeUtils.formatDate(scheduledTime))); + assertValue(record, "trigger_event.triggered_time", is(DateTimeUtils.formatDate(triggeredTime))); + assertValue(record, "trigger_event.manual.schedule.scheduled_time", is(DateTimeUtils.formatDate(scheduledTime))); assertValue(record, "state", is("executed")); assertValue(record, "input.simple.foo", is("bar")); assertValue(record, "condition.always", notNullValue()); diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/get/GetWatchTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/get/GetWatchTests.java index 6e78c03c24a..8a245cafcd2 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/get/GetWatchTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/get/GetWatchTests.java @@ -18,8 +18,8 @@ import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.loggingActi import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBuilder; import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.alwaysCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.hasKey; import static org.hamcrest.Matchers.is; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/put/PutWatchTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/put/PutWatchTests.java index 07e72e5f22a..85344ef9b83 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/put/PutWatchTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/put/PutWatchTests.java @@ -16,8 +16,8 @@ import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.loggingActi import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBuilder; import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.alwaysCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/stats/SlowWatchStatsTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/stats/SlowWatchStatsTests.java index a4d05811d59..1b2db355cf4 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/stats/SlowWatchStatsTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/stats/SlowWatchStatsTests.java @@ -27,8 +27,8 @@ import java.util.concurrent.TimeUnit; import static org.elasticsearch.test.ESIntegTestCase.Scope.TEST; import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBuilder; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interval; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.interval; import static org.hamcrest.Matchers.anyOf; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThanOrEqualTo; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/stats/WatcherStatsTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/stats/WatcherStatsTests.java index 7c41d915a73..3704267b618 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/stats/WatcherStatsTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/transport/action/stats/WatcherStatsTests.java @@ -27,8 +27,8 @@ import static org.elasticsearch.test.ESIntegTestCase.Scope.TEST; import static org.elasticsearch.xpack.watcher.client.WatchSourceBuilders.watchBuilder; import static org.elasticsearch.xpack.watcher.condition.ConditionBuilders.compareCondition; import static org.elasticsearch.xpack.watcher.input.InputBuilders.searchInput; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.cron; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.schedule.Schedules.cron; import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.is; import static org.hamcrest.core.IsEqual.equalTo; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/watch/WatchTests.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/watch/WatchTests.java index 8c9429500b1..34c20b96f27 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/watch/WatchTests.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/xpack/watcher/watch/WatchTests.java @@ -97,25 +97,25 @@ import org.elasticsearch.xpack.watcher.transform.script.ScriptTransformFactory; import org.elasticsearch.xpack.watcher.transform.search.ExecutableSearchTransform; import org.elasticsearch.xpack.watcher.transform.search.SearchTransform; import org.elasticsearch.xpack.watcher.transform.search.SearchTransformFactory; -import org.elasticsearch.xpack.watcher.trigger.Trigger; -import org.elasticsearch.xpack.watcher.trigger.TriggerEngine; -import org.elasticsearch.xpack.watcher.trigger.TriggerService; -import org.elasticsearch.xpack.watcher.trigger.schedule.CronSchedule; -import org.elasticsearch.xpack.watcher.trigger.schedule.DailySchedule; -import org.elasticsearch.xpack.watcher.trigger.schedule.HourlySchedule; -import org.elasticsearch.xpack.watcher.trigger.schedule.IntervalSchedule; -import org.elasticsearch.xpack.watcher.trigger.schedule.MonthlySchedule; -import org.elasticsearch.xpack.watcher.trigger.schedule.Schedule; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleRegistry; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTrigger; -import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEngine; -import org.elasticsearch.xpack.watcher.trigger.schedule.WeeklySchedule; -import org.elasticsearch.xpack.watcher.trigger.schedule.YearlySchedule; -import org.elasticsearch.xpack.watcher.trigger.schedule.support.DayOfWeek; -import org.elasticsearch.xpack.watcher.trigger.schedule.support.Month; -import org.elasticsearch.xpack.watcher.trigger.schedule.support.MonthTimes; -import org.elasticsearch.xpack.watcher.trigger.schedule.support.WeekTimes; -import org.elasticsearch.xpack.watcher.trigger.schedule.support.YearTimes; +import org.elasticsearch.xpack.trigger.Trigger; +import org.elasticsearch.xpack.trigger.TriggerEngine; +import org.elasticsearch.xpack.trigger.TriggerService; +import org.elasticsearch.xpack.trigger.schedule.CronSchedule; +import org.elasticsearch.xpack.trigger.schedule.DailySchedule; +import org.elasticsearch.xpack.trigger.schedule.HourlySchedule; +import org.elasticsearch.xpack.trigger.schedule.IntervalSchedule; +import org.elasticsearch.xpack.trigger.schedule.MonthlySchedule; +import org.elasticsearch.xpack.trigger.schedule.Schedule; +import org.elasticsearch.xpack.trigger.schedule.ScheduleRegistry; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTrigger; +import org.elasticsearch.xpack.trigger.schedule.ScheduleTriggerEngine; +import org.elasticsearch.xpack.trigger.schedule.WeeklySchedule; +import org.elasticsearch.xpack.trigger.schedule.YearlySchedule; +import org.elasticsearch.xpack.trigger.schedule.support.DayOfWeek; +import org.elasticsearch.xpack.trigger.schedule.support.Month; +import org.elasticsearch.xpack.trigger.schedule.support.MonthTimes; +import org.elasticsearch.xpack.trigger.schedule.support.WeekTimes; +import org.elasticsearch.xpack.trigger.schedule.support.YearTimes; import org.elasticsearch.xpack.notification.email.EmailService; import org.elasticsearch.xpack.notification.email.EmailTemplate; import org.elasticsearch.xpack.notification.email.HtmlSanitizer; @@ -132,7 +132,7 @@ import static java.util.Collections.unmodifiableMap; import static org.elasticsearch.xpack.watcher.input.InputBuilders.searchInput; import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.matchAllRequest; -import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; +import static org.elasticsearch.xpack.trigger.TriggerBuilders.schedule; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is;