From a107b5d70a81ced577cde2162a1b3b2a259d1f48 Mon Sep 17 00:00:00 2001 From: Igor Motov Date: Thu, 30 Oct 2014 18:20:02 -0400 Subject: [PATCH] TestConsumerPlugin shouldn't register its service on transport clients Original commit: elastic/x-pack-elasticsearch@c9baa72a4bd5fcc9010214ca4cb803758e1def19 --- .../plugin/LicensesServiceClusterRestartTest.java | 6 +++--- .../license/plugin/TestConsumerPlugin.java | 14 +++++++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/test/java/org/elasticsearch/license/plugin/LicensesServiceClusterRestartTest.java b/src/test/java/org/elasticsearch/license/plugin/LicensesServiceClusterRestartTest.java index 096834b7f38..273ffc60210 100644 --- a/src/test/java/org/elasticsearch/license/plugin/LicensesServiceClusterRestartTest.java +++ b/src/test/java/org/elasticsearch/license/plugin/LicensesServiceClusterRestartTest.java @@ -43,7 +43,7 @@ public class LicensesServiceClusterRestartTest extends AbstractLicensesIntegrati private ImmutableSettings.Builder nodeSettingsBuilder(int nodeOrdinal) { return ImmutableSettings.settingsBuilder() - //.put(super.nodeSettings(nodeOrdinal)) + .put(super.nodeSettings(nodeOrdinal)) .put("gateway.type", "local") .put("plugins.load_classpath_plugins", false) .put("node.data", true) @@ -58,10 +58,10 @@ public class LicensesServiceClusterRestartTest extends AbstractLicensesIntegrati wipeAllLicenses(); } - @Test @Ignore + @Test public void testClusterRestart() throws Exception { logger.info("--> starting 1 node"); - internalCluster().startNode(nodeSettingsBuilder(0)); + internalCluster().startNode(); ensureGreen(); final List esLicenses = generateAndPutLicense(); diff --git a/src/test/java/org/elasticsearch/license/plugin/TestConsumerPlugin.java b/src/test/java/org/elasticsearch/license/plugin/TestConsumerPlugin.java index 754ff29cce6..344937850df 100644 --- a/src/test/java/org/elasticsearch/license/plugin/TestConsumerPlugin.java +++ b/src/test/java/org/elasticsearch/license/plugin/TestConsumerPlugin.java @@ -5,7 +5,8 @@ */ package org.elasticsearch.license.plugin; -import org.elasticsearch.common.collect.ImmutableSet; +import org.elasticsearch.cluster.node.DiscoveryNode; +import org.elasticsearch.common.collect.Lists; import org.elasticsearch.common.component.LifecycleComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; @@ -15,11 +16,14 @@ import java.util.Collection; public class TestConsumerPlugin extends AbstractPlugin { + private final boolean isClient; + private final Settings settings; @Inject public TestConsumerPlugin(Settings settings) { - this.settings = settings; + this.settings = settings; + this.isClient = DiscoveryNode.clientNode(settings); } @Override @@ -35,6 +39,10 @@ public class TestConsumerPlugin extends AbstractPlugin { @Override public Collection> services() { - return ImmutableSet.>of(TestPluginService.class); + Collection> services = Lists.newArrayList(); + if (!isClient) { + services.add(TestPluginService.class); + } + return services; } }