[jira] [Updated] (NIFI-12811) Upgrade Spring Framework to 6.0.17 and Spring Security to 6.2.2

2024-02-16 Thread David Handermann (Jira)


 [ 
https://issues.apache.org/jira/browse/NIFI-12811?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

David Handermann updated NIFI-12811:

Status: Patch Available  (was: Open)

> Upgrade Spring Framework to 6.0.17 and Spring Security to 6.2.2
> ---
>
> Key: NIFI-12811
> URL: https://issues.apache.org/jira/browse/NIFI-12811
> Project: Apache NiFi
>  Issue Type: Improvement
>  Components: Core Framework, NiFi Registry
>Reporter: David Handermann
>Assignee: David Handermann
>Priority: Minor
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Spring Framework dependencies should be upgraded to 
> [6.0.17|https://github.com/spring-projects/spring-framework/releases/tag/v6.0.17]
>  to incorporate various improvements and bug fixes.
> Spring Security 
> [6.2.2|https://github.com/spring-projects/spring-security/releases/tag/6.2.2] 
> also includes several minor bug fixes and transitive dependency upgrades.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[PR] NIFI-12811 Upgrade Spring Framework from 6.0.16 to 6.0.17 [nifi]

2024-02-16 Thread via GitHub


exceptionfactory opened a new pull request, #8422:
URL: https://github.com/apache/nifi/pull/8422

   # Summary
   
   [NIFI-12811](https://issues.apache.org/jira/browse/NIFI-12811) Upgrades 
Spring Framework dependencies from 6.0.16 to 
[6.0.17](https://github.com/spring-projects/spring-framework/releases/tag/v6.0.17)
 and Spring Security dependencies from 6.2.0 to 
[6.2.2](https://github.com/spring-projects/spring-security/releases/tag/6.2.2).
   
   Additional changes include upgrading Registry's version of Spring Framework 
from 6.1.3 to 
[6.1.4](https://github.com/spring-projects/spring-framework/releases/tag/v6.1.4).
   
   Testing Spring Framework 6.1.4 with NiFi continues to exhibit problems with 
AOP parameter resolution in Auditor classes, which is the reason for the 
version differences between NiFi and Registry for now.
   
   # Tracking
   
   Please complete the following tracking steps prior to pull request creation.
   
   ### Issue Tracking
   
   - [X] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue 
created
   
   ### Pull Request Tracking
   
   - [X] Pull Request title starts with Apache NiFi Jira issue number, such as 
`NIFI-0`
   - [X] Pull Request commit message starts with Apache NiFi Jira issue number, 
as such `NIFI-0`
   
   ### Pull Request Formatting
   
   - [X] Pull Request based on current revision of the `main` branch
   - [X] Pull Request refers to a feature branch with one commit containing 
changes
   
   # Verification
   
   Please indicate the verification steps performed prior to pull request 
creation.
   
   ### Build
   
   - [X] Build completed using `mvn clean install -P contrib-check`
 - [X] JDK 21
   
   ### Licensing
   
   - [ ] New dependencies are compatible with the [Apache License 
2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License 
Policy](https://www.apache.org/legal/resolved.html)
   - [ ] New dependencies are documented in applicable `LICENSE` and `NOTICE` 
files
   
   ### Documentation
   
   - [ ] Documentation formatting appears as expected in rendered files
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[jira] [Created] (NIFI-12811) Upgrade Spring Framework to 6.0.17 and Spring Security to 6.2.2

2024-02-16 Thread David Handermann (Jira)
David Handermann created NIFI-12811:
---

 Summary: Upgrade Spring Framework to 6.0.17 and Spring Security to 
6.2.2
 Key: NIFI-12811
 URL: https://issues.apache.org/jira/browse/NIFI-12811
 Project: Apache NiFi
  Issue Type: Improvement
  Components: Core Framework, NiFi Registry
Reporter: David Handermann
Assignee: David Handermann


Spring Framework dependencies should be upgraded to 
[6.0.17|https://github.com/spring-projects/spring-framework/releases/tag/v6.0.17]
 to incorporate various improvements and bug fixes.

Spring Security 
[6.2.2|https://github.com/spring-projects/spring-security/releases/tag/6.2.2] 
also includes several minor bug fixes and transitive dependency upgrades.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Updated] (NIFI-12810) Upgrade SLF4J to 2.0.12

2024-02-16 Thread David Handermann (Jira)


 [ 
https://issues.apache.org/jira/browse/NIFI-12810?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

David Handermann updated NIFI-12810:

Status: Patch Available  (was: Open)

> Upgrade SLF4J to 2.0.12
> ---
>
> Key: NIFI-12810
> URL: https://issues.apache.org/jira/browse/NIFI-12810
> Project: Apache NiFi
>  Issue Type: Improvement
>  Components: Core Framework
>Reporter: David Handermann
>Assignee: David Handermann
>Priority: Minor
>  Labels: backport-needed
> Fix For: 2.0.0, 1.26.0
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> SLF4J [2.0.12|https://www.slf4j.org/news.html#2.0.12] includes minor updates 
> for modular exported packages.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[PR] NIFI-12810 Upgrade SLF4J from 2.0.11 to 2.0.12 [nifi]

2024-02-16 Thread via GitHub


exceptionfactory opened a new pull request, #8421:
URL: https://github.com/apache/nifi/pull/8421

   # Summary
   
   [NIFI-12810](https://issues.apache.org/jira/browse/NIFI-12810) Upgrades 
SLF4J from 2.0.11 to [2.0.12](https://www.slf4j.org/news.html#2.0.12) 
incorporating minor updates. The upgrade is applicable to both main and support 
branches.
   
   # Tracking
   
   Please complete the following tracking steps prior to pull request creation.
   
   ### Issue Tracking
   
   - [X] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue 
created
   
   ### Pull Request Tracking
   
   - [X] Pull Request title starts with Apache NiFi Jira issue number, such as 
`NIFI-0`
   - [X] Pull Request commit message starts with Apache NiFi Jira issue number, 
as such `NIFI-0`
   
   ### Pull Request Formatting
   
   - [X] Pull Request based on current revision of the `main` branch
   - [X] Pull Request refers to a feature branch with one commit containing 
changes
   
   # Verification
   
   Please indicate the verification steps performed prior to pull request 
creation.
   
   ### Build
   
   - [X] Build completed using `mvn clean install -P contrib-check`
 - [X] JDK 21
   
   ### Licensing
   
   - [ ] New dependencies are compatible with the [Apache License 
2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License 
Policy](https://www.apache.org/legal/resolved.html)
   - [ ] New dependencies are documented in applicable `LICENSE` and `NOTICE` 
files
   
   ### Documentation
   
   - [ ] Documentation formatting appears as expected in rendered files
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[jira] [Created] (NIFI-12810) Upgrade SLF4J to 2.0.12

2024-02-16 Thread David Handermann (Jira)
David Handermann created NIFI-12810:
---

 Summary: Upgrade SLF4J to 2.0.12
 Key: NIFI-12810
 URL: https://issues.apache.org/jira/browse/NIFI-12810
 Project: Apache NiFi
  Issue Type: Improvement
  Components: Core Framework
Reporter: David Handermann
Assignee: David Handermann
 Fix For: 2.0.0, 1.26.0


SLF4J [2.0.12|https://www.slf4j.org/news.html#2.0.12] includes minor updates 
for modular exported packages.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (NIFI-12809) PublishKafkaRecord_2_6 - RoundRobin partitioner skipping every other partition

2024-02-16 Thread Steven Youtsey (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-12809?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17818102#comment-17818102
 ] 

Steven Youtsey commented on NIFI-12809:
---

I did not. 
That one seems to be spot on.

 

> PublishKafkaRecord_2_6 - RoundRobin partitioner skipping every other partition
> --
>
> Key: NIFI-12809
> URL: https://issues.apache.org/jira/browse/NIFI-12809
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Extensions
>Affects Versions: 1.25.0
>Reporter: Steven Youtsey
>Priority: Major
>  Labels: kafka, partitioners, publish
>
> When configured to use the NiFi RoundRobin partitioner, the processor 
> publishes to every other partition. If the number of partitions in the topic 
> and the number of records being published are the right combination, this 
> problem is masked. We see this issue when we set the partitions to 26, but 
> not when set to 25. 
> I took a code-dive into the o.a.k.c.producer.KafkaProducer and discovered 
> that it is invoking the Partitioner twice when a "new batch" is created. 
> Thus, the RoundRobin partitioner bumps the index by 2. If the RoundRobin 
> partitioner overwrote the onNewBatch method, this problem could be solved.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


knguyen1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492966006


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -16,25 +16,85 @@
  */
 package org.apache.nifi.processors.standard;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
 import java.io.IOException;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.util.stream.Stream;
 
+import org.apache.nifi.components.DescribedValue;
+import org.apache.nifi.processor.Relationship;
+import org.apache.nifi.processors.standard.encoding.EncodingMode;
+import org.apache.nifi.processors.standard.encoding.EncodingType;
+import org.apache.nifi.processors.standard.encoding.LineOutputMode;
 import org.apache.nifi.util.MockFlowFile;
+import org.apache.nifi.util.StringUtils;
 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 org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+class TestEncodeContent {
 
-public class TestEncodeContent {
+private static final String LOREM_IPSUM = "Lorem ipsum dolor sit amet, 
consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et 
dolore magna aliqua.";
 
 private static final Path FILE_PATH = 
Paths.get("src/test/resources/hello.txt");
+private TestRunner testRunner;
+
+@BeforeEach
+void setUp() {
+testRunner = TestRunners.newTestRunner(EncodeContent.class);
+}
+
+@Test
+void testBase64RoundTrip() throws IOException {
+runTestRoundTrip(EncodingType.BASE64_ENCODING.getValue());
+}
+
+@Test
+void testFailDecodeNotBase64() throws IOException {
+runTestDecodeFailure(EncodingType.BASE64_ENCODING.getValue());
+}

Review Comment:
   Refactored and collapsed: 
https://github.com/apache/nifi/pull/8417/commits/e994e3c46c3dae2fb4bed944826a22c2bb5fc0e3
 and 
https://github.com/apache/nifi/pull/8417/commits/1a15112f86842f64ecf72e56371bef62c685614b



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


dan-s1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492949112


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -16,25 +16,85 @@
  */
 package org.apache.nifi.processors.standard;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
 import java.io.IOException;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.util.stream.Stream;
 
+import org.apache.nifi.components.DescribedValue;
+import org.apache.nifi.processor.Relationship;
+import org.apache.nifi.processors.standard.encoding.EncodingMode;
+import org.apache.nifi.processors.standard.encoding.EncodingType;
+import org.apache.nifi.processors.standard.encoding.LineOutputMode;
 import org.apache.nifi.util.MockFlowFile;
+import org.apache.nifi.util.StringUtils;
 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 org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+class TestEncodeContent {
 
-public class TestEncodeContent {
+private static final String LOREM_IPSUM = "Lorem ipsum dolor sit amet, 
consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et 
dolore magna aliqua.";
 
 private static final Path FILE_PATH = 
Paths.get("src/test/resources/hello.txt");
+private TestRunner testRunner;
+
+@BeforeEach
+void setUp() {
+testRunner = TestRunners.newTestRunner(EncodeContent.class);
+}
+
+@Test
+void testBase64RoundTrip() throws IOException {
+runTestRoundTrip(EncodingType.BASE64_ENCODING.getValue());
+}
+
+@Test
+void testFailDecodeNotBase64() throws IOException {
+runTestDecodeFailure(EncodingType.BASE64_ENCODING.getValue());
+}

Review Comment:
   We are getting closer. We can collapse six of the unit tests into two 
parameterized tests and remove two methods. Tests`testBase64RoundTrip(), 
testBase32RoundTrip() and testHexRoundTrip()` can be collapsed into a 
paramaterized test with the body from `runTestRoundTrip`. In this case you 
would use the `@EnumSource` annotation for the argument.
   
   ```
   @ParameterizedTest
   @EnumSource(value = EncodingType.class)
   void testRoundTrip(EncodingType encoding) throws IOException {
   testRunner.setProperty(EncodeContent.MODE, EncodingMode.ENCODE);
   testRunner.setProperty(EncodeContent.ENCODING, encoding);
   
   testRunner.enqueue(FILE_PATH);
   testRunner.clearTransferState();
   testRunner.run();
   
   testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 
1);
   
   MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
   testRunner.assertQueueEmpty();
   
   testRunner.setProperty(EncodeContent.MODE, EncodingMode.DECODE);
   testRunner.enqueue(flowFile);
   testRunner.clearTransferState();
   testRunner.run();
   testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 
1);
   
   flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
   flowFile.assertContentEquals(FILE_PATH);
   }
   ```
   
   Please add this and implement similar code for `testFailDecodeNotHex(), 
testFailDecodeNotBase32(), testFailDecodeNotHex() and runTestDecodeFailure`.
   Also do not forget the import
   `import org.junit.jupiter.params.provider.EnumSource;`
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-8134 allow unescapeJson Record Path function to recursively convert Maps to Records [nifi]

2024-02-16 Thread via GitHub


ChrisSamo632 commented on PR #7745:
URL: https://github.com/apache/nifi/pull/7745#issuecomment-1949284657

   Have rebased from latest `main` to address merge conflicts, this PR should 
be ready for re-review @markap14 / @exceptionfactory 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-8134 allow unescapeJson Record Path function to recursively convert Maps to Records [nifi]

2024-02-16 Thread via GitHub


ChrisSamo632 commented on code in PR #7745:
URL: https://github.com/apache/nifi/pull/7745#discussion_r1420401479


##
nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/util/DataTypeUtils.java:
##
@@ -469,21 +473,51 @@ public static RecordSchema inferSchema(final Map values, final S
 final RecordField recordField = new RecordField(key, 
inferredDataType, true);
 inferredFieldTypes.add(recordField);
 
-final Object coercedValue = convertType(rawValue, 
inferredDataType, fieldName, charset);
-coercedValues.put(key, coercedValue);
+convertType(rawValue, inferredDataType, fieldName, charset);
 }
 
-final RecordSchema inferredSchema = new 
SimpleRecordSchema(inferredFieldTypes);
-return inferredSchema;
+return new SimpleRecordSchema(inferredFieldTypes);
 }
 
 public static Record toRecord(final Object value, final String fieldName, 
final Charset charset) {
+return toRecord(value, fieldName, charset, false);
+}
+
+private static Object covertObjectToRecord(final Object rawValue, final 
String key, final Charset charset) {
+final Object coercedValue;
+if (rawValue instanceof Map) {
+coercedValue = toRecord(rawValue, key, charset, true);
+} else if (rawValue instanceof Object[]) {
+final Object[] objArray = (Object[]) rawValue;
+coercedValue = Arrays.stream(objArray).noneMatch(o -> o instanceof 
Map)
+? objArray
+: Arrays.stream(objArray).map(o -> toRecord(o, key, 
charset, true)).toArray();
+} else if (rawValue instanceof Collection) {
+final Collection objCollection = (Collection) rawValue;
+// Records have ARRAY DataTypes, so convert any Collections
+coercedValue = objCollection.stream().noneMatch(o -> o instanceof 
Map)
+? objCollection.toArray()
+: objCollection.stream().map(o -> toRecord(o, key, 
charset, true)).toArray();

Review Comment:
   That's fair, I've reverted this and found a couple of other Streams within 
`DataTypeUtils` that should probably be changed too, will include in this PR



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-8134 allow unescapeJson Record Path function to recursively convert Maps to Records [nifi]

2024-02-16 Thread via GitHub


ChrisSamo632 commented on code in PR #7745:
URL: https://github.com/apache/nifi/pull/7745#discussion_r1420713574


##
nifi-commons/nifi-record-path/src/test/java/org/apache/nifi/record/path/TestRecordPath.java:
##
@@ -1837,7 +1838,41 @@ public void testUnescapeJson() {
 put("firstName", "John");
 put("age", 30);
 }}, "json_str"),
-RecordPath.compile("unescapeJson(/json_str, 
'true')").evaluate(recordFromMap).getSelectedFields().findFirst().orElseThrow(IllegalStateException::new).getValue()
+RecordPath.compile("unescapeJson(/json_str, 
'true')").evaluate(recordFromMap).getSelectedFields().findFirst().orElseThrow(AssertionError::new).getValue()
+);
+
+// test nested Record converted from Map Object
+final Record nestedRecordFromMap = new MapRecord(schema,
+Collections.singletonMap(
+"json_str",
+
"{\"firstName\":\"John\",\"age\":30,\"addresses\":[{\"address_1\":\"123 Fake 
Street\"}]}")
+);
+// recursively convert Maps to Records (addresses becomes and ARRAY or 
RECORDs)
+assertEquals(
+DataTypeUtils.toRecord(new LinkedHashMap(){{
+put("firstName", "John");
+put("age", 30);
+put("addresses", new Object[] 
{DataTypeUtils.toRecord(Collections.singletonMap("address_1", "123 Fake 
Street"), "addresses")});
+}}, "json_str"),

Review Comment:
   Absolutely. The only problem is that `Map.of` doesn't provide deterministic 
ordering, so we do need to use `LinkedHashMap`s in some places, which I've 
changed to use the approach suggested.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


dan-s1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492949112


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -16,25 +16,85 @@
  */
 package org.apache.nifi.processors.standard;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
 import java.io.IOException;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.util.stream.Stream;
 
+import org.apache.nifi.components.DescribedValue;
+import org.apache.nifi.processor.Relationship;
+import org.apache.nifi.processors.standard.encoding.EncodingMode;
+import org.apache.nifi.processors.standard.encoding.EncodingType;
+import org.apache.nifi.processors.standard.encoding.LineOutputMode;
 import org.apache.nifi.util.MockFlowFile;
+import org.apache.nifi.util.StringUtils;
 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 org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+class TestEncodeContent {
 
-public class TestEncodeContent {
+private static final String LOREM_IPSUM = "Lorem ipsum dolor sit amet, 
consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et 
dolore magna aliqua.";
 
 private static final Path FILE_PATH = 
Paths.get("src/test/resources/hello.txt");
+private TestRunner testRunner;
+
+@BeforeEach
+void setUp() {
+testRunner = TestRunners.newTestRunner(EncodeContent.class);
+}
+
+@Test
+void testBase64RoundTrip() throws IOException {
+runTestRoundTrip(EncodingType.BASE64_ENCODING.getValue());
+}
+
+@Test
+void testFailDecodeNotBase64() throws IOException {
+runTestDecodeFailure(EncodingType.BASE64_ENCODING.getValue());
+}

Review Comment:
   We are getting closer. We can collapse six of the unit tests into two 
parameterized tests and remove two methods. Tests`testBase64RoundTrip(), 
testBase32RoundTrip() and testHexRoundTrip()` can be collapsed into a 
paramaterized test with the body from `runTestRoundTrip`. In this case you 
would use the `@EnumSource` annotation for the argument.
   
   ```
   @ParameterizedTest
   @EnumSource(value = EncodingType.class)
   void testRoundTrip(EncodingType encoding) throws IOException {
   testRunner.setProperty(EncodeContent.MODE, EncodingMode.ENCODE);
   testRunner.setProperty(EncodeContent.ENCODING, encoding);
   
   testRunner.enqueue(FILE_PATH);
   testRunner.clearTransferState();
   testRunner.run();
   
   testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 
1);
   
   MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
   testRunner.assertQueueEmpty();
   
   testRunner.setProperty(EncodeContent.MODE, 
EncodingMode.DECODE.getValue());
   testRunner.enqueue(flowFile);
   testRunner.clearTransferState();
   testRunner.run();
   testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 
1);
   
   flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
   flowFile.assertContentEquals(FILE_PATH);
   }
   ```
   
   Please add this and implement similar code for `testFailDecodeNotHex(), 
testFailDecodeNotBase32(), testFailDecodeNotHex() and runTestDecodeFailure`.
   Also do not forget the import
   `import org.junit.jupiter.params.provider.EnumSource;`
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


dan-s1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492949112


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -16,25 +16,85 @@
  */
 package org.apache.nifi.processors.standard;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
 import java.io.IOException;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.util.stream.Stream;
 
+import org.apache.nifi.components.DescribedValue;
+import org.apache.nifi.processor.Relationship;
+import org.apache.nifi.processors.standard.encoding.EncodingMode;
+import org.apache.nifi.processors.standard.encoding.EncodingType;
+import org.apache.nifi.processors.standard.encoding.LineOutputMode;
 import org.apache.nifi.util.MockFlowFile;
+import org.apache.nifi.util.StringUtils;
 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 org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+class TestEncodeContent {
 
-public class TestEncodeContent {
+private static final String LOREM_IPSUM = "Lorem ipsum dolor sit amet, 
consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et 
dolore magna aliqua.";
 
 private static final Path FILE_PATH = 
Paths.get("src/test/resources/hello.txt");
+private TestRunner testRunner;
+
+@BeforeEach
+void setUp() {
+testRunner = TestRunners.newTestRunner(EncodeContent.class);
+}
+
+@Test
+void testBase64RoundTrip() throws IOException {
+runTestRoundTrip(EncodingType.BASE64_ENCODING.getValue());
+}
+
+@Test
+void testFailDecodeNotBase64() throws IOException {
+runTestDecodeFailure(EncodingType.BASE64_ENCODING.getValue());
+}

Review Comment:
   We are getting closer. We can collapse six of the unit tests into two 
parameterized tests and remove two methods.
   Tests`testBase64RoundTrip(), testBase32RoundTrip() and testHexRoundTrip()` 
can be collapsed into a paramaterized test with the body from 
`runTestRoundTrip`. In this case you would use the `@EnumSource` annotation for 
the argument.
   
   ```
   @ParameterizedTest
   @EnumSource(value = EncodingType.class)
   void testRoundTrip(EncodingType encoding) throws IOException {
   testRunner.setProperty(EncodeContent.MODE, EncodingMode.ENCODE);
   testRunner.setProperty(EncodeContent.ENCODING, encoding);
   
   testRunner.enqueue(FILE_PATH);
   testRunner.clearTransferState();
   testRunner.run();
   
   testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 
1);
   
   MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
   testRunner.assertQueueEmpty();
   
   testRunner.setProperty(EncodeContent.MODE, 
EncodingMode.DECODE.getValue());
   testRunner.enqueue(flowFile);
   testRunner.clearTransferState();
   testRunner.run();
   testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 
1);
   
   flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
   flowFile.assertContentEquals(FILE_PATH);
   }
   ```
   
   Please add this and implement similar code for `testFailDecodeNotHex(), 
testFailDecodeNotBase32(), testFailDecodeNotHex() and runTestDecodeFailure`.
   Also do not forget the import
   `import org.junit.jupiter.params.provider.EnumSource;`
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12255 refactor PutElasticsearchRecord and PutElasticsearchJson relationships to be more consistent with other processors [nifi]

2024-02-16 Thread via GitHub


ChrisSamo632 commented on PR #7940:
URL: https://github.com/apache/nifi/pull/7940#issuecomment-1949279317

   I've rebased from latest `main` to address merge conflicts.
   
   Let me know your thoughts on previous comments @exceptionfactory.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[jira] [Commented] (NIFI-12232) Frequent "failed to connect node to cluster because local flow controller partially updated. Administrator should disconnect node and review flow for corruption"

2024-02-16 Thread Joe Witt (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-12232?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17818091#comment-17818091
 ] 

Joe Witt commented on NIFI-12232:
-

Also hit by

https://apachenifi.slack.com/archives/C0L9VCD47/p1708113098305609

Roman Wesołowski
  29 minutes ago
Hi all,
I have 3 nodes Nifi cluster with 2.0.0-M1 version. Till today everything was 
working correctly, during my development something strange happeded. For some 
reason 2 nodes disconnected from cluster, and I am not able to reconnect them 
to the cluster. I have resterted nodes but without successes. All machines are 
up but can not connect each other.  Any help would be appreciated.
2024-02-16 15:14:36,663 ERROR [Reconnect to Cluster] 
o.a.n.c.c.node.NodeClusterCoordinator Event Reported for 10.120.8.252:8080 -- 
Node disconnected from cluster due to 
org.apache.nifi.controller.serialization.FlowSynchronizationException: Failed 
to connect node to cluster because local flow controller partially updated. 
Administrator should disconnect node andreview flow for corruption.

> Frequent "failed to connect node to cluster because local flow controller 
> partially updated. Administrator should disconnect node and review flow for 
> corruption"
> -
>
> Key: NIFI-12232
> URL: https://issues.apache.org/jira/browse/NIFI-12232
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Configuration Management
>Affects Versions: 1.23.2
>Reporter: John Joseph
>Assignee: Mark Payne
>Priority: Major
> Attachments: image-2023-10-16-16-12-31-027.png, 
> image-2024-02-14-13-33-44-354.png
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> This is an issue that we have been observing in the 1.23.2 version of NiFi 
> when we try upgrade,
> Since Rolling upgrade is not supported in NiFi, we scale out the revision 
> that is running and {_}run a helm upgrade{_}.
> We have NIFI running in k8s cluster mode, there is a post job that call the 
> Tenants and policies API. On a successful run it would run like this
> {code:java}
> set_policies() Action: 'read' Resource: '/flow' entity_id: 
> 'ad2d3ad6-5d69-3e0f-95e9-c7feb36e2de5' entity_name: 'CN=nifi-api-admin' 
> entity_type: 'USER'
> set_policies() status: '200'
> 'read' '/flow' policy already exists. It will be updated...
> set_policies() fetching policy inside -eq 200 status: '200'
> set_policies() after update PUT: '200'
> set_policies() Action: 'read' Resource: '/tenants' entity_id: 
> 'ad2d3ad6-5d69-3e0f-95e9-c7feb36e2de5' entity_name: 'CN=nifi-api-admin' 
> entity_type: 'USER'
> set_policies() status: '200'{code}
> *_This job was running fine in 1.23.0, 1.22 and other previous versions._* In 
> {*}{{1.23.2}}{*}, we are noticing that the job is failing very frequently 
> with the error logs;
> {code:java}
> set_policies() Action: 'read' Resource: '/flow' entity_id: 
> 'ad2d3ad6-5d69-3e0f-95e9-c7feb36e2de5' entity_name: 'CN=nifi-api-admin' 
> entity_type: 'USER'
> set_policies() status: '200'
> 'read' '/flow' policy already exists. It will be updated...
> set_policies() fetching policy inside -eq 200 status: '200'
> set_policies() after update PUT: '400'
> An error occurred getting 'read' '/flow' policy: 'This node is disconnected 
> from its configured cluster. The requested change will only be allowed if the 
> flag to acknowledge the disconnected node is set.'{code}
> {{_*'This node is disconnected from its configured cluster. The requested 
> change will only be allowed if the flag to acknowledge the disconnected node 
> is set.'*_}}
> The job is configured to run only after all the pods are up and running. 
> Though the pods are up we see exception is the inside pods
> {code:java}
> org.apache.nifi.controller.serialization.FlowSynchronizationException: Failed 
> to connect node to cluster because local flow controller partially updated. 
> Administrator should disconnect node and review flow for corruption.
> at 
> org.apache.nifi.controller.StandardFlowService.loadFromConnectionResponse(StandardFlowService.java:1059)
> at 
> org.apache.nifi.controller.StandardFlowService.handleReconnectionRequest(StandardFlowService.java:667)
> at 
> org.apache.nifi.controller.StandardFlowService.access$200(StandardFlowService.java:107)
> at 
> org.apache.nifi.controller.StandardFlowService$1.run(StandardFlowService.java:396)
> at java.base/java.lang.Thread.run(Thread.java:833)
> Caused by: 
> org.apache.nifi.controller.serialization.FlowSynchronizationException: 
> java.lang.IllegalStateException: Cannot change destination of Connection 
> because the current destination is running
> at 
> 

Re: [PR] NIFI-12773: Added join and anchored RecordPath function [nifi]

2024-02-16 Thread via GitHub


ChrisSamo632 commented on code in PR #8391:
URL: https://github.com/apache/nifi/pull/8391#discussion_r1492937244


##
nifi-commons/nifi-record-path/src/main/java/org/apache/nifi/record/path/functions/Anchored.java:
##
@@ -0,0 +1,80 @@
+/*
+ * 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.record.path.functions;
+
+import org.apache.nifi.record.path.FieldValue;
+import org.apache.nifi.record.path.RecordPathEvaluationContext;
+import org.apache.nifi.record.path.StandardRecordPathEvaluationContext;
+import org.apache.nifi.record.path.paths.RecordPathSegment;
+import org.apache.nifi.serialization.record.Record;
+
+import java.util.Arrays;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
+
+public class Anchored extends RecordPathSegment {
+
+private final RecordPathSegment anchorPath;
+private final RecordPathSegment evaluationPath;
+
+public Anchored(final RecordPathSegment anchorPath, final 
RecordPathSegment evaluationPath, final boolean absolute) {
+super("anchored", null, absolute);
+
+this.anchorPath = anchorPath;
+this.evaluationPath = evaluationPath;
+}
+
+
+@Override
+public Stream evaluate(final RecordPathEvaluationContext 
context) {
+final Stream anchoredStream = anchorPath.evaluate(context);
+
+return anchoredStream.flatMap(fv -> {
+final Object value = fv.getValue();
+return evaluate(value);
+});
+}
+
+private Stream evaluate(final Object value) {
+if (value == null) {
+return Stream.of();
+}
+if (value instanceof Record) {
+final RecordPathEvaluationContext recordPathEvaluateContext = new 
StandardRecordPathEvaluationContext((Record) value);
+return evaluationPath.evaluate(recordPathEvaluateContext);
+}
+if (value instanceof final Record[] array) {
+return Arrays.stream(array).flatMap(element -> {
+final RecordPathEvaluationContext recordPathEvaluateContext = 
new StandardRecordPathEvaluationContext(element);
+return evaluationPath.evaluate(recordPathEvaluateContext);
+});
+}
+if (value instanceof final Iterable iterable) {
+return StreamSupport.stream(iterable.spliterator(), 
false).flatMap(element -> {
+if (!(element instanceof Record)) {
+return Stream.of();
+}
+
+final RecordPathEvaluationContext recordPathEvaluateContext = 
new StandardRecordPathEvaluationContext((Record) element);
+return evaluationPath.evaluate(recordPathEvaluateContext);

Review Comment:
   These lines are duplicated, albeit they're fairly trivial, but would it be 
better to create an `evaluateRecordFieldValue` method to be used by each `if` 
block here?



##
nifi-commons/nifi-record-path/src/main/java/org/apache/nifi/record/path/functions/Anchored.java:
##
@@ -0,0 +1,80 @@
+/*
+ * 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.record.path.functions;
+
+import org.apache.nifi.record.path.FieldValue;
+import org.apache.nifi.record.path.RecordPathEvaluationContext;
+import org.apache.nifi.record.path.StandardRecordPathEvaluationContext;
+import org.apache.nifi.record.path.paths.RecordPathSegment;
+import org.apache.nifi.serialization.record.Record;
+
+import 

[jira] [Updated] (NIFI-12232) Frequent "failed to connect node to cluster because local flow controller partially updated. Administrator should disconnect node and review flow for corruption"

2024-02-16 Thread Mark Payne (Jira)


 [ 
https://issues.apache.org/jira/browse/NIFI-12232?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mark Payne updated NIFI-12232:
--
Assignee: Mark Payne
  Status: Patch Available  (was: Open)

> Frequent "failed to connect node to cluster because local flow controller 
> partially updated. Administrator should disconnect node and review flow for 
> corruption"
> -
>
> Key: NIFI-12232
> URL: https://issues.apache.org/jira/browse/NIFI-12232
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Configuration Management
>Affects Versions: 1.23.2
>Reporter: John Joseph
>Assignee: Mark Payne
>Priority: Major
> Attachments: image-2023-10-16-16-12-31-027.png, 
> image-2024-02-14-13-33-44-354.png
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> This is an issue that we have been observing in the 1.23.2 version of NiFi 
> when we try upgrade,
> Since Rolling upgrade is not supported in NiFi, we scale out the revision 
> that is running and {_}run a helm upgrade{_}.
> We have NIFI running in k8s cluster mode, there is a post job that call the 
> Tenants and policies API. On a successful run it would run like this
> {code:java}
> set_policies() Action: 'read' Resource: '/flow' entity_id: 
> 'ad2d3ad6-5d69-3e0f-95e9-c7feb36e2de5' entity_name: 'CN=nifi-api-admin' 
> entity_type: 'USER'
> set_policies() status: '200'
> 'read' '/flow' policy already exists. It will be updated...
> set_policies() fetching policy inside -eq 200 status: '200'
> set_policies() after update PUT: '200'
> set_policies() Action: 'read' Resource: '/tenants' entity_id: 
> 'ad2d3ad6-5d69-3e0f-95e9-c7feb36e2de5' entity_name: 'CN=nifi-api-admin' 
> entity_type: 'USER'
> set_policies() status: '200'{code}
> *_This job was running fine in 1.23.0, 1.22 and other previous versions._* In 
> {*}{{1.23.2}}{*}, we are noticing that the job is failing very frequently 
> with the error logs;
> {code:java}
> set_policies() Action: 'read' Resource: '/flow' entity_id: 
> 'ad2d3ad6-5d69-3e0f-95e9-c7feb36e2de5' entity_name: 'CN=nifi-api-admin' 
> entity_type: 'USER'
> set_policies() status: '200'
> 'read' '/flow' policy already exists. It will be updated...
> set_policies() fetching policy inside -eq 200 status: '200'
> set_policies() after update PUT: '400'
> An error occurred getting 'read' '/flow' policy: 'This node is disconnected 
> from its configured cluster. The requested change will only be allowed if the 
> flag to acknowledge the disconnected node is set.'{code}
> {{_*'This node is disconnected from its configured cluster. The requested 
> change will only be allowed if the flag to acknowledge the disconnected node 
> is set.'*_}}
> The job is configured to run only after all the pods are up and running. 
> Though the pods are up we see exception is the inside pods
> {code:java}
> org.apache.nifi.controller.serialization.FlowSynchronizationException: Failed 
> to connect node to cluster because local flow controller partially updated. 
> Administrator should disconnect node and review flow for corruption.
> at 
> org.apache.nifi.controller.StandardFlowService.loadFromConnectionResponse(StandardFlowService.java:1059)
> at 
> org.apache.nifi.controller.StandardFlowService.handleReconnectionRequest(StandardFlowService.java:667)
> at 
> org.apache.nifi.controller.StandardFlowService.access$200(StandardFlowService.java:107)
> at 
> org.apache.nifi.controller.StandardFlowService$1.run(StandardFlowService.java:396)
> at java.base/java.lang.Thread.run(Thread.java:833)
> Caused by: 
> org.apache.nifi.controller.serialization.FlowSynchronizationException: 
> java.lang.IllegalStateException: Cannot change destination of Connection 
> because the current destination is running
> at 
> org.apache.nifi.controller.serialization.VersionedFlowSynchronizer.synchronizeFlow(VersionedFlowSynchronizer.java:448)
> at 
> org.apache.nifi.controller.serialization.VersionedFlowSynchronizer.sync(VersionedFlowSynchronizer.java:206)
> at 
> org.apache.nifi.controller.serialization.StandardFlowSynchronizer.sync(StandardFlowSynchronizer.java:42)
> at 
> org.apache.nifi.controller.FlowController.synchronize(FlowController.java:1530)
> at 
> org.apache.nifi.persistence.StandardFlowConfigurationDAO.load(StandardFlowConfigurationDAO.java:104)
> at 
> org.apache.nifi.controller.StandardFlowService.loadFromBytes(StandardFlowService.java:817)
> at 
> org.apache.nifi.controller.StandardFlowService.loadFromConnectionResponse(StandardFlowService.java:1028)
> ... 4 common frames omitted
> Caused by: java.lang.IllegalStateException: Cannot change destination of 
> Connection because the current destination is running
> at 
> 

[jira] [Comment Edited] (NIFI-12809) PublishKafkaRecord_2_6 - RoundRobin partitioner skipping every other partition

2024-02-16 Thread Joe Witt (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-12809?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17818086#comment-17818086
 ] 

Joe Witt edited comment on NIFI-12809 at 2/16/24 7:56 PM:
--

[~slyouts] Did you review any Kafka bugs for the noted scenario?  I see 
https://issues.apache.org/jira/browse/KAFKA-13180 that sounds very closely 
related.

If there is a reasonable workaround for this issue that we can control on the 
NiFi side we should ensure we remove any such change in versions it is resolved 
in (such as Kafka 3 components/etc..) 



was (Author: joewitt):
[~slyouts] Did you review any Kafka bugs for the noted scenario?  I see 
https://issues.apache.org/jira/browse/KAFKA-13180 that sounds very closely 
related.


> PublishKafkaRecord_2_6 - RoundRobin partitioner skipping every other partition
> --
>
> Key: NIFI-12809
> URL: https://issues.apache.org/jira/browse/NIFI-12809
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Extensions
>Affects Versions: 1.25.0
>Reporter: Steven Youtsey
>Priority: Major
>  Labels: kafka, partitioners, publish
>
> When configured to use the NiFi RoundRobin partitioner, the processor 
> publishes to every other partition. If the number of partitions in the topic 
> and the number of records being published are the right combination, this 
> problem is masked. We see this issue when we set the partitions to 26, but 
> not when set to 25. 
> I took a code-dive into the o.a.k.c.producer.KafkaProducer and discovered 
> that it is invoking the Partitioner twice when a "new batch" is created. 
> Thus, the RoundRobin partitioner bumps the index by 2. If the RoundRobin 
> partitioner overwrote the onNewBatch method, this problem could be solved.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (NIFI-12809) PublishKafkaRecord_2_6 - RoundRobin partitioner skipping every other partition

2024-02-16 Thread Joe Witt (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-12809?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17818086#comment-17818086
 ] 

Joe Witt commented on NIFI-12809:
-

[~slyouts] Did you review any Kafka bugs for the noted scenario?  I see 
https://issues.apache.org/jira/browse/KAFKA-13180 that sounds very closely 
related.


> PublishKafkaRecord_2_6 - RoundRobin partitioner skipping every other partition
> --
>
> Key: NIFI-12809
> URL: https://issues.apache.org/jira/browse/NIFI-12809
> Project: Apache NiFi
>  Issue Type: Bug
>  Components: Extensions
>Affects Versions: 1.25.0
>Reporter: Steven Youtsey
>Priority: Major
>  Labels: kafka, partitioners, publish
>
> When configured to use the NiFi RoundRobin partitioner, the processor 
> publishes to every other partition. If the number of partitions in the topic 
> and the number of records being published are the right combination, this 
> problem is masked. We see this issue when we set the partitions to 26, but 
> not when set to 25. 
> I took a code-dive into the o.a.k.c.producer.KafkaProducer and discovered 
> that it is invoking the Partitioner twice when a "new batch" is created. 
> Thus, the RoundRobin partitioner bumps the index by 2. If the RoundRobin 
> partitioner overwrote the onNewBatch method, this problem could be solved.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[PR] NIFI-12784 Refactored to have the "Path Not Found Behavior" property … [nifi]

2024-02-16 Thread via GitHub


dan-s1 opened a new pull request, #8420:
URL: https://github.com/apache/nifi/pull/8420

   …be dependent on the "Destination" property when its value is 
"flowfile-attribute".
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   # Summary
   
   [NIFI-12784](https://issues.apache.org/jira/browse/NIFI-12784)
   
   # Tracking
   
   Please complete the following tracking steps prior to pull request creation.
   
   ### Issue Tracking
   
   - [ ] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue 
created
   
   ### Pull Request Tracking
   
   - [ ] Pull Request title starts with Apache NiFi Jira issue number, such as 
`NIFI-0`
   - [ ] Pull Request commit message starts with Apache NiFi Jira issue number, 
as such `NIFI-0`
   
   ### Pull Request Formatting
   
   - [ ] Pull Request based on current revision of the `main` branch
   - [ ] Pull Request refers to a feature branch with one commit containing 
changes
   
   # Verification
   
   Please indicate the verification steps performed prior to pull request 
creation.
   
   ### Build
   
   - [ ] Build completed using `mvn clean install -P contrib-check`
 - [ ] JDK 21
   
   ### Licensing
   
   - [ ] New dependencies are compatible with the [Apache License 
2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License 
Policy](https://www.apache.org/legal/resolved.html)
   - [ ] New dependencies are documented in applicable `LICENSE` and `NOTICE` 
files
   
   ### Documentation
   
   - [ ] Documentation formatting appears as expected in rendered files
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[jira] [Created] (NIFI-12809) PublishKafkaRecord_2_6 - RoundRobin partitioner skipping every other partition

2024-02-16 Thread Steven Youtsey (Jira)
Steven Youtsey created NIFI-12809:
-

 Summary: PublishKafkaRecord_2_6 - RoundRobin partitioner skipping 
every other partition
 Key: NIFI-12809
 URL: https://issues.apache.org/jira/browse/NIFI-12809
 Project: Apache NiFi
  Issue Type: Bug
  Components: Extensions
Affects Versions: 1.25.0
Reporter: Steven Youtsey


When configured to use the NiFi RoundRobin partitioner, the processor publishes 
to every other partition. If the number of partitions in the topic and the 
number of records being published are the right combination, this problem is 
masked. We see this issue when we set the partitions to 26, but not when set to 
25. 

I took a code-dive into the o.a.k.c.producer.KafkaProducer and discovered that 
it is invoking the Partitioner twice when a "new batch" is created. Thus, the 
RoundRobin partitioner bumps the index by 2. If the RoundRobin partitioner 
overwrote the onNewBatch method, this problem could be solved.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


knguyen1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492898540


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, "Zm9v", "foo");
+}
 
-MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-testRunner.assertQueueEmpty();
+@Test void testBasicDecodeHex() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.HEX_ENCODING, "666F6F", "foo");
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.enqueue(flowFile);
-testRunner.clearTransferState();
-testRunner.run();
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicEncodeHex0() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "hello", "68656C6C6F");
+}
 
-flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-flowFile.assertContentEquals(FILE_PATH);
+@Test void testBasicEncodeHex1() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "foo", "666F6F");
 }
 
-@Test
-public void testFailDecodeNotHex() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testBasicEncodeBase320() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "hello", "NBSWY3DP" + System.lineSeparator());
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+@Test void testBasicEncodeBase321() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "foo", "MZXW6===" + System.lineSeparator());
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
+@Test void testBasicEncodeBase640() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+"hello",
+"aGVsbG8=" + System.lineSeparator());
+}
+
+@Test void testBasicEncodeBase641() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+"foo",
+"Zm9v" + System.lineSeparator());
+}

Review Comment:
   Refactored 
https://github.com/apache/nifi/pull/8417/commits/a4ee842160677e6cefc544bdab2995700ca26bd2



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


knguyen1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492890886


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}

Review Comment:
   Refactored 
https://github.com/apache/nifi/pull/8417/commits/ed7bd5ad7d3c0072d0eb839f1897c993d6730666



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


knguyen1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492890248


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, "Zm9v", "foo");
+}
 
-MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-testRunner.assertQueueEmpty();
+@Test void testBasicDecodeHex() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.HEX_ENCODING, "666F6F", "foo");
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.enqueue(flowFile);
-testRunner.clearTransferState();
-testRunner.run();
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicEncodeHex0() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "hello", "68656C6C6F");
+}

Review Comment:
   Refactored 
https://github.com/apache/nifi/pull/8417/commits/ed7bd5ad7d3c0072d0eb839f1897c993d6730666



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


knguyen1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492873788


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, "Zm9v", "foo");
+}
 
-MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-testRunner.assertQueueEmpty();
+@Test void testBasicDecodeHex() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.HEX_ENCODING, "666F6F", "foo");
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.enqueue(flowFile);
-testRunner.clearTransferState();
-testRunner.run();
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicEncodeHex0() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "hello", "68656C6C6F");
+}
 
-flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-flowFile.assertContentEquals(FILE_PATH);
+@Test void testBasicEncodeHex1() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "foo", "666F6F");
 }
 
-@Test
-public void testFailDecodeNotHex() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testBasicEncodeBase320() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "hello", "NBSWY3DP" + System.lineSeparator());
+}

Review Comment:
   Refactored 
https://github.com/apache/nifi/pull/8417/commits/9fd11b7ae031fe416783f0135b7a94752b534ade



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


knguyen1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492865405


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, "Zm9v", "foo");
+}
 
-MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-testRunner.assertQueueEmpty();
+@Test void testBasicDecodeHex() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.HEX_ENCODING, "666F6F", "foo");
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.enqueue(flowFile);
-testRunner.clearTransferState();
-testRunner.run();
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicEncodeHex0() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "hello", "68656C6C6F");
+}
 
-flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-flowFile.assertContentEquals(FILE_PATH);
+@Test void testBasicEncodeHex1() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "foo", "666F6F");
 }
 
-@Test
-public void testFailDecodeNotHex() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testBasicEncodeBase320() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "hello", "NBSWY3DP" + System.lineSeparator());
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+@Test void testBasicEncodeBase321() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "foo", "MZXW6===" + System.lineSeparator());
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
+@Test void testBasicEncodeBase640() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+"hello",
+"aGVsbG8=" + System.lineSeparator());
+}
+
+@Test void testBasicEncodeBase641() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+"foo",
+"Zm9v" + System.lineSeparator());
+}
+
+@Test void testBlankValueShouldNotFail() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+StringUtils.EMPTY,
+StringUtils.EMPTY);
+}
+
+@Test void testEncodeContentMultipleLinesBase64() {
+// this input is greater than 57 bytes, sure to generate multiple 
lines in base64
+final String expectedOutput = 
"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdCwg" 
+ System.lineSeparator()
++ 
"c2VkIGRvIGVpdXNtb2QgdGVtcG9yIGluY2lkaWR1bnQgdXQgbGFib3JlIGV0IGRvbG9yZSBtYWdu" 
+ System.lineSeparator()
++ "YSBhbGlxdWEu" + System.lineSeparator();
+
+// Execute the test using the helper method
+executeTestHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+LOREM_IPSUM,
+LineOutputMode.MULTIPLE_LINES,
+expectedOutput,

Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


knguyen1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492864784


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EncodeContent.java:
##
@@ -129,31 +175,35 @@ public void onTrigger(final ProcessContext context, final 
ProcessSession session
 }
 }
 
-private static StreamCallback getStreamCallback(final boolean encode, 
final String encoding) {
-if (encode) {
-if (encoding.equalsIgnoreCase(BASE64_ENCODING)) {
-return new EncodeBase64();
-} else if (encoding.equalsIgnoreCase(BASE32_ENCODING)) {
-return new EncodeBase32();
-} else {
-return new EncodeHex();
-}
-} else {
-if (encoding.equalsIgnoreCase(BASE64_ENCODING)) {
-return new DecodeBase64();
-} else if (encoding.equalsIgnoreCase(BASE32_ENCODING)) {
-return new DecodeBase32();
-} else {
-return new DecodeHex();
-}
+private static StreamCallback getStreamCallback(final Boolean encode, 
final EncodingType encoding,

Review Comment:
   Fixed 
https://github.com/apache/nifi/pull/8417/commits/8c16ea83e7ab83c19f4e4f685b0b30dd0d5edc50



##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -16,65 +16,50 @@
  */
 package org.apache.nifi.processors.standard;
 
+import static org.junit.Assert.assertEquals;
+
 import java.io.IOException;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+import org.apache.nifi.components.DescribedValue;
+import org.apache.nifi.processor.Relationship;
+import org.apache.nifi.processors.standard.encoding.EncodingMode;
+import org.apache.nifi.processors.standard.encoding.EncodingType;
+import org.apache.nifi.processors.standard.encoding.LineOutputMode;
 import org.apache.nifi.util.MockFlowFile;
+import org.apache.nifi.util.StringUtils;
 import org.apache.nifi.util.TestRunner;
 import org.apache.nifi.util.TestRunners;
+import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
 public class TestEncodeContent {
 
+private static final String LOREM_IPSUM = "Lorem ipsum dolor sit amet, 
consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et 
dolore magna aliqua.";
+
 private static final Path FILE_PATH = 
Paths.get("src/test/resources/hello.txt");
+private TestRunner testRunner;
+
+@BeforeEach
+public void setUp() {
+testRunner = TestRunners.newTestRunner(EncodeContent.class);
+}
 
 @Test
 public void testBase64RoundTrip() throws IOException {

Review Comment:
   Fixed 
https://github.com/apache/nifi/pull/8417/commits/8c16ea83e7ab83c19f4e4f685b0b30dd0d5edc50



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


knguyen1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492864567


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, "Zm9v", "foo");
+}
 
-MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-testRunner.assertQueueEmpty();
+@Test void testBasicDecodeHex() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.HEX_ENCODING, "666F6F", "foo");
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.enqueue(flowFile);
-testRunner.clearTransferState();
-testRunner.run();
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicEncodeHex0() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "hello", "68656C6C6F");
+}
 
-flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-flowFile.assertContentEquals(FILE_PATH);
+@Test void testBasicEncodeHex1() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "foo", "666F6F");
 }
 
-@Test
-public void testFailDecodeNotHex() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testBasicEncodeBase320() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "hello", "NBSWY3DP" + System.lineSeparator());
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+@Test void testBasicEncodeBase321() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "foo", "MZXW6===" + System.lineSeparator());
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
+@Test void testBasicEncodeBase640() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+"hello",
+"aGVsbG8=" + System.lineSeparator());
+}
+
+@Test void testBasicEncodeBase641() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+"foo",
+"Zm9v" + System.lineSeparator());
+}
+
+@Test void testBlankValueShouldNotFail() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+StringUtils.EMPTY,
+StringUtils.EMPTY);
+}
+
+@Test void testEncodeContentMultipleLinesBase64() {
+// this input is greater than 57 bytes, sure to generate multiple 
lines in base64
+final String expectedOutput = 
"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdCwg" 
+ System.lineSeparator()
++ 
"c2VkIGRvIGVpdXNtb2QgdGVtcG9yIGluY2lkaWR1bnQgdXQgbGFib3JlIGV0IGRvbG9yZSBtYWdu" 
+ System.lineSeparator()
++ "YSBhbGlxdWEu" + System.lineSeparator();
+
+// Execute the test using the helper method
+executeTestHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+LOREM_IPSUM,
+LineOutputMode.MULTIPLE_LINES,
+expectedOutput,

Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


knguyen1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492863804


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, "Zm9v", "foo");
+}
 
-MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-testRunner.assertQueueEmpty();
+@Test void testBasicDecodeHex() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.HEX_ENCODING, "666F6F", "foo");
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.enqueue(flowFile);
-testRunner.clearTransferState();
-testRunner.run();
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicEncodeHex0() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "hello", "68656C6C6F");
+}
 
-flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-flowFile.assertContentEquals(FILE_PATH);
+@Test void testBasicEncodeHex1() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "foo", "666F6F");
 }
 
-@Test
-public void testFailDecodeNotHex() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testBasicEncodeBase320() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "hello", "NBSWY3DP" + System.lineSeparator());
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+@Test void testBasicEncodeBase321() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "foo", "MZXW6===" + System.lineSeparator());
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
+@Test void testBasicEncodeBase640() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+"hello",
+"aGVsbG8=" + System.lineSeparator());
+}
+
+@Test void testBasicEncodeBase641() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+"foo",
+"Zm9v" + System.lineSeparator());
+}
+
+@Test void testBlankValueShouldNotFail() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+StringUtils.EMPTY,
+StringUtils.EMPTY);
+}
+
+@Test void testEncodeContentMultipleLinesBase64() {
+// this input is greater than 57 bytes, sure to generate multiple 
lines in base64
+final String expectedOutput = 
"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdCwg" 
+ System.lineSeparator()
++ 
"c2VkIGRvIGVpdXNtb2QgdGVtcG9yIGluY2lkaWR1bnQgdXQgbGFib3JlIGV0IGRvbG9yZSBtYWdu" 
+ System.lineSeparator()
++ "YSBhbGlxdWEu" + System.lineSeparator();
+
+// Execute the test using the helper method
+executeTestHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+LOREM_IPSUM,
+LineOutputMode.MULTIPLE_LINES,
+expectedOutput,

Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


knguyen1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492863583


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, "Zm9v", "foo");
+}
 
-MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-testRunner.assertQueueEmpty();
+@Test void testBasicDecodeHex() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.HEX_ENCODING, "666F6F", "foo");
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.enqueue(flowFile);
-testRunner.clearTransferState();
-testRunner.run();
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicEncodeHex0() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "hello", "68656C6C6F");
+}
 
-flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-flowFile.assertContentEquals(FILE_PATH);
+@Test void testBasicEncodeHex1() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "foo", "666F6F");
 }
 
-@Test
-public void testFailDecodeNotHex() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testBasicEncodeBase320() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "hello", "NBSWY3DP" + System.lineSeparator());
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+@Test void testBasicEncodeBase321() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "foo", "MZXW6===" + System.lineSeparator());
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
+@Test void testBasicEncodeBase640() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+"hello",
+"aGVsbG8=" + System.lineSeparator());
+}
+
+@Test void testBasicEncodeBase641() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+"foo",
+"Zm9v" + System.lineSeparator());
+}
+
+@Test void testBlankValueShouldNotFail() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+StringUtils.EMPTY,
+StringUtils.EMPTY);
+}
+
+@Test void testEncodeContentMultipleLinesBase64() {

Review Comment:
   Fixed 
https://github.com/apache/nifi/pull/8417/commits/8c16ea83e7ab83c19f4e4f685b0b30dd0d5edc50



##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void 

Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


knguyen1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492862520


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EncodeContent.java:
##
@@ -29,55 +37,88 @@
 import org.apache.nifi.annotation.documentation.CapabilityDescription;
 import org.apache.nifi.annotation.documentation.Tags;
 import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.components.Validator;
+import org.apache.nifi.expression.ExpressionLanguageScope;
 import org.apache.nifi.flowfile.FlowFile;
 import org.apache.nifi.processor.AbstractProcessor;
 import org.apache.nifi.processor.ProcessContext;
 import org.apache.nifi.processor.ProcessSession;
 import org.apache.nifi.processor.Relationship;
 import org.apache.nifi.processor.io.StreamCallback;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.processors.standard.encoding.EncodingMode;
+import org.apache.nifi.processors.standard.encoding.EncodingType;
+import org.apache.nifi.processors.standard.encoding.LineOutputMode;
 import org.apache.nifi.processors.standard.util.ValidatingBase32InputStream;
 import org.apache.nifi.processors.standard.util.ValidatingBase64InputStream;
 import org.apache.nifi.stream.io.StreamUtils;
 import org.apache.nifi.util.StopWatch;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
 @SideEffectFree
 @SupportsBatching
 @InputRequirement(Requirement.INPUT_REQUIRED)
 @Tags({"encode", "decode", "base64", "base32", "hex"})
 @CapabilityDescription("Encode or decode the contents of a FlowFile using 
Base64, Base32, or hex encoding schemes")
 public class EncodeContent extends AbstractProcessor {
 
-public static final String ENCODE_MODE = "Encode";
-public static final String DECODE_MODE = "Decode";
-
-public static final String BASE64_ENCODING = "base64";
-public static final String BASE32_ENCODING = "base32";
-public static final String HEX_ENCODING = "hex";
-
 public static final PropertyDescriptor MODE = new 
PropertyDescriptor.Builder()
 .name("Mode")
 .description("Specifies whether the content should be encoded or 
decoded")
 .required(true)
-.allowableValues(ENCODE_MODE, DECODE_MODE)
-.defaultValue(ENCODE_MODE)
+.allowableValues(EncodingMode.class)
+.defaultValue(EncodingMode.ENCODE.getValue())
 .build();
 
 public static final PropertyDescriptor ENCODING = new 
PropertyDescriptor.Builder()
 .name("Encoding")
 .description("Specifies the type of encoding used")
 .required(true)
-.allowableValues(BASE64_ENCODING, BASE32_ENCODING, HEX_ENCODING)
-.defaultValue(BASE64_ENCODING)
+.allowableValues(EncodingType.class)
+.defaultValue(EncodingType.BASE64_ENCODING.getValue())

Review Comment:
   Fixed 
https://github.com/apache/nifi/pull/8417/commits/c5e0e4d97cddd2604e264f93ed30a8024ba4be67



##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EncodeContent.java:
##
@@ -29,55 +37,88 @@
 import org.apache.nifi.annotation.documentation.CapabilityDescription;
 import org.apache.nifi.annotation.documentation.Tags;
 import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.components.Validator;
+import org.apache.nifi.expression.ExpressionLanguageScope;
 import org.apache.nifi.flowfile.FlowFile;
 import org.apache.nifi.processor.AbstractProcessor;
 import org.apache.nifi.processor.ProcessContext;
 import org.apache.nifi.processor.ProcessSession;
 import org.apache.nifi.processor.Relationship;
 import org.apache.nifi.processor.io.StreamCallback;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.processors.standard.encoding.EncodingMode;
+import org.apache.nifi.processors.standard.encoding.EncodingType;
+import org.apache.nifi.processors.standard.encoding.LineOutputMode;
 import org.apache.nifi.processors.standard.util.ValidatingBase32InputStream;
 import org.apache.nifi.processors.standard.util.ValidatingBase64InputStream;
 import org.apache.nifi.stream.io.StreamUtils;
 import org.apache.nifi.util.StopWatch;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
 @SideEffectFree
 @SupportsBatching
 @InputRequirement(Requirement.INPUT_REQUIRED)
 @Tags({"encode", "decode", "base64", "base32", "hex"})
 @CapabilityDescription("Encode or decode the contents of a FlowFile using 
Base64, Base32, or hex encoding schemes")
 public class EncodeContent extends 

Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


knguyen1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492863400


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {

Review Comment:
   Fixed 
https://github.com/apache/nifi/pull/8417/commits/8c16ea83e7ab83c19f4e4f685b0b30dd0d5edc50



##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, "Zm9v", "foo");
+}
 
-MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-testRunner.assertQueueEmpty();
+@Test void testBasicDecodeHex() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.HEX_ENCODING, "666F6F", "foo");
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.enqueue(flowFile);
-testRunner.clearTransferState();
-testRunner.run();
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicEncodeHex0() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "hello", "68656C6C6F");
+}
 
-flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-flowFile.assertContentEquals(FILE_PATH);
+@Test void testBasicEncodeHex1() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "foo", "666F6F");
 }
 
