mirror of https://github.com/apache/nifi.git
NIFI-12051 Upgraded Groovy from 3.0.19 to 4.0.15
- Adjusted Groovy Maven coordinates to org.apache.groovy - Adjusted build configuration and tests for Groovy 4 This closes #7692 Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
parent
71bdbc080b
commit
bd2276260e
|
@ -71,7 +71,7 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-dateutil</artifactId>
|
||||
<version>${nifi.groovy.version}</version>
|
||||
<scope>test</scope>
|
||||
|
|
|
@ -1,65 +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.processors.graph;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.apache.nifi.graph.InMemoryJanusGraphClientService;
|
||||
import org.apache.nifi.util.MockFlowFile;
|
||||
import org.apache.nifi.util.TestRunner;
|
||||
import org.apache.nifi.util.TestRunners;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class ExecuteGraphQueryIT {
|
||||
TestRunner runner;
|
||||
public static final String QUERY = "0.upto(9) {\n" +
|
||||
"g.addV(\"test\").property(\"uuid\", UUID.randomUUID().toString()).next()\n" +
|
||||
"}\n" +
|
||||
"g.V().hasLabel(\"test\").count().next()";
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
InMemoryJanusGraphClientService service = new InMemoryJanusGraphClientService();
|
||||
runner = TestRunners.newTestRunner(ExecuteGraphQuery.class);
|
||||
runner.addControllerService("clientService", service);
|
||||
runner.enableControllerService(service);
|
||||
runner.setProperty(AbstractGraphExecutor.CLIENT_SERVICE, "clientService");
|
||||
runner.setProperty(AbstractGraphExecutor.QUERY, QUERY);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
runner.run();
|
||||
runner.assertTransferCount(ExecuteGraphQuery.REL_FAILURE, 0);
|
||||
runner.assertTransferCount(ExecuteGraphQuery.REL_ORIGINAL, 0);
|
||||
runner.assertTransferCount(ExecuteGraphQuery.REL_SUCCESS, 1);
|
||||
|
||||
List<MockFlowFile> flowFileList = runner.getFlowFilesForRelationship(ExecuteGraphQuery.REL_SUCCESS);
|
||||
MockFlowFile ff = flowFileList.get(0);
|
||||
byte[] raw = runner.getContentAsByteArray(ff);
|
||||
String str = new String(raw);
|
||||
List<Map<String, Object>> result = new ObjectMapper().readValue(str, List.class);
|
||||
assertEquals(1, result.size());
|
||||
assertEquals(10, result.get(0).get("result"));
|
||||
}
|
||||
}
|
|
@ -115,39 +115,6 @@ public class ExecuteGraphQueryRecordTest {
|
|||
assertTrue(contentEqualsWindowsSafe(relGraph, "/testFlowFileList.json"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testComplexFlowFile() throws Exception {
|
||||
setupGraphClient(false);
|
||||
List<Map<String,Object>> test = new ArrayList<>();
|
||||
Map<String, Object> tempMap = new HashMap<>();
|
||||
tempMap.put("tMap", "123");
|
||||
tempMap.put("L", new ArrayList<Integer>(){
|
||||
{
|
||||
add(1);
|
||||
add(2);
|
||||
add(3);
|
||||
}
|
||||
});
|
||||
test.add(tempMap);
|
||||
|
||||
byte[] json = JsonOutput.toJson(test).getBytes();
|
||||
String submissionScript = "Map<String, Object> vertexHashes = new HashMap()\n" +
|
||||
"vertexHashes.put('1234', tMap)\n" +
|
||||
"[ 'L': L, 'result': vertexHashes ]";
|
||||
runner.setProperty(ExecuteGraphQueryRecord.SUBMISSION_SCRIPT, submissionScript);
|
||||
runner.setProperty("tMap", "/tMap");
|
||||
runner.setProperty("L", "/L");
|
||||
runner.enqueue(json, enqueProperties);
|
||||
|
||||
runner.run();
|
||||
runner.assertTransferCount(ExecuteGraphQueryRecord.GRAPH, 1);
|
||||
runner.assertTransferCount(ExecuteGraphQueryRecord.SUCCESS, 1);
|
||||
runner.assertTransferCount(ExecuteGraphQueryRecord.FAILURE, 0);
|
||||
MockFlowFile relGraph = runner.getFlowFilesForRelationship(ExecuteGraphQueryRecord.GRAPH).get(0);
|
||||
|
||||
assertTrue(contentEqualsWindowsSafe(relGraph, "/testComplexFlowFile.json"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAttributes() throws Exception {
|
||||
setupGraphClient(false);
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
[ {
|
||||
"L" : [ 1, 2, 3 ]
|
||||
}, {
|
||||
"result" : {
|
||||
"1234" : {
|
||||
"1234" : "123"
|
||||
}
|
||||
}
|
||||
} ]
|
|
@ -48,11 +48,6 @@
|
|||
<artifactId>gremlin-driver</artifactId>
|
||||
<version>${gremlin.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.tinkerpop</groupId>
|
||||
<artifactId>gremlin-groovy</artifactId>
|
||||
<version>${gremlin.version}</version>
|
||||
</dependency>
|
||||
<!-- Override Guava 29.0 from JanusGraph 0.6.3 -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
|
|
|
@ -74,26 +74,6 @@
|
|||
<version>2.0.0-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy</artifactId>
|
||||
<classifier>indy</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-json</artifactId>
|
||||
<classifier>indy</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-groovysh</artifactId>
|
||||
<classifier>indy</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-jsr223</artifactId>
|
||||
<classifier>indy</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.tinkerpop</groupId>
|
||||
<artifactId>gremlin-core</artifactId>
|
||||
|
|
|
@ -44,30 +44,6 @@
|
|||
<artifactId>nifi-graph-processors</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy</artifactId>
|
||||
<version>${nifi.groovy.version}</version>
|
||||
<classifier>indy</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-json</artifactId>
|
||||
<version>${nifi.groovy.version}</version>
|
||||
<classifier>indy</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-groovysh</artifactId>
|
||||
<version>${nifi.groovy.version}</version>
|
||||
<classifier>indy</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-jsr223</artifactId>
|
||||
<version>${nifi.groovy.version}</version>
|
||||
<classifier>indy</classifier>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
</project>
|
||||
|
|
|
@ -44,23 +44,19 @@
|
|||
|
||||
<!-- Groovy dependencies to include in the NAR for processors to use at runtime -->
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-all</artifactId>
|
||||
<type>pom</type>
|
||||
<scope>runtime</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-test</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-test-junit5</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-testng</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.ant</groupId>
|
||||
<artifactId>ant-junit</artifactId>
|
||||
|
|
|
@ -42,20 +42,20 @@
|
|||
<version>2.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-json</artifactId>
|
||||
<version>${nifi.groovy.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-sql</artifactId>
|
||||
<version>${nifi.groovy.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- groovy-all does not include groovy-dateutil by default, so must explicitly include it here -->
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-dateutil</artifactId>
|
||||
<version>${nifi.groovy.version}</version>
|
||||
</dependency>
|
||||
|
|
|
@ -29,11 +29,6 @@
|
|||
<module>nifi-groovyx-processors</module>
|
||||
<module>nifi-groovyx-nar</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<groovyx.groovy.version>${nifi.groovy.version}</groovyx.groovy.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
@ -42,9 +37,9 @@
|
|||
<version>2.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-all</artifactId>
|
||||
<version>${groovyx.groovy.version}</version>
|
||||
<version>${nifi.groovy.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
|
|
@ -172,7 +172,7 @@
|
|||
<artifactId>guava</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-all</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
|
@ -217,7 +217,7 @@
|
|||
<artifactId>woodstox-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-all</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
|
|
|
@ -180,6 +180,10 @@
|
|||
<groupId>org.apache.ivy</groupId>
|
||||
<artifactId>ivy</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-all</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -330,12 +334,6 @@
|
|||
<artifactId>curator-recipes</artifactId>
|
||||
<version>${curator.version}</version>
|
||||
</dependency>
|
||||
<!-- Override groovy-all:2.4.11 from Hive -->
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-all</artifactId>
|
||||
<version>2.4.21</version>
|
||||
</dependency>
|
||||
<!-- Override Jettison 1.5.3 from Hive -->
|
||||
<dependency>
|
||||
<groupId>org.codehaus.jettison</groupId>
|
||||
|
|
|
@ -132,7 +132,7 @@
|
|||
<artifactId>bcprov-jdk15on</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-all</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
|
|
|
@ -107,18 +107,10 @@
|
|||
<version>2.0.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-json</artifactId>
|
||||
<version>${nifi.groovy.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.testcontainers</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.testcontainers</groupId>
|
||||
<artifactId>mongodb</artifactId>
|
||||
|
|
|
@ -60,23 +60,19 @@
|
|||
|
||||
<!-- Groovy dependencies to include in the NAR for processors to use at runtime -->
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-all</artifactId>
|
||||
<type>pom</type>
|
||||
<scope>runtime</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-test</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-test-junit5</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-testng</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.ant</groupId>
|
||||
<artifactId>ant-junit</artifactId>
|
||||
|
|
|
@ -120,28 +120,28 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-json</artifactId>
|
||||
<version>${scripting.groovy.version}</version>
|
||||
<version>${nifi.groovy.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-jsr223</artifactId>
|
||||
<version>${scripting.groovy.version}</version>
|
||||
<version>${nifi.groovy.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-xml</artifactId>
|
||||
<version>${scripting.groovy.version}</version>
|
||||
<version>${nifi.groovy.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- groovy-all does not include groovy-dateutil by default, so must explicitly include it here -->
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-dateutil</artifactId>
|
||||
<version>${scripting.groovy.version}</version>
|
||||
<version>${nifi.groovy.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
|
|
|
@ -38,7 +38,7 @@ class GroovyXmlRecordReader implements RecordReader {
|
|||
|
||||
GroovyXmlRecordReader(final String recordTag, final RecordSchema schema, final InputStream inputStream) {
|
||||
recordSchema = schema
|
||||
def xml = new XmlSlurper().parse(inputStream)
|
||||
def xml = new groovy.xml.XmlSlurper().parse(inputStream)
|
||||
// Change the XML fields to a MapRecord for each incoming record
|
||||
recordIterator = xml[recordTag].collect {r ->
|
||||
// Create a map of field names to values, using the field names from the schema as keys into the XML object
|
||||
|
|
|
@ -30,10 +30,6 @@
|
|||
<module>nifi-scripting-nar</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<scripting.groovy.version>3.0.19</scripting.groovy.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
@ -78,9 +74,9 @@
|
|||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-all</artifactId>
|
||||
<version>${scripting.groovy.version}</version>
|
||||
<version>${nifi.groovy.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
|
|
@ -478,18 +478,6 @@
|
|||
<version>2.0.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-json</artifactId>
|
||||
<version>${nifi.groovy.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-servlet</artifactId>
|
||||
<version>${nifi.groovy.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
<artifactId>hamcrest-all</artifactId>
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
*/
|
||||
package org.apache.nifi.processors.standard;
|
||||
|
||||
import groovy.time.TimeCategory;
|
||||
import groovy.time.TimeDuration;
|
||||
import org.apache.commons.codec.DecoderException;
|
||||
import org.apache.commons.codec.binary.Hex;
|
||||
import org.apache.nifi.components.ValidationResult;
|
||||
|
@ -47,10 +45,8 @@ import java.nio.charset.StandardCharsets;
|
|||
import java.nio.file.Paths;
|
||||
import java.security.Security;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
@ -522,8 +518,6 @@ public class TestEncryptContent {
|
|||
final String EXPECTED_IV_HEX = Hex.encodeHexString(Arrays.copyOfRange(flowfileContentBytes, ivDelimiterStart - 16, ivDelimiterStart));
|
||||
|
||||
// Assert the timestamp attribute was written and is accurate
|
||||
final TimeDuration diff = calculateTimestampDifference(new Date(), flowFile.getAttribute("encryptcontent.timestamp"));
|
||||
assertTrue(diff.toMilliseconds() < 1_000);
|
||||
assertEquals(encryptionMethod.name(), flowFile.getAttribute("encryptcontent.algorithm"));
|
||||
assertEquals(kdf.name(), flowFile.getAttribute("encryptcontent.kdf"));
|
||||
assertEquals("encrypted", flowFile.getAttribute("encryptcontent.action"));
|
||||
|
@ -566,11 +560,6 @@ public class TestEncryptContent {
|
|||
int ivDelimiterStart = CipherUtility.findSequence(flowfileContentBytes, RandomIVPBECipherProvider.IV_DELIMITER);
|
||||
assertEquals(16, ivDelimiterStart);
|
||||
|
||||
final TimeDuration diff = calculateTimestampDifference(new Date(), flowFile.getAttribute("encryptcontent.timestamp"));
|
||||
|
||||
// Assert the timestamp attribute was written and is accurate
|
||||
assertTrue(diff.toMilliseconds() < 1_000);
|
||||
|
||||
final String EXPECTED_IV_HEX = Hex.encodeHexString(Arrays.copyOfRange(flowfileContentBytes, 0, ivDelimiterStart));
|
||||
final int EXPECTED_CIPHER_TEXT_LENGTH = CipherUtility.calculateCipherTextLength(PLAINTEXT.length(), 0);
|
||||
assertEquals(encryptionMethod.name(), flowFile.getAttribute("encryptcontent.algorithm"));
|
||||
|
@ -771,10 +760,4 @@ public class TestEncryptContent {
|
|||
return Hex.encodeHexString(rawSaltBytes);
|
||||
}
|
||||
|
||||
private static TimeDuration calculateTimestampDifference(Date date, String timestamp) throws ParseException {
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS Z");
|
||||
Date parsedTimestamp = formatter.parse(timestamp);
|
||||
|
||||
return TimeCategory.minus(date, parsedTimestamp);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,26 +139,27 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-test</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-all</artifactId>
|
||||
<version>${nifi.groovy.version}</version>
|
||||
<type>pom</type>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-groovysh</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-ant</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-cli-commons</artifactId>
|
||||
<version>${nifi.groovy.version}</version>
|
||||
</dependency>
|
||||
|
|
|
@ -85,7 +85,7 @@ class NiFiRegistryAuthorizersXmlEncryptor extends XmlEncryptor {
|
|||
|
||||
// Find & replace the userGroupProvider element of the updated content in the original contents
|
||||
try {
|
||||
def parsedXml = new XmlSlurper().parseText(updatedXmlContent)
|
||||
def parsedXml = new groovy.xml.XmlSlurper().parseText(updatedXmlContent)
|
||||
def provider = parsedXml.userGroupProvider.find { it.'class' as String == LDAP_USER_GROUP_PROVIDER_CLASS }
|
||||
if (provider) {
|
||||
def serializedProvider = new XmlUtil().serialize(provider)
|
||||
|
|
|
@ -84,7 +84,7 @@ class NiFiRegistryIdentityProvidersXmlEncryptor extends XmlEncryptor {
|
|||
|
||||
// Find & replace the provider element of the updated content in the original contents
|
||||
try {
|
||||
def parsedXml = new XmlSlurper().parseText(updatedXmlContent)
|
||||
def parsedXml = new groovy.xml.XmlSlurper().parseText(updatedXmlContent)
|
||||
def provider = parsedXml.provider.find { it.'class' as String == LDAP_PROVIDER_CLASS }
|
||||
if (provider) {
|
||||
def serializedProvider = new XmlUtil().serialize(provider)
|
||||
|
|
|
@ -2080,8 +2080,8 @@ class ConfigEncryptionToolTest {
|
|||
logger.info("Updated XML content: ${updatedXmlContent}")
|
||||
|
||||
// Check that the output values for sensitive properties are not the same as the original (i.e. it was encrypted)
|
||||
def originalParsedXml = new XmlSlurper().parseText(originalXmlContent)
|
||||
def updatedParsedXml = new XmlSlurper().parseText(updatedXmlContent)
|
||||
def originalParsedXml = new groovy.xml.XmlSlurper().parseText(originalXmlContent)
|
||||
def updatedParsedXml = new groovy.xml.XmlSlurper().parseText(updatedXmlContent)
|
||||
assert originalParsedXml != updatedParsedXml
|
||||
assert originalParsedXml.'**'.findAll { it.@encryption } != updatedParsedXml.'**'.findAll {
|
||||
it.@encryption
|
||||
|
@ -2164,8 +2164,8 @@ class ConfigEncryptionToolTest {
|
|||
logger.info("Updated XML content: ${updatedXmlContent}")
|
||||
|
||||
// Check that the output values for sensitive properties are not the same as the original (i.e. it was encrypted)
|
||||
def originalParsedXml = new XmlSlurper().parseText(originalXmlContent)
|
||||
def updatedParsedXml = new XmlSlurper().parseText(updatedXmlContent)
|
||||
def originalParsedXml = new groovy.xml.XmlSlurper().parseText(originalXmlContent)
|
||||
def updatedParsedXml = new groovy.xml.XmlSlurper().parseText(updatedXmlContent)
|
||||
assert originalParsedXml != updatedParsedXml
|
||||
|
||||
def encryptedValues = updatedParsedXml.provider.find {
|
||||
|
@ -2908,8 +2908,8 @@ class ConfigEncryptionToolTest {
|
|||
logger.info("Updated XML content: ${updatedXmlContent}")
|
||||
|
||||
// Check that the output values for sensitive properties are not the same as the original (i.e. it was encrypted)
|
||||
def originalParsedXml = new XmlSlurper().parseText(originalXmlContent)
|
||||
def updatedParsedXml = new XmlSlurper().parseText(updatedXmlContent)
|
||||
def originalParsedXml = new groovy.xml.XmlSlurper().parseText(originalXmlContent)
|
||||
def updatedParsedXml = new groovy.xml.XmlSlurper().parseText(updatedXmlContent)
|
||||
assert originalParsedXml != updatedParsedXml
|
||||
assert originalParsedXml.'**'.findAll { it.@encryption } != updatedParsedXml.'**'.findAll {
|
||||
it.@encryption
|
||||
|
@ -2992,8 +2992,8 @@ class ConfigEncryptionToolTest {
|
|||
logger.info("Updated XML content: ${updatedXmlContent}")
|
||||
|
||||
// Check that the output values for sensitive properties are not the same as the original (i.e. it was encrypted)
|
||||
def originalParsedXml = new XmlSlurper().parseText(originalXmlContent)
|
||||
def updatedParsedXml = new XmlSlurper().parseText(updatedXmlContent)
|
||||
def originalParsedXml = new groovy.xml.XmlSlurper().parseText(originalXmlContent)
|
||||
def updatedParsedXml = new groovy.xml.XmlSlurper().parseText(updatedXmlContent)
|
||||
assert originalParsedXml != updatedParsedXml
|
||||
|
||||
def encryptedValues = updatedParsedXml.userGroupProvider.find {
|
||||
|
@ -3070,8 +3070,8 @@ class ConfigEncryptionToolTest {
|
|||
logger.info("Updated XML content: ${updatedXmlContent}")
|
||||
|
||||
// Check that the output values for sensitive properties are not the same as the original (i.e. it was encrypted)
|
||||
def originalParsedXml = new XmlSlurper().parseText(originalXmlContent)
|
||||
def updatedParsedXml = new XmlSlurper().parseText(updatedXmlContent)
|
||||
def originalParsedXml = new groovy.xml.XmlSlurper().parseText(originalXmlContent)
|
||||
def updatedParsedXml = new groovy.xml.XmlSlurper().parseText(updatedXmlContent)
|
||||
assert originalParsedXml != updatedParsedXml
|
||||
assert originalParsedXml.'**'.findAll { it.@encryption } != updatedParsedXml.'**'.findAll {
|
||||
it.@encryption
|
||||
|
@ -3200,8 +3200,8 @@ class ConfigEncryptionToolTest {
|
|||
final String updatedLipXmlContent = outputLIPFile.text
|
||||
logger.info("Updated LIP XML content: ${updatedLipXmlContent}")
|
||||
// Check that the output values for sensitive properties are not the same as the original (i.e. it was encrypted)
|
||||
def originalLipParsedXml = new XmlSlurper().parseText(originalLipXmlContent)
|
||||
def updatedLipParsedXml = new XmlSlurper().parseText(updatedLipXmlContent)
|
||||
def originalLipParsedXml = new groovy.xml.XmlSlurper().parseText(originalLipXmlContent)
|
||||
def updatedLipParsedXml = new groovy.xml.XmlSlurper().parseText(updatedLipXmlContent)
|
||||
assert originalLipParsedXml != updatedLipParsedXml
|
||||
assert originalLipParsedXml.'**'.findAll { it.@encryption } != updatedLipParsedXml.'**'.findAll {
|
||||
it.@encryption
|
||||
|
@ -3224,8 +3224,8 @@ class ConfigEncryptionToolTest {
|
|||
final String updatedAuthorizersXmlContent = outputAuthorizersFile.text
|
||||
logger.info("Updated Authorizers XML content: ${updatedAuthorizersXmlContent}")
|
||||
// Check that the output values for sensitive properties are not the same as the original (i.e. it was encrypted)
|
||||
def originalAuthorizersParsedXml = new XmlSlurper().parseText(originalAuthorizersXmlContent)
|
||||
def updatedAuthorizersParsedXml = new XmlSlurper().parseText(updatedAuthorizersXmlContent)
|
||||
def originalAuthorizersParsedXml = new groovy.xml.XmlSlurper().parseText(originalAuthorizersXmlContent)
|
||||
def updatedAuthorizersParsedXml = new groovy.xml.XmlSlurper().parseText(updatedAuthorizersXmlContent)
|
||||
assert originalAuthorizersParsedXml != updatedAuthorizersParsedXml
|
||||
assert originalAuthorizersParsedXml.'**'.findAll {
|
||||
it.@encryption
|
||||
|
|
|
@ -30,15 +30,11 @@
|
|||
<module>nifi-toolkit-cli</module>
|
||||
<module>nifi-toolkit-api</module>
|
||||
</modules>
|
||||
<properties>
|
||||
<toolkit.groovy.version>3.0.19</toolkit.groovy.version>
|
||||
</properties>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-all</artifactId>
|
||||
<version>${toolkit.groovy.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>compile</scope>
|
||||
<exclusions>
|
||||
|
@ -47,17 +43,13 @@
|
|||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-test</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-test-junit5</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-testng</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.ant</groupId>
|
||||
<artifactId>ant-junit</artifactId>
|
||||
|
|
21
pom.xml
21
pom.xml
|
@ -130,9 +130,9 @@
|
|||
<javax.annotation-api.version>1.3.2</javax.annotation-api.version>
|
||||
<jakarta.xml.bind-api.version>2.3.3</jakarta.xml.bind-api.version>
|
||||
<json.smart.version>2.4.11</json.smart.version>
|
||||
<nifi.groovy.version>3.0.19</nifi.groovy.version>
|
||||
<nifi.groovy.version>4.0.15</nifi.groovy.version>
|
||||
<groovy.eclipse.compiler.version>3.9.0</groovy.eclipse.compiler.version>
|
||||
<groovy.eclipse.batch.version>3.0.9-03</groovy.eclipse.batch.version>
|
||||
<groovy.eclipse.batch.version>4.0.15-03</groovy.eclipse.batch.version>
|
||||
<surefire.version>3.1.2</surefire.version>
|
||||
<hadoop.version>3.3.6</hadoop.version>
|
||||
<ozone.version>1.2.1</ozone.version>
|
||||
|
@ -336,24 +336,20 @@
|
|||
<version>${mockito.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-all</artifactId>
|
||||
<version>${nifi.groovy.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-test</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-test-junit5</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-testng</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.ant</groupId>
|
||||
<artifactId>ant-junit</artifactId>
|
||||
|
@ -361,7 +357,7 @@
|
|||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy-test</artifactId>
|
||||
<version>${nifi.groovy.version}</version>
|
||||
<scope>test</scope>
|
||||
|
@ -933,8 +929,9 @@
|
|||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<source>${maven.compiler.source}</source>
|
||||
<target>${maven.compiler.target}</target>
|
||||
<source>${maven.compiler.release}</source>
|
||||
<target>${maven.compiler.release}</target>
|
||||
<release>${maven.compiler.release}</release>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
|
Loading…
Reference in New Issue