From d2703153e31027848028782bc5a5c1eb5ce7dbb0 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Mon, 14 Aug 2023 22:51:48 -0400 Subject: [PATCH] [BUG] The spotless should take care of unified imports ordering (buildSrc/ subprojects) (#9314) (#9329) (cherry picked from commit 479850235cf9bfd545a83037e3b3a674bf8c0c38) Signed-off-by: Andriy Redko Signed-off-by: github-actions[bot] Co-authored-by: github-actions[bot] --- .../org/opensearch/gradle/ConcatFilesTask.java | 16 ++++++++-------- .../org/opensearch/gradle/EmptyDirTask.java | 8 ++++---- .../java/org/opensearch/gradle/LoggedExec.java | 1 + .../gradle/OpenSearchJavaPlugin.java | 1 + .../gradle/OpenSearchTestBasePlugin.java | 1 + .../gradle/docker/DockerBuildTask.java | 1 + .../gradle/docker/DockerSupportService.java | 3 ++- .../gradle/http/WaitForHttpResource.java | 1 + .../gradle/info/GlobalBuildInfoPlugin.java | 1 + .../gradle/internal/InternalBwcGitPlugin.java | 2 ++ ...InternalDistributionArchiveCheckPlugin.java | 1 + ...InternalDistributionArchiveSetupPlugin.java | 3 ++- .../InternalDistributionBwcSetupPlugin.java | 1 + .../opensearch/gradle/pluginzip/Publish.java | 5 ++--- .../gradle/precommit/FilePermissionsTask.java | 18 +++++++++--------- .../ForbiddenApisPrecommitPlugin.java | 2 ++ .../gradle/precommit/JarHellTask.java | 1 - .../precommit/TestingConventionsTasks.java | 4 ++-- .../gradle/precommit/ThirdPartyAuditTask.java | 1 + .../ValidateJsonAgainstSchemaTask.java | 2 ++ .../precommit/ValidateJsonNoKeywordsTask.java | 1 + .../gradle/test/DistroTestPlugin.java | 4 ++-- .../gradle/test/GradleDistroTestTask.java | 2 +- .../gradle/test/JNAKernel32Library.java | 1 + .../gradle/test/RestIntegTestTask.java | 3 +-- .../test/TestSuiteConventionMappings.java | 2 +- .../gradle/test/rest/CopyRestApiTask.java | 1 + .../gradle/test/rest/CopyRestTestsTask.java | 1 + .../gradle/testclusters/OpenSearchNode.java | 2 +- .../StandaloneRestIntegTestTask.java | 2 +- .../testclusters/TestClusterConfiguration.java | 3 ++- .../testclusters/TestClustersPlugin.java | 1 + .../testfixtures/TestFixturesPlugin.java | 6 ++++-- .../java/org/opensearch/gradle/util/Util.java | 1 + .../gradle/vagrant/VagrantMachine.java | 1 + .../gradle/ConcatFilesTaskTests.java | 8 ++++---- .../DistributionDownloadPluginTests.java | 2 +- .../opensearch/gradle/EmptyDirTaskTests.java | 13 +++++++------ .../gradle/JdkDownloadPluginTests.java | 5 ++--- .../OptionalDependenciesPluginTests.java | 4 ++-- .../gradle/plugin/PluginBuildPluginTests.java | 5 +++-- .../gradle/pluginzip/PublishTests.java | 14 ++++++-------- .../precommit/FilePermissionsTaskTests.java | 11 ++++++----- .../opensearch/gradle/test/BaseTestCase.java | 4 +++- .../gradle/test/GradleUnitTestCase.java | 1 + 45 files changed, 99 insertions(+), 72 deletions(-) diff --git a/buildSrc/src/main/java/org/opensearch/gradle/ConcatFilesTask.java b/buildSrc/src/main/java/org/opensearch/gradle/ConcatFilesTask.java index 96e3702d5a729..e5cd767ba0e67 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/ConcatFilesTask.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/ConcatFilesTask.java @@ -31,6 +31,14 @@ package org.opensearch.gradle; +import org.gradle.api.DefaultTask; +import org.gradle.api.file.FileTree; +import org.gradle.api.tasks.Input; +import org.gradle.api.tasks.InputFiles; +import org.gradle.api.tasks.Optional; +import org.gradle.api.tasks.OutputFile; +import org.gradle.api.tasks.TaskAction; + import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -40,14 +48,6 @@ import java.util.LinkedHashSet; import java.util.List; -import org.gradle.api.DefaultTask; -import org.gradle.api.file.FileTree; -import org.gradle.api.tasks.Input; -import org.gradle.api.tasks.InputFiles; -import org.gradle.api.tasks.Optional; -import org.gradle.api.tasks.OutputFile; -import org.gradle.api.tasks.TaskAction; - /** * Concatenates a list of files into one and removes duplicate lines. */ diff --git a/buildSrc/src/main/java/org/opensearch/gradle/EmptyDirTask.java b/buildSrc/src/main/java/org/opensearch/gradle/EmptyDirTask.java index f16b667f96ed4..96d7c69699c68 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/EmptyDirTask.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/EmptyDirTask.java @@ -31,16 +31,16 @@ package org.opensearch.gradle; -import java.io.File; - -import javax.inject.Inject; - import org.gradle.api.DefaultTask; import org.gradle.api.tasks.Input; import org.gradle.api.tasks.Internal; import org.gradle.api.tasks.TaskAction; import org.gradle.internal.file.Chmod; +import javax.inject.Inject; + +import java.io.File; + /** * Creates an empty directory. */ diff --git a/buildSrc/src/main/java/org/opensearch/gradle/LoggedExec.java b/buildSrc/src/main/java/org/opensearch/gradle/LoggedExec.java index 0512ed72f5e47..1a78a7dbb2d10 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/LoggedExec.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/LoggedExec.java @@ -47,6 +47,7 @@ import org.gradle.process.JavaExecSpec; import javax.inject.Inject; + import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; diff --git a/buildSrc/src/main/java/org/opensearch/gradle/OpenSearchJavaPlugin.java b/buildSrc/src/main/java/org/opensearch/gradle/OpenSearchJavaPlugin.java index edfaa06cea265..018781c7b30c4 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/OpenSearchJavaPlugin.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/OpenSearchJavaPlugin.java @@ -34,6 +34,7 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar; import nebula.plugin.info.InfoBrokerPlugin; + import org.opensearch.gradle.info.BuildParams; import org.opensearch.gradle.info.GlobalBuildInfoPlugin; import org.opensearch.gradle.precommit.PrecommitTaskPlugin; diff --git a/buildSrc/src/main/java/org/opensearch/gradle/OpenSearchTestBasePlugin.java b/buildSrc/src/main/java/org/opensearch/gradle/OpenSearchTestBasePlugin.java index 3435fb605b704..549e7f5c6d4df 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/OpenSearchTestBasePlugin.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/OpenSearchTestBasePlugin.java @@ -33,6 +33,7 @@ package org.opensearch.gradle; import com.github.jengelman.gradle.plugins.shadow.ShadowBasePlugin; + import org.opensearch.gradle.info.BuildParams; import org.opensearch.gradle.info.GlobalBuildInfoPlugin; import org.opensearch.gradle.jvm.JvmTestSuiteHelper; diff --git a/buildSrc/src/main/java/org/opensearch/gradle/docker/DockerBuildTask.java b/buildSrc/src/main/java/org/opensearch/gradle/docker/DockerBuildTask.java index bb2a6d37362e1..08f0e7488a43c 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/docker/DockerBuildTask.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/docker/DockerBuildTask.java @@ -52,6 +52,7 @@ import org.gradle.workers.WorkerExecutor; import javax.inject.Inject; + import java.io.IOException; import java.util.Arrays; diff --git a/buildSrc/src/main/java/org/opensearch/gradle/docker/DockerSupportService.java b/buildSrc/src/main/java/org/opensearch/gradle/docker/DockerSupportService.java index aa09970d53c7c..fc78792bb3551 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/docker/DockerSupportService.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/docker/DockerSupportService.java @@ -31,6 +31,7 @@ package org.opensearch.gradle.docker; +import org.apache.tools.ant.taskdefs.condition.Os; import org.opensearch.gradle.Version; import org.opensearch.gradle.info.BuildParams; import org.gradle.api.GradleException; @@ -40,9 +41,9 @@ import org.gradle.api.services.BuildServiceParameters; import org.gradle.process.ExecOperations; import org.gradle.process.ExecResult; -import org.apache.tools.ant.taskdefs.condition.Os; import javax.inject.Inject; + import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; diff --git a/buildSrc/src/main/java/org/opensearch/gradle/http/WaitForHttpResource.java b/buildSrc/src/main/java/org/opensearch/gradle/http/WaitForHttpResource.java index 41f4054910d97..6b2ee31a964ae 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/http/WaitForHttpResource.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/http/WaitForHttpResource.java @@ -39,6 +39,7 @@ import javax.net.ssl.KeyManager; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManagerFactory; + import java.io.File; import java.io.FileInputStream; import java.io.IOException; diff --git a/buildSrc/src/main/java/org/opensearch/gradle/info/GlobalBuildInfoPlugin.java b/buildSrc/src/main/java/org/opensearch/gradle/info/GlobalBuildInfoPlugin.java index bde7e916013cd..448ba8a96ef02 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/info/GlobalBuildInfoPlugin.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/info/GlobalBuildInfoPlugin.java @@ -49,6 +49,7 @@ import org.gradle.util.GradleVersion; import javax.inject.Inject; + import java.io.File; import java.io.FileInputStream; import java.io.IOException; diff --git a/buildSrc/src/main/java/org/opensearch/gradle/internal/InternalBwcGitPlugin.java b/buildSrc/src/main/java/org/opensearch/gradle/internal/InternalBwcGitPlugin.java index 11270e5c9a51d..159270d28e3d6 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/internal/InternalBwcGitPlugin.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/internal/InternalBwcGitPlugin.java @@ -50,10 +50,12 @@ import org.gradle.process.ExecSpec; import javax.inject.Inject; + import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.UncheckedIOException; + import static java.util.Arrays.asList; public class InternalBwcGitPlugin implements Plugin { diff --git a/buildSrc/src/main/java/org/opensearch/gradle/internal/InternalDistributionArchiveCheckPlugin.java b/buildSrc/src/main/java/org/opensearch/gradle/internal/InternalDistributionArchiveCheckPlugin.java index 96a2928b6e71e..4949476038bdb 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/internal/InternalDistributionArchiveCheckPlugin.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/internal/InternalDistributionArchiveCheckPlugin.java @@ -44,6 +44,7 @@ import org.gradle.api.tasks.TaskProvider; import javax.inject.Inject; + import java.io.File; import java.io.IOException; import java.nio.file.Files; diff --git a/buildSrc/src/main/java/org/opensearch/gradle/internal/InternalDistributionArchiveSetupPlugin.java b/buildSrc/src/main/java/org/opensearch/gradle/internal/InternalDistributionArchiveSetupPlugin.java index 0944f3960467b..7ab91448252f2 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/internal/InternalDistributionArchiveSetupPlugin.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/internal/InternalDistributionArchiveSetupPlugin.java @@ -41,9 +41,9 @@ import org.gradle.api.Task; import org.gradle.api.artifacts.Configuration; import org.gradle.api.artifacts.type.ArtifactTypeDefinition; -import org.gradle.api.plugins.BasePlugin; import org.gradle.api.logging.Logger; import org.gradle.api.logging.Logging; +import org.gradle.api.plugins.BasePlugin; import org.gradle.api.tasks.AbstractCopyTask; import org.gradle.api.tasks.Sync; import org.gradle.api.tasks.TaskContainer; @@ -52,6 +52,7 @@ import org.gradle.api.tasks.bundling.Compression; import org.gradle.api.tasks.bundling.Zip; import org.gradle.internal.os.OperatingSystem; + import java.io.File; import static org.opensearch.gradle.util.Util.capitalize; diff --git a/buildSrc/src/main/java/org/opensearch/gradle/internal/InternalDistributionBwcSetupPlugin.java b/buildSrc/src/main/java/org/opensearch/gradle/internal/InternalDistributionBwcSetupPlugin.java index 33869e76680cd..6892af1b17f97 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/internal/InternalDistributionBwcSetupPlugin.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/internal/InternalDistributionBwcSetupPlugin.java @@ -48,6 +48,7 @@ import org.gradle.language.base.plugins.LifecycleBasePlugin; import javax.inject.Inject; + import java.io.File; import java.util.ArrayList; import java.util.List; diff --git a/buildSrc/src/main/java/org/opensearch/gradle/pluginzip/Publish.java b/buildSrc/src/main/java/org/opensearch/gradle/pluginzip/Publish.java index de4f9f5ec80e2..a80471f6e6271 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/pluginzip/Publish.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/pluginzip/Publish.java @@ -9,16 +9,15 @@ import org.gradle.api.Plugin; import org.gradle.api.Project; +import org.gradle.api.Task; import org.gradle.api.publish.PublishingExtension; import org.gradle.api.publish.maven.MavenPublication; +import org.gradle.api.publish.maven.plugins.MavenPublishPlugin; import java.nio.file.Path; import java.util.Set; import java.util.stream.Collectors; -import org.gradle.api.Task; -import org.gradle.api.publish.maven.plugins.MavenPublishPlugin; - public class Publish implements Plugin { private final static String DEFAULT_GROUP_ID = "org.opensearch.plugin"; diff --git a/buildSrc/src/main/java/org/opensearch/gradle/precommit/FilePermissionsTask.java b/buildSrc/src/main/java/org/opensearch/gradle/precommit/FilePermissionsTask.java index d525a4a1e2c69..2c17666d8ee0c 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/precommit/FilePermissionsTask.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/precommit/FilePermissionsTask.java @@ -31,15 +31,6 @@ package org.opensearch.gradle.precommit; -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.attribute.PosixFileAttributeView; -import java.nio.file.attribute.PosixFilePermission; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - import org.apache.tools.ant.taskdefs.condition.Os; import org.opensearch.gradle.util.GradleUtils; import org.gradle.api.DefaultTask; @@ -57,6 +48,15 @@ import org.gradle.api.tasks.util.PatternFilterable; import org.gradle.api.tasks.util.PatternSet; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.attribute.PosixFileAttributeView; +import java.nio.file.attribute.PosixFilePermission; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + /** * Checks source files for correct file permissions. */ diff --git a/buildSrc/src/main/java/org/opensearch/gradle/precommit/ForbiddenApisPrecommitPlugin.java b/buildSrc/src/main/java/org/opensearch/gradle/precommit/ForbiddenApisPrecommitPlugin.java index 328edda8b1787..6b89aa8b60197 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/precommit/ForbiddenApisPrecommitPlugin.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/precommit/ForbiddenApisPrecommitPlugin.java @@ -34,7 +34,9 @@ import de.thetaphi.forbiddenapis.gradle.CheckForbiddenApis; import de.thetaphi.forbiddenapis.gradle.ForbiddenApisPlugin; + import groovy.lang.Closure; + import org.opensearch.gradle.ExportOpenSearchBuildResourcesTask; import org.opensearch.gradle.info.BuildParams; import org.opensearch.gradle.util.GradleUtils; diff --git a/buildSrc/src/main/java/org/opensearch/gradle/precommit/JarHellTask.java b/buildSrc/src/main/java/org/opensearch/gradle/precommit/JarHellTask.java index c6a0d7abf7da1..7726133562e9f 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/precommit/JarHellTask.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/precommit/JarHellTask.java @@ -33,7 +33,6 @@ package org.opensearch.gradle.precommit; import org.opensearch.gradle.LoggedExec; - import org.gradle.api.file.FileCollection; import org.gradle.api.tasks.CacheableTask; import org.gradle.api.tasks.CompileClasspath; diff --git a/buildSrc/src/main/java/org/opensearch/gradle/precommit/TestingConventionsTasks.java b/buildSrc/src/main/java/org/opensearch/gradle/precommit/TestingConventionsTasks.java index dad3bfca5f67d..d66b1f9d25cdd 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/precommit/TestingConventionsTasks.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/precommit/TestingConventionsTasks.java @@ -53,6 +53,8 @@ import org.gradle.api.tasks.util.PatternSet; import org.gradle.internal.Factory; +import javax.inject.Inject; + import java.io.File; import java.io.IOException; import java.lang.annotation.Annotation; @@ -76,8 +78,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.inject.Inject; - public class TestingConventionsTasks extends DefaultTask { private static final String TEST_METHOD_PREFIX = "test"; diff --git a/buildSrc/src/main/java/org/opensearch/gradle/precommit/ThirdPartyAuditTask.java b/buildSrc/src/main/java/org/opensearch/gradle/precommit/ThirdPartyAuditTask.java index 403b4c65f70a7..9e740b4e061cf 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/precommit/ThirdPartyAuditTask.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/precommit/ThirdPartyAuditTask.java @@ -32,6 +32,7 @@ package org.opensearch.gradle.precommit; import de.thetaphi.forbiddenapis.cli.CliMain; + import org.apache.commons.io.output.NullOutputStream; import org.opensearch.gradle.LoggedExec; import org.opensearch.gradle.OS; diff --git a/buildSrc/src/main/java/org/opensearch/gradle/precommit/ValidateJsonAgainstSchemaTask.java b/buildSrc/src/main/java/org/opensearch/gradle/precommit/ValidateJsonAgainstSchemaTask.java index 1ecc712ab27ca..d829071c07e3c 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/precommit/ValidateJsonAgainstSchemaTask.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/precommit/ValidateJsonAgainstSchemaTask.java @@ -33,12 +33,14 @@ package org.opensearch.gradle.precommit; import com.fasterxml.jackson.databind.ObjectMapper; + import com.networknt.schema.JsonSchema; import com.networknt.schema.JsonSchemaException; import com.networknt.schema.JsonSchemaFactory; import com.networknt.schema.SchemaValidatorsConfig; import com.networknt.schema.SpecVersion; import com.networknt.schema.ValidationMessage; + import org.gradle.api.DefaultTask; import org.gradle.api.UncheckedIOException; import org.gradle.api.file.FileCollection; diff --git a/buildSrc/src/main/java/org/opensearch/gradle/precommit/ValidateJsonNoKeywordsTask.java b/buildSrc/src/main/java/org/opensearch/gradle/precommit/ValidateJsonNoKeywordsTask.java index b3ac804566e29..c69420f2216b2 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/precommit/ValidateJsonNoKeywordsTask.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/precommit/ValidateJsonNoKeywordsTask.java @@ -36,6 +36,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; + import org.gradle.api.DefaultTask; import org.gradle.api.GradleException; import org.gradle.api.file.FileCollection; diff --git a/buildSrc/src/main/java/org/opensearch/gradle/test/DistroTestPlugin.java b/buildSrc/src/main/java/org/opensearch/gradle/test/DistroTestPlugin.java index a311d89583acb..a420c8b63b02c 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/test/DistroTestPlugin.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/test/DistroTestPlugin.java @@ -35,9 +35,9 @@ import org.opensearch.gradle.Architecture; import org.opensearch.gradle.DistributionDownloadPlugin; import org.opensearch.gradle.JavaPackageType; -import org.opensearch.gradle.OpenSearchDistribution; import org.opensearch.gradle.Jdk; import org.opensearch.gradle.JdkDownloadPlugin; +import org.opensearch.gradle.OpenSearchDistribution; import org.opensearch.gradle.SystemPropertyCommandLineArgumentProvider; import org.opensearch.gradle.Version; import org.opensearch.gradle.VersionProperties; @@ -49,6 +49,7 @@ import org.opensearch.gradle.util.Util; import org.opensearch.gradle.vagrant.VagrantBasePlugin; import org.opensearch.gradle.vagrant.VagrantExtension; +import org.opensearch.gradle.vagrant.VagrantMachine; import org.gradle.api.Action; import org.gradle.api.NamedDomainObjectContainer; import org.gradle.api.Plugin; @@ -62,7 +63,6 @@ import org.gradle.api.tasks.Copy; import org.gradle.api.tasks.TaskProvider; import org.gradle.api.tasks.testing.Test; -import org.opensearch.gradle.vagrant.VagrantMachine; import java.io.File; import java.util.ArrayList; diff --git a/buildSrc/src/main/java/org/opensearch/gradle/test/GradleDistroTestTask.java b/buildSrc/src/main/java/org/opensearch/gradle/test/GradleDistroTestTask.java index 2443a30fc05fb..fa417da1a1007 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/test/GradleDistroTestTask.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/test/GradleDistroTestTask.java @@ -32,10 +32,10 @@ package org.opensearch.gradle.test; +import org.opensearch.gradle.vagrant.VagrantMachine; import org.opensearch.gradle.vagrant.VagrantShellTask; import org.gradle.api.tasks.Input; import org.gradle.api.tasks.options.Option; -import org.opensearch.gradle.vagrant.VagrantMachine; import java.util.ArrayList; import java.util.Collections; diff --git a/buildSrc/src/main/java/org/opensearch/gradle/test/JNAKernel32Library.java b/buildSrc/src/main/java/org/opensearch/gradle/test/JNAKernel32Library.java index 9d575364f5546..1484dcba1e290 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/test/JNAKernel32Library.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/test/JNAKernel32Library.java @@ -34,6 +34,7 @@ import com.sun.jna.Native; import com.sun.jna.WString; + import org.apache.tools.ant.taskdefs.condition.Os; public class JNAKernel32Library { diff --git a/buildSrc/src/main/java/org/opensearch/gradle/test/RestIntegTestTask.java b/buildSrc/src/main/java/org/opensearch/gradle/test/RestIntegTestTask.java index 87aa3ea4eae8d..c09db55d0080c 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/test/RestIntegTestTask.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/test/RestIntegTestTask.java @@ -32,10 +32,9 @@ package org.opensearch.gradle.test; -import org.opensearch.gradle.testclusters.StandaloneRestIntegTestTask; - import groovy.lang.Closure; +import org.opensearch.gradle.testclusters.StandaloneRestIntegTestTask; import org.gradle.api.Task; import org.gradle.api.tasks.CacheableTask; diff --git a/buildSrc/src/main/java/org/opensearch/gradle/test/TestSuiteConventionMappings.java b/buildSrc/src/main/java/org/opensearch/gradle/test/TestSuiteConventionMappings.java index 12096b8d365f4..f03b59509a2f9 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/test/TestSuiteConventionMappings.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/test/TestSuiteConventionMappings.java @@ -8,9 +8,9 @@ package org.opensearch.gradle.test; +import org.opensearch.gradle.jvm.JvmTestSuiteHelper; import org.gradle.api.Project; import org.gradle.api.internal.ConventionMapping; -import org.opensearch.gradle.jvm.JvmTestSuiteHelper; // Temporary workaround for https://docs.gradle.org/8.1/userguide/upgrading_version_8.html#test_task_default_classpath interface TestSuiteConventionMappings { diff --git a/buildSrc/src/main/java/org/opensearch/gradle/test/rest/CopyRestApiTask.java b/buildSrc/src/main/java/org/opensearch/gradle/test/rest/CopyRestApiTask.java index 0275664276877..485561a305291 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/test/rest/CopyRestApiTask.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/test/rest/CopyRestApiTask.java @@ -57,6 +57,7 @@ import org.gradle.internal.Factory; import javax.inject.Inject; + import java.io.File; import java.io.IOException; import java.nio.file.Files; diff --git a/buildSrc/src/main/java/org/opensearch/gradle/test/rest/CopyRestTestsTask.java b/buildSrc/src/main/java/org/opensearch/gradle/test/rest/CopyRestTestsTask.java index ebd6c49fd6157..0d5af7ca06b50 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/test/rest/CopyRestTestsTask.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/test/rest/CopyRestTestsTask.java @@ -57,6 +57,7 @@ import org.gradle.internal.Factory; import javax.inject.Inject; + import java.io.File; import java.util.Objects; import java.util.Optional; diff --git a/buildSrc/src/main/java/org/opensearch/gradle/testclusters/OpenSearchNode.java b/buildSrc/src/main/java/org/opensearch/gradle/testclusters/OpenSearchNode.java index 9040dfcb97822..fca34780351c6 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/testclusters/OpenSearchNode.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/testclusters/OpenSearchNode.java @@ -34,13 +34,13 @@ import org.apache.commons.io.FileUtils; import org.opensearch.gradle.Architecture; import org.opensearch.gradle.DistributionDownloadPlugin; -import org.opensearch.gradle.OpenSearchDistribution; import org.opensearch.gradle.FileSupplier; import org.opensearch.gradle.Jdk; import org.opensearch.gradle.LazyPropertyList; import org.opensearch.gradle.LazyPropertyMap; import org.opensearch.gradle.LoggedExec; import org.opensearch.gradle.OS; +import org.opensearch.gradle.OpenSearchDistribution; import org.opensearch.gradle.PropertyNormalization; import org.opensearch.gradle.ReaperService; import org.opensearch.gradle.Version; diff --git a/buildSrc/src/main/java/org/opensearch/gradle/testclusters/StandaloneRestIntegTestTask.java b/buildSrc/src/main/java/org/opensearch/gradle/testclusters/StandaloneRestIntegTestTask.java index abc92c10285ee..214240f05558d 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/testclusters/StandaloneRestIntegTestTask.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/testclusters/StandaloneRestIntegTestTask.java @@ -38,8 +38,8 @@ import org.opensearch.gradle.util.GradleUtils; import org.gradle.api.Task; import org.gradle.api.provider.Provider; -import org.gradle.api.services.internal.BuildServiceRegistryInternal; import org.gradle.api.services.internal.BuildServiceProvider; +import org.gradle.api.services.internal.BuildServiceRegistryInternal; import org.gradle.api.tasks.CacheableTask; import org.gradle.api.tasks.Internal; import org.gradle.api.tasks.Nested; diff --git a/buildSrc/src/main/java/org/opensearch/gradle/testclusters/TestClusterConfiguration.java b/buildSrc/src/main/java/org/opensearch/gradle/testclusters/TestClusterConfiguration.java index 87cce2f0b32c0..70773884eb920 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/testclusters/TestClusterConfiguration.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/testclusters/TestClusterConfiguration.java @@ -36,7 +36,6 @@ import org.gradle.api.file.RegularFile; import org.gradle.api.logging.Logging; import org.gradle.api.provider.Provider; -import org.slf4j.Logger; import java.io.File; import java.util.LinkedHashMap; @@ -47,6 +46,8 @@ import java.util.function.Predicate; import java.util.function.Supplier; +import org.slf4j.Logger; + public interface TestClusterConfiguration { void setVersion(String version); diff --git a/buildSrc/src/main/java/org/opensearch/gradle/testclusters/TestClustersPlugin.java b/buildSrc/src/main/java/org/opensearch/gradle/testclusters/TestClustersPlugin.java index 2ef14a39b6669..b8ba1e6a90976 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/testclusters/TestClustersPlugin.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/testclusters/TestClustersPlugin.java @@ -57,6 +57,7 @@ import org.gradle.api.tasks.TaskState; import javax.inject.Inject; + import java.io.File; import static org.opensearch.gradle.util.GradleUtils.noop; diff --git a/buildSrc/src/main/java/org/opensearch/gradle/testfixtures/TestFixturesPlugin.java b/buildSrc/src/main/java/org/opensearch/gradle/testfixtures/TestFixturesPlugin.java index ae1db26fbc48d..3aba941875115 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/testfixtures/TestFixturesPlugin.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/testfixtures/TestFixturesPlugin.java @@ -37,6 +37,8 @@ import com.avast.gradle.dockercompose.tasks.ComposeDown; import com.avast.gradle.dockercompose.tasks.ComposePull; import com.avast.gradle.dockercompose.tasks.ComposeUp; + +import org.apache.tools.ant.taskdefs.condition.Os; import org.opensearch.gradle.SystemPropertyCommandLineArgumentProvider; import org.opensearch.gradle.docker.DockerSupportPlugin; import org.opensearch.gradle.docker.DockerSupportService; @@ -57,17 +59,17 @@ import org.gradle.api.tasks.TaskContainer; import org.gradle.api.tasks.TaskProvider; import org.gradle.api.tasks.testing.Test; -import org.apache.tools.ant.taskdefs.condition.Os; import javax.inject.Inject; + import java.io.File; import java.io.IOException; import java.io.UncheckedIOException; import java.nio.file.Files; import java.util.Arrays; import java.util.Collections; -import java.util.function.BiConsumer; import java.util.Optional; +import java.util.function.BiConsumer; public class TestFixturesPlugin implements Plugin { diff --git a/buildSrc/src/main/java/org/opensearch/gradle/util/Util.java b/buildSrc/src/main/java/org/opensearch/gradle/util/Util.java index a4d2c59cf8cad..a2fd1e247b660 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/util/Util.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/util/Util.java @@ -42,6 +42,7 @@ import org.gradle.api.tasks.util.PatternFilterable; import javax.annotation.Nullable; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; diff --git a/buildSrc/src/main/java/org/opensearch/gradle/vagrant/VagrantMachine.java b/buildSrc/src/main/java/org/opensearch/gradle/vagrant/VagrantMachine.java index 75827922fa007..2d71b9361963b 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/vagrant/VagrantMachine.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/vagrant/VagrantMachine.java @@ -43,6 +43,7 @@ import org.gradle.internal.logging.progress.ProgressLoggerFactory; import javax.inject.Inject; + import java.io.File; import java.io.OutputStream; import java.nio.file.Paths; diff --git a/buildSrc/src/test/java/org/opensearch/gradle/ConcatFilesTaskTests.java b/buildSrc/src/test/java/org/opensearch/gradle/ConcatFilesTaskTests.java index 3b9c1c81e0345..0484939ca4698 100644 --- a/buildSrc/src/test/java/org/opensearch/gradle/ConcatFilesTaskTests.java +++ b/buildSrc/src/test/java/org/opensearch/gradle/ConcatFilesTaskTests.java @@ -31,16 +31,16 @@ package org.opensearch.gradle; +import org.opensearch.gradle.test.GradleUnitTestCase; +import org.gradle.api.Project; +import org.gradle.testfixtures.ProjectBuilder; + import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.util.Arrays; -import org.opensearch.gradle.test.GradleUnitTestCase; -import org.gradle.api.Project; -import org.gradle.testfixtures.ProjectBuilder; - public class ConcatFilesTaskTests extends GradleUnitTestCase { public void testHeaderAdded() throws IOException { diff --git a/buildSrc/src/test/java/org/opensearch/gradle/DistributionDownloadPluginTests.java b/buildSrc/src/test/java/org/opensearch/gradle/DistributionDownloadPluginTests.java index f9c28d70261b7..514e169700fd9 100644 --- a/buildSrc/src/test/java/org/opensearch/gradle/DistributionDownloadPluginTests.java +++ b/buildSrc/src/test/java/org/opensearch/gradle/DistributionDownloadPluginTests.java @@ -32,13 +32,13 @@ package org.opensearch.gradle; -import org.gradle.api.internal.artifacts.repositories.DefaultIvyArtifactRepository; import org.opensearch.gradle.OpenSearchDistribution.Platform; import org.opensearch.gradle.OpenSearchDistribution.Type; import org.opensearch.gradle.info.BuildParams; import org.opensearch.gradle.test.GradleUnitTestCase; import org.gradle.api.NamedDomainObjectContainer; import org.gradle.api.Project; +import org.gradle.api.internal.artifacts.repositories.DefaultIvyArtifactRepository; import org.gradle.testfixtures.ProjectBuilder; import java.io.File; diff --git a/buildSrc/src/test/java/org/opensearch/gradle/EmptyDirTaskTests.java b/buildSrc/src/test/java/org/opensearch/gradle/EmptyDirTaskTests.java index a6dc268b90557..ad5b8385abaf8 100644 --- a/buildSrc/src/test/java/org/opensearch/gradle/EmptyDirTaskTests.java +++ b/buildSrc/src/test/java/org/opensearch/gradle/EmptyDirTaskTests.java @@ -31,18 +31,19 @@ package org.opensearch.gradle; -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.InvalidPathException; -import java.nio.file.Path; - import com.carrotsearch.randomizedtesting.RandomizedTest; + import org.apache.tools.ant.taskdefs.condition.Os; import org.opensearch.gradle.test.GradleUnitTestCase; import org.gradle.api.Project; import org.gradle.testfixtures.ProjectBuilder; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.InvalidPathException; +import java.nio.file.Path; + public class EmptyDirTaskTests extends GradleUnitTestCase { public void testCreateEmptyDir() throws Exception { diff --git a/buildSrc/src/test/java/org/opensearch/gradle/JdkDownloadPluginTests.java b/buildSrc/src/test/java/org/opensearch/gradle/JdkDownloadPluginTests.java index 55a1eaec98d82..bb394cf51429f 100644 --- a/buildSrc/src/test/java/org/opensearch/gradle/JdkDownloadPluginTests.java +++ b/buildSrc/src/test/java/org/opensearch/gradle/JdkDownloadPluginTests.java @@ -33,14 +33,13 @@ package org.opensearch.gradle; import org.opensearch.gradle.test.GradleUnitTestCase; - -import java.util.UUID; - import org.gradle.api.NamedDomainObjectContainer; import org.gradle.api.Project; import org.gradle.testfixtures.ProjectBuilder; import org.junit.BeforeClass; +import java.util.UUID; + import static org.hamcrest.CoreMatchers.equalTo; public class JdkDownloadPluginTests extends GradleUnitTestCase { diff --git a/buildSrc/src/test/java/org/opensearch/gradle/plugin/OptionalDependenciesPluginTests.java b/buildSrc/src/test/java/org/opensearch/gradle/plugin/OptionalDependenciesPluginTests.java index ee29f5653d18a..76b669a73610e 100644 --- a/buildSrc/src/test/java/org/opensearch/gradle/plugin/OptionalDependenciesPluginTests.java +++ b/buildSrc/src/test/java/org/opensearch/gradle/plugin/OptionalDependenciesPluginTests.java @@ -12,12 +12,12 @@ import org.apache.maven.model.Model; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; +import org.opensearch.gradle.test.GradleUnitTestCase; import org.gradle.testkit.runner.BuildResult; import org.gradle.testkit.runner.GradleRunner; import org.junit.After; import org.junit.Before; import org.junit.rules.TemporaryFolder; -import org.opensearch.gradle.test.GradleUnitTestCase; import java.io.File; import java.io.FileNotFoundException; @@ -28,8 +28,8 @@ import java.io.OutputStream; import java.util.Optional; -import static org.gradle.testkit.runner.TaskOutcome.SUCCESS; import static org.hamcrest.CoreMatchers.is; +import static org.gradle.testkit.runner.TaskOutcome.SUCCESS; public class OptionalDependenciesPluginTests extends GradleUnitTestCase { private TemporaryFolder projectDir; diff --git a/buildSrc/src/test/java/org/opensearch/gradle/plugin/PluginBuildPluginTests.java b/buildSrc/src/test/java/org/opensearch/gradle/plugin/PluginBuildPluginTests.java index 8772a9fbd65ee..fa0693a258222 100644 --- a/buildSrc/src/test/java/org/opensearch/gradle/plugin/PluginBuildPluginTests.java +++ b/buildSrc/src/test/java/org/opensearch/gradle/plugin/PluginBuildPluginTests.java @@ -31,19 +31,20 @@ package org.opensearch.gradle.plugin; -import org.gradle.api.tasks.bundling.AbstractArchiveTask; import org.opensearch.gradle.BwcVersions; import org.opensearch.gradle.test.GradleUnitTestCase; import org.gradle.api.Project; import org.gradle.api.Task; import org.gradle.api.internal.project.ProjectInternal; +import org.gradle.api.tasks.bundling.AbstractArchiveTask; import org.gradle.testfixtures.ProjectBuilder; import org.junit.Before; import org.junit.Ignore; -import org.mockito.Mockito; import java.util.stream.Collectors; +import org.mockito.Mockito; + public class PluginBuildPluginTests extends GradleUnitTestCase { private Project project; diff --git a/buildSrc/src/test/java/org/opensearch/gradle/pluginzip/PublishTests.java b/buildSrc/src/test/java/org/opensearch/gradle/pluginzip/PublishTests.java index 6b2559b159abe..5c26472cbd33e 100644 --- a/buildSrc/src/test/java/org/opensearch/gradle/pluginzip/PublishTests.java +++ b/buildSrc/src/test/java/org/opensearch/gradle/pluginzip/PublishTests.java @@ -8,12 +8,15 @@ package org.opensearch.gradle.pluginzip; +import org.apache.maven.model.Model; +import org.apache.maven.model.io.xpp3.MavenXpp3Reader; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; +import org.opensearch.gradle.test.GradleUnitTestCase; import org.gradle.api.Project; import org.gradle.testfixtures.ProjectBuilder; import org.gradle.testkit.runner.BuildResult; import org.gradle.testkit.runner.GradleRunner; import org.gradle.testkit.runner.UnexpectedBuildFailure; -import org.opensearch.gradle.test.GradleUnitTestCase; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -28,17 +31,12 @@ import java.net.URL; import java.nio.charset.StandardCharsets; import java.nio.file.Files; - -import static org.gradle.testkit.runner.TaskOutcome.SUCCESS; - -import org.apache.maven.model.Model; -import org.apache.maven.model.io.xpp3.MavenXpp3Reader; -import org.codehaus.plexus.util.xml.pull.XmlPullParserException; - import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; +import static org.gradle.testkit.runner.TaskOutcome.SUCCESS; + public class PublishTests extends GradleUnitTestCase { private TemporaryFolder projectDir; private static final String TEMPLATE_RESOURCE_FOLDER = "pluginzip"; diff --git a/buildSrc/src/test/java/org/opensearch/gradle/precommit/FilePermissionsTaskTests.java b/buildSrc/src/test/java/org/opensearch/gradle/precommit/FilePermissionsTaskTests.java index f47964dd17a7a..0a8cff734ea97 100644 --- a/buildSrc/src/test/java/org/opensearch/gradle/precommit/FilePermissionsTaskTests.java +++ b/buildSrc/src/test/java/org/opensearch/gradle/precommit/FilePermissionsTaskTests.java @@ -31,12 +31,8 @@ package org.opensearch.gradle.precommit; -import java.io.File; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.util.List; - import com.carrotsearch.randomizedtesting.RandomizedTest; + import org.apache.tools.ant.taskdefs.condition.Os; import org.opensearch.gradle.test.GradleUnitTestCase; import org.gradle.api.GradleException; @@ -45,6 +41,11 @@ import org.gradle.testfixtures.ProjectBuilder; import org.junit.Assert; +import java.io.File; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.util.List; + public class FilePermissionsTaskTests extends GradleUnitTestCase { public void testCheckPermissionsWhenAnExecutableFileExists() throws Exception { diff --git a/buildSrc/src/testFixtures/java/org/opensearch/gradle/test/BaseTestCase.java b/buildSrc/src/testFixtures/java/org/opensearch/gradle/test/BaseTestCase.java index 8e06a1cad0241..f285dcbfd3bd2 100644 --- a/buildSrc/src/testFixtures/java/org/opensearch/gradle/test/BaseTestCase.java +++ b/buildSrc/src/testFixtures/java/org/opensearch/gradle/test/BaseTestCase.java @@ -35,10 +35,12 @@ import com.carrotsearch.randomizedtesting.RandomizedRunner; import com.carrotsearch.randomizedtesting.annotations.TestMethodProviders; import com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering; -import junit.framework.AssertionFailedError; + import org.junit.Assert; import org.junit.runner.RunWith; +import junit.framework.AssertionFailedError; + @RunWith(RandomizedRunner.class) @TestMethodProviders({ JUnit4MethodProvider.class, JUnit3MethodProvider.class }) @ThreadLeakLingering(linger = 5000) // wait for "Connection worker" to die diff --git a/buildSrc/src/testFixtures/java/org/opensearch/gradle/test/GradleUnitTestCase.java b/buildSrc/src/testFixtures/java/org/opensearch/gradle/test/GradleUnitTestCase.java index a50a14a0ea932..f8032ba53df4c 100644 --- a/buildSrc/src/testFixtures/java/org/opensearch/gradle/test/GradleUnitTestCase.java +++ b/buildSrc/src/testFixtures/java/org/opensearch/gradle/test/GradleUnitTestCase.java @@ -35,6 +35,7 @@ import com.carrotsearch.randomizedtesting.RandomizedRunner; import com.carrotsearch.randomizedtesting.annotations.TestMethodProviders; import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters; + import org.junit.runner.RunWith; @RunWith(RandomizedRunner.class)