[
https://issues.apache.org/jira/browse/NIFI-5566?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16617608#comment-16617608
]
ASF GitHub Bot commented on NIFI-5566:
--------------------------------------
Github user kevdoran commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2983#discussion_r218085671
--- Diff:
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/groovy/org/apache/nifi/security/util/crypto/HashServiceTest.groovy
---
@@ -0,0 +1,457 @@
+/*
+ * 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.security.util.crypto
+
+import org.apache.nifi.components.AllowableValue
+import org.bouncycastle.jce.provider.BouncyCastleProvider
+import org.bouncycastle.util.encoders.Hex
+import org.junit.After
+import org.junit.AfterClass
+import org.junit.Before
+import org.junit.BeforeClass
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import java.nio.charset.Charset
+import java.nio.charset.StandardCharsets
+import java.security.Security
+
+@RunWith(JUnit4.class)
+class HashServiceTest extends GroovyTestCase {
+ private static final Logger logger =
LoggerFactory.getLogger(HashServiceTest.class)
+ static private final String LARGE_FILE_PATH =
"src/test/resources/HashServiceTest/largefile.txt"
--- End diff --
This is minor, but this path could be changed to be located in a sub-dir of
`target` instead of `src`, which would have the following advantages:
- would not need to be generated every time the tests are run and would not
need to be manually removed, as it be destroyed only on a `mvn clean`
- would not show up as a git untracked file, as everything under `target`
is ignored
- would not be scanned but the Apache RAT plugin (IIRC, it does not scan
`target`?)
- would not require the `.keep` file to maintain a directory if you put it
in a directory that you expect the build to generate, ie `target/test-classes`
I know that most of these are mitigated by the removal of the file in the
`tearDownOnce()` method, but should the execution / JVM halt for any reason
prior to that method executing (could be more likely in a multi-threaded build
due to errors in other tests), then there is a chance that the generated file
remains in the src directory and could create confusion / unintended
consequences if followed by something like a `git add -A` command.
Like I said, this is a minor nitpick, not a blocker by any means :)
> Bring HashContent inline with HashService and rename legacy components
> ----------------------------------------------------------------------
>
> Key: NIFI-5566
> URL: https://issues.apache.org/jira/browse/NIFI-5566
> Project: Apache NiFi
> Issue Type: Improvement
> Components: Extensions
> Affects Versions: 1.7.1
> Reporter: Andy LoPresto
> Assignee: Andy LoPresto
> Priority: Major
> Labels: backwards-compatibility, hash, security
>
> As documented in [NIFI-5147|https://issues.apache.org/jira/browse/NIFI-5147]
> and [PR 2980|https://github.com/apache/nifi/pull/2980], the {{HashAttribute}}
> processor and {{HashContent}} processor are lacking some features, do not
> offer consistent algorithms across platforms, etc.
> I propose the following:
> * Rename {{HashAttribute}} (which does not provide the service of calculating
> a hash over one or more attributes) to {{HashAttributeLegacy}}
> * Renamed {{CalculateAttributeHash}} to {{HashAttribute}} to make semantic
> sense
> * Rename {{HashContent}} to {{HashContentLegacy}} for users who need obscure
> digest algorithms which may or may not have been offered on their platform
> * Implement a processor {{HashContent}} with similar semantics to the
> existing processor but with consistent algorithm offerings and using the
> common {{HashService}} offering
> With the new component versioning features provided as part of the flow
> versioning behavior, silently disrupting existing flows which use these
> processors is no longer a concern. Rather, Any flow currently using the
> existing processors will either:
> 1. continue normal operation
> 1. require flow manager interaction and provide documentation about the change
> 1. migration notes and upgrade instructions will be provided
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)