emiliosetiadarma commented on code in PR #7238:
URL: https://github.com/apache/nifi/pull/7238#discussion_r1194416953


##########
nifi-commons/nifi-security-utils/src/test/java/org/apache/nifi/security/util/crypto/AESKeyedCipherProviderTest.java:
##########
@@ -14,311 +14,298 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.nifi.security.util.crypto
+package org.apache.nifi.security.util.crypto;
 
-import org.apache.commons.codec.binary.Hex
-import org.apache.nifi.security.util.EncryptionMethod
-import org.bouncycastle.jce.provider.BouncyCastleProvider
-import org.junit.jupiter.api.BeforeAll
-import org.junit.jupiter.api.Test
-import org.slf4j.Logger
-import org.slf4j.LoggerFactory
+import org.apache.commons.codec.DecoderException;
+import org.apache.commons.codec.binary.Hex;
+import org.apache.nifi.security.util.EncryptionMethod;
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
-import javax.crypto.Cipher
-import javax.crypto.SecretKey
-import javax.crypto.spec.SecretKeySpec
-import java.security.SecureRandom
-import java.security.Security
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.SecretKeySpec;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+import java.security.Security;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
 
-import static org.junit.jupiter.api.Assertions.assertEquals
-import static org.junit.jupiter.api.Assertions.assertFalse
-import static org.junit.jupiter.api.Assertions.assertThrows
-import static org.junit.jupiter.api.Assertions.assertTrue
-import static org.junit.jupiter.api.Assumptions.assumeTrue
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
 
-class AESKeyedCipherProviderGroovyTest {
-    private static final Logger logger = 
LoggerFactory.getLogger(AESKeyedCipherProviderGroovyTest.class)
+public class AESKeyedCipherProviderTest {
+    private static final String KEY_HEX = "0123456789ABCDEFFEDCBA9876543210";
 
-    private static final String KEY_HEX = "0123456789ABCDEFFEDCBA9876543210"
+    private static final String PLAINTEXT = "ExactBlockSizeRequiredForProcess";
 
-    private static final String PLAINTEXT = "ExactBlockSizeRequiredForProcess"
+    private static final List<EncryptionMethod> keyedEncryptionMethods = 
Arrays.stream(EncryptionMethod.values())
+            .filter(EncryptionMethod::isKeyedCipher)
+            .collect(Collectors.toList());
 
-    private static final List<EncryptionMethod> keyedEncryptionMethods = 
EncryptionMethod.values().findAll { it.keyedCipher }
+    private static SecretKey key;
 
-    private static final SecretKey key = new 
SecretKeySpec(Hex.decodeHex(KEY_HEX as char[]), "AES")
 
     @BeforeAll
     static void setUpOnce() throws Exception {
-        Security.addProvider(new BouncyCastleProvider())
+        Security.addProvider(new BouncyCastleProvider());

Review Comment:
   I wasn't able to get the tests to complete without 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

Reply via email to