From 8015560bd4c02b11e0c92f60d87b875d8bc6b1b5 Mon Sep 17 00:00:00 2001 From: Alpar Torok Date: Wed, 19 Dec 2018 08:06:48 +0200 Subject: [PATCH] Remove line length supressions from plugins (#36708) --- .../resources/checkstyle_suppressions.xml | 3 --- .../elasticsearch/plugins/PluginsService.java | 8 ++++++- .../plugins/PluginsServiceTests.java | 21 ++++++++++++++----- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/buildSrc/src/main/resources/checkstyle_suppressions.xml b/buildSrc/src/main/resources/checkstyle_suppressions.xml index 55fdcecb084..1e8b6948ea6 100644 --- a/buildSrc/src/main/resources/checkstyle_suppressions.xml +++ b/buildSrc/src/main/resources/checkstyle_suppressions.xml @@ -48,7 +48,6 @@ - @@ -63,12 +62,10 @@ - - diff --git a/server/src/main/java/org/elasticsearch/plugins/PluginsService.java b/server/src/main/java/org/elasticsearch/plugins/PluginsService.java index 2837add3c90..240837077e1 100644 --- a/server/src/main/java/org/elasticsearch/plugins/PluginsService.java +++ b/server/src/main/java/org/elasticsearch/plugins/PluginsService.java @@ -100,7 +100,13 @@ public class PluginsService { * @param pluginsDirectory The directory plugins exist in, or null if plugins should not be loaded from the filesystem * @param classpathPlugins Plugins that exist in the classpath which should be loaded */ - public PluginsService(Settings settings, Path configPath, Path modulesDirectory, Path pluginsDirectory, Collection> classpathPlugins) { + public PluginsService( + Settings settings, + Path configPath, + Path modulesDirectory, + Path pluginsDirectory, + Collection> classpathPlugins + ) { this.settings = settings; this.configPath = configPath; diff --git a/server/src/test/java/org/elasticsearch/plugins/PluginsServiceTests.java b/server/src/test/java/org/elasticsearch/plugins/PluginsServiceTests.java index f6649853eda..e447107aac8 100644 --- a/server/src/test/java/org/elasticsearch/plugins/PluginsServiceTests.java +++ b/server/src/test/java/org/elasticsearch/plugins/PluginsServiceTests.java @@ -62,7 +62,10 @@ public class PluginsServiceTests extends ESTestCase { public static class AdditionalSettingsPlugin1 extends Plugin { @Override public Settings additionalSettings() { - return Settings.builder().put("foo.bar", "1").put(IndexModule.INDEX_STORE_TYPE_SETTING.getKey(), IndexModule.Type.MMAPFS.getSettingsKey()).build(); + return Settings.builder() + .put("foo.bar", "1") + .put(IndexModule.INDEX_STORE_TYPE_SETTING.getKey(), IndexModule.Type.MMAPFS.getSettingsKey()) + .build(); } } public static class AdditionalSettingsPlugin2 extends Plugin { @@ -75,7 +78,10 @@ public class PluginsServiceTests extends ESTestCase { public static class FilterablePlugin extends Plugin implements ScriptPlugin {} static PluginsService newPluginsService(Settings settings, Class... classpathPlugins) { - return new PluginsService(settings, null, null, TestEnvironment.newEnvironment(settings).pluginsFile(), Arrays.asList(classpathPlugins)); + return new PluginsService( + settings, null, null, + TestEnvironment.newEnvironment(settings).pluginsFile(), Arrays.asList(classpathPlugins) + ); } public void testAdditionalSettings() { @@ -87,7 +93,10 @@ public class PluginsServiceTests extends ESTestCase { Settings newSettings = service.updatedSettings(); assertEquals("test", newSettings.get("my.setting")); // previous settings still exist assertEquals("1", newSettings.get("foo.bar")); // added setting exists - assertEquals(IndexModule.Type.SIMPLEFS.getSettingsKey(), newSettings.get(IndexModule.INDEX_STORE_TYPE_SETTING.getKey())); // does not override pre existing settings + assertEquals( + IndexModule.Type.SIMPLEFS.getSettingsKey(), + newSettings.get(IndexModule.INDEX_STORE_TYPE_SETTING.getKey()) + ); // does not override pre existing settings } public void testAdditionalSettingsClash() { @@ -228,8 +237,10 @@ public class PluginsServiceTests extends ESTestCase { final Path home = createTempDir(); final Settings settings = Settings.builder().put(Environment.PATH_HOME_SETTING.getKey(), home).build(); - final IllegalStateException e = - expectThrows(IllegalStateException.class, () -> newPluginsService(settings, MultiplePublicConstructorsPlugin.class)); + final IllegalStateException e = expectThrows( + IllegalStateException.class, + () -> newPluginsService(settings, MultiplePublicConstructorsPlugin.class) + ); assertThat(e, hasToString(containsString("no unique public constructor"))); }