[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:
parent
7ef87632ab
commit
13a8c98cb2
|
@ -44,7 +44,7 @@ dependencies {
|
||||||
|
|
||||||
// we keep the source directories in the original structure of split plugins,
|
// 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
|
// 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 {
|
sourceSets {
|
||||||
main {
|
main {
|
||||||
java.srcDir("${module}src/main/java")
|
java.srcDir("${module}src/main/java")
|
||||||
|
@ -77,9 +77,14 @@ processResources {
|
||||||
}
|
}
|
||||||
|
|
||||||
processTestResources {
|
processTestResources {
|
||||||
|
from(sourceSets.test.resources.srcDirs) {
|
||||||
|
exclude '**/*.key'
|
||||||
|
exclude '**/*.jks'
|
||||||
|
exclude '**/*.p12'
|
||||||
inputs.properties(expansions)
|
inputs.properties(expansions)
|
||||||
MavenFilteringHack.filter(it, expansions)
|
MavenFilteringHack.filter(it, expansions)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
forbiddenPatterns {
|
forbiddenPatterns {
|
||||||
exclude '**/*.key'
|
exclude '**/*.key'
|
||||||
|
|
|
@ -14,6 +14,7 @@ import org.elasticsearch.license.plugin.core.LicenseState;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
import org.elasticsearch.plugins.Plugin;
|
||||||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
||||||
import org.elasticsearch.test.InternalTestCluster;
|
import org.elasticsearch.test.InternalTestCluster;
|
||||||
|
import org.elasticsearch.xpack.XPackPlugin;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.elasticsearch.license.plugin.core.*;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
import org.elasticsearch.plugins.Plugin;
|
||||||
import org.elasticsearch.test.ESIntegTestCase;
|
import org.elasticsearch.test.ESIntegTestCase;
|
||||||
import org.elasticsearch.test.InternalTestCluster;
|
import org.elasticsearch.test.InternalTestCluster;
|
||||||
|
import org.elasticsearch.xpack.XPackPlugin;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
@ -39,7 +40,11 @@ public abstract class AbstractLicensesIntegrationTestCase extends ESIntegTestCas
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Settings nodeSettings(int nodeOrdinal) {
|
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
|
@Override
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.elasticsearch.license.plugin.consumer.LazyLicenseRegistrationPluginSe
|
||||||
import org.elasticsearch.license.plugin.core.LicenseState;
|
import org.elasticsearch.license.plugin.core.LicenseState;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
import org.elasticsearch.plugins.Plugin;
|
||||||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
||||||
|
import org.elasticsearch.xpack.XPackPlugin;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.elasticsearch.license.plugin.consumer.LazyLicenseRegistrationPluginSe
|
||||||
import org.elasticsearch.license.plugin.core.LicenseState;
|
import org.elasticsearch.license.plugin.core.LicenseState;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
import org.elasticsearch.plugins.Plugin;
|
||||||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
||||||
|
import org.elasticsearch.xpack.XPackPlugin;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
|
|
||||||
import java.util.Arrays;
|
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")
|
@BadApple(bugUrl = "https://github.com/elastic/x-plugins/issues/1007")
|
||||||
@ClusterScope(scope = TEST, numDataNodes = 0, numClientNodes = 0)
|
@ClusterScope(scope = TEST, numDataNodes = 0, numClientNodes = 0)
|
||||||
public class LicensesPluginsIntegrationTests extends AbstractLicensesIntegrationTestCase {
|
public class LicensesPluginsIntegrationTests extends AbstractLicensesIntegrationTestCase {
|
||||||
|
|
||||||
private static final String ID_1 = EagerLicenseRegistrationPluginService.ID;
|
private static final String ID_1 = EagerLicenseRegistrationPluginService.ID;
|
||||||
private static final String ID_2 = LazyLicenseRegistrationPluginService.ID;
|
private static final String ID_2 = LazyLicenseRegistrationPluginService.ID;
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ import org.elasticsearch.node.Node;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
import org.elasticsearch.plugins.Plugin;
|
||||||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
||||||
import org.elasticsearch.test.InternalTestCluster;
|
import org.elasticsearch.test.InternalTestCluster;
|
||||||
|
import org.elasticsearch.xpack.XPackPlugin;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
|
@ -12,6 +12,7 @@ import org.elasticsearch.license.plugin.core.LicenseState;
|
||||||
import org.elasticsearch.node.Node;
|
import org.elasticsearch.node.Node;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
import org.elasticsearch.plugins.Plugin;
|
||||||
import org.elasticsearch.test.ESIntegTestCase;
|
import org.elasticsearch.test.ESIntegTestCase;
|
||||||
|
import org.elasticsearch.xpack.XPackPlugin;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
|
@ -7,14 +7,17 @@ package org.elasticsearch.marvel.agent.collector;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.RandomizedTest;
|
import com.carrotsearch.randomizedtesting.RandomizedTest;
|
||||||
import com.carrotsearch.randomizedtesting.SysGlobals;
|
import com.carrotsearch.randomizedtesting.SysGlobals;
|
||||||
|
import org.elasticsearch.action.ActionModule;
|
||||||
import org.elasticsearch.cluster.block.ClusterBlocks;
|
import org.elasticsearch.cluster.block.ClusterBlocks;
|
||||||
import org.elasticsearch.common.component.AbstractComponent;
|
import org.elasticsearch.common.component.AbstractComponent;
|
||||||
|
import org.elasticsearch.common.component.LifecycleComponent;
|
||||||
import org.elasticsearch.common.inject.AbstractModule;
|
import org.elasticsearch.common.inject.AbstractModule;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.Module;
|
import org.elasticsearch.common.inject.Module;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.unit.TimeValue;
|
import org.elasticsearch.common.unit.TimeValue;
|
||||||
import org.elasticsearch.license.core.License;
|
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.LicenseState;
|
||||||
import org.elasticsearch.license.plugin.core.Licensee;
|
import org.elasticsearch.license.plugin.core.Licensee;
|
||||||
import org.elasticsearch.license.plugin.core.LicenseeRegistry;
|
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.marvel.test.MarvelIntegTestCase;
|
||||||
import org.elasticsearch.node.Node;
|
import org.elasticsearch.node.Node;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
import org.elasticsearch.plugins.Plugin;
|
||||||
|
import org.elasticsearch.rest.RestModule;
|
||||||
import org.elasticsearch.test.ESIntegTestCase;
|
import org.elasticsearch.test.ESIntegTestCase;
|
||||||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
||||||
import org.elasticsearch.xpack.XPackPlugin;
|
import org.elasticsearch.xpack.XPackPlugin;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@ -43,10 +43,7 @@ public class AbstractCollectorTestCase extends MarvelIntegTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
||||||
if (shieldEnabled) {
|
return Arrays.asList(InternalXPackPlugin.class);
|
||||||
return Arrays.asList(LicensePluginForCollectors.class, XPackPlugin.class, XPackPlugin.class);
|
|
||||||
}
|
|
||||||
return Arrays.asList(LicensePluginForCollectors.class, XPackPlugin.class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -183,18 +180,10 @@ public class AbstractCollectorTestCase extends MarvelIntegTestCase {
|
||||||
}, 30L, TimeUnit.SECONDS);
|
}, 30L, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class LicensePluginForCollectors extends Plugin {
|
public static class InternalLicensePlugin extends LicensePlugin {
|
||||||
|
|
||||||
public static final String NAME = "internal-test-licensing";
|
public InternalLicensePlugin() {
|
||||||
|
super(Settings.EMPTY);
|
||||||
@Override
|
|
||||||
public String name() {
|
|
||||||
return NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String description() {
|
|
||||||
return name();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 {
|
public static class LicenseServiceForCollectors extends AbstractComponent implements LicenseeRegistry {
|
||||||
|
|
|
@ -5,16 +5,22 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.marvel.license;
|
package org.elasticsearch.marvel.license;
|
||||||
|
|
||||||
|
import org.elasticsearch.action.ActionModule;
|
||||||
import org.elasticsearch.common.component.AbstractComponent;
|
import org.elasticsearch.common.component.AbstractComponent;
|
||||||
|
import org.elasticsearch.common.component.LifecycleComponent;
|
||||||
import org.elasticsearch.common.inject.AbstractModule;
|
import org.elasticsearch.common.inject.AbstractModule;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.Module;
|
import org.elasticsearch.common.inject.Module;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
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.core.License;
|
||||||
|
import org.elasticsearch.license.plugin.LicensePlugin;
|
||||||
import org.elasticsearch.license.plugin.core.LicenseState;
|
import org.elasticsearch.license.plugin.core.LicenseState;
|
||||||
import org.elasticsearch.license.plugin.core.Licensee;
|
import org.elasticsearch.license.plugin.core.Licensee;
|
||||||
import org.elasticsearch.license.plugin.core.LicenseeRegistry;
|
import org.elasticsearch.license.plugin.core.LicenseeRegistry;
|
||||||
import org.elasticsearch.license.plugin.core.LicensesManagerService;
|
import org.elasticsearch.license.plugin.core.LicensesManagerService;
|
||||||
|
import org.elasticsearch.rest.RestModule;
|
||||||
import org.elasticsearch.xpack.XPackPlugin;
|
import org.elasticsearch.xpack.XPackPlugin;
|
||||||
import org.elasticsearch.marvel.test.MarvelIntegTestCase;
|
import org.elasticsearch.marvel.test.MarvelIntegTestCase;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
import org.elasticsearch.plugins.Plugin;
|
||||||
|
@ -36,7 +42,7 @@ import static org.hamcrest.Matchers.isOneOf;
|
||||||
public class LicenseIntegrationTests extends MarvelIntegTestCase {
|
public class LicenseIntegrationTests extends MarvelIntegTestCase {
|
||||||
@Override
|
@Override
|
||||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
||||||
return Arrays.asList(MockLicensePlugin.class, XPackPlugin.class);
|
return Arrays.asList(InternalXPackPlugin.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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";
|
public MockLicensePlugin() {
|
||||||
|
super(Settings.EMPTY);
|
||||||
@Override
|
|
||||||
public String name() {
|
|
||||||
return NAME;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -95,6 +98,20 @@ public class LicenseIntegrationTests extends MarvelIntegTestCase {
|
||||||
public Collection<Module> nodeModules() {
|
public Collection<Module> nodeModules() {
|
||||||
return Collections.<Module>singletonList(new InternalLicenseModule());
|
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 {
|
public static class InternalLicenseModule extends AbstractModule {
|
||||||
|
@ -148,4 +165,11 @@ public class LicenseIntegrationTests extends MarvelIntegTestCase {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class InternalXPackPlugin extends XPackPlugin {
|
||||||
|
public InternalXPackPlugin(Settings settings) {
|
||||||
|
super(settings);
|
||||||
|
licensePlugin = new MockLicensePlugin();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,20 +18,18 @@ import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.util.concurrent.CountDown;
|
import org.elasticsearch.common.util.concurrent.CountDown;
|
||||||
import org.elasticsearch.index.IndexModule;
|
import org.elasticsearch.index.IndexModule;
|
||||||
import org.elasticsearch.index.IndexNotFoundException;
|
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.AgentService;
|
||||||
import org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils;
|
import org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils;
|
||||||
import org.elasticsearch.marvel.agent.settings.MarvelSettings;
|
import org.elasticsearch.marvel.agent.settings.MarvelSettings;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
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.esusers.ESUsersRealm;
|
||||||
import org.elasticsearch.shield.authc.support.Hasher;
|
import org.elasticsearch.shield.authc.support.Hasher;
|
||||||
import org.elasticsearch.shield.authc.support.SecuredString;
|
import org.elasticsearch.shield.authc.support.SecuredString;
|
||||||
import org.elasticsearch.shield.crypto.InternalCryptoService;
|
import org.elasticsearch.shield.crypto.InternalCryptoService;
|
||||||
import org.elasticsearch.test.ESIntegTestCase;
|
import org.elasticsearch.test.ESIntegTestCase;
|
||||||
import org.elasticsearch.test.TestCluster;
|
import org.elasticsearch.test.TestCluster;
|
||||||
|
import org.elasticsearch.xpack.XPackPlugin;
|
||||||
import org.hamcrest.Matcher;
|
import org.hamcrest.Matcher;
|
||||||
import org.jboss.netty.util.internal.SystemPropertyUtil;
|
import org.jboss.netty.util.internal.SystemPropertyUtil;
|
||||||
|
|
||||||
|
@ -72,6 +70,10 @@ public abstract class MarvelIntegTestCase extends ESIntegTestCase {
|
||||||
protected Settings nodeSettings(int nodeOrdinal) {
|
protected Settings nodeSettings(int nodeOrdinal) {
|
||||||
Settings.Builder builder = Settings.builder()
|
Settings.Builder builder = Settings.builder()
|
||||||
.put(super.nodeSettings(nodeOrdinal))
|
.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.
|
// 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);
|
.put("index.store.mock.check_index_on_close", false);
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
package org.elasticsearch.integration;
|
package org.elasticsearch.integration;
|
||||||
|
|
||||||
import org.elasticsearch.ElasticsearchSecurityException;
|
import org.elasticsearch.ElasticsearchSecurityException;
|
||||||
|
import org.elasticsearch.action.ActionModule;
|
||||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
||||||
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
|
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
|
||||||
import org.elasticsearch.action.admin.cluster.stats.ClusterStatsIndices;
|
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.NoNodeAvailableException;
|
||||||
import org.elasticsearch.client.transport.TransportClient;
|
import org.elasticsearch.client.transport.TransportClient;
|
||||||
import org.elasticsearch.common.component.AbstractComponent;
|
import org.elasticsearch.common.component.AbstractComponent;
|
||||||
|
import org.elasticsearch.common.component.LifecycleComponent;
|
||||||
import org.elasticsearch.common.inject.AbstractModule;
|
import org.elasticsearch.common.inject.AbstractModule;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.Module;
|
import org.elasticsearch.common.inject.Module;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.license.core.License;
|
|
||||||
import org.elasticsearch.license.core.License.OperationMode;
|
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.LicenseState;
|
||||||
import org.elasticsearch.license.plugin.core.Licensee;
|
import org.elasticsearch.license.plugin.core.Licensee;
|
||||||
import org.elasticsearch.license.plugin.core.LicenseeRegistry;
|
import org.elasticsearch.license.plugin.core.LicenseeRegistry;
|
||||||
import org.elasticsearch.node.Node;
|
import org.elasticsearch.node.Node;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
import org.elasticsearch.rest.RestModule;
|
||||||
import org.elasticsearch.rest.RestStatus;
|
import org.elasticsearch.rest.RestStatus;
|
||||||
import org.elasticsearch.shield.ShieldPlugin;
|
import org.elasticsearch.shield.ShieldPlugin;
|
||||||
import org.elasticsearch.xpack.XPackPlugin;
|
|
||||||
import org.elasticsearch.shield.authc.support.UsernamePasswordToken;
|
import org.elasticsearch.shield.authc.support.UsernamePasswordToken;
|
||||||
import org.elasticsearch.test.ShieldIntegTestCase;
|
import org.elasticsearch.test.ShieldIntegTestCase;
|
||||||
import org.elasticsearch.test.ShieldSettingsSource;
|
import org.elasticsearch.test.ShieldSettingsSource;
|
||||||
import org.elasticsearch.transport.Transport;
|
import org.elasticsearch.transport.Transport;
|
||||||
|
import org.elasticsearch.xpack.XPackPlugin;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.hamcrest.Matchers.hasItem;
|
import static org.hamcrest.Matchers.*;
|
||||||
import static org.hamcrest.Matchers.is;
|
|
||||||
import static org.hamcrest.Matchers.notNullValue;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -102,6 +101,11 @@ public class LicensingTests extends ShieldIntegTestCase {
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<? extends XPackPlugin> xpackPluginClass() {
|
||||||
|
return InternalXPackPlugin.class;
|
||||||
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void resetLicensing() {
|
public void resetLicensing() {
|
||||||
enableLicensing();
|
enableLicensing();
|
||||||
|
@ -237,24 +241,37 @@ public class LicensingTests extends ShieldIntegTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class InternalLicensePlugin extends Plugin {
|
public static class InternalLicensePlugin extends LicensePlugin {
|
||||||
|
|
||||||
public static final String NAME = "internal-licensing";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String name() {
|
|
||||||
return NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String description() {
|
|
||||||
return name();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<Module> nodeModules() {
|
public Collection<Module> nodeModules() {
|
||||||
return Collections.<Module>singletonList(new InternalLicenseModule());
|
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 {
|
public static class InternalLicenseModule extends AbstractModule {
|
||||||
|
|
|
@ -25,9 +25,7 @@ import org.elasticsearch.threadpool.ThreadPool;
|
||||||
import org.elasticsearch.threadpool.ThreadPoolModule;
|
import org.elasticsearch.threadpool.ThreadPoolModule;
|
||||||
import org.elasticsearch.transport.TransportMessage;
|
import org.elasticsearch.transport.TransportMessage;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.*;
|
||||||
import static org.hamcrest.Matchers.instanceOf;
|
|
||||||
import static org.hamcrest.Matchers.notNullValue;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests for the AuthenticationModule
|
* Unit tests for the AuthenticationModule
|
||||||
|
|
|
@ -46,6 +46,7 @@ import static org.hamcrest.Matchers.is;
|
||||||
*/
|
*/
|
||||||
@ClusterScope(numClientNodes = 0, numDataNodes = 1)
|
@ClusterScope(numClientNodes = 0, numDataNodes = 1)
|
||||||
public class PkiAuthenticationTests extends ShieldIntegTestCase {
|
public class PkiAuthenticationTests extends ShieldIntegTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Settings nodeSettings(int nodeOrdinal) {
|
protected Settings nodeSettings(int nodeOrdinal) {
|
||||||
return Settings.builder()
|
return Settings.builder()
|
||||||
|
|
|
@ -23,6 +23,7 @@ import static org.hamcrest.Matchers.is;
|
||||||
|
|
||||||
@ClusterScope(scope = TEST, numDataNodes = 1)
|
@ClusterScope(scope = TEST, numDataNodes = 1)
|
||||||
public class IpFilteringUpdateTests extends ShieldIntegTestCase {
|
public class IpFilteringUpdateTests extends ShieldIntegTestCase {
|
||||||
|
|
||||||
private static int randomClientPort;
|
private static int randomClientPort;
|
||||||
|
|
||||||
private final boolean httpEnabled = randomBoolean();
|
private final boolean httpEnabled = randomBoolean();
|
||||||
|
|
|
@ -28,6 +28,7 @@ import static org.hamcrest.Matchers.is;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
|
|
||||||
public class ShieldNettyHttpServerTransportTests extends ESTestCase {
|
public class ShieldNettyHttpServerTransportTests extends ESTestCase {
|
||||||
|
|
||||||
private ServerSSLService serverSSLService;
|
private ServerSSLService serverSSLService;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
|
|
@ -6,16 +6,15 @@
|
||||||
package org.elasticsearch.test;
|
package org.elasticsearch.test;
|
||||||
|
|
||||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
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.NodeInfo;
|
||||||
import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse;
|
import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse;
|
||||||
import org.elasticsearch.client.Client;
|
import org.elasticsearch.client.Client;
|
||||||
|
import org.elasticsearch.cluster.health.ClusterHealthStatus;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
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.shield.authc.support.SecuredString;
|
||||||
import org.elasticsearch.test.ESIntegTestCase.SuppressLocalMode;
|
import org.elasticsearch.test.ESIntegTestCase.SuppressLocalMode;
|
||||||
|
import org.elasticsearch.xpack.XPackPlugin;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
@ -23,7 +22,7 @@ import org.junit.Rule;
|
||||||
import org.junit.rules.ExternalResource;
|
import org.junit.rules.ExternalResource;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.*;
|
import java.util.Collection;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoTimeout;
|
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?
|
// 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));
|
// assertThat(nodeInfo.getPlugins().getInfos(), hasSize(2));
|
||||||
Collection<String> pluginNames = nodeInfo.getPlugins().getInfos().stream().map(p -> p.getName()).collect(Collectors.toList());
|
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();
|
return randomBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Class<? extends XPackPlugin> xpackPluginClass() {
|
||||||
|
return SHIELD_DEFAULT_SETTINGS.xpackPluginClass();
|
||||||
|
}
|
||||||
|
|
||||||
private class CustomShieldSettingsSource extends ShieldSettingsSource {
|
private class CustomShieldSettingsSource extends ShieldSettingsSource {
|
||||||
private CustomShieldSettingsSource(boolean sslTransportEnabled, Path configDir, Scope scope) {
|
private CustomShieldSettingsSource(boolean sslTransportEnabled, Path configDir, Scope scope) {
|
||||||
super(maxNumberOfNodes(), sslTransportEnabled, configDir, scope);
|
super(maxNumberOfNodes(), sslTransportEnabled, configDir, scope);
|
||||||
|
@ -275,6 +278,10 @@ public abstract class ShieldIntegTestCase extends ESIntegTestCase {
|
||||||
return ShieldIntegTestCase.this.transportClientPassword();
|
return ShieldIntegTestCase.this.transportClientPassword();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<? extends XPackPlugin> xpackPluginClass() {
|
||||||
|
return ShieldIntegTestCase.this.xpackPluginClass();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void assertGreenClusterState(Client client) {
|
protected void assertGreenClusterState(Client client) {
|
||||||
|
|
|
@ -116,6 +116,11 @@ public class ShieldSettingsSource extends ClusterDiscoveryConfiguration.UnicastZ
|
||||||
public Settings nodeSettings(int nodeOrdinal) {
|
public Settings nodeSettings(int nodeOrdinal) {
|
||||||
Path folder = ShieldTestUtils.createFolder(parentFolder, subfolderPrefix + "-" + nodeOrdinal);
|
Path folder = ShieldTestUtils.createFolder(parentFolder, subfolderPrefix + "-" + nodeOrdinal);
|
||||||
Settings.Builder builder = settingsBuilder().put(super.nodeSettings(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("shield.audit.enabled", randomBoolean())
|
||||||
.put(InternalCryptoService.FILE_SETTING, writeFile(folder, "system_key", systemKey))
|
.put(InternalCryptoService.FILE_SETTING, writeFile(folder, "system_key", systemKey))
|
||||||
.put("shield.authc.realms.esusers.type", ESUsersRealm.TYPE)
|
.put("shield.authc.realms.esusers.type", ESUsersRealm.TYPE)
|
||||||
|
@ -143,12 +148,12 @@ public class ShieldSettingsSource extends ClusterDiscoveryConfiguration.UnicastZ
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<Class<? extends Plugin>> nodePlugins() {
|
public Collection<Class<? extends Plugin>> nodePlugins() {
|
||||||
return Arrays.asList(XPackPlugin.class);
|
return Arrays.asList(xpackPluginClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<Class<? extends Plugin>> transportClientPlugins() {
|
public Collection<Class<? extends Plugin>> transportClientPlugins() {
|
||||||
return Collections.<Class<? extends Plugin>>singletonList(XPackPlugin.class);
|
return Collections.<Class<? extends Plugin>>singletonList(xpackPluginClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String configUsers() {
|
protected String configUsers() {
|
||||||
|
@ -183,6 +188,10 @@ public class ShieldSettingsSource extends ClusterDiscoveryConfiguration.UnicastZ
|
||||||
return systemKey;
|
return systemKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Class<? extends XPackPlugin> xpackPluginClass() {
|
||||||
|
return XPackPlugin.class;
|
||||||
|
}
|
||||||
|
|
||||||
private void setUser(Settings.Builder builder, String username, SecuredString password) {
|
private void setUser(Settings.Builder builder, String username, SecuredString password) {
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
builder.put(Headers.PREFIX + "." + UsernamePasswordToken.BASIC_AUTH_HEADER, basicAuthHeaderValue(username, password));
|
builder.put(Headers.PREFIX + "." + UsernamePasswordToken.BASIC_AUTH_HEADER, basicAuthHeaderValue(username, password));
|
||||||
|
|
|
@ -14,6 +14,7 @@ import org.elasticsearch.common.logging.Loggers;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.index.IndexModule;
|
import org.elasticsearch.index.IndexModule;
|
||||||
import org.elasticsearch.index.IndexService;
|
import org.elasticsearch.index.IndexService;
|
||||||
|
import org.elasticsearch.license.plugin.LicensePlugin;
|
||||||
import org.elasticsearch.marvel.MarvelPlugin;
|
import org.elasticsearch.marvel.MarvelPlugin;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
import org.elasticsearch.plugins.Plugin;
|
||||||
import org.elasticsearch.rest.RestModule;
|
import org.elasticsearch.rest.RestModule;
|
||||||
|
@ -27,17 +28,19 @@ import java.util.Collection;
|
||||||
|
|
||||||
public class XPackPlugin extends Plugin {
|
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);
|
private final static ESLogger logger = Loggers.getLogger(XPackPlugin.class);
|
||||||
|
|
||||||
protected final Settings settings;
|
protected final Settings settings;
|
||||||
protected final ShieldPlugin shieldPlugin;
|
protected LicensePlugin licensePlugin;
|
||||||
protected final MarvelPlugin marvelPlugin;
|
protected ShieldPlugin shieldPlugin;
|
||||||
|
protected MarvelPlugin marvelPlugin;
|
||||||
protected WatcherPlugin watcherPlugin;
|
protected WatcherPlugin watcherPlugin;
|
||||||
|
|
||||||
public XPackPlugin(Settings settings) {
|
public XPackPlugin(Settings settings) {
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
|
this.licensePlugin = new LicensePlugin(settings);
|
||||||
this.shieldPlugin = new ShieldPlugin(settings);
|
this.shieldPlugin = new ShieldPlugin(settings);
|
||||||
this.marvelPlugin = new MarvelPlugin(settings);
|
this.marvelPlugin = new MarvelPlugin(settings);
|
||||||
this.watcherPlugin = new WatcherPlugin(settings);
|
this.watcherPlugin = new WatcherPlugin(settings);
|
||||||
|
@ -54,6 +57,7 @@ public class XPackPlugin extends Plugin {
|
||||||
@Override
|
@Override
|
||||||
public Collection<Module> nodeModules() {
|
public Collection<Module> nodeModules() {
|
||||||
ArrayList<Module> modules = new ArrayList<>();
|
ArrayList<Module> modules = new ArrayList<>();
|
||||||
|
modules.addAll(licensePlugin.nodeModules());
|
||||||
modules.addAll(shieldPlugin.nodeModules());
|
modules.addAll(shieldPlugin.nodeModules());
|
||||||
modules.addAll(watcherPlugin.nodeModules());
|
modules.addAll(watcherPlugin.nodeModules());
|
||||||
modules.addAll(marvelPlugin.nodeModules());
|
modules.addAll(marvelPlugin.nodeModules());
|
||||||
|
@ -63,6 +67,7 @@ public class XPackPlugin extends Plugin {
|
||||||
@Override
|
@Override
|
||||||
public Collection<Class<? extends LifecycleComponent>> nodeServices() {
|
public Collection<Class<? extends LifecycleComponent>> nodeServices() {
|
||||||
ArrayList<Class<? extends LifecycleComponent>> services = new ArrayList<>();
|
ArrayList<Class<? extends LifecycleComponent>> services = new ArrayList<>();
|
||||||
|
services.addAll(licensePlugin.nodeServices());
|
||||||
services.addAll(shieldPlugin.nodeServices());
|
services.addAll(shieldPlugin.nodeServices());
|
||||||
services.addAll(watcherPlugin.nodeServices());
|
services.addAll(watcherPlugin.nodeServices());
|
||||||
services.addAll(marvelPlugin.nodeServices());
|
services.addAll(marvelPlugin.nodeServices());
|
||||||
|
@ -72,6 +77,7 @@ public class XPackPlugin extends Plugin {
|
||||||
@Override
|
@Override
|
||||||
public Settings additionalSettings() {
|
public Settings additionalSettings() {
|
||||||
Settings.Builder builder = Settings.builder();
|
Settings.Builder builder = Settings.builder();
|
||||||
|
builder.put(licensePlugin.additionalSettings());
|
||||||
builder.put(shieldPlugin.additionalSettings());
|
builder.put(shieldPlugin.additionalSettings());
|
||||||
builder.put(watcherPlugin.additionalSettings());
|
builder.put(watcherPlugin.additionalSettings());
|
||||||
builder.put(marvelPlugin.additionalSettings());
|
builder.put(marvelPlugin.additionalSettings());
|
||||||
|
@ -89,11 +95,13 @@ public class XPackPlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onModule(RestModule module) {
|
public void onModule(RestModule module) {
|
||||||
|
licensePlugin.onModule(module);
|
||||||
shieldPlugin.onModule(module);
|
shieldPlugin.onModule(module);
|
||||||
watcherPlugin.onModule(module);
|
watcherPlugin.onModule(module);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onModule(ActionModule module) {
|
public void onModule(ActionModule module) {
|
||||||
|
licensePlugin.onModule(module);
|
||||||
shieldPlugin.onModule(module);
|
shieldPlugin.onModule(module);
|
||||||
watcherPlugin.onModule(module);
|
watcherPlugin.onModule(module);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ import java.util.List;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
|
|
||||||
public class LicenseTests extends ESTestCase {
|
public class LicenseTests extends ESTestCase {
|
||||||
|
|
||||||
private SimpleLicenseeRegistry licenseeRegistry = new SimpleLicenseeRegistry();
|
private SimpleLicenseeRegistry licenseeRegistry = new SimpleLicenseeRegistry();
|
||||||
|
|
||||||
public void testPlatinumGoldTrialLicenseCanDoEverything() throws Exception {
|
public void testPlatinumGoldTrialLicenseCanDoEverything() throws Exception {
|
||||||
|
|
|
@ -20,13 +20,10 @@ import org.elasticsearch.common.xcontent.XContentHelper;
|
||||||
import org.elasticsearch.common.xcontent.support.XContentMapValues;
|
import org.elasticsearch.common.xcontent.support.XContentMapValues;
|
||||||
import org.elasticsearch.index.IndexModule;
|
import org.elasticsearch.index.IndexModule;
|
||||||
import org.elasticsearch.index.query.QueryBuilder;
|
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.plugins.Plugin;
|
||||||
import org.elasticsearch.search.SearchHit;
|
import org.elasticsearch.search.SearchHit;
|
||||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
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.esusers.ESUsersRealm;
|
||||||
import org.elasticsearch.shield.authc.support.Hasher;
|
import org.elasticsearch.shield.authc.support.Hasher;
|
||||||
import org.elasticsearch.shield.authc.support.SecuredString;
|
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.test.TestCluster;
|
||||||
import org.elasticsearch.watcher.WatcherLifeCycleService;
|
import org.elasticsearch.watcher.WatcherLifeCycleService;
|
||||||
import org.elasticsearch.watcher.WatcherModule;
|
import org.elasticsearch.watcher.WatcherModule;
|
||||||
import org.elasticsearch.xpack.XPackPlugin;
|
|
||||||
import org.elasticsearch.watcher.WatcherService;
|
import org.elasticsearch.watcher.WatcherService;
|
||||||
import org.elasticsearch.watcher.WatcherState;
|
import org.elasticsearch.watcher.WatcherState;
|
||||||
import org.elasticsearch.watcher.actions.email.service.Authentication;
|
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.TriggerService;
|
||||||
import org.elasticsearch.watcher.trigger.schedule.ScheduleModule;
|
import org.elasticsearch.watcher.trigger.schedule.ScheduleModule;
|
||||||
import org.elasticsearch.watcher.watch.Watch;
|
import org.elasticsearch.watcher.watch.Watch;
|
||||||
|
import org.elasticsearch.xpack.TimeWarpedXPackPlugin;
|
||||||
|
import org.elasticsearch.xpack.XPackPlugin;
|
||||||
import org.hamcrest.Matcher;
|
import org.hamcrest.Matcher;
|
||||||
import org.jboss.netty.util.internal.SystemPropertyUtil;
|
import org.jboss.netty.util.internal.SystemPropertyUtil;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
|
@ -69,25 +67,14 @@ import java.io.OutputStream;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
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.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
import static org.elasticsearch.index.query.QueryBuilders.boolQuery;
|
import static org.elasticsearch.index.query.QueryBuilders.boolQuery;
|
||||||
import static org.elasticsearch.index.query.QueryBuilders.matchQuery;
|
import static org.elasticsearch.index.query.QueryBuilders.matchQuery;
|
||||||
import static org.elasticsearch.test.ESIntegTestCase.Scope.SUITE;
|
import static org.elasticsearch.test.ESIntegTestCase.Scope.SUITE;
|
||||||
import static org.elasticsearch.watcher.WatcherModule.HISTORY_TEMPLATE_NAME;
|
import static org.elasticsearch.watcher.WatcherModule.*;
|
||||||
import static org.elasticsearch.watcher.WatcherModule.TRIGGERED_TEMPLATE_NAME;
|
import static org.hamcrest.Matchers.*;
|
||||||
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.hamcrest.core.Is.is;
|
import static org.hamcrest.core.Is.is;
|
||||||
import static org.hamcrest.core.IsNot.not;
|
import static org.hamcrest.core.IsNot.not;
|
||||||
|
|
||||||
|
@ -119,6 +106,10 @@ public abstract class AbstractWatcherIntegrationTestCase extends ESIntegTestCase
|
||||||
logger.info("using schedule engine [" + scheduleImplName + "]");
|
logger.info("using schedule engine [" + scheduleImplName + "]");
|
||||||
return Settings.builder()
|
return Settings.builder()
|
||||||
.put(super.nodeSettings(nodeOrdinal))
|
.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.
|
// 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("index.store.mock.check_index_on_close", false)
|
||||||
.put("scroll.size", randomIntBetween(1, 100))
|
.put("scroll.size", randomIntBetween(1, 100))
|
||||||
|
@ -153,10 +144,6 @@ public abstract class AbstractWatcherIntegrationTestCase extends ESIntegTestCase
|
||||||
} else {
|
} else {
|
||||||
types.add(XPackPlugin.class);
|
types.add(XPackPlugin.class);
|
||||||
}
|
}
|
||||||
if (shieldEnabled) {
|
|
||||||
types.add(XPackPlugin.class);
|
|
||||||
}
|
|
||||||
types.add(licensePluginClass());
|
|
||||||
return types;
|
return types;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,10 +178,6 @@ public abstract class AbstractWatcherIntegrationTestCase extends ESIntegTestCase
|
||||||
return randomBoolean();
|
return randomBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Class<? extends Plugin> licensePluginClass() {
|
|
||||||
return XPackPlugin.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean checkWatcherRunningOnlyOnce() {
|
protected boolean checkWatcherRunningOnlyOnce() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue