diff --git a/minifi/minifi-assembly/pom.xml b/minifi/minifi-assembly/pom.xml index b31d96385b..74c03fd9c0 100644 --- a/minifi/minifi-assembly/pom.xml +++ b/minifi/minifi-assembly/pom.xml @@ -69,6 +69,11 @@ limitations under the License. logback-classic compile + + ch.qos.logback + logback-core + compile + org.slf4j jcl-over-slf4j diff --git a/minifi/minifi-assembly/src/main/assembly/dependencies-windows-service.xml b/minifi/minifi-assembly/src/main/assembly/dependencies-windows-service.xml index af9e6bd252..754fdb49d4 100644 --- a/minifi/minifi-assembly/src/main/assembly/dependencies-windows-service.xml +++ b/minifi/minifi-assembly/src/main/assembly/dependencies-windows-service.xml @@ -63,6 +63,7 @@ *:commons-io *:slf4j-api *:logback-classic + *:logback-core diff --git a/minifi/minifi-assembly/src/main/assembly/dependencies.xml b/minifi/minifi-assembly/src/main/assembly/dependencies.xml index 8fbd0d51cb..342b520ab3 100644 --- a/minifi/minifi-assembly/src/main/assembly/dependencies.xml +++ b/minifi/minifi-assembly/src/main/assembly/dependencies.xml @@ -64,6 +64,7 @@ *:commons-lang3 *:slf4j-api *:logback-classic + *:logback-core diff --git a/minifi/minifi-c2/minifi-c2-assembly/pom.xml b/minifi/minifi-c2/minifi-c2-assembly/pom.xml index 277bdaa667..3ab4d643d8 100644 --- a/minifi/minifi-c2/minifi-c2-assembly/pom.xml +++ b/minifi/minifi-c2/minifi-c2-assembly/pom.xml @@ -164,6 +164,11 @@ limitations under the License. logback-classic compile + + ch.qos.logback + logback-core + compile + javax.servlet javax.servlet-api diff --git a/nifi-assembly/pom.xml b/nifi-assembly/pom.xml index 38f0d08b60..9cdb654ac4 100644 --- a/nifi-assembly/pom.xml +++ b/nifi-assembly/pom.xml @@ -113,6 +113,11 @@ language governing permissions and limitations under the License. --> logback-classic compile + + ch.qos.logback + logback-core + compile + org.slf4j jcl-over-slf4j diff --git a/nifi-assembly/src/main/assembly/common.xml b/nifi-assembly/src/main/assembly/common.xml index 9ef7087a6d..b193ed9afb 100644 --- a/nifi-assembly/src/main/assembly/common.xml +++ b/nifi-assembly/src/main/assembly/common.xml @@ -28,6 +28,7 @@ *:nifi-bootstrap *:slf4j-api *:logback-classic + *:logback-core *:nifi-api *:nifi-property-protection-api diff --git a/nifi-nar-bundles/nifi-accumulo-bundle/pom.xml b/nifi-nar-bundles/nifi-accumulo-bundle/pom.xml index 1ae40966b3..aea703b499 100644 --- a/nifi-nar-bundles/nifi-accumulo-bundle/pom.xml +++ b/nifi-nar-bundles/nifi-accumulo-bundle/pom.xml @@ -63,6 +63,12 @@ org.apache.zookeeper zookeeper ${zookeeper.version} + + + ch.qos.logback + logback-classic + + diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/conf/logback.xml b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/conf/logback.xml index c578c8ba3d..4a1e57e1f5 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/conf/logback.xml +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/conf/logback.xml @@ -15,7 +15,7 @@ --> - + true diff --git a/nifi-nar-bundles/nifi-hive-bundle/pom.xml b/nifi-nar-bundles/nifi-hive-bundle/pom.xml index d68df4321d..80c88ba728 100644 --- a/nifi-nar-bundles/nifi-hive-bundle/pom.xml +++ b/nifi-nar-bundles/nifi-hive-bundle/pom.xml @@ -90,6 +90,12 @@ org.apache.zookeeper zookeeper ${zookeeper.version} + + + ch.qos.logback + logback-classic + + diff --git a/nifi-nar-bundles/nifi-iceberg-bundle/pom.xml b/nifi-nar-bundles/nifi-iceberg-bundle/pom.xml index 139eba8cb0..c7677a1105 100644 --- a/nifi-nar-bundles/nifi-iceberg-bundle/pom.xml +++ b/nifi-nar-bundles/nifi-iceberg-bundle/pom.xml @@ -75,6 +75,12 @@ org.apache.zookeeper zookeeper ${zookeeper.version} + + + ch.qos.logback + logback-classic + + diff --git a/nifi-nar-bundles/nifi-ranger-bundle/nifi-ranger-plugin/pom.xml b/nifi-nar-bundles/nifi-ranger-bundle/nifi-ranger-plugin/pom.xml index 548b2c7ecd..f1cb4fd37d 100644 --- a/nifi-nar-bundles/nifi-ranger-bundle/nifi-ranger-plugin/pom.xml +++ b/nifi-nar-bundles/nifi-ranger-bundle/nifi-ranger-plugin/pom.xml @@ -62,6 +62,10 @@ commons-logging commons-logging + + ch.qos.logback + logback-classic + @@ -163,6 +167,10 @@ commons-logging commons-logging + + ch.qos.logback + logback-classic + diff --git a/nifi-nar-bundles/nifi-spark-bundle/pom.xml b/nifi-nar-bundles/nifi-spark-bundle/pom.xml index 87f15877b0..394abbd5c8 100644 --- a/nifi-nar-bundles/nifi-spark-bundle/pom.xml +++ b/nifi-nar-bundles/nifi-spark-bundle/pom.xml @@ -74,6 +74,12 @@ org.apache.zookeeper zookeeper ${zookeeper.version} + + + ch.qos.logback + logback-classic + + diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/pom.xml b/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/pom.xml index 73ee56d428..1fec56d363 100644 --- a/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/pom.xml +++ b/nifi-nar-bundles/nifi-standard-services/nifi-hbase_1_1_2-client-service-bundle/pom.xml @@ -102,6 +102,12 @@ org.apache.zookeeper zookeeper ${zookeeper.version} + + + ch.qos.logback + logback-classic + + diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-hbase_2-client-service-bundle/pom.xml b/nifi-nar-bundles/nifi-standard-services/nifi-hbase_2-client-service-bundle/pom.xml index 9bc352bdc7..3717c02bd2 100644 --- a/nifi-nar-bundles/nifi-standard-services/nifi-hbase_2-client-service-bundle/pom.xml +++ b/nifi-nar-bundles/nifi-standard-services/nifi-hbase_2-client-service-bundle/pom.xml @@ -72,6 +72,12 @@ org.apache.zookeeper zookeeper ${zookeeper.version} + + + ch.qos.logback + logback-classic + + diff --git a/nifi-registry/nifi-registry-assembly/pom.xml b/nifi-registry/nifi-registry-assembly/pom.xml index 3f180efc24..200db073d8 100644 --- a/nifi-registry/nifi-registry-assembly/pom.xml +++ b/nifi-registry/nifi-registry-assembly/pom.xml @@ -64,6 +64,11 @@ logback-classic compile + + ch.qos.logback + logback-core + compile + org.slf4j jcl-over-slf4j diff --git a/nifi-registry/nifi-registry-assembly/src/main/assembly/dependencies.xml b/nifi-registry/nifi-registry-assembly/src/main/assembly/dependencies.xml index a364cb277d..53198dd4b1 100644 --- a/nifi-registry/nifi-registry-assembly/src/main/assembly/dependencies.xml +++ b/nifi-registry/nifi-registry-assembly/src/main/assembly/dependencies.xml @@ -50,6 +50,7 @@ *:nifi-registry-bootstrap *:slf4j-api *:logback-classic + *:logback-core diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/pom.xml b/nifi-registry/nifi-registry-core/nifi-registry-framework/pom.xml index aeaa7602bf..286f0de88d 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/pom.xml +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/pom.xml @@ -231,6 +231,13 @@ org.springframework.boot spring-boot-starter-security ${spring.boot.version} + + + + org.springframework.boot + spring-boot-starter-logging + + org.springframework.security diff --git a/nifi-registry/nifi-registry-core/nifi-registry-test/pom.xml b/nifi-registry/nifi-registry-core/nifi-registry-test/pom.xml index 4e2067d36f..7684bb853d 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-test/pom.xml +++ b/nifi-registry/nifi-registry-core/nifi-registry-test/pom.xml @@ -36,6 +36,13 @@ org.springframework.boot spring-boot-starter-test ${spring.boot.version} + + + + org.springframework.boot + spring-boot-starter-logging + + org.testcontainers diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/pom.xml b/nifi-registry/nifi-registry-core/nifi-registry-web-api/pom.xml index ae71667c81..fc204b1158 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/pom.xml +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/pom.xml @@ -284,6 +284,13 @@ org.springframework.boot spring-boot-starter-web ${spring.boot.version} + + + + org.springframework.boot + spring-boot-starter-logging + + diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/NiFiRegistryApiApplication.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/NiFiRegistryApiApplication.java index 14ca1672bb..7accea2a06 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/NiFiRegistryApiApplication.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/NiFiRegistryApiApplication.java @@ -28,6 +28,7 @@ import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestCli import org.springframework.boot.autoconfigure.solr.SolrAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.event.ApplicationReadyEvent; +import org.springframework.boot.logging.LoggingSystem; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.context.ApplicationListener; import org.springframework.stereotype.Component; @@ -56,6 +57,11 @@ public class NiFiRegistryApiApplication extends SpringBootServletInitializer { public static final String NIFI_REGISTRY_PROPERTIES_ATTRIBUTE = "nifi-registry.properties"; public static final String NIFI_REGISTRY_MASTER_KEY_ATTRIBUTE = "nifi-registry.key"; + static { + // Disable Spring Logging abstraction for Spring Boot 2 and SLF4J 2 + System.setProperty(LoggingSystem.SYSTEM_PROPERTY, LoggingSystem.NONE); + } + @Autowired private EventService eventService; diff --git a/nifi-registry/nifi-registry-extensions/nifi-registry-ranger/nifi-registry-ranger-plugin/pom.xml b/nifi-registry/nifi-registry-extensions/nifi-registry-ranger/nifi-registry-ranger-plugin/pom.xml index bc9a71f2bc..87efeefd6e 100644 --- a/nifi-registry/nifi-registry-extensions/nifi-registry-ranger/nifi-registry-ranger-plugin/pom.xml +++ b/nifi-registry/nifi-registry-extensions/nifi-registry-ranger/nifi-registry-ranger-plugin/pom.xml @@ -97,6 +97,10 @@ commons-logging commons-logging + + ch.qos.logback + logback-classic + com.google.code.findbugs jsr305 @@ -239,6 +243,10 @@ commons-logging commons-logging + + ch.qos.logback + logback-classic + diff --git a/nifi-registry/nifi-registry-toolkit/nifi-registry-toolkit-assembly/pom.xml b/nifi-registry/nifi-registry-toolkit/nifi-registry-toolkit-assembly/pom.xml index 53f198a094..fdb59b4ff0 100644 --- a/nifi-registry/nifi-registry-toolkit/nifi-registry-toolkit-assembly/pom.xml +++ b/nifi-registry/nifi-registry-toolkit/nifi-registry-toolkit-assembly/pom.xml @@ -65,6 +65,10 @@ language governing permissions and limitations under the License. --> ch.qos.logback logback-classic + + ch.qos.logback + logback-core + diff --git a/nifi-stateless/nifi-stateless-assembly/pom.xml b/nifi-stateless/nifi-stateless-assembly/pom.xml index 0aa320c08e..5d0a32a888 100644 --- a/nifi-stateless/nifi-stateless-assembly/pom.xml +++ b/nifi-stateless/nifi-stateless-assembly/pom.xml @@ -85,6 +85,11 @@ logback-classic compile + + ch.qos.logback + logback-core + compile + org.slf4j jcl-over-slf4j diff --git a/nifi-system-tests/nifi-system-test-suite/pom.xml b/nifi-system-tests/nifi-system-test-suite/pom.xml index 8d43652fb1..118d23c049 100644 --- a/nifi-system-tests/nifi-system-test-suite/pom.xml +++ b/nifi-system-tests/nifi-system-test-suite/pom.xml @@ -152,6 +152,11 @@ logback-classic compile + + ch.qos.logback + logback-core + compile + org.apache.nifi nifi-api diff --git a/nifi-system-tests/nifi-system-test-suite/src/test/resources/conf/clustered/node1/logback.xml b/nifi-system-tests/nifi-system-test-suite/src/test/resources/conf/clustered/node1/logback.xml index b48ab12d18..773e9a9635 100644 --- a/nifi-system-tests/nifi-system-test-suite/src/test/resources/conf/clustered/node1/logback.xml +++ b/nifi-system-tests/nifi-system-test-suite/src/test/resources/conf/clustered/node1/logback.xml @@ -15,7 +15,7 @@ --> - + true diff --git a/nifi-system-tests/nifi-system-test-suite/src/test/resources/conf/clustered/node2/logback.xml b/nifi-system-tests/nifi-system-test-suite/src/test/resources/conf/clustered/node2/logback.xml index b48ab12d18..773e9a9635 100644 --- a/nifi-system-tests/nifi-system-test-suite/src/test/resources/conf/clustered/node2/logback.xml +++ b/nifi-system-tests/nifi-system-test-suite/src/test/resources/conf/clustered/node2/logback.xml @@ -15,7 +15,7 @@ --> - + true diff --git a/nifi-system-tests/nifi-system-test-suite/src/test/resources/conf/default/logback.xml b/nifi-system-tests/nifi-system-test-suite/src/test/resources/conf/default/logback.xml index 65665cebf9..9471514f10 100644 --- a/nifi-system-tests/nifi-system-test-suite/src/test/resources/conf/default/logback.xml +++ b/nifi-system-tests/nifi-system-test-suite/src/test/resources/conf/default/logback.xml @@ -15,7 +15,7 @@ --> - + true diff --git a/nifi-toolkit/nifi-toolkit-zookeeper-migrator/src/test/groovy/org/apache/nifi/toolkit/zkmigrator/ZooKeeperMigratorTest.groovy b/nifi-toolkit/nifi-toolkit-zookeeper-migrator/src/test/groovy/org/apache/nifi/toolkit/zkmigrator/ZooKeeperMigratorTest.groovy deleted file mode 100644 index fcbb0ab730..0000000000 --- a/nifi-toolkit/nifi-toolkit-zookeeper-migrator/src/test/groovy/org/apache/nifi/toolkit/zkmigrator/ZooKeeperMigratorTest.groovy +++ /dev/null @@ -1,296 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.toolkit.zkmigrator - -import com.google.gson.Gson -import com.google.gson.stream.JsonReader -import org.apache.curator.test.TestingServer -import org.apache.curator.utils.ZKPaths -import org.apache.zookeeper.CreateMode -import org.apache.zookeeper.WatchedEvent -import org.apache.zookeeper.ZKUtil -import org.apache.zookeeper.ZooDefs -import org.apache.zookeeper.ZooKeeper -import org.apache.zookeeper.data.Stat -import org.apache.zookeeper.server.auth.DigestAuthenticationProvider -import spock.lang.Ignore -import spock.lang.Specification -import spock.lang.Unroll - -import java.nio.charset.StandardCharsets - -@Unroll -class ZooKeeperMigratorTest extends Specification { - - def "Test auth and jaas usage simultaneously"() { - when: - ZooKeeperMigratorMain.main(['-r', '-z', 'localhost:2181/path', '-a', 'user:pass', '-k', 'jaas.conf'] as String[]) - - then: - noExceptionThrown() - } - - def "Receive from open ZooKeeper"() { - given: - def server = new TestingServer() - def client = new ZooKeeper(server.connectString, 3000, { WatchedEvent watchedEvent -> - }) - def migrationPathRoot = '/nifi/components' - ZKPaths.mkdirs(client, migrationPathRoot) - client.setData(migrationPathRoot, 'some data'.bytes, 0) - def componentName = '1' - client.create("$migrationPathRoot/$componentName", 'some data'.bytes, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT) - componentName = '1/a' - client.create("$migrationPathRoot/$componentName", 'some data'.bytes, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL) - componentName = '2' - client.create("$migrationPathRoot/$componentName", 'some data'.bytes, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT) - componentName = '3' - client.create("$migrationPathRoot/$componentName", 'some data'.bytes, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT) - def outputFilePath = 'target/test-data.json' - - when: - ZooKeeperMigratorMain.main(['-r', '-z', "$server.connectString$migrationPathRoot", '-f', outputFilePath] as String[]) - - then: - noExceptionThrown() - def persistedData = new Gson().fromJson(new JsonReader(new FileReader(outputFilePath)), List) as List - persistedData.size() == 6 - } - - def "Send to open ZooKeeper without ACL migration"() { - given: - def server = new TestingServer() - def client = new ZooKeeper(server.connectString, 3000, { WatchedEvent watchedEvent -> - }) - def migrationPathRoot = '/newParent' - - when: - ZooKeeperMigratorMain.main(['-s', '-z', "$server.connectString$migrationPathRoot", '-f', 'src/test/resources/test-data.json'] as String[]) - - then: - noExceptionThrown() - def nodes = ZKPaths.getSortedChildren(client, '/').collect { ZKUtil.listSubTreeBFS(client, "/$it") }.flatten() - nodes.size() == 7 - } - - def "Send to open ZooKeeper without ACL migration with new multi-node parent"() { - given: - def server = new TestingServer() - def client = new ZooKeeper(server.connectString, 3000, { WatchedEvent watchedEvent -> - }) - def migrationPathRoot = '/newParent/node' - - when: - ZooKeeperMigratorMain.main(['-s', '-z', "$server.connectString$migrationPathRoot", '-f', 'src/test/resources/test-data.json'] as String[]) - - then: - noExceptionThrown() - def nodes = ZKPaths.getSortedChildren(client, '/').collect { ZKUtil.listSubTreeBFS(client, "/$it") }.flatten() - nodes.size() == 8 - } - - def "Receive all nodes from ZooKeeper root"() { - given: - def server = new TestingServer() - def client = new ZooKeeper(server.connectString, 3000, { WatchedEvent watchedEvent -> - }) - def migrationPathRoot = '/' - def addedNodePath = 'nifi' - client.create("$migrationPathRoot$addedNodePath", 'some data'.bytes, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT) - def outputFilePath = 'target/test-data-root.json' - - when: - ZooKeeperMigratorMain.main(['-r', '-z', "$server.connectString$migrationPathRoot", '-f', outputFilePath] as String[]) - - then: - noExceptionThrown() - def persistedData = new Gson().fromJson(new JsonReader(new FileReader(outputFilePath)), List) as List - persistedData.size() == 6 - } - - def "Receive Zookeeper node created with username and password"() { - given: - def server = new TestingServer() - def client = new ZooKeeper(server.connectString, 3000, { WatchedEvent watchedEvent -> - }) - def username = 'nifi' - def password = 'nifi' - client.addAuthInfo('digest', "$username:$password".getBytes(StandardCharsets.UTF_8)) - def migrationPathRoot = '/nifi' - client.create(migrationPathRoot, 'some data'.bytes, ZooDefs.Ids.CREATOR_ALL_ACL, CreateMode.PERSISTENT) - def outputFilePath = 'target/test-data-user-pass.json' - - when: - ZooKeeperMigratorMain.main(['-r', '-z', "$server.connectString$migrationPathRoot", '-f', outputFilePath, '-a', "$username:$password"] as String[]) - - then: - noExceptionThrown() - def persistedData = new Gson().fromJson(new JsonReader(new FileReader(outputFilePath)), List) as List - persistedData.size() == 2 - } - - def "Send to Zookeeper a node created with username and password"() { - given: - def server = new TestingServer() - def client = new ZooKeeper(server.connectString, 3000, { WatchedEvent watchedEvent -> - }) - def username = 'nifi' - def password = 'nifi' - client.addAuthInfo('digest', "$username:$password".getBytes(StandardCharsets.UTF_8)) - def migrationPathRoot = '/newParent' - - when: - ZooKeeperMigratorMain.main(['-s', '-z', "$server.connectString$migrationPathRoot", '-f', 'src/test/resources/test-data-user-pass.json', '-a', "$username:$password"] as String[]) - - then: - noExceptionThrown() - def nodes = ZKPaths.getSortedChildren(client, '/').collect { ZKUtil.listSubTreeBFS(client, "/$it") }.flatten() - nodes.size() == 4 - } - - def "Send to open Zookeeper with ACL migration"() { - given: - def server = new TestingServer() - def client = new ZooKeeper(server.connectString, 3000, { WatchedEvent watchedEvent -> - }) - def migrationPathRoot = '/nifi-open' - - when: - ZooKeeperMigratorMain.main(['-s', '-z', "$server.connectString$migrationPathRoot", '-f', 'src/test/resources/test-data-user-pass.json'] as String[]) - - then: - noExceptionThrown() - def nodes = ZKPaths.getSortedChildren(client, '/').collect { ZKUtil.listSubTreeBFS(client, "/$it") }.flatten() - nodes.size() == 4 - } - - def "Send to open Zookeeper using existing ACL"() { - given: - def server = new TestingServer() - def securedClient = new ZooKeeper(server.connectString, 3000, { WatchedEvent watchedEvent -> }) - def userPass = "nifi:nifi" - securedClient.addAuthInfo("digest",userPass.getBytes(StandardCharsets.UTF_8)) - def digest = DigestAuthenticationProvider.generateDigest(userPass) - def migrationPathRoot = '/nifi' - def stat = new Stat() - - when: - ZooKeeperMigratorMain.main(['-s', '-z', "$server.connectString$migrationPathRoot", '-f', 'src/test/resources/test-data-user-pass.json','--use-existing-acl'] as String[]) - - then: - noExceptionThrown() - def acl = securedClient.getACL("/nifi",stat) - acl.get(0).id.scheme == "digest" - acl.get(0).id.id == digest - def nodes = ZKPaths.getSortedChildren(securedClient, '/nifi').collect { ZKUtil.listSubTreeBFS(securedClient, "/$it") }.flatten() - nodes.size() == 0 - } - - - def "Parse Zookeeper connect string and path"() { - when: - def zooKeeperMigrator = new ZooKeeperMigrator("$connectString") - - then: - zooKeeperMigrator.zooKeeperEndpointConfig.connectString == connectString - zooKeeperMigrator.zooKeeperEndpointConfig.servers == servers.split(',').collect() - zooKeeperMigrator.zooKeeperEndpointConfig.path == path - - where: - connectString | path | servers || _ - '127.0.0.1' | '/' | '127.0.0.1' || _ - '127.0.0.1,127.0.0.2' | '/' | '127.0.0.1,127.0.0.2' || _ - '127.0.0.1/' | '/' | '127.0.0.1' || _ - '127.0.0.1,127.0.0.2/' | '/' | '127.0.0.1,127.0.0.2' || _ - '127.0.0.1:2181' | '/' | '127.0.0.1:2181' || _ - '127.0.0.1,127.0.0.2:2181' | '/' | '127.0.0.1,127.0.0.2:2181' || _ - '127.0.0.1:2181/' | '/' | '127.0.0.1:2181' || _ - '127.0.0.1,127.0.0.2:2181/' | '/' | '127.0.0.1,127.0.0.2:2181' || _ - '127.0.0.1/path' | '/path' | '127.0.0.1' || _ - '127.0.0.1,127.0.0.2/path' | '/path' | '127.0.0.1,127.0.0.2' || _ - '127.0.0.1/path/node' | '/path/node' | '127.0.0.1' || _ - '127.0.0.1,127.0.0.2/path/node' | '/path/node' | '127.0.0.1,127.0.0.2' || _ - '127.0.0.1:2181/' | '/' | '127.0.0.1:2181' || _ - '127.0.0.1,127.0.0.2:2181/' | '/' | '127.0.0.1,127.0.0.2:2181' || _ - '127.0.0.1:2181/path' | '/path' | '127.0.0.1:2181' || _ - '127.0.0.1,127.0.0.2:2181/path' | '/path' | '127.0.0.1,127.0.0.2:2181' || _ - '127.0.0.1:2181/path/node' | '/path/node' | '127.0.0.1:2181' || _ - '127.0.0.1,127.0.0.2:2181/path/node' | '/path/node' | '127.0.0.1,127.0.0.2:2181' || _ - '127.0.0.1,127.0.0.2:2182,127.0.0.3:2183' | '/' | '127.0.0.1,127.0.0.2:2182,127.0.0.3:2183' || _ - '127.0.0.1,127.0.0.2:2182,127.0.0.3:2183/' | '/' | '127.0.0.1,127.0.0.2:2182,127.0.0.3:2183' || _ - '127.0.0.1,127.0.0.2:2182,127.0.0.3:2183/path' | '/path' | '127.0.0.1,127.0.0.2:2182,127.0.0.3:2183' || _ - '127.0.0.1,127.0.0.2:2182,127.0.0.3:2183/path/node' | '/path/node' | '127.0.0.1,127.0.0.2:2182,127.0.0.3:2183' || _ - } - - def "Test ignore source" () { - given: - def server = new TestingServer() - def migrationPathRoot = '/nifi/components' - def connectString = "$server.connectString" - def dataPath = 'target/test-data-ignore-source.json' - def client = new ZooKeeper(server.connectString, 3000, { WatchedEvent watchedEvent -> - }) - - // Create some znodes under /nifi/components - ZKPaths.mkdirs(client, migrationPathRoot) - client.setData(migrationPathRoot, 'some data'.bytes, 0) - def componentName = '1' - client.create("$migrationPathRoot/$componentName", 'some data'.bytes, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT) - componentName = '1/a' - client.create("$migrationPathRoot/$componentName", 'some data'.bytes, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL) - componentName = '2' - client.create("$migrationPathRoot/$componentName", 'some data'.bytes, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT) - componentName = '3' - client.create("$migrationPathRoot/$componentName", 'some data'.bytes, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT) - - when: "data is read from the source zookeeper" - ZooKeeperMigratorMain.main(['-r', '-z', "$connectString$migrationPathRoot", '-f', dataPath] as String[]) - - then: "verify the data has been written to the output file" - new File(dataPath).exists() - - when: "data is sent to the same zookeeper as the the source zookeeper without ignore source" - ZooKeeperMigratorMain.main(['-s', '-z', "$connectString$migrationPathRoot", '-f', dataPath] as String[]) - - then: "verify that an illegal argument exception is thrown" - thrown(IllegalArgumentException) - - when: "data is sent to the same zookeeper as the source zookeeper with ignore source option set" - ZooKeeperMigratorMain.main(['-s', '-z', "$connectString$migrationPathRoot", '-f', dataPath, '--ignore-source', '--use-existing-acl'] as String[]) - - then: "no exceptions are thrown" - noExceptionThrown() - } - - def "Send to same ZooKeeper with different path"() { - def server = new TestingServer() - def connectString = "$server.connectString" - def dataPath = 'target/test-data-different-path.json' - - when: "data is read from the source zookeeper" - ZooKeeperMigratorMain.main(['-r', '-z', connectString, '-f', dataPath] as String[]) - - then: "verify the data has been written to the output file" - new File(dataPath).exists() - - when: "data is sent to the same zookeeper as the the source zookeeper with a different path" - ZooKeeperMigratorMain.main(['-s', '-z', "$connectString/new-path", '-f', dataPath] as String[]) - - then: "no exceptions are thrown" - noExceptionThrown() - } -} diff --git a/pom.xml b/pom.xml index fa9be9a577..bde25c3491 100644 --- a/pom.xml +++ b/pom.xml @@ -118,7 +118,7 @@ 4.4.15 1.71 1.17.6 - 1.7.36 + 2.0.6 2.3.0 9.4.50.v20221201 2.14.1 @@ -138,7 +138,7 @@ 1.9.6 2.36 2.18.0 - 1.2.11 + 1.3.5 3.12.4 3.10.6.Final 1.33 @@ -177,6 +177,12 @@ ${logback.version} provided + + ch.qos.logback + logback-core + ${logback.version} + provided + org.slf4j jcl-over-slf4j