Github user alopresto commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2350#discussion_r159102652
--- Diff:
nifi-toolkit/nifi-toolkit-encrypt-config/src/test/groovy/org/apache/nifi/properties/ConfigEncryptionToolTest.groovy
---
@@ -319,6 +320,59 @@ class ConfigEncryptionToolTest extends GroovyTestCase {
}
}
+ @Test
+ void testShouldParseAuthorizersArgument() {
+ // Arrange
+ def flags = ["-a", "--authorizers"]
+ String authorizersPath = "src/test/resources/authorizers.xml"
+ ConfigEncryptionTool tool = new ConfigEncryptionTool()
+
+ // Act
+ flags.each { String arg ->
+ tool.parse([arg, authorizersPath] as String[])
+ logger.info("Parsed authorizers.xml location:
${tool.authorizersPath}")
+
+ // Assert
+ assert tool.authorizersPath == authorizersPath
+ assert tool.handlingAuthorizers
+ }
+ }
+
+ @Test
+ void testShouldParseOutputAuthorizersArgument() {
+ // Arrange
+ def flags = ["-u", "--outputAuthorizers"]
+ String authorizersPath = "src/test/resources/authorizers.xml"
+ ConfigEncryptionTool tool = new ConfigEncryptionTool()
+
+ // Act
+ flags.each { String arg ->
+ tool.parse([arg, authorizersPath, "-a", authorizersPath] as
String[])
--- End diff --
Change so the `outputAuthorizersPath` is different from `authorizersPath`
(just call `authorizersPath.reverse()`; it doesn't have to be a valid file) to
ensure from the equality check at the end that the correct value is being read
here.
---