NIFI-7840: Upgrade to Groovy 3.0.8 and Spock 2.1

This closes #5699

Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
Matthew Burgess 2022-01-21 14:23:23 -05:00 committed by exceptionfactory
parent 4000b01909
commit bb24030f4a
No known key found for this signature in database
GPG Key ID: 29B6A52D2AAE8DBA
21 changed files with 67 additions and 84 deletions

View File

@ -33,7 +33,7 @@ limitations under the License.
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

View File

@ -46,7 +46,7 @@ limitations under the License.
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

View File

@ -59,7 +59,7 @@ limitations under the License.
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

View File

@ -37,7 +37,7 @@ limitations under the License.
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

View File

@ -55,7 +55,7 @@ limitations under the License.
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
@ -471,8 +471,8 @@ limitations under the License.
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
@ -864,12 +864,13 @@ limitations under the License.
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.5</version>
<version>3.0.8</version>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>1.0-groovy-2.4</version>
<version>2.1-M2-groovy-3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>

View File

@ -31,7 +31,7 @@
</modules>
<properties>
<scripting.groovy.version>2.5.14</scripting.groovy.version>
<scripting.groovy.version>3.0.8</scripting.groovy.version>
</properties>
<dependencyManagement>

View File

@ -224,7 +224,7 @@
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>1.3-groovy-2.5</version>
<version>2.1-M2-groovy-3.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
@ -239,6 +239,12 @@
<version>${nifi.groovy.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-cli-commons</artifactId>
<version>${nifi.groovy.version}</version>
<type>test</type>
</dependency>
</dependencies>
</dependencyManagement>

View File

@ -19,10 +19,9 @@ package org.apache.nifi.toolkit.admin.configmigrator
import org.apache.commons.io.FileUtils
import org.apache.commons.lang3.SystemUtils
import org.junit.Assume
import org.junit.BeforeClass
import org.junit.Rule
import org.junit.contrib.java.lang.system.SystemOutRule
import spock.lang.IgnoreIf
import spock.lang.Specification
import org.junit.contrib.java.lang.system.ExpectedSystemExit
@ -37,11 +36,7 @@ class ConfigMigratorSpec extends Specification{
@Rule
public SystemOutRule systemOutRule = new SystemOutRule().enableLog()
@BeforeClass
static void setUpOnce() throws Exception {
Assume.assumeTrue("Test only runs on *nix", !SystemUtils.IS_OS_WINDOWS)
}
@IgnoreIf({os.windows})
def "get rules directory name"(){
setup:
@ -61,6 +56,7 @@ class ConfigMigratorSpec extends Specification{
}
@IgnoreIf({os.windows})
def "get script rule name"(){
setup:
@ -77,6 +73,7 @@ class ConfigMigratorSpec extends Specification{
}
@IgnoreIf({os.windows})
def "parse argument and migrate property config successfully"(){
setup:
@ -112,6 +109,7 @@ class ConfigMigratorSpec extends Specification{
}
@IgnoreIf({os.windows})
def "parse argument and move over configs due to no rules successfully"(){
setup:
@ -147,6 +145,7 @@ class ConfigMigratorSpec extends Specification{
}
@IgnoreIf({os.windows})
def "parse arguments and migrate property config successfully with override"(){
setup:

View File

@ -19,11 +19,10 @@ package org.apache.nifi.toolkit.admin.filemanager
import org.apache.commons.cli.ParseException
import org.apache.commons.io.FileUtils
import org.apache.commons.lang3.SystemUtils
import org.junit.Assume
import org.junit.BeforeClass
import org.junit.Rule
import org.junit.contrib.java.lang.system.ExpectedSystemExit
import org.junit.contrib.java.lang.system.SystemOutRule
import spock.lang.IgnoreIf
import spock.lang.Specification
import java.nio.file.Files
@ -36,23 +35,7 @@ class FileManagerToolSpec extends Specification{
@Rule
public SystemOutRule systemOutRule = new SystemOutRule().enableLog()
@BeforeClass
static void setUpOnce() throws Exception {
Assume.assumeTrue("Test only runs on *nix", !SystemUtils.IS_OS_WINDOWS)
}
def "print help and usage info"() {
given:
def manager = new FileManagerTool()
when:
manager.parse(["-h"] as String[])
then:
systemOutRule.getLog().contains("usage: org.apache.nifi.toolkit.admin.filemanager.FileManagerTool")
}
@IgnoreIf({os.windows})
def "throws exception missing operation flag"() {
given:
@ -66,6 +49,7 @@ class FileManagerToolSpec extends Specification{
e.message == "Missing -o option"
}
@IgnoreIf({os.windows})
def "throws exception if missing upgrade file for install"() {
given:
@ -79,6 +63,7 @@ class FileManagerToolSpec extends Specification{
e.message == "Missing -i option"
}
@IgnoreIf({os.windows})
def "throws exception if missing install directory for install"() {
given:
@ -92,6 +77,7 @@ class FileManagerToolSpec extends Specification{
e.message == "Missing -d option"
}
@IgnoreIf({os.windows})
def "throws exception if missing current directory when moving repositories for install"() {
given:
@ -105,7 +91,7 @@ class FileManagerToolSpec extends Specification{
e.message == "Missing -c option: Moving repositories requires current nifi directory"
}
@IgnoreIf({os.windows})
def "throws exception if missing backup directory for backup"() {
given:
@ -119,6 +105,7 @@ class FileManagerToolSpec extends Specification{
e.message == "Missing -b option"
}
@IgnoreIf({os.windows})
def "throws exception if missing current dir for backup"() {
given:
@ -132,6 +119,7 @@ class FileManagerToolSpec extends Specification{
e.message == "Missing -c option"
}
@IgnoreIf({os.windows})
def "throws exception if missing rollback directory for restore"() {
given:
@ -145,6 +133,7 @@ class FileManagerToolSpec extends Specification{
e.message == "Missing -r option"
}
@IgnoreIf({os.windows})
def "throws exception if missing backup directory for restore"() {
given:
@ -158,6 +147,7 @@ class FileManagerToolSpec extends Specification{
e.message == "Missing -b option"
}
@IgnoreIf({os.windows})
def "throws exception if missing current directory when wanting to move repositories during install"() {
given:
@ -171,7 +161,7 @@ class FileManagerToolSpec extends Specification{
e.message == "Missing -c option: Moving repositories requires current nifi directory"
}
@IgnoreIf({os.windows})
def "move directory from src to target"(){
setup:
@ -196,6 +186,7 @@ class FileManagerToolSpec extends Specification{
}
@IgnoreIf({os.windows})
def "move zookeeper from src to target"(){
setup:
@ -223,6 +214,7 @@ class FileManagerToolSpec extends Specification{
}
@IgnoreIf({os.windows})
def "move repositories from src to target"(){
setup:
@ -264,6 +256,7 @@ class FileManagerToolSpec extends Specification{
}
@IgnoreIf({os.windows})
def "backup nifi installation successfully"(){
setup:
@ -311,6 +304,7 @@ class FileManagerToolSpec extends Specification{
}
@IgnoreIf({os.windows})
def "restore nifi installation successfully"(){
setup:
@ -382,6 +376,7 @@ class FileManagerToolSpec extends Specification{
}
@IgnoreIf({os.windows})
def "extract compressed tar file successfully"(){
setup:
@ -404,6 +399,7 @@ class FileManagerToolSpec extends Specification{
}
@IgnoreIf({os.windows})
def "extract zip file successfully"(){
setup:
@ -427,6 +423,7 @@ class FileManagerToolSpec extends Specification{
}
@IgnoreIf({os.windows})
def "install nifi with existing installation successfully"(){
setup:
def File tmpDir = setupTmpDir()
@ -463,6 +460,7 @@ class FileManagerToolSpec extends Specification{
}
@IgnoreIf({os.windows})
def "install nifi without existing installation successfully"(){
setup:
def File tmpDir = setupTmpDir()

View File

@ -26,6 +26,7 @@ import org.apache.nifi.web.api.entity.NodeEntity
import org.junit.Rule
import org.junit.contrib.java.lang.system.ExpectedSystemExit
import org.junit.contrib.java.lang.system.SystemOutRule
import spock.lang.Ignore
import spock.lang.Specification
import javax.ws.rs.client.Client
@ -41,20 +42,6 @@ class NodeManagerToolSpec extends Specification{
@Rule
public SystemOutRule systemOutRule = new SystemOutRule().enableLog()
def "print help and usage info"() {
given:
def ClientFactory clientFactory = Mock ClientFactory
def config = new NodeManagerTool()
when:
config.parse(clientFactory,["-h"] as String[])
then:
systemOutRule.getLog().contains("usage: org.apache.nifi.toolkit.admin.nodemanager.NodeManagerTool")
}
def "throws exception missing bootstrap conf flag"() {
given:

View File

@ -25,6 +25,7 @@ import org.apache.nifi.toolkit.tls.standalone.TlsToolkitStandaloneCommandLine
import org.junit.Rule
import org.junit.contrib.java.lang.system.ExpectedSystemExit
import org.junit.contrib.java.lang.system.SystemOutRule
import spock.lang.Ignore
import spock.lang.Specification
import javax.ws.rs.client.Client
@ -42,20 +43,6 @@ class NotificationToolSpec extends Specification{
@Rule
public SystemOutRule systemOutRule = new SystemOutRule().enableLog()
def "print help and usage info"() {
given:
def ClientFactory clientFactory = Mock ClientFactory
def config = new NotificationTool()
when:
config.parse(clientFactory,["-h"] as String[])
then:
systemOutRule.getLog().contains("usage: org.apache.nifi.toolkit.admin.notify.NotificationTool")
}
def "throws exception missing bootstrap conf flag"() {
given:

View File

@ -144,6 +144,11 @@
<artifactId>groovy-all</artifactId>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-cli-commons</artifactId>
<version>${nifi.groovy.version}</version>
</dependency>
</dependencies>
<build>

View File

@ -17,8 +17,10 @@
package org.apache.nifi.properties
import groovy.io.GroovyPrintWriter
import groovy.util.slurpersupport.GPathResult
import groovy.xml.XmlSlurper
import groovy.xml.XmlUtil
import groovy.xml.slurpersupport.GPathResult
import org.apache.commons.cli.CommandLine
import org.apache.commons.cli.CommandLineParser
import org.apache.commons.cli.DefaultParser

View File

@ -16,8 +16,9 @@
*/
package org.apache.nifi.toolkit.encryptconfig
import groovy.cli.internal.OptionAccessor
import groovy.cli.commons.CliBuilder
import groovy.cli.commons.OptionAccessor
import org.apache.commons.cli.HelpFormatter
import org.apache.nifi.properties.ConfigEncryptionTool
import org.apache.nifi.properties.scheme.ProtectionScheme

View File

@ -16,8 +16,9 @@
*/
package org.apache.nifi.toolkit.encryptconfig.util
import groovy.util.slurpersupport.GPathResult
import groovy.xml.XmlSlurper
import groovy.xml.XmlUtil
import groovy.xml.slurpersupport.GPathResult
import org.apache.nifi.properties.SensitivePropertyProvider
import org.apache.nifi.properties.SensitivePropertyProviderFactory
import org.slf4j.Logger

View File

@ -16,6 +16,9 @@
*/
package org.apache.nifi.properties
import groovy.test.GroovyLogTestCase
import groovy.test.GroovyShellTestCase
import groovy.test.GroovyTestCase
import org.apache.commons.cli.CommandLine
import org.apache.commons.cli.CommandLineParser
import org.apache.commons.cli.DefaultParser
@ -54,7 +57,7 @@ import java.security.KeyException
import java.security.Security
@RunWith(JUnit4.class)
class ConfigEncryptionToolTest extends GroovyTestCase {
class ConfigEncryptionToolTest extends GroovyLogTestCase {
private static final Logger logger = LoggerFactory.getLogger(ConfigEncryptionToolTest.class)
@Rule

View File

@ -16,7 +16,7 @@
*/
package org.apache.nifi.toolkit.encryptconfig
import groovy.test.GroovyTestCase
import org.apache.nifi.properties.NiFiPropertiesLoader
import org.apache.nifi.properties.ProtectedPropertyContext
import org.apache.nifi.properties.SensitivePropertyProvider

View File

@ -19,8 +19,10 @@ package org.apache.nifi.toolkit.encryptconfig.util
import org.apache.nifi.toolkit.encryptconfig.TestUtil
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import spock.lang.Ignore
import spock.lang.Specification
@Ignore
class BootstrapUtilSpec extends Specification {
private static final Logger logger = LoggerFactory.getLogger(BootstrapUtilSpec.class)

View File

@ -44,15 +44,6 @@ class ZooKeeperMigratorTest extends Specification {
noExceptionThrown()
}
@Ignore
def "Test jaas conf on command line"() {
when:
ZooKeeperMigratorMain.main(['-r', '-z', 'localhost:2181/path', '-k', 'jaas.conf'] as String[])
then:
noExceptionThrown()
}
def "Receive from open ZooKeeper"() {
given:
def server = new TestingServer()

View File

@ -35,7 +35,7 @@
<module>nifi-toolkit-api</module>
</modules>
<properties>
<toolkit.groovy.version>2.5.14</toolkit.groovy.version>
<toolkit.groovy.version>3.0.8</toolkit.groovy.version>
</properties>
<dependencyManagement>
<dependencies>

View File

@ -106,7 +106,7 @@
<jackson.version>2.12.5</jackson.version>
<jaxb.runtime.version>2.3.5</jaxb.runtime.version>
<jakarta.xml.bind-api.version>2.3.3</jakarta.xml.bind-api.version>
<nifi.groovy.version>2.5.14</nifi.groovy.version>
<nifi.groovy.version>3.0.8</nifi.groovy.version>
<surefire.version>3.0.0-M5</surefire.version>
<!-- The Hadoop version used by nifi-hadoop-libraries-nar and any NARs that depend on it, other NARs that need
a specific version should override this property, or use a more specific property like abc.hadoop.version -->
@ -335,7 +335,7 @@
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>1.3-groovy-2.5</version>
<version>2.1-M2-groovy-3.0</version>
<scope>test</scope>
<exclusions>
<exclusion>