From c98de38e4c5d93c7ad589e5f1838c5bb107a4b47 Mon Sep 17 00:00:00 2001 From: Roger Yates Date: Wed, 6 Nov 2019 06:00:41 +1000 Subject: [PATCH 1/5] BAEL-3475 - Add code for Lombok Accessors --- .../lombok/accessors/AccessorsTest.java | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 lombok/src/test/java/com/baeldung/lombok/accessors/AccessorsTest.java diff --git a/lombok/src/test/java/com/baeldung/lombok/accessors/AccessorsTest.java b/lombok/src/test/java/com/baeldung/lombok/accessors/AccessorsTest.java new file mode 100644 index 0000000000..b3d9cb16f6 --- /dev/null +++ b/lombok/src/test/java/com/baeldung/lombok/accessors/AccessorsTest.java @@ -0,0 +1,72 @@ +package com.baeldung.lombok.accessors; + +import com.baeldung.lombok.accessors.model.*; +import org.junit.Test; + +import java.math.BigDecimal; + +import static org.junit.Assert.assertEquals; + +public class AccessorsTest { + + @Test + public void givenBasicAccount_thenUseBasicAccessors() { + BasicAccount account = new BasicAccount(); + account.setBalance(BigDecimal.TEN); + account.setName("Basic Accessors"); + + assertEquals(BigDecimal.TEN, account.getBalance()); + assertEquals("Basic Accessors", account.getName()); + } + + @Test + public void givenFluentAccount_thenUseFluentAccessors() { + FluentAccount account = new FluentAccount(); + account.name("Fluent Account"); + account.balance(BigDecimal.TEN); + + assertEquals(BigDecimal.TEN, account.balance()); + assertEquals("Fluent Account", account.name()); + } + + @Test + public void givenChainedAccount_thenUseChainedAccessors() { + ChainedAccount account = new ChainedAccount(); + account.setName("Chained Account").setBalance(BigDecimal.TEN); + + assertEquals(BigDecimal.TEN, account.getBalance()); + assertEquals("Chained Account", account.getName()); + } + + @Test + public void givenChainedFluentAccount_thenUseChainedFluentAccessors() { + ChainedFluentAccount account = new ChainedFluentAccount() + .name("Fluent Account") + .balance(BigDecimal.TEN); + + assertEquals(BigDecimal.TEN, account.balance()); + assertEquals("Fluent Account", account.name()); + } + + @Test + public void givenPrefixedAccount_thenRemovePrefixFromAccessors() { + PrefixedAccount account = new PrefixedAccount(); + account.setName("Prefixed Fields"); + account.setBalance(BigDecimal.TEN); + + assertEquals(BigDecimal.TEN, account.getBalance()); + assertEquals("Prefixed Fields", account.getName()); + } + + @Test + public void givenPrefixedFluentAccount_thenRemovePrefixFromAccessors() { + PrefixedFluentAccount account = new PrefixedFluentAccount(); + account + .name("Prefixed Fluent Fields") + .balance(BigDecimal.TEN); + + assertEquals(BigDecimal.TEN, account.balance()); + assertEquals("Prefixed Fluent Fields", account.name()); + } + +} From 790642634eddb734d073bf81fb1f04ca133133c1 Mon Sep 17 00:00:00 2001 From: Roger Yates Date: Wed, 6 Nov 2019 06:22:50 +1000 Subject: [PATCH 2/5] BAEL-3475 - Updated lombok.version to latest --- lombok/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/lombok/pom.xml b/lombok/pom.xml index b67320909e..b93780c9cf 100644 --- a/lombok/pom.xml +++ b/lombok/pom.xml @@ -77,6 +77,7 @@ 1.18.10 + 1.0.0.Final From f855f08f38368fb58214971bcb597284cc8f26f9 Mon Sep 17 00:00:00 2001 From: Roger Yates Date: Wed, 6 Nov 2019 06:44:10 +1000 Subject: [PATCH 3/5] BAEL-3475 - Rename Test to UnitTest --- .../lombok/accessors/AccessorsTest.java | 72 ------------------- 1 file changed, 72 deletions(-) delete mode 100644 lombok/src/test/java/com/baeldung/lombok/accessors/AccessorsTest.java diff --git a/lombok/src/test/java/com/baeldung/lombok/accessors/AccessorsTest.java b/lombok/src/test/java/com/baeldung/lombok/accessors/AccessorsTest.java deleted file mode 100644 index b3d9cb16f6..0000000000 --- a/lombok/src/test/java/com/baeldung/lombok/accessors/AccessorsTest.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.baeldung.lombok.accessors; - -import com.baeldung.lombok.accessors.model.*; -import org.junit.Test; - -import java.math.BigDecimal; - -import static org.junit.Assert.assertEquals; - -public class AccessorsTest { - - @Test - public void givenBasicAccount_thenUseBasicAccessors() { - BasicAccount account = new BasicAccount(); - account.setBalance(BigDecimal.TEN); - account.setName("Basic Accessors"); - - assertEquals(BigDecimal.TEN, account.getBalance()); - assertEquals("Basic Accessors", account.getName()); - } - - @Test - public void givenFluentAccount_thenUseFluentAccessors() { - FluentAccount account = new FluentAccount(); - account.name("Fluent Account"); - account.balance(BigDecimal.TEN); - - assertEquals(BigDecimal.TEN, account.balance()); - assertEquals("Fluent Account", account.name()); - } - - @Test - public void givenChainedAccount_thenUseChainedAccessors() { - ChainedAccount account = new ChainedAccount(); - account.setName("Chained Account").setBalance(BigDecimal.TEN); - - assertEquals(BigDecimal.TEN, account.getBalance()); - assertEquals("Chained Account", account.getName()); - } - - @Test - public void givenChainedFluentAccount_thenUseChainedFluentAccessors() { - ChainedFluentAccount account = new ChainedFluentAccount() - .name("Fluent Account") - .balance(BigDecimal.TEN); - - assertEquals(BigDecimal.TEN, account.balance()); - assertEquals("Fluent Account", account.name()); - } - - @Test - public void givenPrefixedAccount_thenRemovePrefixFromAccessors() { - PrefixedAccount account = new PrefixedAccount(); - account.setName("Prefixed Fields"); - account.setBalance(BigDecimal.TEN); - - assertEquals(BigDecimal.TEN, account.getBalance()); - assertEquals("Prefixed Fields", account.getName()); - } - - @Test - public void givenPrefixedFluentAccount_thenRemovePrefixFromAccessors() { - PrefixedFluentAccount account = new PrefixedFluentAccount(); - account - .name("Prefixed Fluent Fields") - .balance(BigDecimal.TEN); - - assertEquals(BigDecimal.TEN, account.balance()); - assertEquals("Prefixed Fluent Fields", account.name()); - } - -} From 2d657873645db4be4810bf58cd54ae0875875740 Mon Sep 17 00:00:00 2001 From: Roger Yates <587230+rojyates@users.noreply.github.com> Date: Sun, 10 Nov 2019 22:57:34 +1000 Subject: [PATCH 4/5] BAEL-3475 - Add prefix with trailing _, make fields private, and update delombok version --- lombok/pom.xml | 2 +- .../lombok/accessors/model/BasicAccount.java | 4 ++-- .../lombok/accessors/model/ChainedAccount.java | 4 ++-- .../accessors/model/ChainedFluentAccount.java | 4 ++-- .../lombok/accessors/model/FluentAccount.java | 4 ++-- .../lombok/accessors/model/PrefixedAccount.java | 8 ++++++-- .../accessors/model/PrefixedFluentAccount.java | 4 ++-- .../lombok/accessors/model/StandardAccount.java | 4 ++-- .../lombok/accessors/AccessorsUnitTest.java | 16 +++++++++------- 9 files changed, 28 insertions(+), 22 deletions(-) diff --git a/lombok/pom.xml b/lombok/pom.xml index b93780c9cf..5e2ad33f66 100644 --- a/lombok/pom.xml +++ b/lombok/pom.xml @@ -81,7 +81,7 @@ 1.0.0.Final - 1.18.4.0 + 1.18.10.0 3.8.0 diff --git a/lombok/src/main/java/com/baeldung/lombok/accessors/model/BasicAccount.java b/lombok/src/main/java/com/baeldung/lombok/accessors/model/BasicAccount.java index 74ae51c040..a9332735c7 100644 --- a/lombok/src/main/java/com/baeldung/lombok/accessors/model/BasicAccount.java +++ b/lombok/src/main/java/com/baeldung/lombok/accessors/model/BasicAccount.java @@ -3,8 +3,8 @@ package com.baeldung.lombok.accessors.model; import java.math.BigDecimal; public class BasicAccount { - String name; - BigDecimal balance; + private String name; + private BigDecimal balance; public BigDecimal getBalance() { return this.balance; diff --git a/lombok/src/main/java/com/baeldung/lombok/accessors/model/ChainedAccount.java b/lombok/src/main/java/com/baeldung/lombok/accessors/model/ChainedAccount.java index 8fa9a2e8aa..0437d8f60e 100644 --- a/lombok/src/main/java/com/baeldung/lombok/accessors/model/ChainedAccount.java +++ b/lombok/src/main/java/com/baeldung/lombok/accessors/model/ChainedAccount.java @@ -10,6 +10,6 @@ import java.math.BigDecimal; @Getter @Setter public class ChainedAccount { - String name; - BigDecimal balance; + private String name; + private BigDecimal balance; } diff --git a/lombok/src/main/java/com/baeldung/lombok/accessors/model/ChainedFluentAccount.java b/lombok/src/main/java/com/baeldung/lombok/accessors/model/ChainedFluentAccount.java index 22e85848bd..6ebc080c94 100644 --- a/lombok/src/main/java/com/baeldung/lombok/accessors/model/ChainedFluentAccount.java +++ b/lombok/src/main/java/com/baeldung/lombok/accessors/model/ChainedFluentAccount.java @@ -10,6 +10,6 @@ import java.math.BigDecimal; @Getter @Setter public class ChainedFluentAccount { - String name; - BigDecimal balance; + private String name; + private BigDecimal balance; } diff --git a/lombok/src/main/java/com/baeldung/lombok/accessors/model/FluentAccount.java b/lombok/src/main/java/com/baeldung/lombok/accessors/model/FluentAccount.java index bc5e6ba70e..4c2e1f7976 100644 --- a/lombok/src/main/java/com/baeldung/lombok/accessors/model/FluentAccount.java +++ b/lombok/src/main/java/com/baeldung/lombok/accessors/model/FluentAccount.java @@ -10,6 +10,6 @@ import java.math.BigDecimal; @Getter @Setter public class FluentAccount { - String name; - BigDecimal balance; + private String name; + private BigDecimal balance; } diff --git a/lombok/src/main/java/com/baeldung/lombok/accessors/model/PrefixedAccount.java b/lombok/src/main/java/com/baeldung/lombok/accessors/model/PrefixedAccount.java index e3e3ae620b..506d7adc75 100644 --- a/lombok/src/main/java/com/baeldung/lombok/accessors/model/PrefixedAccount.java +++ b/lombok/src/main/java/com/baeldung/lombok/accessors/model/PrefixedAccount.java @@ -11,6 +11,10 @@ import java.math.BigDecimal; @Getter @Setter public class PrefixedAccount { - String sName; - BigDecimal bdBalance; + private String sName; + private BigDecimal bdBalance; + + @Accessors(prefix = "s_") + private String s_notes; + } diff --git a/lombok/src/main/java/com/baeldung/lombok/accessors/model/PrefixedFluentAccount.java b/lombok/src/main/java/com/baeldung/lombok/accessors/model/PrefixedFluentAccount.java index 462a9b41ec..eb23bf58e2 100644 --- a/lombok/src/main/java/com/baeldung/lombok/accessors/model/PrefixedFluentAccount.java +++ b/lombok/src/main/java/com/baeldung/lombok/accessors/model/PrefixedFluentAccount.java @@ -10,6 +10,6 @@ import java.math.BigDecimal; @Getter @Setter public class PrefixedFluentAccount { - String sName; - BigDecimal bdBalance; + private String sName; + private BigDecimal bdBalance; } diff --git a/lombok/src/main/java/com/baeldung/lombok/accessors/model/StandardAccount.java b/lombok/src/main/java/com/baeldung/lombok/accessors/model/StandardAccount.java index 89727fef19..4d0d578a4d 100644 --- a/lombok/src/main/java/com/baeldung/lombok/accessors/model/StandardAccount.java +++ b/lombok/src/main/java/com/baeldung/lombok/accessors/model/StandardAccount.java @@ -8,6 +8,6 @@ import java.math.BigDecimal; @Getter @Setter public class StandardAccount { - String name; - BigDecimal balance; + private String name; + private BigDecimal balance; } diff --git a/lombok/src/test/java/com/baeldung/lombok/accessors/AccessorsUnitTest.java b/lombok/src/test/java/com/baeldung/lombok/accessors/AccessorsUnitTest.java index 679c7d39ef..04f38bfc32 100644 --- a/lombok/src/test/java/com/baeldung/lombok/accessors/AccessorsUnitTest.java +++ b/lombok/src/test/java/com/baeldung/lombok/accessors/AccessorsUnitTest.java @@ -12,11 +12,11 @@ public class AccessorsUnitTest { @Test public void givenBasicAccount_thenUseBasicAccessors() { BasicAccount account = new BasicAccount(); - account.setBalance(BigDecimal.TEN); account.setName("Basic Accessors"); + account.setBalance(BigDecimal.TEN); - assertEquals(BigDecimal.TEN, account.getBalance()); assertEquals("Basic Accessors", account.getName()); + assertEquals(BigDecimal.TEN, account.getBalance()); } @Test @@ -25,8 +25,8 @@ public class AccessorsUnitTest { account.name("Fluent Account"); account.balance(BigDecimal.TEN); - assertEquals(BigDecimal.TEN, account.balance()); assertEquals("Fluent Account", account.name()); + assertEquals(BigDecimal.TEN, account.balance()); } @Test @@ -34,8 +34,8 @@ public class AccessorsUnitTest { ChainedAccount account = new ChainedAccount(); account.setName("Chained Account").setBalance(BigDecimal.TEN); - assertEquals(BigDecimal.TEN, account.getBalance()); assertEquals("Chained Account", account.getName()); + assertEquals(BigDecimal.TEN, account.getBalance()); } @Test @@ -44,8 +44,8 @@ public class AccessorsUnitTest { .name("Fluent Account") .balance(BigDecimal.TEN); - assertEquals(BigDecimal.TEN, account.balance()); assertEquals("Fluent Account", account.name()); + assertEquals(BigDecimal.TEN, account.balance()); } @Test @@ -53,9 +53,11 @@ public class AccessorsUnitTest { PrefixedAccount account = new PrefixedAccount(); account.setName("Prefixed Fields"); account.setBalance(BigDecimal.TEN); + account.setNotes("Notes"); - assertEquals(BigDecimal.TEN, account.getBalance()); assertEquals("Prefixed Fields", account.getName()); + assertEquals(BigDecimal.TEN, account.getBalance()); + assertEquals("Notes", account.getNotes()); } @Test @@ -65,8 +67,8 @@ public class AccessorsUnitTest { .name("Prefixed Fluent Fields") .balance(BigDecimal.TEN); - assertEquals(BigDecimal.TEN, account.balance()); assertEquals("Prefixed Fluent Fields", account.name()); + assertEquals(BigDecimal.TEN, account.balance()); } } From 4816809ded92d90647c1556fda316dbbb597cab1 Mon Sep 17 00:00:00 2001 From: Roger Yates <587230+rojyates@users.noreply.github.com> Date: Sun, 8 Dec 2019 22:45:47 +1000 Subject: [PATCH 5/5] BAEL-3515 proxy and security settings examples --- maven-all/maven/proxy/settings.xml | 43 +++++++++++++++++++ .../security/redirect/settings-security.xml | 6 +++ .../maven/security/settings-security.xml | 7 +++ 3 files changed, 56 insertions(+) create mode 100644 maven-all/maven/proxy/settings.xml create mode 100644 maven-all/maven/security/redirect/settings-security.xml create mode 100644 maven-all/maven/security/settings-security.xml diff --git a/maven-all/maven/proxy/settings.xml b/maven-all/maven/proxy/settings.xml new file mode 100644 index 0000000000..55a850a6bc --- /dev/null +++ b/maven-all/maven/proxy/settings.xml @@ -0,0 +1,43 @@ + + + + + + + BaeldungProxy_Encrypted + true + http + proxy.baeldung.com + 80 + baeldung + {U2iMf+7aJXQHRquuQq6MX+n7GOeh97zB9/4e7kkEQYs=} + internal.baeldung.com|localhost|127.*|[::1] + + + + BaeldungProxy_Authenticated + true + http + proxy.baeldung.com + 80 + baeldung + changeme + internal.baeldung.com|localhost|127.*|[::1] + + + + BaeldungProxy + proxy.baeldung.com + 80 + internal.baeldung.com|localhost|127.*|[::1] + + + + + \ No newline at end of file diff --git a/maven-all/maven/security/redirect/settings-security.xml b/maven-all/maven/security/redirect/settings-security.xml new file mode 100644 index 0000000000..37e91bd1a4 --- /dev/null +++ b/maven-all/maven/security/redirect/settings-security.xml @@ -0,0 +1,6 @@ + + + R:\config\settings-security.xml + diff --git a/maven-all/maven/security/settings-security.xml b/maven-all/maven/security/settings-security.xml new file mode 100644 index 0000000000..3ac258e8a5 --- /dev/null +++ b/maven-all/maven/security/settings-security.xml @@ -0,0 +1,7 @@ + + + {QFMlh/6WjF8H9po9UD\}0Nv18e527jqWb6mUgIB798n4=} +