-@Test
-public void testFailDecodeNotHex() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testBasicEncodeBase320() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "hello", "NBSWY3DP" + System.lineSeparator());
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+@Test void testBasicEncodeBase321() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "foo", "MZXW6===" + System.lineSeparator());
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
+@Test void testBasicEncodeBase640() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+"hello",
+"aGVsbG8=" + System.lineSeparator());
+}
+
+@Test void testBasicEncodeBase641() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+"foo",
+"Zm9v" + System.lineSeparator());
+}
+
+@Test void testBlankValueShouldNotFail() {

Review Comment:
   Fixed 
https://github.com/apache/nifi/pull/8417/commits/8c16ea83e7ab83c19f4e4f685b0b30dd0d5edc50



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 

Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


knguyen1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492862734


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EncodeContent.java:
##
@@ -29,55 +37,88 @@
 import org.apache.nifi.annotation.documentation.CapabilityDescription;
 import org.apache.nifi.annotation.documentation.Tags;
 import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.components.Validator;
+import org.apache.nifi.expression.ExpressionLanguageScope;
 import org.apache.nifi.flowfile.FlowFile;
 import org.apache.nifi.processor.AbstractProcessor;
 import org.apache.nifi.processor.ProcessContext;
 import org.apache.nifi.processor.ProcessSession;
 import org.apache.nifi.processor.Relationship;
 import org.apache.nifi.processor.io.StreamCallback;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.processors.standard.encoding.EncodingMode;
+import org.apache.nifi.processors.standard.encoding.EncodingType;
+import org.apache.nifi.processors.standard.encoding.LineOutputMode;
 import org.apache.nifi.processors.standard.util.ValidatingBase32InputStream;
 import org.apache.nifi.processors.standard.util.ValidatingBase64InputStream;
 import org.apache.nifi.stream.io.StreamUtils;
 import org.apache.nifi.util.StopWatch;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
 @SideEffectFree
 @SupportsBatching
 @InputRequirement(Requirement.INPUT_REQUIRED)
 @Tags({"encode", "decode", "base64", "base32", "hex"})
 @CapabilityDescription("Encode or decode the contents of a FlowFile using 
Base64, Base32, or hex encoding schemes")
 public class EncodeContent extends AbstractProcessor {
 
-public static final String ENCODE_MODE = "Encode";
-public static final String DECODE_MODE = "Decode";
-
-public static final String BASE64_ENCODING = "base64";
-public static final String BASE32_ENCODING = "base32";
-public static final String HEX_ENCODING = "hex";
-
 public static final PropertyDescriptor MODE = new 
PropertyDescriptor.Builder()
 .name("Mode")
 .description("Specifies whether the content should be encoded or 
decoded")
 .required(true)
-.allowableValues(ENCODE_MODE, DECODE_MODE)
-.defaultValue(ENCODE_MODE)
+.allowableValues(EncodingMode.class)
+.defaultValue(EncodingMode.ENCODE.getValue())

Review Comment:
   Fixed 
https://github.com/apache/nifi/pull/8417/commits/c5e0e4d97cddd2604e264f93ed30a8024ba4be67



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


dan-s1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492784714


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, "Zm9v", "foo");
+}
 
-MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-testRunner.assertQueueEmpty();
+@Test void testBasicDecodeHex() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.HEX_ENCODING, "666F6F", "foo");
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.enqueue(flowFile);
-testRunner.clearTransferState();
-testRunner.run();
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicEncodeHex0() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "hello", "68656C6C6F");
+}
 
-flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-flowFile.assertContentEquals(FILE_PATH);
+@Test void testBasicEncodeHex1() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "foo", "666F6F");
 }
 
-@Test
-public void testFailDecodeNotHex() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testBasicEncodeBase320() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "hello", "NBSWY3DP" + System.lineSeparator());
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+@Test void testBasicEncodeBase321() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "foo", "MZXW6===" + System.lineSeparator());
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
+@Test void testBasicEncodeBase640() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+"hello",
+"aGVsbG8=" + System.lineSeparator());
+}
+
+@Test void testBasicEncodeBase641() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+"foo",
+"Zm9v" + System.lineSeparator());
+}

Review Comment:
   Refactor both of these tests to a single parameterized test.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


dan-s1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492654148


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, "Zm9v", "foo");
+}
 
-MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-testRunner.assertQueueEmpty();
+@Test void testBasicDecodeHex() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.HEX_ENCODING, "666F6F", "foo");
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.enqueue(flowFile);
-testRunner.clearTransferState();
-testRunner.run();
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicEncodeHex0() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "hello", "68656C6C6F");
+}
 
-flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-flowFile.assertContentEquals(FILE_PATH);
+@Test void testBasicEncodeHex1() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "foo", "666F6F");
 }
 
-@Test
-public void testFailDecodeNotHex() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testBasicEncodeBase320() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "hello", "NBSWY3DP" + System.lineSeparator());
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+@Test void testBasicEncodeBase321() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "foo", "MZXW6===" + System.lineSeparator());
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
+@Test void testBasicEncodeBase640() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+"hello",
+"aGVsbG8=" + System.lineSeparator());
+}
+
+@Test void testBasicEncodeBase641() {

Review Comment:
   ```suggestion
   @Test
   void testBasicEncodeBase641() {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


dan-s1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492653917


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, "Zm9v", "foo");
+}
 
-MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-testRunner.assertQueueEmpty();
+@Test void testBasicDecodeHex() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.HEX_ENCODING, "666F6F", "foo");
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.enqueue(flowFile);
-testRunner.clearTransferState();
-testRunner.run();
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicEncodeHex0() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "hello", "68656C6C6F");
+}
 
-flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-flowFile.assertContentEquals(FILE_PATH);
+@Test void testBasicEncodeHex1() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "foo", "666F6F");
 }
 
-@Test
-public void testFailDecodeNotHex() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testBasicEncodeBase320() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "hello", "NBSWY3DP" + System.lineSeparator());
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+@Test void testBasicEncodeBase321() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "foo", "MZXW6===" + System.lineSeparator());
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
+@Test void testBasicEncodeBase640() {

Review Comment:
   ```suggestion
   @Test
   void testBasicEncodeBase640() {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


dan-s1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492777648


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}

Review Comment:
   This test as well as tests on lines 138-140 and 142-144 should be combined 
into a single parameterized test.



##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, "Zm9v", "foo");
+}
 
-MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-testRunner.assertQueueEmpty();
+@Test void testBasicDecodeHex() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.HEX_ENCODING, "666F6F", "foo");
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.enqueue(flowFile);
-testRunner.clearTransferState();
-testRunner.run();
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicEncodeHex0() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "hello", "68656C6C6F");
+}
 
-flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-flowFile.assertContentEquals(FILE_PATH);
+@Test void testBasicEncodeHex1() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "foo", "666F6F");
 }
 
-@Test
-public void testFailDecodeNotHex() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testBasicEncodeBase320() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "hello", "NBSWY3DP" + System.lineSeparator());
+}

Review Comment:
   Instead of this test and the test on line 158-160 use JUnit 5 parameterize 
test
```suggestion
   @ParameterizedTest
   @MethodSource("encodeBase32Args")
   void 

Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


dan-s1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492652912


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, "Zm9v", "foo");
+}
 
-MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-testRunner.assertQueueEmpty();
+@Test void testBasicDecodeHex() {

Review Comment:
   ```suggestion
   @Test
   void testBasicDecodeHex() {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


dan-s1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492652368


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {

Review Comment:
   ```suggestion
   @Test
   void testBasicDecodeBase64() {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


dan-s1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492652027


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {

Review Comment:
   ```suggestion
   @Test 
   void testBasicDecodeBase32() {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


dan-s1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492653155


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, "Zm9v", "foo");
+}
 
-MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-testRunner.assertQueueEmpty();
+@Test void testBasicDecodeHex() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.HEX_ENCODING, "666F6F", "foo");
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.enqueue(flowFile);
-testRunner.clearTransferState();
-testRunner.run();
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicEncodeHex0() {

Review Comment:
   ```suggestion
   @Test
   void testBasicEncodeHex0() {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[PR] NIFI-12808 Upgrade Commons Codec from 1.16.0 to 1.16.1 [nifi]

2024-02-16 Thread via GitHub


exceptionfactory opened a new pull request, #8419:
URL: https://github.com/apache/nifi/pull/8419

   # Summary
   
   [NIFI-12808](https://issues.apache.org/jira/browse/NIFI-12808) Upgrades 
Apache Commons Codec from 1.16.0 to 
[1.16.1](https://commons.apache.org/proper/commons-codec/changes-report.html#a1.16.1)
 across framework and extension components.
   
   # Tracking
   
   Please complete the following tracking steps prior to pull request creation.
   
   ### Issue Tracking
   
   - [X] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue 
created
   
   ### Pull Request Tracking
   
   - [X] Pull Request title starts with Apache NiFi Jira issue number, such as 
`NIFI-0`
   - [X] Pull Request commit message starts with Apache NiFi Jira issue number, 
as such `NIFI-0`
   
   ### Pull Request Formatting
   
   - [X] Pull Request based on current revision of the `main` branch
   - [X] Pull Request refers to a feature branch with one commit containing 
changes
   
   # Verification
   
   Please indicate the verification steps performed prior to pull request 
creation.
   
   ### Build
   
   - [X] Build completed using `mvn clean install -P contrib-check`
 - [X] JDK 21
   
   ### Licensing
   
   - [ ] New dependencies are compatible with the [Apache License 
2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License 
Policy](https://www.apache.org/legal/resolved.html)
   - [ ] New dependencies are documented in applicable `LICENSE` and `NOTICE` 
files
   
   ### Documentation
   
   - [ ] Documentation formatting appears as expected in rendered files
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


dan-s1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492653434


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, "Zm9v", "foo");
+}
 
-MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-testRunner.assertQueueEmpty();
+@Test void testBasicDecodeHex() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.HEX_ENCODING, "666F6F", "foo");
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.enqueue(flowFile);
-testRunner.clearTransferState();
-testRunner.run();
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicEncodeHex0() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "hello", "68656C6C6F");
+}
 
-flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-flowFile.assertContentEquals(FILE_PATH);
+@Test void testBasicEncodeHex1() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "foo", "666F6F");
 }
 
-@Test
-public void testFailDecodeNotHex() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testBasicEncodeBase320() {

Review Comment:
   ```suggestion
   @Test
   void testBasicEncodeBase320() {
   ```



##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, "Zm9v", "foo");
+}
 
-MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-

[jira] [Updated] (NIFI-12808) Upgraded Commons Codec to 1.16.1

2024-02-16 Thread David Handermann (Jira)


 [ 
https://issues.apache.org/jira/browse/NIFI-12808?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

David Handermann updated NIFI-12808:

Labels: backport-needed  (was: )

> Upgraded Commons Codec to 1.16.1
> 
>
> Key: NIFI-12808
> URL: https://issues.apache.org/jira/browse/NIFI-12808
> Project: Apache NiFi
>  Issue Type: Improvement
>  Components: Core Framework, Extensions
>Reporter: David Handermann
>Assignee: David Handermann
>Priority: Minor
>  Labels: backport-needed
>
> Apache Commons Codec 
> [1.16.1|https://commons.apache.org/proper/commons-codec/changes-report.html#a1.16.1]
>  includes incremental bug fixes and improvements.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Created] (NIFI-12808) Upgraded Commons Codec to 1.16.1

2024-02-16 Thread David Handermann (Jira)
David Handermann created NIFI-12808:
---

 Summary: Upgraded Commons Codec to 1.16.1
 Key: NIFI-12808
 URL: https://issues.apache.org/jira/browse/NIFI-12808
 Project: Apache NiFi
  Issue Type: Improvement
  Components: Core Framework, Extensions
Reporter: David Handermann
Assignee: David Handermann


Apache Commons Codec 
[1.16.1|https://commons.apache.org/proper/commons-codec/changes-report.html#a1.16.1]
 includes incremental bug fixes and improvements.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


dan-s1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492740088


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, "Zm9v", "foo");
+}
 
-MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-testRunner.assertQueueEmpty();
+@Test void testBasicDecodeHex() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.HEX_ENCODING, "666F6F", "foo");
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.enqueue(flowFile);
-testRunner.clearTransferState();
-testRunner.run();
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicEncodeHex0() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "hello", "68656C6C6F");
+}
 
-flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-flowFile.assertContentEquals(FILE_PATH);
+@Test void testBasicEncodeHex1() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "foo", "666F6F");
 }
 
-@Test
-public void testFailDecodeNotHex() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testBasicEncodeBase320() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "hello", "NBSWY3DP" + System.lineSeparator());
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+@Test void testBasicEncodeBase321() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "foo", "MZXW6===" + System.lineSeparator());
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
+@Test void testBasicEncodeBase640() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+"hello",
+"aGVsbG8=" + System.lineSeparator());
+}
+
+@Test void testBasicEncodeBase641() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+"foo",
+"Zm9v" + System.lineSeparator());
+}
+
+@Test void testBlankValueShouldNotFail() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+StringUtils.EMPTY,
+StringUtils.EMPTY);
+}
+
+@Test void testEncodeContentMultipleLinesBase64() {
+// this input is greater than 57 bytes, sure to generate multiple 
lines in base64
+final String expectedOutput = 
"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdCwg" 
+ System.lineSeparator()
++ 
"c2VkIGRvIGVpdXNtb2QgdGVtcG9yIGluY2lkaWR1bnQgdXQgbGFib3JlIGV0IGRvbG9yZSBtYWdu" 
+ System.lineSeparator()
++ "YSBhbGlxdWEu" + System.lineSeparator();
+
+// Execute the test using the helper method
+executeTestHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+LOREM_IPSUM,
+LineOutputMode.MULTIPLE_LINES,
+expectedOutput,
+  

Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


dan-s1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492655130


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, "Zm9v", "foo");
+}
 
-MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-testRunner.assertQueueEmpty();
+@Test void testBasicDecodeHex() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.HEX_ENCODING, "666F6F", "foo");
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.enqueue(flowFile);
-testRunner.clearTransferState();
-testRunner.run();
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicEncodeHex0() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "hello", "68656C6C6F");
+}
 
-flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-flowFile.assertContentEquals(FILE_PATH);
+@Test void testBasicEncodeHex1() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "foo", "666F6F");
 }
 
-@Test
-public void testFailDecodeNotHex() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testBasicEncodeBase320() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "hello", "NBSWY3DP" + System.lineSeparator());
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+@Test void testBasicEncodeBase321() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "foo", "MZXW6===" + System.lineSeparator());
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
+@Test void testBasicEncodeBase640() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+"hello",
+"aGVsbG8=" + System.lineSeparator());
+}
+
+@Test void testBasicEncodeBase641() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+"foo",
+"Zm9v" + System.lineSeparator());
+}
+
+@Test void testBlankValueShouldNotFail() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+StringUtils.EMPTY,
+StringUtils.EMPTY);
+}
+
+@Test void testEncodeContentMultipleLinesBase64() {
+// this input is greater than 57 bytes, sure to generate multiple 
lines in base64
+final String expectedOutput = 
"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdCwg" 
+ System.lineSeparator()
++ 
"c2VkIGRvIGVpdXNtb2QgdGVtcG9yIGluY2lkaWR1bnQgdXQgbGFib3JlIGV0IGRvbG9yZSBtYWdu" 
+ System.lineSeparator()
++ "YSBhbGlxdWEu" + System.lineSeparator();
+
+// Execute the test using the helper method
+executeTestHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+LOREM_IPSUM,
+LineOutputMode.MULTIPLE_LINES,
+expectedOutput,
+  

Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


dan-s1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492656975


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, "Zm9v", "foo");
+}
 
-MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-testRunner.assertQueueEmpty();
+@Test void testBasicDecodeHex() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.HEX_ENCODING, "666F6F", "foo");
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.enqueue(flowFile);
-testRunner.clearTransferState();
-testRunner.run();
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicEncodeHex0() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "hello", "68656C6C6F");
+}
 
-flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-flowFile.assertContentEquals(FILE_PATH);
+@Test void testBasicEncodeHex1() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "foo", "666F6F");
 }
 
-@Test
-public void testFailDecodeNotHex() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testBasicEncodeBase320() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "hello", "NBSWY3DP" + System.lineSeparator());
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+@Test void testBasicEncodeBase321() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "foo", "MZXW6===" + System.lineSeparator());
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
+@Test void testBasicEncodeBase640() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+"hello",
+"aGVsbG8=" + System.lineSeparator());
+}
+
+@Test void testBasicEncodeBase641() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+"foo",
+"Zm9v" + System.lineSeparator());
+}
+
+@Test void testBlankValueShouldNotFail() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+StringUtils.EMPTY,
+StringUtils.EMPTY);
+}
+
+@Test void testEncodeContentMultipleLinesBase64() {
+// this input is greater than 57 bytes, sure to generate multiple 
lines in base64
+final String expectedOutput = 
"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdCwg" 
+ System.lineSeparator()
++ 
"c2VkIGRvIGVpdXNtb2QgdGVtcG9yIGluY2lkaWR1bnQgdXQgbGFib3JlIGV0IGRvbG9yZSBtYWdu" 
+ System.lineSeparator()
++ "YSBhbGlxdWEu" + System.lineSeparator();
+
+// Execute the test using the helper method
+executeTestHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+LOREM_IPSUM,
+LineOutputMode.MULTIPLE_LINES,
+expectedOutput,
+  

Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


dan-s1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492656515


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, "Zm9v", "foo");
+}
 
-MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-testRunner.assertQueueEmpty();
+@Test void testBasicDecodeHex() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.HEX_ENCODING, "666F6F", "foo");
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.enqueue(flowFile);
-testRunner.clearTransferState();
-testRunner.run();
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicEncodeHex0() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "hello", "68656C6C6F");
+}
 
-flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-flowFile.assertContentEquals(FILE_PATH);
+@Test void testBasicEncodeHex1() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "foo", "666F6F");
 }
 
-@Test
-public void testFailDecodeNotHex() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testBasicEncodeBase320() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "hello", "NBSWY3DP" + System.lineSeparator());
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+@Test void testBasicEncodeBase321() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "foo", "MZXW6===" + System.lineSeparator());
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
+@Test void testBasicEncodeBase640() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+"hello",
+"aGVsbG8=" + System.lineSeparator());
+}
+
+@Test void testBasicEncodeBase641() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+"foo",
+"Zm9v" + System.lineSeparator());
+}
+
+@Test void testBlankValueShouldNotFail() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+StringUtils.EMPTY,
+StringUtils.EMPTY);
+}
+
+@Test void testEncodeContentMultipleLinesBase64() {
+// this input is greater than 57 bytes, sure to generate multiple 
lines in base64
+final String expectedOutput = 
"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdCwg" 
+ System.lineSeparator()
++ 
"c2VkIGRvIGVpdXNtb2QgdGVtcG9yIGluY2lkaWR1bnQgdXQgbGFib3JlIGV0IGRvbG9yZSBtYWdu" 
+ System.lineSeparator()
++ "YSBhbGlxdWEu" + System.lineSeparator();
+
+// Execute the test using the helper method
+executeTestHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+LOREM_IPSUM,
+LineOutputMode.MULTIPLE_LINES,
+expectedOutput,
+  

Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


dan-s1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492654917


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, "Zm9v", "foo");
+}
 
-MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-testRunner.assertQueueEmpty();
+@Test void testBasicDecodeHex() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.HEX_ENCODING, "666F6F", "foo");
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.enqueue(flowFile);
-testRunner.clearTransferState();
-testRunner.run();
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicEncodeHex0() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "hello", "68656C6C6F");
+}
 
-flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-flowFile.assertContentEquals(FILE_PATH);
+@Test void testBasicEncodeHex1() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "foo", "666F6F");
 }
 
-@Test
-public void testFailDecodeNotHex() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testBasicEncodeBase320() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "hello", "NBSWY3DP" + System.lineSeparator());
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+@Test void testBasicEncodeBase321() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "foo", "MZXW6===" + System.lineSeparator());
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
+@Test void testBasicEncodeBase640() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+"hello",
+"aGVsbG8=" + System.lineSeparator());
+}
+
+@Test void testBasicEncodeBase641() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+"foo",
+"Zm9v" + System.lineSeparator());
+}
+
+@Test void testBlankValueShouldNotFail() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+StringUtils.EMPTY,
+StringUtils.EMPTY);
+}
+
+@Test void testEncodeContentMultipleLinesBase64() {

Review Comment:
   ```suggestion
   @Test
   void testEncodeContentMultipleLinesBase64() {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


dan-s1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492654367


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, "Zm9v", "foo");
+}
 
-MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-testRunner.assertQueueEmpty();
+@Test void testBasicDecodeHex() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.HEX_ENCODING, "666F6F", "foo");
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.enqueue(flowFile);
-testRunner.clearTransferState();
-testRunner.run();
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicEncodeHex0() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "hello", "68656C6C6F");
+}
 
-flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-flowFile.assertContentEquals(FILE_PATH);
+@Test void testBasicEncodeHex1() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "foo", "666F6F");
 }
 
