From e1d136368b53e40acc2cbc158d185f7794b40e3c Mon Sep 17 00:00:00 2001 From: Tomasz Lelek Date: Mon, 6 Mar 2017 18:04:28 +0100 Subject: [PATCH] BAEL-311 move jasypt to libraries module (#1309) * BEEL-311 move jasypt to libraries module * BAEL-9: README.md file updated (#1310) * BAEL-278: Updated README.md * BAEL-554: Add and update README.md files * BAEL-345: fixed assertion * BAEL-109: Updated README.md * BAEL-345: Added README.md * Reinstating reactor-core module in root-level pom * BAEL-393: Adding guide-intro module to root pom * BAEL-9: Updated README.md * Guide to "when" block in Kotlin pull request (#1296) * Char array to string and string to char array test cases added * Minor code renames * Added groupingBy collector unit tests * Added test case for int summary calculation on grouped results * Added the grouping by classes to the main source path * Reverting char array to string test class * Reverting char array to string test class * Reverting char array to string test class * Reverting char array to string test class * Unit test class for Kotlin when block + required types * Minor changes to kotlin when block tests * Minor change * Minor change * Bael 655 (#1256) BAEL-655 hbase * Remove unnecessary files and update .gitignore (#1313) * BAEL-311 Removed jasypt module from parent pom (moved into libraries module) --- jasypt/pom.xml | 34 ---------------- libraries/pom.xml | 6 +++ .../java/com}/baeldung/jasypt/JasyptTest.java | 40 +++++++++---------- pom.xml | 1 - 4 files changed, 25 insertions(+), 56 deletions(-) delete mode 100644 jasypt/pom.xml rename {jasypt/src/test/java/org => libraries/src/test/java/com}/baeldung/jasypt/JasyptTest.java (66%) diff --git a/jasypt/pom.xml b/jasypt/pom.xml deleted file mode 100644 index 7e0c51f0b9..0000000000 --- a/jasypt/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - parent-modules - com.baeldung - 1.0.0-SNAPSHOT - - 4.0.0 - - jasypt - - - - org.jasypt - jasypt - ${jasypt.version} - - - junit - junit - ${junit.version} - test - - - - - 1.9.2 - 4.12 - - - - \ No newline at end of file diff --git a/libraries/pom.xml b/libraries/pom.xml index ee93ee934f..05f8dc47cf 100644 --- a/libraries/pom.xml +++ b/libraries/pom.xml @@ -31,6 +31,11 @@ cglib ${cglib.version} + + org.jasypt + jasypt + ${jasypt.version} + junit junit @@ -42,6 +47,7 @@ 3.2.4 4.12 + 1.9.2 diff --git a/jasypt/src/test/java/org/baeldung/jasypt/JasyptTest.java b/libraries/src/test/java/com/baeldung/jasypt/JasyptTest.java similarity index 66% rename from jasypt/src/test/java/org/baeldung/jasypt/JasyptTest.java rename to libraries/src/test/java/com/baeldung/jasypt/JasyptTest.java index c4bed5de83..fbfa7f823d 100644 --- a/jasypt/src/test/java/org/baeldung/jasypt/JasyptTest.java +++ b/libraries/src/test/java/com/baeldung/jasypt/JasyptTest.java @@ -1,4 +1,4 @@ -package org.baeldung.jasypt; +package com.baeldung.jasypt; import org.jasypt.encryption.pbe.PooledPBEStringEncryptor; @@ -8,27 +8,25 @@ import org.jasypt.util.text.BasicTextEncryptor; import org.junit.Ignore; import org.junit.Test; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertNotSame; -import static junit.framework.Assert.assertTrue; +import static junit.framework.Assert.*; import static junit.framework.TestCase.assertEquals; public class JasyptTest { @Test - public void givenTextPassword_whenDecrypt_thenCompareToEncrypted() { + public void givenTextPrivateData_whenDecrypt_thenCompareToEncrypted() { //given BasicTextEncryptor textEncryptor = new BasicTextEncryptor(); - String password = "secret-pass"; - textEncryptor.setPasswordCharArray("some-random-password".toCharArray()); + String privateData = "secret-data"; + textEncryptor.setPasswordCharArray("some-random-data".toCharArray()); //when - String myEncryptedText = textEncryptor.encrypt(password); - assertNotSame(password, myEncryptedText); //myEncryptedText can be save in db + String myEncryptedText = textEncryptor.encrypt(privateData); + assertNotSame(privateData, myEncryptedText); //myEncryptedText can be save in db //then String plainText = textEncryptor.decrypt(myEncryptedText); - assertEquals(plainText, password); + assertEquals(plainText, privateData); } @Test @@ -61,38 +59,38 @@ public class JasyptTest { @Test @Ignore("should have installed local_policy.jar") - public void givenTextPassword_whenDecrypt_thenCompareToEncryptedWithCustomAlgorithm() { + public void givenTextPrivateData_whenDecrypt_thenCompareToEncryptedWithCustomAlgorithm() { //given StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor(); - String password = "secret-pass"; - encryptor.setPassword("secret-pass"); + String privateData = "secret-data"; + encryptor.setPassword("some-random-data"); encryptor.setAlgorithm("PBEWithMD5AndTripleDES"); //when String encryptedText = encryptor.encrypt("secret-pass"); - assertNotSame(password, encryptedText); + assertNotSame(privateData, encryptedText); //then String plainText = encryptor.decrypt(encryptedText); - assertEquals(plainText, password); + assertEquals(plainText, privateData); } @Test @Ignore("should have installed local_policy.jar") - public void givenTextPassword_whenDecryptOnHighPerformance_thenDecrypt(){ + public void givenTextPrivateData_whenDecryptOnHighPerformance_thenDecrypt(){ //given - String password = "secret-pass"; + String privateData = "secret-data"; PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor(); encryptor.setPoolSize(4); - encryptor.setPassword(password); + encryptor.setPassword("some-random-data"); encryptor.setAlgorithm("PBEWithMD5AndTripleDES"); //when - String encryptedText = encryptor.encrypt(password); - assertNotSame(password, encryptedText); + String encryptedText = encryptor.encrypt(privateData); + assertNotSame(privateData, encryptedText); //then String plainText = encryptor.decrypt(encryptedText); - assertEquals(plainText, password); + assertEquals(plainText, privateData); } } diff --git a/pom.xml b/pom.xml index 9c24200a0b..5230a680fe 100644 --- a/pom.xml +++ b/pom.xml @@ -63,7 +63,6 @@ javaslang javax-servlets javaxval - jasypt jaxb jee7 jjwt