Skip to content

Commit e1d1363

Browse files
tomekl007pedja4
authored andcommitted
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)
1 parent 9f94f9f commit e1d1363

4 files changed

Lines changed: 25 additions & 56 deletions

File tree

jasypt/pom.xml

Lines changed: 0 additions & 34 deletions
This file was deleted.

libraries/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
<artifactId>cglib</artifactId>
3232
<version>${cglib.version}</version>
3333
</dependency>
34+
<dependency>
35+
<groupId>org.jasypt</groupId>
36+
<artifactId>jasypt</artifactId>
37+
<version>${jasypt.version}</version>
38+
</dependency>
3439
<dependency>
3540
<groupId>junit</groupId>
3641
<artifactId>junit</artifactId>
@@ -42,6 +47,7 @@
4247
<properties>
4348
<cglib.version>3.2.4</cglib.version>
4449
<junit.version>4.12</junit.version>
50+
<jasypt.version>1.9.2</jasypt.version>
4551
</properties>
4652

4753

jasypt/src/test/java/org/baeldung/jasypt/JasyptTest.java renamed to libraries/src/test/java/com/baeldung/jasypt/JasyptTest.java

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.baeldung.jasypt;
1+
package com.baeldung.jasypt;
22

33

44
import org.jasypt.encryption.pbe.PooledPBEStringEncryptor;
@@ -8,27 +8,25 @@
88
import org.junit.Ignore;
99
import org.junit.Test;
1010

11-
import static junit.framework.Assert.assertFalse;
12-
import static junit.framework.Assert.assertNotSame;
13-
import static junit.framework.Assert.assertTrue;
11+
import static junit.framework.Assert.*;
1412
import static junit.framework.TestCase.assertEquals;
1513

1614
public class JasyptTest {
1715

1816
@Test
19-
public void givenTextPassword_whenDecrypt_thenCompareToEncrypted() {
17+
public void givenTextPrivateData_whenDecrypt_thenCompareToEncrypted() {
2018
//given
2119
BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
22-
String password = "secret-pass";
23-
textEncryptor.setPasswordCharArray("some-random-password".toCharArray());
20+
String privateData = "secret-data";
21+
textEncryptor.setPasswordCharArray("some-random-data".toCharArray());
2422

2523
//when
26-
String myEncryptedText = textEncryptor.encrypt(password);
27-
assertNotSame(password, myEncryptedText); //myEncryptedText can be save in db
24+
String myEncryptedText = textEncryptor.encrypt(privateData);
25+
assertNotSame(privateData, myEncryptedText); //myEncryptedText can be save in db
2826

2927
//then
3028
String plainText = textEncryptor.decrypt(myEncryptedText);
31-
assertEquals(plainText, password);
29+
assertEquals(plainText, privateData);
3230
}
3331

3432
@Test
@@ -61,38 +59,38 @@ public void givenTextPassword_whenOneWayEncryption_thenCompareEncryptedPasswords
6159

6260
@Test
6361
@Ignore("should have installed local_policy.jar")
64-
public void givenTextPassword_whenDecrypt_thenCompareToEncryptedWithCustomAlgorithm() {
62+
public void givenTextPrivateData_whenDecrypt_thenCompareToEncryptedWithCustomAlgorithm() {
6563
//given
6664
StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
67-
String password = "secret-pass";
68-
encryptor.setPassword("secret-pass");
65+
String privateData = "secret-data";
66+
encryptor.setPassword("some-random-data");
6967
encryptor.setAlgorithm("PBEWithMD5AndTripleDES");
7068

7169
//when
7270
String encryptedText = encryptor.encrypt("secret-pass");
73-
assertNotSame(password, encryptedText);
71+
assertNotSame(privateData, encryptedText);
7472

7573
//then
7674
String plainText = encryptor.decrypt(encryptedText);
77-
assertEquals(plainText, password);
75+
assertEquals(plainText, privateData);
7876
}
7977

8078
@Test
8179
@Ignore("should have installed local_policy.jar")
82-
public void givenTextPassword_whenDecryptOnHighPerformance_thenDecrypt(){
80+
public void givenTextPrivateData_whenDecryptOnHighPerformance_thenDecrypt(){
8381
//given
84-
String password = "secret-pass";
82+
String privateData = "secret-data";
8583
PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
8684
encryptor.setPoolSize(4);
87-
encryptor.setPassword(password);
85+
encryptor.setPassword("some-random-data");
8886
encryptor.setAlgorithm("PBEWithMD5AndTripleDES");
8987

9088
//when
91-
String encryptedText = encryptor.encrypt(password);
92-
assertNotSame(password, encryptedText);
89+
String encryptedText = encryptor.encrypt(privateData);
90+
assertNotSame(privateData, encryptedText);
9391

9492
//then
9593
String plainText = encryptor.decrypt(encryptedText);
96-
assertEquals(plainText, password);
94+
assertEquals(plainText, privateData);
9795
}
9896
}

pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
<module>javaslang</module>
6464
<module>javax-servlets</module>
6565
<module>javaxval</module>
66-
<module>jasypt</module>
6766
<module>jaxb</module>
6867
<module>jee7</module>
6968
<module>jjwt</module>

0 commit comments

Comments
 (0)