[WIP] unified x-pack repo restructuring

- added the license-plugin dir as a src dir

- Made XPackPlugin customizable for tests. Now tests that need to plug in different behaviours (e.g. a custom license plugin) can do that by simply resetting the relevant delegee plugins (i.e. shield, marvel, license, watcher) in the ctor of a new XPackPlugin.

Original commit: elastic/x-pack-elasticsearch@ab83104955
This commit is contained in:
uboness 2015-11-26 17:05:19 +01:00
parent 7ef87632ab
commit 13a8c98cb2
20 changed files with 173 additions and 95 deletions

View File

@ -44,7 +44,7 @@ dependencies {
// we keep the source directories in the original structure of split plugins,
// in order to facilitate backports to 2.x. TODO: remove after 5.0 release
for (String module : ['', 'license/', 'shield/', 'watcher/', 'marvel/']) {
for (String module : ['', 'license-plugin/', 'shield/', 'watcher/', 'marvel/']) {
sourceSets {
main {
java.srcDir("${module}src/main/java")
@ -77,8 +77,13 @@ processResources {
}
processTestResources {
inputs.properties(expansions)
MavenFilteringHack.filter(it, expansions)
from(sourceSets.test.resources.srcDirs) {
exclude '**/*.key'
exclude '**/*.jks'
exclude '**/*.p12'
inputs.properties(expansions)
MavenFilteringHack.filter(it, expansions)
}
}
forbiddenPatterns {

View File

@ -14,6 +14,7 @@ import org.elasticsearch.license.plugin.core.LicenseState;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
import org.elasticsearch.test.InternalTestCluster;
import org.elasticsearch.xpack.XPackPlugin;
import org.junit.After;
import java.util.ArrayList;

View File

@ -23,6 +23,7 @@ import org.elasticsearch.license.plugin.core.*;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.InternalTestCluster;
import org.elasticsearch.xpack.XPackPlugin;
import java.util.ArrayList;
import java.util.Collection;
@ -39,7 +40,11 @@ public abstract class AbstractLicensesIntegrationTestCase extends ESIntegTestCas
@Override
protected Settings nodeSettings(int nodeOrdinal) {
return Settings.EMPTY;
return Settings.builder()
.put("shield.enabled", false)
.put("marvel.enabled", false)
.put("watcher.enabled", false)
.build();
}
@Override

View File

@ -16,6 +16,7 @@ import org.elasticsearch.license.plugin.consumer.LazyLicenseRegistrationPluginSe
import org.elasticsearch.license.plugin.core.LicenseState;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
import org.elasticsearch.xpack.XPackPlugin;
import org.junit.After;
import java.util.Arrays;

View File

@ -15,6 +15,7 @@ import org.elasticsearch.license.plugin.consumer.LazyLicenseRegistrationPluginSe
import org.elasticsearch.license.plugin.core.LicenseState;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
import org.elasticsearch.xpack.XPackPlugin;
import org.junit.After;
import java.util.Arrays;
@ -26,6 +27,7 @@ import static org.elasticsearch.test.ESIntegTestCase.Scope.TEST;
@BadApple(bugUrl = "https://github.com/elastic/x-plugins/issues/1007")
@ClusterScope(scope = TEST, numDataNodes = 0, numClientNodes = 0)
public class LicensesPluginsIntegrationTests extends AbstractLicensesIntegrationTestCase {
private static final String ID_1 = EagerLicenseRegistrationPluginService.ID;
private static final String ID_2 = LazyLicenseRegistrationPluginService.ID;

View File

@ -30,6 +30,7 @@ import org.elasticsearch.node.Node;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
import org.elasticsearch.test.InternalTestCluster;
import org.elasticsearch.xpack.XPackPlugin;
import java.util.Arrays;
import java.util.Collection;

View File

@ -12,6 +12,7 @@ import org.elasticsearch.license.plugin.core.LicenseState;
import org.elasticsearch.node.Node;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.xpack.XPackPlugin;
import java.util.Arrays;
import java.util.Collection;

View File

@ -7,14 +7,17 @@ package org.elasticsearch.marvel.agent.collector;
import com.carrotsearch.randomizedtesting.RandomizedTest;
import com.carrotsearch.randomizedtesting.SysGlobals;
import org.elasticsearch.action.ActionModule;
import org.elasticsearch.cluster.block.ClusterBlocks;
import org.elasticsearch.common.component.AbstractComponent;
import org.elasticsearch.common.component.LifecycleComponent;
import org.elasticsearch.common.inject.AbstractModule;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.inject.Module;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.license.core.License;
import org.elasticsearch.license.plugin.LicensePlugin;
import org.elasticsearch.license.plugin.core.LicenseState;
import org.elasticsearch.license.plugin.core.Licensee;
import org.elasticsearch.license.plugin.core.LicenseeRegistry;
@ -25,16 +28,13 @@ import org.elasticsearch.marvel.shield.SecuredClient;
import org.elasticsearch.marvel.test.MarvelIntegTestCase;
import org.elasticsearch.node.Node;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.rest.RestModule;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
import org.elasticsearch.xpack.XPackPlugin;
import org.junit.Before;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.*;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
@ -43,10 +43,7 @@ public class AbstractCollectorTestCase extends MarvelIntegTestCase {
@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
if (shieldEnabled) {
return Arrays.asList(LicensePluginForCollectors.class, XPackPlugin.class, XPackPlugin.class);
}
return Arrays.asList(LicensePluginForCollectors.class, XPackPlugin.class);
return Arrays.asList(InternalXPackPlugin.class);
}
@Override
@ -183,18 +180,10 @@ public class AbstractCollectorTestCase extends MarvelIntegTestCase {
}, 30L, TimeUnit.SECONDS);
}
public static class LicensePluginForCollectors extends Plugin {
public static class InternalLicensePlugin extends LicensePlugin {
public static final String NAME = "internal-test-licensing";
@Override
public String name() {
return NAME;
}
@Override
public String description() {
return name();
public InternalLicensePlugin() {
super(Settings.EMPTY);
}
@Override
@ -210,6 +199,27 @@ public class AbstractCollectorTestCase extends MarvelIntegTestCase {
}
});
}
@Override
public void onModule(RestModule module) {
}
@Override
public void onModule(ActionModule module) {
}
@Override
public Collection<Class<? extends LifecycleComponent>> nodeServices() {
return Collections.emptyList();
}
}
public static class InternalXPackPlugin extends XPackPlugin {
public InternalXPackPlugin(Settings settings) {
super(settings);
licensePlugin = new InternalLicensePlugin();
}
}
public static class LicenseServiceForCollectors extends AbstractComponent implements LicenseeRegistry {

View File

@ -5,16 +5,22 @@
*/
package org.elasticsearch.marvel.license;
import org.elasticsearch.action.ActionModule;
import org.elasticsearch.common.component.AbstractComponent;
import org.elasticsearch.common.component.LifecycleComponent;
import org.elasticsearch.common.inject.AbstractModule;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.inject.Module;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.IndexModule;
import org.elasticsearch.index.IndexService;
import org.elasticsearch.license.core.License;
import org.elasticsearch.license.plugin.LicensePlugin;
import org.elasticsearch.license.plugin.core.LicenseState;
import org.elasticsearch.license.plugin.core.Licensee;
import org.elasticsearch.license.plugin.core.LicenseeRegistry;
import org.elasticsearch.license.plugin.core.LicensesManagerService;
import org.elasticsearch.rest.RestModule;
import org.elasticsearch.xpack.XPackPlugin;
import org.elasticsearch.marvel.test.MarvelIntegTestCase;
import org.elasticsearch.plugins.Plugin;
@ -36,7 +42,7 @@ import static org.hamcrest.Matchers.isOneOf;
public class LicenseIntegrationTests extends MarvelIntegTestCase {
@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
return Arrays.asList(MockLicensePlugin.class, XPackPlugin.class);
return Arrays.asList(InternalXPackPlugin.class);
}
@Override
@ -77,13 +83,10 @@ public class LicenseIntegrationTests extends MarvelIntegTestCase {
}
}
public static class MockLicensePlugin extends Plugin {
public static class MockLicensePlugin extends LicensePlugin {
public static final String NAME = "internal-test-licensing";
@Override
public String name() {
return NAME;
public MockLicensePlugin() {
super(Settings.EMPTY);
}
@Override
@ -95,6 +98,20 @@ public class LicenseIntegrationTests extends MarvelIntegTestCase {
public Collection<Module> nodeModules() {
return Collections.<Module>singletonList(new InternalLicenseModule());
}
@Override
public void onModule(RestModule module) {
}
@Override
public void onModule(ActionModule module) {
}
@Override
public Collection<Class<? extends LifecycleComponent>> nodeServices() {
return Collections.emptyList();
}
}
public static class InternalLicenseModule extends AbstractModule {
@ -148,4 +165,11 @@ public class LicenseIntegrationTests extends MarvelIntegTestCase {
return null;
}
}
public static class InternalXPackPlugin extends XPackPlugin {
public InternalXPackPlugin(Settings settings) {
super(settings);
licensePlugin = new MockLicensePlugin();
}
}
}

View File

@ -18,20 +18,18 @@ import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.CountDown;
import org.elasticsearch.index.IndexModule;
import org.elasticsearch.index.IndexNotFoundException;
import org.elasticsearch.shield.ShieldPlugin;
import org.elasticsearch.xpack.XPackPlugin;
import org.elasticsearch.xpack.XPackPlugin;
import org.elasticsearch.marvel.agent.AgentService;
import org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils;
import org.elasticsearch.marvel.agent.settings.MarvelSettings;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.xpack.XPackPlugin;
import org.elasticsearch.shield.ShieldPlugin;
import org.elasticsearch.shield.authc.esusers.ESUsersRealm;
import org.elasticsearch.shield.authc.support.Hasher;
import org.elasticsearch.shield.authc.support.SecuredString;
import org.elasticsearch.shield.crypto.InternalCryptoService;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.TestCluster;
import org.elasticsearch.xpack.XPackPlugin;
import org.hamcrest.Matcher;
import org.jboss.netty.util.internal.SystemPropertyUtil;
@ -72,6 +70,10 @@ public abstract class MarvelIntegTestCase extends ESIntegTestCase {
protected Settings nodeSettings(int nodeOrdinal) {
Settings.Builder builder = Settings.builder()
.put(super.nodeSettings(nodeOrdinal))
//TODO: for now lets isolate marvel tests from watcher (randomize this later)
.put("watcher.enabled", false)
// we do this by default in core, but for marvel this isn't needed and only adds noise.
.put("index.store.mock.check_index_on_close", false);

View File

@ -6,6 +6,7 @@
package org.elasticsearch.integration;
import org.elasticsearch.ElasticsearchSecurityException;
import org.elasticsearch.action.ActionModule;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
import org.elasticsearch.action.admin.cluster.stats.ClusterStatsIndices;
@ -17,37 +18,35 @@ import org.elasticsearch.client.support.Headers;
import org.elasticsearch.client.transport.NoNodeAvailableException;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.component.AbstractComponent;
import org.elasticsearch.common.component.LifecycleComponent;
import org.elasticsearch.common.inject.AbstractModule;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.inject.Module;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.license.core.License;
import org.elasticsearch.license.core.License.OperationMode;
import org.elasticsearch.license.plugin.LicensePlugin;
import org.elasticsearch.license.plugin.core.LicenseState;
import org.elasticsearch.license.plugin.core.Licensee;
import org.elasticsearch.license.plugin.core.LicenseeRegistry;
import org.elasticsearch.node.Node;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.rest.RestModule;
import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.shield.ShieldPlugin;
import org.elasticsearch.xpack.XPackPlugin;
import org.elasticsearch.shield.authc.support.UsernamePasswordToken;
import org.elasticsearch.test.ShieldIntegTestCase;
import org.elasticsearch.test.ShieldSettingsSource;
import org.elasticsearch.transport.Transport;
import org.elasticsearch.xpack.XPackPlugin;
import org.junit.After;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.*;
/**
*
@ -102,6 +101,11 @@ public class LicensingTests extends ShieldIntegTestCase {
.build();
}
@Override
protected Class<? extends XPackPlugin> xpackPluginClass() {
return InternalXPackPlugin.class;
}
@After
public void resetLicensing() {
enableLicensing();
@ -237,24 +241,37 @@ public class LicensingTests extends ShieldIntegTestCase {
}
}
public static class InternalLicensePlugin extends Plugin {
public static final String NAME = "internal-licensing";
@Override
public String name() {
return NAME;
}
@Override
public String description() {
return name();
}
public static class InternalLicensePlugin extends LicensePlugin {
@Override
public Collection<Module> nodeModules() {
return Collections.<Module>singletonList(new InternalLicenseModule());
}
public InternalLicensePlugin() {
super(Settings.EMPTY);
}
@Override
public void onModule(RestModule module) {
}
@Override
public void onModule(ActionModule module) {
}
@Override
public Collection<Class<? extends LifecycleComponent>> nodeServices() {
return Collections.emptyList();
}
}
public static class InternalXPackPlugin extends XPackPlugin {
public InternalXPackPlugin(Settings settings) {
super(settings);
licensePlugin = new InternalLicensePlugin();
}
}
public static class InternalLicenseModule extends AbstractModule {

View File

@ -25,9 +25,7 @@ import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.threadpool.ThreadPoolModule;
import org.elasticsearch.transport.TransportMessage;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.*;
/**
* Unit tests for the AuthenticationModule

View File

@ -46,6 +46,7 @@ import static org.hamcrest.Matchers.is;
*/
@ClusterScope(numClientNodes = 0, numDataNodes = 1)
public class PkiAuthenticationTests extends ShieldIntegTestCase {
@Override
protected Settings nodeSettings(int nodeOrdinal) {
return Settings.builder()

View File

@ -23,6 +23,7 @@ import static org.hamcrest.Matchers.is;
@ClusterScope(scope = TEST, numDataNodes = 1)
public class IpFilteringUpdateTests extends ShieldIntegTestCase {
private static int randomClientPort;
private final boolean httpEnabled = randomBoolean();

View File

@ -28,6 +28,7 @@ import static org.hamcrest.Matchers.is;
import static org.mockito.Mockito.mock;
public class ShieldNettyHttpServerTransportTests extends ESTestCase {
private ServerSSLService serverSSLService;
@Before

View File

@ -6,16 +6,15 @@
package org.elasticsearch.test;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.cluster.health.ClusterHealthStatus;
import org.elasticsearch.action.admin.cluster.node.info.NodeInfo;
import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.health.ClusterHealthStatus;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.shield.ShieldPlugin;
import org.elasticsearch.xpack.XPackPlugin;
import org.elasticsearch.shield.authc.support.SecuredString;
import org.elasticsearch.test.ESIntegTestCase.SuppressLocalMode;
import org.elasticsearch.xpack.XPackPlugin;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
@ -23,7 +22,7 @@ import org.junit.Rule;
import org.junit.rules.ExternalResource;
import java.nio.file.Path;
import java.util.*;
import java.util.Collection;
import java.util.stream.Collectors;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoTimeout;
@ -128,7 +127,7 @@ public abstract class ShieldIntegTestCase extends ESIntegTestCase {
// TODO: disable this assertion for now, because the test framework randomly runs with mock plugins. Maybe we should run without mock plugins?
// assertThat(nodeInfo.getPlugins().getInfos(), hasSize(2));
Collection<String> pluginNames = nodeInfo.getPlugins().getInfos().stream().map(p -> p.getName()).collect(Collectors.toList());
assertThat("plugin [" + ShieldPlugin.NAME + "] not found in [" + pluginNames + "]", pluginNames.contains(ShieldPlugin.NAME), is(true));
assertThat("plugin [" + XPackPlugin.NAME + "] not found in [" + pluginNames + "]", pluginNames.contains(XPackPlugin.NAME), is(true));
}
}
@ -235,6 +234,10 @@ public abstract class ShieldIntegTestCase extends ESIntegTestCase {
return randomBoolean();
}
protected Class<? extends XPackPlugin> xpackPluginClass() {
return SHIELD_DEFAULT_SETTINGS.xpackPluginClass();
}
private class CustomShieldSettingsSource extends ShieldSettingsSource {
private CustomShieldSettingsSource(boolean sslTransportEnabled, Path configDir, Scope scope) {
super(maxNumberOfNodes(), sslTransportEnabled, configDir, scope);
@ -275,6 +278,10 @@ public abstract class ShieldIntegTestCase extends ESIntegTestCase {
return ShieldIntegTestCase.this.transportClientPassword();
}
@Override
protected Class<? extends XPackPlugin> xpackPluginClass() {
return ShieldIntegTestCase.this.xpackPluginClass();
}
}
protected void assertGreenClusterState(Client client) {

View File

@ -116,6 +116,11 @@ public class ShieldSettingsSource extends ClusterDiscoveryConfiguration.UnicastZ
public Settings nodeSettings(int nodeOrdinal) {
Path folder = ShieldTestUtils.createFolder(parentFolder, subfolderPrefix + "-" + nodeOrdinal);
Settings.Builder builder = settingsBuilder().put(super.nodeSettings(nodeOrdinal))
//TODO: for now isolate shield tests from watcher & marvel (randomize this later)
.put("watcher.enabled", false)
.put("marvel.enabled", false)
.put("shield.audit.enabled", randomBoolean())
.put(InternalCryptoService.FILE_SETTING, writeFile(folder, "system_key", systemKey))
.put("shield.authc.realms.esusers.type", ESUsersRealm.TYPE)
@ -143,12 +148,12 @@ public class ShieldSettingsSource extends ClusterDiscoveryConfiguration.UnicastZ
@Override
public Collection<Class<? extends Plugin>> nodePlugins() {
return Arrays.asList(XPackPlugin.class);
return Arrays.asList(xpackPluginClass());
}
@Override
public Collection<Class<? extends Plugin>> transportClientPlugins() {
return Collections.<Class<? extends Plugin>>singletonList(XPackPlugin.class);
return Collections.<Class<? extends Plugin>>singletonList(xpackPluginClass());
}
protected String configUsers() {
@ -183,6 +188,10 @@ public class ShieldSettingsSource extends ClusterDiscoveryConfiguration.UnicastZ
return systemKey;
}
protected Class<? extends XPackPlugin> xpackPluginClass() {
return XPackPlugin.class;
}
private void setUser(Settings.Builder builder, String username, SecuredString password) {
if (randomBoolean()) {
builder.put(Headers.PREFIX + "." + UsernamePasswordToken.BASIC_AUTH_HEADER, basicAuthHeaderValue(username, password));

View File

@ -14,6 +14,7 @@ import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.IndexModule;
import org.elasticsearch.index.IndexService;
import org.elasticsearch.license.plugin.LicensePlugin;
import org.elasticsearch.marvel.MarvelPlugin;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.rest.RestModule;
@ -27,17 +28,19 @@ import java.util.Collection;
public class XPackPlugin extends Plugin {
public static final String NAME = "xpack";
public static final String NAME = "x-pack";
private final static ESLogger logger = Loggers.getLogger(XPackPlugin.class);
protected final Settings settings;
protected final ShieldPlugin shieldPlugin;
protected final MarvelPlugin marvelPlugin;
protected LicensePlugin licensePlugin;
protected ShieldPlugin shieldPlugin;
protected MarvelPlugin marvelPlugin;
protected WatcherPlugin watcherPlugin;
public XPackPlugin(Settings settings) {
this.settings = settings;
this.licensePlugin = new LicensePlugin(settings);
this.shieldPlugin = new ShieldPlugin(settings);
this.marvelPlugin = new MarvelPlugin(settings);
this.watcherPlugin = new WatcherPlugin(settings);
@ -54,6 +57,7 @@ public class XPackPlugin extends Plugin {
@Override
public Collection<Module> nodeModules() {
ArrayList<Module> modules = new ArrayList<>();
modules.addAll(licensePlugin.nodeModules());
modules.addAll(shieldPlugin.nodeModules());
modules.addAll(watcherPlugin.nodeModules());
modules.addAll(marvelPlugin.nodeModules());
@ -63,6 +67,7 @@ public class XPackPlugin extends Plugin {
@Override
public Collection<Class<? extends LifecycleComponent>> nodeServices() {
ArrayList<Class<? extends LifecycleComponent>> services = new ArrayList<>();
services.addAll(licensePlugin.nodeServices());
services.addAll(shieldPlugin.nodeServices());
services.addAll(watcherPlugin.nodeServices());
services.addAll(marvelPlugin.nodeServices());
@ -72,6 +77,7 @@ public class XPackPlugin extends Plugin {
@Override
public Settings additionalSettings() {
Settings.Builder builder = Settings.builder();
builder.put(licensePlugin.additionalSettings());
builder.put(shieldPlugin.additionalSettings());
builder.put(watcherPlugin.additionalSettings());
builder.put(marvelPlugin.additionalSettings());
@ -89,11 +95,13 @@ public class XPackPlugin extends Plugin {
}
public void onModule(RestModule module) {
licensePlugin.onModule(module);
shieldPlugin.onModule(module);
watcherPlugin.onModule(module);
}
public void onModule(ActionModule module) {
licensePlugin.onModule(module);
shieldPlugin.onModule(module);
watcherPlugin.onModule(module);
}

View File

@ -19,6 +19,7 @@ import java.util.List;
import static org.hamcrest.Matchers.is;
public class LicenseTests extends ESTestCase {
private SimpleLicenseeRegistry licenseeRegistry = new SimpleLicenseeRegistry();
public void testPlatinumGoldTrialLicenseCanDoEverything() throws Exception {

View File

@ -20,13 +20,10 @@ import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.common.xcontent.support.XContentMapValues;
import org.elasticsearch.index.IndexModule;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.shield.ShieldPlugin;
import org.elasticsearch.xpack.TimeWarpedXPackPlugin;
import org.elasticsearch.xpack.XPackPlugin;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.xpack.XPackPlugin;
import org.elasticsearch.shield.ShieldPlugin;
import org.elasticsearch.shield.authc.esusers.ESUsersRealm;
import org.elasticsearch.shield.authc.support.Hasher;
import org.elasticsearch.shield.authc.support.SecuredString;
@ -36,7 +33,6 @@ import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
import org.elasticsearch.test.TestCluster;
import org.elasticsearch.watcher.WatcherLifeCycleService;
import org.elasticsearch.watcher.WatcherModule;
import org.elasticsearch.xpack.XPackPlugin;
import org.elasticsearch.watcher.WatcherService;
import org.elasticsearch.watcher.WatcherState;
import org.elasticsearch.watcher.actions.email.service.Authentication;
@ -57,6 +53,8 @@ import org.elasticsearch.watcher.trigger.ScheduleTriggerEngineMock;
import org.elasticsearch.watcher.trigger.TriggerService;
import org.elasticsearch.watcher.trigger.schedule.ScheduleModule;
import org.elasticsearch.watcher.watch.Watch;
import org.elasticsearch.xpack.TimeWarpedXPackPlugin;
import org.elasticsearch.xpack.XPackPlugin;
import org.hamcrest.Matcher;
import org.jboss.netty.util.internal.SystemPropertyUtil;
import org.junit.After;
@ -69,25 +67,14 @@ import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import static org.elasticsearch.index.query.QueryBuilders.boolQuery;
import static org.elasticsearch.index.query.QueryBuilders.matchQuery;
import static org.elasticsearch.test.ESIntegTestCase.Scope.SUITE;
import static org.elasticsearch.watcher.WatcherModule.HISTORY_TEMPLATE_NAME;
import static org.elasticsearch.watcher.WatcherModule.TRIGGERED_TEMPLATE_NAME;
import static org.elasticsearch.watcher.WatcherModule.WATCHES_TEMPLATE_NAME;
import static org.hamcrest.Matchers.emptyArray;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.hamcrest.Matchers.notNullValue;
import static org.elasticsearch.watcher.WatcherModule.*;
import static org.hamcrest.Matchers.*;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNot.not;
@ -119,6 +106,10 @@ public abstract class AbstractWatcherIntegrationTestCase extends ESIntegTestCase
logger.info("using schedule engine [" + scheduleImplName + "]");
return Settings.builder()
.put(super.nodeSettings(nodeOrdinal))
//TODO: for now lets isolate watcher tests from marvel (randomize this later)
.put("marvel.enabled", false)
// we do this by default in core, but for watcher this isn't needed and only adds noise.
.put("index.store.mock.check_index_on_close", false)
.put("scroll.size", randomIntBetween(1, 100))
@ -153,10 +144,6 @@ public abstract class AbstractWatcherIntegrationTestCase extends ESIntegTestCase
} else {
types.add(XPackPlugin.class);
}
if (shieldEnabled) {
types.add(XPackPlugin.class);
}
types.add(licensePluginClass());
return types;
}
@ -191,10 +178,6 @@ public abstract class AbstractWatcherIntegrationTestCase extends ESIntegTestCase
return randomBoolean();
}
protected Class<? extends Plugin> licensePluginClass() {
return XPackPlugin.class;
}
protected boolean checkWatcherRunningOnlyOnce() {
return true;
}