-@Test
-public void testFailDecodeNotHex() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testBasicEncodeBase320() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "hello", "NBSWY3DP" + System.lineSeparator());
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+@Test void testBasicEncodeBase321() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "foo", "MZXW6===" + System.lineSeparator());
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
+@Test void testBasicEncodeBase640() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+"hello",
+"aGVsbG8=" + System.lineSeparator());
+}
+
+@Test void testBasicEncodeBase641() {
+executeTestSuccessHelper(EncodingMode.ENCODE,
+EncodingType.BASE64_ENCODING,
+"foo",
+"Zm9v" + System.lineSeparator());
+}
+
+@Test void testBlankValueShouldNotFail() {

Review Comment:
   ```suggestion
   @Test
   void testBlankValueShouldNotFail() {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


dan-s1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492653917


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, "Zm9v", "foo");
+}
 
-MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-testRunner.assertQueueEmpty();
+@Test void testBasicDecodeHex() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.HEX_ENCODING, "666F6F", "foo");
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.enqueue(flowFile);
-testRunner.clearTransferState();
-testRunner.run();
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicEncodeHex0() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "hello", "68656C6C6F");
+}
 
-flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-flowFile.assertContentEquals(FILE_PATH);
+@Test void testBasicEncodeHex1() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "foo", "666F6F");
 }
 
-@Test
-public void testFailDecodeNotHex() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testBasicEncodeBase320() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "hello", "NBSWY3DP" + System.lineSeparator());
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+@Test void testBasicEncodeBase321() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE32_ENCODING, "foo", "MZXW6===" + System.lineSeparator());
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
+@Test void testBasicEncodeBase640() {

Review Comment:
   ```suggestion
   @Test
   void testBasicEncodeBase640() {
   ```



##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-

Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


dan-s1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492653434


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, "Zm9v", "foo");
+}
 
-MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-testRunner.assertQueueEmpty();
+@Test void testBasicDecodeHex() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.HEX_ENCODING, "666F6F", "foo");
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.enqueue(flowFile);
-testRunner.clearTransferState();
-testRunner.run();
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicEncodeHex0() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "hello", "68656C6C6F");
+}
 
-flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-flowFile.assertContentEquals(FILE_PATH);
+@Test void testBasicEncodeHex1() {
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.HEX_ENCODING, "foo", "666F6F");
 }
 
-@Test
-public void testFailDecodeNotHex() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testBasicEncodeBase320() {

Review Comment:
   ```suggestion
   @Test
   void testBasicEncodeBase320() {
   ```



##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, "Zm9v", "foo");
+}
 
-MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-

Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


dan-s1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492653155


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, "Zm9v", "foo");
+}
 
-MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-testRunner.assertQueueEmpty();
+@Test void testBasicDecodeHex() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.HEX_ENCODING, "666F6F", "foo");
+}
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.DECODE_MODE);
-testRunner.enqueue(flowFile);
-testRunner.clearTransferState();
-testRunner.run();
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicEncodeHex0() {

Review Comment:
   ```suggestion
   @Test
   void testBasicEncodeHex0() {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


dan-s1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492652368


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {

Review Comment:
   ```suggestion
   @Test
   void testBasicDecodeBase64() {
   ```



##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEncodeContent.java:
##
@@ -123,43 +122,275 @@ public void testFailDecodeNotBase32() throws IOException 
{
 testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_FAILURE, 1);
 }
 
-@Test
-public void testHexRoundTrip() throws IOException {
-final TestRunner testRunner = TestRunners.newTestRunner(new 
EncodeContent());
+@Test void testEncodeDecodeSpecialCharsBase64() {
+final String specialChars = "!@#$%^&*()_+{}:\"<>?[];',./~`-=";
+final String expectedOutput = 
"IUAjJCVeJiooKV8re306Ijw+P1tdOycsLi9+YC09" + System.lineSeparator();
 
-testRunner.setProperty(EncodeContent.MODE, EncodeContent.ENCODE_MODE);
-testRunner.setProperty(EncodeContent.ENCODING, 
EncodeContent.HEX_ENCODING);
+executeTestSuccessHelper(EncodingMode.ENCODE, 
EncodingType.BASE64_ENCODING, specialChars, expectedOutput);
+testRunner.clearTransferState(); // clear the state for the next test
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, expectedOutput, specialChars);
+}
 
-testRunner.enqueue(FILE_PATH);
-testRunner.clearTransferState();
-testRunner.run();
+@Test void testBasicDecodeBase32() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE32_ENCODING, "NBSWY3DP", "hello");
+}
 
-testRunner.assertAllFlowFilesTransferred(EncodeContent.REL_SUCCESS, 1);
+@Test void testBasicDecodeBase64() {
+executeTestSuccessHelper(EncodingMode.DECODE, 
EncodingType.BASE64_ENCODING, "Zm9v", "foo");
+}
 
-MockFlowFile flowFile = 
testRunner.getFlowFilesForRelationship(EncodeContent.REL_SUCCESS).get(0);
-testRunner.assertQueueEmpty();
+@Test void testBasicDecodeHex() {

Review Comment:
   ```suggestion
   @Test
   void testBasicDecodeHex() {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


dan-s1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492642384


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EncodeContent.java:
##
@@ -29,55 +37,88 @@
 import org.apache.nifi.annotation.documentation.CapabilityDescription;
 import org.apache.nifi.annotation.documentation.Tags;
 import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.components.Validator;
+import org.apache.nifi.expression.ExpressionLanguageScope;
 import org.apache.nifi.flowfile.FlowFile;
 import org.apache.nifi.processor.AbstractProcessor;
 import org.apache.nifi.processor.ProcessContext;
 import org.apache.nifi.processor.ProcessSession;
 import org.apache.nifi.processor.Relationship;
 import org.apache.nifi.processor.io.StreamCallback;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.processors.standard.encoding.EncodingMode;
+import org.apache.nifi.processors.standard.encoding.EncodingType;
+import org.apache.nifi.processors.standard.encoding.LineOutputMode;
 import org.apache.nifi.processors.standard.util.ValidatingBase32InputStream;
 import org.apache.nifi.processors.standard.util.ValidatingBase64InputStream;
 import org.apache.nifi.stream.io.StreamUtils;
 import org.apache.nifi.util.StopWatch;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
 @SideEffectFree
 @SupportsBatching
 @InputRequirement(Requirement.INPUT_REQUIRED)
 @Tags({"encode", "decode", "base64", "base32", "hex"})
 @CapabilityDescription("Encode or decode the contents of a FlowFile using 
Base64, Base32, or hex encoding schemes")
 public class EncodeContent extends AbstractProcessor {
 
-public static final String ENCODE_MODE = "Encode";
-public static final String DECODE_MODE = "Decode";
-
-public static final String BASE64_ENCODING = "base64";
-public static final String BASE32_ENCODING = "base32";
-public static final String HEX_ENCODING = "hex";
-
 public static final PropertyDescriptor MODE = new 
PropertyDescriptor.Builder()
 .name("Mode")
 .description("Specifies whether the content should be encoded or 
decoded")
 .required(true)
-.allowableValues(ENCODE_MODE, DECODE_MODE)
-.defaultValue(ENCODE_MODE)
+.allowableValues(EncodingMode.class)
+.defaultValue(EncodingMode.ENCODE.getValue())
 .build();
 
 public static final PropertyDescriptor ENCODING = new 
PropertyDescriptor.Builder()
 .name("Encoding")
 .description("Specifies the type of encoding used")
 .required(true)
-.allowableValues(BASE64_ENCODING, BASE32_ENCODING, HEX_ENCODING)
-.defaultValue(BASE64_ENCODING)
+.allowableValues(EncodingType.class)
+.defaultValue(EncodingType.BASE64_ENCODING.getValue())

Review Comment:
   `defaultValue` is overloaded to take a `DescribedValue`
   ```suggestion
   .defaultValue(EncodingType.BASE64_ENCODING)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


dan-s1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492643756


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EncodeContent.java:
##
@@ -29,55 +37,88 @@
 import org.apache.nifi.annotation.documentation.CapabilityDescription;
 import org.apache.nifi.annotation.documentation.Tags;
 import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.components.Validator;
+import org.apache.nifi.expression.ExpressionLanguageScope;
 import org.apache.nifi.flowfile.FlowFile;
 import org.apache.nifi.processor.AbstractProcessor;
 import org.apache.nifi.processor.ProcessContext;
 import org.apache.nifi.processor.ProcessSession;
 import org.apache.nifi.processor.Relationship;
 import org.apache.nifi.processor.io.StreamCallback;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.processors.standard.encoding.EncodingMode;
+import org.apache.nifi.processors.standard.encoding.EncodingType;
+import org.apache.nifi.processors.standard.encoding.LineOutputMode;
 import org.apache.nifi.processors.standard.util.ValidatingBase32InputStream;
 import org.apache.nifi.processors.standard.util.ValidatingBase64InputStream;
 import org.apache.nifi.stream.io.StreamUtils;
 import org.apache.nifi.util.StopWatch;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
 @SideEffectFree
 @SupportsBatching
 @InputRequirement(Requirement.INPUT_REQUIRED)
 @Tags({"encode", "decode", "base64", "base32", "hex"})
 @CapabilityDescription("Encode or decode the contents of a FlowFile using 
Base64, Base32, or hex encoding schemes")
 public class EncodeContent extends AbstractProcessor {
 
-public static final String ENCODE_MODE = "Encode";
-public static final String DECODE_MODE = "Decode";
-
-public static final String BASE64_ENCODING = "base64";
-public static final String BASE32_ENCODING = "base32";
-public static final String HEX_ENCODING = "hex";
-
 public static final PropertyDescriptor MODE = new 
PropertyDescriptor.Builder()
 .name("Mode")
 .description("Specifies whether the content should be encoded or 
decoded")
 .required(true)
-.allowableValues(ENCODE_MODE, DECODE_MODE)
-.defaultValue(ENCODE_MODE)
+.allowableValues(EncodingMode.class)
+.defaultValue(EncodingMode.ENCODE.getValue())

Review Comment:
   ```suggestion
   .defaultValue(EncodingMode.ENCODE)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


dan-s1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492643756


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EncodeContent.java:
##
@@ -29,55 +37,88 @@
 import org.apache.nifi.annotation.documentation.CapabilityDescription;
 import org.apache.nifi.annotation.documentation.Tags;
 import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.components.Validator;
+import org.apache.nifi.expression.ExpressionLanguageScope;
 import org.apache.nifi.flowfile.FlowFile;
 import org.apache.nifi.processor.AbstractProcessor;
 import org.apache.nifi.processor.ProcessContext;
 import org.apache.nifi.processor.ProcessSession;
 import org.apache.nifi.processor.Relationship;
 import org.apache.nifi.processor.io.StreamCallback;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.processors.standard.encoding.EncodingMode;
+import org.apache.nifi.processors.standard.encoding.EncodingType;
+import org.apache.nifi.processors.standard.encoding.LineOutputMode;
 import org.apache.nifi.processors.standard.util.ValidatingBase32InputStream;
 import org.apache.nifi.processors.standard.util.ValidatingBase64InputStream;
 import org.apache.nifi.stream.io.StreamUtils;
 import org.apache.nifi.util.StopWatch;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
 @SideEffectFree
 @SupportsBatching
 @InputRequirement(Requirement.INPUT_REQUIRED)
 @Tags({"encode", "decode", "base64", "base32", "hex"})
 @CapabilityDescription("Encode or decode the contents of a FlowFile using 
Base64, Base32, or hex encoding schemes")
 public class EncodeContent extends AbstractProcessor {
 
-public static final String ENCODE_MODE = "Encode";
-public static final String DECODE_MODE = "Decode";
-
-public static final String BASE64_ENCODING = "base64";
-public static final String BASE32_ENCODING = "base32";
-public static final String HEX_ENCODING = "hex";
-
 public static final PropertyDescriptor MODE = new 
PropertyDescriptor.Builder()
 .name("Mode")
 .description("Specifies whether the content should be encoded or 
decoded")
 .required(true)
-.allowableValues(ENCODE_MODE, DECODE_MODE)
-.defaultValue(ENCODE_MODE)
+.allowableValues(EncodingMode.class)
+.defaultValue(EncodingMode.ENCODE.getValue())

Review Comment:
   `defaultValue` is overloaded to take a `DescribedValue`
   
   ```suggestion
   .defaultValue(EncodingMode.ENCODE)
   ```



##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EncodeContent.java:
##
@@ -29,55 +37,88 @@
 import org.apache.nifi.annotation.documentation.CapabilityDescription;
 import org.apache.nifi.annotation.documentation.Tags;
 import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.components.Validator;
+import org.apache.nifi.expression.ExpressionLanguageScope;
 import org.apache.nifi.flowfile.FlowFile;
 import org.apache.nifi.processor.AbstractProcessor;
 import org.apache.nifi.processor.ProcessContext;
 import org.apache.nifi.processor.ProcessSession;
 import org.apache.nifi.processor.Relationship;
 import org.apache.nifi.processor.io.StreamCallback;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.processors.standard.encoding.EncodingMode;
+import org.apache.nifi.processors.standard.encoding.EncodingType;
+import org.apache.nifi.processors.standard.encoding.LineOutputMode;
 import org.apache.nifi.processors.standard.util.ValidatingBase32InputStream;
 import org.apache.nifi.processors.standard.util.ValidatingBase64InputStream;
 import org.apache.nifi.stream.io.StreamUtils;
 import org.apache.nifi.util.StopWatch;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
 @SideEffectFree
 @SupportsBatching
 @InputRequirement(Requirement.INPUT_REQUIRED)
 @Tags({"encode", "decode", "base64", "base32", "hex"})
 @CapabilityDescription("Encode or decode the contents of a FlowFile using 
Base64, Base32, or hex encoding schemes")
 public class EncodeContent extends AbstractProcessor {
 
-public static final String ENCODE_MODE = "Encode";
-public static final String DECODE_MODE = "Decode";
-
-public static final String BASE64_ENCODING = "base64";
-public static final String BASE32_ENCODING = "base32";
-public static final String HEX_ENCODING = "hex";
-
 public static final PropertyDescriptor MODE = new 
PropertyDescriptor.Builder()
 .name("Mode")
 

[jira] [Created] (NIFI-12807) API paths don't work when proxied backend on different path

2024-02-16 Thread Matt Gilman (Jira)
Matt Gilman created NIFI-12807:
--

 Summary: API paths don't work when proxied backend on different 
path
 Key: NIFI-12807
 URL: https://issues.apache.org/jira/browse/NIFI-12807
 Project: Apache NiFi
  Issue Type: Sub-task
  Components: Core UI
Reporter: Matt Gilman
Assignee: Matt Gilman


When running the dev server with a target backend that is running on a 
different path, the API calls do not use the correct base path. I believe this 
is due to its current usage of relative paths. Some changes may be needed to 
work with the http client in it's intended way.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[PR] Bump undici and @angular-devkit/build-angular in /nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi [nifi]

2024-02-16 Thread via GitHub


dependabot[bot] opened a new pull request, #8418:
URL: https://github.com/apache/nifi/pull/8418

   Bumps [undici](https://github.com/nodejs/undici) to 6.6.2 and updates 
ancestor dependency 
[@angular-devkit/build-angular](https://github.com/angular/angular-cli). These 
dependencies need to be updated together.
   
   Updates `undici` from 6.2.1 to 6.6.2
   
   Release notes
   Sourced from https://github.com/nodejs/undici/releases;>undici's releases.
   
   v6.6.2
   What's Changed
   
   fix: webidl.brandcheck non strict should throw by https://github.com/Uzlopak;>@​Uzlopak in https://redirect.github.com/nodejs/undici/pull/2683;>nodejs/undici#2683
   fix: expose EventSource for nodejs by https://github.com/Uzlopak;>@​Uzlopak in https://redirect.github.com/nodejs/undici/pull/2645;>nodejs/undici#2645
   test: more information from debug tests by https://github.com/Uzlopak;>@​Uzlopak in https://redirect.github.com/nodejs/undici/pull/2695;>nodejs/undici#2695
   Fix broken test on linux by https://github.com/mcollina;>@​mcollina in https://redirect.github.com/nodejs/undici/pull/2699;>nodejs/undici#2699
   fix: fix the linux patch by https://github.com/Uzlopak;>@​Uzlopak in https://redirect.github.com/nodejs/undici/pull/2703;>nodejs/undici#2703
   test(wpt): mark timed out tests as 'failed' by https://github.com/rossilor95;>@​rossilor95 in https://redirect.github.com/nodejs/undici/pull/2644;>nodejs/undici#2644
   build(deps-dev): bump borp from 0.5.0 to 0.9.1 by https://github.com/dependabot;>@​dependabot in https://redirect.github.com/nodejs/undici/pull/2702;>nodejs/undici#2702
   perf: use insertion sort algorithm by https://github.com/tsctx;>@​tsctx in https://redirect.github.com/nodejs/undici/pull/2706;>nodejs/undici#2706
   fix: run node tests on merge by https://github.com/Uzlopak;>@​Uzlopak in https://redirect.github.com/nodejs/undici/pull/2707;>nodejs/undici#2707
   
   New Contributors
   
   https://github.com/rossilor95;>@​rossilor95 
made their first contribution in https://redirect.github.com/nodejs/undici/pull/2644;>nodejs/undici#2644
   
   Full Changelog: https://github.com/nodejs/undici/compare/v6.6.1...v6.6.2;>https://github.com/nodejs/undici/compare/v6.6.1...v6.6.2
   v6.6.1
   ⚠️ Security Release ⚠️
   Fixes:
   
   https://github.com/nodejs/undici/security/advisories/GHSA-9f24-jqhm-jfcw;>CVE-2024-24750,
 Backpressure request ignored in fetch()
   https://github.com/nodejs/undici/security/advisories/GHSA-3787-6prv-h9w3;>CVE-2024-24758
 Proxy-Authorization header not cleared on cross-origin redirect in 
fetch
   
   What's Changed
   
   fix: flaky debug test by https://github.com/Uzlopak;>@​Uzlopak in https://redirect.github.com/nodejs/undici/pull/2687;>nodejs/undici#2687
   build(deps): bump github/codeql-action from 3.22.12 to 3.23.2 by https://github.com/dependabot;>@​dependabot in https://redirect.github.com/nodejs/undici/pull/2688;>nodejs/undici#2688
   build(deps): bump actions/dependency-review-action from 3.1.0 to 4.0.0 
by https://github.com/dependabot;>@​dependabot in https://redirect.github.com/nodejs/undici/pull/2689;>nodejs/undici#2689
   fix: ci pipeline warnings by https://github.com/Uzlopak;>@​Uzlopak in https://redirect.github.com/nodejs/undici/pull/2685;>nodejs/undici#2685
   perf: optimize Iterator by https://github.com/tsctx;>@​tsctx in https://redirect.github.com/nodejs/undici/pull/2692;>nodejs/undici#2692
   
   Full Changelog: https://github.com/nodejs/undici/compare/v6.6.0...v6.6.1;>https://github.com/nodejs/undici/compare/v6.6.0...v6.6.1
   v6.6.0
   What's Changed
   
   add webSocket example by https://github.com/mertcanaltin;>@​mertcanaltin in https://redirect.github.com/nodejs/undici/pull/2626;>nodejs/undici#2626
   chore: remove atomic-sleep as dev dependency by https://github.com/Uzlopak;>@​Uzlopak in https://redirect.github.com/nodejs/undici/pull/2648;>nodejs/undici#2648
   chore: remove semver as dev dependency by https://github.com/Uzlopak;>@​Uzlopak in https://redirect.github.com/nodejs/undici/pull/2646;>nodejs/undici#2646
   chore: remove table as dev dependency by https://github.com/Uzlopak;>@​Uzlopak in https://redirect.github.com/nodejs/undici/pull/2649;>nodejs/undici#2649
   chore: remove delay as dev dependency by https://github.com/Uzlopak;>@​Uzlopak in https://redirect.github.com/nodejs/undici/pull/2647;>nodejs/undici#2647
   chore: reduce noise in test-logs test/issue-2349.js by https://github.com/Uzlopak;>@​Uzlopak in https://redirect.github.com/nodejs/undici/pull/2655;>nodejs/undici#2655
   chore: fix faketimer warning in test/request-timeout.js by https://github.com/Uzlopak;>@​Uzlopak in https://redirect.github.com/nodejs/undici/pull/2656;>nodejs/undici#2656
   chore: reduce noise in test logs test/client-node-max-header-size.js by 
https://github.com/Uzlopak;>@​Uzlopak in https://redirect.github.com/nodejs/undici/pull/2654;>nodejs/undici#2654
   refactor: use fromInnerResponse by https://github.com/tsctx;>@​tsctx in 

[jira] [Updated] (NIFI-12795) Help Documentation

2024-02-16 Thread Matt Gilman (Jira)


 [ 
https://issues.apache.org/jira/browse/NIFI-12795?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Matt Gilman updated NIFI-12795:
---
Fix Version/s: 2.0.0
   Resolution: Fixed
   Status: Resolved  (was: Patch Available)

> Help Documentation
> --
>
> Key: NIFI-12795
> URL: https://issues.apache.org/jira/browse/NIFI-12795
> Project: Apache NiFi
>  Issue Type: Sub-task
>  Components: Core UI
>Reporter: Matt Gilman
>Assignee: Matt Gilman
>Priority: Major
> Fix For: 2.0.0
>
>  Time Spent: 2h 50m
>  Remaining Estimate: 0h
>
> Add support to open the NiFi Help Docs in the new UI



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Updated] (NIFI-12761) RPG refresh

2024-02-16 Thread Matt Gilman (Jira)


 [ 
https://issues.apache.org/jira/browse/NIFI-12761?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Matt Gilman updated NIFI-12761:
---
Fix Version/s: 2.0.0
   Resolution: Fixed
   Status: Resolved  (was: Patch Available)

> RPG refresh
> ---
>
> Key: NIFI-12761
> URL: https://issues.apache.org/jira/browse/NIFI-12761
> Project: Apache NiFi
>  Issue Type: Sub-task
>Reporter: Scott Aslan
>Assignee: Scott Aslan
>Priority: Major
> Fix For: 2.0.0
>
>  Time Spent: 1h 20m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (NIFI-12761) RPG refresh

2024-02-16 Thread ASF subversion and git services (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-12761?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17818019#comment-17818019
 ] 

ASF subversion and git services commented on NIFI-12761:


Commit 3c5b997ce759c30673c246fcd3331bcb099a9df1 in nifi's branch 
refs/heads/main from Scott Aslan
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=3c5b997ce7 ]

[NIFI-12761] refresh RPG (#8401)

* [NIFI-12761] refresh RPG

* address feedback

* stop polling on error

* fix linting errors introduced in this PR

* reload the connections

* refresh rpg, if first call does not have updated timestamp start polling

* rename action

* final touches

This closes #8401 

> RPG refresh
> ---
>
> Key: NIFI-12761
> URL: https://issues.apache.org/jira/browse/NIFI-12761
> Project: Apache NiFi
>  Issue Type: Sub-task
>Reporter: Scott Aslan
>Assignee: Scott Aslan
>Priority: Major
>  Time Spent: 1h 20m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)


Re: [PR] [NIFI-12761] refresh RPG [nifi]

2024-02-16 Thread via GitHub


mcgilman merged PR #8401:
URL: https://github.com/apache/nifi/pull/8401


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[jira] [Updated] (NIFI-12806) Add color selector to Configure Label dialog

2024-02-16 Thread John Wise (Jira)


 [ 
https://issues.apache.org/jira/browse/NIFI-12806?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

John Wise updated NIFI-12806:
-
Component/s: Core UI

> Add color selector to Configure Label dialog
> 
>
> Key: NIFI-12806
> URL: https://issues.apache.org/jira/browse/NIFI-12806
> Project: Apache NiFi
>  Issue Type: Improvement
>  Components: Core UI
>Reporter: John Wise
>Priority: Minor
>
> The current process of creating/editing a label and coloring it requires too 
> many steps.  Ideally, the color selector, value, and preview would be 
> incorporated into the Configure Label dialog.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Created] (NIFI-12806) Add color selector to Configure Label dialog

2024-02-16 Thread John Wise (Jira)
John Wise created NIFI-12806:


 Summary: Add color selector to Configure Label dialog
 Key: NIFI-12806
 URL: https://issues.apache.org/jira/browse/NIFI-12806
 Project: Apache NiFi
  Issue Type: Improvement
Reporter: John Wise


The current process of creating/editing a label and coloring it requires too 
many steps.  Ideally, the color selector, value, and preview would be 
incorporated into the Configure Label dialog.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Updated] (NIFI-12806) Add color selector to Configure Label dialog

2024-02-16 Thread John Wise (Jira)


 [ 
https://issues.apache.org/jira/browse/NIFI-12806?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

John Wise updated NIFI-12806:
-
Description: 
The current process of creating/editing a label and coloring it requires too 
many steps.  Ideally, the color selector, value, and preview would be 
incorporated into the Configure Label dialog.

Also, gradients and rich text were very useful.  It would be great if those 
returned as well.

  was:The current process of creating/editing a label and coloring it requires 
too many steps.  Ideally, the color selector, value, and preview would be 
incorporated into the Configure Label dialog.


> Add color selector to Configure Label dialog
> 
>
> Key: NIFI-12806
> URL: https://issues.apache.org/jira/browse/NIFI-12806
> Project: Apache NiFi
>  Issue Type: Improvement
>  Components: Core UI
>Reporter: John Wise
>Priority: Minor
>
> The current process of creating/editing a label and coloring it requires too 
> many steps.  Ideally, the color selector, value, and preview would be 
> incorporated into the Configure Label dialog.
> Also, gradients and rich text were very useful.  It would be great if those 
> returned as well.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Created] (NIFI-12805) Improve NiFi Registry client dialogs

2024-02-16 Thread John Wise (Jira)
John Wise created NIFI-12805:


 Summary: Improve NiFi Registry client dialogs
 Key: NIFI-12805
 URL: https://issues.apache.org/jira/browse/NIFI-12805
 Project: Apache NiFi
  Issue Type: Improvement
  Components: NiFi Registry
Reporter: John Wise


When adding a new NiFi Registry, the process is broken up into multiple 
operations - First, only the Name, Type, and Description can be 
entered/selected.  Only after that's been added, can you then click the pencil 
icon to actually provide the URL and SSL context properties.

The edit dialog should replace the initial Add dialog.  Also, if only one 
NiFiRegistryFlowRegistryClient type is available, then it shouldn't be a 
selectable option.  If more than one type is envisioned in the future, then it 
should be a property in the Edit dialog.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


Re: [PR] [NIFI-12761] refresh RPG [nifi]

2024-02-16 Thread via GitHub


scottyaslan commented on code in PR #8401:
URL: https://github.com/apache/nifi/pull/8401#discussion_r1492604164


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/state/flow/flow.effects.ts:
##
@@ -359,6 +363,70 @@ export class FlowEffects {
 { dispatch: false }
 );
 
+startRemoteProcessGroupPolling$ = createEffect(() =>
+this.actions$.pipe(
+ofType(FlowActions.startRemoteProcessGroupPolling),
+switchMap(() => {
+return interval(3000, asyncScheduler).pipe(
+
takeUntil(this.actions$.pipe(ofType(FlowActions.stopRemoteProcessGroupPolling)))
+);
+}),
+switchMap(() => {
+return of(FlowActions.refreshRemoteProcessGroup());
+})
+)
+);
+
+requestRemoteProcessGroup$ = createEffect(() =>

Review Comment:
   That's what I get for trying to use the IDE refactor/rename feature! LOL!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[jira] [Commented] (NIFI-12795) Help Documentation

2024-02-16 Thread ASF subversion and git services (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-12795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17817994#comment-17817994
 ] 

ASF subversion and git services commented on NIFI-12795:


Commit 6f6ddf89609298a9735747bf0e8713eba888b45d in nifi's branch 
refs/heads/main from Matt Gilman
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=6f6ddf8960 ]

NIFI-12795: (#8416)

- Including embedded help documentation.
- Support linking to specific help documentation from the canvas and component 
listings.

> Help Documentation
> --
>
> Key: NIFI-12795
> URL: https://issues.apache.org/jira/browse/NIFI-12795
> Project: Apache NiFi
>  Issue Type: Sub-task
>  Components: Core UI
>Reporter: Matt Gilman
>Assignee: Matt Gilman
>Priority: Major
>  Time Spent: 2h 50m
>  Remaining Estimate: 0h
>
> Add support to open the NiFi Help Docs in the new UI



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


Re: [PR] NIFI-12795: Including embedded help documentation [nifi]

2024-02-16 Thread via GitHub


scottyaslan merged PR #8416:
URL: https://github.com/apache/nifi/pull/8416


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[jira] [Commented] (NIFI-4728) Create ExtractHeader processor

2024-02-16 Thread David Handermann (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17817993#comment-17817993
 ] 

David Handermann commented on NIFI-4728:


Thanks for the reply. ReplaceText has a number of configuration options for 
selective extraction or removal as needed. If there are use cases that it 
doesn't cover, it would be worth highlighting them and considering additions to 
that Processor. If things don't fit, that might be a reason for a new 
Processor, but that's where a few use case examples would be helpful. Using a 
Line-by-Line evaluation with tailored regular expression also enables 
fine-grained control over text manipulation, versus a more arbitrary removal of 
a number of lines.

> Create ExtractHeader processor
> --
>
> Key: NIFI-4728
> URL: https://issues.apache.org/jira/browse/NIFI-4728
> Project: Apache NiFi
>  Issue Type: New Feature
>  Components: Extensions
>Affects Versions: 1.4.0
>Reporter: Andy LoPresto
>Assignee: Jason Sherman
>Priority: Minor
>  Labels: header, processor, text
>
> A frequent community request is to remove a header line from incoming text. 
> The {{ExtractHeaderProcessor}} should accept arbitrary text, remove a 
> (configurable number of) lines from the beginning, and route a new child 
> flowfile containing the header to a {{header}} relationship, and the 
> remaining contents to a {{body}} relationship. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Comment Edited] (NIFI-4728) Create ExtractHeader processor

2024-02-16 Thread crissaegrim (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17817992#comment-17817992
 ] 

crissaegrim edited comment on NIFI-4728 at 2/16/24 2:44 PM:


Okay, I was gonna add a `ExtractHeadOrTail` proc with configurable lines.  If 
it's as you say, then can probably close.


was (Author: JIRAUSER298664):
Okay, I was gonna head a `ExtractHeadOrTail` proc with configurable lines.  If 
it's as you say, then can probably close.

> Create ExtractHeader processor
> --
>
> Key: NIFI-4728
> URL: https://issues.apache.org/jira/browse/NIFI-4728
> Project: Apache NiFi
>  Issue Type: New Feature
>  Components: Extensions
>Affects Versions: 1.4.0
>Reporter: Andy LoPresto
>Assignee: Jason Sherman
>Priority: Minor
>  Labels: header, processor, text
>
> A frequent community request is to remove a header line from incoming text. 
> The {{ExtractHeaderProcessor}} should accept arbitrary text, remove a 
> (configurable number of) lines from the beginning, and route a new child 
> flowfile containing the header to a {{header}} relationship, and the 
> remaining contents to a {{body}} relationship. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


dan-s1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492563877


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EncodeContent.java:
##
@@ -112,9 +153,14 @@ public void onTrigger(final ProcessContext context, final 
ProcessSession session
 return;
 }
 
-final boolean encode = 
context.getProperty(MODE).getValue().equalsIgnoreCase(ENCODE_MODE);
-final String encoding = context.getProperty(ENCODING).getValue();
-final StreamCallback callback = getStreamCallback(encode, encoding);
+final boolean encode = 
context.getProperty(MODE).getValue().equals(EncodingMode.ENCODE.getValue());
+   final EncodingType encoding = 
EncodingType.valueOf(context.getProperty(ENCODING).getValue());

Review Comment:
   Please align the corrected variable with the others
   ```suggestion
   final boolean encode = 
context.getProperty(MODE).getValue().equals(EncodingMode.ENCODE.getValue());
   final EncodingType encoding = 
EncodingType.valueOf(context.getProperty(ENCODING).getValue());
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[jira] [Commented] (NIFI-4728) Create ExtractHeader processor

2024-02-16 Thread crissaegrim (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17817992#comment-17817992
 ] 

crissaegrim commented on NIFI-4728:
---

Okay, I was gonna head a `ExtractHeadOrTail` proc with configurable lines.  If 
it's as you say, then can probably close.

> Create ExtractHeader processor
> --
>
> Key: NIFI-4728
> URL: https://issues.apache.org/jira/browse/NIFI-4728
> Project: Apache NiFi
>  Issue Type: New Feature
>  Components: Extensions
>Affects Versions: 1.4.0
>Reporter: Andy LoPresto
>Assignee: Jason Sherman
>Priority: Minor
>  Labels: header, processor, text
>
> A frequent community request is to remove a header line from incoming text. 
> The {{ExtractHeaderProcessor}} should accept arbitrary text, remove a 
> (configurable number of) lines from the beginning, and route a new child 
> flowfile containing the header to a {{header}} relationship, and the 
> remaining contents to a {{body}} relationship. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (NIFI-4728) Create ExtractHeader processor

2024-02-16 Thread David Handermann (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17817989#comment-17817989
 ] 

David Handermann commented on NIFI-4728:


[~crissaegrim] The ReplaceText Processor already supports a number of text 
manipulation use cases, so this without further description of features, this 
may not be a necessary addition.

> Create ExtractHeader processor
> --
>
> Key: NIFI-4728
> URL: https://issues.apache.org/jira/browse/NIFI-4728
> Project: Apache NiFi
>  Issue Type: New Feature
>  Components: Extensions
>Affects Versions: 1.4.0
>Reporter: Andy LoPresto
>Assignee: Jason Sherman
>Priority: Minor
>  Labels: header, processor, text
>
> A frequent community request is to remove a header line from incoming text. 
> The {{ExtractHeaderProcessor}} should accept arbitrary text, remove a 
> (configurable number of) lines from the beginning, and route a new child 
> flowfile containing the header to a {{header}} relationship, and the 
> remaining contents to a {{body}} relationship. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


knguyen1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492555324


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EncodeContent.java:
##
@@ -129,31 +175,35 @@ public void onTrigger(final ProcessContext context, final 
ProcessSession session
 }
 }
 
-private static StreamCallback getStreamCallback(final boolean encode, 
final String encoding) {
-if (encode) {
-if (encoding.equalsIgnoreCase(BASE64_ENCODING)) {
-return new EncodeBase64();
-} else if (encoding.equalsIgnoreCase(BASE32_ENCODING)) {
-return new EncodeBase32();
-} else {
-return new EncodeHex();
-}
-} else {
-if (encoding.equalsIgnoreCase(BASE64_ENCODING)) {
-return new DecodeBase64();
-} else if (encoding.equalsIgnoreCase(BASE32_ENCODING)) {
-return new DecodeBase32();
-} else {
-return new DecodeHex();
-}
+private static StreamCallback getStreamCallback(final Boolean encode, 
final String encoding,
+final int lineLength, final String lineSeparator) {
+switch(encoding) {
+case "BASE64_ENCODING":
+return encode ? new EncodeBase64(lineLength, lineSeparator) : 
new DecodeBase64();
+case "BASE32_ENCODING":
+return encode ? new EncodeBase32(lineLength, lineSeparator) : 
new DecodeBase32();

Review Comment:
   Interesting.  Okay, didn't know enums behaved that way.  Committing.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12017 add ability to choose to output to single line for base32 base64 contents [nifi]

2024-02-16 Thread via GitHub


dan-s1 commented on code in PR #8417:
URL: https://github.com/apache/nifi/pull/8417#discussion_r1492547462


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EncodeContent.java:
##
@@ -112,9 +153,14 @@ public void onTrigger(final ProcessContext context, final 
ProcessSession session
 return;
 }
 
-final boolean encode = 
context.getProperty(MODE).getValue().equalsIgnoreCase(ENCODE_MODE);
+final boolean encode = 
context.getProperty(MODE).getValue().equals(EncodingMode.ENCODE.getValue());
 final String encoding = context.getProperty(ENCODING).getValue();

Review Comment:
   ```suggestion
  final EncodingType encoding = 
EncodingType.valueOf(context.getProperty(ENCODING).getValue());
   ```



##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EncodeContent.java:
##
@@ -129,31 +175,35 @@ public void onTrigger(final ProcessContext context, final 
ProcessSession session
 }
 }
 
-private static StreamCallback getStreamCallback(final boolean encode, 
final String encoding) {
-if (encode) {
-if (encoding.equalsIgnoreCase(BASE64_ENCODING)) {
-return new EncodeBase64();
-} else if (encoding.equalsIgnoreCase(BASE32_ENCODING)) {
-return new EncodeBase32();
-} else {
-return new EncodeHex();
-}
-} else {
-if (encoding.equalsIgnoreCase(BASE64_ENCODING)) {
-return new DecodeBase64();
-} else if (encoding.equalsIgnoreCase(BASE32_ENCODING)) {
-return new DecodeBase32();
-} else {
-return new DecodeHex();
-}
+private static StreamCallback getStreamCallback(final Boolean encode, 
final String encoding,
+final int lineLength, final String lineSeparator) {
+switch(encoding) {
+case "BASE64_ENCODING":
+return encode ? new EncodeBase64(lineLength, lineSeparator) : 
new DecodeBase64();
+case "BASE32_ENCODING":
+return encode ? new EncodeBase32(lineLength, lineSeparator) : 
new DecodeBase32();

Review Comment:
   ```suggestion
   private static StreamCallback getStreamCallback(final Boolean encode, 
final EncodingType encoding,
   final int lineLength, final String lineSeparator) {
   switch(encoding) {
   case BASE64_ENCODING:
   return encode ? new EncodeBase64(lineLength, lineSeparator) 
: new DecodeBase64();
   case BASE32_ENCODING:
   return encode ? new EncodeBase32(lineLength, lineSeparator) 
: new DecodeBase32();
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[jira] [Commented] (NIFI-4728) Create ExtractHeader processor

2024-02-16 Thread crissaegrim (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17817975#comment-17817975
 ] 

crissaegrim commented on NIFI-4728:
---

It doesn't look like there's been update on this ticket.  I'll take this one.

> Create ExtractHeader processor
> --
>
> Key: NIFI-4728
> URL: https://issues.apache.org/jira/browse/NIFI-4728
> Project: Apache NiFi
>  Issue Type: New Feature
>  Components: Extensions
>Affects Versions: 1.4.0
>Reporter: Andy LoPresto
>Assignee: Jason Sherman
>Priority: Minor
>  Labels: header, processor, text
>
> A frequent community request is to remove a header line from incoming text. 
> The {{ExtractHeaderProcessor}} should accept arbitrary text, remove a 
> (configurable number of) lines from the beginning, and route a new child 
> flowfile containing the header to a {{header}} relationship, and the 
> remaining contents to a {{body}} relationship. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


Re: [PR] NIFI-12795: Including embedded help documentation [nifi]

2024-02-16 Thread via GitHub


mcgilman commented on code in PR #8416:
URL: https://github.com/apache/nifi/pull/8416#discussion_r1492472964


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/service/canvas-context-menu.service.ts:
##
@@ -57,6 +57,7 @@ import {
 } from '../../../ui/common/context-menu/context-menu.component';
 import { promptEmptyQueueRequest, promptEmptyQueuesRequest } from 
'../state/queue/queue.actions';
 import { getComponentStateAndOpenDialog } from 
'../../../state/component-state/component-state.actions';
+import { navigateToComponentDocumentation } from 
'../../../state/documentation/documentation.actions';

Review Comment:
   Same command as above.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12795: Including embedded help documentation [nifi]

2024-02-16 Thread via GitHub


mcgilman commented on code in PR #8416:
URL: https://github.com/apache/nifi/pull/8416#discussion_r1492472637


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/documentation/feature/documentation.component.ts:
##
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+
+import { Component, OnDestroy, SecurityContext } from '@angular/core';
+import { NiFiState } from '../../../state';
+import { Store } from '@ngrx/store';
+import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
+import { HttpParams } from '@angular/common/http';
+import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
+import { selectDocumentationParameters } from 
'../../../state/documentation/documentation.selectors';
+import { DocumentationParameters } from '../../../state/documentation';
+import { clearDocumentationParameters } from 
'../../../state/documentation/documentation.actions';

Review Comment:
   Same comment as above.



##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/ui/controller-service/controller-services.component.ts:
##
@@ -46,6 +46,7 @@ import { selectFlowConfiguration } from 
'../../../../state/flow-configuration/fl
 import { NiFiState } from '../../../../state';
 import { loadFlowConfiguration } from 
'../../../../state/flow-configuration/flow-configuration.actions';
 import { getComponentStateAndOpenDialog } from 
'../../../../state/component-state/component-state.actions';
+import { navigateToComponentDocumentation } from 
'../../../../state/documentation/documentation.actions';

Review Comment:
   Same comment as above.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12795: Including embedded help documentation [nifi]

2024-02-16 Thread via GitHub


mcgilman commented on code in PR #8416:
URL: https://github.com/apache/nifi/pull/8416#discussion_r1492471864


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/reporting-tasks/reporting-tasks.component.ts:
##
@@ -43,6 +43,7 @@ import { NiFiState } from '../../../../state';
 import { loadFlowConfiguration } from 
'../../../../state/flow-configuration/flow-configuration.actions';
 import { selectFlowConfiguration } from 
'../../../../state/flow-configuration/flow-configuration.selectors';
 import { getComponentStateAndOpenDialog } from 
'../../../../state/component-state/component-state.actions';
+import { navigateToComponentDocumentation } from 
'../../../../state/documentation/documentation.actions';

Review Comment:
   Same comment as above.



##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/parameter-providers/parameter-providers.component.ts:
##
@@ -34,6 +34,7 @@ import { initialParameterProvidersState } from 
'../../state/parameter-providers/
 import { switchMap, take } from 'rxjs';
 import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
 import { isDefinedAndNotNull } from '../../../../state/shared';
+import { navigateToComponentDocumentation } from 
'../../../../state/documentation/documentation.actions';

Review Comment:
   Same comment as above.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12795: Including embedded help documentation [nifi]

2024-02-16 Thread via GitHub


mcgilman commented on code in PR #8416:
URL: https://github.com/apache/nifi/pull/8416#discussion_r1492472236


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/management-controller-services/management-controller-services.component.ts:
##
@@ -45,6 +45,7 @@ import { selectFlowConfiguration } from 
'../../../../state/flow-configuration/fl
 import { loadFlowConfiguration } from 
'../../../../state/flow-configuration/flow-configuration.actions';
 import { CurrentUser } from '../../../../state/current-user';
 import { getComponentStateAndOpenDialog } from 
'../../../../state/component-state/component-state.actions';
+import { navigateToComponentDocumentation } from 
'../../../../state/documentation/documentation.actions';

Review Comment:
   Same comment as above.



##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/flow-analysis-rules/flow-analysis-rules.component.ts:
##
@@ -41,6 +41,7 @@ import { selectCurrentUser } from 
'../../../../state/current-user/current-user.s
 import { NiFiState } from '../../../../state';
 import { FlowAnalysisRuleEntity, FlowAnalysisRulesState } from 
'../../state/flow-analysis-rules';
 import { getComponentStateAndOpenDialog } from 
'../../../../state/component-state/component-state.actions';
+import { navigateToComponentDocumentation } from 
'../../../../state/documentation/documentation.actions';

Review Comment:
   Same comment as above.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12795: Including embedded help documentation [nifi]

2024-02-16 Thread via GitHub


mcgilman commented on code in PR #8416:
URL: https://github.com/apache/nifi/pull/8416#discussion_r1492471475


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/ui/common/controller-service/controller-service-table/controller-service-table.component.html:
##
@@ -31,13 +31,11 @@
 
 @if (canRead(item)) {
 
-
-
+

Review Comment:
   We could look at other options when considering our strategy for tooltips 
throughout. We still need to address all the info icons. But thus far, all 
buttons and icons in table listings have used `title`. Here I only updated the 
value.



##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/parameter-providers/parameter-providers-table/parameter-providers-table.component.html:
##
@@ -31,25 +31,29 @@
 
 
 
-
-
-
+@if (canRead(item)) {
+
+
+
 
-
-
+

Review Comment:
   Same comment as above.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12795: Including embedded help documentation [nifi]

2024-02-16 Thread via GitHub


mcgilman commented on code in PR #8416:
URL: https://github.com/apache/nifi/pull/8416#discussion_r1492468292


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/state/documentation/documentation.reducer.ts:
##
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+import { createReducer, on } from '@ngrx/store';
+import { DocumentationState } from './index';
+import { clearDocumentationParameters, navigateToComponentDocumentation } from 
'./documentation.actions';

Review Comment:
   Thus far we've only been doing this in Effects. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12795: Including embedded help documentation [nifi]

2024-02-16 Thread via GitHub


mcgilman commented on code in PR #8416:
URL: https://github.com/apache/nifi/pull/8416#discussion_r1492467286


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/flow-analysis-rules/flow-analysis-rule-table/flow-analysis-rule-table.component.html:
##
@@ -31,7 +31,10 @@
 
 @if (canRead(item)) {
 
-
+

Review Comment:
   For these buttons and icons in table listings, they have been used. We are 
still tracking other info icons throughout the application which could yield 
yet another type of tooltip. We should consider our options with light/dark 
mode in mind.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12795: Including embedded help documentation [nifi]

2024-02-16 Thread via GitHub


mcgilman commented on code in PR #8416:
URL: https://github.com/apache/nifi/pull/8416#discussion_r1492463462


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/documentation/feature/documentation.component.html:
##
@@ -0,0 +1,27 @@
+
+
+
+
+

Review Comment:
   The dark mode will be an issue for any of our applications (documentation, 
data viewers, custom UIs, etc) until they can be updated to also support it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12795: Including embedded help documentation [nifi]

2024-02-16 Thread via GitHub


mcgilman commented on code in PR #8416:
URL: https://github.com/apache/nifi/pull/8416#discussion_r1492462044


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/service/canvas-context-menu.service.ts:
##
@@ -717,13 +718,26 @@ export class CanvasContextMenu implements 
ContextMenuDefinitionProvider {
 },
 {
 condition: (selection: any) => {
-// TODO - hasUsage
-return false;
+return (
+this.canvasUtils.canRead(selection) &&

Review Comment:
   Yes. Without permissions, the user does not know what type of Processor is 
on canvas. The details needed for the deep link are only available when the 
user can read.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12795: Including embedded help documentation [nifi]

2024-02-16 Thread via GitHub


mcgilman commented on code in PR #8416:
URL: https://github.com/apache/nifi/pull/8416#discussion_r1492460016


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/documentation/feature/documentation.component.spec.ts:
##
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { Documentation } from './documentation.component';
+import { RouterModule } from '@angular/router';
+import { RouterTestingModule } from '@angular/router/testing';
+import { Component } from '@angular/core';
+import { provideMockStore } from '@ngrx/store/testing';
+import { initialState } from 
'../../../state/documentation/documentation.reducer';
+
+describe('Documentation', () => {
+let component: Documentation;
+let fixture: ComponentFixture;
+
+@Component({
+selector: 'navigation',
+standalone: true,
+template: ''
+})
+class MockNavigation {}

Review Comment:
   This is a good idea. We have a few other mocks that would be good candidates.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12795: Including embedded help documentation [nifi]

2024-02-16 Thread via GitHub


mcgilman commented on code in PR #8416:
URL: https://github.com/apache/nifi/pull/8416#discussion_r1492458688


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/documentation/feature/documentation.component.html:
##
@@ -0,0 +1,27 @@
+
+
+
+
+

Review Comment:
   If I recall correctly, that behavior targeted the Canvas menu item in the 
global menu. It should also work for the icon. This was an oversight that we'll 
need to fix.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12795: Including embedded help documentation [nifi]

2024-02-16 Thread via GitHub


mcgilman commented on code in PR #8416:
URL: https://github.com/apache/nifi/pull/8416#discussion_r1492454355


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/app-routing.module.ts:
##
@@ -28,6 +28,12 @@ const routes: Routes = [
 path: 'error',
 loadChildren: () => 
import('./pages/error/feature/error.module').then((m) => m.ErrorModule)
 },
+{
+path: 'documentation',
+canMatch: [authenticationGuard],

Review Comment:
   We display the current user in the header. The authentication guard ensures 
the current user is loaded for cases when the user directly visits the 
documentation.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] [NIFI-12761] refresh RPG [nifi]

2024-02-16 Thread via GitHub


mcgilman commented on code in PR #8401:
URL: https://github.com/apache/nifi/pull/8401#discussion_r1491549684


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/state/flow/flow.effects.ts:
##
@@ -113,7 +116,8 @@ export class FlowEffects {
 private router: Router,
 private dialog: MatDialog,
 private propertyTableHelperService: PropertyTableHelperService,
-private parameterHelperService: ParameterHelperService
+private parameterHelperService: ParameterHelperService,
+private errorHelper: ErrorHelper

Review Comment:
   This is unused.



##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/state/flow/flow.effects.ts:
##
@@ -359,6 +363,70 @@ export class FlowEffects {
 { dispatch: false }
 );
 
+startRemoteProcessGroupPolling$ = createEffect(() =>
+this.actions$.pipe(
+ofType(FlowActions.startRemoteProcessGroupPolling),
+switchMap(() => {
+return interval(3000, asyncScheduler).pipe(
+
takeUntil(this.actions$.pipe(ofType(FlowActions.stopRemoteProcessGroupPolling)))
+);
+}),
+switchMap(() => {
+return of(FlowActions.refreshRemoteProcessGroup());
+})
+)
+);
+
+requestRemoteProcessGroup$ = createEffect(() =>

Review Comment:
   ```suggestion
   requestRefreshRemoteProcessGroup$ = createEffect(() =>
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org