From e00b4bd1973fffda14980c4fadfc6ed90238ff4c Mon Sep 17 00:00:00 2001 From: Dimitris Athanasiou Date: Tue, 14 Nov 2017 10:32:42 +0000 Subject: [PATCH 1/6] [ML][TEST] Improve RevertModelSnapshotIT (elastic/x-pack-elasticsearch#2954) X-Pack side testing of elastic/machine-learning-cpp#390 Original commit: elastic/x-pack-elasticsearch@64e8ca85eb3b8b55e6f8e9a0ca9cf000a09def0a --- .../ml/integration/RevertModelSnapshotIT.java | 48 ++++++++++++++++--- 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/plugin/src/test/java/org/elasticsearch/xpack/ml/integration/RevertModelSnapshotIT.java b/plugin/src/test/java/org/elasticsearch/xpack/ml/integration/RevertModelSnapshotIT.java index 2d423e48d30..ec53eb0d29f 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/ml/integration/RevertModelSnapshotIT.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/ml/integration/RevertModelSnapshotIT.java @@ -7,6 +7,8 @@ package org.elasticsearch.xpack.ml.integration; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.common.unit.TimeValue; +import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.search.SearchHits; @@ -17,6 +19,7 @@ import org.elasticsearch.xpack.ml.job.config.Job; import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSizeStats; import org.elasticsearch.xpack.ml.job.process.autodetect.state.ModelSnapshot; import org.elasticsearch.xpack.ml.job.process.autodetect.state.Quantiles; +import org.elasticsearch.xpack.ml.job.results.Bucket; import org.junit.After; import java.io.IOException; @@ -31,6 +34,7 @@ import java.util.stream.Collectors; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.not; /** @@ -49,14 +53,19 @@ public class RevertModelSnapshotIT extends MlNativeAutodetectIntegTestCase { TimeValue bucketSpan = TimeValue.timeValueHours(1); long startTime = 1491004800000L; - Job.Builder job = buildAndRegisterJob("revert-model-snapshot-split-it-job", bucketSpan); + Job.Builder job = buildAndRegisterJob("revert-model-snapshot-it-job", bucketSpan); openJob(job.getId()); postData(job.getId(), generateData(startTime, bucketSpan, 10, Arrays.asList("foo"), (bucketIndex, series) -> bucketIndex == 5 ? 100.0 : 10.0).stream().collect(Collectors.joining())); + flushJob(job.getId(), true); closeJob(job.getId()); ModelSizeStats modelSizeStats1 = getJobStats(job.getId()).get(0).getModelSizeStats(); - String quantiles1 = getQuantiles(job.getId()); + Quantiles quantiles1 = getQuantiles(job.getId()); + + List midwayBuckets = getBuckets(job.getId()); + Bucket revertPointBucket = midwayBuckets.get(midwayBuckets.size() - 1); + assertThat(revertPointBucket.isInterim(), is(true)); // We need to wait a second to ensure the second time around model snapshot will have a different ID (it depends on epoch seconds) awaitBusy(() -> false, 1, TimeUnit.SECONDS); @@ -67,7 +76,7 @@ public class RevertModelSnapshotIT extends MlNativeAutodetectIntegTestCase { closeJob(job.getId()); ModelSizeStats modelSizeStats2 = getJobStats(job.getId()).get(0).getModelSizeStats(); - String quantiles2 = getQuantiles(job.getId()); + Quantiles quantiles2 = getQuantiles(job.getId()); // Check model has grown since a new series was introduced assertThat(modelSizeStats2.getModelBytes(), greaterThan(modelSizeStats1.getModelBytes())); @@ -75,6 +84,10 @@ public class RevertModelSnapshotIT extends MlNativeAutodetectIntegTestCase { // Check quantiles have changed assertThat(quantiles2, not(equalTo(quantiles1))); + List finalPreRevertBuckets = getBuckets(job.getId()); + Bucket finalPreRevertPointBucket = finalPreRevertBuckets.get(midwayBuckets.size() - 1); + assertThat(finalPreRevertPointBucket.isInterim(), is(false)); + List modelSnapshots = getModelSnapshots(job.getId()); assertThat(modelSnapshots.size(), equalTo(2)); @@ -89,7 +102,19 @@ public class RevertModelSnapshotIT extends MlNativeAutodetectIntegTestCase { assertThat(getJobStats(job.getId()).get(0).getModelSizeStats().getModelBytes(), equalTo(modelSizeStats1.getModelBytes())); // Check quantiles have been reverted - assertThat(getQuantiles(job.getId()), equalTo(quantiles1)); + assertThat(getQuantiles(job.getId()).getTimestamp(), equalTo(revertSnapshot.getLatestResultTimeStamp())); + + // Re-run 2nd half of data + openJob(job.getId()); + postData(job.getId(), generateData(startTime + 10 * bucketSpan.getMillis(), bucketSpan, 10, Arrays.asList("foo", "bar"), + (bucketIndex, series) -> 10.0).stream().collect(Collectors.joining())); + closeJob(job.getId()); + + List finalPostRevertBuckets = getBuckets(job.getId()); + Bucket finalPostRevertPointBucket = finalPostRevertBuckets.get(midwayBuckets.size() - 1); + assertThat(finalPostRevertPointBucket.getTimestamp(), equalTo(finalPreRevertPointBucket.getTimestamp())); + assertThat(finalPostRevertPointBucket.getAnomalyScore(), equalTo(finalPreRevertPointBucket.getAnomalyScore())); + assertThat(finalPostRevertPointBucket.getEventCount(), equalTo(finalPreRevertPointBucket.getEventCount())); } private Job.Builder buildAndRegisterJob(String jobId, TimeValue bucketSpan) throws Exception { @@ -117,19 +142,30 @@ public class RevertModelSnapshotIT extends MlNativeAutodetectIntegTestCase { record.put("value", timeAndSeriesToValueFunction.apply(i, field)); record.put("series", field); data.add(createJsonRecord(record)); + + record = new HashMap<>(); + record.put("time", now + bucketSpan.getMillis() / 2); + record.put("value", timeAndSeriesToValueFunction.apply(i, field)); + record.put("series", field); + data.add(createJsonRecord(record)); } now += bucketSpan.getMillis(); } return data; } - private String getQuantiles(String jobId) { + private Quantiles getQuantiles(String jobId) { SearchResponse response = client().prepareSearch(".ml-state") .setQuery(QueryBuilders.idsQuery().addIds(Quantiles.documentId(jobId))) .setSize(1) .get(); SearchHits hits = response.getHits(); assertThat(hits.getTotalHits(), equalTo(1L)); - return hits.getAt(0).getSourceAsString(); + try { + XContentParser parser = JsonXContent.jsonXContent.createParser(null, hits.getAt(0).getSourceAsString()); + return Quantiles.PARSER.apply(parser, null); + } catch (IOException e) { + throw new IllegalStateException(e); + } } } From dc42887396898cb62402aa21d104c48b4c166477 Mon Sep 17 00:00:00 2001 From: Alexander Reelsen Date: Tue, 14 Nov 2017 11:35:10 +0100 Subject: [PATCH 2/6] Watcher: Move watcher-only packages into watcher hierarchy (elastic/x-pack-elasticsearch#2933) In order to prepare for separate source directories, this commit moves a few packages back into the watcher namespaces. A few of them have been moved out previously as we thought that it might make sense to have a dedicated notification API. This wont be the case for watcher on ES anymore, so we can safely move those back into the watcher space. Packages affected by this move: * org.elasticsearch.xpack.common.http * org.elasticsearch.xpack.common.text * org.elasticsearch.xpack.common.secret * org.elasticsearch.xpack.common.stats * org.elasticsearch.xpack.support * org.elasticsearch.xpack.notification Tests have been moved accordingly. The class `XContentUtils` has been split into one implementation for watcher and one for security as different methods were used. Relates elastic/x-pack-elasticsearch#2925 Original commit: elastic/x-pack-elasticsearch@0aec64a7e29a64a2c0830ee35b988fb66027cb89 --- .../org/elasticsearch/xpack/XPackPlugin.java | 42 ++++++------- .../user/ChangePasswordRequestBuilder.java | 2 +- .../action/user/PutUserRequestBuilder.java | 2 +- .../xpack/security/authz/RoleDescriptor.java | 2 +- .../common/xcontent/XContentUtils.java | 45 +------------ .../elasticsearch/xpack/watcher/Watcher.java | 18 +++--- .../xpack/watcher/actions/ActionBuilders.java | 10 +-- .../watcher/actions/email/EmailAction.java | 16 ++--- .../actions/email/EmailActionFactory.java | 8 +-- .../actions/email/ExecutableEmailAction.java | 14 ++--- .../hipchat/ExecutableHipChatAction.java | 10 +-- .../actions/hipchat/HipChatAction.java | 8 +-- .../actions/hipchat/HipChatActionFactory.java | 6 +- .../actions/jira/ExecutableJiraAction.java | 10 +-- .../watcher/actions/jira/JiraAction.java | 4 +- .../actions/jira/JiraActionFactory.java | 4 +- .../logging/ExecutableLoggingAction.java | 2 +- .../actions/logging/LoggingAction.java | 2 +- .../actions/logging/LoggingActionFactory.java | 2 +- .../pagerduty/ExecutablePagerDutyAction.java | 10 +-- .../actions/pagerduty/PagerDutyAction.java | 4 +- .../pagerduty/PagerDutyActionFactory.java | 4 +- .../actions/slack/ExecutableSlackAction.java | 10 +-- .../watcher/actions/slack/SlackAction.java | 6 +- .../actions/slack/SlackActionFactory.java | 4 +- .../webhook/ExecutableWebhookAction.java | 8 +-- .../actions/webhook/WebhookAction.java | 6 +- .../actions/webhook/WebhookActionFactory.java | 6 +- .../{ => watcher}/common/http/HttpClient.java | 6 +- .../common/http/HttpContentType.java | 2 +- .../{ => watcher}/common/http/HttpMethod.java | 2 +- .../{ => watcher}/common/http/HttpProxy.java | 2 +- .../common/http/HttpRequest.java | 6 +- .../common/http/HttpRequestTemplate.java | 10 +-- .../common/http/HttpResponse.java | 2 +- .../common/http/HttpSettings.java | 2 +- .../{ => watcher}/common/http/Scheme.java | 2 +- .../common/http/SizeLimitInputStream.java | 2 +- .../common/http/auth/ApplicableHttpAuth.java | 2 +- .../common/http/auth/HttpAuth.java | 2 +- .../common/http/auth/HttpAuthFactory.java | 2 +- .../common/http/auth/HttpAuthRegistry.java | 2 +- .../http/auth/basic/ApplicableBasicAuth.java | 4 +- .../common/http/auth/basic/BasicAuth.java | 6 +- .../http/auth/basic/BasicAuthFactory.java | 4 +- .../{ => watcher}/common/secret/Secret.java | 2 +- .../{ => watcher}/common/stats/Counters.java | 2 +- .../common/text/TextTemplate.java | 2 +- .../common/text/TextTemplateEngine.java | 2 +- .../common/xcontent/XContentUtils.java | 45 +++++++++++++ .../condition/ArrayCompareCondition.java | 2 +- .../watcher/condition/CompareCondition.java | 2 +- .../watcher/execution/ExecutionService.java | 2 +- .../xpack/watcher/input/InputBuilders.java | 2 +- .../input/http/ExecutableHttpInput.java | 8 +-- .../xpack/watcher/input/http/HttpInput.java | 6 +- .../watcher/input/http/HttpInputFactory.java | 6 +- .../notification/NotificationService.java | 2 +- .../notification/email/Account.java | 4 +- .../notification/email/Attachment.java | 4 +- .../notification/email/Authentication.java | 4 +- .../notification/email/DataAttachment.java | 3 +- .../notification/email/Email.java | 2 +- .../notification/email/EmailService.java | 4 +- .../notification/email/EmailTemplate.java | 6 +- .../notification/email/HtmlSanitizer.java | 3 +- .../notification/email/Profile.java | 2 +- .../email/attachment/DataAttachment.java | 14 ++--- .../attachment/DataAttachmentParser.java | 10 +-- .../attachment/EmailAttachmentParser.java | 4 +- .../email/attachment/EmailAttachments.java | 2 +- .../attachment/EmailAttachmentsParser.java | 2 +- .../HttpEmailAttachementParser.java | 14 ++--- .../attachment/HttpRequestAttachment.java | 4 +- .../email/attachment/ReportingAttachment.java | 6 +- .../attachment/ReportingAttachmentParser.java | 24 +++---- .../email/support/BodyPartSource.java | 2 +- .../notification/hipchat/HipChatAccount.java | 8 +-- .../notification/hipchat/HipChatMessage.java | 6 +- .../notification/hipchat/HipChatServer.java | 4 +- .../notification/hipchat/HipChatService.java | 6 +- .../hipchat/IntegrationAccount.java | 20 +++--- .../notification/hipchat/SentMessages.java | 6 +- .../notification/hipchat/UserAccount.java | 20 +++--- .../notification/hipchat/V1Account.java | 20 +++--- .../notification/jira/JiraAccount.java | 16 ++--- .../notification/jira/JiraIssue.java | 6 +- .../notification/jira/JiraService.java | 6 +- .../notification/pagerduty/IncidentEvent.java | 14 ++--- .../pagerduty/IncidentEventContext.java | 6 +- .../pagerduty/IncidentEventDefaults.java | 2 +- .../pagerduty/PagerDutyAccount.java | 8 +-- .../pagerduty/PagerDutyService.java | 6 +- .../notification/pagerduty/SentEvent.java | 6 +- .../notification/slack/SentMessages.java | 8 +-- .../notification/slack/SlackAccount.java | 21 +++---- .../notification/slack/SlackService.java | 6 +- .../slack/message/Attachment.java | 6 +- .../slack/message/DynamicAttachments.java | 4 +- .../notification/slack/message/Field.java | 6 +- .../slack/message/MessageElement.java | 2 +- .../slack/message/SlackMessage.java | 6 +- .../slack/message/SlackMessageDefaults.java | 2 +- .../xcontent/WatcherXContentParser.java | 2 +- .../support/xcontent/XContentSource.java | 2 +- .../xpack/watcher/watch/Watch.java | 4 +- .../watch}/clock/HaltedClock.java | 2 +- .../AbstractLicenseServiceTestCase.java | 2 +- .../script/MockMustacheScriptEngine.java | 2 +- .../xpack/TimeWarpedXPackPlugin.java | 2 +- .../LocalExporterResourceIntegTests.java | 2 +- .../security/authc/TokenServiceTests.java | 3 +- .../xpack/test/rest/XPackRestTestCase.java | 8 --- .../watcher/WatcherIndexingListenerTests.java | 2 +- .../actions/email/EmailActionTests.java | 63 ++++++++++--------- .../actions/email/EmailAttachmentTests.java | 25 ++++---- .../hipchat/HipChatActionFactoryTests.java | 6 +- .../actions/hipchat/HipChatActionTests.java | 18 +++--- .../jira/ExecutableJiraActionTests.java | 20 +++--- .../actions/jira/JiraActionFactoryTests.java | 8 +-- .../watcher/actions/jira/JiraActionTests.java | 20 +++--- .../actions/logging/LoggingActionTests.java | 6 +- .../PagerDutyActionFactoryTests.java | 6 +- .../pagerduty/PagerDutyActionTests.java | 22 +++---- .../slack/ExecutableSlackActionTests.java | 16 ++--- .../slack/SlackActionFactoryTests.java | 8 +-- .../actions/slack/SlackActionTests.java | 20 +++--- .../throttler/ActionThrottleTests.java | 8 +-- .../actions/webhook/WebhookActionTests.java | 22 +++---- .../webhook/WebhookHttpsIntegrationTests.java | 10 +-- .../webhook/WebhookIntegrationTests.java | 8 +-- .../common/http/HttpClientTests.java | 8 +-- .../http/HttpConnectionTimeoutTests.java | 4 +- .../common/http/HttpReadTimeoutTests.java | 4 +- .../common/http/HttpRequestTemplateTests.java | 10 +-- .../common/http/HttpRequestTests.java | 8 +-- .../common/http/HttpResponseTests.java | 2 +- .../http/SizeLimitInputStreamTests.java | 2 +- .../common/stats/CountersTests.java | 2 +- .../common/text/TextTemplateTests.java | 2 +- .../condition/ArrayCompareConditionTests.java | 2 +- .../condition/CompareConditionTests.java | 2 +- .../execution/ExecutionServiceTests.java | 2 +- .../execution/TriggeredWatchStoreTests.java | 6 +- .../watcher/history/HistoryStoreTests.java | 10 +-- .../HistoryTemplateEmailMappingsTests.java | 4 +- .../HistoryTemplateHttpMappingsTests.java | 4 +- .../watcher/input/chain/ChainInputTests.java | 4 +- .../input/chain/ChainIntegrationTests.java | 4 +- .../input/http/HttpInputIntegrationTests.java | 6 +- .../watcher/input/http/HttpInputTests.java | 26 ++++---- .../notification/email/AccountTests.java | 6 +- .../notification/email/AccountsTests.java | 2 +- .../email/DataAttachmentTests.java | 2 +- .../email/EmailSecretsIntegrationTests.java | 7 ++- .../notification/email/EmailServiceTests.java | 4 +- .../email/EmailTemplateTests.java | 4 +- .../notification/email/EmailTests.java | 2 +- .../email/HtmlSanitizerTests.java | 2 +- .../notification/email/ProfileTests.java | 2 +- .../attachment/DataAttachmentParserTests.java | 2 +- .../EmailAttachmentParsersTests.java | 10 +-- .../HttpEmailAttachementParserTests.java | 16 ++--- .../ReportingAttachmentParserTests.java | 30 ++++----- .../email/support/EmailServer.java | 2 +- .../hipchat/HipChatAccountsTests.java | 12 ++-- .../hipchat/HipChatMessageTests.java | 10 +-- .../hipchat/HipChatServiceTests.java | 4 +- .../hipchat/IntegrationAccountTests.java | 12 ++-- .../hipchat/UserAccountTests.java | 14 ++--- .../notification/hipchat/V1AccountTests.java | 12 ++-- .../notification/jira/JiraAccountTests.java | 12 ++-- .../notification/jira/JiraIssueTests.java | 20 +++--- .../pagerduty/IncidentEventDefaultsTests.java | 2 +- .../pagerduty/PagerDutyAccountsTests.java | 13 ++-- .../slack/SlackAccountsTests.java | 7 +-- .../message/SlackMessageDefaultsTests.java | 2 +- .../slack/message/SlackMessageTests.java | 6 +- .../AbstractWatcherIntegrationTestCase.java | 10 +-- .../watcher/test/MockTextTemplateEngine.java | 4 +- .../xpack/watcher/test/WatcherTestUtils.java | 22 +++---- .../WatcherExecutorServiceBenchmark.java | 6 +- .../test/integration/HipChatServiceTests.java | 10 +-- .../HttpSecretsIntegrationTests.java | 6 +- .../integration/PagerDutyServiceTests.java | 10 +-- .../integration/SearchTransformTests.java | 2 +- .../test/integration/SlackServiceTests.java | 10 +-- .../test/integration/WatchMetadataTests.java | 2 +- .../action/delete/DeleteWatchTests.java | 2 +- .../trigger/ScheduleTriggerEngineMock.java | 2 +- .../engine/TickerScheduleEngineTests.java | 3 +- .../xpack/watcher/watch/WatchTests.java | 31 +++++---- .../watch}/clock/ClockMock.java | 2 +- .../watch}/clock/ClockTests.java | 2 +- .../xpack/restart/FullClusterRestartIT.java | 2 +- .../smoketest/WatcherTemplateIT.java | 4 +- 196 files changed, 749 insertions(+), 768 deletions(-) rename plugin/src/main/java/org/elasticsearch/xpack/{ => security}/common/xcontent/XContentUtils.java (54%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/common/http/HttpClient.java (98%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/common/http/HttpContentType.java (96%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/common/http/HttpMethod.java (95%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/common/http/HttpProxy.java (98%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/common/http/HttpRequest.java (99%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/common/http/HttpRequestTemplate.java (98%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/common/http/HttpResponse.java (99%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/common/http/HttpSettings.java (97%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/common/http/Scheme.java (95%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/common/http/SizeLimitInputStream.java (97%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/common/http/auth/ApplicableHttpAuth.java (96%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/common/http/auth/HttpAuth.java (86%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/common/http/auth/HttpAuthFactory.java (92%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/common/http/auth/HttpAuthRegistry.java (96%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/common/http/auth/basic/ApplicableBasicAuth.java (91%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/common/http/auth/basic/BasicAuth.java (94%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/common/http/auth/basic/BasicAuthFactory.java (88%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/common/secret/Secret.java (95%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/common/stats/Counters.java (98%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/common/text/TextTemplate.java (98%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/common/text/TextTemplateEngine.java (98%) create mode 100644 plugin/src/main/java/org/elasticsearch/xpack/watcher/common/xcontent/XContentUtils.java rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/NotificationService.java (98%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/email/Account.java (99%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/email/Attachment.java (98%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/email/Authentication.java (89%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/email/DataAttachment.java (97%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/email/Email.java (99%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/email/EmailService.java (95%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/email/EmailTemplate.java (98%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/email/HtmlSanitizer.java (98%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/email/Profile.java (99%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/email/attachment/DataAttachment.java (74%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/email/attachment/DataAttachmentParser.java (84%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/email/attachment/EmailAttachmentParser.java (94%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/email/attachment/EmailAttachments.java (96%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/email/attachment/EmailAttachmentsParser.java (97%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/email/attachment/HttpEmailAttachementParser.java (90%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/email/attachment/HttpRequestAttachment.java (96%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/email/attachment/ReportingAttachment.java (95%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/email/attachment/ReportingAttachmentParser.java (94%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/email/support/BodyPartSource.java (96%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/hipchat/HipChatAccount.java (95%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/hipchat/HipChatMessage.java (98%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/hipchat/HipChatServer.java (92%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/hipchat/HipChatService.java (90%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/hipchat/IntegrationAccount.java (89%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/hipchat/SentMessages.java (96%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/hipchat/UserAccount.java (91%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/hipchat/V1Account.java (89%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/jira/JiraAccount.java (89%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/jira/JiraIssue.java (97%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/jira/JiraService.java (87%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/pagerduty/IncidentEvent.java (97%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/pagerduty/IncidentEventContext.java (98%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/pagerduty/IncidentEventDefaults.java (98%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/pagerduty/PagerDutyAccount.java (88%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/pagerduty/PagerDutyService.java (86%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/pagerduty/SentEvent.java (97%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/slack/SentMessages.java (94%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/slack/SlackAccount.java (87%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/slack/SlackService.java (86%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/slack/message/Attachment.java (99%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/slack/message/DynamicAttachments.java (96%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/slack/message/Field.java (96%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/slack/message/MessageElement.java (88%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/slack/message/SlackMessage.java (98%) rename plugin/src/main/java/org/elasticsearch/xpack/{ => watcher}/notification/slack/message/SlackMessageDefaults.java (99%) rename plugin/src/main/java/org/elasticsearch/xpack/{support => watcher/watch}/clock/HaltedClock.java (95%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/common/http/HttpClientTests.java (98%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/common/http/HttpConnectionTimeoutTests.java (97%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/common/http/HttpReadTimeoutTests.java (97%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/common/http/HttpRequestTemplateTests.java (96%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/common/http/HttpRequestTests.java (96%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/common/http/HttpResponseTests.java (99%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/common/http/SizeLimitInputStreamTests.java (97%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/common/stats/CountersTests.java (95%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/common/text/TextTemplateTests.java (99%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/notification/email/AccountTests.java (98%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/notification/email/AccountsTests.java (98%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/notification/email/DataAttachmentTests.java (96%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/notification/email/EmailSecretsIntegrationTests.java (96%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/notification/email/EmailServiceTests.java (94%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/notification/email/EmailTemplateTests.java (97%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/notification/email/EmailTests.java (97%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/notification/email/HtmlSanitizerTests.java (99%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/notification/email/ProfileTests.java (97%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/notification/email/attachment/DataAttachmentParserTests.java (96%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/notification/email/attachment/EmailAttachmentParsersTests.java (96%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/notification/email/attachment/HttpEmailAttachementParserTests.java (92%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/notification/email/attachment/ReportingAttachmentParserTests.java (95%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/notification/email/support/EmailServer.java (98%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/notification/hipchat/HipChatAccountsTests.java (95%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/notification/hipchat/HipChatMessageTests.java (97%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/notification/hipchat/HipChatServiceTests.java (99%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/notification/hipchat/IntegrationAccountTests.java (94%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/notification/hipchat/UserAccountTests.java (96%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/notification/hipchat/V1AccountTests.java (94%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/notification/jira/JiraAccountTests.java (97%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/notification/jira/JiraIssueTests.java (88%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/notification/pagerduty/IncidentEventDefaultsTests.java (98%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/notification/pagerduty/PagerDutyAccountsTests.java (94%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/notification/slack/SlackAccountsTests.java (96%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/notification/slack/message/SlackMessageDefaultsTests.java (98%) rename plugin/src/test/java/org/elasticsearch/xpack/{ => watcher}/notification/slack/message/SlackMessageTests.java (99%) rename plugin/src/test/java/org/elasticsearch/xpack/{support => watcher/watch}/clock/ClockMock.java (98%) rename plugin/src/test/java/org/elasticsearch/xpack/{support => watcher/watch}/clock/ClockTests.java (95%) diff --git a/plugin/src/main/java/org/elasticsearch/xpack/XPackPlugin.java b/plugin/src/main/java/org/elasticsearch/xpack/XPackPlugin.java index f231fbe046c..dee875efd6d 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/XPackPlugin.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/XPackPlugin.java @@ -62,14 +62,14 @@ import org.elasticsearch.xpack.action.TransportXPackInfoAction; import org.elasticsearch.xpack.action.TransportXPackUsageAction; import org.elasticsearch.xpack.action.XPackInfoAction; import org.elasticsearch.xpack.action.XPackUsageAction; -import org.elasticsearch.xpack.common.http.HttpClient; -import org.elasticsearch.xpack.common.http.HttpRequestTemplate; -import org.elasticsearch.xpack.common.http.HttpSettings; -import org.elasticsearch.xpack.common.http.auth.HttpAuthFactory; -import org.elasticsearch.xpack.common.http.auth.HttpAuthRegistry; -import org.elasticsearch.xpack.common.http.auth.basic.BasicAuth; -import org.elasticsearch.xpack.common.http.auth.basic.BasicAuthFactory; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.common.http.HttpClient; +import org.elasticsearch.xpack.watcher.common.http.HttpRequestTemplate; +import org.elasticsearch.xpack.watcher.common.http.HttpSettings; +import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuthFactory; +import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuthRegistry; +import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuth; +import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuthFactory; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; import org.elasticsearch.xpack.deprecation.Deprecation; import org.elasticsearch.xpack.extensions.XPackExtension; import org.elasticsearch.xpack.extensions.XPackExtensionsService; @@ -81,19 +81,19 @@ import org.elasticsearch.xpack.ml.MachineLearning; import org.elasticsearch.xpack.ml.MachineLearningFeatureSet; import org.elasticsearch.xpack.monitoring.Monitoring; import org.elasticsearch.xpack.monitoring.MonitoringFeatureSet; -import org.elasticsearch.xpack.notification.email.Account; -import org.elasticsearch.xpack.notification.email.EmailService; -import org.elasticsearch.xpack.notification.email.attachment.DataAttachmentParser; -import org.elasticsearch.xpack.notification.email.attachment.EmailAttachmentParser; -import org.elasticsearch.xpack.notification.email.attachment.EmailAttachmentsParser; -import org.elasticsearch.xpack.notification.email.attachment.HttpEmailAttachementParser; -import org.elasticsearch.xpack.notification.email.attachment.ReportingAttachmentParser; -import org.elasticsearch.xpack.notification.email.support.BodyPartSource; -import org.elasticsearch.xpack.notification.hipchat.HipChatService; -import org.elasticsearch.xpack.notification.jira.JiraService; -import org.elasticsearch.xpack.notification.pagerduty.PagerDutyAccount; -import org.elasticsearch.xpack.notification.pagerduty.PagerDutyService; -import org.elasticsearch.xpack.notification.slack.SlackService; +import org.elasticsearch.xpack.watcher.notification.email.Account; +import org.elasticsearch.xpack.watcher.notification.email.EmailService; +import org.elasticsearch.xpack.watcher.notification.email.attachment.DataAttachmentParser; +import org.elasticsearch.xpack.watcher.notification.email.attachment.EmailAttachmentParser; +import org.elasticsearch.xpack.watcher.notification.email.attachment.EmailAttachmentsParser; +import org.elasticsearch.xpack.watcher.notification.email.attachment.HttpEmailAttachementParser; +import org.elasticsearch.xpack.watcher.notification.email.attachment.ReportingAttachmentParser; +import org.elasticsearch.xpack.watcher.notification.email.support.BodyPartSource; +import org.elasticsearch.xpack.watcher.notification.hipchat.HipChatService; +import org.elasticsearch.xpack.watcher.notification.jira.JiraService; +import org.elasticsearch.xpack.watcher.notification.pagerduty.PagerDutyAccount; +import org.elasticsearch.xpack.watcher.notification.pagerduty.PagerDutyService; +import org.elasticsearch.xpack.watcher.notification.slack.SlackService; import org.elasticsearch.xpack.rest.action.RestXPackInfoAction; import org.elasticsearch.xpack.rest.action.RestXPackUsageAction; import org.elasticsearch.xpack.security.InternalClient; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/security/action/user/ChangePasswordRequestBuilder.java b/plugin/src/main/java/org/elasticsearch/xpack/security/action/user/ChangePasswordRequestBuilder.java index 95179655991..93a32287d46 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/security/action/user/ChangePasswordRequestBuilder.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/security/action/user/ChangePasswordRequestBuilder.java @@ -18,7 +18,7 @@ import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.xpack.security.authc.support.Hasher; import org.elasticsearch.xpack.security.support.Validation; import org.elasticsearch.xpack.security.user.User; -import org.elasticsearch.xpack.common.xcontent.XContentUtils; +import org.elasticsearch.xpack.security.common.xcontent.XContentUtils; import java.io.IOException; import java.nio.CharBuffer; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/security/action/user/PutUserRequestBuilder.java b/plugin/src/main/java/org/elasticsearch/xpack/security/action/user/PutUserRequestBuilder.java index a8f91df37f0..2af4cf1a61a 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/security/action/user/PutUserRequestBuilder.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/security/action/user/PutUserRequestBuilder.java @@ -21,7 +21,7 @@ import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.xpack.security.authc.support.Hasher; import org.elasticsearch.xpack.security.support.Validation; import org.elasticsearch.xpack.security.user.User; -import org.elasticsearch.xpack.common.xcontent.XContentUtils; +import org.elasticsearch.xpack.security.common.xcontent.XContentUtils; import java.io.IOException; import java.util.Arrays; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/security/authz/RoleDescriptor.java b/plugin/src/main/java/org/elasticsearch/xpack/security/authz/RoleDescriptor.java index 9cb2d2dcb1e..ec0e57c3aeb 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/security/authz/RoleDescriptor.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/security/authz/RoleDescriptor.java @@ -23,7 +23,7 @@ import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.json.JsonXContent; -import org.elasticsearch.xpack.common.xcontent.XContentUtils; +import org.elasticsearch.xpack.security.common.xcontent.XContentUtils; import org.elasticsearch.xpack.security.support.MetadataUtils; import org.elasticsearch.xpack.security.support.Validation; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/common/xcontent/XContentUtils.java b/plugin/src/main/java/org/elasticsearch/xpack/security/common/xcontent/XContentUtils.java similarity index 54% rename from plugin/src/main/java/org/elasticsearch/xpack/common/xcontent/XContentUtils.java rename to plugin/src/main/java/org/elasticsearch/xpack/security/common/xcontent/XContentUtils.java index 6762b1a3c12..c83c202f99f 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/common/xcontent/XContentUtils.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/security/common/xcontent/XContentUtils.java @@ -3,15 +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.common.xcontent; +package org.elasticsearch.xpack.security.common.xcontent; import org.elasticsearch.ElasticsearchParseException; -import org.elasticsearch.common.bytes.BytesReference; -import org.elasticsearch.common.collect.Tuple; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.common.xcontent.XContentType; import java.io.IOException; import java.util.ArrayList; @@ -62,42 +57,4 @@ public class XContentUtils { } return list.toArray(new String[list.size()]); } - - // TODO open this up in core - public static List readList(XContentParser parser, XContentParser.Token token) throws IOException { - List list = new ArrayList<>(); - while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { - list.add(readValue(parser, token)); - } - return list; - } - - // TODO open this up in core - public static Object readValue(XContentParser parser, XContentParser.Token token) throws IOException { - if (token == XContentParser.Token.VALUE_NULL) { - return null; - } else if (token == XContentParser.Token.VALUE_STRING) { - return parser.text(); - } else if (token == XContentParser.Token.VALUE_NUMBER) { - XContentParser.NumberType numberType = parser.numberType(); - if (numberType == XContentParser.NumberType.INT) { - return parser.intValue(); - } else if (numberType == XContentParser.NumberType.LONG) { - return parser.longValue(); - } else if (numberType == XContentParser.NumberType.FLOAT) { - return parser.floatValue(); - } else if (numberType == XContentParser.NumberType.DOUBLE) { - return parser.doubleValue(); - } - } else if (token == XContentParser.Token.VALUE_BOOLEAN) { - return parser.booleanValue(); - } else if (token == XContentParser.Token.START_OBJECT) { - return parser.map(); - } else if (token == XContentParser.Token.START_ARRAY) { - return readList(parser, token); - } else if (token == XContentParser.Token.VALUE_EMBEDDED_OBJECT) { - return parser.binaryValue(); - } - return null; - } } diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/Watcher.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/Watcher.java index ba19df1bf64..2282dc48bf2 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/Watcher.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/Watcher.java @@ -49,15 +49,15 @@ import org.elasticsearch.threadpool.FixedExecutorBuilder; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.xpack.XPackPlugin; import org.elasticsearch.xpack.XPackSettings; -import org.elasticsearch.xpack.common.http.HttpClient; -import org.elasticsearch.xpack.common.http.HttpRequestTemplate; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; -import org.elasticsearch.xpack.notification.email.EmailService; -import org.elasticsearch.xpack.notification.email.attachment.EmailAttachmentsParser; -import org.elasticsearch.xpack.notification.hipchat.HipChatService; -import org.elasticsearch.xpack.notification.jira.JiraService; -import org.elasticsearch.xpack.notification.pagerduty.PagerDutyService; -import org.elasticsearch.xpack.notification.slack.SlackService; +import org.elasticsearch.xpack.watcher.common.http.HttpClient; +import org.elasticsearch.xpack.watcher.common.http.HttpRequestTemplate; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.notification.email.EmailService; +import org.elasticsearch.xpack.watcher.notification.email.attachment.EmailAttachmentsParser; +import org.elasticsearch.xpack.watcher.notification.hipchat.HipChatService; +import org.elasticsearch.xpack.watcher.notification.jira.JiraService; +import org.elasticsearch.xpack.watcher.notification.pagerduty.PagerDutyService; +import org.elasticsearch.xpack.watcher.notification.slack.SlackService; import org.elasticsearch.xpack.security.InternalClient; import org.elasticsearch.xpack.security.crypto.CryptoService; import org.elasticsearch.xpack.watcher.actions.ActionFactory; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/ActionBuilders.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/ActionBuilders.java index b3445098a19..ab068c2e345 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/ActionBuilders.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/ActionBuilders.java @@ -6,11 +6,11 @@ package org.elasticsearch.xpack.watcher.actions; import org.elasticsearch.common.collect.MapBuilder; -import org.elasticsearch.xpack.common.http.HttpRequestTemplate; -import org.elasticsearch.xpack.common.text.TextTemplate; -import org.elasticsearch.xpack.notification.email.EmailTemplate; -import org.elasticsearch.xpack.notification.pagerduty.IncidentEvent; -import org.elasticsearch.xpack.notification.slack.message.SlackMessage; +import org.elasticsearch.xpack.watcher.common.http.HttpRequestTemplate; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.notification.email.EmailTemplate; +import org.elasticsearch.xpack.watcher.notification.pagerduty.IncidentEvent; +import org.elasticsearch.xpack.watcher.notification.slack.message.SlackMessage; import org.elasticsearch.xpack.watcher.actions.email.EmailAction; import org.elasticsearch.xpack.watcher.actions.hipchat.HipChatAction; import org.elasticsearch.xpack.watcher.actions.index.IndexAction; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/email/EmailAction.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/email/EmailAction.java index f05df948d52..b306dc75594 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/email/EmailAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/email/EmailAction.java @@ -10,14 +10,14 @@ import org.elasticsearch.common.Nullable; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.common.secret.Secret; -import org.elasticsearch.xpack.notification.email.Authentication; -import org.elasticsearch.xpack.notification.email.DataAttachment; -import org.elasticsearch.xpack.notification.email.Email; -import org.elasticsearch.xpack.notification.email.EmailTemplate; -import org.elasticsearch.xpack.notification.email.Profile; -import org.elasticsearch.xpack.notification.email.attachment.EmailAttachments; -import org.elasticsearch.xpack.notification.email.attachment.EmailAttachmentsParser; +import org.elasticsearch.xpack.watcher.common.secret.Secret; +import org.elasticsearch.xpack.watcher.notification.email.Authentication; +import org.elasticsearch.xpack.watcher.notification.email.DataAttachment; +import org.elasticsearch.xpack.watcher.notification.email.Email; +import org.elasticsearch.xpack.watcher.notification.email.EmailTemplate; +import org.elasticsearch.xpack.watcher.notification.email.Profile; +import org.elasticsearch.xpack.watcher.notification.email.attachment.EmailAttachments; +import org.elasticsearch.xpack.watcher.notification.email.attachment.EmailAttachmentsParser; import org.elasticsearch.xpack.watcher.actions.Action; import org.elasticsearch.xpack.watcher.support.xcontent.WatcherParams; import org.elasticsearch.xpack.watcher.support.xcontent.WatcherXContentParser; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/email/EmailActionFactory.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/email/EmailActionFactory.java index c364596948c..7f664c3ac1d 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/email/EmailActionFactory.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/email/EmailActionFactory.java @@ -8,11 +8,11 @@ package org.elasticsearch.xpack.watcher.actions.email; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; import org.elasticsearch.xpack.watcher.actions.ActionFactory; -import org.elasticsearch.xpack.notification.email.EmailService; -import org.elasticsearch.xpack.notification.email.HtmlSanitizer; -import org.elasticsearch.xpack.notification.email.attachment.EmailAttachmentsParser; +import org.elasticsearch.xpack.watcher.notification.email.EmailService; +import org.elasticsearch.xpack.watcher.notification.email.HtmlSanitizer; +import org.elasticsearch.xpack.watcher.notification.email.attachment.EmailAttachmentsParser; import java.io.IOException; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/email/ExecutableEmailAction.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/email/ExecutableEmailAction.java index 45e83a62564..a24a331adf1 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/email/ExecutableEmailAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/email/ExecutableEmailAction.java @@ -7,13 +7,13 @@ package org.elasticsearch.xpack.watcher.actions.email; import org.apache.logging.log4j.Logger; import org.elasticsearch.ElasticsearchException; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; -import org.elasticsearch.xpack.notification.email.Attachment; -import org.elasticsearch.xpack.notification.email.DataAttachment; -import org.elasticsearch.xpack.notification.email.Email; -import org.elasticsearch.xpack.notification.email.EmailService; -import org.elasticsearch.xpack.notification.email.HtmlSanitizer; -import org.elasticsearch.xpack.notification.email.attachment.EmailAttachmentParser; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.notification.email.Attachment; +import org.elasticsearch.xpack.watcher.notification.email.DataAttachment; +import org.elasticsearch.xpack.watcher.notification.email.Email; +import org.elasticsearch.xpack.watcher.notification.email.EmailService; +import org.elasticsearch.xpack.watcher.notification.email.HtmlSanitizer; +import org.elasticsearch.xpack.watcher.notification.email.attachment.EmailAttachmentParser; import org.elasticsearch.xpack.watcher.actions.Action; import org.elasticsearch.xpack.watcher.actions.ExecutableAction; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/hipchat/ExecutableHipChatAction.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/hipchat/ExecutableHipChatAction.java index ec5d892362b..af22925caa4 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/hipchat/ExecutableHipChatAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/hipchat/ExecutableHipChatAction.java @@ -6,11 +6,11 @@ package org.elasticsearch.xpack.watcher.actions.hipchat; import org.apache.logging.log4j.Logger; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; -import org.elasticsearch.xpack.notification.hipchat.HipChatAccount; -import org.elasticsearch.xpack.notification.hipchat.HipChatMessage; -import org.elasticsearch.xpack.notification.hipchat.HipChatService; -import org.elasticsearch.xpack.notification.hipchat.SentMessages; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.notification.hipchat.HipChatAccount; +import org.elasticsearch.xpack.watcher.notification.hipchat.HipChatMessage; +import org.elasticsearch.xpack.watcher.notification.hipchat.HipChatService; +import org.elasticsearch.xpack.watcher.notification.hipchat.SentMessages; import org.elasticsearch.xpack.watcher.actions.Action; import org.elasticsearch.xpack.watcher.actions.ExecutableAction; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/hipchat/HipChatAction.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/hipchat/HipChatAction.java index 92e98d080f3..23a0a3b821a 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/hipchat/HipChatAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/hipchat/HipChatAction.java @@ -11,10 +11,10 @@ import org.elasticsearch.common.Nullable; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.common.http.HttpProxy; -import org.elasticsearch.xpack.common.text.TextTemplate; -import org.elasticsearch.xpack.notification.hipchat.HipChatMessage; -import org.elasticsearch.xpack.notification.hipchat.SentMessages; +import org.elasticsearch.xpack.watcher.common.http.HttpProxy; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.notification.hipchat.HipChatMessage; +import org.elasticsearch.xpack.watcher.notification.hipchat.SentMessages; import org.elasticsearch.xpack.watcher.actions.Action; import java.io.IOException; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/hipchat/HipChatActionFactory.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/hipchat/HipChatActionFactory.java index ddb27c34c48..a94f4cc1339 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/hipchat/HipChatActionFactory.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/hipchat/HipChatActionFactory.java @@ -8,10 +8,10 @@ package org.elasticsearch.xpack.watcher.actions.hipchat; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; import org.elasticsearch.xpack.watcher.actions.ActionFactory; -import org.elasticsearch.xpack.notification.hipchat.HipChatAccount; -import org.elasticsearch.xpack.notification.hipchat.HipChatService; +import org.elasticsearch.xpack.watcher.notification.hipchat.HipChatAccount; +import org.elasticsearch.xpack.watcher.notification.hipchat.HipChatService; import java.io.IOException; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/jira/ExecutableJiraAction.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/jira/ExecutableJiraAction.java index 4d3f28c2ad7..89970667605 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/jira/ExecutableJiraAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/jira/ExecutableJiraAction.java @@ -6,11 +6,11 @@ package org.elasticsearch.xpack.watcher.actions.jira; import org.apache.logging.log4j.Logger; -import org.elasticsearch.xpack.common.text.TextTemplate; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; -import org.elasticsearch.xpack.notification.jira.JiraAccount; -import org.elasticsearch.xpack.notification.jira.JiraIssue; -import org.elasticsearch.xpack.notification.jira.JiraService; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.notification.jira.JiraAccount; +import org.elasticsearch.xpack.watcher.notification.jira.JiraIssue; +import org.elasticsearch.xpack.watcher.notification.jira.JiraService; import org.elasticsearch.xpack.watcher.actions.Action; import org.elasticsearch.xpack.watcher.actions.ExecutableAction; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/jira/JiraAction.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/jira/JiraAction.java index 90f0c610bb5..e3aeb341096 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/jira/JiraAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/jira/JiraAction.java @@ -11,8 +11,8 @@ import org.elasticsearch.common.Nullable; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.common.http.HttpProxy; -import org.elasticsearch.xpack.notification.jira.JiraIssue; +import org.elasticsearch.xpack.watcher.common.http.HttpProxy; +import org.elasticsearch.xpack.watcher.notification.jira.JiraIssue; import org.elasticsearch.xpack.watcher.actions.Action; import java.io.IOException; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/jira/JiraActionFactory.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/jira/JiraActionFactory.java index 47050419bee..1f74e15e584 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/jira/JiraActionFactory.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/jira/JiraActionFactory.java @@ -8,8 +8,8 @@ package org.elasticsearch.xpack.watcher.actions.jira; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; -import org.elasticsearch.xpack.notification.jira.JiraService; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.notification.jira.JiraService; import org.elasticsearch.xpack.watcher.actions.ActionFactory; import java.io.IOException; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/logging/ExecutableLoggingAction.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/logging/ExecutableLoggingAction.java index e4a07d789ee..d4a6ec43fa4 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/logging/ExecutableLoggingAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/logging/ExecutableLoggingAction.java @@ -8,7 +8,7 @@ package org.elasticsearch.xpack.watcher.actions.logging; import org.apache.logging.log4j.Logger; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; import org.elasticsearch.xpack.watcher.actions.Action; import org.elasticsearch.xpack.watcher.actions.ExecutableAction; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/logging/LoggingAction.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/logging/LoggingAction.java index ae2c07d36f6..0dbb415ef1d 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/logging/LoggingAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/logging/LoggingAction.java @@ -10,7 +10,7 @@ import org.elasticsearch.common.Nullable; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; import org.elasticsearch.xpack.watcher.actions.Action; import java.io.IOException; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/logging/LoggingActionFactory.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/logging/LoggingActionFactory.java index 23552affddb..97b7035dbc6 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/logging/LoggingActionFactory.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/logging/LoggingActionFactory.java @@ -8,7 +8,7 @@ package org.elasticsearch.xpack.watcher.actions.logging; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; import org.elasticsearch.xpack.watcher.actions.ActionFactory; import java.io.IOException; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/pagerduty/ExecutablePagerDutyAction.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/pagerduty/ExecutablePagerDutyAction.java index 549a2270003..6bd14162b06 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/pagerduty/ExecutablePagerDutyAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/pagerduty/ExecutablePagerDutyAction.java @@ -6,11 +6,11 @@ package org.elasticsearch.xpack.watcher.actions.pagerduty; import org.apache.logging.log4j.Logger; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; -import org.elasticsearch.xpack.notification.pagerduty.IncidentEvent; -import org.elasticsearch.xpack.notification.pagerduty.PagerDutyAccount; -import org.elasticsearch.xpack.notification.pagerduty.PagerDutyService; -import org.elasticsearch.xpack.notification.pagerduty.SentEvent; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.notification.pagerduty.IncidentEvent; +import org.elasticsearch.xpack.watcher.notification.pagerduty.PagerDutyAccount; +import org.elasticsearch.xpack.watcher.notification.pagerduty.PagerDutyService; +import org.elasticsearch.xpack.watcher.notification.pagerduty.SentEvent; import org.elasticsearch.xpack.watcher.actions.Action; import org.elasticsearch.xpack.watcher.actions.ExecutableAction; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/pagerduty/PagerDutyAction.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/pagerduty/PagerDutyAction.java index debab898d63..f7aa819205c 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/pagerduty/PagerDutyAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/pagerduty/PagerDutyAction.java @@ -10,8 +10,8 @@ import org.elasticsearch.common.ParseField; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.xpack.watcher.actions.Action; -import org.elasticsearch.xpack.notification.pagerduty.IncidentEvent; -import org.elasticsearch.xpack.notification.pagerduty.SentEvent; +import org.elasticsearch.xpack.watcher.notification.pagerduty.IncidentEvent; +import org.elasticsearch.xpack.watcher.notification.pagerduty.SentEvent; import java.io.IOException; import java.util.Objects; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/pagerduty/PagerDutyActionFactory.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/pagerduty/PagerDutyActionFactory.java index 4ac031ec46c..02982082ed7 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/pagerduty/PagerDutyActionFactory.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/pagerduty/PagerDutyActionFactory.java @@ -8,8 +8,8 @@ package org.elasticsearch.xpack.watcher.actions.pagerduty; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; -import org.elasticsearch.xpack.notification.pagerduty.PagerDutyService; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.notification.pagerduty.PagerDutyService; import org.elasticsearch.xpack.watcher.actions.ActionFactory; import java.io.IOException; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/slack/ExecutableSlackAction.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/slack/ExecutableSlackAction.java index 978a7a26c34..35ce6f118e5 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/slack/ExecutableSlackAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/slack/ExecutableSlackAction.java @@ -6,11 +6,11 @@ package org.elasticsearch.xpack.watcher.actions.slack; import org.apache.logging.log4j.Logger; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; -import org.elasticsearch.xpack.notification.slack.SentMessages; -import org.elasticsearch.xpack.notification.slack.SlackAccount; -import org.elasticsearch.xpack.notification.slack.SlackService; -import org.elasticsearch.xpack.notification.slack.message.SlackMessage; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.notification.slack.SentMessages; +import org.elasticsearch.xpack.watcher.notification.slack.SlackAccount; +import org.elasticsearch.xpack.watcher.notification.slack.SlackService; +import org.elasticsearch.xpack.watcher.notification.slack.message.SlackMessage; import org.elasticsearch.xpack.watcher.actions.Action; import org.elasticsearch.xpack.watcher.actions.ExecutableAction; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/slack/SlackAction.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/slack/SlackAction.java index a10ad30c0dd..d7d7df785ed 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/slack/SlackAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/slack/SlackAction.java @@ -11,9 +11,9 @@ import org.elasticsearch.common.Nullable; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.common.http.HttpProxy; -import org.elasticsearch.xpack.notification.slack.SentMessages; -import org.elasticsearch.xpack.notification.slack.message.SlackMessage; +import org.elasticsearch.xpack.watcher.common.http.HttpProxy; +import org.elasticsearch.xpack.watcher.notification.slack.SentMessages; +import org.elasticsearch.xpack.watcher.notification.slack.message.SlackMessage; import org.elasticsearch.xpack.watcher.actions.Action; import java.io.IOException; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/slack/SlackActionFactory.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/slack/SlackActionFactory.java index d19998abe4c..d455921a933 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/slack/SlackActionFactory.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/slack/SlackActionFactory.java @@ -8,8 +8,8 @@ package org.elasticsearch.xpack.watcher.actions.slack; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; -import org.elasticsearch.xpack.notification.slack.SlackService; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.notification.slack.SlackService; import org.elasticsearch.xpack.watcher.actions.ActionFactory; import java.io.IOException; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/webhook/ExecutableWebhookAction.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/webhook/ExecutableWebhookAction.java index 3c34234f90e..095b35c48f8 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/webhook/ExecutableWebhookAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/webhook/ExecutableWebhookAction.java @@ -6,10 +6,10 @@ package org.elasticsearch.xpack.watcher.actions.webhook; import org.apache.logging.log4j.Logger; -import org.elasticsearch.xpack.common.http.HttpClient; -import org.elasticsearch.xpack.common.http.HttpRequest; -import org.elasticsearch.xpack.common.http.HttpResponse; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.common.http.HttpClient; +import org.elasticsearch.xpack.watcher.common.http.HttpRequest; +import org.elasticsearch.xpack.watcher.common.http.HttpResponse; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; import org.elasticsearch.xpack.watcher.actions.Action; import org.elasticsearch.xpack.watcher.actions.ExecutableAction; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookAction.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookAction.java index b67a59b7d38..383189f5bf1 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookAction.java @@ -9,9 +9,9 @@ import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.common.http.HttpRequest; -import org.elasticsearch.xpack.common.http.HttpRequestTemplate; -import org.elasticsearch.xpack.common.http.HttpResponse; +import org.elasticsearch.xpack.watcher.common.http.HttpRequest; +import org.elasticsearch.xpack.watcher.common.http.HttpRequestTemplate; +import org.elasticsearch.xpack.watcher.common.http.HttpResponse; import org.elasticsearch.xpack.watcher.actions.Action; import java.io.IOException; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookActionFactory.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookActionFactory.java index b1197bc5966..c03080ff6e8 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookActionFactory.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookActionFactory.java @@ -8,10 +8,10 @@ package org.elasticsearch.xpack.watcher.actions.webhook; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; import org.elasticsearch.xpack.watcher.actions.ActionFactory; -import org.elasticsearch.xpack.common.http.HttpClient; -import org.elasticsearch.xpack.common.http.HttpRequestTemplate; +import org.elasticsearch.xpack.watcher.common.http.HttpClient; +import org.elasticsearch.xpack.watcher.common.http.HttpRequestTemplate; import java.io.IOException; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/common/http/HttpClient.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpClient.java similarity index 98% rename from plugin/src/main/java/org/elasticsearch/xpack/common/http/HttpClient.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpClient.java index 77cf7ca7896..43b7bd38b64 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/common/http/HttpClient.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpClient.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.common.http; +package org.elasticsearch.xpack.watcher.common.http; import org.apache.http.Header; import org.apache.http.HttpHeaders; @@ -38,8 +38,8 @@ import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentType; -import org.elasticsearch.xpack.common.http.auth.ApplicableHttpAuth; -import org.elasticsearch.xpack.common.http.auth.HttpAuthRegistry; +import org.elasticsearch.xpack.watcher.common.http.auth.ApplicableHttpAuth; +import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuthRegistry; import org.elasticsearch.xpack.common.socket.SocketAccess; import org.elasticsearch.xpack.ssl.SSLService; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/common/http/HttpContentType.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpContentType.java similarity index 96% rename from plugin/src/main/java/org/elasticsearch/xpack/common/http/HttpContentType.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpContentType.java index d39b1e0a081..e08a2ffdb4b 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/common/http/HttpContentType.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpContentType.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.common.http; +package org.elasticsearch.xpack.watcher.common.http; import org.elasticsearch.common.xcontent.XContentType; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/common/http/HttpMethod.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpMethod.java similarity index 95% rename from plugin/src/main/java/org/elasticsearch/xpack/common/http/HttpMethod.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpMethod.java index 81f5b53444a..67e4d6a7abd 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/common/http/HttpMethod.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpMethod.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.common.http; +package org.elasticsearch.xpack.watcher.common.http; import java.util.Locale; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/common/http/HttpProxy.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpProxy.java similarity index 98% rename from plugin/src/main/java/org/elasticsearch/xpack/common/http/HttpProxy.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpProxy.java index 5c86b55e755..c94b219a9b0 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/common/http/HttpProxy.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpProxy.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.common.http; +package org.elasticsearch.xpack.watcher.common.http; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.ParseField; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/common/http/HttpRequest.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpRequest.java similarity index 99% rename from plugin/src/main/java/org/elasticsearch/xpack/common/http/HttpRequest.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpRequest.java index 4178ae16009..07f82b52a6f 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/common/http/HttpRequest.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpRequest.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.common.http; +package org.elasticsearch.xpack.watcher.common.http; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.Nullable; @@ -16,8 +16,8 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.rest.RestUtils; -import org.elasticsearch.xpack.common.http.auth.HttpAuth; -import org.elasticsearch.xpack.common.http.auth.HttpAuthRegistry; +import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuth; +import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuthRegistry; import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils; import org.elasticsearch.xpack.watcher.support.WatcherUtils; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/common/http/HttpRequestTemplate.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpRequestTemplate.java similarity index 98% rename from plugin/src/main/java/org/elasticsearch/xpack/common/http/HttpRequestTemplate.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpRequestTemplate.java index d8386e6161d..2458e1d9d01 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/common/http/HttpRequestTemplate.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpRequestTemplate.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.common.http; +package org.elasticsearch.xpack.watcher.common.http; import io.netty.handler.codec.http.HttpHeaders; @@ -18,10 +18,10 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.RestUtils; import org.elasticsearch.script.ScriptType; -import org.elasticsearch.xpack.common.http.auth.HttpAuth; -import org.elasticsearch.xpack.common.http.auth.HttpAuthRegistry; -import org.elasticsearch.xpack.common.text.TextTemplate; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuth; +import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuthRegistry; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils; import java.io.IOException; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/common/http/HttpResponse.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpResponse.java similarity index 99% rename from plugin/src/main/java/org/elasticsearch/xpack/common/http/HttpResponse.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpResponse.java index 8c6ea5804ef..ef704bdb216 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/common/http/HttpResponse.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpResponse.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.common.http; +package org.elasticsearch.xpack.watcher.common.http; import io.netty.handler.codec.http.HttpHeaders; import org.elasticsearch.ElasticsearchParseException; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/common/http/HttpSettings.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpSettings.java similarity index 97% rename from plugin/src/main/java/org/elasticsearch/xpack/common/http/HttpSettings.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpSettings.java index 52e9b94d868..ca1dacdaa73 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/common/http/HttpSettings.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpSettings.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.common.http; +package org.elasticsearch.xpack.watcher.common.http; import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.unit.ByteSizeUnit; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/common/http/Scheme.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/Scheme.java similarity index 95% rename from plugin/src/main/java/org/elasticsearch/xpack/common/http/Scheme.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/Scheme.java index 6d74361aad0..04557271c26 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/common/http/Scheme.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/Scheme.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.common.http; +package org.elasticsearch.xpack.watcher.common.http; import java.util.Locale; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/common/http/SizeLimitInputStream.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/SizeLimitInputStream.java similarity index 97% rename from plugin/src/main/java/org/elasticsearch/xpack/common/http/SizeLimitInputStream.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/SizeLimitInputStream.java index cc17ed8a6e8..5d724915de7 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/common/http/SizeLimitInputStream.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/SizeLimitInputStream.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.common.http; +package org.elasticsearch.xpack.watcher.common.http; import org.elasticsearch.common.unit.ByteSizeValue; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/common/http/auth/ApplicableHttpAuth.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/auth/ApplicableHttpAuth.java similarity index 96% rename from plugin/src/main/java/org/elasticsearch/xpack/common/http/auth/ApplicableHttpAuth.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/auth/ApplicableHttpAuth.java index 7da8a9d8fa8..cecc7bfda79 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/common/http/auth/ApplicableHttpAuth.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/auth/ApplicableHttpAuth.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.common.http.auth; +package org.elasticsearch.xpack.watcher.common.http.auth; import org.apache.http.auth.AuthScope; import org.apache.http.client.CredentialsProvider; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/common/http/auth/HttpAuth.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/auth/HttpAuth.java similarity index 86% rename from plugin/src/main/java/org/elasticsearch/xpack/common/http/auth/HttpAuth.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/auth/HttpAuth.java index 2f2cdd4f168..0909a33ab73 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/common/http/auth/HttpAuth.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/auth/HttpAuth.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.common.http.auth; +package org.elasticsearch.xpack.watcher.common.http.auth; import org.elasticsearch.common.xcontent.ToXContentObject; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/common/http/auth/HttpAuthFactory.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/auth/HttpAuthFactory.java similarity index 92% rename from plugin/src/main/java/org/elasticsearch/xpack/common/http/auth/HttpAuthFactory.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/auth/HttpAuthFactory.java index 3a142356fe6..7667e568b0a 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/common/http/auth/HttpAuthFactory.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/auth/HttpAuthFactory.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.common.http.auth; +package org.elasticsearch.xpack.watcher.common.http.auth; import org.elasticsearch.common.xcontent.XContentParser; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/common/http/auth/HttpAuthRegistry.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/auth/HttpAuthRegistry.java similarity index 96% rename from plugin/src/main/java/org/elasticsearch/xpack/common/http/auth/HttpAuthRegistry.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/auth/HttpAuthRegistry.java index 9e73dbfac0a..2f217236707 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/common/http/auth/HttpAuthRegistry.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/auth/HttpAuthRegistry.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.common.http.auth; +package org.elasticsearch.xpack.watcher.common.http.auth; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.xcontent.XContentParser; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/common/http/auth/basic/ApplicableBasicAuth.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/auth/basic/ApplicableBasicAuth.java similarity index 91% rename from plugin/src/main/java/org/elasticsearch/xpack/common/http/auth/basic/ApplicableBasicAuth.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/auth/basic/ApplicableBasicAuth.java index dcd7f339796..c5b3e034fe9 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/common/http/auth/basic/ApplicableBasicAuth.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/auth/basic/ApplicableBasicAuth.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.common.http.auth.basic; +package org.elasticsearch.xpack.watcher.common.http.auth.basic; import org.apache.http.auth.AuthScope; import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.client.CredentialsProvider; -import org.elasticsearch.xpack.common.http.auth.ApplicableHttpAuth; +import org.elasticsearch.xpack.watcher.common.http.auth.ApplicableHttpAuth; import org.elasticsearch.xpack.security.crypto.CryptoService; import java.net.HttpURLConnection; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/common/http/auth/basic/BasicAuth.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/auth/basic/BasicAuth.java similarity index 94% rename from plugin/src/main/java/org/elasticsearch/xpack/common/http/auth/basic/BasicAuth.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/auth/basic/BasicAuth.java index 5a4b66efb05..8d32178515b 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/common/http/auth/basic/BasicAuth.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/auth/basic/BasicAuth.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.common.http.auth.basic; +package org.elasticsearch.xpack.watcher.common.http.auth.basic; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.common.http.auth.HttpAuth; -import org.elasticsearch.xpack.common.secret.Secret; +import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuth; +import org.elasticsearch.xpack.watcher.common.secret.Secret; import org.elasticsearch.xpack.watcher.support.xcontent.WatcherParams; import org.elasticsearch.xpack.watcher.support.xcontent.WatcherXContentParser; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/common/http/auth/basic/BasicAuthFactory.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/auth/basic/BasicAuthFactory.java similarity index 88% rename from plugin/src/main/java/org/elasticsearch/xpack/common/http/auth/basic/BasicAuthFactory.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/auth/basic/BasicAuthFactory.java index 51fd6d02118..dfc66367146 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/common/http/auth/basic/BasicAuthFactory.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/http/auth/basic/BasicAuthFactory.java @@ -3,11 +3,11 @@ * 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.common.http.auth.basic; +package org.elasticsearch.xpack.watcher.common.http.auth.basic; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.common.http.auth.HttpAuthFactory; +import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuthFactory; import org.elasticsearch.xpack.security.crypto.CryptoService; import java.io.IOException; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/common/secret/Secret.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/secret/Secret.java similarity index 95% rename from plugin/src/main/java/org/elasticsearch/xpack/common/secret/Secret.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/common/secret/Secret.java index 1deb9931ad8..fde0d9c29a5 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/common/secret/Secret.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/secret/Secret.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.common.secret; +package org.elasticsearch.xpack.watcher.common.secret; import org.elasticsearch.xpack.security.crypto.CryptoService; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/common/stats/Counters.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/stats/Counters.java similarity index 98% rename from plugin/src/main/java/org/elasticsearch/xpack/common/stats/Counters.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/common/stats/Counters.java index faf35e71424..e51b687b26c 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/common/stats/Counters.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/stats/Counters.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.common.stats; +package org.elasticsearch.xpack.watcher.common.stats; import com.carrotsearch.hppc.ObjectLongHashMap; import com.carrotsearch.hppc.cursors.ObjectLongCursor; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/common/text/TextTemplate.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/text/TextTemplate.java similarity index 98% rename from plugin/src/main/java/org/elasticsearch/xpack/common/text/TextTemplate.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/common/text/TextTemplate.java index 804bf3c0a50..e52e1cbc1e8 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/common/text/TextTemplate.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/text/TextTemplate.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.common.text; +package org.elasticsearch.xpack.watcher.common.text; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.xcontent.ToXContent; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/common/text/TextTemplateEngine.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/text/TextTemplateEngine.java similarity index 98% rename from plugin/src/main/java/org/elasticsearch/xpack/common/text/TextTemplateEngine.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/common/text/TextTemplateEngine.java index 0906d99eb3b..7b87a9e87a5 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/common/text/TextTemplateEngine.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/text/TextTemplateEngine.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.common.text; +package org.elasticsearch.xpack.watcher.common.text; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.settings.Settings; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/xcontent/XContentUtils.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/xcontent/XContentUtils.java new file mode 100644 index 00000000000..c82977c988d --- /dev/null +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/common/xcontent/XContentUtils.java @@ -0,0 +1,45 @@ +/* + * 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.common.xcontent; + +import org.elasticsearch.common.xcontent.XContentParser; + +import java.io.IOException; + +public class XContentUtils { + + private XContentUtils() { + } + + // TODO open this up in core + public static Object readValue(XContentParser parser, XContentParser.Token token) throws IOException { + if (token == XContentParser.Token.VALUE_NULL) { + return null; + } else if (token == XContentParser.Token.VALUE_STRING) { + return parser.text(); + } else if (token == XContentParser.Token.VALUE_NUMBER) { + XContentParser.NumberType numberType = parser.numberType(); + if (numberType == XContentParser.NumberType.INT) { + return parser.intValue(); + } else if (numberType == XContentParser.NumberType.LONG) { + return parser.longValue(); + } else if (numberType == XContentParser.NumberType.FLOAT) { + return parser.floatValue(); + } else if (numberType == XContentParser.NumberType.DOUBLE) { + return parser.doubleValue(); + } + } else if (token == XContentParser.Token.VALUE_BOOLEAN) { + return parser.booleanValue(); + } else if (token == XContentParser.Token.START_OBJECT) { + return parser.map(); + } else if (token == XContentParser.Token.START_ARRAY) { + return parser.list(); + } else if (token == XContentParser.Token.VALUE_EMBEDDED_OBJECT) { + return parser.binaryValue(); + } + return null; + } +} diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/condition/ArrayCompareCondition.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/condition/ArrayCompareCondition.java index 1c4974e7b8c..0686e968b2c 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/condition/ArrayCompareCondition.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/condition/ArrayCompareCondition.java @@ -8,7 +8,7 @@ package org.elasticsearch.xpack.watcher.condition; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.common.xcontent.XContentUtils; +import org.elasticsearch.xpack.watcher.common.xcontent.XContentUtils; import org.elasticsearch.xpack.watcher.support.xcontent.ObjectPath; import java.io.IOException; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/condition/CompareCondition.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/condition/CompareCondition.java index 855486878fe..5d49dbf94db 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/condition/CompareCondition.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/condition/CompareCondition.java @@ -8,7 +8,7 @@ package org.elasticsearch.xpack.watcher.condition; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.common.xcontent.XContentUtils; +import org.elasticsearch.xpack.watcher.common.xcontent.XContentUtils; import org.elasticsearch.xpack.watcher.support.xcontent.ObjectPath; import java.io.IOException; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/execution/ExecutionService.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/execution/ExecutionService.java index c7afc31afc0..370edaa402c 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/execution/ExecutionService.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/execution/ExecutionService.java @@ -33,7 +33,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.index.engine.DocumentMissingException; -import org.elasticsearch.xpack.common.stats.Counters; +import org.elasticsearch.xpack.watcher.common.stats.Counters; import org.elasticsearch.xpack.watcher.Watcher; import org.elasticsearch.xpack.watcher.actions.ActionWrapper; import org.elasticsearch.xpack.watcher.condition.Condition; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/input/InputBuilders.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/input/InputBuilders.java index bdccff282d5..46015088948 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/input/InputBuilders.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/input/InputBuilders.java @@ -6,7 +6,7 @@ package org.elasticsearch.xpack.watcher.input; import org.elasticsearch.common.collect.MapBuilder; -import org.elasticsearch.xpack.common.http.HttpRequestTemplate; +import org.elasticsearch.xpack.watcher.common.http.HttpRequestTemplate; import org.elasticsearch.xpack.watcher.input.chain.ChainInput; import org.elasticsearch.xpack.watcher.input.http.HttpInput; import org.elasticsearch.xpack.watcher.input.none.NoneInput; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/input/http/ExecutableHttpInput.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/input/http/ExecutableHttpInput.java index 93c8b991740..37b1766dafb 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/input/http/ExecutableHttpInput.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/input/http/ExecutableHttpInput.java @@ -12,10 +12,10 @@ import org.elasticsearch.common.xcontent.NamedXContentRegistry; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType; -import org.elasticsearch.xpack.common.http.HttpClient; -import org.elasticsearch.xpack.common.http.HttpRequest; -import org.elasticsearch.xpack.common.http.HttpResponse; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.common.http.HttpClient; +import org.elasticsearch.xpack.watcher.common.http.HttpRequest; +import org.elasticsearch.xpack.watcher.common.http.HttpResponse; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; import org.elasticsearch.xpack.watcher.input.ExecutableInput; import org.elasticsearch.xpack.watcher.support.Variables; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/input/http/HttpInput.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/input/http/HttpInput.java index ef6c8344a0b..328e5c949ac 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/input/http/HttpInput.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/input/http/HttpInput.java @@ -10,9 +10,9 @@ import org.elasticsearch.common.Nullable; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.common.http.HttpContentType; -import org.elasticsearch.xpack.common.http.HttpRequest; -import org.elasticsearch.xpack.common.http.HttpRequestTemplate; +import org.elasticsearch.xpack.watcher.common.http.HttpContentType; +import org.elasticsearch.xpack.watcher.common.http.HttpRequest; +import org.elasticsearch.xpack.watcher.common.http.HttpRequestTemplate; import org.elasticsearch.xpack.watcher.input.Input; import org.elasticsearch.xpack.watcher.watch.Payload; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/input/http/HttpInputFactory.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/input/http/HttpInputFactory.java index 60cd1b4eeca..2cb26ab1d67 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/input/http/HttpInputFactory.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/input/http/HttpInputFactory.java @@ -8,9 +8,9 @@ package org.elasticsearch.xpack.watcher.input.http; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.common.http.HttpClient; -import org.elasticsearch.xpack.common.http.HttpRequestTemplate; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.common.http.HttpClient; +import org.elasticsearch.xpack.watcher.common.http.HttpRequestTemplate; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; import org.elasticsearch.xpack.watcher.input.InputFactory; import java.io.IOException; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/notification/NotificationService.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/NotificationService.java similarity index 98% rename from plugin/src/main/java/org/elasticsearch/xpack/notification/NotificationService.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/NotificationService.java index 89a4894a4e0..5e2d06a8510 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/notification/NotificationService.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/NotificationService.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.notification; +package org.elasticsearch.xpack.watcher.notification; import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.component.AbstractComponent; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/notification/email/Account.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/Account.java similarity index 99% rename from plugin/src/main/java/org/elasticsearch/xpack/notification/email/Account.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/Account.java index 33321e31639..b4d927334e1 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/notification/email/Account.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/Account.java @@ -3,11 +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.notification.email; +package org.elasticsearch.xpack.watcher.notification.email; import org.apache.logging.log4j.Logger; import org.elasticsearch.SpecialPermission; -import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsException; import org.elasticsearch.common.unit.TimeValue; @@ -24,7 +23,6 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; -import java.util.Map; import java.util.Properties; public class Account { diff --git a/plugin/src/main/java/org/elasticsearch/xpack/notification/email/Attachment.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/Attachment.java similarity index 98% rename from plugin/src/main/java/org/elasticsearch/xpack/notification/email/Attachment.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/Attachment.java index e4abfd821d2..5265ffdbc4f 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/notification/email/Attachment.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/Attachment.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.notification.email; +package org.elasticsearch.xpack.watcher.notification.email; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.SuppressForbidden; @@ -12,7 +12,7 @@ import org.elasticsearch.common.inject.Provider; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentType; -import org.elasticsearch.xpack.notification.email.support.BodyPartSource; +import org.elasticsearch.xpack.watcher.notification.email.support.BodyPartSource; import javax.activation.DataHandler; import javax.activation.DataSource; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/notification/email/Authentication.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/Authentication.java similarity index 89% rename from plugin/src/main/java/org/elasticsearch/xpack/notification/email/Authentication.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/Authentication.java index 9cfb96098e8..aab5f6e48a2 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/notification/email/Authentication.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/Authentication.java @@ -3,9 +3,9 @@ * 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.notification.email; +package org.elasticsearch.xpack.watcher.notification.email; -import org.elasticsearch.xpack.common.secret.Secret; +import org.elasticsearch.xpack.watcher.common.secret.Secret; import java.util.Objects; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/notification/email/DataAttachment.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/DataAttachment.java similarity index 97% rename from plugin/src/main/java/org/elasticsearch/xpack/notification/email/DataAttachment.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/DataAttachment.java index cb97fb5922b..b742f513f9e 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/notification/email/DataAttachment.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/DataAttachment.java @@ -3,11 +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.notification.email; +package org.elasticsearch.xpack.watcher.notification.email; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.ParseField; -import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContentObject; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/notification/email/Email.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/Email.java similarity index 99% rename from plugin/src/main/java/org/elasticsearch/xpack/notification/email/Email.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/Email.java index 03eac380490..17141e599f4 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/notification/email/Email.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/Email.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.notification.email; +package org.elasticsearch.xpack.watcher.notification.email; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.ParseField; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/notification/email/EmailService.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/EmailService.java similarity index 95% rename from plugin/src/main/java/org/elasticsearch/xpack/notification/email/EmailService.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/EmailService.java index e86e2bdf879..b0bb870c89f 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/notification/email/EmailService.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/EmailService.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.notification.email; +package org.elasticsearch.xpack.watcher.notification.email; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.xpack.notification.NotificationService; +import org.elasticsearch.xpack.watcher.notification.NotificationService; import org.elasticsearch.xpack.security.crypto.CryptoService; import javax.mail.MessagingException; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/notification/email/EmailTemplate.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/EmailTemplate.java similarity index 98% rename from plugin/src/main/java/org/elasticsearch/xpack/notification/email/EmailTemplate.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/EmailTemplate.java index 5d4794b5aac..75ca0cc9968 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/notification/email/EmailTemplate.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/EmailTemplate.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.notification.email; +package org.elasticsearch.xpack.watcher.notification.email; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.xcontent.ToXContentObject; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.common.text.TextTemplate; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; import javax.mail.internet.AddressException; import java.io.IOException; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/notification/email/HtmlSanitizer.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/HtmlSanitizer.java similarity index 98% rename from plugin/src/main/java/org/elasticsearch/xpack/notification/email/HtmlSanitizer.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/HtmlSanitizer.java index 65a3939f1da..90c6dee8263 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/notification/email/HtmlSanitizer.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/HtmlSanitizer.java @@ -3,9 +3,8 @@ * 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.notification.email; +package org.elasticsearch.xpack.watcher.notification.email; -import org.elasticsearch.common.Strings; import org.elasticsearch.common.SuppressForbidden; import org.elasticsearch.common.settings.Settings; import org.owasp.html.CssSchema; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/notification/email/Profile.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/Profile.java similarity index 99% rename from plugin/src/main/java/org/elasticsearch/xpack/notification/email/Profile.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/Profile.java index 6bbde3ba881..b59ee070d7f 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/notification/email/Profile.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/Profile.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.notification.email; +package org.elasticsearch.xpack.watcher.notification.email; import java.io.IOException; import java.nio.charset.StandardCharsets; diff --git a/plugin/src/main/java/org/elasticsearch/xpack/notification/email/attachment/DataAttachment.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/attachment/DataAttachment.java similarity index 74% rename from plugin/src/main/java/org/elasticsearch/xpack/notification/email/attachment/DataAttachment.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/attachment/DataAttachment.java index 3327380b7c2..c55ef067a95 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/notification/email/attachment/DataAttachment.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/attachment/DataAttachment.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.notification.email.attachment; +package org.elasticsearch.xpack.watcher.notification.email.attachment; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -13,21 +13,21 @@ import java.util.Objects; public class DataAttachment implements EmailAttachmentParser.EmailAttachment { private final String id; - private final org.elasticsearch.xpack.notification.email.DataAttachment dataAttachment; + private final org.elasticsearch.xpack.watcher.notification.email.DataAttachment dataAttachment; - public DataAttachment(String id, org.elasticsearch.xpack.notification.email.DataAttachment dataAttachment) { + public DataAttachment(String id, org.elasticsearch.xpack.watcher.notification.email.DataAttachment dataAttachment) { this.id = id; this.dataAttachment = dataAttachment; } - public org.elasticsearch.xpack.notification.email.DataAttachment getDataAttachment() { + public org.elasticsearch.xpack.watcher.notification.email.DataAttachment getDataAttachment() { return dataAttachment; } @Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(id).startObject(DataAttachmentParser.TYPE); - if (dataAttachment == org.elasticsearch.xpack.notification.email.DataAttachment.YAML) { + if (dataAttachment == org.elasticsearch.xpack.watcher.notification.email.DataAttachment.YAML) { builder.field("format", "yaml"); } else { builder.field("format", "json"); @@ -72,13 +72,13 @@ public class DataAttachment implements EmailAttachmentParser.EmailAttachment { public static class Builder { private String id; - private org.elasticsearch.xpack.notification.email.DataAttachment dataAttachment; + private org.elasticsearch.xpack.watcher.notification.email.DataAttachment dataAttachment; private Builder(String id) { this.id = id; } - public Builder dataAttachment(org.elasticsearch.xpack.notification.email.DataAttachment dataAttachment) { + public Builder dataAttachment(org.elasticsearch.xpack.watcher.notification.email.DataAttachment dataAttachment) { this.dataAttachment = dataAttachment; return this; } diff --git a/plugin/src/main/java/org/elasticsearch/xpack/notification/email/attachment/DataAttachmentParser.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/attachment/DataAttachmentParser.java similarity index 84% rename from plugin/src/main/java/org/elasticsearch/xpack/notification/email/attachment/DataAttachmentParser.java rename to plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/attachment/DataAttachmentParser.java index 80c69d9ec17..11c17b93756 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/notification/email/attachment/DataAttachmentParser.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/notification/email/attachment/DataAttachmentParser.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.notification.email.attachment; +package org.elasticsearch.xpack.watcher.notification.email.attachment; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.Strings; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.notification.email.Attachment; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; +import org.elasticsearch.xpack.watcher.notification.email.Attachment; import org.elasticsearch.xpack.watcher.support.Variables; import org.elasticsearch.xpack.watcher.watch.Payload; import java.io.IOException; import java.util.Map; -import static org.elasticsearch.xpack.notification.email.DataAttachment.resolve; +import static org.elasticsearch.xpack.watcher.notification.email.DataAttachment.resolve; public class DataAttachmentParser implements EmailAttachmentParser { @@ -34,8 +34,8 @@ public class DataAttachmentParser implements EmailAttachmentParser { assertThat(message.getSubject(), equalTo("Subject")); @@ -155,8 +155,7 @@ public class EmailAttachmentTests extends AbstractWatcherIntegrationTestCase { List attachments = new ArrayList<>(); - org.elasticsearch.xpack.notification.email.attachment.DataAttachment dataAttachment = - org.elasticsearch.xpack.notification.email.attachment.DataAttachment.builder("my-id").dataAttachment(dataFormat).build(); + DataAttachment dataAttachment = DataAttachment.builder("my-id").dataAttachment(dataFormat).build(); attachments.add(dataAttachment); HttpRequestTemplate requestTemplate = HttpRequestTemplate.builder("localhost", webServer.getPort()) diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/hipchat/HipChatActionFactoryTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/hipchat/HipChatActionFactoryTests.java index ec630a7e8e6..323b6031a00 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/hipchat/HipChatActionFactoryTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/hipchat/HipChatActionFactoryTests.java @@ -10,9 +10,9 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; -import org.elasticsearch.xpack.notification.hipchat.HipChatAccount; -import org.elasticsearch.xpack.notification.hipchat.HipChatService; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.notification.hipchat.HipChatAccount; +import org.elasticsearch.xpack.watcher.notification.hipchat.HipChatService; import org.junit.Before; import java.util.Collections; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/hipchat/HipChatActionTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/hipchat/HipChatActionTests.java index 17a2a699991..c07816567be 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/hipchat/HipChatActionTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/hipchat/HipChatActionTests.java @@ -13,15 +13,15 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.http.HttpProxy; -import org.elasticsearch.xpack.common.http.HttpRequest; -import org.elasticsearch.xpack.common.http.HttpResponse; -import org.elasticsearch.xpack.common.text.TextTemplate; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; -import org.elasticsearch.xpack.notification.hipchat.HipChatAccount; -import org.elasticsearch.xpack.notification.hipchat.HipChatMessage; -import org.elasticsearch.xpack.notification.hipchat.HipChatService; -import org.elasticsearch.xpack.notification.hipchat.SentMessages; +import org.elasticsearch.xpack.watcher.common.http.HttpProxy; +import org.elasticsearch.xpack.watcher.common.http.HttpRequest; +import org.elasticsearch.xpack.watcher.common.http.HttpResponse; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.notification.hipchat.HipChatAccount; +import org.elasticsearch.xpack.watcher.notification.hipchat.HipChatMessage; +import org.elasticsearch.xpack.watcher.notification.hipchat.HipChatService; +import org.elasticsearch.xpack.watcher.notification.hipchat.SentMessages; import org.elasticsearch.xpack.watcher.actions.Action; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; import org.elasticsearch.xpack.watcher.execution.Wid; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/jira/ExecutableJiraActionTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/jira/ExecutableJiraActionTests.java index 9814e984e02..c41c459c83c 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/jira/ExecutableJiraActionTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/jira/ExecutableJiraActionTests.java @@ -9,16 +9,16 @@ import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.script.ScriptService; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.http.HttpClient; -import org.elasticsearch.xpack.common.http.HttpProxy; -import org.elasticsearch.xpack.common.http.HttpRequest; -import org.elasticsearch.xpack.common.http.HttpResponse; -import org.elasticsearch.xpack.common.http.auth.HttpAuth; -import org.elasticsearch.xpack.common.http.auth.basic.BasicAuth; -import org.elasticsearch.xpack.common.text.TextTemplate; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; -import org.elasticsearch.xpack.notification.jira.JiraAccount; -import org.elasticsearch.xpack.notification.jira.JiraService; +import org.elasticsearch.xpack.watcher.common.http.HttpClient; +import org.elasticsearch.xpack.watcher.common.http.HttpProxy; +import org.elasticsearch.xpack.watcher.common.http.HttpRequest; +import org.elasticsearch.xpack.watcher.common.http.HttpResponse; +import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuth; +import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuth; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.notification.jira.JiraAccount; +import org.elasticsearch.xpack.watcher.notification.jira.JiraService; import org.elasticsearch.xpack.watcher.actions.Action; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; import org.elasticsearch.xpack.watcher.execution.Wid; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/jira/JiraActionFactoryTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/jira/JiraActionFactoryTests.java index 544df5828c6..ea821b67810 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/jira/JiraActionFactoryTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/jira/JiraActionFactoryTests.java @@ -10,14 +10,14 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; -import org.elasticsearch.xpack.notification.jira.JiraAccount; -import org.elasticsearch.xpack.notification.jira.JiraService; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.notification.jira.JiraAccount; +import org.elasticsearch.xpack.watcher.notification.jira.JiraService; import org.junit.Before; import static java.util.Collections.singleton; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; -import static org.elasticsearch.xpack.notification.jira.JiraAccountTests.randomIssueDefaults; +import static org.elasticsearch.xpack.watcher.notification.jira.JiraAccountTests.randomIssueDefaults; import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.jiraAction; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/jira/JiraActionTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/jira/JiraActionTests.java index fb72b153115..9fe51f05ccc 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/jira/JiraActionTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/jira/JiraActionTests.java @@ -16,16 +16,16 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.script.ScriptService; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.http.HttpClient; -import org.elasticsearch.xpack.common.http.HttpProxy; -import org.elasticsearch.xpack.common.http.HttpRequest; -import org.elasticsearch.xpack.common.http.HttpResponse; -import org.elasticsearch.xpack.common.text.TextTemplate; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; -import org.elasticsearch.xpack.notification.jira.JiraAccount; -import org.elasticsearch.xpack.notification.jira.JiraAccountTests; -import org.elasticsearch.xpack.notification.jira.JiraIssue; -import org.elasticsearch.xpack.notification.jira.JiraService; +import org.elasticsearch.xpack.watcher.common.http.HttpClient; +import org.elasticsearch.xpack.watcher.common.http.HttpProxy; +import org.elasticsearch.xpack.watcher.common.http.HttpRequest; +import org.elasticsearch.xpack.watcher.common.http.HttpResponse; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.notification.jira.JiraAccount; +import org.elasticsearch.xpack.watcher.notification.jira.JiraAccountTests; +import org.elasticsearch.xpack.watcher.notification.jira.JiraIssue; +import org.elasticsearch.xpack.watcher.notification.jira.JiraService; import org.elasticsearch.xpack.watcher.actions.Action; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; import org.elasticsearch.xpack.watcher.execution.Wid; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/logging/LoggingActionTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/logging/LoggingActionTests.java index 85c3164dc8b..a1574cc1e00 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/logging/LoggingActionTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/logging/LoggingActionTests.java @@ -12,9 +12,9 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.text.TextTemplate; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; -import org.elasticsearch.xpack.notification.email.Attachment; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.notification.email.Attachment; import org.elasticsearch.xpack.watcher.actions.Action; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; import org.elasticsearch.xpack.watcher.test.WatcherTestUtils; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/pagerduty/PagerDutyActionFactoryTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/pagerduty/PagerDutyActionFactoryTests.java index b9ed91ad3ee..b6dccc11eed 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/pagerduty/PagerDutyActionFactoryTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/pagerduty/PagerDutyActionFactoryTests.java @@ -10,9 +10,9 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; -import org.elasticsearch.xpack.notification.pagerduty.PagerDutyAccount; -import org.elasticsearch.xpack.notification.pagerduty.PagerDutyService; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.notification.pagerduty.PagerDutyAccount; +import org.elasticsearch.xpack.watcher.notification.pagerduty.PagerDutyService; import org.junit.Before; import java.util.Collections; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/pagerduty/PagerDutyActionTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/pagerduty/PagerDutyActionTests.java index a266686483d..7cdd96cc457 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/pagerduty/PagerDutyActionTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/pagerduty/PagerDutyActionTests.java @@ -14,17 +14,17 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.http.HttpProxy; -import org.elasticsearch.xpack.common.http.HttpRequest; -import org.elasticsearch.xpack.common.http.HttpResponse; -import org.elasticsearch.xpack.common.text.TextTemplate; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; -import org.elasticsearch.xpack.notification.pagerduty.IncidentEvent; -import org.elasticsearch.xpack.notification.pagerduty.IncidentEventContext; -import org.elasticsearch.xpack.notification.pagerduty.IncidentEventDefaults; -import org.elasticsearch.xpack.notification.pagerduty.PagerDutyAccount; -import org.elasticsearch.xpack.notification.pagerduty.PagerDutyService; -import org.elasticsearch.xpack.notification.pagerduty.SentEvent; +import org.elasticsearch.xpack.watcher.common.http.HttpProxy; +import org.elasticsearch.xpack.watcher.common.http.HttpRequest; +import org.elasticsearch.xpack.watcher.common.http.HttpResponse; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.notification.pagerduty.IncidentEvent; +import org.elasticsearch.xpack.watcher.notification.pagerduty.IncidentEventContext; +import org.elasticsearch.xpack.watcher.notification.pagerduty.IncidentEventDefaults; +import org.elasticsearch.xpack.watcher.notification.pagerduty.PagerDutyAccount; +import org.elasticsearch.xpack.watcher.notification.pagerduty.PagerDutyService; +import org.elasticsearch.xpack.watcher.notification.pagerduty.SentEvent; import org.elasticsearch.xpack.watcher.actions.Action; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; import org.elasticsearch.xpack.watcher.execution.Wid; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/slack/ExecutableSlackActionTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/slack/ExecutableSlackActionTests.java index 6cddd4b99e3..0e702f16878 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/slack/ExecutableSlackActionTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/slack/ExecutableSlackActionTests.java @@ -7,14 +7,14 @@ package org.elasticsearch.xpack.watcher.actions.slack; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.http.HttpClient; -import org.elasticsearch.xpack.common.http.HttpProxy; -import org.elasticsearch.xpack.common.http.HttpRequest; -import org.elasticsearch.xpack.common.http.HttpResponse; -import org.elasticsearch.xpack.common.text.TextTemplate; -import org.elasticsearch.xpack.notification.slack.SlackAccount; -import org.elasticsearch.xpack.notification.slack.SlackService; -import org.elasticsearch.xpack.notification.slack.message.SlackMessage; +import org.elasticsearch.xpack.watcher.common.http.HttpClient; +import org.elasticsearch.xpack.watcher.common.http.HttpProxy; +import org.elasticsearch.xpack.watcher.common.http.HttpRequest; +import org.elasticsearch.xpack.watcher.common.http.HttpResponse; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.notification.slack.SlackAccount; +import org.elasticsearch.xpack.watcher.notification.slack.SlackService; +import org.elasticsearch.xpack.watcher.notification.slack.message.SlackMessage; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; import org.elasticsearch.xpack.watcher.execution.Wid; import org.elasticsearch.xpack.watcher.test.MockTextTemplateEngine; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/slack/SlackActionFactoryTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/slack/SlackActionFactoryTests.java index b9b3e7e43b7..27824bc0e15 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/slack/SlackActionFactoryTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/slack/SlackActionFactoryTests.java @@ -10,15 +10,15 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; -import org.elasticsearch.xpack.notification.slack.SlackAccount; -import org.elasticsearch.xpack.notification.slack.SlackService; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.notification.slack.SlackAccount; +import org.elasticsearch.xpack.watcher.notification.slack.SlackService; import org.junit.Before; import java.util.Collections; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; -import static org.elasticsearch.xpack.notification.slack.message.SlackMessageTests.createRandomTemplate; +import static org.elasticsearch.xpack.watcher.notification.slack.message.SlackMessageTests.createRandomTemplate; import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.slackAction; import static org.hamcrest.Matchers.is; import static org.mockito.Mockito.mock; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/slack/SlackActionTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/slack/SlackActionTests.java index c5338edc6bd..04fdb2e6bbb 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/slack/SlackActionTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/slack/SlackActionTests.java @@ -13,16 +13,16 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.http.HttpProxy; -import org.elasticsearch.xpack.common.http.HttpRequest; -import org.elasticsearch.xpack.common.http.HttpResponse; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; -import org.elasticsearch.xpack.notification.slack.SentMessages; -import org.elasticsearch.xpack.notification.slack.SlackAccount; -import org.elasticsearch.xpack.notification.slack.SlackService; -import org.elasticsearch.xpack.notification.slack.message.SlackMessage; -import org.elasticsearch.xpack.notification.slack.message.SlackMessageDefaults; -import org.elasticsearch.xpack.notification.slack.message.SlackMessageTests; +import org.elasticsearch.xpack.watcher.common.http.HttpProxy; +import org.elasticsearch.xpack.watcher.common.http.HttpRequest; +import org.elasticsearch.xpack.watcher.common.http.HttpResponse; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.notification.slack.SentMessages; +import org.elasticsearch.xpack.watcher.notification.slack.SlackAccount; +import org.elasticsearch.xpack.watcher.notification.slack.SlackService; +import org.elasticsearch.xpack.watcher.notification.slack.message.SlackMessage; +import org.elasticsearch.xpack.watcher.notification.slack.message.SlackMessageDefaults; +import org.elasticsearch.xpack.watcher.notification.slack.message.SlackMessageTests; import org.elasticsearch.xpack.watcher.actions.Action; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; import org.elasticsearch.xpack.watcher.execution.Wid; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/throttler/ActionThrottleTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/throttler/ActionThrottleTests.java index 73c22fac473..f82690fa0a6 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/throttler/ActionThrottleTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/throttler/ActionThrottleTests.java @@ -9,10 +9,10 @@ import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentType; -import org.elasticsearch.xpack.common.http.HttpMethod; -import org.elasticsearch.xpack.common.http.HttpRequestTemplate; -import org.elasticsearch.xpack.common.text.TextTemplate; -import org.elasticsearch.xpack.notification.email.EmailTemplate; +import org.elasticsearch.xpack.watcher.common.http.HttpMethod; +import org.elasticsearch.xpack.watcher.common.http.HttpRequestTemplate; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.notification.email.EmailTemplate; import org.elasticsearch.xpack.watcher.actions.Action; import org.elasticsearch.xpack.watcher.actions.email.EmailAction; import org.elasticsearch.xpack.watcher.actions.index.IndexAction; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookActionTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookActionTests.java index 4c8e82166e0..a3e9ad499fb 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookActionTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookActionTests.java @@ -16,17 +16,17 @@ import org.elasticsearch.env.TestEnvironment; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.http.MockResponse; import org.elasticsearch.test.http.MockWebServer; -import org.elasticsearch.xpack.common.http.HttpClient; -import org.elasticsearch.xpack.common.http.HttpMethod; -import org.elasticsearch.xpack.common.http.HttpProxy; -import org.elasticsearch.xpack.common.http.HttpRequest; -import org.elasticsearch.xpack.common.http.HttpRequestTemplate; -import org.elasticsearch.xpack.common.http.HttpResponse; -import org.elasticsearch.xpack.common.http.auth.HttpAuthRegistry; -import org.elasticsearch.xpack.common.http.auth.basic.BasicAuthFactory; -import org.elasticsearch.xpack.common.text.TextTemplate; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; -import org.elasticsearch.xpack.notification.email.Attachment; +import org.elasticsearch.xpack.watcher.common.http.HttpClient; +import org.elasticsearch.xpack.watcher.common.http.HttpMethod; +import org.elasticsearch.xpack.watcher.common.http.HttpProxy; +import org.elasticsearch.xpack.watcher.common.http.HttpRequest; +import org.elasticsearch.xpack.watcher.common.http.HttpRequestTemplate; +import org.elasticsearch.xpack.watcher.common.http.HttpResponse; +import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuthRegistry; +import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuthFactory; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.notification.email.Attachment; import org.elasticsearch.xpack.ssl.SSLService; import org.elasticsearch.xpack.watcher.actions.Action; import org.elasticsearch.xpack.watcher.actions.Action.Result.Status; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookHttpsIntegrationTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookHttpsIntegrationTests.java index d09a88ce72c..566722e11fb 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookHttpsIntegrationTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookHttpsIntegrationTests.java @@ -11,11 +11,11 @@ import org.elasticsearch.env.Environment; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.test.http.MockResponse; import org.elasticsearch.test.http.MockWebServer; -import org.elasticsearch.xpack.common.http.HttpMethod; -import org.elasticsearch.xpack.common.http.HttpRequestTemplate; -import org.elasticsearch.xpack.common.http.Scheme; -import org.elasticsearch.xpack.common.http.auth.basic.BasicAuth; -import org.elasticsearch.xpack.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.common.http.HttpMethod; +import org.elasticsearch.xpack.watcher.common.http.HttpRequestTemplate; +import org.elasticsearch.xpack.watcher.common.http.Scheme; +import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuth; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; import org.elasticsearch.xpack.ssl.TestsSSLService; import org.elasticsearch.xpack.watcher.actions.ActionBuilders; import org.elasticsearch.xpack.watcher.condition.AlwaysCondition; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookIntegrationTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookIntegrationTests.java index 7280335e735..6fd11421964 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookIntegrationTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/actions/webhook/WebhookIntegrationTests.java @@ -14,10 +14,10 @@ import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.test.SecuritySettingsSource; import org.elasticsearch.test.http.MockResponse; import org.elasticsearch.test.http.MockWebServer; -import org.elasticsearch.xpack.common.http.HttpMethod; -import org.elasticsearch.xpack.common.http.HttpRequestTemplate; -import org.elasticsearch.xpack.common.http.auth.basic.BasicAuth; -import org.elasticsearch.xpack.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.common.http.HttpMethod; +import org.elasticsearch.xpack.watcher.common.http.HttpRequestTemplate; +import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuth; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; import org.elasticsearch.xpack.watcher.actions.ActionBuilders; import org.elasticsearch.xpack.watcher.condition.AlwaysCondition; import org.elasticsearch.xpack.watcher.history.WatchRecord; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/common/http/HttpClientTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/common/http/HttpClientTests.java similarity index 98% rename from plugin/src/test/java/org/elasticsearch/xpack/common/http/HttpClientTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/common/http/HttpClientTests.java index d96c4275d32..942fb7a52e2 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/common/http/HttpClientTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/common/http/HttpClientTests.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.common.http; +package org.elasticsearch.xpack.watcher.common.http; import com.carrotsearch.randomizedtesting.generators.RandomStrings; import org.apache.http.client.ClientProtocolException; @@ -21,9 +21,9 @@ import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.http.MockResponse; import org.elasticsearch.test.http.MockWebServer; import org.elasticsearch.test.junit.annotations.Network; -import org.elasticsearch.xpack.common.http.auth.HttpAuthRegistry; -import org.elasticsearch.xpack.common.http.auth.basic.BasicAuth; -import org.elasticsearch.xpack.common.http.auth.basic.BasicAuthFactory; +import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuthRegistry; +import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuth; +import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuthFactory; import org.elasticsearch.xpack.ssl.SSLService; import org.elasticsearch.xpack.ssl.TestsSSLService; import org.elasticsearch.xpack.ssl.VerificationMode; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/common/http/HttpConnectionTimeoutTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/common/http/HttpConnectionTimeoutTests.java similarity index 97% rename from plugin/src/test/java/org/elasticsearch/xpack/common/http/HttpConnectionTimeoutTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/common/http/HttpConnectionTimeoutTests.java index f4ecbf936d2..e02aee12807 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/common/http/HttpConnectionTimeoutTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/common/http/HttpConnectionTimeoutTests.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.common.http; +package org.elasticsearch.xpack.watcher.common.http; import org.apache.http.conn.ConnectTimeoutException; import org.elasticsearch.common.settings.Settings; @@ -12,7 +12,7 @@ import org.elasticsearch.env.Environment; import org.elasticsearch.env.TestEnvironment; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.junit.annotations.Network; -import org.elasticsearch.xpack.common.http.auth.HttpAuthRegistry; +import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuthRegistry; import org.elasticsearch.xpack.ssl.SSLService; import static org.hamcrest.Matchers.greaterThan; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/common/http/HttpReadTimeoutTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/common/http/HttpReadTimeoutTests.java similarity index 97% rename from plugin/src/test/java/org/elasticsearch/xpack/common/http/HttpReadTimeoutTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/common/http/HttpReadTimeoutTests.java index 152ae7fe642..07d9aed0307 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/common/http/HttpReadTimeoutTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/common/http/HttpReadTimeoutTests.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.common.http; +package org.elasticsearch.xpack.watcher.common.http; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; @@ -12,7 +12,7 @@ import org.elasticsearch.env.TestEnvironment; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.http.MockResponse; import org.elasticsearch.test.http.MockWebServer; -import org.elasticsearch.xpack.common.http.auth.HttpAuthRegistry; +import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuthRegistry; import org.elasticsearch.xpack.ssl.SSLService; import org.junit.After; import org.junit.Before; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/common/http/HttpRequestTemplateTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/common/http/HttpRequestTemplateTests.java similarity index 96% rename from plugin/src/test/java/org/elasticsearch/xpack/common/http/HttpRequestTemplateTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/common/http/HttpRequestTemplateTests.java index f2556db71d5..4dccc557e65 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/common/http/HttpRequestTemplateTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/common/http/HttpRequestTemplateTests.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.common.http; +package org.elasticsearch.xpack.watcher.common.http; import io.netty.handler.codec.http.HttpHeaders; import org.elasticsearch.ElasticsearchParseException; @@ -13,10 +13,10 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.http.auth.HttpAuthRegistry; -import org.elasticsearch.xpack.common.http.auth.basic.BasicAuth; -import org.elasticsearch.xpack.common.http.auth.basic.BasicAuthFactory; -import org.elasticsearch.xpack.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuthRegistry; +import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuth; +import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuthFactory; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; import org.elasticsearch.xpack.watcher.test.MockTextTemplateEngine; import java.util.Collections; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/common/http/HttpRequestTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/common/http/HttpRequestTests.java similarity index 96% rename from plugin/src/test/java/org/elasticsearch/xpack/common/http/HttpRequestTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/common/http/HttpRequestTests.java index e045ba96395..8123715493f 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/common/http/HttpRequestTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/common/http/HttpRequestTests.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.common.http; +package org.elasticsearch.xpack.watcher.common.http; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.unit.TimeValue; @@ -11,9 +11,9 @@ import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.http.auth.HttpAuthRegistry; -import org.elasticsearch.xpack.common.http.auth.basic.BasicAuth; -import org.elasticsearch.xpack.common.http.auth.basic.BasicAuthFactory; +import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuthRegistry; +import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuth; +import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuthFactory; import static java.util.Collections.singletonMap; import static org.elasticsearch.common.xcontent.XContentFactory.cborBuilder; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/common/http/HttpResponseTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/common/http/HttpResponseTests.java similarity index 99% rename from plugin/src/test/java/org/elasticsearch/xpack/common/http/HttpResponseTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/common/http/HttpResponseTests.java index 6689c279881..3629a984f22 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/common/http/HttpResponseTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/common/http/HttpResponseTests.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.common.http; +package org.elasticsearch.xpack.watcher.common.http; import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.bytes.BytesReference; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/common/http/SizeLimitInputStreamTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/common/http/SizeLimitInputStreamTests.java similarity index 97% rename from plugin/src/test/java/org/elasticsearch/xpack/common/http/SizeLimitInputStreamTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/common/http/SizeLimitInputStreamTests.java index 66ef5f35361..fa9af2367bc 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/common/http/SizeLimitInputStreamTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/common/http/SizeLimitInputStreamTests.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.common.http; +package org.elasticsearch.xpack.watcher.common.http; import org.elasticsearch.common.unit.ByteSizeUnit; import org.elasticsearch.common.unit.ByteSizeValue; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/common/stats/CountersTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/common/stats/CountersTests.java similarity index 95% rename from plugin/src/test/java/org/elasticsearch/xpack/common/stats/CountersTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/common/stats/CountersTests.java index 711dab70333..a571010372d 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/common/stats/CountersTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/common/stats/CountersTests.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.common.stats; +package org.elasticsearch.xpack.watcher.common.stats; import org.elasticsearch.test.ESTestCase; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/common/text/TextTemplateTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/common/text/TextTemplateTests.java similarity index 99% rename from plugin/src/test/java/org/elasticsearch/xpack/common/text/TextTemplateTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/common/text/TextTemplateTests.java index d4e84c67370..7e630f6c3cb 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/common/text/TextTemplateTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/common/text/TextTemplateTests.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.common.text; +package org.elasticsearch.xpack.watcher.common.text; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.settings.Settings; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/condition/ArrayCompareConditionTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/condition/ArrayCompareConditionTests.java index d91695060e5..59eaad0daf8 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/condition/ArrayCompareConditionTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/condition/ArrayCompareConditionTests.java @@ -11,7 +11,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.support.clock.ClockMock; +import org.elasticsearch.xpack.watcher.watch.clock.ClockMock; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; import org.elasticsearch.xpack.watcher.watch.Payload; import org.joda.time.DateTime; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/condition/CompareConditionTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/condition/CompareConditionTests.java index c33a8558999..6302bb71b5c 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/condition/CompareConditionTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/condition/CompareConditionTests.java @@ -10,7 +10,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.support.clock.ClockMock; +import org.elasticsearch.xpack.watcher.watch.clock.ClockMock; import org.elasticsearch.xpack.watcher.condition.CompareCondition.Op; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; import org.elasticsearch.xpack.watcher.watch.Payload; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/execution/ExecutionServiceTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/execution/ExecutionServiceTests.java index 7a89a28f1d0..0ee079ae6fc 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/execution/ExecutionServiceTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/execution/ExecutionServiceTests.java @@ -27,7 +27,7 @@ import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.index.IndexNotFoundException; import org.elasticsearch.index.get.GetResult; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.support.clock.ClockMock; +import org.elasticsearch.xpack.watcher.watch.clock.ClockMock; import org.elasticsearch.xpack.watcher.actions.Action; import org.elasticsearch.xpack.watcher.actions.ActionStatus; import org.elasticsearch.xpack.watcher.actions.ActionWrapper; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/execution/TriggeredWatchStoreTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/execution/TriggeredWatchStoreTests.java index 752b4b8bccd..15329f01a65 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/execution/TriggeredWatchStoreTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/execution/TriggeredWatchStoreTests.java @@ -42,9 +42,9 @@ import org.elasticsearch.search.SearchHits; import org.elasticsearch.search.SearchShardTarget; import org.elasticsearch.search.internal.InternalSearchResponse; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.http.HttpClient; -import org.elasticsearch.xpack.notification.email.EmailService; -import org.elasticsearch.xpack.support.clock.ClockMock; +import org.elasticsearch.xpack.watcher.common.http.HttpClient; +import org.elasticsearch.xpack.watcher.notification.email.EmailService; +import org.elasticsearch.xpack.watcher.watch.clock.ClockMock; import org.elasticsearch.xpack.watcher.support.search.WatcherSearchTemplateService; import org.elasticsearch.xpack.watcher.test.WatcherTestUtils; import org.elasticsearch.xpack.watcher.trigger.TriggerEngine; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryStoreTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryStoreTests.java index cfd64a48c96..c9019eabd41 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryStoreTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryStoreTests.java @@ -14,11 +14,11 @@ import org.elasticsearch.action.support.PlainActionFuture; import org.elasticsearch.client.Client; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.http.HttpClient; -import org.elasticsearch.xpack.common.http.HttpRequest; -import org.elasticsearch.xpack.common.http.HttpResponse; -import org.elasticsearch.xpack.notification.jira.JiraAccount; -import org.elasticsearch.xpack.notification.jira.JiraIssue; +import org.elasticsearch.xpack.watcher.common.http.HttpClient; +import org.elasticsearch.xpack.watcher.common.http.HttpRequest; +import org.elasticsearch.xpack.watcher.common.http.HttpResponse; +import org.elasticsearch.xpack.watcher.notification.jira.JiraAccount; +import org.elasticsearch.xpack.watcher.notification.jira.JiraIssue; import org.elasticsearch.xpack.watcher.actions.ActionStatus; import org.elasticsearch.xpack.watcher.actions.ActionWrapper; import org.elasticsearch.xpack.watcher.actions.jira.JiraAction; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateEmailMappingsTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateEmailMappingsTests.java index a083ecff7e6..dc86bf8d406 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateEmailMappingsTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateEmailMappingsTests.java @@ -10,8 +10,8 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.search.aggregations.Aggregations; import org.elasticsearch.search.aggregations.bucket.terms.Terms; import org.elasticsearch.test.junit.annotations.TestLogging; -import org.elasticsearch.xpack.notification.email.EmailTemplate; -import org.elasticsearch.xpack.notification.email.support.EmailServer; +import org.elasticsearch.xpack.watcher.notification.email.EmailTemplate; +import org.elasticsearch.xpack.watcher.notification.email.support.EmailServer; import org.elasticsearch.xpack.watcher.condition.AlwaysCondition; import org.elasticsearch.xpack.watcher.execution.ExecutionState; import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateHttpMappingsTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateHttpMappingsTests.java index bc20a189a3e..fb2656f16d9 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateHttpMappingsTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryTemplateHttpMappingsTests.java @@ -15,8 +15,8 @@ import org.elasticsearch.search.aggregations.Aggregations; import org.elasticsearch.search.aggregations.bucket.terms.Terms; import org.elasticsearch.test.http.MockResponse; import org.elasticsearch.test.http.MockWebServer; -import org.elasticsearch.xpack.common.http.HttpMethod; -import org.elasticsearch.xpack.common.http.HttpRequestTemplate; +import org.elasticsearch.xpack.watcher.common.http.HttpMethod; +import org.elasticsearch.xpack.watcher.common.http.HttpRequestTemplate; import org.elasticsearch.xpack.watcher.condition.AlwaysCondition; import org.elasticsearch.xpack.watcher.execution.ExecutionState; import org.elasticsearch.xpack.watcher.support.xcontent.ObjectPath; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/input/chain/ChainInputTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/input/chain/ChainInputTests.java index dd3b7f7b027..79d2424f8c2 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/input/chain/ChainInputTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/input/chain/ChainInputTests.java @@ -15,8 +15,8 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.SecuritySettingsSource; -import org.elasticsearch.xpack.common.http.HttpRequestTemplate; -import org.elasticsearch.xpack.common.http.auth.basic.BasicAuth; +import org.elasticsearch.xpack.watcher.common.http.HttpRequestTemplate; +import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuth; import org.elasticsearch.xpack.watcher.condition.ScriptCondition; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; import org.elasticsearch.xpack.watcher.input.InputFactory; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/input/chain/ChainIntegrationTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/input/chain/ChainIntegrationTests.java index 722009bfac9..924083e070a 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/input/chain/ChainIntegrationTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/input/chain/ChainIntegrationTests.java @@ -13,8 +13,8 @@ import org.elasticsearch.index.IndexNotFoundException; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.test.SecuritySettingsSource; import org.elasticsearch.transport.Netty4Plugin; -import org.elasticsearch.xpack.common.http.HttpRequestTemplate; -import org.elasticsearch.xpack.common.http.auth.basic.BasicAuth; +import org.elasticsearch.xpack.watcher.common.http.HttpRequestTemplate; +import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuth; import org.elasticsearch.xpack.watcher.input.http.HttpInput; import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/input/http/HttpInputIntegrationTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/input/http/HttpInputIntegrationTests.java index 217cb5f3939..23b9e9c9882 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/input/http/HttpInputIntegrationTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/input/http/HttpInputIntegrationTests.java @@ -15,9 +15,9 @@ import org.elasticsearch.plugins.Plugin; import org.elasticsearch.test.SecuritySettingsSource; import org.elasticsearch.test.junit.annotations.TestLogging; import org.elasticsearch.transport.Netty4Plugin; -import org.elasticsearch.xpack.common.http.HttpRequestTemplate; -import org.elasticsearch.xpack.common.http.auth.basic.BasicAuth; -import org.elasticsearch.xpack.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.common.http.HttpRequestTemplate; +import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuth; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; import org.elasticsearch.xpack.watcher.client.WatcherClient; import org.elasticsearch.xpack.watcher.condition.CompareCondition; import org.elasticsearch.xpack.watcher.history.HistoryStore; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/input/http/HttpInputTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/input/http/HttpInputTests.java index 5fb08c88e5c..88da927ed66 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/input/http/HttpInputTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/input/http/HttpInputTests.java @@ -16,19 +16,19 @@ import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.http.HttpClient; -import org.elasticsearch.xpack.common.http.HttpContentType; -import org.elasticsearch.xpack.common.http.HttpMethod; -import org.elasticsearch.xpack.common.http.HttpRequest; -import org.elasticsearch.xpack.common.http.HttpRequestTemplate; -import org.elasticsearch.xpack.common.http.HttpResponse; -import org.elasticsearch.xpack.common.http.Scheme; -import org.elasticsearch.xpack.common.http.auth.HttpAuth; -import org.elasticsearch.xpack.common.http.auth.HttpAuthRegistry; -import org.elasticsearch.xpack.common.http.auth.basic.BasicAuth; -import org.elasticsearch.xpack.common.http.auth.basic.BasicAuthFactory; -import org.elasticsearch.xpack.common.text.TextTemplate; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.common.http.HttpClient; +import org.elasticsearch.xpack.watcher.common.http.HttpContentType; +import org.elasticsearch.xpack.watcher.common.http.HttpMethod; +import org.elasticsearch.xpack.watcher.common.http.HttpRequest; +import org.elasticsearch.xpack.watcher.common.http.HttpRequestTemplate; +import org.elasticsearch.xpack.watcher.common.http.HttpResponse; +import org.elasticsearch.xpack.watcher.common.http.Scheme; +import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuth; +import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuthRegistry; +import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuth; +import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuthFactory; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; import org.elasticsearch.xpack.watcher.input.InputBuilders; import org.elasticsearch.xpack.watcher.support.xcontent.ObjectPath; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/notification/email/AccountTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/AccountTests.java similarity index 98% rename from plugin/src/test/java/org/elasticsearch/xpack/notification/email/AccountTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/AccountTests.java index 99821c4269d..5f02654488e 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/notification/email/AccountTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/AccountTests.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.notification.email; +package org.elasticsearch.xpack.watcher.notification.email; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.secret.Secret; -import org.elasticsearch.xpack.notification.email.support.EmailServer; +import org.elasticsearch.xpack.watcher.common.secret.Secret; +import org.elasticsearch.xpack.watcher.notification.email.support.EmailServer; import org.junit.After; import org.junit.Before; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/notification/email/AccountsTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/AccountsTests.java similarity index 98% rename from plugin/src/test/java/org/elasticsearch/xpack/notification/email/AccountsTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/AccountsTests.java index 99ac222ddd0..8f966e172c9 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/notification/email/AccountsTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/AccountsTests.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.notification.email; +package org.elasticsearch.xpack.watcher.notification.email; import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.Settings; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/notification/email/DataAttachmentTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/DataAttachmentTests.java similarity index 96% rename from plugin/src/test/java/org/elasticsearch/xpack/notification/email/DataAttachmentTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/DataAttachmentTests.java index a55c0e25c5f..e947ee40140 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/notification/email/DataAttachmentTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/DataAttachmentTests.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.notification.email; +package org.elasticsearch.xpack.watcher.notification.email; import org.elasticsearch.common.io.Streams; import org.elasticsearch.test.ESTestCase; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/notification/email/EmailSecretsIntegrationTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/EmailSecretsIntegrationTests.java similarity index 96% rename from plugin/src/test/java/org/elasticsearch/xpack/notification/email/EmailSecretsIntegrationTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/EmailSecretsIntegrationTests.java index 28fe26b2c29..12f2c39ba8d 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/notification/email/EmailSecretsIntegrationTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/EmailSecretsIntegrationTests.java @@ -3,13 +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.notification.email; +package org.elasticsearch.xpack.watcher.notification.email; import org.elasticsearch.action.get.GetResponse; import org.elasticsearch.common.settings.MockSecureSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.support.XContentMapValues; -import org.elasticsearch.xpack.notification.email.support.EmailServer; +import org.elasticsearch.xpack.watcher.actions.ActionBuilders; +import org.elasticsearch.xpack.watcher.notification.email.support.EmailServer; import org.elasticsearch.xpack.security.crypto.CryptoService; import org.elasticsearch.xpack.watcher.Watcher; import org.elasticsearch.xpack.watcher.client.WatcherClient; @@ -87,7 +88,7 @@ public class EmailSecretsIntegrationTests extends AbstractWatcherIntegrationTest .trigger(schedule(cron("0 0 0 1 * ? 2020"))) .input(simpleInput()) .condition(AlwaysCondition.INSTANCE) - .addAction("_email", emailAction( + .addAction("_email", ActionBuilders.emailAction( EmailTemplate.builder() .from("_from") .to("_to") diff --git a/plugin/src/test/java/org/elasticsearch/xpack/notification/email/EmailServiceTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/EmailServiceTests.java similarity index 94% rename from plugin/src/test/java/org/elasticsearch/xpack/notification/email/EmailServiceTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/EmailServiceTests.java index be622c6aba9..deb9ee8a0ad 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/notification/email/EmailServiceTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/EmailServiceTests.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.notification.email; +package org.elasticsearch.xpack.watcher.notification.email; import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.secret.Secret; +import org.elasticsearch.xpack.watcher.common.secret.Secret; import org.junit.Before; import java.util.Collections; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/notification/email/EmailTemplateTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/EmailTemplateTests.java similarity index 97% rename from plugin/src/test/java/org/elasticsearch/xpack/notification/email/EmailTemplateTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/EmailTemplateTests.java index bdb1a0a1735..feded3f2439 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/notification/email/EmailTemplateTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/EmailTemplateTests.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.notification.email; +package org.elasticsearch.xpack.watcher.notification.email; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; import org.elasticsearch.xpack.watcher.test.MockTextTemplateEngine; import java.util.ArrayList; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/notification/email/EmailTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/EmailTests.java similarity index 97% rename from plugin/src/test/java/org/elasticsearch/xpack/notification/email/EmailTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/EmailTests.java index 9186b05c7d0..48dd20baa67 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/notification/email/EmailTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/EmailTests.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.notification.email; +package org.elasticsearch.xpack.watcher.notification.email; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/notification/email/HtmlSanitizerTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/HtmlSanitizerTests.java similarity index 99% rename from plugin/src/test/java/org/elasticsearch/xpack/notification/email/HtmlSanitizerTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/HtmlSanitizerTests.java index 43710c1bd9e..46119aa39db 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/notification/email/HtmlSanitizerTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/HtmlSanitizerTests.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.notification.email; +package org.elasticsearch.xpack.watcher.notification.email; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESTestCase; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/notification/email/ProfileTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/ProfileTests.java similarity index 97% rename from plugin/src/test/java/org/elasticsearch/xpack/notification/email/ProfileTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/ProfileTests.java index 257c107d1d6..c710546bf87 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/notification/email/ProfileTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/ProfileTests.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.notification.email; +package org.elasticsearch.xpack.watcher.notification.email; import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.Settings; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/notification/email/attachment/DataAttachmentParserTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/attachment/DataAttachmentParserTests.java similarity index 96% rename from plugin/src/test/java/org/elasticsearch/xpack/notification/email/attachment/DataAttachmentParserTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/attachment/DataAttachmentParserTests.java index f21dfac2f8e..ff211d2a375 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/notification/email/attachment/DataAttachmentParserTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/attachment/DataAttachmentParserTests.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.notification.email.attachment; +package org.elasticsearch.xpack.watcher.notification.email.attachment; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/notification/email/attachment/EmailAttachmentParsersTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/attachment/EmailAttachmentParsersTests.java similarity index 96% rename from plugin/src/test/java/org/elasticsearch/xpack/notification/email/attachment/EmailAttachmentParsersTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/attachment/EmailAttachmentParsersTests.java index 1ead0b2d347..198203943cc 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/notification/email/attachment/EmailAttachmentParsersTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/attachment/EmailAttachmentParsersTests.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.notification.email.attachment; +package org.elasticsearch.xpack.watcher.notification.email.attachment; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.ParseField; @@ -12,9 +12,9 @@ import org.elasticsearch.common.xcontent.XContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.http.HttpRequestTemplate; -import org.elasticsearch.xpack.common.http.Scheme; -import org.elasticsearch.xpack.notification.email.Attachment; +import org.elasticsearch.xpack.watcher.common.http.HttpRequestTemplate; +import org.elasticsearch.xpack.watcher.common.http.Scheme; +import org.elasticsearch.xpack.watcher.notification.email.Attachment; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; import org.elasticsearch.xpack.watcher.watch.Payload; @@ -91,7 +91,7 @@ public class EmailAttachmentParsersTests extends ESTestCase { public void testThatToXContentSerializationWorks() throws Exception { List attachments = new ArrayList<>(); - attachments.add(new DataAttachment("my-name.json", org.elasticsearch.xpack.notification.email.DataAttachment.JSON)); + attachments.add(new DataAttachment("my-name.json", org.elasticsearch.xpack.watcher.notification.email.DataAttachment.JSON)); HttpRequestTemplate requestTemplate = HttpRequestTemplate.builder("localhost", 80).scheme(Scheme.HTTP).path("/").build(); boolean inline = randomBoolean(); diff --git a/plugin/src/test/java/org/elasticsearch/xpack/notification/email/attachment/HttpEmailAttachementParserTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/attachment/HttpEmailAttachementParserTests.java similarity index 92% rename from plugin/src/test/java/org/elasticsearch/xpack/notification/email/attachment/HttpEmailAttachementParserTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/attachment/HttpEmailAttachementParserTests.java index 372906c40de..5352a345206 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/notification/email/attachment/HttpEmailAttachementParserTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/attachment/HttpEmailAttachementParserTests.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.notification.email.attachment; +package org.elasticsearch.xpack.watcher.notification.email.attachment; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.collect.MapBuilder; @@ -11,13 +11,13 @@ import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.http.HttpClient; -import org.elasticsearch.xpack.common.http.HttpRequest; -import org.elasticsearch.xpack.common.http.HttpRequestTemplate; -import org.elasticsearch.xpack.common.http.HttpResponse; -import org.elasticsearch.xpack.common.http.auth.HttpAuthRegistry; -import org.elasticsearch.xpack.common.http.auth.basic.BasicAuth; -import org.elasticsearch.xpack.common.http.auth.basic.BasicAuthFactory; +import org.elasticsearch.xpack.watcher.common.http.HttpClient; +import org.elasticsearch.xpack.watcher.common.http.HttpRequest; +import org.elasticsearch.xpack.watcher.common.http.HttpRequestTemplate; +import org.elasticsearch.xpack.watcher.common.http.HttpResponse; +import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuthRegistry; +import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuth; +import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuthFactory; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; import org.elasticsearch.xpack.watcher.execution.Wid; import org.elasticsearch.xpack.watcher.test.MockTextTemplateEngine; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/notification/email/attachment/ReportingAttachmentParserTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/attachment/ReportingAttachmentParserTests.java similarity index 95% rename from plugin/src/test/java/org/elasticsearch/xpack/notification/email/attachment/ReportingAttachmentParserTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/attachment/ReportingAttachmentParserTests.java index 7c62f6e2a55..25b58061eaf 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/notification/email/attachment/ReportingAttachmentParserTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/attachment/ReportingAttachmentParserTests.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.notification.email.attachment; +package org.elasticsearch.xpack.watcher.notification.email.attachment; import com.fasterxml.jackson.core.io.JsonEOFException; @@ -16,19 +16,19 @@ import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.http.HttpClient; -import org.elasticsearch.xpack.common.http.HttpMethod; -import org.elasticsearch.xpack.common.http.HttpProxy; -import org.elasticsearch.xpack.common.http.HttpRequest; -import org.elasticsearch.xpack.common.http.HttpResponse; -import org.elasticsearch.xpack.common.http.auth.HttpAuth; -import org.elasticsearch.xpack.common.http.auth.HttpAuthFactory; -import org.elasticsearch.xpack.common.http.auth.HttpAuthRegistry; -import org.elasticsearch.xpack.common.http.auth.basic.BasicAuth; -import org.elasticsearch.xpack.common.http.auth.basic.BasicAuthFactory; -import org.elasticsearch.xpack.common.text.TextTemplate; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; -import org.elasticsearch.xpack.notification.email.Attachment; +import org.elasticsearch.xpack.watcher.common.http.HttpClient; +import org.elasticsearch.xpack.watcher.common.http.HttpMethod; +import org.elasticsearch.xpack.watcher.common.http.HttpProxy; +import org.elasticsearch.xpack.watcher.common.http.HttpRequest; +import org.elasticsearch.xpack.watcher.common.http.HttpResponse; +import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuth; +import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuthFactory; +import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuthRegistry; +import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuth; +import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuthFactory; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.notification.email.Attachment; import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext; import org.elasticsearch.xpack.watcher.execution.Wid; import org.elasticsearch.xpack.watcher.test.MockTextTemplateEngine; @@ -224,7 +224,7 @@ public class ReportingAttachmentParserTests extends ESTestCase { public void testInitialRequestContainsPathAsObject() throws Exception { when(httpClient.execute(any(HttpRequest.class))) - // closing json bracket is missing + // path must be a field, but is an object here .thenReturn(new HttpResponse(200, "{\"path\": { \"foo\" : \"anything\"}}")); ReportingAttachment attachment = new ReportingAttachment("foo", "http://www.example.org/", randomBoolean(), null, null, null, null); ParsingException e = expectThrows(ParsingException.class, diff --git a/plugin/src/test/java/org/elasticsearch/xpack/notification/email/support/EmailServer.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/support/EmailServer.java similarity index 98% rename from plugin/src/test/java/org/elasticsearch/xpack/notification/email/support/EmailServer.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/support/EmailServer.java index 7d376d2c75a..4195b251392 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/notification/email/support/EmailServer.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/email/support/EmailServer.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.notification.email.support; +package org.elasticsearch.xpack.watcher.notification.email.support; import org.apache.logging.log4j.Logger; import org.subethamail.smtp.auth.EasyAuthenticationHandlerFactory; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/notification/hipchat/HipChatAccountsTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/hipchat/HipChatAccountsTests.java similarity index 95% rename from plugin/src/test/java/org/elasticsearch/xpack/notification/hipchat/HipChatAccountsTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/hipchat/HipChatAccountsTests.java index 85cfbc06c05..b624c37d02e 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/notification/hipchat/HipChatAccountsTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/hipchat/HipChatAccountsTests.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.notification.hipchat; +package org.elasticsearch.xpack.watcher.notification.hipchat; import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsException; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.http.HttpClient; -import org.elasticsearch.xpack.common.http.HttpProxy; -import org.elasticsearch.xpack.common.http.HttpRequest; -import org.elasticsearch.xpack.common.http.HttpResponse; -import org.elasticsearch.xpack.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.common.http.HttpClient; +import org.elasticsearch.xpack.watcher.common.http.HttpProxy; +import org.elasticsearch.xpack.watcher.common.http.HttpRequest; +import org.elasticsearch.xpack.watcher.common.http.HttpResponse; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; import org.elasticsearch.xpack.watcher.test.MockTextTemplateEngine; import org.junit.Before; import org.mockito.ArgumentCaptor; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/notification/hipchat/HipChatMessageTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/hipchat/HipChatMessageTests.java similarity index 97% rename from plugin/src/test/java/org/elasticsearch/xpack/notification/hipchat/HipChatMessageTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/hipchat/HipChatMessageTests.java index 5708a66e938..089dc42d946 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/notification/hipchat/HipChatMessageTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/hipchat/HipChatMessageTests.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.notification.hipchat; +package org.elasticsearch.xpack.watcher.notification.hipchat; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.xcontent.ToXContent; @@ -11,8 +11,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.text.TextTemplate; -import org.elasticsearch.xpack.common.xcontent.XContentUtils; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; import java.util.ArrayList; import java.util.Arrays; @@ -26,6 +25,7 @@ import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; public class HipChatMessageTests extends ESTestCase { + public void testToXContent() throws Exception { String message = randomAlphaOfLength(10); String[] rooms = generateRandomStringArray(3, 10, true); @@ -65,9 +65,9 @@ public class HipChatMessageTests extends ESTestCase { } else if ("body".equals(currentFieldName)) { message = parser.text(); } else if ("room".equals(currentFieldName)) { - rooms = XContentUtils.readStringArray(parser, false); + rooms = parser.list().stream().map(Object::toString).toArray(String[]::new); } else if ("user".equals(currentFieldName)) { - users = XContentUtils.readStringArray(parser, false); + users = parser.list().stream().map(Object::toString).toArray(String[]::new); } else if ("from".equals(currentFieldName)) { from = parser.text(); } else if ("format".equals(currentFieldName)) { diff --git a/plugin/src/test/java/org/elasticsearch/xpack/notification/hipchat/HipChatServiceTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/hipchat/HipChatServiceTests.java similarity index 99% rename from plugin/src/test/java/org/elasticsearch/xpack/notification/hipchat/HipChatServiceTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/hipchat/HipChatServiceTests.java index e4c4d58e195..aaebf2e602f 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/notification/hipchat/HipChatServiceTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/hipchat/HipChatServiceTests.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.notification.hipchat; +package org.elasticsearch.xpack.watcher.notification.hipchat; import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsException; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.http.HttpClient; +import org.elasticsearch.xpack.watcher.common.http.HttpClient; import org.junit.Before; import java.util.Collections; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/notification/hipchat/IntegrationAccountTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/hipchat/IntegrationAccountTests.java similarity index 94% rename from plugin/src/test/java/org/elasticsearch/xpack/notification/hipchat/IntegrationAccountTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/hipchat/IntegrationAccountTests.java index 81023b28791..1fec9dd2200 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/notification/hipchat/IntegrationAccountTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/hipchat/IntegrationAccountTests.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.notification.hipchat; +package org.elasticsearch.xpack.watcher.notification.hipchat; import org.apache.logging.log4j.Logger; import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsException; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.http.HttpClient; -import org.elasticsearch.xpack.common.http.HttpMethod; -import org.elasticsearch.xpack.common.http.HttpRequest; -import org.elasticsearch.xpack.common.http.HttpResponse; -import org.elasticsearch.xpack.common.http.Scheme; +import org.elasticsearch.xpack.watcher.common.http.HttpClient; +import org.elasticsearch.xpack.watcher.common.http.HttpMethod; +import org.elasticsearch.xpack.watcher.common.http.HttpRequest; +import org.elasticsearch.xpack.watcher.common.http.HttpResponse; +import org.elasticsearch.xpack.watcher.common.http.Scheme; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/notification/hipchat/UserAccountTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/hipchat/UserAccountTests.java similarity index 96% rename from plugin/src/test/java/org/elasticsearch/xpack/notification/hipchat/UserAccountTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/hipchat/UserAccountTests.java index c9dcdb38422..07a6165b47c 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/notification/hipchat/UserAccountTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/hipchat/UserAccountTests.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.notification.hipchat; +package org.elasticsearch.xpack.watcher.notification.hipchat; import org.apache.logging.log4j.Logger; import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsException; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.http.HttpClient; -import org.elasticsearch.xpack.common.http.HttpMethod; -import org.elasticsearch.xpack.common.http.HttpRequest; -import org.elasticsearch.xpack.common.http.HttpResponse; -import org.elasticsearch.xpack.common.http.Scheme; -import org.elasticsearch.xpack.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.common.http.HttpClient; +import org.elasticsearch.xpack.watcher.common.http.HttpMethod; +import org.elasticsearch.xpack.watcher.common.http.HttpRequest; +import org.elasticsearch.xpack.watcher.common.http.HttpResponse; +import org.elasticsearch.xpack.watcher.common.http.Scheme; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; import org.elasticsearch.xpack.watcher.test.MockTextTemplateEngine; import java.util.HashMap; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/notification/hipchat/V1AccountTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/hipchat/V1AccountTests.java similarity index 94% rename from plugin/src/test/java/org/elasticsearch/xpack/notification/hipchat/V1AccountTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/hipchat/V1AccountTests.java index 6ca2b54635d..08698ff2f64 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/notification/hipchat/V1AccountTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/hipchat/V1AccountTests.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.notification.hipchat; +package org.elasticsearch.xpack.watcher.notification.hipchat; import org.apache.logging.log4j.Logger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsException; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.http.HttpClient; -import org.elasticsearch.xpack.common.http.HttpMethod; -import org.elasticsearch.xpack.common.http.HttpRequest; -import org.elasticsearch.xpack.common.http.HttpResponse; -import org.elasticsearch.xpack.common.http.Scheme; +import org.elasticsearch.xpack.watcher.common.http.HttpClient; +import org.elasticsearch.xpack.watcher.common.http.HttpMethod; +import org.elasticsearch.xpack.watcher.common.http.HttpRequest; +import org.elasticsearch.xpack.watcher.common.http.HttpResponse; +import org.elasticsearch.xpack.watcher.common.http.Scheme; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.hamcrest.Matchers.arrayContaining; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/notification/jira/JiraAccountTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/jira/JiraAccountTests.java similarity index 97% rename from plugin/src/test/java/org/elasticsearch/xpack/notification/jira/JiraAccountTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/jira/JiraAccountTests.java index 067b9e6ac8f..7b765563e3c 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/notification/jira/JiraAccountTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/jira/JiraAccountTests.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.notification.jira; +package org.elasticsearch.xpack.watcher.notification.jira; import org.apache.http.HttpStatus; import org.elasticsearch.common.collect.MapBuilder; @@ -12,11 +12,11 @@ import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsException; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.http.HttpClient; -import org.elasticsearch.xpack.common.http.HttpProxy; -import org.elasticsearch.xpack.common.http.HttpRequest; -import org.elasticsearch.xpack.common.http.HttpResponse; -import org.elasticsearch.xpack.common.http.Scheme; +import org.elasticsearch.xpack.watcher.common.http.HttpClient; +import org.elasticsearch.xpack.watcher.common.http.HttpProxy; +import org.elasticsearch.xpack.watcher.common.http.HttpRequest; +import org.elasticsearch.xpack.watcher.common.http.HttpResponse; +import org.elasticsearch.xpack.watcher.common.http.Scheme; import org.junit.Before; import org.mockito.ArgumentCaptor; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/notification/jira/JiraIssueTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/jira/JiraIssueTests.java similarity index 88% rename from plugin/src/test/java/org/elasticsearch/xpack/notification/jira/JiraIssueTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/jira/JiraIssueTests.java index 15592fce7a6..2823faa17b2 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/notification/jira/JiraIssueTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/jira/JiraIssueTests.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.notification.jira; +package org.elasticsearch.xpack.watcher.notification.jira; import org.apache.http.HttpStatus; import org.elasticsearch.common.collect.Tuple; @@ -11,12 +11,12 @@ import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.http.HttpMethod; -import org.elasticsearch.xpack.common.http.HttpRequest; -import org.elasticsearch.xpack.common.http.HttpResponse; -import org.elasticsearch.xpack.common.http.auth.HttpAuthRegistry; -import org.elasticsearch.xpack.common.http.auth.basic.BasicAuth; -import org.elasticsearch.xpack.common.http.auth.basic.BasicAuthFactory; +import org.elasticsearch.xpack.watcher.common.http.HttpMethod; +import org.elasticsearch.xpack.watcher.common.http.HttpRequest; +import org.elasticsearch.xpack.watcher.common.http.HttpResponse; +import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuthRegistry; +import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuth; +import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuthFactory; import java.io.IOException; import java.util.HashMap; @@ -27,9 +27,9 @@ import static org.elasticsearch.common.xcontent.XContentFactory.cborBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.smileBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.yamlBuilder; -import static org.elasticsearch.xpack.notification.jira.JiraAccountTests.randomHttpError; -import static org.elasticsearch.xpack.notification.jira.JiraAccountTests.randomIssueDefaults; -import static org.elasticsearch.xpack.notification.jira.JiraIssue.resolveFailureReason; +import static org.elasticsearch.xpack.watcher.notification.jira.JiraAccountTests.randomHttpError; +import static org.elasticsearch.xpack.watcher.notification.jira.JiraAccountTests.randomIssueDefaults; +import static org.elasticsearch.xpack.watcher.notification.jira.JiraIssue.resolveFailureReason; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.Matchers.hasEntry; import static org.hamcrest.Matchers.is; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/notification/pagerduty/IncidentEventDefaultsTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/pagerduty/IncidentEventDefaultsTests.java similarity index 98% rename from plugin/src/test/java/org/elasticsearch/xpack/notification/pagerduty/IncidentEventDefaultsTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/pagerduty/IncidentEventDefaultsTests.java index cb613f3fc0f..2d4fdc07044 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/notification/pagerduty/IncidentEventDefaultsTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/pagerduty/IncidentEventDefaultsTests.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.notification.pagerduty; +package org.elasticsearch.xpack.watcher.notification.pagerduty; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESTestCase; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/notification/pagerduty/PagerDutyAccountsTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/pagerduty/PagerDutyAccountsTests.java similarity index 94% rename from plugin/src/test/java/org/elasticsearch/xpack/notification/pagerduty/PagerDutyAccountsTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/pagerduty/PagerDutyAccountsTests.java index 7df40d99f06..88e5b90fa69 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/notification/pagerduty/PagerDutyAccountsTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/pagerduty/PagerDutyAccountsTests.java @@ -3,23 +3,22 @@ * 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.notification.pagerduty; +package org.elasticsearch.xpack.watcher.notification.pagerduty; import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsException; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.http.HttpClient; -import org.elasticsearch.xpack.common.http.HttpProxy; -import org.elasticsearch.xpack.common.http.HttpRequest; -import org.elasticsearch.xpack.common.http.HttpResponse; -import org.elasticsearch.xpack.notification.slack.message.SlackMessageDefaultsTests; +import org.elasticsearch.xpack.watcher.common.http.HttpClient; +import org.elasticsearch.xpack.watcher.common.http.HttpProxy; +import org.elasticsearch.xpack.watcher.common.http.HttpRequest; +import org.elasticsearch.xpack.watcher.common.http.HttpResponse; +import org.elasticsearch.xpack.watcher.notification.slack.message.SlackMessageDefaultsTests; import org.elasticsearch.xpack.watcher.watch.Payload; import org.junit.Before; import org.mockito.ArgumentCaptor; import java.util.Collections; -import java.util.Map; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/notification/slack/SlackAccountsTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/slack/SlackAccountsTests.java similarity index 96% rename from plugin/src/test/java/org/elasticsearch/xpack/notification/slack/SlackAccountsTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/slack/SlackAccountsTests.java index c0f82010a12..8320d3f242c 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/notification/slack/SlackAccountsTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/slack/SlackAccountsTests.java @@ -3,18 +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.notification.slack; +package org.elasticsearch.xpack.watcher.notification.slack; import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsException; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.http.HttpClient; -import org.elasticsearch.xpack.notification.slack.message.SlackMessageDefaultsTests; +import org.elasticsearch.xpack.watcher.common.http.HttpClient; +import org.elasticsearch.xpack.watcher.notification.slack.message.SlackMessageDefaultsTests; import org.junit.Before; import java.util.Collections; -import java.util.Map; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/notification/slack/message/SlackMessageDefaultsTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/slack/message/SlackMessageDefaultsTests.java similarity index 98% rename from plugin/src/test/java/org/elasticsearch/xpack/notification/slack/message/SlackMessageDefaultsTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/slack/message/SlackMessageDefaultsTests.java index 286aaab9354..73dec8acd3d 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/notification/slack/message/SlackMessageDefaultsTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/slack/message/SlackMessageDefaultsTests.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.notification.slack.message; +package org.elasticsearch.xpack.watcher.notification.slack.message; import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.Settings; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/notification/slack/message/SlackMessageTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/slack/message/SlackMessageTests.java similarity index 99% rename from plugin/src/test/java/org/elasticsearch/xpack/notification/slack/message/SlackMessageTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/slack/message/SlackMessageTests.java index 27f4a76912f..ba335f2ab2c 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/notification/slack/message/SlackMessageTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/notification/slack/message/SlackMessageTests.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.notification.slack.message; +package org.elasticsearch.xpack.watcher.notification.slack.message; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.text.TextTemplate; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; import org.elasticsearch.xpack.watcher.test.MockTextTemplateEngine; import java.io.IOException; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/AbstractWatcherIntegrationTestCase.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/AbstractWatcherIntegrationTestCase.java index 2cd73dbc07c..9caf1b8ffe2 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/AbstractWatcherIntegrationTestCase.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/AbstractWatcherIntegrationTestCase.java @@ -51,14 +51,14 @@ import org.elasticsearch.xpack.XPackClient; import org.elasticsearch.xpack.XPackPlugin; import org.elasticsearch.xpack.XPackSettings; import org.elasticsearch.xpack.ml.MachineLearning; -import org.elasticsearch.xpack.notification.email.Authentication; -import org.elasticsearch.xpack.notification.email.Email; -import org.elasticsearch.xpack.notification.email.EmailService; -import org.elasticsearch.xpack.notification.email.Profile; +import org.elasticsearch.xpack.watcher.notification.email.Authentication; +import org.elasticsearch.xpack.watcher.notification.email.Email; +import org.elasticsearch.xpack.watcher.notification.email.EmailService; +import org.elasticsearch.xpack.watcher.notification.email.Profile; import org.elasticsearch.xpack.security.Security; import org.elasticsearch.xpack.security.authc.file.FileRealm; import org.elasticsearch.xpack.security.authc.support.Hasher; -import org.elasticsearch.xpack.support.clock.ClockMock; +import org.elasticsearch.xpack.watcher.watch.clock.ClockMock; import org.elasticsearch.xpack.template.TemplateUtils; import org.elasticsearch.xpack.watcher.WatcherState; import org.elasticsearch.xpack.watcher.client.WatcherClient; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/MockTextTemplateEngine.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/MockTextTemplateEngine.java index 207a4da20ac..eeefa20c3a1 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/MockTextTemplateEngine.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/MockTextTemplateEngine.java @@ -6,8 +6,8 @@ package org.elasticsearch.xpack.watcher.test; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.xpack.common.text.TextTemplate; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; import java.util.Map; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/WatcherTestUtils.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/WatcherTestUtils.java index 94ed64f6043..78fabb2bf2d 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/WatcherTestUtils.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/WatcherTestUtils.java @@ -15,17 +15,17 @@ import org.elasticsearch.common.xcontent.XContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.search.builder.SearchSourceBuilder; -import org.elasticsearch.xpack.common.http.HttpClient; -import org.elasticsearch.xpack.common.http.HttpMethod; -import org.elasticsearch.xpack.common.http.HttpRequestTemplate; -import org.elasticsearch.xpack.common.secret.Secret; -import org.elasticsearch.xpack.common.text.TextTemplate; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; -import org.elasticsearch.xpack.notification.email.Authentication; -import org.elasticsearch.xpack.notification.email.EmailService; -import org.elasticsearch.xpack.notification.email.EmailTemplate; -import org.elasticsearch.xpack.notification.email.HtmlSanitizer; -import org.elasticsearch.xpack.notification.email.Profile; +import org.elasticsearch.xpack.watcher.common.http.HttpClient; +import org.elasticsearch.xpack.watcher.common.http.HttpMethod; +import org.elasticsearch.xpack.watcher.common.http.HttpRequestTemplate; +import org.elasticsearch.xpack.watcher.common.secret.Secret; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.notification.email.Authentication; +import org.elasticsearch.xpack.watcher.notification.email.EmailService; +import org.elasticsearch.xpack.watcher.notification.email.EmailTemplate; +import org.elasticsearch.xpack.watcher.notification.email.HtmlSanitizer; +import org.elasticsearch.xpack.watcher.notification.email.Profile; import org.elasticsearch.xpack.watcher.actions.ActionStatus; import org.elasticsearch.xpack.watcher.actions.ActionWrapper; import org.elasticsearch.xpack.watcher.actions.email.EmailAction; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/bench/WatcherExecutorServiceBenchmark.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/bench/WatcherExecutorServiceBenchmark.java index 435537c1111..9c3e8614a1e 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/bench/WatcherExecutorServiceBenchmark.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/bench/WatcherExecutorServiceBenchmark.java @@ -16,7 +16,7 @@ import org.elasticsearch.script.Script; import org.elasticsearch.script.ScriptType; import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.xpack.XPackPlugin; -import org.elasticsearch.xpack.common.http.HttpRequestTemplate; +import org.elasticsearch.xpack.watcher.common.http.HttpRequestTemplate; import org.elasticsearch.xpack.watcher.Watcher; import org.elasticsearch.xpack.watcher.client.WatchSourceBuilder; import org.elasticsearch.xpack.watcher.client.WatcherClient; @@ -29,10 +29,6 @@ import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleRegistry; import java.io.IOException; import java.nio.file.Path; import java.security.GeneralSecurityException; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.UnrecoverableKeyException; -import java.security.cert.CertificateException; import java.time.Clock; import java.util.Arrays; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/integration/HipChatServiceTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/integration/HipChatServiceTests.java index be248734ace..c96a1afcd55 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/integration/HipChatServiceTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/integration/HipChatServiceTests.java @@ -11,10 +11,10 @@ import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.junit.annotations.Network; import org.elasticsearch.test.junit.annotations.TestLogging; -import org.elasticsearch.xpack.notification.hipchat.HipChatAccount; -import org.elasticsearch.xpack.notification.hipchat.HipChatMessage; -import org.elasticsearch.xpack.notification.hipchat.HipChatService; -import org.elasticsearch.xpack.notification.hipchat.SentMessages; +import org.elasticsearch.xpack.watcher.notification.hipchat.HipChatAccount; +import org.elasticsearch.xpack.watcher.notification.hipchat.HipChatMessage; +import org.elasticsearch.xpack.watcher.notification.hipchat.HipChatService; +import org.elasticsearch.xpack.watcher.notification.hipchat.SentMessages; import org.elasticsearch.xpack.watcher.actions.hipchat.HipChatAction; import org.elasticsearch.xpack.watcher.condition.AlwaysCondition; import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase; @@ -33,7 +33,7 @@ import static org.hamcrest.Matchers.lessThan; import static org.hamcrest.Matchers.notNullValue; @Network -@TestLogging("org.elasticsearch.xpack.common.http:TRACE") +@TestLogging("org.elasticsearch.xpack.watcher.common.http:TRACE") public class HipChatServiceTests extends AbstractWatcherIntegrationTestCase { @Override protected boolean timeWarped() { diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/integration/HttpSecretsIntegrationTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/integration/HttpSecretsIntegrationTests.java index 6249f9a85e1..d3cf05d7bbd 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/integration/HttpSecretsIntegrationTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/integration/HttpSecretsIntegrationTests.java @@ -11,9 +11,9 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.support.XContentMapValues; import org.elasticsearch.test.http.MockResponse; import org.elasticsearch.test.http.MockWebServer; -import org.elasticsearch.xpack.common.http.HttpRequestTemplate; -import org.elasticsearch.xpack.common.http.auth.basic.ApplicableBasicAuth; -import org.elasticsearch.xpack.common.http.auth.basic.BasicAuth; +import org.elasticsearch.xpack.watcher.common.http.HttpRequestTemplate; +import org.elasticsearch.xpack.watcher.common.http.auth.basic.ApplicableBasicAuth; +import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuth; import org.elasticsearch.xpack.security.crypto.CryptoService; import org.elasticsearch.xpack.watcher.Watcher; import org.elasticsearch.xpack.watcher.client.WatcherClient; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/integration/PagerDutyServiceTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/integration/PagerDutyServiceTests.java index def27fe2ddd..885fb992bab 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/integration/PagerDutyServiceTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/integration/PagerDutyServiceTests.java @@ -9,11 +9,11 @@ import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.junit.annotations.Network; import org.elasticsearch.xpack.watcher.actions.pagerduty.PagerDutyAction; -import org.elasticsearch.xpack.notification.pagerduty.IncidentEvent; -import org.elasticsearch.xpack.notification.pagerduty.IncidentEventContext; -import org.elasticsearch.xpack.notification.pagerduty.PagerDutyAccount; -import org.elasticsearch.xpack.notification.pagerduty.PagerDutyService; -import org.elasticsearch.xpack.notification.pagerduty.SentEvent; +import org.elasticsearch.xpack.watcher.notification.pagerduty.IncidentEvent; +import org.elasticsearch.xpack.watcher.notification.pagerduty.IncidentEventContext; +import org.elasticsearch.xpack.watcher.notification.pagerduty.PagerDutyAccount; +import org.elasticsearch.xpack.watcher.notification.pagerduty.PagerDutyService; +import org.elasticsearch.xpack.watcher.notification.pagerduty.SentEvent; import org.elasticsearch.xpack.watcher.condition.AlwaysCondition; import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase; import org.elasticsearch.xpack.watcher.transport.actions.put.PutWatchResponse; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/integration/SearchTransformTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/integration/SearchTransformTests.java index 96bf09273a0..b4c0ce97d4f 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/integration/SearchTransformTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/integration/SearchTransformTests.java @@ -18,7 +18,7 @@ import org.elasticsearch.script.ScriptModule; import org.elasticsearch.script.ScriptService; import org.elasticsearch.script.ScriptType; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; import org.elasticsearch.xpack.watcher.transform.search.ExecutableSearchTransform; import org.elasticsearch.xpack.watcher.transform.search.SearchTransform; import org.elasticsearch.xpack.watcher.transform.search.SearchTransformFactory; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/integration/SlackServiceTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/integration/SlackServiceTests.java index 36b643708cb..2114f8b7cad 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/integration/SlackServiceTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/integration/SlackServiceTests.java @@ -12,11 +12,11 @@ import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.search.SearchHit; import org.elasticsearch.test.junit.annotations.Network; -import org.elasticsearch.xpack.notification.slack.SentMessages; -import org.elasticsearch.xpack.notification.slack.SlackAccount; -import org.elasticsearch.xpack.notification.slack.SlackService; -import org.elasticsearch.xpack.notification.slack.message.Attachment; -import org.elasticsearch.xpack.notification.slack.message.SlackMessage; +import org.elasticsearch.xpack.watcher.notification.slack.SentMessages; +import org.elasticsearch.xpack.watcher.notification.slack.SlackAccount; +import org.elasticsearch.xpack.watcher.notification.slack.SlackService; +import org.elasticsearch.xpack.watcher.notification.slack.message.Attachment; +import org.elasticsearch.xpack.watcher.notification.slack.message.SlackMessage; import org.elasticsearch.xpack.watcher.actions.slack.SlackAction; import org.elasticsearch.xpack.watcher.condition.AlwaysCondition; import org.elasticsearch.xpack.watcher.support.xcontent.XContentSource; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/integration/WatchMetadataTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/integration/WatchMetadataTests.java index 44c9670c67a..a351f51aa89 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/integration/WatchMetadataTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/test/integration/WatchMetadataTests.java @@ -13,7 +13,7 @@ import org.elasticsearch.xpack.watcher.condition.AlwaysCondition; import org.elasticsearch.xpack.watcher.condition.CompareCondition; import org.elasticsearch.xpack.watcher.execution.ActionExecutionMode; import org.elasticsearch.xpack.watcher.history.HistoryStore; -import org.elasticsearch.xpack.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; import org.elasticsearch.xpack.watcher.support.xcontent.ObjectPath; import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase; import org.elasticsearch.xpack.watcher.transport.actions.execute.ExecuteWatchResponse; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/transport/action/delete/DeleteWatchTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/transport/action/delete/DeleteWatchTests.java index c3c7e5ef472..0cac2733d5e 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/transport/action/delete/DeleteWatchTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/transport/action/delete/DeleteWatchTests.java @@ -10,7 +10,7 @@ import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.test.http.MockResponse; import org.elasticsearch.test.http.MockWebServer; -import org.elasticsearch.xpack.common.http.HttpRequestTemplate; +import org.elasticsearch.xpack.watcher.common.http.HttpRequestTemplate; import org.elasticsearch.xpack.watcher.history.HistoryStore; import org.elasticsearch.xpack.watcher.support.xcontent.ObjectPath; import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/trigger/ScheduleTriggerEngineMock.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/trigger/ScheduleTriggerEngineMock.java index 22b44e26266..c24598bd964 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/trigger/ScheduleTriggerEngineMock.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/trigger/ScheduleTriggerEngineMock.java @@ -10,7 +10,7 @@ import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.xpack.support.clock.ClockMock; +import org.elasticsearch.xpack.watcher.watch.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; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/engine/TickerScheduleEngineTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/engine/TickerScheduleEngineTests.java index aef7c4dd6e2..be415890cf6 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/engine/TickerScheduleEngineTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/trigger/schedule/engine/TickerScheduleEngineTests.java @@ -5,10 +5,9 @@ */ package org.elasticsearch.xpack.watcher.trigger.schedule.engine; -import org.apache.logging.log4j.Logger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.support.clock.ClockMock; +import org.elasticsearch.xpack.watcher.watch.clock.ClockMock; import org.elasticsearch.xpack.watcher.condition.AlwaysCondition; import org.elasticsearch.xpack.watcher.input.none.ExecutableNoneInput; import org.elasticsearch.xpack.watcher.trigger.TriggerEngine; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/watch/WatchTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/watch/WatchTests.java index 94c4bab055f..46816151e3f 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/watch/WatchTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/watch/WatchTests.java @@ -25,21 +25,21 @@ import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.script.Script; import org.elasticsearch.script.ScriptService; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.http.HttpClient; -import org.elasticsearch.xpack.common.http.HttpMethod; -import org.elasticsearch.xpack.common.http.HttpRequestTemplate; -import org.elasticsearch.xpack.common.http.auth.HttpAuthRegistry; -import org.elasticsearch.xpack.common.http.auth.basic.BasicAuthFactory; -import org.elasticsearch.xpack.common.text.TextTemplate; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; -import org.elasticsearch.xpack.notification.email.DataAttachment; -import org.elasticsearch.xpack.notification.email.EmailService; -import org.elasticsearch.xpack.notification.email.EmailTemplate; -import org.elasticsearch.xpack.notification.email.HtmlSanitizer; -import org.elasticsearch.xpack.notification.email.Profile; -import org.elasticsearch.xpack.notification.email.attachment.EmailAttachments; -import org.elasticsearch.xpack.notification.email.attachment.EmailAttachmentsParser; -import org.elasticsearch.xpack.support.clock.ClockMock; +import org.elasticsearch.xpack.watcher.common.http.HttpClient; +import org.elasticsearch.xpack.watcher.common.http.HttpMethod; +import org.elasticsearch.xpack.watcher.common.http.HttpRequestTemplate; +import org.elasticsearch.xpack.watcher.common.http.auth.HttpAuthRegistry; +import org.elasticsearch.xpack.watcher.common.http.auth.basic.BasicAuthFactory; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.notification.email.DataAttachment; +import org.elasticsearch.xpack.watcher.notification.email.EmailService; +import org.elasticsearch.xpack.watcher.notification.email.EmailTemplate; +import org.elasticsearch.xpack.watcher.notification.email.HtmlSanitizer; +import org.elasticsearch.xpack.watcher.notification.email.Profile; +import org.elasticsearch.xpack.watcher.notification.email.attachment.EmailAttachments; +import org.elasticsearch.xpack.watcher.notification.email.attachment.EmailAttachmentsParser; +import org.elasticsearch.xpack.watcher.watch.clock.ClockMock; import org.elasticsearch.xpack.watcher.actions.ActionFactory; import org.elasticsearch.xpack.watcher.actions.ActionRegistry; import org.elasticsearch.xpack.watcher.actions.ActionStatus; @@ -137,7 +137,6 @@ import static org.elasticsearch.search.builder.SearchSourceBuilder.searchSource; import static org.elasticsearch.xpack.watcher.input.InputBuilders.searchInput; import static org.elasticsearch.xpack.watcher.test.WatcherTestUtils.templateRequest; import static org.elasticsearch.xpack.watcher.trigger.TriggerBuilders.schedule; -import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.instanceOf; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/support/clock/ClockMock.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/watch/clock/ClockMock.java similarity index 98% rename from plugin/src/test/java/org/elasticsearch/xpack/support/clock/ClockMock.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/watch/clock/ClockMock.java index 3d921839a15..3b285e472f0 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/support/clock/ClockMock.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/watch/clock/ClockMock.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.support.clock; +package org.elasticsearch.xpack.watcher.watch.clock; import org.elasticsearch.common.unit.TimeValue; import org.joda.time.DateTime; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/support/clock/ClockTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/watch/clock/ClockTests.java similarity index 95% rename from plugin/src/test/java/org/elasticsearch/xpack/support/clock/ClockTests.java rename to plugin/src/test/java/org/elasticsearch/xpack/watcher/watch/clock/ClockTests.java index 466fd3c2def..d1b7d17830a 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/support/clock/ClockTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/watch/clock/ClockTests.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.support.clock; +package org.elasticsearch.xpack.watcher.watch.clock; import org.elasticsearch.test.ESTestCase; import org.joda.time.DateTime; diff --git a/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/FullClusterRestartIT.java b/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/FullClusterRestartIT.java index 6401a48aa3a..8fcaa4b1d00 100644 --- a/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/FullClusterRestartIT.java +++ b/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/FullClusterRestartIT.java @@ -19,7 +19,7 @@ import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.test.StreamsUtils; import org.elasticsearch.test.rest.ESRestTestCase; -import org.elasticsearch.xpack.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; import org.elasticsearch.xpack.monitoring.exporter.MonitoringTemplateUtils; import org.elasticsearch.xpack.security.SecurityClusterClientYamlTestCase; import org.elasticsearch.xpack.security.support.IndexLifecycleManager; diff --git a/qa/smoke-test-watcher-with-mustache/src/test/java/org/elasticsearch/smoketest/WatcherTemplateIT.java b/qa/smoke-test-watcher-with-mustache/src/test/java/org/elasticsearch/smoketest/WatcherTemplateIT.java index f8206efe602..a5cf8c0db9c 100644 --- a/qa/smoke-test-watcher-with-mustache/src/test/java/org/elasticsearch/smoketest/WatcherTemplateIT.java +++ b/qa/smoke-test-watcher-with-mustache/src/test/java/org/elasticsearch/smoketest/WatcherTemplateIT.java @@ -15,8 +15,8 @@ import org.elasticsearch.script.ScriptEngine; import org.elasticsearch.script.ScriptService; import org.elasticsearch.script.mustache.MustacheScriptEngine; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.common.text.TextTemplate; -import org.elasticsearch.xpack.common.text.TextTemplateEngine; +import org.elasticsearch.xpack.watcher.common.text.TextTemplate; +import org.elasticsearch.xpack.watcher.common.text.TextTemplateEngine; import org.elasticsearch.xpack.watcher.Watcher; import org.junit.Before; From a89bfe84baadb691664e4cbcc5378b674a01b46e Mon Sep 17 00:00:00 2001 From: Dimitrios Liappis Date: Tue, 14 Nov 2017 14:25:52 +0200 Subject: [PATCH 3/6] [DOCS] Split long lines in Docker TLS getting-started snippet and add warning for Windows users not using PowerShell (e.g. `cmd.exe`) to remove the `\` character and join lines. Also fix trailing whitespace character in link back to `docker.asciidoc`. Relates elastic/x-pack-elasticsearch#2999 Original commit: elastic/x-pack-elasticsearch@fe1c5dbc11f6bf8e8f920a452ae5e02dd859a8fa --- .../configuring-tls-docker.asciidoc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/en/security/securing-communications/configuring-tls-docker.asciidoc b/docs/en/security/securing-communications/configuring-tls-docker.asciidoc index f6309c44b5d..bd2b687673f 100644 --- a/docs/en/security/securing-communications/configuring-tls-docker.asciidoc +++ b/docs/en/security/securing-communications/configuring-tls-docker.asciidoc @@ -15,7 +15,7 @@ https://www.elastic.co/subscriptions[available subscriptions]. [float] ==== Prepare the environment -<>. +<>. Inside a new, empty, directory create the following **four files**: @@ -178,8 +178,14 @@ curl --cacert certs/ca/ca.crt -u elastic:PleaseChangeMe https://localhost:9200 all users: + -- +WARNING: Windows users not running PowerShell will need to remove `\` and join lines in the snippet below. ["source","sh"] ---- -docker exec es01 /bin/bash -c "bin/x-pack/setup-passwords auto --batch -Expack.ssl.certificate=x-pack/certificates/es01/es01.crt -Expack.ssl.certificate_authorities=x-pack/certificates/ca/ca.crt -Expack.ssl.key=x-pack/certificates/es01/es01.key --url https://localhost:9200" +docker exec es01 /bin/bash -c "bin/x-pack/setup-passwords \ +auto --batch \ +-Expack.ssl.certificate=x-pack/certificates/es01/es01.crt \ +-Expack.ssl.certificate_authorities=x-pack/certificates/ca/ca.crt \ +-Expack.ssl.key=x-pack/certificates/es01/es01.key \ +--url https://localhost:9200" ---- -- From 5888174f2465306dd06076e9ba9da3794f5e82f5 Mon Sep 17 00:00:00 2001 From: Jay Modi Date: Tue, 14 Nov 2017 08:11:21 -0700 Subject: [PATCH 4/6] Cleanup leftover tribe references in the plugin build.gradle file (elastic/x-pack-elasticsearch#2987) In elastic/x-pack-elasticsearch#2901, the dependency on the tribe module was removed but a few leftover references were missed in the build.gradle file of the x-pack-elasticsearch plugin. This commit removes these leftover references. Original commit: elastic/x-pack-elasticsearch@03f1cae1f55f13944a2f84ef94ff3f7934f741e0 --- plugin/build.gradle | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugin/build.gradle b/plugin/build.gradle index b7dca718c3c..bdc0cb136cd 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -29,13 +29,11 @@ dependencyLicenses { mapping from: /bc.*/, to: 'bouncycastle' mapping from: /owasp-java-html-sanitizer.*/, to: 'owasp-java-html-sanitizer' mapping from: /transport-netty.*/, to: 'elasticsearch' - mapping from: /tribe.*/, to: 'elasticsearch' mapping from: /elasticsearch-rest-client.*/, to: 'elasticsearch' mapping from: /http.*/, to: 'httpclient' // pulled in by rest client mapping from: /commons-.*/, to: 'commons' // pulled in by rest client ignoreSha 'elasticsearch-rest-client' ignoreSha 'transport-netty4' - ignoreSha 'tribe' ignoreSha 'elasticsearch-rest-client-sniffer' } From 2f8cd77349265845981dd44e4be72f671269a2bc Mon Sep 17 00:00:00 2001 From: jaymode Date: Tue, 14 Nov 2017 08:15:43 -0700 Subject: [PATCH 5/6] Test: TribeWithSecurityIT should wait for security index to be writeable This commit adds checks to the TribeWithSecurityIT tests to ensure that the security index is writeable before making modification operations. Otherwise, we hit errors in tests that are not always reproducible. relates elastic/x-pack-elasticsearch#2977 Original commit: elastic/x-pack-elasticsearch@c29bdff7ae6cc578b690fb22a6636187e561f348 --- .../test/SecurityIntegTestCase.java | 17 ++++++++++------- .../elasticsearch/test/TribeWithSecurityIT.java | 5 ++++- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/plugin/src/test/java/org/elasticsearch/test/SecurityIntegTestCase.java b/plugin/src/test/java/org/elasticsearch/test/SecurityIntegTestCase.java index 875d7b17426..de4681568ab 100644 --- a/plugin/src/test/java/org/elasticsearch/test/SecurityIntegTestCase.java +++ b/plugin/src/test/java/org/elasticsearch/test/SecurityIntegTestCase.java @@ -20,7 +20,6 @@ import org.elasticsearch.cluster.health.ClusterHealthStatus; import org.elasticsearch.cluster.metadata.AliasOrIndex; import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.cluster.routing.IndexRoutingTable; -import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.network.NetworkAddress; import org.elasticsearch.common.settings.MockSecureSettings; import org.elasticsearch.common.settings.SecureString; @@ -452,13 +451,13 @@ public abstract class SecurityIntegTestCase extends ESIntegTestCase { } public void assertSecurityIndexActive() throws Exception { - assertSecurityIndexActive(internalCluster()); + assertSecurityIndexActive(cluster()); } - public void assertSecurityIndexActive(InternalTestCluster internalTestCluster) throws Exception { - for (ClusterService clusterService : internalTestCluster.getInstances(ClusterService.class)) { + public void assertSecurityIndexActive(TestCluster testCluster) throws Exception { + for (Client client : testCluster.getClients()) { assertBusy(() -> { - ClusterState clusterState = clusterService.state(); + ClusterState clusterState = client.admin().cluster().prepareState().setLocal(true).get().getState(); assertFalse(clusterState.blocks().hasGlobalBlock(GatewayService.STATE_NOT_RECOVERED_BLOCK)); assertTrue(securityIndexMappingAndTemplateSufficientToRead(clusterState, logger)); Index securityIndex = resolveSecurityIndex(clusterState.metaData()); @@ -473,9 +472,13 @@ public abstract class SecurityIntegTestCase extends ESIntegTestCase { } public void assertSecurityIndexWriteable() throws Exception { - for (ClusterService clusterService : internalCluster().getInstances(ClusterService.class)) { + assertSecurityIndexWriteable(cluster()); + } + + public void assertSecurityIndexWriteable(TestCluster testCluster) throws Exception { + for (Client client : testCluster.getClients()) { assertBusy(() -> { - ClusterState clusterState = clusterService.state(); + ClusterState clusterState = client.admin().cluster().prepareState().setLocal(true).get().getState(); assertFalse(clusterState.blocks().hasGlobalBlock(GatewayService.STATE_NOT_RECOVERED_BLOCK)); assertTrue(securityIndexMappingAndTemplateUpToDate(clusterState, logger)); Index securityIndex = resolveSecurityIndex(clusterState.metaData()); diff --git a/qa/tribe-tests-with-security/src/test/java/org/elasticsearch/test/TribeWithSecurityIT.java b/qa/tribe-tests-with-security/src/test/java/org/elasticsearch/test/TribeWithSecurityIT.java index e7dc9c47802..2a0ce60d95b 100644 --- a/qa/tribe-tests-with-security/src/test/java/org/elasticsearch/test/TribeWithSecurityIT.java +++ b/qa/tribe-tests-with-security/src/test/java/org/elasticsearch/test/TribeWithSecurityIT.java @@ -7,7 +7,6 @@ package org.elasticsearch.test; import com.carrotsearch.hppc.cursors.ObjectCursor; -import org.apache.lucene.util.LuceneTestCase; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetaData; @@ -114,6 +113,7 @@ public class TribeWithSecurityIT extends SecurityIntegTestCase { } public void testThatTribeCanAuthenticateElasticUserWithChangedPassword() throws Exception { + assertSecurityIndexWriteable(); securityClient(client()).prepareChangePassword("elastic", "password".toCharArray()).get(); assertTribeNodeHasAllIndices(); @@ -124,6 +124,8 @@ public class TribeWithSecurityIT extends SecurityIntegTestCase { } public void testThatTribeClustersHaveDifferentPasswords() throws Exception { + assertSecurityIndexWriteable(); + assertSecurityIndexWriteable(cluster2); securityClient().prepareChangePassword("elastic", "password".toCharArray()).get(); securityClient(cluster2.client()).prepareChangePassword("elastic", "password2".toCharArray()).get(); @@ -153,6 +155,7 @@ public class TribeWithSecurityIT extends SecurityIntegTestCase { final int randomRoles = scaledRandomIntBetween(3, 8); List shouldBeSuccessfulRoles = new ArrayList<>(); + assertSecurityIndexWriteable(); for (int i = 0; i < randomRoles; i++) { final String rolename = "preferredClusterRole" + i; PutRoleResponse response = securityClient(client()).preparePutRole(rolename).cluster("monitor").get(); From 4eb87bba4bb8ea7e3cb3ff00faef7d6237d888b0 Mon Sep 17 00:00:00 2001 From: Jay Modi Date: Tue, 14 Nov 2017 10:08:59 -0700 Subject: [PATCH 6/6] Remove create_bwc_indexes.py (elastic/x-pack-elasticsearch#2989) This commit removes the create_bwc_indexes.py script as we no longer need this script to test for BWC with indices. The last test relying on this script was removed in elastic/x-pack-elasticsearch#2832. relates elastic/x-pack-elasticsearch#1629 Original commit: elastic/x-pack-elasticsearch@5dc3cbc39522304f571e39cac23bbdec8fed4ddd --- dev-tools/create_bwc_indexes.py | 512 -------------------------------- 1 file changed, 512 deletions(-) delete mode 100644 dev-tools/create_bwc_indexes.py diff --git a/dev-tools/create_bwc_indexes.py b/dev-tools/create_bwc_indexes.py deleted file mode 100644 index 251da452202..00000000000 --- a/dev-tools/create_bwc_indexes.py +++ /dev/null @@ -1,512 +0,0 @@ -# ELASTICSEARCH CONFIDENTIAL -# __________________ -# -# [2014] Elasticsearch Incorporated. All Rights Reserved. -# -# NOTICE: All information contained herein is, and remains -# the property of Elasticsearch Incorporated and its suppliers, -# if any. The intellectual and technical concepts contained -# herein are proprietary to Elasticsearch Incorporated -# and its suppliers and may be covered by U.S. and Foreign Patents, -# patents in process, and are protected by trade secret or copyright law. -# Dissemination of this information or reproduction of this material -# is strictly forbidden unless prior written permission is obtained -# from Elasticsearch Incorporated. - -# Creates indices with old versions of elasticsearch. These indices are used by x-pack plugins like security -# to test if the import of metadata that is stored in elasticsearch indexes works correctly. -# This tool will start a node on port 9200/9300. If a node is already running on that port then the script will fail. -# Currently this script can only deal with versions >=2.0.0 and < 5.0. Needs more work for versions before or after. -# -# Run from x-plugins root directory like so: -# python3 ./dev-tools/create_bwc_indexes.py 2.3.4 -# You can get any particular version of elasticsearch with: -# python3 ../elasticsearch/dev-tools/get-bwc-version.py 2.3.4 -# -# -import argparse -import glob -import json -import logging -import os -import random -import shutil -import subprocess -import sys -import tempfile -import time -import requests -import socket -import signal -from cmd import Cmd - -DEFAULT_TRANSPORT_TCP_PORT = 9300 -DEFAULT_HTTP_TCP_PORT = 9200 - -if sys.version_info[0] < 3: - print('%s must use python 3.x (for the ES python client)' % sys.argv[0]) - -try: - from elasticsearch import Elasticsearch - from elasticsearch.exceptions import ConnectionError - from elasticsearch.exceptions import TransportError - from elasticsearch.exceptions import NotFoundError - from elasticsearch.client import IndicesClient -except ImportError as e: - print('Can\'t import elasticsearch please install `sudo pip3 install elasticsearch`') - sys.exit(1) - -def start_node(version, release_dir, data_dir): - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - result = sock.connect_ex(('localhost',DEFAULT_HTTP_TCP_PORT)) - if result == 0: - raise Exception('Elasticsearch instance already running on port ' + str(DEFAULT_HTTP_TCP_PORT)) - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - result = sock.connect_ex(('localhost',DEFAULT_TRANSPORT_TCP_PORT)) - if result == 0: - raise Exception('Elasticsearch instance already running on port ' + str(DEFAULT_TRANSPORT_TCP_PORT)) - logging.info('Starting node from %s on port %s/%s, data_dir %s' % (release_dir, DEFAULT_TRANSPORT_TCP_PORT - , DEFAULT_HTTP_TCP_PORT, data_dir)) - cluster_name = 'bwc_index_' + version - if parse_version(version) < parse_version("5.0.0-alpha1"): - prefix = '-Des.' - else: - prefix = '-E' - cmd = [ - os.path.join(release_dir, 'bin/elasticsearch'), - '%spath.data=%s' % (prefix, data_dir), - '%spath.logs=logs' % prefix, - '%scluster.name=%s' % (prefix, cluster_name), - '%snetwork.host=localhost' % prefix, - '%stransport.tcp.port=%s' % (prefix, DEFAULT_TRANSPORT_TCP_PORT), # not sure if we need to customize ports - '%shttp.port=%s' % (prefix, DEFAULT_HTTP_TCP_PORT) - ] - - return subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - -def install_plugin(version, release_dir, plugin_name): - args = [plugin_name] - if parse_version(version) >= parse_version('2.2.0'): - args = [plugin_name, '--batch'] - run_plugin(version, release_dir, 'install', args) - -def remove_plugin(version, release_dir, plugin_name): - # 5.0 doesn't like trying to remove a plugin that isn't installed so we - # shouldn't try. - if os.path.exists(os.path.join(release_dir, 'plugins', plugin_name)): - run_plugin(version, release_dir, 'remove', [plugin_name]) - -def run_plugin(version, release_dir, plugin_cmd, args): - if parse_version(version) < parse_version('5.0.0'): - script = 'bin/plugin' - else: - script = 'bin/elasticsearch-plugin' - cmd = [os.path.join(release_dir, script), plugin_cmd] + args - subprocess.check_call(cmd) - -def create_client(): - logging.info('Waiting for node to startup') - for _ in range(0, 30): - try: - client = Elasticsearch([{'host': 'localhost', 'port': 9200, 'http_auth':'es_admin:0123456789'}]) - health = client.cluster.health(wait_for_nodes=1) - return client - except ConnectionError: - logging.info('Not started yet...') - time.sleep(1) - assert False, 'Timed out waiting for node for %s seconds' % timeout - -def wait_for_yellow(version, client, index): - logging.info('Waiting for %s to be yellow' % index) - # The health call below uses `params` because it the 5.x client doesn't - # support wait_for_relocating_shards and the 2.x client doesn't support - # wait_for_relocating_shards and we'd like to use the same client for both - # versions. - if parse_version(version) < parse_version('5.0.0'): - health = client.cluster.health(wait_for_status='yellow', index=index, params={'wait_for_relocating_shards':0}) - else: - health = client.cluster.health(wait_for_status='yellow', index=index, params={'wait_for_no_relocating_shards':'true'}) - assert health['timed_out'] == False, 'cluster health timed out %s' % health - -# this adds a user bwc_test_role/9876543210, a role bwc_test_role and some documents the user has or has not access to -def generate_security_index(client, version): - - logging.info('Add a group') - # don't know how to use python client with shield so use curl instead - # add a user - body = { - "password" : "9876543210", - "roles" : [ "bwc_test_role" ] - } - - while True: - response = requests.put('http://localhost:9200/_shield/user/bwc_test_user', auth=('es_admin', '0123456789'), data=json.dumps(body)) - logging.info('put user reponse: ' + response.text) - if response.status_code == 200: - break - else: - if 'service has not been started' in response.text: - continue - raise Exception('PUT http://localhost:9200/_shield/role/bwc_test_role did not succeed!') - - - # add a role - body = { - "cluster": ["all"], - "indices": [ - { - "names": [ "index1", "index2" ], - "privileges": ["all"], - "query": "{\"match\": {\"title\": \"foo\"}}" - } - ], - "run_as": [ "other_user" ] - } - if parse_version(version) < parse_version('5.0.0'): - body['indices'][0]['fields'] = [ "title", "body" ] - else: - body['indices'][0]['field_security'] = { "grant": [ "title", "body" ] } - # order of params in put role request is important, see https://github.com/elastic/x-plugins/issues/2606 - response = requests.put('http://localhost:9200/_shield/role/bwc_test_role', auth=('es_admin', '0123456789') - , data=json.dumps(body, sort_keys=True)) - logging.info('put user reponse: ' + response.text) - if (response.status_code != 200) : - raise Exception('PUT http://localhost:9200/_shield/role/bwc_test_role did not succeed!') - - client.index(index="index1", doc_type="doc", body={"title": "foo", - "body": "bwc_test_user should be able to see this field", - "secured_body": "bwc_test_user should not be able to see this field"}) - client.index(index="index1", doc_type="doc", body={"title": "bwc_test_user should not be able to see this document"}) - - client.index(index="index2", doc_type="doc", body={"title": "foo", - "body": "bwc_test_user should be able to see this field", - "secured_body": "bwc_test_user should not be able to see this field"}) - client.index(index="index2", doc_type="doc", body={"title": "bwc_test_user should not be able to see this document"}) - - client.index(index="index3", doc_type="doc", body={"title": "bwc_test_user should not see this index"}) - - if parse_version(version) < parse_version('5.1.0'): - logging.info("Adding a alias that starts with - so we can test against it") - client.indices.put_alias(index='index3', name='-index3') - - wait_for_yellow(version, client, '.security') - -# this adds a couple of watches and waits for the the watch_history to accumulate some results -def generate_watcher_index(client, version): - logging.info('Adding a watch') - body = { - "trigger" : { - "schedule": { - "interval": "1s" - } - }, - "input" : { - "search" : { - "timeout": "100s", - "request" : { - "indices" : [ ".watches" ], - "body" : { - "query" : { "match_all" : {}}, - "size": 1 - }, - } - } - }, - "condition" : { - "always" : {} - }, - "throttle_period": "1s", - "actions" : { - "index_payload" : { - "transform" : { - "search" : { - "request" : { - "body" : { "size": 1, "query" : { "match_all" : {} }} - }, - "timeout": "100s" - } - }, - "index" : { - "index" : "bwc_watch_index", - "doc_type" : "bwc_watch_type", - "timeout": "100s" - } - } - } - } - response = requests.put('http://localhost:9200/_watcher/watch/bwc_watch', auth=('es_admin', '0123456789'), data=json.dumps(body)) - logging.info('PUT watch response: ' + response.text) - if (response.status_code != 201) : - raise Exception('PUT http://localhost:9200/_watcher/watch/bwc_watch did not succeed!') - - logging.info('Adding a watch with "fun" throttle periods') - body = { - "trigger" : { - "schedule": { - "interval": "1s" - } - }, - "condition" : { - "never" : {} - }, - "throttle_period": "100s", - "actions" : { - "index_payload" : { - "throttle_period": "100s", - "transform" : { - "search" : { - "request" : { - "body" : { "size": 1, "query" : { "match_all" : {} }} - } - } - }, - "index" : { - "index" : "bwc_watch_index", - "doc_type" : "bwc_watch_type" - } - } - } - } - response = requests.put('http://localhost:9200/_watcher/watch/bwc_throttle_period', auth=('es_admin', '0123456789'), data=json.dumps(body)) - logging.info('PUT watch response: ' + response.text) - if (response.status_code != 201) : - raise Exception('PUT http://localhost:9200/_watcher/watch/bwc_throttle_period did not succeed!') - - if parse_version(version) < parse_version('2.3.0'): - logging.info('Skipping watch with a funny read timeout because email attachement is not supported by this version') - else: - logging.info('Adding a watch with a funny read timeout') - body = { - "trigger" : { - "schedule": { - "interval": "100s" - } - }, - "condition": { - "never": {} - }, - "actions": { - "work": { - "email": { - "to": "email@domain.com", - "subject": "Test Kibana PDF report", - "attachments": { - "test_report.pdf": { - "http": { - "content_type": "application/pdf", - "request": { - "read_timeout": "100s", - "scheme": "https", - "host": "example.com", - "path":"{{ctx.metadata.report_url}}", - "port": 8443, - "auth": { - "basic": { - "username": "Aladdin", - "password": "open sesame" - } - } - } - } - } - } - } - } - } - } - response = requests.put('http://localhost:9200/_watcher/watch/bwc_funny_timeout', auth=('es_admin', '0123456789'), data=json.dumps(body)) - logging.info('PUT watch response: ' + response.text) - if (response.status_code != 201) : - raise Exception('PUT http://localhost:9200/_watcher/watch/bwc_funny_timeout did not succeed!') - - # wait to accumulate some watches - logging.info('Waiting for watch results index to fill up...') - wait_for_search(10, lambda: client.search(index="bwc_watch_index", body={"query": {"match_all": {}}})) - if parse_version(version) < parse_version('5.0.0'): - watcher_history_name = ".watch_history*" - else: - watcher_history_name = ".watcher-history*" - wait_for_search(10, lambda: client.search(index=watcher_history_name, body={"query": {"match_all": {}}})) - - wait_for_yellow(version, client, '.watches') - wait_for_yellow(version, client, watcher_history_name) - wait_for_yellow(version, client, 'bwc_watch_index') - -def wait_for_monitoring_index_to_fill(client, version): - if parse_version(version) < parse_version('5.0.0'): - monitoring_name = '.marvel-*' - else: - monitoring_name = '.monitoring-*' - def wait_for_monitoring_to_index(doc_type, count): - logging.info('Waiting for %s to have count(%s) = %s...' % (monitoring_name, doc_type, count)) - wait_for_search(count, lambda: - client.search(index=monitoring_name, body={"query": {"term": { "type": doc_type }}})) - - wait_for_monitoring_to_index('index_stats', 10) - wait_for_monitoring_to_index('shards', 10) - wait_for_monitoring_to_index('indices_stats', 3) - wait_for_monitoring_to_index('node_stats', 3) - wait_for_monitoring_to_index('cluster_stats', 3) - - wait_for_yellow(version, client, monitoring_name) - -def wait_for_search(required_count, searcher): - for attempt in range(1, 31): - try: - response = searcher() - logging.info('(' + str(attempt) + ') Got ' + str(response['hits']['total']) + ' hits and want ' + str(required_count) + '...') - if response['hits']['total'] >= required_count: - return - except NotFoundError: - logging.info('(' + str(attempt) + ') Not found, retrying') - time.sleep(1) - logger.error("Ran out of retries") - raise "Ran out of retries" - -def compress_index(version, tmp_dir, output_dir): - compress(tmp_dir, output_dir, 'x-pack-%s.zip' % version, 'data') - -def compress(tmp_dir, output_dir, zipfile, directory): - abs_output_dir = os.path.abspath(output_dir) - zipfile = os.path.join(abs_output_dir, zipfile) - if os.path.exists(zipfile): - os.remove(zipfile) - logging.info('Compressing index into %s, tmpDir %s', zipfile, tmp_dir) - olddir = os.getcwd() - os.chdir(tmp_dir) - subprocess.check_call('zip -r %s %s' % (zipfile, directory), shell=True) - os.chdir(olddir) - - -def parse_config(): - parser = argparse.ArgumentParser(description='Builds an elasticsearch index for backwards compatibility tests') - required = parser.add_mutually_exclusive_group(required=True) - required.add_argument('versions', metavar='X.Y.Z', nargs='*', default=[], - help='The elasticsearch version to build an index for') - required.add_argument('--all', action='store_true', default=False, - help='Recreate all existing backwards compatibility indexes') - parser.add_argument('--releases-dir', '-d', default='backwards', metavar='DIR', - help='The directory containing elasticsearch releases') - parser.add_argument('--output-dir', '-o', default='plugin/src/test/resources/indices/bwc/', - help='The directory to write the zipped index into') - - cfg = parser.parse_args() - - if not os.path.exists(cfg.output_dir): - parser.error('Output directory does not exist: %s' % cfg.output_dir) - - if not cfg.versions: - # --all - for bwc_index in glob.glob(os.path.join(cfg.output_dir, 'x-pack-*.zip')): - version = os.path.basename(bwc_index)[len('x-pack-'):-len('.zip')] - cfg.versions.append(version) - - return cfg - -def shutdown_node(node): - logging.info('Shutting down node with pid %d', node.pid) - node.terminate() - node.wait() - -def parse_version(version): - import re - splitted = re.split('[.-]', version) - if len(splitted) == 3: - splitted = splitted + ['GA'] - splitted = [s.lower() for s in splitted] - assert len(splitted) == 4; - return splitted - -def run(command, env_vars=None): - if env_vars: - for key, value in env_vars.items(): - os.putenv(key, value) - logging.info('*** Running: %s%s%s' % (COLOR_OK, command, COLOR_END)) - if os.system(command): - raise RuntimeError(' FAILED: %s' % (command)) - -assert parse_version('1.2.3') < parse_version('2.1.0') -assert parse_version('1.2.3') < parse_version('1.2.4') -assert parse_version('1.1.0') < parse_version('1.2.0') - -# console colors -COLOR_OK = '\033[92m' -COLOR_END = '\033[0m' -COLOR_FAIL = '\033[91m' - -def main(): - logging.basicConfig(format='[%(levelname)s] [%(asctime)s] %(message)s', level=logging.INFO, - datefmt='%Y-%m-%d %I:%M:%S %p') - logging.getLogger('elasticsearch').setLevel(logging.ERROR) - logging.getLogger('urllib3').setLevel(logging.WARN) - cfg = parse_config() - for version in cfg.versions: - logging.info('--> Creating x-pack index for %s' % version) - - # setup for starting nodes - release_dir = os.path.join(cfg.releases_dir, 'elasticsearch-%s' % version) - if not os.path.exists(release_dir): - raise RuntimeError('ES version %s does not exist in %s' % (version, cfg.releases_dir)) - tmp_dir = tempfile.mkdtemp() - data_dir = os.path.join(tmp_dir, 'data') - logging.info('Temp data dir: %s' % data_dir) - node = None - - try: - if parse_version(version) < parse_version('5.0.0'): - # Remove old plugins just in case any are around - remove_plugin(version, release_dir, 'marvel-agent') - remove_plugin(version, release_dir, 'watcher') - remove_plugin(version, release_dir, 'shield') - remove_plugin(version, release_dir, 'license') - # Remove the shield config too before fresh install - run('rm -rf %s' %(os.path.join(release_dir, 'config/shield'))) - # Install plugins we'll need - install_plugin(version, release_dir, 'license') - install_plugin(version, release_dir, 'shield') - install_plugin(version, release_dir, 'watcher') - install_plugin(version, release_dir, 'marvel-agent') - # define the stuff we need to make the esadmin user - users_script = os.path.join(release_dir, 'bin/shield/esusers') - esadmin_role = 'admin' - else: - # Remove old plugins just in case any are around - remove_plugin(version, release_dir, 'x-pack') - # Remove the x-pack config too before fresh install - run('rm -rf %s' %(os.path.join(release_dir, 'config/x-pack'))) - # Install plugins we'll need - install_plugin(version, release_dir, 'x-pack') - # define the stuff we need to make the esadmin user - users_script = os.path.join(release_dir, 'bin/x-pack/users') - esadmin_role = 'superuser' - - # create admin - run('%s useradd es_admin -r %s -p 0123456789' % - (users_script, esadmin_role)) - node = start_node(version, release_dir, data_dir) - - # create a client that authenticates as es_admin - client = create_client() - if parse_version(version) < parse_version('2.3.0'): - logging.info('Version is ' + version + ' but shield supports native realm only from 2.3.0 on. Nothing to do for Shield.') - else: - generate_security_index(client, version) - generate_watcher_index(client, version) - wait_for_monitoring_index_to_fill(client, version) - - shutdown_node(node) - node = None - compress_index(version, tmp_dir, cfg.output_dir) - finally: - - if node is not None: - # This only happens if we've hit an exception: - shutdown_node(node) - shutil.rmtree(tmp_dir) - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - logging.info('Caught keyboard interrupt, exiting...') - sys.exit(signal.SIGTERM) # exit code