mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-24 17:09:48 +00:00
Merge branch 'master' into extract_scheduler_engine_to_xpack
Original commit: elastic/x-pack-elasticsearch@1fef4b9a31
This commit is contained in:
commit
58a0d42ff8
@ -13,7 +13,7 @@ public class KibanaUserRole extends Role {
|
||||
|
||||
private static final String[] CLUSTER_PRIVILEGES = new String[] { "monitor" };
|
||||
private static final RoleDescriptor.IndicesPrivileges[] INDICES_PRIVILEGES = new RoleDescriptor.IndicesPrivileges[] {
|
||||
RoleDescriptor.IndicesPrivileges.builder().indices(".kibana*").privileges("manage", "read", "index").build() };
|
||||
RoleDescriptor.IndicesPrivileges.builder().indices(".kibana*").privileges("manage", "read", "index", "delete").build() };
|
||||
|
||||
public static final String NAME = "kibana_user";
|
||||
public static final RoleDescriptor DESCRIPTOR = new RoleDescriptor(NAME, CLUSTER_PRIVILEGES, INDICES_PRIVILEGES, null);
|
||||
|
@ -5,12 +5,15 @@
|
||||
*/
|
||||
package org.elasticsearch.integration;
|
||||
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
|
||||
import org.elasticsearch.action.admin.indices.get.GetIndexResponse;
|
||||
import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse;
|
||||
import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse.FieldMappingMetaData;
|
||||
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryResponse;
|
||||
import org.elasticsearch.action.delete.DeleteResponse;
|
||||
import org.elasticsearch.action.fieldstats.FieldStats;
|
||||
import org.elasticsearch.action.fieldstats.FieldStatsResponse;
|
||||
import org.elasticsearch.action.index.IndexResponse;
|
||||
import org.elasticsearch.action.search.MultiSearchResponse;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
@ -19,6 +22,8 @@ import org.elasticsearch.shield.authc.support.SecuredString;
|
||||
import org.elasticsearch.shield.authc.support.UsernamePasswordToken;
|
||||
import org.elasticsearch.test.ShieldIntegTestCase;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static org.hamcrest.Matchers.arrayContaining;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
@ -29,7 +34,7 @@ import static org.hamcrest.Matchers.notNullValue;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class KibanaRoleTests extends ShieldIntegTestCase {
|
||||
public class KibanaUserRoleIntegTests extends ShieldIntegTestCase {
|
||||
|
||||
protected static final SecuredString USERS_PASSWD = new SecuredString("change_me".toCharArray());
|
||||
protected static final String USERS_PASSWD_HASHED = new String(Hasher.BCRYPT.hash(new SecuredString("change_me".toCharArray())));
|
||||
@ -38,18 +43,11 @@ public class KibanaRoleTests extends ShieldIntegTestCase {
|
||||
public String configRoles() {
|
||||
return super.configRoles() + "\n" +
|
||||
"my_kibana_user:\n" +
|
||||
" cluster:\n" +
|
||||
" - monitor\n" +
|
||||
" indices:\n" +
|
||||
" - names: 'logstash-*'\n" +
|
||||
" privileges:\n" +
|
||||
" - view_index_metadata\n" +
|
||||
" - read\n" +
|
||||
" - names: '.kibana*'\n" +
|
||||
" privileges:\n" +
|
||||
" - manage\n" +
|
||||
" - read\n" +
|
||||
" - index";
|
||||
" - read\n";
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -61,7 +59,8 @@ public class KibanaRoleTests extends ShieldIntegTestCase {
|
||||
@Override
|
||||
public String configUsersRoles() {
|
||||
return super.configUsersRoles() +
|
||||
"my_kibana_user:kibana_user";
|
||||
"my_kibana_user:kibana_user\n" +
|
||||
"kibana_user:kibana_user";
|
||||
}
|
||||
|
||||
public void testFieldMappings() throws Exception {
|
||||
@ -168,6 +167,33 @@ public class KibanaRoleTests extends ShieldIntegTestCase {
|
||||
assertThat(response.getIndices(), arrayContaining(index));
|
||||
}
|
||||
|
||||
public void testCreateIndexDeleteInKibanaIndex() throws Exception {
|
||||
final String index = randomBoolean()? ".kibana" : ".kibana-" + randomAsciiOfLengthBetween(1, 10).toLowerCase(Locale.ENGLISH);
|
||||
|
||||
if (randomBoolean()) {
|
||||
CreateIndexResponse createIndexResponse = client().filterWithHeader(singletonMap("Authorization",
|
||||
UsernamePasswordToken.basicAuthHeaderValue("kibana_user", USERS_PASSWD)))
|
||||
.admin().indices().prepareCreate(index).get();
|
||||
assertThat(createIndexResponse.isAcknowledged(), is(true));
|
||||
}
|
||||
|
||||
IndexResponse response = client()
|
||||
.filterWithHeader(singletonMap("Authorization", UsernamePasswordToken.basicAuthHeaderValue("kibana_user", USERS_PASSWD)))
|
||||
.prepareIndex()
|
||||
.setIndex(index)
|
||||
.setType("dashboard")
|
||||
.setSource("foo", "bar")
|
||||
.setRefresh(true)
|
||||
.get();
|
||||
assertThat(response.isCreated(), is(true));
|
||||
|
||||
DeleteResponse deleteResponse = client()
|
||||
.filterWithHeader(singletonMap("Authorization", UsernamePasswordToken.basicAuthHeaderValue("kibana_user", USERS_PASSWD)))
|
||||
.prepareDelete(index, "dashboard", response.getId())
|
||||
.get();
|
||||
assertThat(deleteResponse.isFound(), is(true));
|
||||
}
|
||||
|
||||
// TODO: When we have an XPackIntegTestCase, this should test that we can send MonitoringBulkActions
|
||||
|
||||
}
|
@ -37,6 +37,6 @@ public class VersionCompatibilityTests extends ESTestCase {
|
||||
*
|
||||
*/
|
||||
assertThat("Remove workaround in LicenseService class when es core supports merging cluster level custom metadata",
|
||||
Version.CURRENT.equals(Version.V_5_0_0_alpha3), is(true));
|
||||
Version.CURRENT.equals(Version.V_5_0_0), is(true));
|
||||
}
|
||||
}
|
||||
|
@ -60,8 +60,8 @@ public class KibanaUserRoleTests extends ESTestCase {
|
||||
private void testIndexAccess(String index) {
|
||||
assertThat(KibanaUserRole.INSTANCE.indices().allowedIndicesMatcher("indices:foo").test(index), is(false));
|
||||
assertThat(KibanaUserRole.INSTANCE.indices().allowedIndicesMatcher("indices:bar").test(index), is(false));
|
||||
assertThat(KibanaUserRole.INSTANCE.indices().allowedIndicesMatcher(DeleteAction.NAME).test(index), is(false));
|
||||
|
||||
assertThat(KibanaUserRole.INSTANCE.indices().allowedIndicesMatcher(DeleteAction.NAME).test(index), is(true));
|
||||
assertThat(KibanaUserRole.INSTANCE.indices().allowedIndicesMatcher(DeleteIndexAction.NAME).test(index), is(true));
|
||||
assertThat(KibanaUserRole.INSTANCE.indices().allowedIndicesMatcher(CreateIndexAction.NAME).test(index), is(true));
|
||||
assertThat(KibanaUserRole.INSTANCE.indices().allowedIndicesMatcher(IndexAction.NAME).test(index), is(true));
|
||||
|
@ -73,8 +73,6 @@ indices:monitor/stats[n]
|
||||
indices:monitor/upgrade[n]
|
||||
indices:monitor/upgrade
|
||||
internal:admin/tasks/ban
|
||||
internal:cluster/node/index/deleted
|
||||
internal:cluster/node/index_store/deleted
|
||||
internal:cluster/node/mapping/refresh
|
||||
internal:cluster/nodes/indices/shard/store
|
||||
internal:cluster/nodes/indices/shard/store[n]
|
||||
|
@ -43,6 +43,7 @@ import org.elasticsearch.xpack.rest.action.RestXPackInfoAction;
|
||||
import org.elasticsearch.xpack.common.text.TextTemplateModule;
|
||||
import org.elasticsearch.xpack.rest.action.RestXPackUsageAction;
|
||||
import org.elasticsearch.xpack.watcher.Watcher;
|
||||
import org.elasticsearch.xpack.support.clock.ClockModule;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.security.AccessController;
|
||||
@ -137,6 +138,7 @@ public class XPackPlugin extends Plugin {
|
||||
public Collection<Module> nodeModules() {
|
||||
ArrayList<Module> modules = new ArrayList<>();
|
||||
modules.add(new LazyInitializationModule());
|
||||
modules.add(new ClockModule());
|
||||
modules.addAll(notification.nodeModules());
|
||||
modules.addAll(licensing.nodeModules());
|
||||
modules.addAll(security.nodeModules());
|
||||
|
@ -7,7 +7,7 @@ package org.elasticsearch.xpack.scheduler;
|
||||
|
||||
import org.elasticsearch.common.util.concurrent.EsExecutors;
|
||||
import org.elasticsearch.common.util.concurrent.FutureUtils;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.support.clock.Clock;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
|
@ -3,7 +3,7 @@
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
package org.elasticsearch.xpack.watcher.support.clock;
|
||||
package org.elasticsearch.xpack.support.clock;
|
||||
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.joda.time.DateTime;
|
@ -3,7 +3,7 @@
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
package org.elasticsearch.xpack.watcher.support.clock;
|
||||
package org.elasticsearch.xpack.support.clock;
|
||||
|
||||
import org.elasticsearch.common.inject.AbstractModule;
|
||||
|
@ -3,7 +3,7 @@
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
package org.elasticsearch.xpack.watcher.support.clock;
|
||||
package org.elasticsearch.xpack.support.clock;
|
||||
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.joda.time.DateTime;
|
@ -3,7 +3,7 @@
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
package org.elasticsearch.xpack.watcher.support.clock;
|
||||
package org.elasticsearch.xpack.support.clock;
|
||||
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.joda.time.DateTime;
|
@ -5,13 +5,43 @@
|
||||
*/
|
||||
package org.elasticsearch.xpack;
|
||||
|
||||
import org.elasticsearch.common.inject.Module;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.xpack.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.support.clock.ClockMock;
|
||||
import org.elasticsearch.xpack.support.clock.ClockModule;
|
||||
import org.elasticsearch.xpack.watcher.test.TimeWarpedWatcher;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class TimeWarpedXPackPlugin extends XPackPlugin {
|
||||
|
||||
public TimeWarpedXPackPlugin(Settings settings) {
|
||||
super(settings);
|
||||
watcher = new TimeWarpedWatcher(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Module> nodeModules() {
|
||||
List<Module> modules = new ArrayList<>(super.nodeModules());
|
||||
for (int i = 0; i < modules.size(); ++i) {
|
||||
Module module = modules.get(i);
|
||||
if (module instanceof ClockModule) {
|
||||
// replacing the clock module so we'll be able
|
||||
// to control time in tests
|
||||
modules.set(i, new MockClockModule());
|
||||
}
|
||||
}
|
||||
return modules;
|
||||
}
|
||||
|
||||
public static class MockClockModule extends ClockModule {
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(ClockMock.class).asEagerSingleton();
|
||||
bind(Clock.class).to(ClockMock.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
package org.elasticsearch.xpack.watcher.support.clock;
|
||||
package org.elasticsearch.xpack.support.clock;
|
||||
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.joda.time.DateTime;
|
@ -3,7 +3,7 @@
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
package org.elasticsearch.xpack.watcher.support.clock;
|
||||
package org.elasticsearch.xpack.support.clock;
|
||||
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
|
@ -43,7 +43,6 @@ import org.elasticsearch.xpack.watcher.rest.action.RestWatcherStatsAction;
|
||||
import org.elasticsearch.xpack.common.ScriptServiceProxy;
|
||||
import org.elasticsearch.xpack.watcher.support.WatcherIndexTemplateRegistry;
|
||||
import org.elasticsearch.xpack.watcher.support.WatcherIndexTemplateRegistry.TemplateConfig;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.ClockModule;
|
||||
import org.elasticsearch.xpack.watcher.support.init.proxy.WatcherClientProxy;
|
||||
import org.elasticsearch.xpack.watcher.support.validation.WatcherSettingsValidation;
|
||||
import org.elasticsearch.xpack.watcher.transform.TransformModule;
|
||||
@ -110,7 +109,6 @@ public class Watcher {
|
||||
modules.add(new WatcherModule(enabled, transportClient));
|
||||
if (enabled && transportClient == false) {
|
||||
modules.add(new WatchModule());
|
||||
modules.add(new ClockModule());
|
||||
modules.add(new WatcherClientModule());
|
||||
modules.add(new TransformModule());
|
||||
modules.add(new TriggerModule(settings));
|
||||
|
@ -17,7 +17,7 @@ import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.index.engine.VersionConflictEngineException;
|
||||
import org.elasticsearch.xpack.watcher.execution.ExecutionService;
|
||||
import org.elasticsearch.xpack.watcher.support.WatcherIndexTemplateRegistry;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.watcher.trigger.TriggerService;
|
||||
import org.elasticsearch.xpack.watcher.watch.Watch;
|
||||
import org.elasticsearch.xpack.watcher.watch.WatchLockService;
|
||||
|
@ -9,7 +9,7 @@ import org.elasticsearch.ElasticsearchParseException;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.xpack.watcher.WatcherLicensee;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.watcher.support.validation.Validation;
|
||||
import org.elasticsearch.xpack.watcher.transform.TransformRegistry;
|
||||
|
||||
|
@ -19,7 +19,7 @@ import org.elasticsearch.xpack.watcher.actions.throttler.Throttler;
|
||||
import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext;
|
||||
import org.elasticsearch.xpack.watcher.WatcherLicensee;
|
||||
import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.watcher.transform.ExecutableTransform;
|
||||
import org.elasticsearch.xpack.watcher.transform.Transform;
|
||||
import org.elasticsearch.xpack.watcher.transform.TransformRegistry;
|
||||
|
@ -9,7 +9,7 @@ import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext;
|
||||
import org.elasticsearch.xpack.watcher.WatcherLicensee;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.support.clock.Clock;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -9,7 +9,7 @@ import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.xpack.watcher.actions.ActionStatus;
|
||||
import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.support.clock.Clock;
|
||||
import org.joda.time.PeriodType;
|
||||
|
||||
/**
|
||||
|
@ -11,7 +11,7 @@ import org.elasticsearch.xpack.watcher.condition.ExecutableCondition;
|
||||
import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext;
|
||||
import org.elasticsearch.xpack.watcher.support.Variables;
|
||||
import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.watcher.support.xcontent.ObjectPath;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.DateTimeZone;
|
||||
|
@ -10,7 +10,7 @@ import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.xpack.watcher.condition.ConditionFactory;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.support.clock.Clock;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
package org.elasticsearch.xpack.watcher.condition.compare;
|
||||
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.watcher.support.xcontent.ObjectPath;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -10,7 +10,7 @@ import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.xpack.watcher.condition.ConditionFactory;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.support.clock.Clock;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -7,7 +7,7 @@ package org.elasticsearch.xpack.watcher.condition.compare.array;
|
||||
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.xpack.watcher.condition.compare.AbstractExecutableCompareCondition;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.watcher.support.xcontent.ObjectPath;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -18,7 +18,7 @@ import org.elasticsearch.xpack.watcher.condition.Condition;
|
||||
import org.elasticsearch.xpack.watcher.history.HistoryStore;
|
||||
import org.elasticsearch.xpack.watcher.history.WatchRecord;
|
||||
import org.elasticsearch.xpack.watcher.input.Input;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.watcher.support.validation.WatcherSettingsValidation;
|
||||
import org.elasticsearch.xpack.watcher.transform.Transform;
|
||||
import org.elasticsearch.xpack.watcher.trigger.TriggerEvent;
|
||||
|
@ -14,7 +14,7 @@ import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.index.mapper.core.DateFieldMapper;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.support.clock.Clock;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.DateTimeZone;
|
||||
|
||||
|
@ -15,8 +15,8 @@ import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.xcontent.XContentLocation;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.common.secret.Secret;
|
||||
import org.elasticsearch.xpack.common.secret.SecretService;
|
||||
|
||||
|
@ -27,7 +27,7 @@ import org.elasticsearch.xpack.watcher.execution.ManualExecutionContext;
|
||||
import org.elasticsearch.xpack.watcher.history.WatchRecord;
|
||||
import org.elasticsearch.xpack.watcher.input.simple.SimpleInput;
|
||||
import org.elasticsearch.xpack.watcher.WatcherLicensee;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.watcher.support.xcontent.WatcherParams;
|
||||
import org.elasticsearch.xpack.watcher.transport.actions.WatcherTransportAction;
|
||||
import org.elasticsearch.xpack.watcher.trigger.TriggerEvent;
|
||||
|
@ -9,7 +9,7 @@ import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.watcher.trigger.AbstractTriggerEngine;
|
||||
import org.elasticsearch.xpack.watcher.trigger.TriggerService;
|
||||
import org.joda.time.DateTime;
|
||||
|
@ -11,7 +11,7 @@ import org.elasticsearch.common.ParseFieldMatcher;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.watcher.trigger.TriggerEvent;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.DateTimeZone;
|
||||
|
@ -8,7 +8,7 @@ package org.elasticsearch.xpack.watcher.trigger.schedule.engine;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.xpack.scheduler.SchedulerEngine;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.watcher.trigger.TriggerEvent;
|
||||
import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleRegistry;
|
||||
import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTrigger;
|
||||
|
@ -8,7 +8,7 @@ package org.elasticsearch.xpack.watcher.trigger.schedule.engine;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.watcher.trigger.TriggerEvent;
|
||||
import org.elasticsearch.xpack.watcher.trigger.schedule.Schedule;
|
||||
import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleRegistry;
|
||||
|
@ -13,7 +13,6 @@ import org.elasticsearch.common.bytes.BytesReference;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.lucene.uid.Versions;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
@ -32,8 +31,8 @@ import org.elasticsearch.xpack.watcher.input.ExecutableInput;
|
||||
import org.elasticsearch.xpack.watcher.input.InputRegistry;
|
||||
import org.elasticsearch.xpack.watcher.input.none.ExecutableNoneInput;
|
||||
import org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.HaltedClock;
|
||||
import org.elasticsearch.xpack.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.support.clock.HaltedClock;
|
||||
import org.elasticsearch.xpack.common.secret.SecretService;
|
||||
import org.elasticsearch.xpack.watcher.support.xcontent.WatcherParams;
|
||||
import org.elasticsearch.xpack.watcher.support.xcontent.WatcherXContentParser;
|
||||
|
@ -19,7 +19,7 @@ import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.xpack.watcher.actions.Action;
|
||||
import org.elasticsearch.xpack.watcher.actions.ActionStatus;
|
||||
import org.elasticsearch.xpack.watcher.actions.throttler.AckThrottler;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.watcher.support.xcontent.WatcherXContentParser;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.DateTimeZone;
|
||||
|
@ -16,8 +16,8 @@ import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.xpack.watcher.execution.ExecutionService;
|
||||
import org.elasticsearch.xpack.watcher.support.WatcherIndexTemplateRegistry;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.ClockMock;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.support.clock.ClockMock;
|
||||
import org.elasticsearch.xpack.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.watcher.trigger.Trigger;
|
||||
import org.elasticsearch.xpack.watcher.trigger.TriggerEngine;
|
||||
import org.elasticsearch.xpack.watcher.trigger.TriggerService;
|
||||
|
@ -8,7 +8,7 @@ package org.elasticsearch.xpack.watcher.actions.throttler;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.xpack.watcher.actions.ActionStatus;
|
||||
import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.watcher.watch.Watch;
|
||||
import org.elasticsearch.xpack.watcher.watch.WatchStatus;
|
||||
import org.joda.time.DateTime;
|
||||
|
@ -18,7 +18,7 @@ import org.elasticsearch.xpack.watcher.execution.ActionExecutionMode;
|
||||
import org.elasticsearch.xpack.watcher.execution.ExecutionState;
|
||||
import org.elasticsearch.xpack.watcher.execution.ManualExecutionContext;
|
||||
import org.elasticsearch.xpack.watcher.history.WatchRecord;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.common.http.HttpRequestTemplate;
|
||||
import org.elasticsearch.xpack.common.text.TextTemplate;
|
||||
import org.elasticsearch.xpack.watcher.support.xcontent.ObjectPath;
|
||||
|
@ -9,7 +9,7 @@ import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.xpack.watcher.actions.ActionStatus;
|
||||
import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.watcher.watch.WatchStatus;
|
||||
import org.joda.time.PeriodType;
|
||||
|
||||
|
@ -17,7 +17,7 @@ import org.elasticsearch.search.internal.InternalSearchHit;
|
||||
import org.elasticsearch.search.internal.InternalSearchHits;
|
||||
import org.elasticsearch.search.internal.InternalSearchResponse;
|
||||
import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase;
|
||||
import org.elasticsearch.xpack.watcher.watch.Payload;
|
||||
|
||||
|
@ -13,8 +13,8 @@ import org.elasticsearch.common.xcontent.json.JsonXContent;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.xpack.watcher.condition.compare.CompareCondition.Op;
|
||||
import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.ClockMock;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.support.clock.ClockMock;
|
||||
import org.elasticsearch.xpack.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.watcher.watch.Payload;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
|
@ -9,7 +9,7 @@ import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilders;
|
||||
import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase;
|
||||
import org.elasticsearch.xpack.watcher.watch.Payload;
|
||||
|
||||
|
@ -12,8 +12,8 @@ import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.common.xcontent.json.JsonXContent;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.xpack.watcher.execution.WatchExecutionContext;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.ClockMock;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.support.clock.ClockMock;
|
||||
import org.elasticsearch.xpack.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.watcher.watch.Payload;
|
||||
import org.junit.Rule;
|
||||
import org.junit.rules.ExpectedException;
|
||||
|
@ -23,8 +23,8 @@ import org.elasticsearch.xpack.watcher.history.HistoryStore;
|
||||
import org.elasticsearch.xpack.watcher.history.WatchRecord;
|
||||
import org.elasticsearch.xpack.watcher.input.ExecutableInput;
|
||||
import org.elasticsearch.xpack.watcher.input.Input;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.ClockMock;
|
||||
import org.elasticsearch.xpack.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.support.clock.ClockMock;
|
||||
import org.elasticsearch.xpack.watcher.support.validation.WatcherSettingsValidation;
|
||||
import org.elasticsearch.xpack.watcher.transform.ExecutableTransform;
|
||||
import org.elasticsearch.xpack.watcher.transform.Transform;
|
||||
|
@ -17,7 +17,7 @@ import org.elasticsearch.xpack.watcher.condition.always.AlwaysCondition;
|
||||
import org.elasticsearch.xpack.watcher.history.HistoryStore;
|
||||
import org.elasticsearch.xpack.watcher.history.WatchRecord;
|
||||
import org.elasticsearch.xpack.watcher.input.simple.SimpleInput;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.watcher.support.xcontent.ObjectPath;
|
||||
import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase;
|
||||
import org.elasticsearch.xpack.watcher.transport.actions.execute.ExecuteWatchRequest;
|
||||
|
@ -45,7 +45,7 @@ import org.elasticsearch.script.Template;
|
||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.xpack.watcher.input.search.ExecutableSearchInput;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.common.text.TextTemplate;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
|
@ -48,7 +48,7 @@ import org.elasticsearch.xpack.watcher.execution.ExecutionState;
|
||||
import org.elasticsearch.xpack.watcher.history.HistoryStore;
|
||||
import org.elasticsearch.xpack.watcher.WatcherLicensee;
|
||||
import org.elasticsearch.xpack.watcher.support.WatcherIndexTemplateRegistry;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.ClockMock;
|
||||
import org.elasticsearch.xpack.support.clock.ClockMock;
|
||||
import org.elasticsearch.xpack.common.http.HttpClient;
|
||||
import org.elasticsearch.xpack.common.ScriptServiceProxy;
|
||||
import org.elasticsearch.xpack.watcher.support.xcontent.XContentSource;
|
||||
|
@ -12,9 +12,6 @@ import org.elasticsearch.xpack.watcher.Watcher;
|
||||
import org.elasticsearch.xpack.watcher.execution.ExecutionModule;
|
||||
import org.elasticsearch.xpack.watcher.execution.SyncTriggerListener;
|
||||
import org.elasticsearch.xpack.watcher.execution.WatchExecutor;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.ClockMock;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.ClockModule;
|
||||
import org.elasticsearch.xpack.watcher.trigger.ScheduleTriggerEngineMock;
|
||||
import org.elasticsearch.xpack.watcher.trigger.TriggerModule;
|
||||
import org.elasticsearch.xpack.watcher.trigger.manual.ManualTriggerEngine;
|
||||
@ -49,10 +46,6 @@ public class TimeWarpedWatcher extends Watcher {
|
||||
// replacing scheduler module so we'll
|
||||
// have control on when it fires a job
|
||||
modules.set(i, new MockTriggerModule(settings));
|
||||
} else if (module instanceof ClockModule) {
|
||||
// replacing the clock module so we'll be able
|
||||
// to control time in tests
|
||||
modules.set(i, new MockClockModule());
|
||||
} else if (module instanceof ExecutionModule) {
|
||||
// replacing the execution module so all the watches will be
|
||||
// executed on the same thread as the trigger engine
|
||||
@ -76,14 +69,6 @@ public class TimeWarpedWatcher extends Watcher {
|
||||
}
|
||||
}
|
||||
|
||||
public static class MockClockModule extends ClockModule {
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(ClockMock.class).asEagerSingleton();
|
||||
bind(Clock.class).to(ClockMock.class);
|
||||
}
|
||||
}
|
||||
|
||||
public static class MockExecutionModule extends ExecutionModule {
|
||||
|
||||
public MockExecutionModule() {
|
||||
|
@ -9,7 +9,7 @@ import org.elasticsearch.common.Randomness;
|
||||
import org.elasticsearch.common.SuppressForbidden;
|
||||
import org.elasticsearch.common.metrics.MeanMetric;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.watcher.trigger.Trigger;
|
||||
import org.elasticsearch.xpack.watcher.trigger.TriggerEngine;
|
||||
import org.elasticsearch.xpack.watcher.trigger.TriggerEvent;
|
||||
|
@ -34,7 +34,7 @@ import org.elasticsearch.xpack.watcher.actions.logging.LoggingLevel;
|
||||
import org.elasticsearch.xpack.watcher.client.WatchSourceBuilder;
|
||||
import org.elasticsearch.xpack.watcher.client.WatcherClient;
|
||||
import org.elasticsearch.xpack.watcher.history.HistoryStore;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.watcher.watch.WatchStore;
|
||||
import org.elasticsearch.xpack.XPackPlugin;
|
||||
|
||||
|
@ -20,7 +20,7 @@ import org.elasticsearch.xpack.watcher.client.WatchSourceBuilder;
|
||||
import org.elasticsearch.xpack.watcher.client.WatcherClient;
|
||||
import org.elasticsearch.xpack.watcher.condition.compare.CompareCondition;
|
||||
import org.elasticsearch.xpack.watcher.support.WatcherUtils;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.watcher.support.xcontent.XContentSource;
|
||||
import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase;
|
||||
import org.elasticsearch.xpack.watcher.transport.actions.delete.DeleteWatchResponse;
|
||||
|
@ -11,8 +11,8 @@ 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.watcher.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.ClockMock;
|
||||
import org.elasticsearch.xpack.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.support.clock.ClockMock;
|
||||
import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleRegistry;
|
||||
import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTrigger;
|
||||
import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTriggerEngine;
|
||||
|
@ -11,7 +11,7 @@ import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.common.xcontent.json.JsonXContent;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.support.clock.SystemClock;
|
||||
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
package org.elasticsearch.xpack.watcher.trigger.schedule.engine;
|
||||
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.watcher.trigger.Trigger;
|
||||
import org.elasticsearch.xpack.watcher.trigger.TriggerEngine;
|
||||
import org.elasticsearch.xpack.watcher.trigger.TriggerEvent;
|
||||
|
@ -7,7 +7,7 @@ package org.elasticsearch.xpack.watcher.trigger.schedule.engine;
|
||||
|
||||
import org.apache.lucene.util.LuceneTestCase.BadApple;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.watcher.trigger.TriggerEngine;
|
||||
import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleRegistry;
|
||||
|
||||
|
@ -7,7 +7,7 @@ package org.elasticsearch.xpack.watcher.trigger.schedule.engine;
|
||||
|
||||
import org.apache.lucene.util.LuceneTestCase.BadApple;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.watcher.trigger.TriggerEngine;
|
||||
import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleRegistry;
|
||||
|
||||
|
@ -71,9 +71,9 @@ import org.elasticsearch.xpack.watcher.input.simple.SimpleInputFactory;
|
||||
import org.elasticsearch.xpack.watcher.WatcherLicensee;
|
||||
import org.elasticsearch.xpack.watcher.support.Script;
|
||||
import org.elasticsearch.xpack.watcher.support.WatcherUtils;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.ClockMock;
|
||||
import org.elasticsearch.xpack.watcher.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.support.clock.Clock;
|
||||
import org.elasticsearch.xpack.support.clock.ClockMock;
|
||||
import org.elasticsearch.xpack.support.clock.SystemClock;
|
||||
import org.elasticsearch.xpack.common.http.HttpClient;
|
||||
import org.elasticsearch.xpack.common.http.HttpMethod;
|
||||
import org.elasticsearch.xpack.common.http.HttpRequestTemplate;
|
||||
|
Loading…
x
Reference in New Issue
Block a user