From 91d1812cb8cbd8458036b6c13f6604e67136994e Mon Sep 17 00:00:00 2001 From: Lee Hinman Date: Fri, 8 Dec 2017 14:42:50 -0700 Subject: [PATCH 1/2] Rename x-pack-common -> x-pack-core (elastic/x-pack-elasticsearch#3272) The folder has to be named 'x-pack-core' (not 'core'), otherwise Gradle flips out and has circular dependencies. Relates to elastic/x-pack-elasticsearch#3233 Original commit: elastic/x-pack-elasticsearch@f756e5d356d776939448b1288d75c1e4a6026c43 --- build.gradle | 2 +- plugin/graph/build.gradle | 4 ++-- ...on-LICENSE.txt => x-pack-core-LICENSE.txt} | 0 ...mmon-NOTICE.txt => x-pack-core-NOTICE.txt} | 0 plugin/ml/build.gradle | 20 +++++++++---------- ...on-LICENSE.txt => x-pack-core-LICENSE.txt} | 0 ...mmon-NOTICE.txt => x-pack-core-NOTICE.txt} | 0 plugin/monitoring/build.gradle | 16 +++++++-------- ...on-LICENSE.txt => x-pack-core-LICENSE.txt} | 0 ...mmon-NOTICE.txt => x-pack-core-NOTICE.txt} | 0 plugin/security/build.gradle | 12 +++++------ ...on-LICENSE.txt => x-pack-core-LICENSE.txt} | 0 ...mmon-NOTICE.txt => x-pack-core-NOTICE.txt} | 0 plugin/watcher/build.gradle | 4 ++-- ...on-LICENSE.txt => x-pack-core-LICENSE.txt} | 0 ...mmon-NOTICE.txt => x-pack-core-NOTICE.txt} | 0 plugin/{common => x-pack-core}/build.gradle | 2 +- 17 files changed, 30 insertions(+), 30 deletions(-) rename plugin/graph/licenses/{x-pack-common-LICENSE.txt => x-pack-core-LICENSE.txt} (100%) rename plugin/graph/licenses/{x-pack-common-NOTICE.txt => x-pack-core-NOTICE.txt} (100%) rename plugin/ml/licenses/{x-pack-common-LICENSE.txt => x-pack-core-LICENSE.txt} (100%) rename plugin/ml/licenses/{x-pack-common-NOTICE.txt => x-pack-core-NOTICE.txt} (100%) rename plugin/monitoring/licenses/{x-pack-common-LICENSE.txt => x-pack-core-LICENSE.txt} (100%) rename plugin/monitoring/licenses/{x-pack-common-NOTICE.txt => x-pack-core-NOTICE.txt} (100%) rename plugin/security/licenses/{x-pack-common-LICENSE.txt => x-pack-core-LICENSE.txt} (100%) rename plugin/security/licenses/{x-pack-common-NOTICE.txt => x-pack-core-NOTICE.txt} (100%) rename plugin/watcher/licenses/{x-pack-common-LICENSE.txt => x-pack-core-LICENSE.txt} (100%) rename plugin/watcher/licenses/{x-pack-common-NOTICE.txt => x-pack-core-NOTICE.txt} (100%) rename plugin/{common => x-pack-core}/build.gradle (87%) diff --git a/build.gradle b/build.gradle index b5f035a14bb..8c031e51ca6 100644 --- a/build.gradle +++ b/build.gradle @@ -51,7 +51,7 @@ subprojects { additionalLicense 'ESCON', 'Elasticsearch Confidential', 'ELASTICSEARCH CONFIDENTIAL' } ext.projectSubstitutions += [ "org.elasticsearch.plugin:x-pack-api:${version}": ':x-pack-elasticsearch:plugin'] - ext.projectSubstitutions += [ "org.elasticsearch:x-pack-common:${version}": ':x-pack-elasticsearch:plugin:common'] + ext.projectSubstitutions += [ "org.elasticsearch:x-pack-core:${version}": ':x-pack-elasticsearch:plugin:x-pack-core'] for (final Version version : versionCollection.versionsIndexCompatibleWithCurrent) { if (version.branch != null) { diff --git a/plugin/graph/build.gradle b/plugin/graph/build.gradle index 8b3e4655268..cb597e9f4cb 100644 --- a/plugin/graph/build.gradle +++ b/plugin/graph/build.gradle @@ -9,11 +9,11 @@ licenseHeaders.enabled = false dependencies { provided "org.elasticsearch:elasticsearch:${version}" - compile "org.elasticsearch:x-pack-common:${version}" + compile "org.elasticsearch:x-pack-core:${version}" } dependencyLicenses { - ignoreSha 'x-pack-common' + ignoreSha 'x-pack-core' } parent.bundlePlugin { diff --git a/plugin/graph/licenses/x-pack-common-LICENSE.txt b/plugin/graph/licenses/x-pack-core-LICENSE.txt similarity index 100% rename from plugin/graph/licenses/x-pack-common-LICENSE.txt rename to plugin/graph/licenses/x-pack-core-LICENSE.txt diff --git a/plugin/graph/licenses/x-pack-common-NOTICE.txt b/plugin/graph/licenses/x-pack-core-NOTICE.txt similarity index 100% rename from plugin/graph/licenses/x-pack-common-NOTICE.txt rename to plugin/graph/licenses/x-pack-core-NOTICE.txt diff --git a/plugin/ml/build.gradle b/plugin/ml/build.gradle index f990bf9ffb1..a599b3d240a 100644 --- a/plugin/ml/build.gradle +++ b/plugin/ml/build.gradle @@ -7,21 +7,21 @@ test.enabled=false licenseHeaders.enabled = false configurations { - nativeBundle { - resolutionStrategy.dependencySubstitution { - if (findProject(':machine-learning-cpp') != null) { - substitute module("org.elasticsearch.ml:ml-cpp") with project(":machine-learning-cpp") - } else { - substitute module("org.elasticsearch.ml:ml-cpp") with project("${project.path}:ml-cpp-snapshot") - } + nativeBundle { + resolutionStrategy.dependencySubstitution { + if (findProject(':machine-learning-cpp') != null) { + substitute module("org.elasticsearch.ml:ml-cpp") with project(":machine-learning-cpp") + } else { + substitute module("org.elasticsearch.ml:ml-cpp") with project("${project.path}:ml-cpp-snapshot") + } + } } - } } dependencies { provided "org.elasticsearch:elasticsearch:${version}" - compile "org.elasticsearch:x-pack-common:${version}" + compile "org.elasticsearch:x-pack-core:${version}" // ml deps compile 'net.sf.supercsv:super-csv:2.4.0' @@ -30,7 +30,7 @@ dependencies { } dependencyLicenses { - ignoreSha 'x-pack-common' + ignoreSha 'x-pack-core' } parent.bundlePlugin { diff --git a/plugin/ml/licenses/x-pack-common-LICENSE.txt b/plugin/ml/licenses/x-pack-core-LICENSE.txt similarity index 100% rename from plugin/ml/licenses/x-pack-common-LICENSE.txt rename to plugin/ml/licenses/x-pack-core-LICENSE.txt diff --git a/plugin/ml/licenses/x-pack-common-NOTICE.txt b/plugin/ml/licenses/x-pack-core-NOTICE.txt similarity index 100% rename from plugin/ml/licenses/x-pack-common-NOTICE.txt rename to plugin/ml/licenses/x-pack-core-NOTICE.txt diff --git a/plugin/monitoring/build.gradle b/plugin/monitoring/build.gradle index 163c32f435c..5db18fa06a1 100644 --- a/plugin/monitoring/build.gradle +++ b/plugin/monitoring/build.gradle @@ -12,7 +12,7 @@ licenseHeaders.enabled = false dependencies { provided "org.elasticsearch:elasticsearch:${version}" - compile "org.elasticsearch:x-pack-common:${version}" + compile "org.elasticsearch:x-pack-core:${version}" // monitoring deps compile "org.elasticsearch.client:elasticsearch-rest-client:${version}" @@ -20,13 +20,13 @@ dependencies { } dependencyLicenses { - mapping from: /elasticsearch-rest-client.*/, to: 'elasticsearch' - mapping from: /http.*/, to: 'httpclient' // pulled in by rest client - mapping from: /commons-.*/, to: 'commons' // pulled in by rest client - ignoreSha 'x-pack-common' - ignoreSha 'elasticsearch-rest-client' - ignoreSha 'transport-netty4' - ignoreSha 'elasticsearch-rest-client-sniffer' + mapping from: /elasticsearch-rest-client.*/, to: 'elasticsearch' + mapping from: /http.*/, to: 'httpclient' // pulled in by rest client + mapping from: /commons-.*/, to: 'commons' // pulled in by rest client + ignoreSha 'x-pack-core' + ignoreSha 'elasticsearch-rest-client' + ignoreSha 'transport-netty4' + ignoreSha 'elasticsearch-rest-client-sniffer' } parent.bundlePlugin { diff --git a/plugin/monitoring/licenses/x-pack-common-LICENSE.txt b/plugin/monitoring/licenses/x-pack-core-LICENSE.txt similarity index 100% rename from plugin/monitoring/licenses/x-pack-common-LICENSE.txt rename to plugin/monitoring/licenses/x-pack-core-LICENSE.txt diff --git a/plugin/monitoring/licenses/x-pack-common-NOTICE.txt b/plugin/monitoring/licenses/x-pack-core-NOTICE.txt similarity index 100% rename from plugin/monitoring/licenses/x-pack-common-NOTICE.txt rename to plugin/monitoring/licenses/x-pack-core-NOTICE.txt diff --git a/plugin/security/build.gradle b/plugin/security/build.gradle index 1a3a8450773..9ec1ddd2505 100644 --- a/plugin/security/build.gradle +++ b/plugin/security/build.gradle @@ -9,7 +9,7 @@ licenseHeaders.enabled = false dependencies { provided "org.elasticsearch:elasticsearch:${version}" - compile "org.elasticsearch:x-pack-common:${version}" + compile "org.elasticsearch:x-pack-core:${version}" // security deps compile project(path: ':modules:transport-netty4', configuration: 'runtime') compile 'com.unboundid:unboundid-ldapsdk:3.2.0' @@ -19,11 +19,11 @@ dependencies { } dependencyLicenses { - mapping from: /netty-.*/, to: 'netty' - mapping from: /bc.*/, to: 'bouncycastle' - mapping from: /transport-netty.*/, to: 'elasticsearch' - ignoreSha 'x-pack-common' - ignoreSha 'transport-netty4' + mapping from: /netty-.*/, to: 'netty' + mapping from: /bc.*/, to: 'bouncycastle' + mapping from: /transport-netty.*/, to: 'elasticsearch' + ignoreSha 'x-pack-core' + ignoreSha 'transport-netty4' } parent.bundlePlugin { diff --git a/plugin/security/licenses/x-pack-common-LICENSE.txt b/plugin/security/licenses/x-pack-core-LICENSE.txt similarity index 100% rename from plugin/security/licenses/x-pack-common-LICENSE.txt rename to plugin/security/licenses/x-pack-core-LICENSE.txt diff --git a/plugin/security/licenses/x-pack-common-NOTICE.txt b/plugin/security/licenses/x-pack-core-NOTICE.txt similarity index 100% rename from plugin/security/licenses/x-pack-common-NOTICE.txt rename to plugin/security/licenses/x-pack-core-NOTICE.txt diff --git a/plugin/watcher/build.gradle b/plugin/watcher/build.gradle index 7ffe4722b72..5525fc541c7 100644 --- a/plugin/watcher/build.gradle +++ b/plugin/watcher/build.gradle @@ -8,13 +8,13 @@ licenseHeaders.enabled = false dependencyLicenses { mapping from: /owasp-java-html-sanitizer.*/, to: 'owasp-java-html-sanitizer' - ignoreSha 'x-pack-common' + ignoreSha 'x-pack-core' } dependencies { provided "org.elasticsearch:elasticsearch:${version}" - compile "org.elasticsearch:x-pack-common:${version}" + compile "org.elasticsearch:x-pack-core:${version}" // watcher deps compile 'com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:r239' diff --git a/plugin/watcher/licenses/x-pack-common-LICENSE.txt b/plugin/watcher/licenses/x-pack-core-LICENSE.txt similarity index 100% rename from plugin/watcher/licenses/x-pack-common-LICENSE.txt rename to plugin/watcher/licenses/x-pack-core-LICENSE.txt diff --git a/plugin/watcher/licenses/x-pack-common-NOTICE.txt b/plugin/watcher/licenses/x-pack-core-NOTICE.txt similarity index 100% rename from plugin/watcher/licenses/x-pack-common-NOTICE.txt rename to plugin/watcher/licenses/x-pack-core-NOTICE.txt diff --git a/plugin/common/build.gradle b/plugin/x-pack-core/build.gradle similarity index 87% rename from plugin/common/build.gradle rename to plugin/x-pack-core/build.gradle index 23bad797501..12d72c3197d 100644 --- a/plugin/common/build.gradle +++ b/plugin/x-pack-core/build.gradle @@ -4,7 +4,7 @@ dependencies { provided "org.elasticsearch:elasticsearch:${version}" } -archivesBaseName = 'x-pack-common' +archivesBaseName = 'x-pack-core' // TODO: enable this once we have tests test.enabled=false From 9dbb887a584a80189d0d0e22ca06d0c783245c09 Mon Sep 17 00:00:00 2001 From: Tim Brooks Date: Fri, 8 Dec 2017 16:57:08 -0700 Subject: [PATCH 2/2] Update x-pack for change to channel tracking (elastic/x-pack-elasticsearch#3261) This commit updates x-pack to be compatible with elastic/elasticsearch#27711. That commit removed the need for channels to be internally tracked inside transport implementations. This commit removes a test mocking class that is not necessary after that change. Original commit: elastic/x-pack-elasticsearch@75d99ba1d1e988ce8cfb308e4c28462347c1cf41 --- .../transport/netty4/Netty4MockUtil.java | 21 ------------------- .../netty4/SecurityNetty4TransportTests.java | 10 --------- 2 files changed, 31 deletions(-) delete mode 100644 plugin/src/test/java/org/elasticsearch/transport/netty4/Netty4MockUtil.java diff --git a/plugin/src/test/java/org/elasticsearch/transport/netty4/Netty4MockUtil.java b/plugin/src/test/java/org/elasticsearch/transport/netty4/Netty4MockUtil.java deleted file mode 100644 index 15bd2bb1c25..00000000000 --- a/plugin/src/test/java/org/elasticsearch/transport/netty4/Netty4MockUtil.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ -package org.elasticsearch.transport.netty4; - -import static org.mockito.Mockito.mock; - -/** Allows setting a mock into Netty3Transport */ -public class Netty4MockUtil { - - /** - * We don't really need to start Netty for these tests, but we can't create a pipeline - * with a null handler. So we set it to a mock for tests. - */ - public static void setOpenChannelsHandlerToMock(Netty4Transport transport) throws Exception { - transport.serverOpenChannels = mock(Netty4OpenChannelsHandler.class); - } - -} diff --git a/plugin/src/test/java/org/elasticsearch/xpack/security/transport/netty4/SecurityNetty4TransportTests.java b/plugin/src/test/java/org/elasticsearch/xpack/security/transport/netty4/SecurityNetty4TransportTests.java index cd4c36efa6e..e946fca21c4 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/security/transport/netty4/SecurityNetty4TransportTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/security/transport/netty4/SecurityNetty4TransportTests.java @@ -18,7 +18,6 @@ import org.elasticsearch.env.TestEnvironment; import org.elasticsearch.indices.breaker.CircuitBreakerService; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.netty4.Netty4MockUtil; import org.elasticsearch.xpack.ssl.SSLClientAuth; import org.elasticsearch.xpack.ssl.SSLService; import org.junit.Before; @@ -75,7 +74,6 @@ public class SecurityNetty4TransportTests extends ESTestCase { public void testThatProfileTakesDefaultSSLSetting() throws Exception { SecurityNetty4Transport transport = createTransport(); - Netty4MockUtil.setOpenChannelsHandlerToMock(transport); ChannelHandler handler = transport.getServerChannelInitializer("default"); final EmbeddedChannel ch = new EmbeddedChannel(handler); assertThat(ch.pipeline().get(SslHandler.class).engine(), notNullValue()); @@ -83,7 +81,6 @@ public class SecurityNetty4TransportTests extends ESTestCase { public void testDefaultClientAuth() throws Exception { SecurityNetty4Transport transport = createTransport(); - Netty4MockUtil.setOpenChannelsHandlerToMock(transport); ChannelHandler handler = transport.getServerChannelInitializer("default"); final EmbeddedChannel ch = new EmbeddedChannel(handler); assertThat(ch.pipeline().get(SslHandler.class).engine().getNeedClientAuth(), is(true)); @@ -98,7 +95,6 @@ public class SecurityNetty4TransportTests extends ESTestCase { .build(); sslService = new SSLService(settings, env); SecurityNetty4Transport transport = createTransport(settings); - Netty4MockUtil.setOpenChannelsHandlerToMock(transport); ChannelHandler handler = transport.getServerChannelInitializer("default"); final EmbeddedChannel ch = new EmbeddedChannel(handler); assertThat(ch.pipeline().get(SslHandler.class).engine().getNeedClientAuth(), is(true)); @@ -113,7 +109,6 @@ public class SecurityNetty4TransportTests extends ESTestCase { .build(); sslService = new SSLService(settings, env); SecurityNetty4Transport transport = createTransport(settings); - Netty4MockUtil.setOpenChannelsHandlerToMock(transport); ChannelHandler handler = transport.getServerChannelInitializer("default"); final EmbeddedChannel ch = new EmbeddedChannel(handler); assertThat(ch.pipeline().get(SslHandler.class).engine().getNeedClientAuth(), is(false)); @@ -128,7 +123,6 @@ public class SecurityNetty4TransportTests extends ESTestCase { .build(); sslService = new SSLService(settings, env); SecurityNetty4Transport transport = createTransport(settings); - Netty4MockUtil.setOpenChannelsHandlerToMock(transport); ChannelHandler handler = transport.getServerChannelInitializer("default"); final EmbeddedChannel ch = new EmbeddedChannel(handler); assertThat(ch.pipeline().get(SslHandler.class).engine().getNeedClientAuth(), is(false)); @@ -144,7 +138,6 @@ public class SecurityNetty4TransportTests extends ESTestCase { .build(); sslService = new SSLService(settings, env); SecurityNetty4Transport transport = createTransport(settings); - Netty4MockUtil.setOpenChannelsHandlerToMock(transport); ChannelHandler handler = transport.getServerChannelInitializer("client"); final EmbeddedChannel ch = new EmbeddedChannel(handler); assertThat(ch.pipeline().get(SslHandler.class).engine().getNeedClientAuth(), is(true)); @@ -160,7 +153,6 @@ public class SecurityNetty4TransportTests extends ESTestCase { .build(); sslService = new SSLService(settings, env); SecurityNetty4Transport transport = createTransport(settings); - Netty4MockUtil.setOpenChannelsHandlerToMock(transport); ChannelHandler handler = transport.getServerChannelInitializer("client"); final EmbeddedChannel ch = new EmbeddedChannel(handler); assertThat(ch.pipeline().get(SslHandler.class).engine().getNeedClientAuth(), is(false)); @@ -176,7 +168,6 @@ public class SecurityNetty4TransportTests extends ESTestCase { .build(); sslService = new SSLService(settings, env); SecurityNetty4Transport transport = createTransport(settings); - Netty4MockUtil.setOpenChannelsHandlerToMock(transport); final ChannelHandler handler = transport.getServerChannelInitializer("client"); final EmbeddedChannel ch = new EmbeddedChannel(handler); assertThat(ch.pipeline().get(SslHandler.class).engine().getNeedClientAuth(), is(false)); @@ -200,7 +191,6 @@ public class SecurityNetty4TransportTests extends ESTestCase { env = TestEnvironment.newEnvironment(settings); sslService = new SSLService(settings, env); SecurityNetty4Transport transport = createTransport(settings); - Netty4MockUtil.setOpenChannelsHandlerToMock(transport); final ChannelHandler handler = transport.getServerChannelInitializer("default"); final EmbeddedChannel ch = new EmbeddedChannel(handler); final SSLEngine engine = ch.pipeline().get(SslHandler.class).engine();