746 Commits

Author SHA1 Message Date
Loredana Crusoveanu
d3fbb4d650 new formatter 2023-08-14 11:57:46 +03:00
Loredana Crusoveanu
cfeb61c929 old formatter 2023-08-14 11:55:03 +03:00
Loredana Crusoveanu
b9157ea900 with old formatter 2023-08-14 11:50:04 +03:00
Loredana Crusoveanu
cc012c9c47 test formatter 2023-08-11 20:41:34 +03:00
Loredana Crusoveanu
db65a7002b comment suanshu library - see JAVA-24004 2023-08-05 21:24:21 +03:00
Loredana Crusoveanu
ff42782e3b comment suanshu library - see JAVA-24004 2023-08-05 21:15:55 +03:00
Tapan Avasthi
938b6a4ee2 BAEL-6831: Convert an int[] Array to HashSet in Java (#14525)
Co-authored-by: Tapan Avasthi <tavasthi@Tapans-MacBook-Air.local>
2023-08-05 08:44:19 -05:00
Eugene Kovko
58dcdf8af4 BAEL-6651: Embeddable Records in Hibernate 6 (#14516)
* BAEL-6651: Bumped Spring Boot version

* BAEL-6651: Replaced flaky test

* BAEL-6651: Embeddable example with tests
2023-08-04 19:39:09 +02:00
Josiah Noel
198dff7bed Add Example Code (#14521) 2023-08-04 11:54:26 +02:00
Vini
2ea5d3f9f9 Merge pull request #14526 from vunamtien/BAEL-6541-convert-relative-path-2
BAEL-6541-convert-relative-path-2
2023-08-04 10:53:52 +02:00
Loredana Crusoveanu
42e661f005 Merge pull request #14531 from eugenp/lor6-patch-1
Update CertificatesUnitTest.java
2023-08-04 11:12:48 +03:00
Loredana Crusoveanu
7851382f77 Update CertificatesUnitTest.java 2023-08-04 10:42:58 +03:00
victorsempere
0f9550b4e3 Feature/BAEL-5575 (#14350)
* BAEL-5575

First commit of the example for the article:
https://drafts.baeldung.com/wp-admin/post.php?post=153774&action=edit

* BAEL-5575

Adjusted pom.xml

* BAEL-5575

Formatted source code

* BAEL-5575

Removed unused import

* BAEL-5575

Renamed UT to follow: https://docs.google.com/document/d/1iIeSPuYFG-jEtB8UbcxQnn2AI3OR2LWlnisNo2NUCL8/edit

* BAEL-5575

Modified pom.xml to define versions in  properties  as stated in:
https://docs.google.com/document/d/1iIeSPuYFG-jEtB8UbcxQnn2AI3OR2LWlnisNo2NUCL8/edit

* BAEL-5575

Changes checking the commands:
* mvn clean install
* mvn clean install -Dgib.enabled=false

* BAEL-5575

Set GB as the base language

* BAEL-5575

Removed explicit references to jakarta in pom.xml
Reduced code to instanciate Thymeleaf engine

* BAEL-5575

Adjusting parent artifactId
2023-08-03 14:45:32 +02:00
tienvn
8f27b58aa7 BAEL-6541-convert-relative-path 2023-08-03 17:59:49 +07:00
neha298
645169a951 Spring Boot with Apache Pulsar (#14341)
* Add dead-letter configuration with code refactor

* Add String consumer

* Add customizers in message producers

* Reindent PulsarConsumer.java

* Reindent PulsarProducer.java

* Reindent pom.xml and remove readme

* Update log in PulsarConsumer

* Re-indent main class and remove test directory
2023-08-02 20:21:15 +01:00
Loredana Crusoveanu
2a323d310a Merge pull request #14522 from edizor/master
Update README
2023-08-02 21:23:01 +03:00
MohamedHelmyKassab
b003cd198b This commit is for the article BAEL-6788 (#14513)
This commit aims to add a test class (MultiValueHashMapTest) to test the HashMap that allows multiple values to be associated with the same key
2023-08-02 19:47:45 +02:00
Mo Helmy
122c663999 This commit is for the article BAEL-6792 (#14512)
This commit aims to add a test class namely (StringToMapUnitTest) that tests the conversion of string and string array into map.
2023-08-02 19:42:36 +02:00
edizor
38bb93bfef Update README.md
[skip ci]
2023-08-02 21:51:38 +08:00
edizor
f856c47677 Update README.md
[skip ci]
2023-08-02 21:47:51 +08:00
edizor
36f4bdb503 Update README.md
[skip ci]
2023-08-02 21:43:06 +08:00
edizor
71b8229974 Create README.md
[skip ci]
2023-08-02 21:37:54 +08:00
edizor
75fa5bf710 Update README.md
[skip ci]
2023-08-02 21:30:25 +08:00
edizor
6abc60ee2d Update README.md
[skip ci]
2023-08-02 21:27:38 +08:00
edizor
447488b94c Update README.md
[skip ci]
2023-08-02 21:22:56 +08:00
edizor
fea89b6ea6 Create README.md
[skip ci]
2023-08-02 21:16:59 +08:00
edizor
3473531036 Update README.md
[skip ci]
2023-08-02 21:13:10 +08:00
edizor
0bcffff6cf Create README.md
[skip ci]
2023-08-02 21:05:45 +08:00
edizor
97ec191686 Update README.md
[skip ci]
2023-08-02 21:02:48 +08:00
edizor
6b0f219810 Update README.md
[skip ci]
2023-08-02 20:56:47 +08:00
edizor
62f0ba4d62 Update README.md
[skip ci]
2023-08-02 20:54:52 +08:00
edizor
f75ef9e0f5 Update README.md
[skip ci]
2023-08-02 20:51:10 +08:00
edizor
152db7dbe8 Update README.md
[skip ci]
2023-08-02 20:47:25 +08:00
edizor
438019a37a Update README.md
[skip ci]
2023-08-02 20:41:09 +08:00
edizor
3d697dce87 Update README.md
[skip ci]
2023-08-02 20:37:55 +08:00
anuragkumawat
68167f73c0 JAVA-18523 Upgrade cas module and related articles (#14504)
* JAVA-18523 Upgrade cas module and related articles

* JAVA-18523 Remove deprecated  WebSecurityConfigurerAdapter
2023-08-02 11:00:48 +05:30
timis1
3fb58d5683 JAVA-23392 Adding some more example for differences between Scanner n… (#14491)
* JAVA-23392 Adding some more example for differences between Scanner next() vs nextLine()

* Update NextVsNextLineUnitTest.java

---------

Co-authored-by: timis1 <noreplay@yahoo.com>
Co-authored-by: Dhawal Kapil <dhawalkapil@gmail.com>
2023-08-01 20:44:56 +05:30
parthiv39731
4401a6c258 BAEL-6841 (#14502)
Improvement article - "Check if a String Has All Unique Characters in Java"
2023-08-01 11:52:01 +02:00
Bipin kumar
136ba8a382 JAVA-22440_01: changes made for reverting the ejb-beans (#14509) 2023-08-01 10:03:07 +05:30
Pedro Lopes
e2df834665 BAEL-6406 - Understanding Kafka Topics and Partitions (#14324)
* consumer config. topic config. driver and calculator classes.

* basic app working. test structure

* final version

* wraping up

* optimizing imports
2023-07-31 21:01:26 -06:00
ovidiumihaitacu
bfc63c6eeb [BAEL-6750] - Jackson Polymorphic Deserialization and SubTypes registration using Reflection API (#14503)
* [BAEL-6750] - Jackson Polymorphic Deserialization and SubTypes registration using Reflection API

* Renamed test files

---------

Co-authored-by: ovidiu-mihai98 <57233636+ovidiu-mihai98@users.noreply.github.com>
2023-07-31 19:19:16 +02:00
sachin
17d9cc854e BAEL-4895 brokenpipe error (#14346)
Co-authored-by: Sachin kumar <sachin.n.kumar@oracle.com>
2023-07-31 12:15:49 -05:00
Ulisses Lima
adf98d4597 BAEL-4165 - Custom DLL Load - Fixing the "java.lang.UnsatisfiedLinkError" Error (#14393)
* first draft

* review 1

* review 1 - test setup
2023-07-31 17:57:13 +02:00
davidmartinezbarua
ce6219a626 Merge pull request #14481 from sam-gardner/BAEL-6611-completablefuturevsfuturevsrxjava
BAEL-6611 add example code for completablefuture vs future vs rxjava …
2023-07-31 12:48:33 -03:00
Kai Yuan
f2192bfbcf How to Modify a Key in a HashMap? (#14496) 2023-07-30 23:02:18 -05:00
Michael Olayemi
a70a5e0cbc Splitting a string into two halfs (#14500) 2023-07-31 07:01:30 +05:30
Michael Olayemi
d38bf7c256 How to Get the Start and the End Date of a Year using Java (#14493)
* How to Get the Start and the End Date of a Year using Java

* How to Get the Start and the End Date of a Year using Java

* How to Get the Start and the End Date of a Year using Java
2023-07-30 10:12:23 +05:30
Kasra Madadipouya
4c4dc15cfe Merge pull request #14486 from Bipinkumar27/JAVA-22440
JAVA-22440: Changes made for adding Add missing submodule in respecti…
2023-07-28 21:47:30 +02:00
Dhawal Kapil
35c0b1b0f7 JAVA-18812 Disabled reuse forks option that was causing issue with SimpleTracer test (#14490) 2023-07-28 20:56:56 +03:00
vunamtien
c99aead112 BAEL-5644-escape-html-java (#14492) 2023-07-28 16:44:51 +02:00
Bipinkumar27
cae0390356 JAVA-22440: Changes made for adding Add missing submodule in respective container modules 2023-07-28 17:42:19 +05:30
lucaCambi77
412374ed48 Docker Compose Support in Spring Boot 3 [ BAEL-6648 ] (#14394)
* feat: spring boot docker compose support

* fix: add actuator

* fix: indent

* fix: remove optional

* fix: remove mongodb config

* fix: add non docker-compose profile

---------

Co-authored-by: Eric Martin <emart.tigers@gmail.com>
2023-07-27 21:51:14 -05:00
timis1
4bb9fa006d JAVA-23344 Fix failing tests in hibernate-annotations (#14468) 2023-07-27 19:27:17 +03:00
timis1
5a5c71e66f JAVA-20287 Update article "Spring Cloud Azure Key Vault" (#14488)
* JAVA-20287 Update article "Spring Cloud Azure Key Vault"

* Comment the spring-cloud-azure

---------

Co-authored-by: timis1 <noreplay@yahoo.com>
2023-07-27 21:20:14 +05:30
Sam
336a15050f Scroll API Implementation (#14435)
Co-authored-by: technoddy <mail.technoddy@gmail.com>
2023-07-27 12:00:54 +02:00
Balamurugan
17e56bbce7 BAEL-6584: Added spring data reactive pagination along with tests (#14478)
* BAEL-6584: Added spring data reactive pagination along with tests

* BAEL-6584: removed unnecessary spaces

---------

Co-authored-by: balasr3 <balamurugan.radhakrishnan@imgarena.com>
2023-07-27 11:57:06 +02:00
hitansh-shah98
a1d50fe4a1 BAEL-6674 Added code for mybatis sqlscript (#14487) 2023-07-27 11:53:29 +02:00
Graham Cox
0c25f7828b BAEL-5847: Property-Based Testing with jqwik (#14489) 2023-07-27 10:53:04 +02:00
Vini
9f4d417e13 Merge pull request #14232 from vunamtien/BAEL-6541-convert-relative-path
BAEL-6541-convert-relative-path
2023-07-27 09:29:08 +02:00
Kasra Madadipouya
3f816482eb Merge pull request #14456 from anuragkumawat/JAVA-18117
JAVA-18117 Update spring-boot-keycloak-adapters module
2023-07-26 20:23:45 +02:00
Bipinkumar27
e7c6c16715 JAVA-22440: Changes made for adding Add missing submodule in respective container modules 2023-07-26 21:35:26 +05:30
Thiago dos Santos Hora
cf3fc67a2b [BAEL-4897] Shardingshere (#14470)
* [BAEL-4897] Shardingshere

* [BAEL-4897] Fixes

* [BAEL-4897] delete read me
2023-07-26 17:23:08 +02:00
Dhawal Kapil
f4fdcdcede JAVA-23379 Fixed test as per JDK 17 (#14484)
* JAVA-23379 Fixed test as per JDK 17

* JAVA-23379 Made SimpleDateFormat local specific
2023-07-26 15:33:04 +05:30
Loredana Crusoveanu
a089d27d7e Merge pull request #14485 from edizor/master
Update README
2023-07-26 12:59:40 +03:00
ACHRAF TAITAI
467610c664 BAEL-6713: Convert List<Long> Object to long[] Array in Java (#14479) 2023-07-26 11:17:26 +02:00
edizor
3e6713abd7 Update README.md
[skip ci]
2023-07-26 16:14:40 +08:00
edizor
8a9dd4ba6e Update README.md
[skip ci]
2023-07-26 16:07:48 +08:00
edizor
c2b3a9ae79 Update README.md
[skip ci]
2023-07-26 16:03:39 +08:00
edizor
0e2dd287bd Update README.md
[skip ci]
2023-07-26 16:03:06 +08:00
edizor
6569083afe Update README.md
[skip ci]
2023-07-26 16:00:14 +08:00
edizor
2b9e37abb0 Update README.md
[skip ci]
2023-07-26 15:56:55 +08:00
edizor
442d703014 Update README.md
[skip ci]
2023-07-26 15:52:01 +08:00
edizor
eb26e722ff Update README.md
[skip ci]
2023-07-26 15:49:02 +08:00
edizor
ea680399fd Update README.md
[skip ci]
2023-07-26 15:45:36 +08:00
edizor
e692f20f40 Update README.md
[skip ci]
2023-07-26 15:40:25 +08:00
edizor
c99f218e7c Create README.md
[skip ci]
2023-07-26 15:34:16 +08:00
Michael Olayemi
2dfd837ab2 Law of Demeter in Java (#14465)
* Law of Demeter in Java

* Law of Demeter in Java

* Law of Demeter in Java
2023-07-26 10:55:09 +05:30
Sam Gardner
f4986c6dec BAEL-6611 add example code for completablefuture vs future vs rxjava comparison 2023-07-25 14:05:05 +01:00
timis1
dcafed7d53 JAVA-23211 Upgrade dependencies versions for helidon-mp module (#14472)
Co-authored-by: timis1 <noreplay@yahoo.com>
2023-07-25 13:02:08 +05:30
panos-kakos
b1aa6721c2 [JAVA-23091] Upgraded esapi version and removed it form main pom.xml (#14384)
Co-authored-by: Dhawal Kapil <dhawalkapil@gmail.com>
2023-07-25 12:59:21 +05:30
Bipin kumar
95e5db14a0 JAVA-22625: Changes made for formatting the pom.xml (#14327)
* JAVA-22625: Changes made for formatting the pom.xml

* JAVA-22625: Changes made for formatting the pom.xml

* JAVA-22625: commenting module

* JAVA-22625: commenting module
2023-07-25 12:04:39 +05:30
panos-kakos
c194dc54c5 [JAVA-23092] Upgrade jmh-core and jmh-generator dependencies to 1.36 (#14387)
* [JAVA-23092] Upgrade jmh-core and jmh-generator dependencies to 1.36

* [JAVA-23091] Clean up
2023-07-25 11:50:47 +05:30
davidmartinezbarua
949394c33a Merge pull request #14373 from ukhan1980/BAEL-6697-fail-maven-build-if-coverage-falls
[BAEL-6697] code for jacoco fail build
2023-07-24 19:16:29 -03:00
Loredana Crusoveanu
35f1cf3475 Merge pull request #14471 from collaboratewithakash/master
backlink added
2023-07-24 13:50:04 +03:00
collaboratewithakash
4e3917fd56 backlink added 2023-07-24 14:59:53 +05:30
Vali Tuguran
ca952b8b87 BAEL-6225 Refactor code and move package. (#14132)
* BAEL-6225 Refactor code and move package.

* BAEL-6225 Move code to core-java-lang-oop-patterns.

* BAEL-6225 Refactor test name.

* BAEL-6225 Refactor test name.

* BAEL-6225 Update with singleton instances.
2023-07-24 08:47:07 +01:00
psevestre
0a8aa94d8a [BAEL-6138] - Receiving Push Notifications in PostreSQL with Spring Integration (#14467)
* [BAEL-4849] Article code

* [BAEL-4968] Article code

* [BAEL-4968] Article code

* [BAEL-4968] Article code

* [BAEL-4968] Remove extra comments

* [BAEL-5258] Article Code

* [BAEL-2765] PKCE Support for Secret Clients

* [BAEL-5698] Article code

* [BAEL-5698] Article code

* [BAEL-5905] Initial code

* [BAEL-5905] Article code

* [BAEL-5905] Relocate article code to new module

* [BAEL-6275] PostgreSQL NOTIFY/LISTEN

* [BAEL-6275] Minor correction

* BAEL-6138

* [BAEL-6138] WIP - LiveTest

* [BAEL-6138] Tutorial Code

* [BAEL-6138] Tutorial Code

---------

Co-authored-by: Philippe Sevestre <psevestre@gmail.com>
2023-07-23 22:45:57 +02:00
parthiv39731
f72192762c BAEL-6710 (#14454)
Changed method names
2023-07-23 19:50:50 +02:00
Tetiana
27644df711 BAEL-6754 Parameterized Logging with Slf4j (#14447)
- updated logback-classic version
- updated logback.xml to have only one appender for new classes
- added sample parameterized logging and fluent logging
2023-07-23 19:16:50 +02:00
Rajat Garg
3e58e24219 [BAEL-6494] Add functionality to minify a JSON string (#14451)
* [BAEL-6494] Add functionality to minify JSON

* [BAEL-6494] Address review comment

---------

Co-authored-by: rajatgarg <rajatgarg@adobe.com>
2023-07-23 10:08:21 +02:00
Manfred
37f883a58f BAEL-6725 - Performance Comparison Between Different Java String Concatenation Methods (#14458) 2023-07-23 10:04:32 +02:00
Ana Peterlić
be2a4d3bf5 BAEL-6585 - Unit Testing of System.in with JUnit (#14436)
* BAEL-6585 - Unit Testing of System.in with JUnit

* Rename test classes

* Remane test classes
2023-07-23 09:19:16 +05:30
Dhawal Kapil
fdfa6c282f Update README.md (#14461) 2023-07-23 00:03:33 +05:30
Dhawal Kapil
253a4c3aaa Update README.md (#14460)
* Update README.md

* Update README.md
2023-07-22 23:53:49 +05:30
timis1
94cc312bbf JAVA-23235 Split or move spring-cloud-openfeign module (conti-4) (moved-8) (#14450)
Co-authored-by: timis1 <noreplay@yahoo.com>
2023-07-22 23:35:37 +05:30
davidmartinezbarua
0f988a7bbe Merge pull request #14347 from ukhan1980/BAEL-6318-consuming-paged-response-via-rest-template
[BAEL-6318] code for consuming Page<Entity> using rest template
2023-07-22 10:32:45 -03:00
davidmartinezbarua
6d9b8e2fb4 Merge pull request #14404 from sam-gardner/BAEL-6721-example-code-for-notification-of-a-complete-task
BAEL-6721 Add example code for notification of a complete task
2023-07-22 10:26:28 -03:00
davidmartinezbarua
099802fdb2 Merge pull request #14415 from etrandafir93/features/BAEL-6578-CompletableFuture_allOf_vs_join
BAEL-6578: CompletableFuture allOf.join() vs join()
2023-07-22 10:19:55 -03:00
Gaetano Piazzolla
ebfee879e7 JAVA-23317 | Added dummy TrustManager (#14444)
* JAVA-23317 | Added dummy TrustManager

* JAVA-23317 | Added comment

* JAVA-23317 | renamed dummy to mock

* JAVA-23317 | renamed unit test
2023-07-22 18:49:21 +05:30
anuragkumawat
263583972c JAVA-18117 Update spring-boot-keycloak-adapters module 2023-07-22 14:54:43 +05:30
Michael Olayemi
9080604c31 What is the maximum depth of the java call stack? (#14428)
* What is the maximum depth of the java call stack?

* What is the maximum depth of the java call stack?
2023-07-21 07:12:48 +05:30
Loredana Crusoveanu
e47ebfcd9e Merge pull request #14445 from collaboratewithakash/master
backlink  updated
2023-07-20 17:51:20 +03:00
timis1
ef05552325 JAVA-23118 Fix java-ee-8-security-api module (#14397)
* JAVA-23118 Fix java-ee-8-security-api module

* JAVA-23118 Additional changes

---------

Co-authored-by: timis1 <noreplay@yahoo.com>
2023-07-20 19:29:57 +05:30
Loredana Crusoveanu
a60356f8a3 Merge branch 'master' into master 2023-07-20 16:30:42 +03:00
collaboratewithakash
96f637211a backlinks removed 2023-07-20 16:44:33 +05:30
collaboratewithakash
6fc517c480 backlink removed 2023-07-20 16:42:50 +05:30
parthiv39731
df3f6097ef Update PersonSerializerUnitTest.java (#14441) 2023-07-19 22:47:15 +02:00
davidmartinezbarua
e1ee366539 Merge pull request #14431 from sam-gardner/BAEL-6749-improve-examples-for-handling-null-fields-with-jackson
BAEL-6749 improve examples for handling null fields with Jackson
2023-07-19 14:18:50 -03:00
Loredana Crusoveanu
9c8791f573 Merge pull request #14437 from edizor/master
Update README
2023-07-19 18:12:09 +03:00
Gaetano Piazzolla
d42b2f98bc JAVA-22042 | Removed cargo plugin in favor or mockserver. removed duplicated mockserver implementation (#14439) 2023-07-19 17:46:37 +05:30
panos-kakos
a7b5326737 [JAVA-22621] Clean up (#14433)
* [JAVA-22621] Clean up

* [JAVA-22621] Clean up
2023-07-19 17:43:21 +05:30
Dhawal Kapil
2745f176b5 Update README.md (#14438)
Cleaned up readme
2023-07-19 17:30:14 +05:30
edizor
f9cdc78c69 Update README.md
[skip ci]
2023-07-19 19:36:16 +08:00
edizor
34530afc0f Update README.md
[skip ci]
2023-07-19 19:35:36 +08:00
edizor
433a4bb023 Update README.md
[skip ci]
2023-07-19 19:22:09 +08:00
Bipin kumar
bb1cd17603 Java 23053 02 (#14432)
* JAVA-23053: renaming the module

* JAVA-23053: correction made for More articles links in  spring-thymeleaf
2023-07-19 16:49:19 +05:30
edizor
2cbc55ac52 Update README.md
[skip ci]
2023-07-19 19:11:45 +08:00
edizor
b14a9031c9 Update README.md
[skip ci]
2023-07-19 19:03:49 +08:00
edizor
336b89be17 Update README.md
[skip ci]
2023-07-19 16:22:36 +08:00
edizor
9d1011e15a Update README.md
[skip ci]
2023-07-19 16:17:52 +08:00
edizor
540e87abd2 Create README.md
[skip ci]
2023-07-19 16:11:28 +08:00
Vini
3da4812c8c Merge pull request #14405 from tudormarc/tudor/jacksonjr4
BAEL-6310 - updated indent
2023-07-19 09:07:50 +02:00
Loredana Crusoveanu
589f558e93 Merge pull request #14383 from timis1/JAVA-23082
JAVA-23082 Review log statements for projects - Week 16 - 2023 (moved…
2023-07-18 19:25:35 +03:00
Hamid Reza Sharifi
a7a2c28d6c #bael-3314-new:Update JMockit articles (#14355)
* #bael-3314-new:remove unused method

* #bael-3314-new:change private to protected
2023-07-18 18:21:58 +02:00
ACHRAF TAITAI
e8fa7ed602 BAEL-6054: Postman - send multi-part data and json in the same request (#14430) 2023-07-17 21:55:25 +02:00
emanueltrandafir1993
b5ef44d4d6 BAEL-6578: removed comments 2023-07-17 19:39:13 +02:00
Ehsan Sasanianno
52207c7786 fix failing tests in selenium-2 due to website change (#14422) 2023-07-17 21:27:08 +05:30
anuragkumawat
5b5899a1e6 JAVA-22316 Review the time of the build - Week 26 - 2023 (#14426) 2023-07-17 20:49:43 +05:30
Sam Gardner
0d0e39795c BAEL-6721 move code to concurrency basic folder 2023-07-17 15:57:24 +01:00
Sam Gardner
58e756824f BAEL-6749 improve examples for handling null fields with Jackson 2023-07-17 15:41:07 +01:00
uzma
eb6aa93709 [PV-6697] space after test 2023-07-17 14:19:08 +01:00
uzma
230aa7f5c8 [BAEL-6318] fix indentation 2023-07-17 14:02:35 +01:00
collaboratewithakash
9d89b1d494 backlink removed 2023-07-17 14:27:25 +05:30
Graham Cox
d2c4278a32 BAEL-6731: Introduction to JeroMQ (#14412) 2023-07-16 09:08:38 +02:00
emanuel.trandafir
4cce8653a5 BAEL-6578: CompletableFuture allOf.join() vs join() 2023-07-15 19:53:51 +02:00
Dhawal Kapil
0b18a9feda Update README.md (#14414) 2023-07-15 17:33:35 +05:30
Bipin kumar
218ffa120b JAVA-23053: Changes made for correcting the article tagging with right module (#14411) 2023-07-15 17:28:33 +05:30
Bipin kumar
0d26783f4b JAVA-23052: changes made for adding spring-abstract-routing-data-sour… (#14407)
* JAVA-23052: changes made for adding spring-abstract-routing-data-source in spring-boot-persistence-3

* JAVA-23052: changes made for removing spring-abstract-routing-data-source in spring-boot-persistence
2023-07-15 17:02:13 +05:30
timis1
3aab8be1cd JAVA-22211 Upgrade dependencies versions for helidon-se module (#14389)
* JAVA-22211 Upgrade dependencies versions for helidon-se module

* JAVA-22211 Add properties for each version

---------

Co-authored-by: timis1 <noreplay@yahoo.com>
2023-07-15 12:44:20 +05:30
Michael Olayemi
43faa3ff58 How to get active user's UserDetails with AuthenticationPrincipal (#14398) 2023-07-15 07:10:27 +05:30
Dhawal Kapil
1476484426 Delete core-java-modules/core-java-io-apis-3 directory (#14408) 2023-07-14 23:31:14 +05:30
Dhawal Kapil
a3b2d6412d Update README.md (#14409) 2023-07-14 23:25:39 +05:30
timis1
5142770066 JAVA-22516 Split or move core-java-io-apis-2 module (moved-1) (#14361)
* JAVA-22516 Split or move core-java-io-apis-2 module (moved-1)

* JAVA-22516 Adding back the file after fixing the conflicts

---------

Co-authored-by: timis1 <noreplay@yahoo.com>
2023-07-14 23:00:39 +05:30
Loredana Crusoveanu
88e25373b8 Merge pull request #14401 from edizor/master
Update README
2023-07-14 17:24:32 +03:00
tudor.marc
1c1639e1c8 BAEL-6310 - updated indent 2023-07-13 22:50:40 +03:00
parthiv39731
2edb3a33f5 BAEL-6710 (#14403)
Check If a String Has All Unique Characters in Java
2023-07-13 21:49:18 +02:00
Tetiana
a6dca28aea BAEL-6717 Convert One Enum to Another Enum in Java (#14400)
- added new module core-java-lang-6
- added data model and test for enums
2023-07-13 21:29:37 +02:00
Sam Gardner
923744bf61 BAEL-6721 Add example code for notification of a complete task 2023-07-13 19:07:35 +01:00
Rajat Garg
d8fd4e8435 Address review comments (#14396)
Co-authored-by: rajatgarg <rajatgarg@adobe.com>
2023-07-13 18:57:08 +02:00
Mikhail Polivakha
729850bec2 BAEL-6706 source code (#14395) 2023-07-13 18:45:41 +02:00
edizor
9f96e51f03 Create README.md
[skip ci]
2023-07-13 21:48:52 +08:00
edizor
8d389b248e Update README.md
[skip ci]
2023-07-13 21:46:09 +08:00
edizor
8317b87741 Update README.md
[skip ci]
2023-07-13 21:44:30 +08:00
edizor
965e34dd6b Create README.md
[skip ci]
2023-07-13 21:41:57 +08:00
edizor
f2a080fa6d Update README.md
[skip ci]
2023-07-13 21:39:06 +08:00
edizor
6083667f12 Create README.md
[skip ci]
2023-07-13 21:34:04 +08:00
edizor
d25e2c76a2 Update README.md
[skip ci]
2023-07-13 21:27:25 +08:00
edizor
e7a7b5065f Update README.md
[skip ci]
2023-07-13 20:29:08 +08:00
edizor
fb3e495748 Create README.md
[skip ci]
2023-07-13 20:22:32 +08:00
edizor
b4a8b84d1d Update README.md
[skip ci]
2023-07-13 20:12:10 +08:00
edizor
beb88e2a6d Update README.md
[skip ci]
2023-07-13 14:34:24 +08:00
edizor
a088cd8abe Update README.md
[skip ci]
2023-07-13 14:25:31 +08:00
edizor
2319db5d2c Update README.md
[skip ci]
2023-07-13 14:14:56 +08:00
edizor
b63e7afe0a Update README.md
[skip ci]
2023-07-13 14:06:49 +08:00
edizor
25abb24bdb Update README.md
[skip ci]
2023-07-13 14:01:58 +08:00
Michael Olayemi
aea9230ae9 Does Java read integers in little endian or big endian? (#14381)
* Does Java read integers in little endian or big endian?

* Does Java read integers in little endian or big endian?
2023-07-13 06:35:34 +05:30
Kasra Madadipouya
c25655c57e Merge pull request #14380 from timis1/JAVA-22515
JAVA-22515 Split or move spring-data-jpa-repo-2 module (moved-1)
2023-07-11 12:09:09 +02:00
MohamedHelmyKassab
8d8be8ca65 BAEL-6418 (#14311)
* BAEL-6418

This commit aims to add a test class for the article BAEL-6418

* Update IntegerClassIntegerTYPEIntClassUnitTest.java

* Update IntegerClassIntegerTYPEIntClassUnitTest.java

* Update IntegerClassIntegerTYPEIntClassUnitTest.java

* Update IntegerClassIntegerTYPEIntClassUnitTest.java
2023-07-11 07:52:58 +05:30
Rajat Garg
4d7d323ba0 [BAEL-6506] Add utility for Pretty-Print JSON (#14378)
* Add utility for  Pretty-Print JSON

* Remove accidental change

* Address review comments

* Address review comments

---------

Co-authored-by: rajatgarg <rajatgarg@adobe.com>
2023-07-10 20:47:36 +02:00
Dhawal Kapil
13b9ffce95 JAVA-22043 Fixed formatting (#14386) 2023-07-11 00:02:51 +05:30
Gaetano Piazzolla
044dca1905 JAVA-22043 | Fixing httpclient live test (#14352)
* JAVA-22043 | fixing httpclient live test

* JAVA-22043 | fixing httpclient live test using lambda expression for execution
2023-07-10 23:45:49 +05:30
Dhawal Kapil
f67ef3f84f JAVA-22611 Commented out java-ee security module (#14385) 2023-07-10 23:02:21 +05:30
Loredana Crusoveanu
7685e48cf2 Merge pull request #14376 from edizor/master
Update README.md
2023-07-10 20:14:42 +03:00
tienvn
201746172f edit unit test 2023-07-10 22:42:12 +07:00
Timon Back
8feecff48e BAEL-6529 springwolf (#14204)
* [BAEL-6529] Add spring boot springwolf article

Co-authored-by: David Müller <david.mueller@codecentric.de>

* [BAEL-6529] Remove README.md

Co-authored-by: David Müller <david.mueller@codecentric.de>

* Bael 6529 springwolf 0.12.0 (#2)

* [BAEL-6529] Bump springwolf-kafka to 0.12.0

Co-authored-by: David Müller <david.mueller@codecentric.de>

* [BAEL-6529] Bump springwolf-kafka to 0.12.1

Co-authored-by: David Müller <david.mueller@codecentric.de>

---------

Co-authored-by: David Müller <david.mueller@codecentric.de>
2023-07-10 20:57:56 +05:30
collaboratewithakash
a4cae6cc61 backlink updated 2023-07-10 16:48:24 +05:30
collaboratewithakash
8ecc164fa1 updated backlink 2023-07-10 16:47:21 +05:30
collaboratewithakash
898015910f backlink updated 2023-07-10 16:13:02 +05:30
timis1
407b22b4e1 JAVA-22210 Upgrade dependencies versions for spring-apache-camel module (#14359) 2023-07-10 11:56:36 +03:00
timis1
9b39c0ffaa JAVA-23082 Review log statements for projects - Week 16 - 2023 (moved-13) (conti-1) 2023-07-10 11:23:04 +03:00
Vini
326458d425 Merge pull request #14342 from azhwani/BAEL-6399
BAEL-6399: Getting Yesterday's Date in Java
2023-07-10 10:21:56 +02:00
Loredana Crusoveanu
c998a6ffd6 Merge pull request #14382 from ulisseslima/ulisseslima-patch-1
Update StringFilenameValidationUtils.java
2023-07-10 10:41:48 +03:00
Ulisses Lima
4be50c5110 Update StringFilenameValidationUtils.java
Based on email feedback. Changing regex from "A-z" to "A-Z".
2023-07-10 00:00:07 -03:00
Kasra Madadipouya
f22ef628d7 Merge pull request #14328 from panos-kakos/JAVA-14013
[JAVA-14013] Added example for LoggingSystem
2023-07-09 21:21:52 +02:00
Kasra Madadipouya
3ddde905ee Merge pull request #14323 from panos-kakos/JAVA-22589
Java 22589
2023-07-09 20:30:49 +02:00
Graham Cox
d7e519a8e8 BAEL-6696: Introduction to Selenide (#14379)
* BAEL-6210: Examples for RethinkDB article

* BAEL-6696: Introduction to Selenide
2023-07-09 19:18:15 +02:00
Saikat Chakraborty
0648a4b11c Setup PATCH method in the OpenFeign (#14304)
* Fix the integration tests which failed due to defined port

* Add open feign patch example

* refactor the feign code

* refactor the feign code

* refactor the feign code

* refactor the code

* remove space

* refactor code

* refactor code and set the user id for testing

* refactor code
2023-07-09 14:07:52 +01:00
timis1
976fcdb061 JAVA-21486 Split or move selenium-junit-testng module (moved-4) (#14366)
Co-authored-by: timis1 <noreplay@yahoo.com>
2023-07-09 17:26:19 +05:30
Kai Yuan
cbd86f2347 [long-to-bigdecimal] Convert Long to BigDecimal in Java (#14372)
* [long-to-bigdecimal] Convert Long to BigDecimal in Java

* [long-to-bigdecimal] renaming var
2023-07-08 22:30:44 -05:00
Manfred
e577b2cb78 BAEL-6670: Reading a JSP variable from JavaScript (#14337) 2023-07-09 08:54:38 +05:30
Michael Olayemi
4746fdc886 Generating Random Numbers in a Range with Some Exclusions in Java (#14357) 2023-07-09 08:37:06 +05:30
timis1
6d9ca58eb1 JAVA-22515 Split or move spring-data-jpa-repo-2 module (moved-1) 2023-07-08 22:06:30 +03:00
Michael Olayemi
701b8f8a05 How to Solve 403 Error in Spring Boot Post Request (#14303)
* How to Solve 403 Error in Spring Boot Post Request

* How to Solve 403 Error in Spring Boot Post Request
2023-07-08 19:20:38 +05:30
parthiv39731
2d8eb9d618 JIRA BAEL-6693, difference between Gson @Expose and @SerializedName (#14370)
Co-authored-by: parthiv39731 <parthiv39731@gmail.com>
2023-07-08 10:22:04 +02:00
Seremba Patrick
8749794f55 Difference Between @JoinColumn and @PrimaryKeyJoinColumn in JPA (#14171)
* primarykeyjoincolum annotaion in jpa

* indent Departmnet Person and primaryKeyJoinColumn

* indent Department Perspn and PrimaryKeyJoinColumnIntegrationTest classes

* format properly

* format to 2-space continuation identation

* Revert "format to 2-space continuation identation"

This reverts commit 49630409ee.

* add 2-space indent on line continuations.
2023-07-08 09:26:26 +05:30
edizor
a7eef6811b Update README.md
[skip ci]
2023-07-08 08:31:12 +08:00
Azhwani
ff09d7c37e BAEL-6399: Getting Yesterday's Date in Java 2023-07-07 22:17:50 +02:00
tienvn
f9e48c05a2 add unit test 2023-07-08 00:39:27 +07:00
tienvn
af9dc027fa Merge branch 'master' into BAEL-6541-convert-relative-path 2023-07-08 00:12:28 +07:00
Vini
7e0db60cad Merge pull request #14305 from Eredisse/master
BAEL-6024 - Guide to YugabyteDB
2023-07-07 15:14:50 +02:00
alexandru.borza
2c806b3c1f remove unused dependency 2023-07-07 14:49:14 +03:00
uzma
2c816f666e [BAEL-6697] code for jacoco fail build 2023-07-07 00:36:48 +01:00
Dhawal Kapil
69a5a4b15a JAVA-22625 Removed junit4 engine (#14368) 2023-07-06 13:02:53 +05:30
Bipin kumar
6068def232 Java 19657 (#14336)
* JAVA-19657: Changes made for WSDL stubs with maven

* JAVA-19657: changes made for upgrading module Generate WSDL Stubs with Maven
2023-07-06 12:04:39 +05:30
Kai Yuan
eead5281ac [split-digits] Split a String Into Digits- and Non-Digits-Elements (#14349)
* [split-digits] Split a String Into Digits- and Non-Digits-Elements

* [split-digits] JMH benchmark

* [split-digits] using enum
2023-07-05 18:20:28 -05:00
davidmartinezbarua
de37f3519a Merge pull request #14340 from etrandafir93/features/BAEL-6579-completable_future_thread_pool
BAEL-6579: completable future's thread pool
2023-07-05 14:41:11 -03:00
anuragkumawat
39ae838c85 JAVA-21457 Add SpringFox module to spring-boot-modules pom (#14344)
* JAVA-21457 Add SpringFox module to spring-boot-modules pom

* JAVA-21460 Update articles URLs for new annotations
2023-07-05 23:10:52 +05:30
Gaetano Piazzolla
d17380c270 JAVA-20499 | Merging javax-validation-advanced module in javaxval-2. (#14362) 2023-07-05 22:53:06 +05:30
panos-kakos
0a5dde8f9c [JAVA-21545] Upgraded aws-java-sdk-dynamodb version (#14351) 2023-07-05 20:38:31 +05:30
Shahul Basha
96eaaeda71 BAEL-6633 (#14356)
* Deep copy of Arraylist

* Deep copy of Arraylist

* Deep copy of Arraylist updated as per review

* Deep copy of Arraylist updated as per review

* Deep copy of Arraylist updated as per review
2023-07-05 14:24:57 +02:00
vunamtien
1715231d03 rename file (#14365) 2023-07-05 13:23:40 +02:00
Abhinav Pandey
311f5cc472 Bael 6577 (#14260)
* BAEL-6577 - Paralellize for loops in Java

* BAEL-6577 - Paralellize for loops in Java

* BAEL-6577 - Paralellize for loops in Java - adding JMH

* BAEL-6577 - Paralellize for loops in Java - using CompletableFuture
2023-07-04 20:07:40 +05:30
Shahul Basha
95bee7122a BAEL-6633 (#14308)
* Deep copy of Arraylist

* Deep copy of Arraylist

* Deep copy of Arraylist updated as per review
2023-07-04 14:35:53 +02:00
parthiv39731
9bd2cdbc5e BAEL-6626 (#14345)
* BALE-6626
Check If a String Contains Non-Alphanumeric Characters in Java

* Move patterns to class level.

---------

Co-authored-by: parthiv39731 <parthiv39731@gmail.com>
2023-07-04 14:17:45 +02:00
panos-kakos
5857614401 [JAVA-22589] Added @DirtiesContext and re-enabled test case 2023-07-03 17:15:45 +03:00
uzma
b62dba7b7f [BAEL-6318] fix test 2023-07-03 13:18:03 +01:00
Loredana Crusoveanu
50e477a72a Merge pull request #14339 from edizor/master
Update README
2023-07-03 13:07:16 +03:00
vunamtien
5506d3c91f BAEL-6644-read-zip-entries (#14321)
* read zip file entries

* add unit test

* update test code
2023-07-03 12:04:44 +02:00
uzma
8b52027902 [BAEL-6318] code for consuming Page<Entity> using rest template 2023-07-02 23:51:56 +01:00
Tapan Avasthi
c2445783c0 BAEL-6647: How to handle character encoding in JSON POST Request (#14335)
Co-authored-by: Tapan Avasthi <tavasthi@Tapans-MacBook-Air.local>
2023-07-02 10:47:44 -05:00
Kasra Madadipouya
fcb98776a9 Merge pull request #14331 from timis1/JAVA-22498
JAVA-22498 Potential issue in "Difference Between FileReader and Buff…
2023-07-02 15:20:19 +02:00
Kai Yuan
a642f803e9 [file-is-empty] Check If a File is Empty in Java (#14319)
* [file-is-empty] Check If a File is Empty in Java

* [file-is-empty] adjust code format

* [file-is-empty] rename test methods

* [file-is-empty] Then->then in method names
2023-07-01 21:39:05 -05:00
Michael Olayemi
ff05916b9b Upload file and get its URL from Amazon S3 (#14317)
* Upload file and get its URL from Amazon S3

* Upload file and get its URL from Amazon S3

* Upload file and get its URL from Amazon S3
2023-07-01 18:53:45 +05:30
emanueltrandafir1993
54eb5defc8 BAEL-6579: fixing tests 2023-07-01 13:33:40 +02:00
emanueltrandafir1993
1b9f8bdb5d BAEL-6579: completable future's thread pool 2023-07-01 13:24:01 +02:00
edizor
d16ded7aa0 Update README.md
[skip ci]
2023-07-01 18:45:22 +08:00
edizor
09bfb18abb Update README.md
[skip ci]
2023-07-01 18:36:32 +08:00
edizor
f296df4b1c Update README.md
[skip ci]
2023-07-01 18:28:28 +08:00
edizor
9d1fd2cec3 Update README.md
[skip ci]
2023-07-01 18:22:12 +08:00
edizor
9b0d629242 Update README.md
[skip ci]
2023-07-01 18:13:54 +08:00
edizor
869d9f2080 Create README.md
[skip ci]
2023-07-01 18:06:20 +08:00
edizor
961c1c9369 Update README.md
[skip ci]
2023-07-01 17:54:36 +08:00
edizor
aef7588e0e Update README.md
[skip ci]
2023-07-01 17:45:15 +08:00
edizor
961bec8417 Update README.md
[skip ci]
2023-07-01 17:39:19 +08:00
edizor
3bac2c14ac Update README.md
[skip ci]
2023-07-01 17:31:59 +08:00
edizor
847dc0b1ed Update README.md
[skip ci]
2023-07-01 17:20:41 +08:00
edizor
a0dc17a8c7 Update README.md
[skip ci]
2023-07-01 17:18:27 +08:00
edizor
ebd569ebb5 Update README.md
[skip ci]
2023-07-01 17:09:10 +08:00
edizor
8f2b1126e1 Update README.md
[skip ci]
2023-07-01 17:06:20 +08:00
edizor
e66e1b9af7 Update README.md
[skip ci]
2023-07-01 17:03:31 +08:00
edizor
292f51aa72 Update README.md
[skip ci]
2023-07-01 16:59:56 +08:00
edizor
6f49e59cdf Update README.md
[skip ci]
2023-07-01 16:50:32 +08:00
Dhawal Kapil
7c189d6981 JAVA-22625 Replaced Junit4 package with Junit5 (#14334) 2023-06-30 17:03:46 +05:30
Bipin kumar
c6e3c56da9 Java 22625 S to Z (#14332)
* JAVA-22625: Changes made for module T to Z formatting the pom.xml

* JAVA-22625: Changes made for module S  to Z formatting the pom.xml
2023-06-30 16:38:28 +05:30
Bipin kumar
16272c6c47 JAVA-22625: Changes made for module Q to S formatting the pom.xml (#14330) 2023-06-30 16:37:55 +05:30
Bipin kumar
7095138d64 JAVA-22625: Changes made for formatting the pom.xml (#14329) 2023-06-30 16:37:25 +05:30
Gaetano Piazzolla
5ee991f207 JAVA-21601 | Using oracle Starter instead of Multiple dependencies. (#14326) 2023-06-30 16:19:14 +05:30
timis1
45c2efebb4 JAVA-21187 Cleanup un-committed or un-ignored artifacts - Week 21 - 2023 (moved-5) (#14312)
Co-authored-by: timis1 <noreplay@yahoo.com>
2023-06-30 09:33:31 +05:30
timis1
5c1a76f1c8 JAVA-20168 Update article links in README.md (#14307)
Co-authored-by: timis1 <noreplay@yahoo.com>
2023-06-30 09:29:21 +05:30
Tapan Avasthi
20bc629fd7 BAEL-6627: How to start a thread using an anonymous class (#14314)
Co-authored-by: Tapan Avasthi <tavasthi@Tapans-MacBook-Air.local>
2023-06-29 20:59:37 -05:00
timis1
64b06b0899 JAVA-22498 Potential issue in "Difference Between FileReader and BufferedReader in Java" 2023-06-29 22:35:10 +03:00
panos-kakos
6ea7b339d3 [JAVA-14013] Added example for LoggingSystem 2023-06-29 18:36:48 +03:00
timis1
daef3dd7e9 JAVA-100003 Removed apis from Kong
Co-authored-by: timis1 <noreplay@yahoo.com>
2023-06-29 11:26:08 +03:00
kpentaris
9daa4d35c7 BAEL-4466 Smart Batching in Java (#14190)
* Tutorial code for BAEL-4466 Smart Batching in Java

* Revert "Tutorial code for BAEL-4466 Smart Batching in Java"

This reverts commit d8d4fa7a42.

* Tutorial code for BAEL-4466 Smart Batching in Java
2023-06-29 08:54:43 +05:30
panos-kakos
406595a3c9 [JAVA-22589] Disabled test case 2023-06-29 00:18:06 +03:00
tudor.marc
eeec699ea9 BAEL-6310 - update project location 2023-06-28 23:34:34 +03:00
panos-kakos
dc108d7a2d [JAVA-22159] Upgraded circuitbreaker-resilience4j and spring boot version (#14316) 2023-06-28 19:16:12 +03:00
Hamid Reza Sharifi
14d102074d bael-3314:update jmockit articles (#14320) 2023-06-28 18:14:01 +02:00
Gaetano Piazzolla
8d9f1fb8ca JAVA-21602 | fixing sync code block (#14318) 2023-06-28 20:18:08 +05:30
anuragkumawat
930d2fc22a Java 21460 Move code from spring-boot-swagger & spring-boot-swagger-2 to spring-boot-swagger-springfox module (#14310)
* JAVA-21460 Upgrade spring-boot-swagger-jwt modules to use SpringDoc in place of SpringFox

* JAVA-21460 Upgrade spring-boot-swagger-2 module to use SpringDoc in place of SpringFox

* JAVA-21460 Upgrade spring-boot-swagger module to use SpringDoc in place of SpringFox

* JAVA-21460 Move code from spring-boot-swagger & spring-boot-swagger-2 to  spring-boot-swagger-springfox module

* JAVA-21457 Upgrade spring-security-web-rest to use SpringDoc in place of SpringFox
2023-06-28 10:13:24 +05:30
brokenhardisk
c2da4391f7 BAEL-6498 RequiredArgsConstructor Code and Tests (#14281)
* BAEL-6498 RequiredArgsConstructor Code and Tests

* BAEL-6498 RequiredArgsConstructor Code and Tests
2023-06-27 18:43:29 +05:30
Kingsley✨
e1166ee4d9 Jaxb vs Jaxp (#14242) 2023-06-27 18:38:52 +05:30
Gaetano Piazzolla
2c2869a5d9 JAVA-22499 | Upgraded spring-boot and removed hybernate-validator to use 3.0.0.Final version of the spring-boot 3 (#14315) 2023-06-27 13:51:25 +03:00
panos-kakos
cc7d251bba [JAVA-22589] Clean up 2023-06-27 11:43:54 +03:00
Vini
ee03a11ab3 Merge pull request #14309 from tudormarc/tudor-jacksonjr2
Tudor jacksonjr2
2023-06-27 10:38:36 +02:00
panos-kakos
b51e76f4f1 [JAVA-22213] Upgraded mantis-runtime version (#14246)
* [JAVA-22213] Added Spectator library
2023-06-27 11:35:06 +03:00
Mo Helmy
2c1544db4d Removing JSON elements with Jackson [BAEL-6511] (#14291)
* Removing JSON elements with Jackson [BAEL-6511]

This commit adds a test class for removing JSON elements using the Jackson library.

* Removing JSON elements with Jackson [BAEL-6511]

This PR adds a test class for removing JSON elements using the Jackson library.
2023-06-26 19:26:45 -05:00
davidmartinezbarua
7b38a7d641 Merge pull request #14272 from thibaultfaure/article/BAEL-6358
BAEL-6358 Code for the Starting the Maven Build From the Point Where …
2023-06-26 11:39:37 -03:00
Azhwani
1160ccc07e BAEL-6597: How to get the last Day of the Month in Java (#14191) 2023-06-26 14:05:24 +02:00
panos-kakos
5c84df1a61 Java 15033 Added apache httpclient v4 test case demonstrating close/release resources (#14295) 2023-06-26 14:39:00 +03:00
Bipin kumar
24443145ab Java-15020: Changes made for running failed cases (#14288) 2023-06-26 14:12:55 +03:00
tudor.marc
e15c6a9b18 BAEL-6310 - review updates 2023-06-26 11:47:01 +03:00
Michael Pratt
a03ed654c5 Add unit tests (#14306) 2023-06-25 20:42:54 -05:00
Loredana Crusoveanu
51ddccd8f7 Merge pull request #14299 from collaboratewithakash/master
updated backlink
2023-06-25 18:50:11 +03:00
alexandru.borza
1e08a74b3e add live test 2023-06-25 18:28:58 +03:00
Bipin kumar
08333e68ba Java-20326: Changes made for replacing strSubstitutor with stringSubstitutor (#14301) 2023-06-25 18:19:11 +05:30
Grzegorz Piwowarek
13307e4341 Remove redundant constructors (#14248) 2023-06-25 14:38:28 +02:00
anuragkumawat
1d8f4e1ab6 JAVA-21458 Upgrade custom-validations-opeanpi-codegen to use SpringDoc in place of SpringFox (#14302) 2023-06-25 18:06:27 +05:30
Grzegorz Piwowarek
61a113efd9 Adjust for a non-null MongoClient API (#14247) 2023-06-25 14:14:06 +02:00
anuragkumawat
bfbf4c00f4 JAVA-21460 Upgrade spring-boot-swagger-jwt modules to use SpringDoc in place of SpringFox (#14296)
* JAVA-21460 Upgrade spring-boot-swagger-jwt modules to use SpringDoc in place of SpringFox

* JAVA-21460 Upgrade spring-boot-swagger-2 module to use SpringDoc in place of SpringFox

* JAVA-21460 Upgrade spring-boot-swagger module to use SpringDoc in place of SpringFox
2023-06-25 17:00:13 +05:30
timis1
54e49847da JAVA-20405 Remove 'modules' from spring-thymeleaf-attributes (#14300)
Co-authored-by: timis1 <noreplay@yahoo.com>
2023-06-25 16:53:03 +05:30
Loredana Crusoveanu
fec3f5bc70 Merge pull request #14275 from dkapil/task/JAVA-22153
JAVA-22153 Upgraded parent-spring* versions
2023-06-24 21:14:04 +03:00
Gaetano Piazzolla
171fdc7b7e JAVA-22238 | moved articles into correct locations. (#14297) 2023-06-24 23:41:14 +05:30
Ulisses Lima
b4a8dfbbff BAEL-6403 - Extracting a Tar File in Java (#14240)
* code 1

* sibling module readme

* new module

* review 1

* review 2
2023-06-24 10:43:02 +02:00
Azhwani
3debfa944f BAEL-6397: Adding One Month to Current Date in Java (#14261) 2023-06-24 10:38:42 +02:00
collaboratewithakash
2b918750b7 updated backlink 2023-06-24 13:29:37 +05:30
Tapan Avasthi
e59dc5c1bd BAEL-6532: Define main class when using multiple profiles in a Spring Boot project (#14267)
Co-authored-by: Tapan Avasthi <tavasthi@Tapans-MacBook-Air.local>
2023-06-23 21:10:42 -05:00
Loredana Crusoveanu
0631f8ceb1 Merge pull request #14249 from eugenp/lor6-patch-1
Update README.md
2023-06-23 19:12:57 +03:00
Loredana Crusoveanu
014006805e Merge pull request #14250 from eugenp/lor6-patch-2
Update README.md
2023-06-23 19:12:05 +03:00
Michael Olayemi
1547170c11 How to convert docx into pdf with Java? (#14273) 2023-06-23 19:38:20 +05:30
Vini
9f0401b5e7 Merge pull request #14228 from tudormarc/tudor-jacksonjr
BAEL-6310 - guide to JacksonJr
2023-06-23 15:37:06 +02:00
Bipin kumar
11a392584d Java-15020: Minor fix in HttpClientParamsLiveTest (#14284) 2023-06-23 12:36:31 +03:00
anuragkumawat
47f5f1776d JAVA-21298 Fix failing tests in spring-boot-testing module (#14289) 2023-06-23 14:03:16 +05:30
timis1
e4edb2fb47 Java 20405 Align module names, folder names and artifact id - Week 18 - 2023 (moved-7) (#14290)
* JAVA-20405 Align name for spring-boot-aws

* JAVA-20405 Align module name for spring-boot-3-url-matching

* JAVA-20405 Align module name for core-java-streams-collect

* JAVA-20405 Align module name for dummy-surefire-junit47

---------

Co-authored-by: timis1 <noreplay@yahoo.com>
2023-06-23 13:15:40 +05:30
timis1
5af1ff5334 JAVA-16399 Upgrade gradle-modules/gradle/maven-to-gradle to JDK 17 (#14282)
* JAVA-16399 Upgrade gradle-modules/gradle/maven-to-gradle to JDK 17

* JAVA-16399 Remove duplicate modules in a profile

* JAVA-16399 Fix broken pom.xml

---------

Co-authored-by: timis1 <noreplay@yahoo.com>
2023-06-23 13:09:53 +05:30
Ehsan Sasanianno
8a43581a38 java-20085: fix selenium failing tests (#14279) 2023-06-22 23:00:27 +05:30
Gaetano Piazzolla
68605e9d26 JAVA-22236 | adding new submodule due to too much articles in the same submodule. (#14286) 2023-06-22 20:23:01 +05:30
panos-kakos
818c6aa19e [JAVA-15033] Update article Apache HttpClient 4 Cookbook (#14266) 2023-06-22 13:16:56 +03:00
Loredana Crusoveanu
d283aba01e Merge pull request #14276 from edizor/master
Update README
2023-06-22 11:42:46 +03:00
Bhaskar Ghosh Dastidar
5a83662f66 [BAEL-6090] vector api examples (#14274)
Co-authored-by: Bhaskar <bhaskar.dastidar@freshworks.com>
2023-06-21 13:50:45 -07:00
edizor
ccc8d8ab20 Update README.md
[skip ci]
2023-06-21 20:31:57 +08:00
edizor
0aba278b42 Update README.md
[skip ci]
2023-06-21 20:22:12 +08:00
edizor
44cdc819d8 Update README.md
[skip ci]
2023-06-21 18:26:24 +08:00
edizor
7bbab038ea Create README.md
[skip ci]
2023-06-21 18:15:41 +08:00
edizor
523692fc7b Update README.md
[skip ci]
2023-06-21 17:53:50 +08:00
edizor
79f1fe4410 Update README.md
[skip ci]
2023-06-21 17:47:03 +08:00
edizor
192d7a4da6 Update README.md
[skip ci]
2023-06-21 17:36:02 +08:00
Dhawal Kapil
357d0e57cf JAVA-22153 Upgraded parent-spring* versions 2023-06-21 11:35:12 +05:30
timis1
c1c1fb2c2d JAVA-18148 Create a new java-nashorn project from the existing langua… (#14268)
* JAVA-18148 Create a new java-nashorn project from the existing language-interop

* JAVA-18148 Cleanup the project to contain just the python related language interop

---------

Co-authored-by: timis1 <noreplay@yahoo.com>
2023-06-21 09:22:00 +05:30
thibault.faure
56605a856f BAEL-6358 Code for the Starting the Maven Build From the Point Where It Failed article 2023-06-20 19:42:54 +02:00
timis1
9c18d908f9 JAVA-20168 Migrating spring-jpa (#14257)
* JAVA-20168 Migrating spring-jpa

* JAVA-20168 Migrate spring-jpa-2

* JAVA-20168 Remove unneeded annotation

---------

Co-authored-by: timis1 <noreplay@yahoo.com>
2023-06-20 23:00:45 +05:30
Anastasios Ioannidis
d5d6478346 Upgrade spring-cloud-contract, spring-cloud-data-flow to JDK 17 (#14263)
* Upgrade spring-cloud-contract, spring-cloud-data-flow to JDK 17

* JAVA-22207 Refactored groovy version
2023-06-20 22:58:00 +05:30
Gaetano Piazzolla
bd7e255bf7 JAVA-22212 | upgraded microprofile version (#14259) 2023-06-20 22:33:42 +05:30
Dmytro Budym
2bff026de7 Add code examples for "Convert Java Array to Iterable" (#14144)
* Add code examples for "Convert Java Array to Iterable"

* fix formatting
2023-06-20 21:23:47 +05:30
Michael Olayemi
044526c91f Hex Representation of a SHA-1 Digest of a String in Java (#14239)
* Hex Representation of a SHA-1 Digest of a String in Java

* Hex Representation of a SHA-1 Digest of a String in Java

* Hex Representation of a SHA-1 Digest of a String in Java
2023-06-20 21:17:00 +05:30
Michael Pratt
5d7ab6ea5d BAEL-6417: MinIO Java SDK examples (#14048)
* BAEL-6417: MinIO Java SDK examples

* BAEL-6417 Add Live test

* BAEL-6417 Rename live test class

* BAEL-6417 Create property for minio version
2023-06-20 10:45:16 -05:00
panos-kakos
eb0910c72e [JAVA-22206] Upgraded micrometer dependency version (#14200) 2023-06-20 13:26:51 +03:00
davidmartinezbarua
23509bea76 Merge pull request #14234 from thibaultfaure/article/BAEL-5977
BAEL-5977 Code for the Throw Exception for Unexpected Input for Enum …
2023-06-19 22:40:59 -03:00
Azhwani
534e7b78da BAEL-6523: Difference Between findBy and findOneBy in Spring Data JPA (#14136) 2023-06-19 20:28:52 +02:00
davidmartinezbarua
15e0fcf4e1 Merge pull request #14243 from thibaultfaure/article/BAEL-5600
BAEL-5600 Code for the Read Date in Java using Scanner article
2023-06-19 13:07:37 -03:00
sam-gardner
f4007229f7 BAEL-5830 Add code for setting default values for null fields with Jackson (#14265) 2023-06-19 08:15:16 -07:00
panos-kakos
584dd6efdc [JAVA-22160] Upgraded resilience4j-spring-boot2 dependency version + … (#14207) 2023-06-19 15:39:08 +03:00
Vini
fe320577b3 Merge pull request #14161 from Eredisse/master
BAEL-6024 Guide to YugabyteDB
2023-06-19 12:15:09 +02:00
Kai Yuan
c6dae279de [list<str>-to-list<int>] Convert a List of Strings to a List of Integers (#14244) 2023-06-18 10:53:42 -05:00
Viktor Ardelean
3c3560fa3a Feature/bael 5934 (#14120)
* Merge fork with source (#6)

* JAVA-20280: remove wrong property (#13874)

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

* Update README.md

[skip ci]

* JAVA-13721 Format, Fix Package, Upgrade version of all the articles

* JAVA-13721 Moved mockito-simple to JDK9+ profiles

* JAVA-20278. Please point me to the tutorial code #13768. (#13923)

Co-authored-by: jogra <joseph.sterling.grah@miles.no>

* BAEL-6352: Check if the First Letter of a String is a Number (#13883)

* [BAEL-6434_charAndString] Difference Between "char" and "String" (#13907)

* [JAVA-18185] Upgrade groovy version (#13926)

* Update code for Overview of NLP Libraries in Java (#13912)

* Update code for Overview of NLP Libraries in Java

* Update code for Overview of NLP Libraries in Java

* Update code for Overview of NLP Libraries in Java

* BAEL-6319 Hibernate 6 Boolean Converters (#13894)

Co-authored-by: Mariusz Kaczmarczyk <to@mariu.sh>

* BAEL-6194 Retrieve the Value of an HTML Input Using Selenium WebDriver in Java (#13898)

* Retrieve the Value of an HTML Input Using Selenium WebDriver in Java

* Retrieve the Value of an HTML Input Using Selenium WebDriver in Java

* Retrieve the Value of an HTML Input Using Selenium WebDriver in Java

* JAVA-20898 Check Article Code Matches GitHub

* Java 15032 (#13913)

* JAVA-15032: Changes made for adding the test cases custom userAgent in request  header

* JAVA-15032: Changes made for adding the test cases custom userAgent in request  header

* JAVA-15032: Changes made for incorporarting review comments

* JAVA-20931 Commented out spring-boot-3 for now because of JDK 19 requirement (#13936)

* BAEL-6325 Create core-java-lang-oop-constructors-2 (#13933)

* BAEL-5915 Added different ways to create an object

* BAEL-6325 Create core-java-lang-oop-constructors-2

* BAEL-6435: Reverse a String in Java 8 using Lambda and Streams (#13910)

* [JAVA-20456] Upgraded jackson version (#13871)

* [JAVA-20457] Upgraded springdoc version (#13872)

* [JAVA-20459] Upgraded org.json to latest version (#13869)

* BAEL-6327 - Find the index of an element in a Java array (#13844)

* JAVA-20898 Move article url from javaxval-2 to javaxval

* Java 20643 (#13914)

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: changes made for removing web-modules from default

* [BAEL-6436_printQuotesAroundString] Print "" Quotes Around a String in Java (#13925)

* JAVA-18113 Update spring-boot-swagger-keycloak module (#13506)

* JAVA-18113 Update spring-boot-swagger-keycloak module

* JAVA-16612: Mock Final Classes and Methods with Mockito article; MockMaker improvement (#13890)

* BAEL-6254: Scoped values (#13756)

* Added the code for "The difference between BufferedReader and FileReader". (#13942)

* BAEL-5814 - Is CompletableFuture Non-blocking (#13917)

* BAEL-5814 - Is CompletableFuture Non-blocking

* Fix the formatting

* BAEL-6326: Spring Boot H2 JdbcSQLSyntaxErrorException expected identifier (#13843)

* BAEL-6320: added code support for the @NaturalId article

* JAVA-16946: comment spring-jooq module from persistence-modules. (#13951)

* JAVA-20555 use Java Base64 instead of deprecated Spring Base64Utils (#13941)

* [BAEL-6105] code for list to page article

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* [BAEL-6105] code for list to page article

* [BAEL-6105] refactor test names

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* BAEL-6438 Code for the Find the longest word in a given string article

* BAEL-6332: Calling Non-Static Method In Static Method In Java (#13940)

* [BAEL-6485_RM-Punctuation] Remove Punctuation (#13946)

* BAEL-6410 (#13919)

* BAEL-6410 | Article code

* Adding consumer code for article

* BAEL-6046 MongoDB - Field Level Encryption (#13859)

* [BAEL-6253] record equals hashcode (#13958)

* [BAEL-6253] records equals and hashcode

* [BAEL-6253] records equals and hashcode

* [BAEL-6253] records equals and hashcode test case

---------

Co-authored-by: Bhaskar <bhaskar.dastidar@freshworks.com>

* [compByteArrays] Comparing Two Byte Arrays in Java (#13935)

* Remove Comments and update prefix.

* Uploading File using Selenium WebDriver in Java (#13947)

* Uploading File using Selenium WebDriver in Java

* Uploading File using Selenium WebDriver in Java

* Uploading File using Selenium WebDriver in Java

* Uploading File using Selenium WebDriver in Java

* [rajkishorraj185@gmail.com] Lombok equalsandhashcode annotation (#13717)

* example code for equalsandhashcode annotation

* moving codes to lombok-2

---------

Co-authored-by: raj kishor <raj.kishor@smartcoin.co.in>

* Match prefix same as draft.

* JAVA-19152: fix intermittently failing RequestProcessorUnitTest (#13957)

* [JAVA-19362] Upgraded itextpdf to 5.5.13.3 (#13961)

* JAVA-16946: disable unit test for core-java-lang-oop-modifiers module for maintenance (#13968)

* BAEL-6444 | Added P6Spy logging in spring boot observation module. (#13965)

* BAEL-6444 | Added P6Spy logging in spring boot observation module.

* BAEL-6444 | Added Find with name query and custom log format now working

* BAEL-6444 | Formatting

* BAEL-6444 | Renaming junit files

* BAEL-6444 | Added start class

* BAEL-6444 | Actualized code with Article

* BAEL-6444 | Actualized code with Article

* BAEL-6444 | redded commit()

* BAEL-6444 | BDD naming strategy

* BAEL-6501 Update article "The producer-consumer problem example in Java" (#13973)

* BAEL-6501 Changed the synchronization block to use the DataQueue

* BAEL-6501 Fixed the platform agnostic new lines

* BAEL-6501 Moved ID increment to a static method

* BAEL-6501 Added a logger

* Add files via upload (#13978)

* JAVA-19152 Increased the awaitility timeout for one more poll delay (#13975)

* BAEL-6250: Example code for Get All Caffeine Cache Keys article (#13806)

* BAEL-6185 reuse string builder performance (#13791)

* BAEL-6444 | Removed copyright commit (#13987)

* JAVA-18648 Review the time of the build - Week 9 - 2023 (#13954)

* JAVA-20277 GitHub Issue: Regarding article Introduction to JsonPath (#13939)

* BAEL-6197 - Execute Tests Based on Active Profile with JUnit 5 (#13776)

* BAEL-6255 - Run a Spring Boot application in AWS Lambda

* BAEL-6255 - Run a Spring Boot application in AWS Lambda

* fix on template.yaml

* fix on template.yaml

* removed log from test

* resolved issues reported on PR

* BAEL-6277 - A Guide To Spring Cloud Azure

First commit

* BAEL-6277 - A Guide To Spring Cloud Azure

Added to README.md the steps to create the secrets

* BAEL-6277 - A Guide To Spring Cloud Azure

Added the integration Azure Key Vault Properties

* BAEL-6277 - A Guide To Spring Cloud Azure

Added the integration Azure Key Vault Properties

* BAEL-6277 - A Guide To Spring Cloud Azure Key Vault

Added one level package keyvault

* BAEL-6277 - A Guide To Spring Cloud Azure Key Vault

removed target release version

* BAEL-6277 - A Guide To Spring Cloud Azure Key Vault

fix compilation of NoSuchElementException

* BAEL-6277 - A Guide To Spring Cloud Azure Key Vault

fix pom.xml

* Revert "BAEL-6277 - A Guide To Spring Cloud Azure Key Vault"

This reverts commit 1cca1d0d69.

* BAEL-6277 - A Guide To Spring Cloud Azure Key Vault

fix pom.xml

* BAEL-6277 - A Guide To Spring Cloud Azure Key Vault

downgrade version to fix jenkins pipeline error

* BAEL-6277 - A Guide To Spring Cloud Azure Key Vault

comment run on main class

* Revert "reset last commit"

This reverts commit c557fad67f1c15bb384f0af5781430a45121a838.

* BAEL 6197 - Execute Tests Based on Active Profile with JUnit 5

#First push

* BAEL-6277 - A Guide To Spring Cloud Azure Key Vault

Revert for new pr

* reset last commit

* reset last commit

* BAEL 6197 - Execute Tests Based on Active Profile with JUnit 5

#Remove redundant test

* BAEL 6197 - Execute Tests Based on Active Profile with JUnit 5

#Format fix

* BAEL 6197 - Execute Tests Based on Active Profile with JUnit 5

#fix from review

* BAEL 6197 - Execute Tests Based on Active Profile with JUnit 5

#fix from review

* BAEL 6197 - Execute Tests Based on Active Profile with JUnit 5

#fix test name

---------

Co-authored-by: Cesare <cesare.valenti@hotmail.com>

* [scanner-to-array] Saving Java Scanner Input to an Array (#13969)

* BAEL-6342 JUnit Test Class for Null and Empty String (#13963)

* JAVA-20630 upgrade maven war plugin to be compatible with JDK 11 and 17 (#13945)

* JAVA-20630 upgrade maven war plugin to be compatible with JDK 11 and 17

* JAVA-20630 code format

* JAVA-20630 don't fail if there's no web.xml and using Java based configuration while building a war file

* JAVA-20630 avoid unneeded formatting

* JAVA-20630 change order of modules to solve flaky tests

* fix module order

* add dependent module

* add parent

* JAVA-20828 Fixing the core-java-exclusions module (#13997)

* Upgrade spring.vault.core from 2.3.2 to 3.0.2 (#13977)

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Create README.md

[skip ci]

* Update README.md

[skip ci]

* Title: Regular Expression: \z vs \Z Anchors in Java (#13994)

Hello,
This commit related to the article entitled "Regular Expression: \z vs \Z Anchors in Java"

* JAVA-20828: Changes made for updating blade module to java 11 (#13929)

* JAVA-20828: Changes made for updating blade module to java 11

* JAVA-20828: Changes made for updating bootique,dropwizard,google-web-toolkit  module to java 11

* JAVA-20828: Changes made for updating bootique,dropwizard,google-web-toolkit  module to java 11

* JAVA-20828: Adding jakarta-ee to jdk-9 profile

* BAEL-6334 Add example code for checking if a list element is in another list

* JAVA-20610 Upgraded parent-boot-2 to 2.7.11 (#13944)

* JAVA-20163 Upgrade hibernate specific modules to JDK 11 (#13817)

* JAVA-20163 Migration hibernate-annotations

* JAVA-20163 Migrate hibernate-queries

* JAVA-20163 Migrating hibernate-mapping

* JAVA-20163 rename reserved keywords, update inheritance example

* JAVA-20163 Migrate hibernate-ogm module to the jdk 8 because hibernate-ogm doesn't support jakarta API

* JAVA-20163 Migrate hibernate-enterprise module

* JAVA-20163 Add update to HibernateExceptionUnitTest#whenQueryExecutedWithUnmappedEntity_thenMappingException

* JAVA-20163 Set explicit version for hibernate 6.1.7.Final in the hibernate-queries module

* JAVA-20163 Fix failed test with port that already exists (giving another port 8088)

* JAVA-20163 Fix other location after changing the port

* JAVA-20163 Remove duplicate Unit Test

---------

Co-authored-by: n <noreplay@yahoo.com>
Co-authored-by: Loredana Crusoveanu <lore.crusoveanu@gmail.com>

* JAVA-20165 Upgrade spring-boot hibernate specific modules to JDK 11 (#13952)

* JAVA-20165 Upgrade spring-boot hibernate specific modules to JDK 11

* JAVA-20165 Migrating spring-boot-persistence-mongodb

* JAVA-20165 Migrating spring-boot-persistence-mongodb-2

* JAVA-20165 Migrating spring-boot-persistence-mongodb-3

* JAVA-20165 Adding latest version for jdbi in spring-boot-persistence-2 module

---------

Co-authored-by: timis1 <noreplay@yahoo.com>

* [Check If a Specified Key Exists in a Given S3 Bucket using Java] added code examples (#13775)

* [Check If a Specified Key Exists in a Given S3 Bucket using Java]] added code examples for

change test name

remove link from README.md

* - used env variables for AWS credentials
- used codestyle profile of baledung

* [os-to-is] Convert an OutputStream to an InputStream (#13992)

* BAEL-6264 added class to show how to instantiate ArrayBlockingQueue a… (#13851)

* BAEL-6264 added class to show how to instantiate ArrayBlockingQueue and LinkedBlockingQueue

* BAEL-6264 added unit test case

* modified test case

* BAEL-6264 deleted BlockingQueueImplExample file not needed anymore

* BAEL-6264 code review changes moved class file to different module

---------

Co-authored-by: Vartika_Nigam <Vartika_Nigam@DellTeam.com>

* Add code examples for "Opening a New Tab Using Selenium WebDriver in Java" (#14001)

Add code examples for "Opening a New Tab Using Selenium WebDriver in Java"

* BAEL-6320: format & code review

* JAVA-16946 Upgrade h2 database version for remaining modules (#13976)

* Add java interface single implementation examples (#13972)

* Fix formatting issues, refactor the `profiles` word in the properties.

* Add files via upload (#14006)

* JAVA-20828 Fixed module name (#14018)

* fix SeleniumOpenNewTabLiveTest (#14019)

* BAEL-6493 - Read last N messages from a Kafka Topic (#14020)

* BAEL-6398: Java PrintStream to String (#13998)

* Revert "JAVA-20280: remove wrong property (#13874)" (#14021)

This reverts commit 58d9bcb3b4.

* Hashing with Argon2 in Java (#14009)

* Hashing with Argon2 in Java

* Hashing with Argon2 in Java

* JAVA-13721 Fixing the formatting

* JAVA-13721 Further formatting of files

* BAEL-4369: Multiple ways of declaring dependency versions in Gradle (#13825)

* BAEL-6246 Code for the article Send MultipartFile Request with RestAs… (#13803)

* BAEL-6246 Code for the article Send MultipartFile Request with RestAssured

* Fix code style in rest assured integration tests

---------

Co-authored-by: thibault.faure <thibault.faure@mimacom.com>

* Bael 4582: Custom Authentication using shared secret (#13801)

* Spring custom security filter add

* Integration Tests add

* Add Project into parent pom

* refactor code

* refactor code

* remove .env and refactor code

* refactor code

* exclude auto configuration

* Refactored code

* removed ssl certificate for security

* Set session management to statelees

* Refactor tests

* Refactor authentication logic

* Refactor authentication logic

* Refactor authentication logic

* Remove unused code

* Remove unused code

* Remove unused appconfig

* disable AWSS3ObjectIntegrationTest due to need real credentials (#14028)

make AWSS3ObjectIntegrationTest manual

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* JAVA-20828: changes made for resolving botique module (#14027)

* [JAVA-20626]Moved vertx-modules to jdk9-and-above profile + upgraded vertx version to 3.9.15 (#13960)

* [JAVA-20633  Clean up modules (#14024)

* add value of comparision

* [BAEL-6339] custom iterator with testcases (#14038)

Co-authored-by: Bhaskar <bhaskar.dastidar@freshworks.com>

* BAEL-6246 Fix AppControllerIntegrationTest (#14039)

Co-authored-by: thibault.faure <thibault.faure@mimacom.com>

* JAVA-20946 Renamed HttpBinServiceUnitTest to LiveTest (#14041)

- Since it is making actual live request to httpbin.org

* JAVA-21186 Fix references to parents - Week 21 - 2023 (#14036)

* JAVA-20630 move the jws module to  *-jdk9-and-above profiles (#14030)

* JAVA-20631 move Jetbrains module to *-jdk9-and-above profiles (#14029)

* JAVA-20631 move Jetbrains module to *-jdk9-and-above profiles

* JAVA-20631 fix parent modules so that the project parent (pom.xml) can be built without error

* BAEL-5711: Securing Spring Boot API with API key and secret (#14015)

* #bael-5711: add source

* #bael-5711: remove extra space

* #bael-5711: remove extra space

* #bael-5711: remove extra space

---------

Co-authored-by: h_sharifi <h_sharifi@modernisc.com>

* BAEL-6334 Improve test names and typos

* BAEL-6179: Add Actuator sample without Spring Boot (#14032)

* BAEL-6179: Add Actuator sample without Spring Boot

* BAEL-6179: Simplify custom health indicator

* [JAVA-20624] Moved static-analysis module to jdk9-and-above-profile (#14026)

* change return type to optional

* Title: Array vs List Performance in Java (#14034)

This commit related to the article entitled "Array vs List Performance in Java".

* BAEL-6428 Make a Method Execute Only Once in Java

* 20616 (#14023)

* [JAVA-20616] Upgraded spring-spel module to jdk9-and-above profile

* [JAVA-20616]  Upgraded spring-websockets module to jdk9-and-above profile

* [JAVA-20616]  Upgraded spring-shell module to jdk9-and-above profile

---------

Co-authored-by: Dhawal Kapil <dhawalkapil@gmail.com>

* JAVA-21106: Adding javax-servlets module to jdk9 and above (#13974)

* JAVA-21106: Adding javax-servlets module to jdk9 and above

* JAVA-21106: Changes made for adding the method for runt he application

* JAVA-21106: Changes made for adding javax-servlets-2 modules to jdk-9 and above

* JAVA-21106: Changes made for adding linkrest  modules to jdk-9 and above

* JAVA-21106 : Changes made for adding jee-7 and ninija in default-jdk9-and-above profile

* JAVA-21106 : Changes made for adding resteasy,spark-java,struts-3,vraptor,wicket in default-jdk9-and-above profile

* JAVA-21106 : Changes made for removing ninja module

* JAVA-21106 : Changes made for removing ninja module fro  jdk-9 and above

* JAVA-21106: Changes made for cleaninhg pom.xml

* JAVA-21106: FIXING MAVEN VERISON FOR WICKET

* Java 20277 (#14046)

* JAVA-20277 GitHub Issue: Regarding article Introduction to JsonPath

* JAVA-20277 Code Review Changes

* JAVA-20167 Upgrade spring-data hibernate with external libraries specific modules to JDK 11 (#14022)

Co-authored-by: timis1 <noreplay@yahoo.com>

* JAVA-20166 Migrating spring-date-eclipselink (#13959)

* JAVA-20166 Migrating spring-date-eclipselink

* JAVA-20166 Fix failed tests address already bind

* JAVA-20166 Migrating spring-date-couchbase-2

* JAVA-20166 Replace with optional instead of returning null

---------

Co-authored-by: timis1 <noreplay@yahoo.com>

* JAVA-20164 Upgrade java hibernate specific modules to JDK 11 (#13900)

* JAVA-20164 Upgrade java hibernate specific modules to JDK 11

* JAVA-20164 Migrating java-jpa-2

* JAVA-20164 Migrating jnosql-artemis

* JAVA-20164 Migrating querydsl

* JAVA-20164 Migrating r2dbc

* JAVA-20164 Migrating redis

* JAVA-20164 Fixing test JPATextUnitTest#givenExam_whenSaveExam_thenReturnExpectedExam

* JAVA-20164 Fixing givenIdentityStrategy_whenCommitTransction_thenReturnPrimaryKey

* JAVA-20164 Changes after review

* JAVA-20164 Migrating java-cassandra to jdk8

* JAVA-20164 Fix legacy mode error

* Update pom.xml

---------

Co-authored-by: timis1 <noreplay@yahoo.com>
Co-authored-by: Dhawal Kapil <dhawalkapil@gmail.com>

* BAEL-5905 move article

* BAEL-5947: Moving a project to a different package (#14054)

* Revert "feat: BAEL-5947 External Debugging with JMXTerm (#13847)"

This reverts commit cce2ed68a4.

* BAEL-5947: Moving a project to a different package

* BAEL-4615: Create and Detect Memory Leak in Java (#14060)

* BAEL-6086: Customize WebFlux Exceptions in Spring Boot 3 (#13948)

* BAEL-6086: Added code for webflux default and custom exception along with Unit Tests

* BAEL-6086: added missing import

* BAEL-6086: reformatting

* BAEL-6086: reformatted code

---------

Co-authored-by: balasr3 <balamurugan.radhakrishnan@imgarena.com>

* BAEL-5575 (#14016)

* BAEL-5575

First commit of the example for the article:
https://drafts.baeldung.com/wp-admin/post.php?post=153774&action=edit

* BAEL-5575

Adjusted pom.xml

* BAEL-5575

Formatted source code

* BAEL-5575

Removed unused import

* BAEL-5575

Renamed UT to follow: https://docs.google.com/document/d/1iIeSPuYFG-jEtB8UbcxQnn2AI3OR2LWlnisNo2NUCL8/edit

* BAEL-5575

Modified pom.xml to define versions in  properties  as stated in:
https://docs.google.com/document/d/1iIeSPuYFG-jEtB8UbcxQnn2AI3OR2LWlnisNo2NUCL8/edit

* BAEL-5575

Changes checking the commands:
* mvn clean install
* mvn clean install -Dgib.enabled=false

* BAEL-5575

Set GB as the base language

* BAEL-6094 (#14043)

* Inital Commit for BAEL-6094

* Added the test

* Updated the test

* Convert Hashmap to JSON object in Java (#14070)

* Convert Hashmap to JSON object in Java

This commit is related to the article entitled "Convert Hashmap to JSON object in Java"

* Convert Hashmap to JSON object in Java

This commit is for the article "Convert Hashmap to JSON object in Java"

* Array vs List Performance in Java (#14078)

This commit is related to the article entitled "Array vs List Performance in Java"

* Bael-6331: Adding changes for creating and checking empty streams (#14047)

* BAEL-6331: Create EmptyStreams.java

* BAEL-6331: Create EmptyStreamsUnitTest.java

* JAVA-20163 Fix failed integration test with date creation comparison (#14080)

Co-authored-by: timis1 <noreplay@yahoo.com>

* JAVA-21440: Changes made for upgrade jooby module to 2.16.1 to make j… (#14064)

* JAVA-21440: Chnages made for upgrade jooby module to 2.16.1 to make java-17 compatable

* JAVA-21440: commenting redis code as this will only work in the local or infra should have a redis setup

* JAVA-21440 Minor cleanup (#14084)

* Delete README.md

* removed optional specific function

* changing unit test class name

* BAEL-6250: refactor: Move to spring-caching-2 since spring-caching is full

* Update README.md

* Update README.md

* BAEL-6460: Why is Scanner skipping nextLine() after using other next functions? (#14079)

* changing branch

* BAEL-6334 Make object properties example clearer

* [BAEL-6344] address PR comment

* JAVA-21305 : Changes made for adding ratpack module to jdk9-and above… (#14012)

* JAVA-21106 : Changes made for adding ratpack module to jdk9-and above module

* JAVA-21106 : Changes made for adding java-lite module to jdk9-and above module

* JAVA-21305: Changes made for cleaninhg pom.xml

* JAVA-21305: Changes made for cleaning pom.xml

* BOSS-21305: changes made for adding ninja in jdk9 above modeule

* JAVA-21305: Changes made as per review comments

* JAVA-21305: Changes made as per review comments

* JAVA-21305: Changes made as per review comments

* [JAVA-21134] (#14045)

* [JAVA-21134] Removed external repository from jgit module

* [JAVA-21134] Removed external repository from aws-miscellaneous module + upgraded dynamodblocal version

* [JAVA-21134] Removed external repository from apache-tapestry module

* TASK-20628 (#14074)

* [TASK-20628] Moved xml module to jdk9-and-above profile

* [TASK-20628] Moved xml-2 module to jdk9-and-above profile

* [JAVA-15027]Upgraded follow redirects for apache http client + moved … (#14092)

* [JAVA-15027]Upgraded follow redirects for apache http client + moved older version to apache-httpclient4 module

* [JAVA-15027] Added test case

* BAEL-6508 Code for the Solving Gson Parsing Errors article

* JAVA-21189: Formatting pom.xml modules starting from KLM (#14096)

* JAVA-21189: Formatting pom.xml modules starting from NOPQR (#14097)

* JAVA-21189: Formatting pom.xml modules starting from NOPQR (#14097)

* java-20079: upgrade apache-spark module libraries (#14087)

* [scanner-with-spaces] how to take input as String with spaces in Java… (#14044)

* [scanner-with-spaces] how to take input as String with spaces in Java using Scanner?y

* [scanner-with-spaces] fix typo

* [output-to-file] Write Console Output to Text File in Java (#14082)

* [output-to-file] Write Console Output to Text File in Java

* [output-to-file] rebase on the master

* Convert Hashmap to JSON object in Java (#14110)

This commit is for Convert Hashmap to JSON object in Java

* Generating Javadoc with Gradle (#14091)

* Generating Javadoc with Gradle

* Generating Javadoc with Gradle

* Generating Javadoc with Gradle

* BAEL-6179: Fix readme (#14088)

* BAEL-6179: Add Actuator sample without Spring Boot

* BAEL-6179: Simplify custom health indicator

* BAEL-6179: Fix description in README.md

* JAVA-21189:  changes made for formatting modules starting from S (#14106)

* JAVA-21189:  changes made for formatting modules starting from TVWX (#14107)

* JAVA_21305: Changes made for fix the Integration test faliures (#14113)

* JAVA-20164 Fix .._SEQ.NEXTVAL error (#14109)

Co-authored-by: timis1 <noreplay@yahoo.com>

* JAVA-15022 (#14099)

* [JAVA-15022] Moved 4.5 version code to apache-httpclient4 module

* [JAVA-15022] Upgraded code to 5.x version

* Array vs List Performance in Java (#14114)

This commit is related to the article entitled "Array vs List Performance in Java"

* BAEL-6461: What's the difference between Scanner next() and nextLine() methods? (#14057)

* JAVA-19670: changes made for upgrading jenkins module to jdk-9 above (#14105)

* JAVA-19670: changes made for upgrading jenkins module to jdk-9 above

* JAVA-19670: Changes made for adding jenkins-modules in jdk-9 and above profile

* JAVA_21106: Changes made for fixing test cases for jee-7 (#14115)

* Bael 5711: Securing Spring Boot API with API key and secret (#14102)

* #bael-5711: add source

* #bael-5711: remove extra space

* #bael-5711: remove extra space

* #bael-5711: remove extra space

* #bael-5711: add custom message

* #bael-5711: refactor return null

---------

Co-authored-by: h_sharifi <h_sharifi@modernisc.com>

---------

Co-authored-by: Loredana Crusoveanu <lore.crusoveanu@gmail.com>
Co-authored-by: 3hsan <56245694+ehsansasanian@users.noreply.github.com>
Co-authored-by: edizor <113095366+edizor@users.noreply.github.com>
Co-authored-by: Vini <34344290+vinipx@users.noreply.github.com>
Co-authored-by: Dhawal Kapil <dhawalkapil@gmail.com>
Co-authored-by: jsgrah-spring <jsgrah@hotmail.com>
Co-authored-by: jogra <joseph.sterling.grah@miles.no>
Co-authored-by: Azhwani <13301425+azhwani@users.noreply.github.com>
Co-authored-by: Kai Yuan <kent.yuan@Gmail.com>
Co-authored-by: panos-kakos <102670093+panos-kakos@users.noreply.github.com>
Co-authored-by: Michael Olayemi <michaelolayemi28@gmail.com>
Co-authored-by: mariudotsh <33603097+mariudotsh@users.noreply.github.com>
Co-authored-by: Mariusz Kaczmarczyk <to@mariu.sh>
Co-authored-by: anuragkumawat <anuragkumawat7@gmail.com>
Co-authored-by: Bipin kumar <sayy2bipin@gmail.com>
Co-authored-by: Shaun Phillips <61982125+ShaPhi7@users.noreply.github.com>
Co-authored-by: Alejamdro <alemolerio@gmail.com>
Co-authored-by: Daniel Strmecki <daniel.strmecki@gmail.com>
Co-authored-by: Arya <108480101+Dazzle-10@users.noreply.github.com>
Co-authored-by: Ana Peterlić <apeterlic@gmail.com>
Co-authored-by: Zahid Khan <63726443+zahikhan@users.noreply.github.com>
Co-authored-by: emanuel.trandafir <emanuel.trandafir@betvictor.com>
Co-authored-by: Kasra Madadipouya <kasra_mp@yahoo.com>
Co-authored-by: uzma <uzma.nasir@gmail.com>
Co-authored-by: thibault.faure <thibault.faure@mimacom.com>
Co-authored-by: ACHRAF TAITAI <43656331+achraftt@users.noreply.github.com>
Co-authored-by: Avin Buricha <avin.buricha@gmail.com>
Co-authored-by: Ulisses Lima <ulisseslima@users.noreply.github.com>
Co-authored-by: Bhaskar Ghosh Dastidar <dastidar.bhaskar@gmail.com>
Co-authored-by: Bhaskar <bhaskar.dastidar@freshworks.com>
Co-authored-by: Zahid Khan <Zahid.khan@globalpay.com>
Co-authored-by: Raj Kishor <30443297+rajkishorraj@users.noreply.github.com>
Co-authored-by: raj kishor <raj.kishor@smartcoin.co.in>
Co-authored-by: Gaetano Piazzolla <gae.piaz@gmail.com>
Co-authored-by: Eugene Kovko <37694937+eukovko@users.noreply.github.com>
Co-authored-by: Bahaa El-Din Helmy <bahaavampire@yahoo.com>
Co-authored-by: davidmartinezbarua <davmb5@gmail.com>
Co-authored-by: Anastasios Ioannidis <121166333+anastasiosioannidis@users.noreply.github.com>
Co-authored-by: Grzegorz Musiał <grzegorz@musial.tk>
Co-authored-by: Kilian Schneider <48420258+Basler182@users.noreply.github.com>
Co-authored-by: cesarevalenti90 <50798547+cesarevalenti90@users.noreply.github.com>
Co-authored-by: Cesare <cesare.valenti@hotmail.com>
Co-authored-by: brokenhardisk <brokenhardisk@gmail.com>
Co-authored-by: Sam Gardner <samgardner909@gmail.com>
Co-authored-by: timis1 <12120641+timis1@users.noreply.github.com>
Co-authored-by: n <noreplay@yahoo.com>
Co-authored-by: Dmytro Budym <46810751+dbudim@users.noreply.github.com>
Co-authored-by: Vartika Nigam <63852792+vnigam2702@users.noreply.github.com>
Co-authored-by: Vartika_Nigam <Vartika_Nigam@DellTeam.com>
Co-authored-by: emanueltrandafir1993 <emanueltrandafir1993@gmail.com>
Co-authored-by: Ehsan Sasanianno <ehsan.sasanian@gmail.com>
Co-authored-by: Dileesha Rajapakse <dileesha@wso2.com>
Co-authored-by: Maciej Główka <maciejglowka.pl@gmail.com>
Co-authored-by: thibaultfaure <thibault.faure.pro@gmail.com>
Co-authored-by: Saikat Chakraborty <40471715+saikatcse03@users.noreply.github.com>
Co-authored-by: Andrew Tarry <andrew.tarry@perrio.io>
Co-authored-by: Hamid Reza Sharifi <hmdrzsharifi@gmail.com>
Co-authored-by: h_sharifi <h_sharifi@modernisc.com>
Co-authored-by: Ralf Ueberfuhr <40685729+ueberfuhr@users.noreply.github.com>
Co-authored-by: Deboshree <deboshree.banerjee@cred.club>
Co-authored-by: AndiCover <a.schoengruber@gmx.net>
Co-authored-by: Balamurugan <balamurugan.radhakrishnan@gmail.com>
Co-authored-by: balasr3 <balamurugan.radhakrishnan@imgarena.com>
Co-authored-by: victorsempere <victor.sempere1@gmail.com>
Co-authored-by: Muhammad Asif <muasif80@gmail.com>
Co-authored-by: vaibhav007jain <72961247+vaibhav007jain@users.noreply.github.com>
Co-authored-by: Andrew Tarry <andrew.tarry@gmail.com>
Co-authored-by: ciphx <wordcipherer@gmail.com>

* [BAEL-5934] add code examples for article Listing All AWS S3 Objects in a Bucket Using Java

* merge source to fork master (#7)

* JAVA-20280: remove wrong property (#13874)

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

* Update README.md

[skip ci]

* JAVA-13721 Format, Fix Package, Upgrade version of all the articles

* JAVA-13721 Moved mockito-simple to JDK9+ profiles

* JAVA-20278. Please point me to the tutorial code #13768. (#13923)

Co-authored-by: jogra <joseph.sterling.grah@miles.no>

* BAEL-6352: Check if the First Letter of a String is a Number (#13883)

* [BAEL-6434_charAndString] Difference Between "char" and "String" (#13907)

* [JAVA-18185] Upgrade groovy version (#13926)

* Update code for Overview of NLP Libraries in Java (#13912)

* Update code for Overview of NLP Libraries in Java

* Update code for Overview of NLP Libraries in Java

* Update code for Overview of NLP Libraries in Java

* BAEL-6319 Hibernate 6 Boolean Converters (#13894)

Co-authored-by: Mariusz Kaczmarczyk <to@mariu.sh>

* BAEL-6194 Retrieve the Value of an HTML Input Using Selenium WebDriver in Java (#13898)

* Retrieve the Value of an HTML Input Using Selenium WebDriver in Java

* Retrieve the Value of an HTML Input Using Selenium WebDriver in Java

* Retrieve the Value of an HTML Input Using Selenium WebDriver in Java

* JAVA-20898 Check Article Code Matches GitHub

* Java 15032 (#13913)

* JAVA-15032: Changes made for adding the test cases custom userAgent in request  header

* JAVA-15032: Changes made for adding the test cases custom userAgent in request  header

* JAVA-15032: Changes made for incorporarting review comments

* JAVA-20931 Commented out spring-boot-3 for now because of JDK 19 requirement (#13936)

* BAEL-6325 Create core-java-lang-oop-constructors-2 (#13933)

* BAEL-5915 Added different ways to create an object

* BAEL-6325 Create core-java-lang-oop-constructors-2

* BAEL-6435: Reverse a String in Java 8 using Lambda and Streams (#13910)

* [JAVA-20456] Upgraded jackson version (#13871)

* [JAVA-20457] Upgraded springdoc version (#13872)

* [JAVA-20459] Upgraded org.json to latest version (#13869)

* BAEL-6327 - Find the index of an element in a Java array (#13844)

* JAVA-20898 Move article url from javaxval-2 to javaxval

* Java 20643 (#13914)

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: changes made for removing web-modules from default

* [BAEL-6436_printQuotesAroundString] Print "" Quotes Around a String in Java (#13925)

* JAVA-18113 Update spring-boot-swagger-keycloak module (#13506)

* JAVA-18113 Update spring-boot-swagger-keycloak module

* JAVA-16612: Mock Final Classes and Methods with Mockito article; MockMaker improvement (#13890)

* BAEL-6254: Scoped values (#13756)

* Added the code for "The difference between BufferedReader and FileReader". (#13942)

* BAEL-5814 - Is CompletableFuture Non-blocking (#13917)

* BAEL-5814 - Is CompletableFuture Non-blocking

* Fix the formatting

* BAEL-6326: Spring Boot H2 JdbcSQLSyntaxErrorException expected identifier (#13843)

* BAEL-6320: added code support for the @NaturalId article

* JAVA-16946: comment spring-jooq module from persistence-modules. (#13951)

* JAVA-20555 use Java Base64 instead of deprecated Spring Base64Utils (#13941)

* [BAEL-6105] code for list to page article

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* [BAEL-6105] code for list to page article

* [BAEL-6105] refactor test names

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* BAEL-6438 Code for the Find the longest word in a given string article

* BAEL-6332: Calling Non-Static Method In Static Method In Java (#13940)

* [BAEL-6485_RM-Punctuation] Remove Punctuation (#13946)

* BAEL-6410 (#13919)

* BAEL-6410 | Article code

* Adding consumer code for article

* BAEL-6046 MongoDB - Field Level Encryption (#13859)

* [BAEL-6253] record equals hashcode (#13958)

* [BAEL-6253] records equals and hashcode

* [BAEL-6253] records equals and hashcode

* [BAEL-6253] records equals and hashcode test case

---------

Co-authored-by: Bhaskar <bhaskar.dastidar@freshworks.com>

* [compByteArrays] Comparing Two Byte Arrays in Java (#13935)

* Remove Comments and update prefix.

* Uploading File using Selenium WebDriver in Java (#13947)

* Uploading File using Selenium WebDriver in Java

* Uploading File using Selenium WebDriver in Java

* Uploading File using Selenium WebDriver in Java

* Uploading File using Selenium WebDriver in Java

* [rajkishorraj185@gmail.com] Lombok equalsandhashcode annotation (#13717)

* example code for equalsandhashcode annotation

* moving codes to lombok-2

---------

Co-authored-by: raj kishor <raj.kishor@smartcoin.co.in>

* Match prefix same as draft.

* JAVA-19152: fix intermittently failing RequestProcessorUnitTest (#13957)

* [JAVA-19362] Upgraded itextpdf to 5.5.13.3 (#13961)

* JAVA-16946: disable unit test for core-java-lang-oop-modifiers module for maintenance (#13968)

* BAEL-6444 | Added P6Spy logging in spring boot observation module. (#13965)

* BAEL-6444 | Added P6Spy logging in spring boot observation module.

* BAEL-6444 | Added Find with name query and custom log format now working

* BAEL-6444 | Formatting

* BAEL-6444 | Renaming junit files

* BAEL-6444 | Added start class

* BAEL-6444 | Actualized code with Article

* BAEL-6444 | Actualized code with Article

* BAEL-6444 | redded commit()

* BAEL-6444 | BDD naming strategy

* BAEL-6501 Update article "The producer-consumer problem example in Java" (#13973)

* BAEL-6501 Changed the synchronization block to use the DataQueue

* BAEL-6501 Fixed the platform agnostic new lines

* BAEL-6501 Moved ID increment to a static method

* BAEL-6501 Added a logger

* Add files via upload (#13978)

* JAVA-19152 Increased the awaitility timeout for one more poll delay (#13975)

* BAEL-6250: Example code for Get All Caffeine Cache Keys article (#13806)

* BAEL-6185 reuse string builder performance (#13791)

* BAEL-6444 | Removed copyright commit (#13987)

* JAVA-18648 Review the time of the build - Week 9 - 2023 (#13954)

* JAVA-20277 GitHub Issue: Regarding article Introduction to JsonPath (#13939)

* BAEL-6197 - Execute Tests Based on Active Profile with JUnit 5 (#13776)

* BAEL-6255 - Run a Spring Boot application in AWS Lambda

* BAEL-6255 - Run a Spring Boot application in AWS Lambda

* fix on template.yaml

* fix on template.yaml

* removed log from test

* resolved issues reported on PR

* BAEL-6277 - A Guide To Spring Cloud Azure

First commit

* BAEL-6277 - A Guide To Spring Cloud Azure

Added to README.md the steps to create the secrets

* BAEL-6277 - A Guide To Spring Cloud Azure

Added the integration Azure Key Vault Properties

* BAEL-6277 - A Guide To Spring Cloud Azure

Added the integration Azure Key Vault Properties

* BAEL-6277 - A Guide To Spring Cloud Azure Key Vault

Added one level package keyvault

* BAEL-6277 - A Guide To Spring Cloud Azure Key Vault

removed target release version

* BAEL-6277 - A Guide To Spring Cloud Azure Key Vault

fix compilation of NoSuchElementException

* BAEL-6277 - A Guide To Spring Cloud Azure Key Vault

fix pom.xml

* Revert "BAEL-6277 - A Guide To Spring Cloud Azure Key Vault"

This reverts commit 1cca1d0d69.

* BAEL-6277 - A Guide To Spring Cloud Azure Key Vault

fix pom.xml

* BAEL-6277 - A Guide To Spring Cloud Azure Key Vault

downgrade version to fix jenkins pipeline error

* BAEL-6277 - A Guide To Spring Cloud Azure Key Vault

comment run on main class

* Revert "reset last commit"

This reverts commit c557fad67f1c15bb384f0af5781430a45121a838.

* BAEL 6197 - Execute Tests Based on Active Profile with JUnit 5

#First push

* BAEL-6277 - A Guide To Spring Cloud Azure Key Vault

Revert for new pr

* reset last commit

* reset last commit

* BAEL 6197 - Execute Tests Based on Active Profile with JUnit 5

#Remove redundant test

* BAEL 6197 - Execute Tests Based on Active Profile with JUnit 5

#Format fix

* BAEL 6197 - Execute Tests Based on Active Profile with JUnit 5

#fix from review

* BAEL 6197 - Execute Tests Based on Active Profile with JUnit 5

#fix from review

* BAEL 6197 - Execute Tests Based on Active Profile with JUnit 5

#fix test name

---------

Co-authored-by: Cesare <cesare.valenti@hotmail.com>

* [scanner-to-array] Saving Java Scanner Input to an Array (#13969)

* BAEL-6342 JUnit Test Class for Null and Empty String (#13963)

* JAVA-20630 upgrade maven war plugin to be compatible with JDK 11 and 17 (#13945)

* JAVA-20630 upgrade maven war plugin to be compatible with JDK 11 and 17

* JAVA-20630 code format

* JAVA-20630 don't fail if there's no web.xml and using Java based configuration while building a war file

* JAVA-20630 avoid unneeded formatting

* JAVA-20630 change order of modules to solve flaky tests

* fix module order

* add dependent module

* add parent

* JAVA-20828 Fixing the core-java-exclusions module (#13997)

* Upgrade spring.vault.core from 2.3.2 to 3.0.2 (#13977)

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Create README.md

[skip ci]

* Update README.md

[skip ci]

* Title: Regular Expression: \z vs \Z Anchors in Java (#13994)

Hello,
This commit related to the article entitled "Regular Expression: \z vs \Z Anchors in Java"

* JAVA-20828: Changes made for updating blade module to java 11 (#13929)

* JAVA-20828: Changes made for updating blade module to java 11

* JAVA-20828: Changes made for updating bootique,dropwizard,google-web-toolkit  module to java 11

* JAVA-20828: Changes made for updating bootique,dropwizard,google-web-toolkit  module to java 11

* JAVA-20828: Adding jakarta-ee to jdk-9 profile

* BAEL-6334 Add example code for checking if a list element is in another list

* JAVA-20610 Upgraded parent-boot-2 to 2.7.11 (#13944)

* JAVA-20163 Upgrade hibernate specific modules to JDK 11 (#13817)

* JAVA-20163 Migration hibernate-annotations

* JAVA-20163 Migrate hibernate-queries

* JAVA-20163 Migrating hibernate-mapping

* JAVA-20163 rename reserved keywords, update inheritance example

* JAVA-20163 Migrate hibernate-ogm module to the jdk 8 because hibernate-ogm doesn't support jakarta API

* JAVA-20163 Migrate hibernate-enterprise module

* JAVA-20163 Add update to HibernateExceptionUnitTest#whenQueryExecutedWithUnmappedEntity_thenMappingException

* JAVA-20163 Set explicit version for hibernate 6.1.7.Final in the hibernate-queries module

* JAVA-20163 Fix failed test with port that already exists (giving another port 8088)

* JAVA-20163 Fix other location after changing the port

* JAVA-20163 Remove duplicate Unit Test

---------

Co-authored-by: n <noreplay@yahoo.com>
Co-authored-by: Loredana Crusoveanu <lore.crusoveanu@gmail.com>

* JAVA-20165 Upgrade spring-boot hibernate specific modules to JDK 11 (#13952)

* JAVA-20165 Upgrade spring-boot hibernate specific modules to JDK 11

* JAVA-20165 Migrating spring-boot-persistence-mongodb

* JAVA-20165 Migrating spring-boot-persistence-mongodb-2

* JAVA-20165 Migrating spring-boot-persistence-mongodb-3

* JAVA-20165 Adding latest version for jdbi in spring-boot-persistence-2 module

---------

Co-authored-by: timis1 <noreplay@yahoo.com>

* [Check If a Specified Key Exists in a Given S3 Bucket using Java] added code examples (#13775)

* [Check If a Specified Key Exists in a Given S3 Bucket using Java]] added code examples for

change test name

remove link from README.md

* - used env variables for AWS credentials
- used codestyle profile of baledung

* [os-to-is] Convert an OutputStream to an InputStream (#13992)

* BAEL-6264 added class to show how to instantiate ArrayBlockingQueue a… (#13851)

* BAEL-6264 added class to show how to instantiate ArrayBlockingQueue and LinkedBlockingQueue

* BAEL-6264 added unit test case

* modified test case

* BAEL-6264 deleted BlockingQueueImplExample file not needed anymore

* BAEL-6264 code review changes moved class file to different module

---------

Co-authored-by: Vartika_Nigam <Vartika_Nigam@DellTeam.com>

* Add code examples for "Opening a New Tab Using Selenium WebDriver in Java" (#14001)

Add code examples for "Opening a New Tab Using Selenium WebDriver in Java"

* BAEL-6320: format & code review

* JAVA-16946 Upgrade h2 database version for remaining modules (#13976)

* Add java interface single implementation examples (#13972)

* Fix formatting issues, refactor the `profiles` word in the properties.

* Add files via upload (#14006)

* JAVA-20828 Fixed module name (#14018)

* fix SeleniumOpenNewTabLiveTest (#14019)

* BAEL-6493 - Read last N messages from a Kafka Topic (#14020)

* BAEL-6398: Java PrintStream to String (#13998)

* Revert "JAVA-20280: remove wrong property (#13874)" (#14021)

This reverts commit 58d9bcb3b4.

* Hashing with Argon2 in Java (#14009)

* Hashing with Argon2 in Java

* Hashing with Argon2 in Java

* JAVA-13721 Fixing the formatting

* JAVA-13721 Further formatting of files

* BAEL-4369: Multiple ways of declaring dependency versions in Gradle (#13825)

* BAEL-6246 Code for the article Send MultipartFile Request with RestAs… (#13803)

* BAEL-6246 Code for the article Send MultipartFile Request with RestAssured

* Fix code style in rest assured integration tests

---------

Co-authored-by: thibault.faure <thibault.faure@mimacom.com>

* Bael 4582: Custom Authentication using shared secret (#13801)

* Spring custom security filter add

* Integration Tests add

* Add Project into parent pom

* refactor code

* refactor code

* remove .env and refactor code

* refactor code

* exclude auto configuration

* Refactored code

* removed ssl certificate for security

* Set session management to statelees

* Refactor tests

* Refactor authentication logic

* Refactor authentication logic

* Refactor authentication logic

* Remove unused code

* Remove unused code

* Remove unused appconfig

* disable AWSS3ObjectIntegrationTest due to need real credentials (#14028)

make AWSS3ObjectIntegrationTest manual

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* JAVA-20828: changes made for resolving botique module (#14027)

* [JAVA-20626]Moved vertx-modules to jdk9-and-above profile + upgraded vertx version to 3.9.15 (#13960)

* [JAVA-20633  Clean up modules (#14024)

* add value of comparision

* [BAEL-6339] custom iterator with testcases (#14038)

Co-authored-by: Bhaskar <bhaskar.dastidar@freshworks.com>

* BAEL-6246 Fix AppControllerIntegrationTest (#14039)

Co-authored-by: thibault.faure <thibault.faure@mimacom.com>

* JAVA-20946 Renamed HttpBinServiceUnitTest to LiveTest (#14041)

- Since it is making actual live request to httpbin.org

* JAVA-21186 Fix references to parents - Week 21 - 2023 (#14036)

* JAVA-20630 move the jws module to  *-jdk9-and-above profiles (#14030)

* JAVA-20631 move Jetbrains module to *-jdk9-and-above profiles (#14029)

* JAVA-20631 move Jetbrains module to *-jdk9-and-above profiles

* JAVA-20631 fix parent modules so that the project parent (pom.xml) can be built without error

* BAEL-5711: Securing Spring Boot API with API key and secret (#14015)

* #bael-5711: add source

* #bael-5711: remove extra space

* #bael-5711: remove extra space

* #bael-5711: remove extra space

---------

Co-authored-by: h_sharifi <h_sharifi@modernisc.com>

* BAEL-6334 Improve test names and typos

* BAEL-6179: Add Actuator sample without Spring Boot (#14032)

* BAEL-6179: Add Actuator sample without Spring Boot

* BAEL-6179: Simplify custom health indicator

* [JAVA-20624] Moved static-analysis module to jdk9-and-above-profile (#14026)

* change return type to optional

* Title: Array vs List Performance in Java (#14034)

This commit related to the article entitled "Array vs List Performance in Java".

* BAEL-6428 Make a Method Execute Only Once in Java

* 20616 (#14023)

* [JAVA-20616] Upgraded spring-spel module to jdk9-and-above profile

* [JAVA-20616]  Upgraded spring-websockets module to jdk9-and-above profile

* [JAVA-20616]  Upgraded spring-shell module to jdk9-and-above profile

---------

Co-authored-by: Dhawal Kapil <dhawalkapil@gmail.com>

* JAVA-21106: Adding javax-servlets module to jdk9 and above (#13974)

* JAVA-21106: Adding javax-servlets module to jdk9 and above

* JAVA-21106: Changes made for adding the method for runt he application

* JAVA-21106: Changes made for adding javax-servlets-2 modules to jdk-9 and above

* JAVA-21106: Changes made for adding linkrest  modules to jdk-9 and above

* JAVA-21106 : Changes made for adding jee-7 and ninija in default-jdk9-and-above profile

* JAVA-21106 : Changes made for adding resteasy,spark-java,struts-3,vraptor,wicket in default-jdk9-and-above profile

* JAVA-21106 : Changes made for removing ninja module

* JAVA-21106 : Changes made for removing ninja module fro  jdk-9 and above

* JAVA-21106: Changes made for cleaninhg pom.xml

* JAVA-21106: FIXING MAVEN VERISON FOR WICKET

* Java 20277 (#14046)

* JAVA-20277 GitHub Issue: Regarding article Introduction to JsonPath

* JAVA-20277 Code Review Changes

* JAVA-20167 Upgrade spring-data hibernate with external libraries specific modules to JDK 11 (#14022)

Co-authored-by: timis1 <noreplay@yahoo.com>

* JAVA-20166 Migrating spring-date-eclipselink (#13959)

* JAVA-20166 Migrating spring-date-eclipselink

* JAVA-20166 Fix failed tests address already bind

* JAVA-20166 Migrating spring-date-couchbase-2

* JAVA-20166 Replace with optional instead of returning null

---------

Co-authored-by: timis1 <noreplay@yahoo.com>

* JAVA-20164 Upgrade java hibernate specific modules to JDK 11 (#13900)

* JAVA-20164 Upgrade java hibernate specific modules to JDK 11

* JAVA-20164 Migrating java-jpa-2

* JAVA-20164 Migrating jnosql-artemis

* JAVA-20164 Migrating querydsl

* JAVA-20164 Migrating r2dbc

* JAVA-20164 Migrating redis

* JAVA-20164 Fixing test JPATextUnitTest#givenExam_whenSaveExam_thenReturnExpectedExam

* JAVA-20164 Fixing givenIdentityStrategy_whenCommitTransction_thenReturnPrimaryKey

* JAVA-20164 Changes after review

* JAVA-20164 Migrating java-cassandra to jdk8

* JAVA-20164 Fix legacy mode error

* Update pom.xml

---------

Co-authored-by: timis1 <noreplay@yahoo.com>
Co-authored-by: Dhawal Kapil <dhawalkapil@gmail.com>

* BAEL-5905 move article

* BAEL-5947: Moving a project to a different package (#14054)

* Revert "feat: BAEL-5947 External Debugging with JMXTerm (#13847)"

This reverts commit cce2ed68a4.

* BAEL-5947: Moving a project to a different package

* BAEL-4615: Create and Detect Memory Leak in Java (#14060)

* BAEL-6086: Customize WebFlux Exceptions in Spring Boot 3 (#13948)

* BAEL-6086: Added code for webflux default and custom exception along with Unit Tests

* BAEL-6086: added missing import

* BAEL-6086: reformatting

* BAEL-6086: reformatted code

---------

Co-authored-by: balasr3 <balamurugan.radhakrishnan@imgarena.com>

* BAEL-5575 (#14016)

* BAEL-5575

First commit of the example for the article:
https://drafts.baeldung.com/wp-admin/post.php?post=153774&action=edit

* BAEL-5575

Adjusted pom.xml

* BAEL-5575

Formatted source code

* BAEL-5575

Removed unused import

* BAEL-5575

Renamed UT to follow: https://docs.google.com/document/d/1iIeSPuYFG-jEtB8UbcxQnn2AI3OR2LWlnisNo2NUCL8/edit

* BAEL-5575

Modified pom.xml to define versions in  properties  as stated in:
https://docs.google.com/document/d/1iIeSPuYFG-jEtB8UbcxQnn2AI3OR2LWlnisNo2NUCL8/edit

* BAEL-5575

Changes checking the commands:
* mvn clean install
* mvn clean install -Dgib.enabled=false

* BAEL-5575

Set GB as the base language

* BAEL-6094 (#14043)

* Inital Commit for BAEL-6094

* Added the test

* Updated the test

* Convert Hashmap to JSON object in Java (#14070)

* Convert Hashmap to JSON object in Java

This commit is related to the article entitled "Convert Hashmap to JSON object in Java"

* Convert Hashmap to JSON object in Java

This commit is for the article "Convert Hashmap to JSON object in Java"

* Array vs List Performance in Java (#14078)

This commit is related to the article entitled "Array vs List Performance in Java"

* Bael-6331: Adding changes for creating and checking empty streams (#14047)

* BAEL-6331: Create EmptyStreams.java

* BAEL-6331: Create EmptyStreamsUnitTest.java

* JAVA-20163 Fix failed integration test with date creation comparison (#14080)

Co-authored-by: timis1 <noreplay@yahoo.com>

* JAVA-21440: Changes made for upgrade jooby module to 2.16.1 to make j… (#14064)

* JAVA-21440: Chnages made for upgrade jooby module to 2.16.1 to make java-17 compatable

* JAVA-21440: commenting redis code as this will only work in the local or infra should have a redis setup

* JAVA-21440 Minor cleanup (#14084)

* Delete README.md

* removed optional specific function

* changing unit test class name

* BAEL-6250: refactor: Move to spring-caching-2 since spring-caching is full

* Update README.md

* Update README.md

* BAEL-6460: Why is Scanner skipping nextLine() after using other next functions? (#14079)

* changing branch

* BAEL-6334 Make object properties example clearer

* [BAEL-6344] address PR comment

* JAVA-21305 : Changes made for adding ratpack module to jdk9-and above… (#14012)

* JAVA-21106 : Changes made for adding ratpack module to jdk9-and above module

* JAVA-21106 : Changes made for adding java-lite module to jdk9-and above module

* JAVA-21305: Changes made for cleaninhg pom.xml

* JAVA-21305: Changes made for cleaning pom.xml

* BOSS-21305: changes made for adding ninja in jdk9 above modeule

* JAVA-21305: Changes made as per review comments

* JAVA-21305: Changes made as per review comments

* JAVA-21305: Changes made as per review comments

* [JAVA-21134] (#14045)

* [JAVA-21134] Removed external repository from jgit module

* [JAVA-21134] Removed external repository from aws-miscellaneous module + upgraded dynamodblocal version

* [JAVA-21134] Removed external repository from apache-tapestry module

* TASK-20628 (#14074)

* [TASK-20628] Moved xml module to jdk9-and-above profile

* [TASK-20628] Moved xml-2 module to jdk9-and-above profile

* [JAVA-15027]Upgraded follow redirects for apache http client + moved … (#14092)

* [JAVA-15027]Upgraded follow redirects for apache http client + moved older version to apache-httpclient4 module

* [JAVA-15027] Added test case

* BAEL-6508 Code for the Solving Gson Parsing Errors article

* JAVA-21189: Formatting pom.xml modules starting from KLM (#14096)

* JAVA-21189: Formatting pom.xml modules starting from NOPQR (#14097)

* JAVA-21189: Formatting pom.xml modules starting from NOPQR (#14097)

* java-20079: upgrade apache-spark module libraries (#14087)

* [scanner-with-spaces] how to take input as String with spaces in Java… (#14044)

* [scanner-with-spaces] how to take input as String with spaces in Java using Scanner?y

* [scanner-with-spaces] fix typo

* [output-to-file] Write Console Output to Text File in Java (#14082)

* [output-to-file] Write Console Output to Text File in Java

* [output-to-file] rebase on the master

* Convert Hashmap to JSON object in Java (#14110)

This commit is for Convert Hashmap to JSON object in Java

* Generating Javadoc with Gradle (#14091)

* Generating Javadoc with Gradle

* Generating Javadoc with Gradle

* Generating Javadoc with Gradle

* BAEL-6179: Fix readme (#14088)

* BAEL-6179: Add Actuator sample without Spring Boot

* BAEL-6179: Simplify custom health indicator

* BAEL-6179: Fix description in README.md

* JAVA-21189:  changes made for formatting modules starting from S (#14106)

* JAVA-21189:  changes made for formatting modules starting from TVWX (#14107)

* JAVA_21305: Changes made for fix the Integration test faliures (#14113)

* JAVA-20164 Fix .._SEQ.NEXTVAL error (#14109)

Co-authored-by: timis1 <noreplay@yahoo.com>

* JAVA-15022 (#14099)

* [JAVA-15022] Moved 4.5 version code to apache-httpclient4 module

* [JAVA-15022] Upgraded code to 5.x version

* Array vs List Performance in Java (#14114)

This commit is related to the article entitled "Array vs List Performance in Java"

* BAEL-6461: What's the difference between Scanner next() and nextLine() methods? (#14057)

* JAVA-19670: changes made for upgrading jenkins module to jdk-9 above (#14105)

* JAVA-19670: changes made for upgrading jenkins module to jdk-9 above

* JAVA-19670: Changes made for adding jenkins-modules in jdk-9 and above profile

* JAVA_21106: Changes made for fixing test cases for jee-7 (#14115)

* Bael 5711: Securing Spring Boot API with API key and secret (#14102)

* #bael-5711: add source

* #bael-5711: remove extra space

* #bael-5711: remove extra space

* #bael-5711: remove extra space

* #bael-5711: add custom message

* #bael-5711: refactor return null

---------

Co-authored-by: h_sharifi <h_sharifi@modernisc.com>

---------

Co-authored-by: Loredana Crusoveanu <lore.crusoveanu@gmail.com>
Co-authored-by: 3hsan <56245694+ehsansasanian@users.noreply.github.com>
Co-authored-by: edizor <113095366+edizor@users.noreply.github.com>
Co-authored-by: Vini <34344290+vinipx@users.noreply.github.com>
Co-authored-by: Dhawal Kapil <dhawalkapil@gmail.com>
Co-authored-by: jsgrah-spring <jsgrah@hotmail.com>
Co-authored-by: jogra <joseph.sterling.grah@miles.no>
Co-authored-by: Azhwani <13301425+azhwani@users.noreply.github.com>
Co-authored-by: Kai Yuan <kent.yuan@Gmail.com>
Co-authored-by: panos-kakos <102670093+panos-kakos@users.noreply.github.com>
Co-authored-by: Michael Olayemi <michaelolayemi28@gmail.com>
Co-authored-by: mariudotsh <33603097+mariudotsh@users.noreply.github.com>
Co-authored-by: Mariusz Kaczmarczyk <to@mariu.sh>
Co-authored-by: anuragkumawat <anuragkumawat7@gmail.com>
Co-authored-by: Bipin kumar <sayy2bipin@gmail.com>
Co-authored-by: Shaun Phillips <61982125+ShaPhi7@users.noreply.github.com>
Co-authored-by: Alejamdro <alemolerio@gmail.com>
Co-authored-by: Daniel Strmecki <daniel.strmecki@gmail.com>
Co-authored-by: Arya <108480101+Dazzle-10@users.noreply.github.com>
Co-authored-by: Ana Peterlić <apeterlic@gmail.com>
Co-authored-by: Zahid Khan <63726443+zahikhan@users.noreply.github.com>
Co-authored-by: emanuel.trandafir <emanuel.trandafir@betvictor.com>
Co-authored-by: Kasra Madadipouya <kasra_mp@yahoo.com>
Co-authored-by: uzma <uzma.nasir@gmail.com>
Co-authored-by: thibault.faure <thibault.faure@mimacom.com>
Co-authored-by: ACHRAF TAITAI <43656331+achraftt@users.noreply.github.com>
Co-authored-by: Avin Buricha <avin.buricha@gmail.com>
Co-authored-by: Ulisses Lima <ulisseslima@users.noreply.github.com>
Co-authored-by: Bhaskar Ghosh Dastidar <dastidar.bhaskar@gmail.com>
Co-authored-by: Bhaskar <bhaskar.dastidar@freshworks.com>
Co-authored-by: Zahid Khan <Zahid.khan@globalpay.com>
Co-authored-by: Raj Kishor <30443297+rajkishorraj@users.noreply.github.com>
Co-authored-by: raj kishor <raj.kishor@smartcoin.co.in>
Co-authored-by: Gaetano Piazzolla <gae.piaz@gmail.com>
Co-authored-by: Eugene Kovko <37694937+eukovko@users.noreply.github.com>
Co-authored-by: Bahaa El-Din Helmy <bahaavampire@yahoo.com>
Co-authored-by: davidmartinezbarua <davmb5@gmail.com>
Co-authored-by: Anastasios Ioannidis <121166333+anastasiosioannidis@users.noreply.github.com>
Co-authored-by: Grzegorz Musiał <grzegorz@musial.tk>
Co-authored-by: Kilian Schneider <48420258+Basler182@users.noreply.github.com>
Co-authored-by: cesarevalenti90 <50798547+cesarevalenti90@users.noreply.github.com>
Co-authored-by: Cesare <cesare.valenti@hotmail.com>
Co-authored-by: brokenhardisk <brokenhardisk@gmail.com>
Co-authored-by: Sam Gardner <samgardner909@gmail.com>
Co-authored-by: timis1 <12120641+timis1@users.noreply.github.com>
Co-authored-by: n <noreplay@yahoo.com>
Co-authored-by: Dmytro Budym <46810751+dbudim@users.noreply.github.com>
Co-authored-by: Vartika Nigam <63852792+vnigam2702@users.noreply.github.com>
Co-authored-by: Vartika_Nigam <Vartika_Nigam@DellTeam.com>
Co-authored-by: emanueltrandafir1993 <emanueltrandafir1993@gmail.com>
Co-authored-by: Ehsan Sasanianno <ehsan.sasanian@gmail.com>
Co-authored-by: Dileesha Rajapakse <dileesha@wso2.com>
Co-authored-by: Maciej Główka <maciejglowka.pl@gmail.com>
Co-authored-by: thibaultfaure <thibault.faure.pro@gmail.com>
Co-authored-by: Saikat Chakraborty <40471715+saikatcse03@users.noreply.github.com>
Co-authored-by: Andrew Tarry <andrew.tarry@perrio.io>
Co-authored-by: Hamid Reza Sharifi <hmdrzsharifi@gmail.com>
Co-authored-by: h_sharifi <h_sharifi@modernisc.com>
Co-authored-by: Ralf Ueberfuhr <40685729+ueberfuhr@users.noreply.github.com>
Co-authored-by: Deboshree <deboshree.banerjee@cred.club>
Co-authored-by: AndiCover <a.schoengruber@gmx.net>
Co-authored-by: Balamurugan <balamurugan.radhakrishnan@gmail.com>
Co-authored-by: balasr3 <balamurugan.radhakrishnan@imgarena.com>
Co-authored-by: victorsempere <victor.sempere1@gmail.com>
Co-authored-by: Muhammad Asif <muasif80@gmail.com>
Co-authored-by: vaibhav007jain <72961247+vaibhav007jain@users.noreply.github.com>
Co-authored-by: Andrew Tarry <andrew.tarry@gmail.com>
Co-authored-by: ciphx <wordcipherer@gmail.com>

* Merge source to fork (#8)

* JAVA-20280: remove wrong property (#13874)

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

* Update README.md

[skip ci]

* JAVA-13721 Format, Fix Package, Upgrade version of all the articles

* JAVA-13721 Moved mockito-simple to JDK9+ profiles

* JAVA-20278. Please point me to the tutorial code #13768. (#13923)

Co-authored-by: jogra <joseph.sterling.grah@miles.no>

* BAEL-6352: Check if the First Letter of a String is a Number (#13883)

* [BAEL-6434_charAndString] Difference Between "char" and "String" (#13907)

* [JAVA-18185] Upgrade groovy version (#13926)

* Update code for Overview of NLP Libraries in Java (#13912)

* Update code for Overview of NLP Libraries in Java

* Update code for Overview of NLP Libraries in Java

* Update code for Overview of NLP Libraries in Java

* BAEL-6319 Hibernate 6 Boolean Converters (#13894)

Co-authored-by: Mariusz Kaczmarczyk <to@mariu.sh>

* BAEL-6194 Retrieve the Value of an HTML Input Using Selenium WebDriver in Java (#13898)

* Retrieve the Value of an HTML Input Using Selenium WebDriver in Java

* Retrieve the Value of an HTML Input Using Selenium WebDriver in Java

* Retrieve the Value of an HTML Input Using Selenium WebDriver in Java

* JAVA-20898 Check Article Code Matches GitHub

* Java 15032 (#13913)

* JAVA-15032: Changes made for adding the test cases custom userAgent in request  header

* JAVA-15032: Changes made for adding the test cases custom userAgent in request  header

* JAVA-15032: Changes made for incorporarting review comments

* JAVA-20931 Commented out spring-boot-3 for now because of JDK 19 requirement (#13936)

* BAEL-6325 Create core-java-lang-oop-constructors-2 (#13933)

* BAEL-5915 Added different ways to create an object

* BAEL-6325 Create core-java-lang-oop-constructors-2

* BAEL-6435: Reverse a String in Java 8 using Lambda and Streams (#13910)

* [JAVA-20456] Upgraded jackson version (#13871)

* [JAVA-20457] Upgraded springdoc version (#13872)

* [JAVA-20459] Upgraded org.json to latest version (#13869)

* BAEL-6327 - Find the index of an element in a Java array (#13844)

* JAVA-20898 Move article url from javaxval-2 to javaxval

* Java 20643 (#13914)

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: Changes made for updating apache-tapestry module to java 11

* JAVA-20643: changes made for removing web-modules from default

* [BAEL-6436_printQuotesAroundString] Print "" Quotes Around a String in Java (#13925)

* JAVA-18113 Update spring-boot-swagger-keycloak module (#13506)

* JAVA-18113 Update spring-boot-swagger-keycloak module

* JAVA-16612: Mock Final Classes and Methods with Mockito article; MockMaker improvement (#13890)

* BAEL-6254: Scoped values (#13756)

* Added the code for "The difference between BufferedReader and FileReader". (#13942)

* BAEL-5814 - Is CompletableFuture Non-blocking (#13917)

* BAEL-5814 - Is CompletableFuture Non-blocking

* Fix the formatting

* BAEL-6326: Spring Boot H2 JdbcSQLSyntaxErrorException expected identifier (#13843)

* BAEL-6320: added code support for the @NaturalId article

* JAVA-16946: comment spring-jooq module from persistence-modules. (#13951)

* JAVA-20555 use Java Base64 instead of deprecated Spring Base64Utils (#13941)

* [BAEL-6105] code for list to page article

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* [BAEL-6105] code for list to page article

* [BAEL-6105] refactor test names

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* BAEL-6438 Code for the Find the longest word in a given string article

* BAEL-6332: Calling Non-Static Method In Static Method In Java (#13940)

* [BAEL-6485_RM-Punctuation] Remove Punctuation (#13946)

* BAEL-6410 (#13919)

* BAEL-6410 | Article code

* Adding consumer code for article

* BAEL-6046 MongoDB - Field Level Encryption (#13859)

* [BAEL-6253] record equals hashcode (#13958)

* [BAEL-6253] records equals and hashcode

* [BAEL-6253] records equals and hashcode

* [BAEL-6253] records equals and hashcode test case

---------

Co-authored-by: Bhaskar <bhaskar.dastidar@freshworks.com>

* [compByteArrays] Comparing Two Byte Arrays in Java (#13935)

* Remove Comments and update prefix.

* Uploading File using Selenium WebDriver in Java (#13947)

* Uploading File using Selenium WebDriver in Java

* Uploading File using Selenium WebDriver in Java

* Uploading File using Selenium WebDriver in Java

* Uploading File using Selenium WebDriver in Java

* [rajkishorraj185@gmail.com] Lombok equalsandhashcode annotation (#13717)

* example code for equalsandhashcode annotation

* moving codes to lombok-2

---------

Co-authored-by: raj kishor <raj.kishor@smartcoin.co.in>

* Match prefix same as draft.

* JAVA-19152: fix intermittently failing RequestProcessorUnitTest (#13957)

* [JAVA-19362] Upgraded itextpdf to 5.5.13.3 (#13961)

* JAVA-16946: disable unit test for core-java-lang-oop-modifiers module for maintenance (#13968)

* BAEL-6444 | Added P6Spy logging in spring boot observation module. (#13965)

* BAEL-6444 | Added P6Spy logging in spring boot observation module.

* BAEL-6444 | Added Find with name query and custom log format now working

* BAEL-6444 | Formatting

* BAEL-6444 | Renaming junit files

* BAEL-6444 | Added start class

* BAEL-6444 | Actualized code with Article

* BAEL-6444 | Actualized code with Article

* BAEL-6444 | redded commit()

* BAEL-6444 | BDD naming strategy

* BAEL-6501 Update article "The producer-consumer problem example in Java" (#13973)

* BAEL-6501 Changed the synchronization block to use the DataQueue

* BAEL-6501 Fixed the platform agnostic new lines

* BAEL-6501 Moved ID increment to a static method

* BAEL-6501 Added a logger

* Add files via upload (#13978)

* JAVA-19152 Increased the awaitility timeout for one more poll delay (#13975)

* BAEL-6250: Example code for Get All Caffeine Cache Keys article (#13806)

* BAEL-6185 reuse string builder performance (#13791)

* BAEL-6444 | Removed copyright commit (#13987)

* JAVA-18648 Review the time of the build - Week 9 - 2023 (#13954)

* JAVA-20277 GitHub Issue: Regarding article Introduction to JsonPath (#13939)

* BAEL-6197 - Execute Tests Based on Active Profile with JUnit 5 (#13776)

* BAEL-6255 - Run a Spring Boot application in AWS Lambda

* BAEL-6255 - Run a Spring Boot application in AWS Lambda

* fix on template.yaml

* fix on template.yaml

* removed log from test

* resolved issues reported on PR

* BAEL-6277 - A Guide To Spring Cloud Azure

First commit

* BAEL-6277 - A Guide To Spring Cloud Azure

Added to README.md the steps to create the secrets

* BAEL-6277 - A Guide To Spring Cloud Azure

Added the integration Azure Key Vault Properties

* BAEL-6277 - A Guide To Spring Cloud Azure

Added the integration Azure Key Vault Properties

* BAEL-6277 - A Guide To Spring Cloud Azure Key Vault

Added one level package keyvault

* BAEL-6277 - A Guide To Spring Cloud Azure Key Vault

removed target release version

* BAEL-6277 - A Guide To Spring Cloud Azure Key Vault

fix compilation of NoSuchElementException

* BAEL-6277 - A Guide To Spring Cloud Azure Key Vault

fix pom.xml

* Revert "BAEL-6277 - A Guide To Spring Cloud Azure Key Vault"

This reverts commit 1cca1d0d69.

* BAEL-6277 - A Guide To Spring Cloud Azure Key Vault

fix pom.xml

* BAEL-6277 - A Guide To Spring Cloud Azure Key Vault

downgrade version to fix jenkins pipeline error

* BAEL-6277 - A Guide To Spring Cloud Azure Key Vault

comment run on main class

* Revert "reset last commit"

This reverts commit c557fad67f1c15bb384f0af5781430a45121a838.

* BAEL 6197 - Execute Tests Based on Active Profile with JUnit 5

#First push

* BAEL-6277 - A Guide To Spring Cloud Azure Key Vault

Revert for new pr

* reset last commit

* reset last commit

* BAEL 6197 - Execute Tests Based on Active Profile with JUnit 5

#Remove redundant test

* BAEL 6197 - Execute Tests Based on Active Profile with JUnit 5

#Format fix

* BAEL 6197 - Execute Tests Based on Active Profile with JUnit 5

#fix from review

* BAEL 6197 - Execute Tests Based on Active Profile with JUnit 5

#fix from review

* BAEL 6197 - Execute Tests Based on Active Profile with JUnit 5

#fix test name

---------

Co-authored-by: Cesare <cesare.valenti@hotmail.com>

* [scanner-to-array] Saving Java Scanner Input to an Array (#13969)

* BAEL-6342 JUnit Test Class for Null and Empty String (#13963)

* JAVA-20630 upgrade maven war plugin to be compatible with JDK 11 and 17 (#13945)

* JAVA-20630 upgrade maven war plugin to be compatible with JDK 11 and 17

* JAVA-20630 code format

* JAVA-20630 don't fail if there's no web.xml and using Java based configuration while building a war file

* JAVA-20630 avoid unneeded formatting

* JAVA-20630 change order of modules to solve flaky tests

* fix module order

* add dependent module

* add parent

* JAVA-20828 Fixing the core-java-exclusions module (#13997)

* Upgrade spring.vault.core from 2.3.2 to 3.0.2 (#13977)

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Create README.md

[skip ci]

* Update README.md

[skip ci]

* Title: Regular Expression: \z vs \Z Anchors in Java (#13994)

Hello,
This commit related to the article entitled "Regular Expression: \z vs \Z Anchors in Java"

* JAVA-20828: Changes made for updating blade module to java 11 (#13929)

* JAVA-20828: Changes made for updating blade module to java 11

* JAVA-20828: Changes made for updating bootique,dropwizard,google-web-toolkit  module to java 11

* JAVA-20828: Changes made for updating bootique,dropwizard,google-web-toolkit  module to java 11

* JAVA-20828: Adding jakarta-ee to jdk-9 profile

* BAEL-6334 Add example code for checking if a list element is in another list

* JAVA-20610 Upgraded parent-boot-2 to 2.7.11 (#13944)

* JAVA-20163 Upgrade hibernate specific modules to JDK 11 (#13817)

* JAVA-20163 Migration hibernate-annotations

* JAVA-20163 Migrate hibernate-queries

* JAVA-20163 Migrating hibernate-mapping

* JAVA-20163 rename reserved keywords, update inheritance example

* JAVA-20163 Migrate hibernate-ogm module to the jdk 8 because hibernate-ogm doesn't support jakarta API

* JAVA-20163 Migrate hibernate-enterprise module

* JAVA-20163 Add update to HibernateExceptionUnitTest#whenQueryExecutedWithUnmappedEntity_thenMappingException

* JAVA-20163 Set explicit version for hibernate 6.1.7.Final in the hibernate-queries module

* JAVA-20163 Fix failed test with port that already exists (giving another port 8088)

* JAVA-20163 Fix other location after changing the port

* JAVA-20163 Remove duplicate Unit Test

---------

Co-authored-by: n <noreplay@yahoo.com>
Co-authored-by: Loredana Crusoveanu <lore.crusoveanu@gmail.com>

* JAVA-20165 Upgrade spring-boot hibernate specific modules to JDK 11 (#13952)

* JAVA-20165 Upgrade spring-boot hibernate specific modules to JDK 11

* JAVA-20165 Migrating spring-boot-persistence-mongodb

* JAVA-20165 Migrating spring-boot-persistence-mongodb-2

* JAVA-20165 Migrating spring-boot-persistence-mongodb-3

* JAVA-20165 Adding latest version for jdbi in spring-boot-persistence-2 module

---------

Co-authored-by: timis1 <noreplay@yahoo.com>

* [Check If a Specified Key Exists in a Given S3 Bucket using Java] added code examples (#13775)

* [Check If a Specified Key Exists in a Given S3 Bucket using Java]] added code examples for

change test name

remove link from README.md

* - used env variables for AWS credentials
- used codestyle profile of baledung

* [os-to-is] Convert an OutputStream to an InputStream (#13992)

* BAEL-6264 added class to show how to instantiate ArrayBlockingQueue a… (#13851)

* BAEL-6264 added class to show how to instantiate ArrayBlockingQueue and LinkedBlockingQueue

* BAEL-6264 added unit test case

* modified test case

* BAEL-6264 deleted BlockingQueueImplExample file not needed anymore

* BAEL-6264 code review changes moved class file to different module

---------

Co-authored-by: Vartika_Nigam <Vartika_Nigam@DellTeam.com>

* Add code examples for "Opening a New Tab Using Selenium WebDriver in Java" (#14001)

Add code examples for "Opening a New Tab Using Selenium WebDriver in Java"

* BAEL-6320: format & code review

* JAVA-16946 Upgrade h2 database version for remaining modules (#13976)

* Add java interface single implementation examples (#13972)

* Fix formatting issues, refactor the `profiles` word in the properties.

* Add files via upload (#14006)

* JAVA-20828 Fixed module name (#14018)

* fix SeleniumOpenNewTabLiveTest (#14019)

* BAEL-6493 - Read last N messages from a Kafka Topic (#14020)

* BAEL-6398: Java PrintStream to String (#13998)

* Revert "JAVA-20280: remove wrong property (#13874)" (#14021)

This reverts commit 58d9bcb3b4.

* Hashing with Argon2 in Java (#14009)

* Hashing with Argon2 in Java

* Hashing with Argon2 in Java

* JAVA-13721 Fixing the formatting

* JAVA-13721 Further formatting of files

* BAEL-4369: Multiple ways of declaring dependency versions in Gradle (#13825)

* BAEL-6246 Code for the article Send MultipartFile Request with RestAs… (#13803)

* BAEL-6246 Code for the article Send MultipartFile Request with RestAssured

* Fix code style in rest assured integration tests

---------

Co-authored-by: thibault.faure <thibault.faure@mimacom.com>

* Bael 4582: Custom Authentication using shared secret (#13801)

* Spring custom security filter add

* Integration Tests add

* Add Project into parent pom

* refactor code

* refactor code

* remove .env and refactor code

* refactor code

* exclude auto configuration

* Refactored code

* removed ssl certificate for security

* Set session management to statelees

* Refactor tests

* Refactor authentication logic

* Refactor authentication logic

* Refactor authentication logic

* Remove unused code

* Remove unused code

* Remove unused appconfig

* disable AWSS3ObjectIntegrationTest due to need real credentials (#14028)

make AWSS3ObjectIntegrationTest manual

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* Update README.md

[skip ci]

* JAVA-20828: changes made for resolving botique module (#14027)

* [JAVA-20626]Moved vertx-modules to jdk9-and-above profile + upgraded vertx version to 3.9.15 (#13960)

* [JAVA-20633  Clean up modules (#14024)

* add value of comparision

* [BAEL-6339] custom iterator with testcases (#14038)

Co-authored-by: Bhaskar <bhaskar.dastidar@freshworks.com>

* BAEL-6246 Fix AppControllerIntegrationTest (#14039)

Co-authored-by: thibault.faure <thibault.faure@mimacom.com>

* JAVA-20946 Renamed HttpBinServiceUnitTest to LiveTest (#14041)

- Since it is making actual live request to httpbin.org

* JAVA-21186 Fix references to parents - Week 21 - 2023 (#14036)

* JAVA-20630 move the jws module to  *-jdk9-and-above profiles (#14030)

* JAVA-20631 move Jetbrains module to *-jdk9-and-above profiles (#14029)

* JAVA-20631 move Jetbrains module to *-jdk9-and-above profiles

* JAVA-20631 fix parent modules so that the project parent (pom.xml) can be built without error

* BAEL-5711: Securing Spring Boot API with API key and secret (#14015)

* #bael-5711: add source

* #bael-5711: remove extra space

* #bael-5711: remove extra space

* #bael-5711: remove extra space

---------

Co-authored-by: h_sharifi <h_sharifi@modernisc.com>

* BAEL-6334 Improve test names and typos

* BAEL-6179: Add Actuator sample without Spring Boot (#14032)

* BAEL-6179: Add Actuator sample without Spring Boot

* BAEL-6179: Simplify custom health indicator

* [JAVA-20624] Moved static-analysis module to jdk9-and-above-profile (#14026)

* change return type to optional

* Title: Array vs List Performance in Java (#14034)

This commit related to the article entitled "Array vs List Performance in Java".

* BAEL-6428 Make a Method Execute Only Once in Java

* 20616 (#14023)

* [JAVA-20616] Upgraded spring-spel module to jdk9-and-above profile

* [JAVA-20616]  Upgraded spring-websockets module to jdk9-and-above profile

* [JAVA-20616]  Upgraded spring-shell module to jdk9-and-above profile

---------

Co-authored-by: Dhawal Kapil <dhawalkapil@gmail.com>

* JAVA-21106: Adding javax-servlets module to jdk9 and above (#13974)

* JAVA-21106: Adding javax-servlets module to jdk9 and above

* JAVA-21106: Changes made for adding the method for runt he application

* JAVA-21106: Changes made for adding javax-servlets-2 modules to jdk-9 and above

* JAVA-21106: Changes made for adding linkrest  modules to jdk-9 and above

* JAVA-21106 : Changes made for adding jee-7 and ninija in default-jdk9-and-above profile

* JAVA-21106 : Changes made for adding resteasy,spark-java,struts-3,vraptor,wicket in default-jdk9-and-above profile

* JAVA-21106 : Changes made for removing ninja module

* JAVA-21106 : Changes made for removing ninja module fro  jdk-9 and above

* JAVA-21106: Changes made for cleaninhg pom.xml

* JAVA-21106: FIXING MAVEN VERISON FOR WICKET

* Java 20277 (#14046)

* JAVA-20277 GitHub Issue: Regarding article Introduction to JsonPath

* JAVA-20277 Code Review Changes

* JAVA-20167 Upgrade spring-data hibernate with external libraries specific modules to JDK 11 (#14022)

Co-authored-by: timis1 <noreplay@yahoo.com>

* JAVA-20166 Migrating spring-date-eclipselink (#13959)

* JAVA-20166 Migrating spring-date-eclipselink

* JAVA-20166 Fix failed tests address already bind

* JAVA-20166 Migrating spring-date-couchbase-2

* JAVA-20166 Replace with optional instead of returning null

---------

Co-authored-by: timis1 <noreplay@yahoo.com>

* JAVA-20164 Upgrade java hibernate specific modules to JDK 11 (#13900)

* JAVA-20164 Upgrade java hibernate specific modules to JDK 11

* JAVA-20164 Migrating java-jpa-2

* JAVA-20164 Migrating jnosql-artemis

* JAVA-20164 Migrating querydsl

* JAVA-20164 Migrating r2dbc

* JAVA-20164 Migrating redis

* JAVA-20164 Fixing test JPATextUnitTest#givenExam_whenSaveExam_thenReturnExpectedExam

* JAVA-20164 Fixing givenIdentityStrategy_whenCommitTransction_thenReturnPrimaryKey

* JAVA-20164 Changes after review

* JAVA-20164 Migrating java-cassandra to jdk8

* JAVA-20164 Fix legacy mode error

* Update pom.xml

---------

Co-authored-by: timis1 <noreplay@yahoo.com>
Co-authored-by: Dhawal Kapil <dhawalkapil@gmail.com>

* BAEL-5905 move article

* BAEL-5947: Moving a project to a different package (#14054)

* Revert "feat: BAEL-5947 External Debugging with JMXTerm (#13847)"

This reverts commit cce2ed68a4.

* BAEL-5947: Moving a project to a different package

* BAEL-4615: Create and Detect Memory Leak in Java (#14060)

* BAEL-6086: Customize WebFlux Exceptions in Spring Boot 3 (#13948)

* BAEL-6086: Added code for webflux default and custom exception along with Unit Tests

* BAEL-6086: added missing import

* BAEL-6086: reformatting

* BAEL-6086: reformatted code

---------

Co-authored-by: balasr3 <balamurugan.radhakrishnan@imgarena.com>

* BAEL-5575 (#14016)

* BAEL-5575

First commit of the example for the article:
https://drafts.baeldung.com/wp-admin/post.php?post=153774&action=edit

* BAEL-5575

Adjusted pom.xml

* BAEL-5575

Formatted source code

* BAEL-5575

Removed unused import

* BAEL-5575

Renamed UT to follow: https://docs.google.com/document/d/1iIeSPuYFG-jEtB8UbcxQnn2AI3OR2LWlnisNo2NUCL8/edit

* BAEL-5575

Modified pom.xml to define versions in  properties  as stated in:
https://docs.google.com/document/d/1iIeSPuYFG-jEtB8UbcxQnn2AI3OR2LWlnisNo2NUCL8/edit

* BAEL-5575

Changes checking the commands:
* mvn clean install
* mvn clean install -Dgib.enabled=false

* BAEL-5575

Set GB as the base language

* BAEL-6094 (#14043)

* Inital Commit for BAEL-6094

* Added the test

* Updated the test

* Convert Hashmap to JSON object in Java (#14070)

* Convert Hashmap to JSON object in Java

This commit is related to the article entitled "Convert Hashmap to JSON object in Java"

* Convert Hashmap to JSON object in Java

This commit is for the article "Convert Hashmap to JSON object in Java"

* Array vs List Performance in Java (#14078)

This commit is related to the article entitled "Array vs List Performance in Java"

* Bael-6331: Adding changes for creating and checking empty streams (#14047)

* BAEL-6331: Create EmptyStreams.java

* BAEL-6331: Create EmptyStreamsUnitTest.java

* JAVA-20163 Fix failed integration test with date creation comparison (#14080)

Co-authored-by: timis1 <noreplay@yahoo.com>

* JAVA-21440: Changes made for upgrade jooby module to 2.16.1 to make j… (#14064)

* JAVA-21440: Chnages made for upgrade jooby module to 2.16.1 to make java-17 compatable

* JAVA-21440: commenting redis code as this will only work in the local or infra should have a redis setup

* JAVA-21440 Minor cleanup (#14084)

* Delete README.md

* removed optional specific function

* changing unit test class name

* BAEL-6250: refactor: Move to spring-caching-2 since spring-caching is full

* Update README.md

* Update README.md

* BAEL-6460: Why is Scanner skipping nextLine() after using other next functions? (#14079)

* changing branch

* BAEL-6334 Make object properties example clearer

* [BAEL-6344] address PR comment

* JAVA-21305 : Changes made for adding ratpack module to jdk9-and above… (#14012)

* JAVA-21106 : Changes made for adding ratpack module to jdk9-and above module

* JAVA-21106 : Changes made for adding java-lite module to jdk9-and above module

* JAVA-21305: Changes made for cleaninhg pom.xml

* JAVA-21305: Changes made for cleaning pom.xml

* BOSS-21305: changes made for adding ninja in jdk9 above modeule

* JAVA-21305: Changes made as per review comments

* JAVA-21305: Changes made as per review comments

* JAVA-21305: Changes made as per review comments

* [JAVA-21134] (#14045)

* [JAVA-21134] Removed external repository from jgit module

* [JAVA-21134] Removed external repository from aws-miscellaneous module + upgraded dynamodblocal version

* [JAVA-21134] Removed external repository from apache-tapestry module

* TASK-20628 (#14074)

* [TASK-20628] Moved xml module to jdk9-and-above profile

* [TASK-20628] Moved xml-2 module to jdk9-and-above profile

* [JAVA-15027]Upgraded follow redirects for apache http client + moved … (#14092)

* [JAVA-15027]Upgraded follow redirects for apache http client + moved older version to apache-httpclient4 module

* [JAVA-15027] Added test case

* BAEL-6508 Code for the Solving Gson Parsing Errors article

* JAVA-21189: Formatting pom.xml modules starting from KLM (#14096)

* JAVA-21189: Formatting pom.xml modules starting from NOPQR (#14097)

* JAVA-21189: Formatting pom.xml modules starting from NOPQR (#14097)

* java-20079: upgrade apache-spark module libraries (#14087)

* [scanner-with-spaces] how to take input as String with spaces in Java… (#14044)

* [scanner-with-spaces] how to take input as String with spaces in Java using Scanner?y

* [scanner-with-spaces] fix typo

* [output-to-file] Write Console Output to Text File in Java (#14082)

* [output-to-file] Write Console Output to Text File in Java

* [output-to-file] rebase on the master

* Convert Hashmap to JSON object in Java (#14110)

This commit is for Convert Hashmap to JSON object in Java

* Generating Javadoc with Gradle (#14091)

* Generating Javadoc with Gradle

* Generating Javadoc with Gradle

* Generating Javadoc with Gradle

* BAEL-6179: Fix readme (#14088)

* BAEL-6179: Add Actuator sample without Spring Boot

* BAEL-6179: Simplify custom health indicator

* BAEL-6179: Fix description in README.md

* JAVA-21189:  changes made for formatting modules starting from S (#14106)

* JAVA-21189:  changes made for formatting modules starting from TVWX (#14107)

* JAVA_21305: Changes made for fix the Integration test faliures (#14113)

* JAVA-20164 Fix .._SEQ.NEXTVAL error (#14109)

Co-authored-by: timis1 <noreplay@yahoo.com>

* JAVA-15022 (#14099)

* [JAVA-15022] Moved 4.5 version code to apache-httpclient4 module

* [JAVA-15022] Upgraded code to 5.x version

* Array vs List Performance in Java (#14114)

This commit is related to the article entitled "Array vs List Performance in Java"

* BAEL-6461: What's the difference between Scanner next() and nextLine() methods? (#14057)

* JAVA-19670: changes made for upgrading jenkins module to jdk-9 above (#14105)

* JAVA-19670: changes made for upgrading jenkins module to jdk-9 above

* JAVA-19670: Changes made for adding jenkins-modules in jdk-9 and above profile

* JAVA_21106: Changes made for fixing test cases for jee-7 (#14115)

* Bael 5711: Securing Spring Boot API with API key and secret (#14102)

* #bael-5711: add source

* #bael-5711: remove extra space

* #bael-5711: remove extra space

* #bael-5711: remove extra space

* #bael-5711: add custom message

* #bael-5711: refactor return null

---------

Co-authored-by: h_sharifi <h_sharifi@modernisc.com>

---------

Co-authored-by: Loredana Crusoveanu <lore.crusoveanu@gmail.com>
Co-authored-by: 3hsan <56245694+ehsansasanian@users.noreply.github.com>
Co-authored-by: edizor <113095366+edizor@users.noreply.github.com>
Co-authored-by: Vini <34344290+vinipx@users.noreply.github.com>
Co-authored-by: Dhawal Kapil <dhawalkapil@gmail.com>
Co-authored-by: jsgrah-spring <jsgrah@hotmail.com>
Co-authored-by: jogra <joseph.sterling.grah@miles.no>
Co-authored-by: Azhwani <13301425+azhwani@users.noreply.github.com>
Co-authored-by: Kai Yuan <kent.yuan@Gmail.com>
Co-authored-by: panos-kakos <102670093+panos-kakos@users.noreply.github.com>
Co-authored-by: Michael Olayemi <michaelolayemi28@gmail.com>
Co-authored-by: mariudotsh <33603097+mariudotsh@users.noreply.github.com>
Co-authored-by: Mariusz Kaczmarczyk <to@mariu.sh>
Co-authored-by: anuragkumawat <anuragkumawat7@gmail.com>
Co-authored-by: Bipin kumar <sayy2bipin@gmail.com>
Co-authored-by: Shaun Phillips <61982125+ShaPhi7@users.noreply.github.com>
Co-authored-by: Alejamdro <alemolerio@gmail.com>
Co-authored-by: Daniel Strmecki <daniel.strmecki@gmail.com>
Co-authored-by: Arya <108480101+Dazzle-10@users.noreply.github.com>
Co-authored-by: Ana Peterlić <apeterlic@gmail.com>
Co-authored-by: Zahid Khan <63726443+zahikhan@users.noreply.github.com>
Co-authored-by: emanuel.trandafir <emanuel.trandafir@betvictor.com>
Co-authored-by: Kasra Madadipouya <kasra_mp@yahoo.com>
Co-authored-by: uzma <uzma.nasir@gmail.com>
Co-authored-by: thibault.faure <thibault.faure@mimacom.com>
Co-authored-by: ACHRAF TAITAI <43656331+achraftt@users.noreply.github.com>
Co-authored-by: Avin Buricha <avin.buricha@gmail.com>
Co-authored-by: Ulisses Lima <ulisseslima@users.noreply.github.com>
Co-authored-by: Bhaskar Ghosh Dastidar <dastidar.bhaskar@gmail.com>
Co-authored-by: Bhaskar <bhaskar.dastidar@freshworks.com>
Co-authored-by: Zahid Khan <Zahid.khan@globalpay.com>
Co-authored-by: Raj Kishor <30443297+rajkishorraj@users.noreply.github.com>
Co-authored-by: raj kishor <raj.kishor@smartcoin.co.in>
Co-authored-by: Gaetano Piazzolla <gae.piaz@gmail.com>
Co-authored-by: Eugene Kovko <37694937+eukovko@users.noreply.github.com>
Co-authored-by: Bahaa El-Din Helmy <bahaavampire@yahoo.com>
Co-authored-by: davidmartinezbarua <davmb5@gmail.com>
Co-authored-by: Anastasios Ioannidis <121166333+anastasiosioannidis@users.noreply.github.com>
Co-authored-by: Grzegorz Musiał <grzegorz@musial.tk>
Co-authored-by: Kilian Schneider <48420258+Basler182@users.noreply.github.com>
Co-authored-by: cesarevalenti90 <50798547+cesarevalenti90@users.noreply.github.com>
Co-authored-by: Cesare <cesare.valenti@hotmail.com>
Co-authored-by: brokenhardisk <brokenhardisk@gmail.com>
Co-authored-by: Sam Gardner <samgardner909@gmail.com>
Co-authored-by: timis1 <12120641+timis1@users.noreply.github.com>
Co-authored-by: n <noreplay@yahoo.com>
Co-authored-by: Dmytro Budym <46810751+dbudim@users.noreply.github.com>
Co-authored-by: Vartika Nigam <63852792+vnigam2702@users.noreply.github.com>
Co-authored-by: Vartika_Nigam <Vartika_Nigam@DellTeam.com>
Co-authored-by: emanueltrandafir1993 <emanueltrandafir1993@gmail.com>
Co-authored-by: Ehsan Sasanianno <ehsan.sasanian@gmail.com>
Co-authored-by: Dileesha Rajapakse <dileesha@wso2.com>
Co-authored-by: Maciej Główka <maciejglowka.pl@gmail.com>
Co-authored-by: thibaultfaure <thibault.faure.pro@gmail.com>
Co-authored-by: Saikat Chakraborty <40471715+saikatcse03@users.noreply.github.com>
Co-authored-by: Andrew Tarry <andrew.tarry@perrio.io>
Co-authored-by: Hamid Reza Sharifi <hmdrzsharifi@gmail.com>
Co-authored-by: h_sharifi <h_sharifi@modernisc.com>
Co-authored-by: Ralf Ueberfuhr <40685729+ueberfuhr@users.noreply.github.com>
Co-authored-by: Deboshree <deboshree.banerjee@cred.club>
Co-authored-by: AndiCover <a.schoengruber@gmx.net>
Co-authored-by: Balamurugan <balamurugan.radhakrishnan@gmail.com>
Co-authored-by: balasr3 <balamurugan.radhakrishnan@imgarena.com>
Co-authored-by: victorsempere <victor.sempere1@gmail.com>
Co-authored-by: Muhammad Asif <muasif80@gmail.com>
Co-authored-by: vaibhav007jain <72961247+vaibhav007jain@users.noreply.github.com>
Co-authored-by: Andrew Tarry <andrew.tarry@gmail.com>
Co-authored-by: ciphx <wordcipherer@gmail.com>

* [BAEL-5934] code formatting and adding submodule

* [BAEL-5934] print s3 objects

* [BAEL-5934] add subpackage

---------

Co-authored-by: Loredana Crusoveanu <lore.crusoveanu@gmail.com>
Co-authored-by: 3hsan <56245694+ehsansasanian@users.noreply.github.com>
Co-authored-by: edizor <113095366+edizor@users.noreply.github.com>
Co-authored-by: Vini <34344290+vinipx@users.noreply.github.com>
Co-authored-by: Dhawal Kapil <dhawalkapil@gmail.com>
Co-authored-by: jsgrah-spring <jsgrah@hotmail.com>
Co-authored-by: jogra <joseph.sterling.grah@miles.no>
Co-authored-by: Azhwani <13301425+azhwani@users.noreply.github.com>
Co-authored-by: Kai Yuan <kent.yuan@Gmail.com>
Co-authored-by: panos-kakos <102670093+panos-kakos@users.noreply.github.com>
Co-authored-by: Michael Olayemi <michaelolayemi28@gmail.com>
Co-authored-by: mariudotsh <33603097+mariudotsh@users.noreply.github.com>
Co-authored-by: Mariusz Kaczmarczyk <to@mariu.sh>
Co-authored-by: anuragkumawat <anuragkumawat7@gmail.com>
Co-authored-by: Bipin kumar <sayy2bipin@gmail.com>
Co-authored-by: Shaun Phillips <61982125+ShaPhi7@users.noreply.github.com>
Co-authored-by: Alejamdro <alemolerio@gmail.com>
Co-authored-by: Daniel Strmecki <daniel.strmecki@gmail.com>
Co-authored-by: Arya <108480101+Dazzle-10@users.noreply.github.com>
Co-authored-by: Ana Peterlić <apeterlic@gmail.com>
Co-authored-by: Zahid Khan <63726443+zahikhan@users.noreply.github.com>
Co-authored-by: emanuel.trandafir <emanuel.trandafir@betvictor.com>
Co-authored-by: Kasra Madadipouya <kasra_mp@yahoo.com>
Co-authored-by: uzma <uzma.nasir@gmail.com>
Co-authored-by: thibault.faure <thibault.faure@mimacom.com>
Co-authored-by: ACHRAF TAITAI <43656331+achraftt@users.noreply.github.com>
Co-authored-by: Avin Buricha <avin.buricha@gmail.com>
Co-authored-by: Ulisses Lima <ulisseslima@users.noreply.github.com>
Co-authored-by: Bhaskar Ghosh Dastidar <dastidar.bhaskar@gmail.com>
Co-authored-by: Bhaskar <bhaskar.dastidar@freshworks.com>
Co-authored-by: Zahid Khan <Zahid.khan@globalpay.com>
Co-authored-by: Raj Kishor <30443297+rajkishorraj@users.noreply.github.com>
Co-authored-by: raj kishor <raj.kishor@smartcoin.co.in>
Co-authored-by: Gaetano Piazzolla <gae.piaz@gmail.com>
Co-authored-by: Eugene Kovko <37694937+eukovko@users.noreply.github.com>
Co-authored-by: Bahaa El-Din Helmy <bahaavampire@yahoo.com>
Co-authored-by: davidmartinezbarua <davmb5@gmail.com>
Co-authored-by: Anastasios Ioannidis <121166333+anastasiosioannidis@users.noreply.github.com>
Co-authored-by: Grzegorz Musiał <grzegorz@musial.tk>
Co-authored-by: Kilian Schneider <48420258+Basler182@users.noreply.github.com>
Co-authored-by: cesarevalenti90 <50798547+cesarevalenti90@users.noreply.github.com>
Co-authored-by: Cesare <cesare.valenti@hotmail.com>
Co-authored-by: brokenhardisk <brokenhardisk@gmail.com>
Co-authored-by: Sam Gardner <samgardner909@gmail.com>
Co-authored-by: timis1 <12120641+timis1@users.noreply.github.com>
Co-authored-by: n <noreplay@yahoo.com>
Co-authored-by: Dmytro Budym <46810751+dbudim@users.noreply.github.com>
Co-authored-by: Vartika Nigam <63852792+vnigam2702@users.noreply.github.com>
Co-authored-by: Vartika_Nigam <Vartika_Nigam@DellTeam.com>
Co-authored-by: emanueltrandafir1993 <emanueltrandafir1993@gmail.com>
Co-authored-by: Ehsan Sasanianno <ehsan.sasanian@gmail.com>
Co-authored-by: Dileesha Rajapakse <dileesha@wso2.com>
Co-authored-by: Maciej Główka <maciejglowka.pl@gmail.com>
Co-authored-by: thibaultfaure <thibault.faure.pro@gmail.com>
Co-authored-by: Saikat Chakraborty <40471715+saikatcse03@users.noreply.github.com>
Co-authored-by: Andrew Tarry <andrew.tarry@perrio.io>
Co-authored-by: Hamid Reza Sharifi <hmdrzsharifi@gmail.com>
Co-authored-by: h_sharifi <h_sharifi@modernisc.com>
Co-authored-by: Ralf Ueberfuhr <40685729+ueberfuhr@users.noreply.github.com>
Co-authored-by: Deboshree <deboshree.banerjee@cred.club>
Co-authored-by: AndiCover <a.schoengruber@gmx.net>
Co-authored-by: Balamurugan <balamurugan.radhakrishnan@gmail.com>
Co-authored-by: balasr3 <balamurugan.radhakrishnan@imgarena.com>
Co-authored-by: victorsempere <victor.sempere1@gmail.com>
Co-authored-by: Muhammad Asif <muasif80@gmail.com>
Co-authored-by: vaibhav007jain <72961247+vaibhav007jain@users.noreply.github.com>
Co-authored-by: Andrew Tarry <andrew.tarry@gmail.com>
Co-authored-by: ciphx <wordcipherer@gmail.com>
2023-06-18 10:43:01 -05:00
Harry9656
9eac77fb8b JAVA-6350: Add comments for SpringDoc v2 compatible with Spring Boot 3 (#13989) 2023-06-18 12:54:06 +02:00
Gaetano Piazzolla
fcbe35c33a JAVA-22250 | bumping karate to a new version compatible with jdk 17 (#14230)
* JAVA-22250 | bumping karate to a new version compatible with jdk 17

* JAVA-22180 | removed unused lib and added correct scope.
2023-06-18 14:53:46 +05:30
panos-kakos
641be7c21d [JAVA-21545] Fix test (#14258) 2023-06-18 13:46:45 +05:30
Kasra Madadipouya
5f721bbbcf JAVA-20620 upgrade Spring Swagger module to work with JDK 9 and above (#14254) 2023-06-18 10:58:01 +05:30
Gaetano Piazzolla
ca02c7c41f JAVA-6405 | counting Partitions in a topic in two different ways. (#14233) 2023-06-17 09:55:59 -07:00
Loredana Crusoveanu
39522e2168 Merge pull request #14166 from timis1/JAVA-20167_1
JAVA-20167 Migrate spring-data-mongodb to JDK 17
2023-06-17 18:04:25 +03:00
timis1
f001ff53df JAVA-20167 Remove methods that are not presented in articles 2023-06-17 00:45:20 +03:00
timis1
8df15cb3a2 Merge branch 'eugenp:master' into JAVA-20167_1 2023-06-17 00:37:36 +03:00
Bahaa El-Din Helmy
2e22abdad8 Difference Between Boolean.TRUE and true in Java (#14253)
This commit is related to the article "Difference Between Boolean.TRUE and true in Java"
2023-06-16 14:34:34 -07:00
timis1
656a3463e6 Merge branch 'master' into JAVA-20167_1 2023-06-16 22:13:06 +03:00
Loredana Crusoveanu
af8f02547f Update README.md 2023-06-16 20:41:02 +03:00
Loredana Crusoveanu
772c4c2677 Update README.md 2023-06-16 20:40:51 +03:00
Loredana Crusoveanu
5de999fecd Merge pull request #14241 from timis1/JAVA-22364
JAVA-22364 Split spring-data-neo4j module
2023-06-16 20:28:03 +03:00
Loredana Crusoveanu
53b48abda6 Merge pull request #14238 from edizor/master
Update README
2023-06-16 12:49:21 +03:00
thibault.faure
1b3718695a BAEL-5600 Code for the Read Date in Java using Scanner article 2023-06-16 10:52:58 +02:00
timis1
bbdd103ebf JAVA-22364 Some adjustments in neo4j 2023-06-16 09:35:28 +03:00
timis1
1ee2d9dce2 JAVA-222364 Keep in the spring data neo4j just the examples with spring 2023-06-16 09:00:06 +03:00
timis1
41aa2ee34f JAVA-22364 Split spring-data-neo4j module 2023-06-16 00:27:28 +03:00
davidmartinezbarua
59f684a57a Merge pull request #14220 from thibaultfaure/article/BAEL-6482
BAEL-6482 Code for the Matching Null With Mockito article
2023-06-15 17:05:53 -03:00
timis1
720f6415db JAVA-20167 Adding additional example for Spring data derived query 2023-06-15 21:00:23 +03:00
n
f67041ce37 JAVA-20167 Add the spring-date-neo4j to the jdk8 profile 2023-06-15 20:46:06 +03:00
n
0ada68f2fc Revert "JAVA-20167 Migrating spring-data-neo4j"
This reverts commit 1fdf017844.
2023-06-15 20:37:30 +03:00
n
096ab51bf6 Revert "JAVA-20167 Changes in MovieRepositoryIntegrationTest"
This reverts commit 2d2394411f.
2023-06-15 20:37:24 +03:00
n
4927e57ca3 Revert "JAVA-20167 Additional changes for test MovieRepositoryIntegrationTest"
This reverts commit 5fac3cfd7c.
2023-06-15 20:37:20 +03:00
Ana Peterlić
4bfa3cb53b BAEL-6432 - Asserting Equality on Two Classes without an Equals Method (#14193) 2023-06-15 21:13:10 +05:30
edizor
4610e975c4 Update README.md
[skip ci]
2023-06-15 23:14:25 +08:00
edizor
01030b808f Update README.md
[skip ci]
2023-06-15 23:04:52 +08:00
edizor
5bdc5a770d Update README.md
[skip ci]
2023-06-15 22:59:15 +08:00
edizor
c78aa3d6e9 Update README.md
[skip ci]
2023-06-15 22:44:37 +08:00
edizor
d6a175cb97 Update README.md
[skip ci]
2023-06-15 22:39:06 +08:00
edizor
346144af0b Update README.md
[skip ci]
2023-06-15 22:32:42 +08:00
edizor
d0e1d3f9b4 Update README.md
[skip ci]
2023-06-15 22:27:05 +08:00
edizor
6fb99c19b2 Update README.md
[skip ci]
2023-06-15 22:23:23 +08:00
edizor
f5c5d37a16 Update README.md
[skip ci]
2023-06-15 22:15:04 +08:00
edizor
af78688c85 Update README.md
[skip ci]
2023-06-15 22:09:26 +08:00
edizor
1e8eebb821 Update README.md
[skip ci]
2023-06-15 22:06:30 +08:00
edizor
1f018f6d0c Update README.md
[skip ci]
2023-06-15 22:01:03 +08:00
edizor
6d62b71434 Update README.md
[skip ci]
2023-06-15 21:57:03 +08:00
Loredana Crusoveanu
89c8cda3f9 Merge pull request #14159 from dkapil/task/JAVA-13721_2
JAVA-13721 Removed mockmaker file, not needed with mockito v5+
2023-06-15 11:26:00 +03:00
Balamurugan
cb7dec7ddd BAEL-6086: removed unnecessary dependency(probably conflict which fails test) (#14235)
* BAEL-6086: Added code for webflux default and custom exception along with Unit Tests

* BAEL-6086: added missing import

* BAEL-6086: reformatting

* BAEL-6086: reformatted code

* BAEL-6086: removed unnecessary dependency(probably conflict which fails test)

---------

Co-authored-by: balasr3 <balamurugan.radhakrishnan@imgarena.com>
2023-06-15 11:28:50 +05:30
Bipin kumar
094d4e7bd2 Java 19673 01 (#14224)
* JAVA-19673_01: Changes made for upgraing image-processing module to jdk-17

* JAVA-19673_01: Changes made for upgraing image-processing module to jdk-17
2023-06-15 11:04:30 +05:30
Gaetano Piazzolla
16894b7986 JAVA-22180 | fixed test with simple annotations. (#14225) 2023-06-15 09:39:55 +05:30
timis1
e9ce7e4ff0 Merge branch 'eugenp:master' into JAVA-20167_1 2023-06-15 00:43:18 +03:00
davidmartinezbarua
167d296c8c Merge pull request #14183 from thibaultfaure/article/BAEL-6587
BAEL-6587 Code for the Mockito Exception article
2023-06-14 11:24:23 -03:00
thibault.faure
4ef476252f BAEL-5977 Code for the Throw Exception for Unexpected Input for Enum with Mapstruct article 2023-06-14 11:58:03 +02:00
Kai Yuan
8e3eabccab [str-all-upper] Check if a String is All Uppercase or Lowercase in Java (#14227) 2023-06-13 22:40:37 -05:00
timis1
5fac3cfd7c JAVA-20167 Additional changes for test MovieRepositoryIntegrationTest 2023-06-13 20:40:51 +03:00
Ulisses Lima
f6770bbc4d BAEL-6046 MongoDB - Field Level Encryption (#14229)
* bael-6046 - first draft

* review 1

* review 2

* null checks and lambda

* review 3

* removing converter

* debug

* auto encryption config

* createKeyUniqueIndex() and updated dependencies.

* Review 5.
2023-06-13 13:41:20 +02:00
tienvn4
25917125c7 BAEL-6541-convert-relative-path 2023-06-13 17:02:25 +07:00
tudormarc
7ce0f89a4a Merge pull request #4 from tudormarc/tudor-jacksonjr
BAEL-6310 - guide to JacksonJr
2023-06-13 01:02:40 +03:00
tudor.marc
1d08b4937e BAEL-6310 - guide to JacksonJr 2023-06-13 01:00:38 +03:00
timis1
2d2394411f JAVA-20167 Changes in MovieRepositoryIntegrationTest 2023-06-13 00:42:45 +03:00
Mo Helmy
4db74d0ea7 Convert List to JSON (#14226)
Hello there, 
The code provides a test class for a Java list to JSON conversion.
Regards,
Mohamed.
2023-06-12 13:10:24 -07:00
alexandru.borza
24cfe65bdd fix intendation 2023-06-12 23:05:26 +03:00
Forb Yuan
1abf01689d BAEL-4860: Java IllegalStateException: "getInputStream() has already been called for this request" (#14121)
* [BAEL-6203] Deserialize Generic Type with Jackson

* BAEL-4860: Java IllegalStateException: "getInputStream() has already been called for this request"

* BAEL-4860: Move code to new module spring-web-module/spring-mvc-java-3.

* BAEL-4860: update pom

* BAEL-4860: make the test methods public
2023-06-12 09:19:15 +05:30
Michael Olayemi
c9f751beed Performance and Memory Allocation Comparison Between List and Set (#14124)
* Performance and Memory Allocation Comparison Between List and Set in Java

* Performance and Memory Allocation Comparison Between List and Set in Java

* Performance and Memory Allocation Comparison Between List and Set in Java

* Performance and Memory Allocation Comparison Between List and Set in Java
2023-06-12 08:26:58 +05:30
timis1
1fdf017844 JAVA-20167 Migrating spring-data-neo4j 2023-06-12 02:00:30 +03:00
timis1
a23ce976fa Merge branch 'eugenp:master' into JAVA-20167_1 2023-06-12 01:52:08 +03:00
Loredana Crusoveanu
d4a0ed5f1e Merge pull request #14216 from collaboratewithakash/master
backlink updated
2023-06-11 15:33:45 +03:00
tudormarc
53095f7e72 Merge pull request #3 from eugenp/master
rebase
2023-06-11 15:23:51 +03:00
Dhawal Kapil
57a308167a Update pom.xml (#14222) 2023-06-11 15:11:07 +05:30
anuragkumawat
80933e5399 JAVA-21454 Upgrade spring-boot-libraries-2 to use SpringDoc in place of SpringFox (#14214) 2023-06-11 13:26:10 +05:30
anuragkumawat
cfed66d3a7 JAVA-21455 Move SpringFox code out of spring-boot-mvc to spring-boot-mvc-legacy (#14212) 2023-06-11 13:17:27 +05:30
Saikat Chakraborty
41d1bc0e7d Fix the integration tests which failed due to defined port (#14215) 2023-06-11 13:15:27 +05:30
panos-kakos
27ec87baec Java 20625 (#14213)
* [JAVA-20625] Opened packages + disabled karate integration until upgrade

* [JAVA-20625] Formatting
2023-06-11 13:13:39 +05:30
Dhawal Kapil
849035a0d1 JAVA-8924 Cleanup for spliterator article (#14221) 2023-06-11 13:09:16 +05:30
Bipin kumar
fb4362b89b JAVA-8924: changes made for adding example of trySplit() with spiterator (#14218) 2023-06-11 12:46:11 +05:30
ACHRAF TAITAI
2919e22ddb replace the securityContext (#14202) 2023-06-10 18:47:47 +02:00
thibault.faure
d74e9e8012 BAEL-6482 Code for the Matching Null With Mockito article 2023-06-10 16:30:05 +02:00
Dhawal Kapil
b3210b23d1 JAVA-8924 Fixed spliterator packages and formatting (#14211) 2023-06-10 12:42:38 +05:30
Bipin kumar
18f6a4c48a JAVA-8924: changes made for adding example of tryAdvance with spiterator (#14208)
* JAVA-8924: changes made for adding example of tryAdvance with spiterator

* JAVA-8924: changes made for adding example of tryAdvance with spiterator
2023-06-10 12:02:46 +05:30
Kasra Madadipouya
7203820adf JAVA-22075 move Blaze persistence module to Spring Boot parent two (#14196)
* JAVA-22075 move Blaze persistence module to Spring Boot parent two

* JAVA-22075 remove unnecessary TestContextConfig file
2023-06-10 11:55:24 +05:30
Kasra Madadipouya
196f83572b JAVA-18184 upgrade spring-bom module to work with JDK 11 and 17 (#14209) 2023-06-10 11:47:41 +05:30
Kai Yuan
fe722f47ee [sort-dt-str] Sort Date Strings in Java (#14188) 2023-06-09 23:00:04 -05:00
Bipin kumar
efa97a1c3a JAVA-21843: Changes made for adding jee-7 module to jdk-9-above profile (#14205) 2023-06-09 23:39:49 +05:30
Kasra Madadipouya
21fc31d866 JAVA-20632 move checker-framework module to JDK 11 (#14203) 2023-06-09 22:59:29 +05:30
davidmartinezbarua
3ba04890b9 Merge pull request #14182 from sam-gardner/BAEL-6312-Json-merge-Jackson-annotation
BAEL-6312 Add example code for @JsonMerge Jackson annotation
2023-06-09 13:58:22 -03:00
davidmartinezbarua
bdb4fd5d31 Merge pull request #14170 from thibaultfaure/article/BAEL-6595
BAEL-6595 code for the How Many Days Are There in a Particular Month …
2023-06-09 13:39:42 -03:00
Loredana Crusoveanu
1f06f9d2d4 Merge pull request #14206 from edizor/master
Update README.md
2023-06-09 17:29:41 +03:00
Loredana Crusoveanu
f3811093b1 Merge pull request #14199 from eugenp/remove-module
remove duplicate code
2023-06-09 17:24:48 +03:00
edizor
8608e71adb Update README.md
[skip ci]
2023-06-09 22:09:21 +08:00
davidmartinezbarua
98093c788a Merge pull request #14055 from thibaultfaure/feature/BAEL-6438-move-article-to-new-submodule
Create new module core-java-string-operations-6
2023-06-09 09:57:25 -03:00
Sam Gardner
7283845475 BAEL-6312 Update @JsonMerge annotation test to update language instead of name 2023-06-09 13:56:22 +01:00
collaboratewithakash
584177a41d backlinks removed 2023-06-09 15:37:20 +05:30
collaboratewithakash
920c17a22c backlink added 2023-06-09 15:36:17 +05:30
collaboratewithakash
a8a07bc583 backlinks removed 2023-06-09 15:29:11 +05:30
collaboratewithakash
7630c82f0b backlinks removed 2023-06-09 14:58:22 +05:30
collaboratewithakash
4325744a5c backlinks removed 2023-06-09 14:52:04 +05:30
collaboratewithakash
b7d2a1cd3d backlinks removed 2023-06-09 14:49:18 +05:30
collaboratewithakash
7897a9fb1a backlink updated 2023-06-09 14:47:17 +05:30
collaboratewithakash
0973e26a53 backlink updated 2023-06-09 14:39:30 +05:30
collaboratewithakash
e5eb167dfa backlink updated 2023-06-09 14:36:54 +05:30
collaboratewithakash
cd7c6c4eec backlink updated 2023-06-09 14:34:21 +05:30
collaboratewithakash
f272d94240 backlink updated 2023-06-09 14:32:01 +05:30
panos-kakos
0f86df8263 [JAVA-20619] Upgraded spring-static-resources to jdk9-and-above-profile (#14179) 2023-06-09 12:30:03 +05:30
panos-kakos
7aa95a9040 [JAVA-21296] Renamed Integration test to Manual (#14197) 2023-06-09 12:03:07 +05:30
Bipin kumar
b61bc614a3 JAVA-21843: Changes made for resolving failing test cases (#14201) 2023-06-09 11:52:47 +05:30
Avin Buricha
0b3af92558 BAEL-6564 | Article scripts (#14181) 2023-06-09 07:46:18 +05:30
Michael Olayemi
51a8904a3c Generating WSDL Stubs with Gradle (#14187)
* Generating WSDL Stubs with Gradle

* Generating WSDL Stubs with Gradle
2023-06-09 07:24:30 +05:30
thibault.faure
df7821277c BAEL-6595 code for the How Many Days Are There in a Particular Month of a Given Year article 2023-06-09 01:03:58 +02:00
Harry9656
fcf2eb22ce JAVA-6503: Image compression in Java (#14081) 2023-06-08 21:58:24 +02:00
Azhwani
fa6cc0bdd2 BAEL-6545: Update article https://www.baeldung.com/java-read-lines-large-file (#14168) 2023-06-08 21:43:31 +02:00
sdhiray7
bce2930f68 BAEL-5621 Combining two byte arrays (#14129)
* Initial commit for Object copy in Java

* review comments commit for Object copy in Java

* Initial commit for parseInt vs valueOf java

* Review comments commit for parseInt vs valueOf java

* Modify readme

* review comments

* build failure

* build failure retry

* build failure retry remove parseInt(java.lang.String,int,int,int)

* build failure add comment

* change examples

* review comments

* review comments 2

* review comments 3

* Initial commit for get current stacktrace

* Remove old files

* Name updates

* Jenkins error

* changes to file name

* Review comments

* Create unit test file

* Remove unnecessary files

* Update package name

* BAEL-5321 Initial commit

* BAEL-5321 Initial commit 2

* [BAEL-5321] review comments

* [BAEL-5321] constructor

* [BAEL-5321] inline

* BAEL-6396 Initial commit

* BAEL-6396 Files reorg
2023-06-08 22:55:28 +05:30
Loredana Crusoveanu
3743e98265 Merge pull request #14198 from edizor/master
Update README
2023-06-08 19:33:07 +03:00
Loredana Crusoveanu
8d71a50896 remove duplicate code 2023-06-08 19:32:16 +03:00
edizor
f9719a946c Update README.md
[skip ci]
2023-06-08 23:30:21 +08:00
edizor
d1195ad695 Create README.md
[skip ci]
2023-06-08 23:28:40 +08:00
edizor
759c12d0f6 Update README.md
[skip ci]
2023-06-08 23:19:21 +08:00
edizor
e20a11c6f7 Update README.md
[skip ci]
2023-06-08 23:12:41 +08:00
edizor
241c6458f2 Update README.md
[skip ci]
2023-06-08 23:09:26 +08:00
edizor
638041e819 Update README.md
[skip ci]
2023-06-08 23:03:13 +08:00
edizor
a40f7e0cc7 Update README.md
[skip ci]
2023-06-08 22:58:45 +08:00
Loredana Crusoveanu
f0fdcb5646 Merge pull request #14194 from ulisseslima/bael-6253-quickfix_records
BAEL 6253 - quick fix - Overridding hashCode() and equals() for Records
2023-06-08 17:07:49 +03:00
edizor
d519120aff Update README.md
[skip ci]
2023-06-08 21:45:22 +08:00
edizor
33aba31730 Update README.md
[skip ci]
2023-06-08 21:42:19 +08:00
edizor
13bcd1c647 Update README.md
[skip ci]
2023-06-08 21:35:13 +08:00
Ulisses Lima
a557399dce removing unrelated code 2023-06-07 12:34:50 -03:00
Ulisses Lima
002517ac3e check instanceof Movie 2023-06-07 12:20:25 -03:00
Ulisses Lima
87a2652f14 Merge branch 'eugenp:master' into master 2023-06-07 12:18:36 -03:00
Loredana Crusoveanu
86e2bf481a Merge pull request #14189 from dkapil/task/JAVA-21776
JAVA-21776 Renamed module names
2023-06-07 13:39:55 +03:00
Dhawal Kapil
fba060a8fe JAVA-21776 Renamed module names 2023-06-07 12:20:38 +05:30
Jonathan Cook
77d4cf53ce BAEL-5776 - Mock a URL Connection in Java (#14184)
* BAEL-4706 - Spring Boot with Spring Batch

* BAEL-3948 - Fix test(s) in spring-batch which leaves repository.sqlite
changed

* BAEL-4736 - Convert JSONArray to List of Object using camel-jackson

* BAEL-4756 - Mockito MockSettings

* BAEL-4756 - Mockito MockSettings - fix spelling

* BAEL-2674 - Upgrade the Okhttp article

* BAEL-4204 - Adding Interceptors in OkHTTP

* BAEL-4836 - Mocking Static Methods with Mockito

* BAEL-4205 - A Guide to Events in OkHTTP

* BAEL-5408 - Update Camel version in spring-boot-camel module

* BAEL-5234 - Apache Camel Routes Testing in Spring Boot

* BAEL-5234 - Apache Camel Routes Testing in Spring Boot

* BAEL-5237 - Apache Camel Conditional Routing

* BAEL-5236 - Apache Camel Exception Handling

* BAEL-5890 - Jackson's Deserialization with Lombok

* BAEL-5890 - Jackson's Deserialization with Lombok

* BAEL-5890 - Jackson's Deserialization with Lombok

* BAEL-5890 - Jackson's Deserialization with Lombok

* BAEL-5890 - Jackson's Deserialization with Lombok

* BAEL-5776 - Mock a URL Connection in Java

* BAEL-5776 - Mock a URL Connection in Java

---------

Co-authored-by: Jonathan Cook <jcook@sciops.esa.int>
Co-authored-by: jcook02 <jonathan.paul.cook@ext.esa.int>
2023-06-06 14:27:46 -07:00
Ana Peterlić
23562536a2 BAEL-6491 - Why is Field Injection not Recommended? (#14146) 2023-06-06 18:47:16 +05:30
panos-kakos
07099a47c3 Task 20625 (#14164)
* [TASK-20625] Upgraded testing-modules to jdk9-and-above profile

* [TASK-20625] Fixed failing modules

* [TASK-20625] Removed ninja submodule from build

* Update pom.xml

---------

Co-authored-by: Dhawal Kapil <dhawalkapil@gmail.com>
2023-06-06 14:51:21 +05:30
timis1
bbb91a1408 JAVA-20164 Renaming test methods (#14177)
Co-authored-by: timis1 <noreplay@yahoo.com>
2023-06-06 11:13:33 +05:30
panos-kakos
57b6d7a169 [JAVA-21538] (#14163) 2023-06-06 11:07:00 +05:30
panos-kakos
16d85e91c7 [JAVA-21772] Clean up (#14178) 2023-06-06 11:03:29 +05:30
panos-kakos
4a32ca1c8f Java 15022 (#14174)
* [JAVA-15022] Clean up

* [JAVA-15022] Clean up
2023-06-06 10:57:42 +05:30
anuragkumawat
d114f12960 JAVA-21459 Upgrade spring-rest-http-2 to use SpringDoc in place of SpringFox (#14131)
* JAVA-21459 Upgrade spring-rest-http-2 to use SpringDoc in place of SpringFox

* JAVA-21459 Code Review changes

* JAVA-21459 Formatting pom changes

* JAVA-21459 Formatting pom changes
2023-06-06 10:54:12 +05:30
anuragkumawat
d67f660b63 JAVA-21456 Upgrade spring-boot-mvc-4 to use SpringDoc in place of SpringFox (#14139)
* JAVA-21456 Upgrade spring-boot-mvc-4 to use SpringDoc in place of SpringFox

* JAVA-21456 Replace no longer needed ModelAttribute with RequestBody

* JAVA-21456 Review comments changes

* JAVA-21456 Formatting changes pom

* JAVA-21456 Correct formatting pom
2023-06-06 09:30:56 +05:30
Kai Yuan
d11744a741 [unique-elements-list] Get Unique Values From an ArrayList In Java (#14152) 2023-06-05 21:02:36 -05:00
lucaCambi77
fe50b9192d [BAEL-6486] - Returning a Value After Finishing Thread's Job in Java (#14101)
* feat: threads with return value

* pmd violation
2023-06-05 20:52:46 -05:00
Kai Yuan
65ef7bae18 [map-str-obj-to-str-str] converting a Map<String, Object> to a Map<String, String>. (#14175) 2023-06-05 20:43:28 -05:00
thibault.faure
cd67755469 BAEL-6587 Code for the Mockito Exception article 2023-06-05 20:19:07 +02:00
davidmartinezbarua
05c550f506 Merge pull request #14156 from thibaultfaure/improvement/BAEL-6469
BAEL-6469 Code for the @Value Annotation Support on records in Spring…
2023-06-05 14:12:15 -03:00
Sam Gardner
6b9812fa9c BAEL-6312 Add example code for @JsonMerge Jackson annotation 2023-06-05 11:13:48 +01:00
ACHRAF TAITAI
136f94fbbf BAEL-5648: Thymeleaf - How to add checked attribute to input conditio… (#14180)
* BAEL-5648: Thymeleaf - How to add checked attribute to input conditionally

* BAEL-5648: Thymeleaf - How to add checked attribute to input conditionally
2023-06-05 07:59:40 +02:00
Abhinav Pandey
b5ccdbc296 BAEL-5734 - Mocking private fields (#14085)
* BAEL-5734 - Mocking private fields

* BAEL-5734 - reducing spring version to make it compatible
2023-06-05 09:12:47 +05:30
Michael Olayemi
ab0684fa11 How to Display a Full HTTP Response Body with Gatling (#14148) 2023-06-03 09:12:18 +05:30
Ulisses Lima
6d636016b6 test adjustments 2023-06-02 19:37:30 -03:00
timis1
9f571f7265 JAVA-20164 Add missing dependency (#14137)
* JAVA-20164 Add missing dependency

* JAVA-20164 Fix redis config file error maxheap

---------

Co-authored-by: timis1 <noreplay@yahoo.com>
2023-06-03 01:37:07 +05:30
timis1
d7d751c76f JAVA-20163 Update example for UserType/CompositeUserType (#14143)
Co-authored-by: timis1 <noreplay@yahoo.com>
2023-06-02 23:42:06 +05:30
psevestre
9032d8e49b [BAEL-6275] PostgreSQL NOTIFY/LISTEN (#14153)
* [BAEL-4849] Article code

* [BAEL-4968] Article code

* [BAEL-4968] Article code

* [BAEL-4968] Article code

* [BAEL-4968] Remove extra comments

* [BAEL-5258] Article Code

* [BAEL-2765] PKCE Support for Secret Clients

* [BAEL-5698] Article code

* [BAEL-5698] Article code

* [BAEL-5905] Initial code

* [BAEL-5905] Article code

* [BAEL-5905] Relocate article code to new module

* [BAEL-6275] PostgreSQL NOTIFY/LISTEN

* [BAEL-6275] Minor correction

---------

Co-authored-by: Philippe Sevestre <psevestre@gmail.com>
2023-06-02 09:24:47 -07:00
Loredana Crusoveanu
4d47257d2a Merge pull request #14173 from eugenp/lor6-patch-1
Update README.md
2023-06-02 17:50:02 +03:00
Loredana Crusoveanu
93aa1c6b07 Update README.md 2023-06-02 17:47:05 +03:00
Loredana Crusoveanu
19f92e1fcd Merge pull request #14162 from collaboratewithakash/master
backlinks updated
2023-06-02 17:35:52 +03:00
Loredana Crusoveanu
65d44a96e9 Merge branch 'master' into master 2023-06-02 16:23:25 +03:00
Loredana Crusoveanu
99358367f6 Merge pull request #14169 from edizor/master
Update README
2023-06-02 11:36:13 +03:00
edizor
098df5faf5 Update README.md
[skip ci]
2023-06-02 09:15:32 +08:00
edizor
822e1af061 Update README.md
[skip ci]
2023-06-02 09:12:34 +08:00
edizor
8d6f8ce748 Update README.md
[skip ci]
2023-06-02 09:05:22 +08:00
edizor
211defc693 Update README.md
[skip ci]
2023-06-02 09:00:46 +08:00
edizor
08b67e091b Update README.md
[skip ci]
2023-06-02 08:55:33 +08:00
edizor
8cb23de096 Update README.md
[skip ci]
2023-06-02 08:46:50 +08:00
edizor
76a1e73b97 Create README.md
[skip ci]
2023-06-02 08:43:47 +08:00
edizor
1acdf2b024 Update README.md
[skip ci]
2023-06-02 08:40:51 +08:00
edizor
3221c38599 Update README.md
[skip ci]
2023-06-02 08:38:24 +08:00
edizor
4b99b48c54 Update README.md
[skip ci]
2023-06-02 08:31:53 +08:00
edizor
9593cd5fa0 Update README.md
[skip ci]
2023-06-02 08:27:58 +08:00
edizor
d2897638cd Update README.md
[skip ci]
2023-06-02 08:24:42 +08:00
edizor
1ab518e660 Update README.md
[skip ci]
2023-06-02 08:16:39 +08:00
edizor
ed4882b750 Update README.md
[skip ci]
2023-06-02 08:13:40 +08:00
edizor
79e9fe3b0e Update README.md
[skip ci]
2023-06-02 08:10:17 +08:00
davidmartinezbarua
4f03b1496b Merge pull request #14141 from thibaultfaure/article/BAEL-5773
BAEL-5773 Code for the Replacing Variables in a Document Template wit…
2023-06-01 19:49:37 -03:00
timis1
bcfbc7b91b JAVA-20167 Migrate spring-data-mongodb to JDK 17 2023-06-01 23:12:38 +03:00
thibault.faure
2ce7661be8 BAEL-6469 Code for the @Value Annotation Support on records in Spring improvement 2023-06-01 09:40:52 +02:00
collaboratewithakash
6be2913365 backlinks removed 2023-06-01 12:31:25 +05:30
collaboratewithakash
9cc1bc25dc backlinks removed 2023-06-01 12:23:54 +05:30
collaboratewithakash
25840eff01 backlink added 2023-06-01 12:21:46 +05:30
collaboratewithakash
b0b4e0f890 Update README.md 2023-06-01 12:12:16 +05:30
alexandru.borza
eea4bda4a0 BAEL-6024 - Guide to YugabyteDB 2023-05-31 23:12:55 +03:00
alexandru.borza
964953bfd8 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	persistence-modules/pom.xml
2023-05-31 23:11:03 +03:00
alexandru.borza
1728af43ec BAEL-6024 - Guide to YugabyteDB 2023-05-31 23:10:01 +03:00
alexandru.borza
e3bd696a18 BAEL-6024 - Guide to YugabyteDB 2023-05-31 23:09:59 +03:00
alexandru.borza
03357b54c8 review 2023-05-31 23:09:39 +03:00
alexandru.borza
300535438b review 2023-05-31 23:09:36 +03:00
alexandru.borza
3d61ccf4ba time-based UUIDs 2023-05-31 23:08:56 +03:00
alexandru.borza
5b46e18733 BAEL-6195 2023-05-31 23:08:56 +03:00
alexandru.borza
09c16f3437 move code 2023-05-31 23:08:25 +03:00
alexandru.borza
5e2da825b4 configure pom parent 2023-05-31 23:08:25 +03:00
alexandru.borza
07b1637f45 initialize arraylist with null or zeros 2023-05-31 23:08:21 +03:00
alexandru.borza
1954b8d128 BAEL-6024 - Guide to YugabyteDB 2023-05-31 23:00:07 +03:00
alexandru.borza
59b3a39a25 BAEL-6024 - Guide to YugabyteDB 2023-05-31 22:56:50 +03:00
Pedro Lopes
c932b75f21 BAEL 6249: Gray Box Testing (#13610)
* test implementation and sut class

* finishing up unit tests

* format

* fix test name

* changing method source name

* creating new module testing-techniques

* fix package name

---------

Co-authored-by: Ashley Frieze <ashley@incredible.org.uk>
2023-05-31 20:32:16 +01:00
Bahaa El-Din Helmy
3627e0f8dc Article: Converting Object To Map in Java (#14160)
This commit is related to the article entitled "Converting Object To Map in Java"
2023-05-31 11:35:56 -07:00
Bahaa El-Din Helmy
7df3a12a07 Update article "Difference Between \z and \Z in a Regular Expression in Java" (#14151)
This commit for "Update article "Difference Between \z and \Z in a Regular Expression in Java""
2023-05-31 11:09:25 -07:00
Dhawal Kapil
b6869f1870 JAVA-13721 Removed mockmaker file, not needed with mockito v5+ 2023-05-31 23:38:48 +05:30
Dhawal Kapil
bccf771d30 JAVA-15022 Added MockServer support for LiveTest (#14158) 2023-05-31 23:14:00 +05:30
panos-kakos
354d84c248 [JAVA-20622] Upgraded spring-web-modules to jdk9-and-above profile + … (#14154)
* [JAVA-20622] Upgraded spring-web-modules to jdk9-and-above profile + minor clean up

* [JAVA-20622] Fixed issue at spring-freemarker module
2023-05-31 22:28:19 +05:30
panos-kakos
66ecd935ea [JAVA-20615] Upgraded spring-security-modules to jdk9-and-above profile (#14142)
* [JAVA-20615] Upgraded spring-security-modules to jdk9-and-above profile

* [JAVA-20615] test build

* [JAVA-20615] test build

* [JAVA-20615] Clean up
2023-05-31 22:26:25 +05:30
panos-kakos
c239c68fa4 JAVA-20837 (#14140)
* [JAVA-20837]Upgraded optaplanner version

* upgraded dependencies
2023-05-31 21:49:42 +05:30
panos-kakos
b38c0a9d74 [JAVA-21185] Clean up (#14138)
* [JAVA-21185] Clean up

* [JAVA-21185] Clean up

* [JAVA-21185] Clean up

* Revert "[JAVA-21185] Clean up"

This reverts commit 485b1b86a9.

* Revert "[JAVA-21185] Clean up"

This reverts commit 13faeab481.
2023-05-31 20:19:13 +05:30
Bipin kumar
0b76b7c37f JAVA-21106:Changes made for removing jee-7 module from jdk-9 above profile (#14157) 2023-05-31 20:15:57 +05:30
panos-kakos
3049b75f47 [JAVA-21545] Clean up (#14126)
* [JAVA-21545] Clean up

* [JAVA-21545] Clean up

* [JAVA-21545] Revert change

* [JAVA-21545] Clean up

* [JAVA-21545] Clean up

* [JAVA-21545] Clean up
2023-05-31 20:04:02 +05:30
Bipin kumar
28e8354dfe JAVA-21305: Changes made for removing exception execController not sp… (#14122)
* JAVA-21305: Chnages made for removing excpetion execController not specified causing serverstart fail

* JAVA-21305: Chnages made for removing excpetion execController not specified causing serverstart fail

---------

Co-authored-by: Bipin Kumar <bipin5.kumar@paytm.com>
2023-05-31 19:58:13 +05:30
Ulisses Lima
1a2fddc879 Merge branch 'master' of https://github.com/ulisseslima/tutorials 2023-05-31 09:41:18 -03:00
Ulisses Lima
c61336c2f4 draft 1 2023-05-31 09:40:20 -03:00
collaboratewithakash
81f941f2ef backlink updated 2023-05-31 17:40:51 +05:30
collaboratewithakash
0fd47f71a2 backlink updated 2023-05-31 17:38:24 +05:30
collaboratewithakash
588e44b3cf backlink updated 2023-05-31 17:33:18 +05:30
collaboratewithakash
144dbdbde1 backlink updated 2023-05-31 17:29:35 +05:30
collaboratewithakash
30ffb3cc5a backlink updated 2023-05-31 17:28:06 +05:30
collaboratewithakash
70e5e9251c backlink updated 2023-05-31 17:25:58 +05:30
collaboratewithakash
be86db3ade backlink updated 2023-05-31 17:24:54 +05:30
collaboratewithakash
1fe20014f3 backlink updated 2023-05-31 17:23:33 +05:30
collaboratewithakash
37e4aeda8f backlink updated 2023-05-31 17:20:13 +05:30
collaboratewithakash
b53cbf7bb0 backlink updated 2023-05-31 17:17:50 +05:30
collaboratewithakash
8ece7eaa98 backlink updated 2023-05-31 17:14:55 +05:30
Kasra Madadipouya
ece5a165e9 JAVA-17164 update config and discovery services to use Spring Boot 2.7.X (#13967) 2023-05-31 14:40:49 +03:00
collaboratewithakash
6d8903d75b backlink updated 2023-05-31 17:07:22 +05:30
collaboratewithakash
58f1b2149b backlink updated 2023-05-31 17:05:41 +05:30
collaboratewithakash
fea4545011 backlink updated 2023-05-31 17:03:49 +05:30
collaboratewithakash
6f3dc1fae5 backlink updated 2023-05-31 17:02:39 +05:30
collaboratewithakash
ee8a4f6862 backlink updated 2023-05-31 17:01:08 +05:30
collaboratewithakash
3a52f3554f backlink updated 2023-05-31 16:59:22 +05:30
collaboratewithakash
a13c349609 backlink updated 2023-05-31 16:56:09 +05:30
collaboratewithakash
c0a029433e backlink updated 2023-05-31 16:45:32 +05:30
collaboratewithakash
a229495c12 backlink updated 2023-05-31 16:43:10 +05:30
collaboratewithakash
f443431551 backlink updated 2023-05-31 16:40:09 +05:30
collaboratewithakash
d6c4afec0d backlink updated 2023-05-31 16:38:34 +05:30
collaboratewithakash
80b8817049 backlink updated 2023-05-31 16:36:37 +05:30
collaboratewithakash
3870788066 backlink updated 2023-05-31 16:35:19 +05:30
collaboratewithakash
b0d77e725c backlink updated 2023-05-31 16:33:31 +05:30
collaboratewithakash
fc6cccca31 backlink updated 2023-05-31 16:28:25 +05:30
collaboratewithakash
13e22b72c4 backlink updated 2023-05-31 16:27:10 +05:30
collaboratewithakash
d21433fc5e backlink updated 2023-05-31 16:26:13 +05:30
collaboratewithakash
3822485328 backlink updated 2023-05-31 16:25:02 +05:30
collaboratewithakash
1dd73ffe93 backlink updated 2023-05-31 16:23:51 +05:30
collaboratewithakash
802fe7749a backlink updated 2023-05-31 16:22:32 +05:30
collaboratewithakash
0f09464d98 backlink updated 2023-05-31 16:17:42 +05:30
collaboratewithakash
31027cfa86 backlink updated 2023-05-31 16:16:15 +05:30
collaboratewithakash
4183ce2ad7 backlink updated 2023-05-31 16:09:40 +05:30
collaboratewithakash
5cfd290639 backlink updated 2023-05-31 16:07:51 +05:30
collaboratewithakash
e4096baf06 backlink updated 2023-05-31 16:05:37 +05:30
collaboratewithakash
61815396a1 backlink updated 2023-05-31 16:03:54 +05:30
collaboratewithakash
997cd9c383 backlink updated 2023-05-31 16:02:45 +05:30
collaboratewithakash
6389bf5bba backlink updated 2023-05-31 15:58:49 +05:30
collaboratewithakash
7c485a12e3 backlink updated 2023-05-31 15:57:10 +05:30
collaboratewithakash
6a9518aa5a backlink updated 2023-05-31 15:55:41 +05:30
collaboratewithakash
ae2f16b402 backlink updated 2023-05-31 15:53:10 +05:30
collaboratewithakash
b5c4a8b156 backlink updated 2023-05-31 15:51:11 +05:30
collaboratewithakash
1092b590ea backlink updated 2023-05-31 15:49:39 +05:30
collaboratewithakash
f48d79825a backlink updated 2023-05-31 15:47:50 +05:30
collaboratewithakash
754218982b backlink updated 2023-05-31 15:46:34 +05:30
collaboratewithakash
bbce7c04e3 backlink updated 2023-05-31 15:43:45 +05:30
Vini
62b436733a Merge pull request #14011 from imsurajmishra/master
BAEL-6323 : Count Number of Rows in JPA
2023-05-31 11:50:36 +02:00
Avin Buricha
1533268618 BAEL-6416 | Article code (#14065) 2023-05-31 08:53:46 +05:30
Avin Buricha
03448258d9 BAEL-6409 | Article code (#14135)
* BAEL-6409 | Article code

* Compilation fix
2023-05-31 08:45:00 +05:30
sachin
d36a81e36c bael-5728 added code (#14010)
* bael-5728 added code

* bael-5728 added code

* bael-5728 added code

* bael-5728 code fix

* bael-5728 code fix

---------

Co-authored-by: Sachin kumar <sachin.n.kumar@oracle.com>
2023-05-30 20:24:52 -05:00
davidmartinezbarua
d2cef18589 Merge pull request #13875 from KingsleyAmankwah/master
JPA/Hibernate Associations
2023-05-30 13:55:07 -03:00
collaboratewithakash
c1b56cd285 backlink updated 2023-05-30 17:47:55 +05:30
collaboratewithakash
cd4a5b31aa backlink updated 2023-05-30 17:45:57 +05:30
collaboratewithakash
9d98185435 backlink updated 2023-05-30 17:44:35 +05:30
collaboratewithakash
f70974f3f6 backlink updated 2023-05-30 17:42:58 +05:30
collaboratewithakash
6df5561a12 backlink updated 2023-05-30 17:41:02 +05:30
collaboratewithakash
7c6e257571 backlink updated 2023-05-30 17:39:38 +05:30
collaboratewithakash
2a3cb89d81 backlink updated 2023-05-30 17:37:57 +05:30
collaboratewithakash
5c538bf649 backlink updated 2023-05-30 17:36:05 +05:30
collaboratewithakash
059ec93309 backlink updated 2023-05-30 17:34:53 +05:30
collaboratewithakash
b921e4f6cc backlink updated 2023-05-30 17:33:21 +05:30
collaboratewithakash
88ff47d9b6 backlink updated 2023-05-30 17:31:46 +05:30
collaboratewithakash
97d34e9995 backlink updated 2023-05-30 17:29:13 +05:30
collaboratewithakash
9568349a23 backlink updated 2023-05-30 17:26:02 +05:30
collaboratewithakash
323745dc6d backlink updated 2023-05-30 17:24:41 +05:30
collaboratewithakash
42e43cbfa2 backlink updated 2023-05-30 17:22:42 +05:30
collaboratewithakash
fa1e3f4c27 backlink updated 2023-05-30 17:21:30 +05:30
collaboratewithakash
a8d7babf34 backlink updated 2023-05-30 17:11:31 +05:30
collaboratewithakash
b380757e9a backlink updated 2023-05-30 17:10:24 +05:30
collaboratewithakash
ecfb858e79 backlink updated 2023-05-30 17:08:52 +05:30
collaboratewithakash
57cc5bfb97 backlink updated 2023-05-30 17:07:11 +05:30
Kai Yuan
ca3d08cdec [list-with-default] Set Default Value for Elements in List (#14125)
* [list-with-default] Set Default Value for Elements in List

* [list-with-default] remove the ncopies and stream methods.

* [list-with-default]  remove irrelevant codes
2023-05-29 09:50:55 -05:00
Loredana Crusoveanu
869b45c01c Merge pull request #14134 from collaboratewithakash/master
backlinks added
2023-05-29 17:48:03 +03:00
thibault.faure
53a4ba1607 BAEL-5773 Code for the Replacing Variables in a Document Template with Java article 2023-05-29 14:42:31 +02:00
collaboratewithakash
ba34518cbe Update README.md 2023-05-29 12:54:11 +05:30
Azhwani
c9cc5bbefd BAEL-6465: How to handle NoSuchElementException when reading a file through a Scanner ? (#13999) 2023-05-28 11:06:59 +02:00
technoddy
69e5e51927 Addressing PR feedback 2023-05-27 18:26:35 -04:00
Abhinav Pandey
d42b1d05b1 BAEL-6509 - JSON to XML conversion in Java (#14050)
* BAEL-6509 - JSON to XML conversion

* BAEL-6509 - CRLF to LF
2023-05-27 21:08:50 +05:30
Tapan Avasthi
3072261677 BAEL-6293: Add builder pattern for ObjectMapper creation (#14112)
Co-authored-by: Tapan Avasthi <tavasthi@Tapans-MacBook-Air.local>
2023-05-27 08:44:01 -05:00
collaboratewithakash
ca16401784 backlink updated 2023-05-27 17:16:00 +05:30
collaboratewithakash
cb37d1fb67 backlink updated 2023-05-27 17:12:28 +05:30
collaboratewithakash
a5333e074e backlink updated 2023-05-27 17:06:19 +05:30
collaboratewithakash
aba9730325 backlink updated 2023-05-27 17:01:25 +05:30
collaboratewithakash
33efd70324 backlink updated 2023-05-27 16:59:40 +05:30
collaboratewithakash
d92c8065ee backlink updated 2023-05-27 16:57:24 +05:30
collaboratewithakash
d84e91e9d3 backlink updated 2023-05-27 16:56:07 +05:30
collaboratewithakash
4a4ea05190 backlink updated 2023-05-27 16:54:13 +05:30
collaboratewithakash
c3b896760b backlink updated 2023-05-27 16:48:50 +05:30
collaboratewithakash
9ffd70d980 backlink updated 2023-05-27 16:47:38 +05:30
collaboratewithakash
9ceaa28a99 backlink updated 2023-05-27 16:45:37 +05:30
collaboratewithakash
3df2dff507 backlink updated 2023-05-27 16:39:31 +05:30
collaboratewithakash
f37f088e4f backlink updated 2023-05-27 16:22:54 +05:30
collaboratewithakash
5fa933bc52 backlink updated 2023-05-27 16:17:36 +05:30
collaboratewithakash
411026a197 backlink updated 2023-05-27 16:11:33 +05:30
collaboratewithakash
bd4fad36fe backlink updated 2023-05-27 16:09:46 +05:30
collaboratewithakash
b0c16eefe8 backlink updated 2023-05-27 16:07:03 +05:30
collaboratewithakash
d75846727d backlink updated 2023-05-27 15:53:08 +05:30
collaboratewithakash
6210986603 backlink updated 2023-05-27 15:43:10 +05:30
collaboratewithakash
d3c0e53f61 backlink added 2023-05-27 15:41:27 +05:30
collaboratewithakash
5ff4d37955 backlink updated 2023-05-27 15:30:38 +05:30
collaboratewithakash
a266eedeb0 backlink updated 2023-05-27 15:28:39 +05:30
collaboratewithakash
6ce51569c7 updated backlink 2023-05-27 15:20:01 +05:30
collaboratewithakash
447785c344 updated backlink 2023-05-27 15:16:58 +05:30
collaboratewithakash
79b09531f5 added backlink 2023-05-27 15:04:18 +05:30
collaboratewithakash
1f32dde92c added backlink 2023-05-27 15:03:04 +05:30
collaboratewithakash
14c4b606eb updated link 2023-05-27 15:00:11 +05:30
collaboratewithakash
9fd743ae70 updated link 2023-05-27 14:55:17 +05:30
collaboratewithakash
6b4531aa93 added backlink 2023-05-27 14:49:34 +05:30
collaboratewithakash
8bd105c629 updated title 2023-05-27 14:47:34 +05:30
collaboratewithakash
72cd569311 added backlink 2023-05-27 14:43:17 +05:30
collaboratewithakash
199f48a8db backlink added 2023-05-27 14:42:28 +05:30
collaboratewithakash
14fb2c4bca added 2023-05-27 14:41:40 +05:30
collaboratewithakash
ac281be18d added backlink 2023-05-27 14:38:11 +05:30
collaboratewithakash
8dcd4f6309 added backlink 2023-05-27 14:35:34 +05:30
Dhawal Kapil
25dfb6928a Revert "JAVA-19670: changes made for upgrading jenkins module to jdk-9 above (#14105)" (#14127)
This reverts commit a5ca306563.
2023-05-27 02:21:32 +05:30
timis1
b6bb5c46f8 JAVA-20163 Add instruction for running Morphia Test manually (#14128)
Co-authored-by: timis1 <noreplay@yahoo.com>
2023-05-27 02:21:17 +05:30
Anastasios Ioannidis
e27e16cfd1 JAVA-20409 Uncommented spring-roo (#13949)
* JAVA-20409 Uncommented spring-roo

* JAVA-20409 Comment that roo is not supported

* JAVA-21133 Updated comment for commented feign module
2023-05-27 01:52:03 +05:30
Loredana Crusoveanu
016129d3f6 Merge pull request #14123 from edizor/master
Update README
2023-05-26 10:49:54 +03:00
edizor
7003481337 Update README.md
[skip ci]
2023-05-26 11:00:47 +08:00
edizor
539f0f5224 Create README.md
[skip ci]
2023-05-26 10:51:25 +08:00
edizor
46434b9c37 Update README.md
[skip ci]
2023-05-26 10:47:28 +08:00
edizor
9182858942 Update README.md
[skip ci]
2023-05-26 10:43:38 +08:00
edizor
d34a66d5cf Update README.md
[skip ci]
2023-05-26 10:35:47 +08:00
edizor
623a890165 Update README.md
[skip ci]
2023-05-26 10:28:23 +08:00
edizor
0614f441e9 Update README.md
[skip ci]
2023-05-26 10:21:02 +08:00
Bahaa El-Din Helmy
9caa7d7000 Convert Hashmap to JSON object in Java (#14118)
This commit is related to the article "Convert Hashmap to JSON object in Java"
2023-05-25 17:45:29 -07:00
davidmartinezbarua
0babcc3b92 Merge pull request #13937 from ukhan1980/BAEL-6105-correct-use-of-flush
[BAEL-6105] code for correct use of flush
2023-05-25 21:05:19 -03:00
uzma
f1084ee442 [BAEL-6105] delete code from the old module 2023-05-25 23:38:09 +01:00
uzma
442793d483 [BAEL-6105] code for correct use of flush 2023-05-25 23:36:24 +01:00
Kasra Madadipouya
68fe289e4a Merge pull request #13810 from press0/master
pr: add return types for assertion; test WrongVoucher vs GoodVoucher
2023-05-25 20:04:24 +02:00
edizor
820a6ea07f Update README.md
[skip ci]
2023-05-26 00:53:15 +08:00
edizor
ee44d48d2f Update README.md
[skip ci]
2023-05-26 00:46:34 +08:00
edizor
03292d1b2a Update README.md
[skip ci]
2023-05-26 00:38:16 +08:00
edizor
ebaa99f043 Create README.md
[skip ci]
2023-05-26 00:34:00 +08:00
edizor
efbbe8d0f6 Update README.md
[skip ci]
2023-05-26 00:22:10 +08:00
edizor
3e10e81099 Update README.md
[skip ci]
2023-05-26 00:19:08 +08:00
edizor
6dab6d5cd9 Update README.md
[skip ci]
2023-05-26 00:09:07 +08:00
edizor
b6e7bf4a05 Update README.md
[skip ci]
2023-05-26 00:00:50 +08:00
edizor
8cb18fd3c7 Update README.md
[skip ci]
2023-05-25 23:49:41 +08:00
edizor
6302d83e3e Create README.md
[skip ci]
2023-05-25 23:40:52 +08:00
edizor
63fb43b4d0 Update README.md
[skip ci]
2023-05-25 23:31:28 +08:00
edizor
a0f48b6d77 Update README.md
[skip ci]
2023-05-25 23:20:07 +08:00
Hamid Reza Sharifi
0b68753c6a Bael 5711: Securing Spring Boot API with API key and secret (#14102)
* #bael-5711: add source

* #bael-5711: remove extra space

* #bael-5711: remove extra space

* #bael-5711: remove extra space

* #bael-5711: add custom message

* #bael-5711: refactor return null

---------

Co-authored-by: h_sharifi <h_sharifi@modernisc.com>
2023-05-25 11:47:53 +02:00
Kasra Madadipouya
c44f766842 Merge pull request #13719 from FabioBentoLuiz/fix/es-userutility
Event Sourcing - Recreate user with id from the UserCreatedEvent instead of creating a new one
2023-05-24 23:16:59 +02:00
Bipin kumar
231c8544fb JAVA_21106: Changes made for fixing test cases for jee-7 (#14115) 2023-05-24 23:08:41 +05:30
Bipin kumar
a5ca306563 JAVA-19670: changes made for upgrading jenkins module to jdk-9 above (#14105)
* JAVA-19670: changes made for upgrading jenkins module to jdk-9 above

* JAVA-19670: Changes made for adding jenkins-modules in jdk-9 and above profile
2023-05-24 23:06:41 +05:30
Azhwani
8c8daf5803 BAEL-6461: What's the difference between Scanner next() and nextLine() methods? (#14057) 2023-05-24 17:26:01 +02:00
davidmartinezbarua
c6f95b978c Merge pull request #14094 from thibaultfaure/article/BAEL-6508
BAEL-6508 Code for the Solving Gson Parsing Errors article
2023-05-24 12:18:58 -03:00
Bahaa El-Din Helmy
596249c8a5 Array vs List Performance in Java (#14114)
This commit is related to the article entitled "Array vs List Performance in Java"
2023-05-24 07:59:59 -07:00
panos-kakos
e15edf753a JAVA-15022 (#14099)
* [JAVA-15022] Moved 4.5 version code to apache-httpclient4 module

* [JAVA-15022] Upgraded code to 5.x version
2023-05-24 20:02:13 +05:30
timis1
226ec06b41 JAVA-20164 Fix .._SEQ.NEXTVAL error (#14109)
Co-authored-by: timis1 <noreplay@yahoo.com>
2023-05-24 19:52:01 +05:30
Bipin kumar
63b4bf9eab JAVA_21305: Changes made for fix the Integration test faliures (#14113) 2023-05-24 19:39:23 +05:30
Bipin kumar
4a949a6703 JAVA-21189: changes made for formatting modules starting from TVWX (#14107) 2023-05-24 19:38:09 +05:30
Bipin kumar
0e4dc7b874 JAVA-21189: changes made for formatting modules starting from S (#14106) 2023-05-24 19:37:51 +05:30
Ralf Ueberfuhr
ec44198e34 BAEL-6179: Fix readme (#14088)
* BAEL-6179: Add Actuator sample without Spring Boot

* BAEL-6179: Simplify custom health indicator

* BAEL-6179: Fix description in README.md
2023-05-24 06:50:36 +02:00
Michael Olayemi
44f1a6f15a Generating Javadoc with Gradle (#14091)
* Generating Javadoc with Gradle

* Generating Javadoc with Gradle

* Generating Javadoc with Gradle
2023-05-24 08:40:50 +05:30
Bahaa El-Din Helmy
b9ca95954e Convert Hashmap to JSON object in Java (#14110)
This commit is for Convert Hashmap to JSON object in Java
2023-05-23 17:05:20 -07:00
Kai Yuan
2064338a8d [output-to-file] Write Console Output to Text File in Java (#14082)
* [output-to-file] Write Console Output to Text File in Java

* [output-to-file] rebase on the master
2023-05-23 16:56:31 -05:00
Kai Yuan
3eb7f6e72c [scanner-with-spaces] how to take input as String with spaces in Java… (#14044)
* [scanner-with-spaces] how to take input as String with spaces in Java using Scanner?y

* [scanner-with-spaces] fix typo
2023-05-23 16:50:10 -05:00
Ehsan Sasanianno
fcd950f1ef java-20079: upgrade apache-spark module libraries (#14087) 2023-05-23 22:27:01 +05:30
Bipin kumar
fa0b961e2d JAVA-21189: Formatting pom.xml modules starting from NOPQR (#14097) 2023-05-23 22:04:20 +05:30
Bipin kumar
9917ff790e JAVA-21189: Formatting pom.xml modules starting from NOPQR (#14097) 2023-05-23 22:03:06 +05:30
Bipin kumar
f06cd98e00 JAVA-21189: Formatting pom.xml modules starting from KLM (#14096) 2023-05-23 22:02:15 +05:30
thibault.faure
8ef3fbf868 BAEL-6508 Code for the Solving Gson Parsing Errors article 2023-05-22 23:51:22 +02:00
davidmartinezbarua
1a2c446f2c Merge pull request #13955 from ukhan1980/BAEL-6344-convert-list-to-page
[BAEL-6105] code for list to page article
2023-05-22 14:59:52 -03:00
thibault.faure
64d1902858 Create new module core-java-string-operations-6
Move code for the Find the Longest Word in a String article
2023-05-22 19:51:40 +02:00
davidmartinezbarua
fc6660e4d9 Merge pull request #14037 from andrewtarry/string-conversion
add value of comparison
2023-05-22 14:39:18 -03:00
panos-kakos
33bfd48d1b [JAVA-15027]Upgraded follow redirects for apache http client + moved … (#14092)
* [JAVA-15027]Upgraded follow redirects for apache http client + moved older version to apache-httpclient4 module

* [JAVA-15027] Added test case
2023-05-22 21:47:58 +05:30
panos-kakos
9276300f25 TASK-20628 (#14074)
* [TASK-20628] Moved xml module to jdk9-and-above profile

* [TASK-20628] Moved xml-2 module to jdk9-and-above profile
2023-05-22 21:41:38 +05:30
panos-kakos
110c90169f [JAVA-21134] (#14045)
* [JAVA-21134] Removed external repository from jgit module

* [JAVA-21134] Removed external repository from aws-miscellaneous module + upgraded dynamodblocal version

* [JAVA-21134] Removed external repository from apache-tapestry module
2023-05-22 21:39:24 +05:30
Bipin kumar
8255831251 JAVA-21305 : Changes made for adding ratpack module to jdk9-and above… (#14012)
* JAVA-21106 : Changes made for adding ratpack module to jdk9-and above module

* JAVA-21106 : Changes made for adding java-lite module to jdk9-and above module

* JAVA-21305: Changes made for cleaninhg pom.xml

* JAVA-21305: Changes made for cleaning pom.xml

* BOSS-21305: changes made for adding ninja in jdk9 above modeule

* JAVA-21305: Changes made as per review comments

* JAVA-21305: Changes made as per review comments

* JAVA-21305: Changes made as per review comments
2023-05-22 21:35:36 +05:30
Vini
fdda5b84f3 Merge pull request #14014 from zahikhan/master
Fix formatting issues, refactor the profiles word in the properties.
2023-05-22 14:47:15 +02:00
uzma
0f7ea8184c [BAEL-6344] address PR comment 2023-05-22 13:40:23 +01:00
Vini
0044a8fa45 Merge pull request #14093 from sam-gardner/BAEL-6334-check-list-element-in-other-list
BAEL-6334 Make object properties example clearer
2023-05-22 14:36:10 +02:00
Vini
c513e7ee92 Merge pull request #13761 from ciphx/string_to_int_encapsulation
https://jira.baeldung.com/browse/BAEL-5859
2023-05-22 13:42:20 +02:00
Sam Gardner
ece652ec7b BAEL-6334 Make object properties example clearer 2023-05-22 10:35:26 +01:00
Deboshree
e0d73ee542 changing branch 2023-05-22 13:26:06 +05:30
Deboshree
89a7a2f448 changing unit test class name 2023-05-21 23:41:53 +05:30
ciphx
b98c11541c Merge branch 'eugenp:master' into string_to_int_encapsulation 2023-05-21 23:37:26 +05:30
Deboshree
3a1fd12709 removed optional specific function 2023-05-21 23:36:38 +05:30
Andrew Tarry
220d05d746 Delete README.md 2023-05-21 20:13:34 +03:00
Deboshree
3ba4098eaf change return type to optional 2023-05-18 19:27:02 +05:30
Andrew Tarry
c46ba5c545 add value of comparision 2023-05-17 21:23:14 +03:00
Zahid Khan
dfeb53c8bf Merge branch 'eugenp:master' into master 2023-05-15 11:48:09 +05:30
Zahid Khan
36473805bd Fix formatting issues, refactor the profiles word in the properties. 2023-05-15 11:47:43 +05:30
technoddy
255601afb9 updating class name for tests to abide by policy 2023-05-14 12:38:41 -04:00
Sam
04408ed180 Merge branch 'eugenp:master' into master 2023-05-14 12:27:30 -04:00
technoddy
b52c5ed2bd JPA Counting Row Implementation 2023-05-14 12:09:07 -04:00
alexandru.borza
509f65e571 Merge remote-tracking branch 'origin/master' 2023-05-12 20:19:50 +03:00
Alexandru Borza
3018c49076 Merge branch 'eugenp:master' into master 2023-05-12 20:19:32 +03:00
alexandru.borza
59ff6d75b1 Merge remote-tracking branch 'origin/master' 2023-05-12 20:11:37 +03:00
uzma
88f72aed7e [BAEL-6105] refactor test names 2023-05-05 15:04:09 +01:00
uzma
62b9ec7c42 [BAEL-6105] code for list to page article 2023-05-05 14:52:08 +01:00
uzma
ec24c69fd2 [BAEL-6105] code for list to page article 2023-05-05 11:07:33 +01:00
uzma
4222e7c88a [BAEL-6105] code for correct use of flush 2023-05-04 19:33:42 +01:00
uzma
3fd029808f [BAEL-6105] code for correct use of flush 2023-05-04 17:46:56 +01:00
press0
e679f1d36e Merge branch 'eugenp:master' into master 2023-05-02 21:40:51 -05:00
uzma
0ab3847e2c [BAEL-6105] code for correct use of flush 2023-05-01 22:57:57 +01:00
Kingsley✨
4bd982104e Merge branch 'eugenp:master' into master 2023-04-30 21:28:54 +05:30
Kingsley Amankwah
234821d400 Comments removed 2023-04-30 15:58:54 +05:30
Kingsley Amankwah
99df14ecb9 getters and setters removed from code 2023-04-30 15:53:49 +05:30
Kingsley Amankwah
8d29c1d263 Hibernate Associations 2023-04-27 05:10:50 +05:30
Kingsley Amankwah
47388fb20c Hibernate Associations 2023-04-27 05:00:38 +05:30
press0
7c1f04d893 Merge branch 'eugenp:master' into master 2023-04-26 17:02:40 -05:00
Kingsley✨
c18380136d Merge branch 'eugenp:master' into master 2023-04-24 05:25:30 +00:00
Kingsley✨
0120c52669 Merge branch 'eugenp:master' into master 2023-04-22 08:36:53 +00:00
Kingsley Amankwah
d80a33e659 JPA/Hibernate Associations 2023-04-21 04:48:52 +05:30
press0
157507aa9a Merge branch 'eugenp:master' into master 2023-04-10 10:39:14 -05:00
press0@gmail.com
1327f2d0af PR 2023-04-10 10:37:33 -05:00
Deboshree
6f3afad74f https://jira.baeldung.com/browse/BAEL-5837
pass default value as method param
2023-04-10 08:30:15 +05:30
Deboshree
c8867dd347 https://jira.baeldung.com/browse/BAEL-
moved the code to a different module
2023-04-03 15:11:48 +05:30
Fabio Bento Luiz
06fa64fcd9 Get the user id from the original event instead of creating a new oe 2023-03-25 19:57:45 +01:00
alexandru.borza
7c0b1e9e34 review 2023-03-24 22:46:29 +02:00
alexandru.borza
ad6f541bfe review 2023-03-24 22:44:22 +02:00
technoddy
4de59a4946 Creating shallow copy vs deep copy in Java 2023-03-19 13:50:18 -04:00
alexandru.borza
6f3d8d176e time-based UUIDs 2023-03-17 19:58:29 +02:00
alexandru.borza
07874feede BAEL-6195 2023-02-06 23:24:32 +02:00
Alexandru Borza
2248593be9 Merge branch 'eugenp:master' into master 2023-02-06 21:23:03 +02:00
alexandru.borza
96ace48d39 delete module 2023-01-29 20:38:26 +02:00
alexandru.borza
10ece15120 move code 2023-01-29 20:34:59 +02:00
alexandru.borza
3cceac88ae configure pom parent 2023-01-29 19:46:23 +02:00
alexandru.borza
ee0c63afeb initialize arraylist with null or zeros 2023-01-29 01:53:53 +02:00
1979 changed files with 32745 additions and 10223 deletions

6
.gitignore vendored
View File

@@ -70,6 +70,7 @@ jmeter/src/main/resources/*-JMeter*.csv
jmeter/src/main/resources/*ReportsDashboard*.csv
jmeter/src/main/resources/dashboard/*ReportsDashboard*.csv
jmeter/src/main/resources/*FileExtractionExample.csv
jmeter/src/main/resources/*_Summary-Report.csv
ninja/devDb.mv.db
@@ -120,4 +121,7 @@ libraries-2/src/test/resources/crawler4j/**
devDb*.db
#jaxb
*.xjb
*.xjb
#neo4j
persistence-modules/neo4j/data/**

View File

@@ -8,9 +8,8 @@ This module contains articles about algorithms. Some classes of algorithms, e.g.
- [Java Two Pointer Technique](https://www.baeldung.com/java-two-pointer-technique)
- [Implementing Simple State Machines with Java Enums](https://www.baeldung.com/java-enum-simple-state-machine)
- [Converting Between Roman and Arabic Numerals in Java](https://www.baeldung.com/java-convert-roman-arabic)
- [Practical Java Examples of the Big O Notation](https://www.baeldung.com/java-algorithm-complexity)
- [Checking If a List Is Sorted in Java](https://www.baeldung.com/java-check-if-list-sorted)
- [Checking if a Java Graph has a Cycle](https://www.baeldung.com/java-graph-has-a-cycle)
- [Checking if a Java Graph Has a Cycle](https://www.baeldung.com/java-graph-has-a-cycle)
- [A Guide to the Folding Technique in Java](https://www.baeldung.com/folding-hashing-technique)
- [Creating a Triangle with for Loops in Java](https://www.baeldung.com/java-print-triangle)
- [The K-Means Clustering Algorithm in Java](https://www.baeldung.com/java-k-means-clustering-algorithm)

View File

@@ -5,10 +5,10 @@ This module contains articles about algorithms. Some classes of algorithms, e.g.
### Relevant articles:
- [Multi-Swarm Optimization Algorithm in Java](https://www.baeldung.com/java-multi-swarm-algorithm)
- [Check If a String Contains All The Letters of The Alphabet with Java](https://www.baeldung.com/java-string-contains-all-letters)
- [Check if a String Contains All the Letters of the Alphabet With Java](https://www.baeldung.com/java-string-contains-all-letters)
- [Find the Middle Element of a Linked List in Java](https://www.baeldung.com/java-linked-list-middle-element)
- [Find Substrings That Are Palindromes in Java](https://www.baeldung.com/java-palindrome-substrings)
- [Find the Longest Substring without Repeating Characters](https://www.baeldung.com/java-longest-substring-without-repeated-characters)
- [Find the Longest Substring Without Repeating Characters](https://www.baeldung.com/java-longest-substring-without-repeated-characters)
- [Permutations of an Array in Java](https://www.baeldung.com/java-array-permutations)
- [Find the Smallest Missing Integer in an Array](https://www.baeldung.com/java-smallest-missing-integer-in-array)
- [Permutations of a String in Java](https://www.baeldung.com/java-string-permutations)

View File

@@ -9,7 +9,7 @@ This module contains articles about algorithms. Some classes of algorithms, e.g.
- [Reversing a Binary Tree in Java](https://www.baeldung.com/java-reversing-a-binary-tree)
- [Find If Two Numbers Are Relatively Prime in Java](https://www.baeldung.com/java-two-relatively-prime-numbers)
- [Knapsack Problem Implementation in Java](https://www.baeldung.com/java-knapsack)
- [How to Determine if a Binary Tree is Balanced in Java](https://www.baeldung.com/java-balanced-binary-tree)
- [How to Determine if a Binary Tree Is Balanced in Java](https://www.baeldung.com/java-balanced-binary-tree)
- [Overview of Combinatorial Problems in Java](https://www.baeldung.com/java-combinatorial-algorithms)
- [Prims Algorithm with a Java Implementation](https://www.baeldung.com/java-prim-algorithm)
- [Maximum Subarray Problem in Java](https://www.baeldung.com/java-maximum-subarray)

View File

@@ -23,7 +23,8 @@ public class BalancedBracketsUsingDeque {
if (ch == '{' || ch == '[' || ch == '(') {
deque.addFirst(ch);
} else {
if (!deque.isEmpty() && ((deque.peekFirst() == '{' && ch == '}') || (deque.peekFirst() == '[' && ch == ']') || (deque.peekFirst() == '(' && ch == ')'))) {
if (!deque.isEmpty() && ((deque.peekFirst() == '{' && ch == '}') || (deque.peekFirst() == '[' && ch == ']') || (deque.peekFirst() == '(' &&
ch == ')'))) {
deque.removeFirst();
} else {
return false;

View File

@@ -16,9 +16,7 @@ public class BalancedBracketsUsingString {
}
while (str.contains("()") || str.contains("[]") || str.contains("{}")) {
str = str.replaceAll("\\(\\)", "")
.replaceAll("\\[\\]", "")
.replaceAll("\\{\\}", "");
str = str.replaceAll("\\(\\)", "").replaceAll("\\[\\]", "").replaceAll("\\{\\}", "");
}
return (str.length() == 0);

View File

@@ -6,8 +6,7 @@ import com.google.common.graph.ValueGraphBuilder;
public class BoruvkaMST {
private static MutableValueGraph<Integer, Integer> mst = ValueGraphBuilder.undirected()
.build();
private static MutableValueGraph<Integer, Integer> mst = ValueGraphBuilder.undirected().build();
private static int totalWeight;
public BoruvkaMST(MutableValueGraph<Integer, Integer> graph) {
@@ -18,7 +17,7 @@ public class BoruvkaMST {
// repeat at most log N times or until we have N-1 edges
for (int t = 1; t < size && mst.edges().size() < size - 1; t = t + t) {
EndpointPair<Integer>[] closestEdgeArray = new EndpointPair[size];
// foreach tree in graph, find closest edge
@@ -69,13 +68,9 @@ public class BoruvkaMST {
}
}
public MutableValueGraph<Integer, Integer> getMST() {
return mst;
}
public MutableValueGraph<Integer, Integer> getMST() { return mst; }
public int getTotalWeight() {
return totalWeight;
}
public int getTotalWeight() { return totalWeight; }
public String toString() {
return "MST: " + mst.toString() + " | Total Weight: " + totalWeight;

View File

@@ -1,6 +1,7 @@
package com.baeldung.algorithms.boruvka;
public class UnionFind {
private int[] parents;
private int[] ranks;

View File

@@ -14,7 +14,8 @@ public class CaesarCipher {
private static final char LETTER_A = 'a';
private static final char LETTER_Z = 'z';
private static final int ALPHABET_SIZE = LETTER_Z - LETTER_A + 1;
private static final double[] ENGLISH_LETTERS_PROBABILITIES = {0.073, 0.009, 0.030, 0.044, 0.130, 0.028, 0.016, 0.035, 0.074, 0.002, 0.003, 0.035, 0.025, 0.078, 0.074, 0.027, 0.003, 0.077, 0.063, 0.093, 0.027, 0.013, 0.016, 0.005, 0.019, 0.001};
private static final double[] ENGLISH_LETTERS_PROBABILITIES = { 0.073, 0.009, 0.030, 0.044, 0.130, 0.028, 0.016, 0.035, 0.074, 0.002, 0.003, 0.035, 0.025,
0.078, 0.074, 0.027, 0.003, 0.077, 0.063, 0.093, 0.027, 0.013, 0.016, 0.005, 0.019, 0.001 };
public String cipher(String message, int offset) {
StringBuilder result = new StringBuilder();
@@ -57,21 +58,15 @@ public class CaesarCipher {
}
private long[] observedLettersFrequencies(String message) {
return IntStream.rangeClosed(LETTER_A, LETTER_Z)
.mapToLong(letter -> countLetter((char) letter, message))
.toArray();
return IntStream.rangeClosed(LETTER_A, LETTER_Z).mapToLong(letter -> countLetter((char) letter, message)).toArray();
}
private long countLetter(char letter, String message) {
return message.chars()
.filter(character -> character == letter)
.count();
return message.chars().filter(character -> character == letter).count();
}
private double[] expectedLettersFrequencies(int messageLength) {
return Arrays.stream(ENGLISH_LETTERS_PROBABILITIES)
.map(probability -> probability * messageLength)
.toArray();
return Arrays.stream(ENGLISH_LETTERS_PROBABILITIES).map(probability -> probability * messageLength).toArray();
}
private int probableOffset(double[] chiSquares) {

View File

@@ -4,17 +4,19 @@ import lombok.Getter;
public class Follower {
@Getter String username;
@Getter long count;
@Getter
String username;
@Getter
long count;
public Follower(String username, long count) {
super();
this.username = username;
this.count = count;
}
@Override
public String toString() {
return "User: " + username + ", Followers: " + count + "\n\r" ;
return "User: " + username + ", Followers: " + count + "\n\r";
}
}

View File

@@ -7,38 +7,32 @@ public class FollowersPath {
private List<Follower> accounts;
private long count;
public FollowersPath() {
super();
this.accounts = new ArrayList<>();
}
public List<Follower> getAccounts() {
return accounts;
}
public long getCount() {
return count;
}
public List<Follower> getAccounts() { return accounts; }
public long getCount() { return count; }
public void addFollower(String username, long count) {
accounts.add(new Follower(username, count));
}
public void addCount(long count) {
this.count += count;
}
@Override
public String toString() {
String details = "";
for(Follower a : accounts) {
details+=a.toString() + ", ";
for (Follower a : accounts) {
details += a.toString() + ", ";
}
return "Total: " + count + ", \n\r" +
" Details: { " + "\n\r" +
details + "\n\r" +
" }";
return "Total: " + count + ", \n\r" + " Details: { " + "\n\r" + details + "\n\r" + " }";
}
}

View File

@@ -5,20 +5,20 @@ import java.util.List;
public class GreedyAlgorithm {
int currentLevel = 0;
final int maxLevel = 3;
final int maxLevel = 3;
SocialConnector sc;
FollowersPath fp;
public GreedyAlgorithm(SocialConnector sc) {
super();
this.sc = sc;
this.fp = new FollowersPath();
}
public long findMostFollowersPath(String account) {
long max = 0;
SocialUser toFollow = null;
List<SocialUser> followers = sc.getFollowers(account);
for (SocialUser el : followers) {
long followersCount = el.getFollowersCount();
@@ -27,17 +27,15 @@ public class GreedyAlgorithm {
max = followersCount;
}
}
if (currentLevel < maxLevel - 1) {
currentLevel++;
max += findMostFollowersPath(toFollow.getUsername());
return max;
} else {
return max;
}
}
public FollowersPath getFollowers() {
return fp;
}
}
public FollowersPath getFollowers() { return fp; }
}

View File

@@ -5,20 +5,20 @@ import java.util.List;
public class NonGreedyAlgorithm {
int currentLevel = 0;
final int maxLevel = 3;
final int maxLevel = 3;
SocialConnector tc;
public NonGreedyAlgorithm(SocialConnector tc, int level) {
super();
this.tc = tc;
this.currentLevel = level;
}
public long findMostFollowersPath(String account) {
List<SocialUser> followers = tc.getFollowers(account);
long total = currentLevel > 0 ? followers.size() : 0;
if (currentLevel < maxLevel ) {
if (currentLevel < maxLevel) {
currentLevel++;
long[] count = new long[followers.size()];
@@ -28,16 +28,16 @@ public class NonGreedyAlgorithm {
count[i] = sub.findMostFollowersPath(el.getUsername());
i++;
}
long max = 0;
for (; i > 0; i--) {
if (count[i-1] > max )
max = count[i-1];
if (count[i - 1] > max)
max = count[i - 1];
}
return total + max;
}
return total;
}
}

View File

@@ -7,25 +7,29 @@ import lombok.Getter;
import lombok.Setter;
public class SocialConnector {
private boolean isCounterEnabled = true;
private int counter = 4;
@Getter @Setter List<SocialUser> users;
@Getter
@Setter
List<SocialUser> users;
public SocialConnector() {
users = new ArrayList<>();
}
public boolean switchCounter() {
this.isCounterEnabled = !this.isCounterEnabled;
return this.isCounterEnabled;
}
public List<SocialUser> getFollowers(String account) {
if (counter < 0)
throw new IllegalStateException ("API limit reached");
throw new IllegalStateException("API limit reached");
else {
if(this.isCounterEnabled) counter--;
for(SocialUser user : users) {
if (this.isCounterEnabled)
counter--;
for (SocialUser user : users) {
if (user.getUsername().equals(account)) {
return user.getFollowers();
}

View File

@@ -7,32 +7,32 @@ import lombok.Getter;
public class SocialUser {
@Getter private String username;
@Getter private List<SocialUser> followers;
@Getter
private String username;
@Getter
private List<SocialUser> followers;
public SocialUser(String username) {
super();
this.username = username;
this.followers = new ArrayList<>();
}
public SocialUser(String username, List<SocialUser> followers) {
super();
this.username = username;
this.followers = followers;
}
public long getFollowersCount() {
return followers.size();
}
public long getFollowersCount() { return followers.size(); }
public void addFollowers(List<SocialUser> followers) {
this.followers.addAll(followers);
}
@Override
public boolean equals(Object obj) {
return ((SocialUser) obj).getUsername().equals(username);
}
}

View File

@@ -10,19 +10,11 @@ public class DisjointSetInfo {
setRank(1);
}
public Integer getParentNode() {
return parentNode;
}
public Integer getParentNode() { return parentNode; }
public void setParentNode(Integer parentNode) {
this.parentNode = parentNode;
}
public void setParentNode(Integer parentNode) { this.parentNode = parentNode; }
public int getRank() {
return rank;
}
public int getRank() { return rank; }
public void setRank(int rank) {
this.rank = rank;
}
public void setRank(int rank) { this.rank = rank; }
}

View File

@@ -10,19 +10,11 @@ public class ListNode {
this.next = null;
}
public int getData() {
return data;
}
public int getData() { return data; }
public ListNode getNext() {
return next;
}
public ListNode getNext() { return next; }
public void setData(int data) {
this.data = data;
}
public void setData(int data) { this.data = data; }
public void setNext(ListNode next) {
this.next = next;
}
public void setNext(ListNode next) { this.next = next; }
}

View File

@@ -45,9 +45,7 @@ public class MinHeap {
return (2 * index + 2);
}
HeapNode getRootNode() {
return heapNodes[0];
}
HeapNode getRootNode() { return heapNodes[0]; }
void heapifyFromRoot() {
heapify(0);
@@ -58,7 +56,7 @@ public class MinHeap {
heapNodes[i] = heapNodes[j];
heapNodes[j] = temp;
}
static int[] merge(int[][] array) {
HeapNode[] heapNodes = new HeapNode[array.length];
int resultingArraySize = 0;
@@ -68,7 +66,7 @@ public class MinHeap {
heapNodes[i] = node;
resultingArraySize += array[i].length;
}
MinHeap minHeap = new MinHeap(heapNodes);
int[] resultingArray = new int[resultingArraySize];

View File

@@ -9,6 +9,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Board {
private static final Logger LOG = LoggerFactory.getLogger(Board.class);
private final int[][] board;
@@ -16,7 +17,7 @@ public class Board {
private final int score;
public Board(int size) {
assert(size > 0);
assert (size > 0);
this.board = new int[size][];
this.score = 0;
@@ -38,19 +39,15 @@ public class Board {
}
}
public int getSize() {
return board.length;
}
public int getSize() { return board.length; }
public int getScore() {
return score;
}
public int getScore() { return score; }
public int getCell(Cell cell) {
int x = cell.getX();
int y = cell.getY();
assert(x >= 0 && x < board.length);
assert(y >= 0 && y < board.length);
assert (x >= 0 && x < board.length);
assert (y >= 0 && y < board.length);
return board[x][y];
}
@@ -90,7 +87,8 @@ public class Board {
}
LOG.debug("Before move: {}", Arrays.deepToString(tiles));
// If we're doing an Left/Right move then transpose the board to make it a Up/Down move
// If we're doing an Left/Right move then transpose the board to make it a
// Up/Down move
if (move == Move.LEFT || move == Move.RIGHT) {
tiles = transpose(tiles);
LOG.debug("After transpose: {}", Arrays.deepToString(tiles));

View File

@@ -3,6 +3,7 @@ package com.baeldung.algorithms.play2048;
import java.util.StringJoiner;
public class Cell {
private int x;
private int y;
@@ -11,13 +12,9 @@ public class Cell {
this.y = y;
}
public int getX() {
return x;
}
public int getX() { return x; }
public int getY() {
return y;
}
public int getY() { return y; }
@Override
public String toString() {

View File

@@ -7,6 +7,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Computer {
private static final Logger LOG = LoggerFactory.getLogger(Computer.class);
private final SecureRandom rng = new SecureRandom();

View File

@@ -12,69 +12,57 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Human {
private static final Logger LOG = LoggerFactory.getLogger(Human.class);
public Board makeMove(Board input) {
// For each move in MOVE
// Generate board from move
// Generate Score for Board
// Generate board from move
// Generate Score for Board
// Return board with the best score
//
// Generate Score
// If Depth Limit
// Return Final Score
// Total Score = 0
// For every empty square in new board
// Generate board with "2" in square
// Calculate Score
// Total Score += (Score * 0.9)
// Generate board with "4" in square
// Calculate Score
// Total Score += (Score * 0.1)
// If Depth Limit
// Return Final Score
// Total Score = 0
// For every empty square in new board
// Generate board with "2" in square
// Calculate Score
// Total Score += (Score * 0.9)
// Generate board with "4" in square
// Calculate Score
// Total Score += (Score * 0.1)
//
// Calculate Score
// For each move in MOVE
// Generate board from move
// Generate score for board
// Return the best generated score
// For each move in MOVE
// Generate board from move
// Generate score for board
// Return the best generated score
return Arrays.stream(Move.values())
.parallel()
.map(input::move)
.filter(board -> !board.equals(input))
.max(Comparator.comparingInt(board -> generateScore(board, 0)))
.orElse(input);
return Arrays.stream(Move.values()).parallel().map(input::move).filter(board -> !board.equals(input)).max(Comparator.comparingInt(board -> generateScore(board,
0))).orElse(input);
}
private int generateScore(Board board, int depth) {
if (depth >= 3) {
int finalScore = calculateFinalScore(board);
LOG.debug("Final score for board {}: {}", board,finalScore);
LOG.debug("Final score for board {}: {}", board, finalScore);
return finalScore;
}
return board.emptyCells().stream()
.parallel()
.flatMap(cell -> Stream.of(new Pair<>(cell, 2), new Pair<>(cell, 4)))
.mapToInt(move -> {
LOG.debug("Simulating move {} at depth {}", move, depth);
Board newBoard = board.placeTile(move.getFirst(), move.getSecond());
int boardScore = calculateScore(newBoard, depth + 1);
int calculatedScore = (int) (boardScore * (move.getSecond() == 2 ? 0.9 : 0.1));
LOG.debug("Calculated score for board {} and move {} at depth {}: {}", newBoard, move, depth, calculatedScore);
return calculatedScore;
})
.sum();
return board.emptyCells().stream().parallel().flatMap(cell -> Stream.of(new Pair<>(cell, 2), new Pair<>(cell, 4))).mapToInt(move -> {
LOG.debug("Simulating move {} at depth {}", move, depth);
Board newBoard = board.placeTile(move.getFirst(), move.getSecond());
int boardScore = calculateScore(newBoard, depth + 1);
int calculatedScore = (int) (boardScore * (move.getSecond() == 2 ? 0.9 : 0.1));
LOG.debug("Calculated score for board {} and move {} at depth {}: {}", newBoard, move, depth, calculatedScore);
return calculatedScore;
}).sum();
}
private int calculateScore(Board board, int depth) {
return Arrays.stream(Move.values())
.parallel()
.map(board::move)
.filter(moved -> !moved.equals(board))
.mapToInt(newBoard -> generateScore(newBoard, depth))
.max()
.orElse(0);
return Arrays.stream(Move.values()).parallel().map(board::move).filter(moved -> !moved.equals(board)).mapToInt(newBoard -> generateScore(newBoard,
depth)).max().orElse(0);
}
private int calculateFinalScore(Board board) {
@@ -92,35 +80,30 @@ public class Human {
rowsToScore.add(col);
}
return rowsToScore.stream()
.parallel()
.mapToInt(row -> {
List<Integer> preMerged = row.stream()
.filter(value -> value != 0)
.collect(Collectors.toList());
return rowsToScore.stream().parallel().mapToInt(row -> {
List<Integer> preMerged = row.stream().filter(value -> value != 0).collect(Collectors.toList());
int numMerges = 0;
int monotonicityLeft = 0;
int monotonicityRight = 0;
for (int i = 0; i < preMerged.size() - 1; ++i) {
Integer first = preMerged.get(i);
Integer second = preMerged.get(i + 1);
if (first.equals(second)) {
++numMerges;
} else if (first > second) {
monotonicityLeft += first - second;
} else {
monotonicityRight += second - first;
}
int numMerges = 0;
int monotonicityLeft = 0;
int monotonicityRight = 0;
for (int i = 0; i < preMerged.size() - 1; ++i) {
Integer first = preMerged.get(i);
Integer second = preMerged.get(i + 1);
if (first.equals(second)) {
++numMerges;
} else if (first > second) {
monotonicityLeft += first - second;
} else {
monotonicityRight += second - first;
}
}
int score = 1000;
score += 250 * row.stream().filter(value -> value == 0).count();
score += 750 * numMerges;
score -= 10 * row.stream().mapToInt(value -> value).sum();
score -= 50 * Math.min(monotonicityLeft, monotonicityRight);
return score;
})
.sum();
int score = 1000;
score += 250 * row.stream().filter(value -> value == 0).count();
score += 750 * numMerges;
score -= 10 * row.stream().mapToInt(value -> value).sum();
score -= 50 * Math.min(monotonicityLeft, monotonicityRight);
return score;
}).sum();
}
}

View File

@@ -1,6 +1,7 @@
package com.baeldung.algorithms.play2048;
public class Play2048 {
private static final int SIZE = 4;
private static final int INITIAL_NUMBERS = 2;
@@ -44,7 +45,6 @@ public class Play2048 {
topLines.append("+");
midLines.append("|");
for (int y = 0; y < board.getSize(); ++y) {
System.out.println(topLines);
System.out.println(midLines);

View File

@@ -3,5 +3,6 @@ package com.baeldung.algorithms.topkelements;
import java.util.List;
public interface TopKElementsFinder<T extends Comparable<T>> {
List<T> findTopK(List<T> input, int k);
}

View File

@@ -1,12 +1,12 @@
package com.baeldung.algorithms.balancedbrackets;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
class BalancedBracketsUsingDequeUnitTest {
private BalancedBracketsUsingDeque balancedBracketsUsingDeque;
@BeforeEach

View File

@@ -1,12 +1,12 @@
package com.baeldung.algorithms.balancedbrackets;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
class BalancedBracketsUsingStringUnitTest {
private BalancedBracketsUsingString balancedBracketsUsingString;
@BeforeEach

View File

@@ -14,8 +14,7 @@ class BoruvkaUnitTest {
@BeforeEach
public void setup() {
graph = ValueGraphBuilder.undirected()
.build();
graph = ValueGraphBuilder.undirected().build();
graph.putEdgeValue(0, 1, 8);
graph.putEdgeValue(0, 2, 5);
graph.putEdgeValue(1, 2, 9);

View File

@@ -5,6 +5,7 @@ import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
class CaesarCipherUnitTest {
private static final String SENTENCE = "he told me i could never teach a llama to drive";
private static final String SENTENCE_SHIFTED_THREE = "kh wrog ph l frxog qhyhu whdfk d oodpd wr gulyh";
private static final String SENTENCE_SHIFTED_TEN = "ro dyvn wo s myevn xofob dokmr k vvkwk dy nbsfo";
@@ -15,69 +16,59 @@ class CaesarCipherUnitTest {
void givenSentenceAndShiftThree_whenCipher_thenCipheredMessageWithoutOverflow() {
String cipheredSentence = algorithm.cipher(SENTENCE, 3);
assertThat(cipheredSentence)
.isEqualTo(SENTENCE_SHIFTED_THREE);
assertThat(cipheredSentence).isEqualTo(SENTENCE_SHIFTED_THREE);
}
@Test
void givenSentenceAndShiftTen_whenCipher_thenCipheredMessageWithOverflow() {
String cipheredSentence = algorithm.cipher(SENTENCE, 10);
assertThat(cipheredSentence)
.isEqualTo(SENTENCE_SHIFTED_TEN);
assertThat(cipheredSentence).isEqualTo(SENTENCE_SHIFTED_TEN);
}
@Test
void givenSentenceAndShiftThirtySix_whenCipher_thenCipheredLikeTenMessageWithOverflow() {
String cipheredSentence = algorithm.cipher(SENTENCE, 36);
assertThat(cipheredSentence)
.isEqualTo(SENTENCE_SHIFTED_TEN);
assertThat(cipheredSentence).isEqualTo(SENTENCE_SHIFTED_TEN);
}
@Test
void givenSentenceShiftedThreeAndShiftThree_whenDecipher_thenOriginalSentenceWithoutOverflow() {
String decipheredSentence = algorithm.decipher(SENTENCE_SHIFTED_THREE, 3);
assertThat(decipheredSentence)
.isEqualTo(SENTENCE);
assertThat(decipheredSentence).isEqualTo(SENTENCE);
}
@Test
void givenSentenceShiftedTenAndShiftTen_whenDecipher_thenOriginalSentenceWithOverflow() {
String decipheredSentence = algorithm.decipher(SENTENCE_SHIFTED_TEN, 10);
assertThat(decipheredSentence)
.isEqualTo(SENTENCE);
assertThat(decipheredSentence).isEqualTo(SENTENCE);
}
@Test
void givenSentenceShiftedTenAndShiftThirtySix_whenDecipher_thenOriginalSentenceWithOverflow() {
String decipheredSentence = algorithm.decipher(SENTENCE_SHIFTED_TEN, 36);
assertThat(decipheredSentence)
.isEqualTo(SENTENCE);
assertThat(decipheredSentence).isEqualTo(SENTENCE);
}
@Test
void givenSentenceShiftedThree_whenBreakCipher_thenOriginalSentence() {
int offset = algorithm.breakCipher(SENTENCE_SHIFTED_THREE);
assertThat(offset)
.isEqualTo(3);
assertThat(offset).isEqualTo(3);
assertThat(algorithm.decipher(SENTENCE_SHIFTED_THREE, offset))
.isEqualTo(SENTENCE);
assertThat(algorithm.decipher(SENTENCE_SHIFTED_THREE, offset)).isEqualTo(SENTENCE);
}
@Test
void givenSentenceShiftedTen_whenBreakCipher_thenOriginalSentence() {
int offset = algorithm.breakCipher(SENTENCE_SHIFTED_TEN);
assertThat(offset)
.isEqualTo(10);
assertThat(offset).isEqualTo(10);
assertThat(algorithm.decipher(SENTENCE_SHIFTED_TEN, offset))
.isEqualTo(SENTENCE);
assertThat(algorithm.decipher(SENTENCE_SHIFTED_TEN, offset)).isEqualTo(SENTENCE);
}
}

View File

@@ -10,8 +10,7 @@ class GradientDescentUnitTest {
@Test
void givenFunction_whenStartingPointIsOne_thenLocalMinimumIsFound() {
Function<Double, Double> df = x ->
StrictMath.abs(StrictMath.pow(x, 3)) - (3 * StrictMath.pow(x, 2)) + x;
Function<Double, Double> df = x -> StrictMath.abs(StrictMath.pow(x, 3)) - (3 * StrictMath.pow(x, 2)) + x;
GradientDescent gd = new GradientDescent();
double res = gd.findLocalMinimum(df, 1);
assertTrue(res > 1.78);

View File

@@ -6,8 +6,6 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.Test;
import java.util.Arrays;
class GreedyAlgorithmUnitTest {
private SocialConnector prepareNetwork() {
@@ -22,16 +20,15 @@ class GreedyAlgorithmUnitTest {
SocialUser child31 = new SocialUser("child31");
SocialUser child311 = new SocialUser("child311");
SocialUser child3111 = new SocialUser("child3111");
child211.addFollowers(Arrays.asList(new SocialUser[]{child2111}));
child311.addFollowers(Arrays.asList(new SocialUser[]{child3111}));
child21.addFollowers(Arrays.asList(new SocialUser[]{child211}));
child31.addFollowers(Arrays.asList(new SocialUser[]{child311,
new SocialUser("child312"), new SocialUser("child313"), new SocialUser("child314")}));
child1.addFollowers(Arrays.asList(new SocialUser[]{new SocialUser("child11"), new SocialUser("child12")}));
child2.addFollowers(Arrays.asList(new SocialUser[]{child21, new SocialUser("child22"), new SocialUser("child23")}));
child3.addFollowers(Arrays.asList(new SocialUser[]{child31}));
root.addFollowers(Arrays.asList(new SocialUser[]{child1, child2, child3}));
sc.setUsers(Arrays.asList(new SocialUser[]{root, child1, child2, child3, child21, child31, child311, child211}));
child211.addFollowers(Arrays.asList(new SocialUser[] { child2111 }));
child311.addFollowers(Arrays.asList(new SocialUser[] { child3111 }));
child21.addFollowers(Arrays.asList(new SocialUser[] { child211 }));
child31.addFollowers(Arrays.asList(new SocialUser[] { child311, new SocialUser("child312"), new SocialUser("child313"), new SocialUser("child314") }));
child1.addFollowers(Arrays.asList(new SocialUser[] { new SocialUser("child11"), new SocialUser("child12") }));
child2.addFollowers(Arrays.asList(new SocialUser[] { child21, new SocialUser("child22"), new SocialUser("child23") }));
child3.addFollowers(Arrays.asList(new SocialUser[] { child31 }));
root.addFollowers(Arrays.asList(new SocialUser[] { child1, child2, child3 }));
sc.setUsers(Arrays.asList(new SocialUser[] { root, child1, child2, child3, child21, child31, child311, child211 }));
return sc;
}
@@ -46,7 +43,7 @@ class GreedyAlgorithmUnitTest {
NonGreedyAlgorithm nga = new NonGreedyAlgorithm(prepareNetwork(), 0);
assertThrows(IllegalStateException.class, () -> {
nga.findMostFollowersPath("root");
});
});
}
@Test

View File

@@ -1,6 +1,5 @@
package com.baeldung.algorithms.kruskal;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

View File

@@ -6,6 +6,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
import org.junit.jupiter.api.Test;
class LinkedListReversalUnitTest {
@Test
void givenLinkedList_whenIterativeReverse_thenOutputCorrectResult() {
ListNode head = constructLinkedList();

View File

@@ -14,9 +14,9 @@ class MinHeapUnitTest {
@Test
void givenSortedArrays_whenMerged_thenShouldReturnASingleSortedarray() {
int[] resultArray = MinHeap.merge(inputArray);
assertThat(resultArray.length, is(equalTo(10)));
assertThat(resultArray, is(equalTo(expectedArray)));
}
}

View File

@@ -8,6 +8,7 @@ import static org.assertj.core.api.Java6Assertions.assertThat;
import org.junit.jupiter.api.Test;
class TopKElementsFinderUnitTest {
private final TopKElementsFinder<Integer> bruteForceFinder = new BruteForceTopKElementsFinder();
private final TopKElementsFinder<Integer> maxHeapFinder = new MaxHeapTopKElementsFinder();
private final TopKElementsFinder<Integer> treeSetFinder = new TreeSetTopKElementsFinder();
@@ -18,7 +19,6 @@ class TopKElementsFinderUnitTest {
private final List<Integer> nonDistinctIntegers = Arrays.asList(1, 2, 3, 3, 9, 9, 7, 6, 12);
private final List<Integer> nonDistinctIntegersTopK = Arrays.asList(9, 9, 7, 12);
@Test
void givenArrayDistinctIntegers_whenBruteForceFindTopK_thenReturnKLargest() {
assertThat(bruteForceFinder.findTopK(distinctIntegers, k)).containsOnlyElementsOf(distinctIntegersTopK);

View File

@@ -23,7 +23,7 @@ public class Graph {
adjVertices.get(src).add(dest);
}
public void dfsWithoutRecursion(int start) {
public boolean[] dfsWithoutRecursion(int start) {
Stack<Integer> stack = new Stack<Integer>();
boolean[] isVisited = new boolean[adjVertices.size()];
stack.push(start);
@@ -38,20 +38,22 @@ public class Graph {
}
}
}
return isVisited;
}
public void dfs(int start) {
public boolean[] dfs(int start) {
boolean[] isVisited = new boolean[adjVertices.size()];
dfsRecursive(start, isVisited);
return dfsRecursive(start, isVisited);
}
private void dfsRecursive(int current, boolean[] isVisited) {
private boolean[] dfsRecursive(int current, boolean[] isVisited) {
isVisited[current] = true;
visit(current);
for (int dest : adjVertices.get(current)) {
if (!isVisited[dest])
dfsRecursive(dest, isVisited);
}
return isVisited;
}
public List<Integer> topologicalSort(int start) {

View File

@@ -1,7 +1,9 @@
package com.baeldung.algorithms.dfs;
import java.util.Arrays;
import java.util.List;
import org.junit.Assert;
import org.junit.jupiter.api.Test;
class GraphUnitTest {
@@ -9,9 +11,12 @@ class GraphUnitTest {
@Test
void givenDirectedGraph_whenDFS_thenPrintAllValues() {
Graph graph = createDirectedGraph();
graph.dfs(0);
System.out.println();
graph.dfsWithoutRecursion(0);
boolean[] visited;
visited = graph.dfs(0);
boolean[] expected = new boolean[]{true, true, true, true, true, true};
Assert.assertArrayEquals(expected, visited);
visited = graph.dfsWithoutRecursion(0);
Assert.assertArrayEquals(expected, visited);
}
@Test
@@ -19,6 +24,8 @@ class GraphUnitTest {
Graph graph = createDirectedGraph();
List<Integer> list = graph.topologicalSort(0);
System.out.println(list);
List<Integer> expected = Arrays.asList(0, 2, 1, 3, 4, 5);
Assert.assertEquals(expected, list);
}
private Graph createDirectedGraph() {

View File

@@ -1,3 +1,3 @@
### Relevant Articles:
- [Server-Sent Events (SSE) In JAX-RS](https://www.baeldung.com/java-ee-jax-rs-sse)
- [Server-Sent Events (SSE) in JAX-RS](https://www.baeldung.com/java-ee-jax-rs-sse)

View File

@@ -13,5 +13,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [How To Get Cookies From the Apache HttpClient Response](https://www.baeldung.com/java-apache-httpclient-cookies)
- [Enabling Logging for Apache HttpClient](https://www.baeldung.com/apache-httpclient-enable-logging)
- [Apache HttpClient vs. CloseableHttpClient](https://www.baeldung.com/apache-httpclient-vs-closeablehttpclient)
- [Expand Shortened URLs with Apache HttpClient](https://www.baeldung.com/apache-httpclient-expand-url)
- More articles: [[<-- prev]](../apache-httpclient)

View File

@@ -0,0 +1,18 @@
package com.baeldung.httpclient.httpclient;
import java.io.IOException;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
public final class ClientUtil {
private ClientUtil(){}
public static void closeClient(CloseableHttpClient client) throws IOException {
if (client == null) {
return;
}
client.close();
}
}

View File

@@ -0,0 +1,211 @@
package com.baeldung.httpclient.httpclient;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.emptyArray;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.apache.hc.client5.http.classic.methods.HttpPost;
import org.apache.hc.client5.http.config.ConnectionConfig;
import org.apache.hc.client5.http.config.RequestConfig;
import org.apache.hc.client5.http.entity.UrlEncodedFormEntity;
import org.apache.hc.client5.http.impl.io.BasicHttpClientConnectionManager;
import org.apache.hc.client5.http.classic.methods.HttpGet;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
import org.apache.hc.client5.http.impl.classic.HttpClients;
import org.apache.hc.core5.http.ContentType;
import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpHeaders;
import org.apache.hc.core5.http.NameValuePair;
import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.apache.hc.core5.http.message.BasicNameValuePair;
import org.apache.hc.core5.util.Timeout;
import java.io.IOException;
import java.net.SocketTimeoutException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
class HttpClientCookBookLiveTest {
private static final String SAMPLE_GET_URL = "http://www.google.com";
private static final String SAMPLE_POST_URL = "http://www.github.com";
private CloseableHttpClient httpClient;
private CloseableHttpResponse response;
@BeforeEach
public final void before() {
httpClient = HttpClientBuilder.create().build();
}
@AfterEach
public final void after() throws IOException {
ClientUtil.closeClient(httpClient);
}
@Test
void givenGetRequestExecuted_thenCorrectStatusCode() throws IOException {
HttpGet httpGet = new HttpGet(SAMPLE_GET_URL);
httpClient.execute(httpGet,
response -> {
assertThat(response.getCode()).isEqualTo(200);
return response;
}
);
}
@Test
void givenGetRequestExecuted_thenCorrectContentMimeType() throws IOException {
HttpGet httpGet = new HttpGet(SAMPLE_GET_URL);
httpClient.execute(httpGet,
response -> {
final String contentMimeType = ContentType.parse(response.getEntity().getContentType()).getMimeType();
assertThat(contentMimeType).isEqualTo(ContentType.TEXT_HTML.getMimeType());
return response;
}
);
}
@Test
void givenGetRequestExecuted_thenCorrectResponse() throws IOException {
HttpGet httpGet = new HttpGet(SAMPLE_GET_URL);
httpClient.execute(httpGet,
response -> {
String bodyAsString = EntityUtils.toString(response.getEntity());
assertThat(bodyAsString, notNullValue());
return response;
}
);
}
@Test
void whenConfigureTimeoutOnRequest_thenCorrectResponse() throws IOException {
RequestConfig requestConfig = RequestConfig.custom()
.setConnectionRequestTimeout(Timeout.ofMilliseconds(2000L))
.build();
CloseableHttpClient httpClient = HttpClientBuilder.create()
.setDefaultRequestConfig(requestConfig)
.build();
HttpGet request = new HttpGet(SAMPLE_GET_URL);
request.setConfig(requestConfig);
httpClient.execute(request,
response -> {
assertThat(response.getCode()).isEqualTo(200);
return response;
}
);
}
@Test
void givenLowSocketTimeOut_whenExecutingRequestWithTimeout_thenException() throws IOException {
ConnectionConfig connConfig = ConnectionConfig.custom()
.setConnectTimeout(1000, TimeUnit.MILLISECONDS)
.setSocketTimeout(20, TimeUnit.MILLISECONDS)
.build();
RequestConfig requestConfig = RequestConfig.custom()
.setConnectionRequestTimeout(Timeout.ofMilliseconds(2000L))
.build();
BasicHttpClientConnectionManager cm = new BasicHttpClientConnectionManager();
cm.setConnectionConfig(connConfig);
CloseableHttpClient httpClient = HttpClientBuilder.create()
.setDefaultRequestConfig(requestConfig)
.setConnectionManager(cm)
.build();
HttpGet request = new HttpGet(SAMPLE_GET_URL);
assertThrows(SocketTimeoutException.class, () -> {
httpClient.execute(request, resp -> resp);
});
}
@Test
void whenExecutingPostRequest_thenNoExceptions() throws IOException {
final HttpPost httpPost = new HttpPost(SAMPLE_POST_URL);
httpClient.execute(httpPost,
response -> {
assertThat(response.getCode()).isEqualTo(200);
return response;
}
);
}
@Test
void givenParametersAddedToRequest_thenCorrect() throws IOException {
final HttpPost httpPost = new HttpPost(SAMPLE_POST_URL);
final List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("key1", "value1"));
params.add(new BasicNameValuePair("key2", "value2"));
httpPost.setEntity(new UrlEncodedFormEntity(params, Charset.defaultCharset()));
httpClient.execute(httpPost, response -> {
assertThat(response.getCode()).isEqualTo(200);
return response;
});
}
@Test
void givenRedirectsAreDisabled_whenConsumingUrlWhichRedirects_thenNotRedirected() throws IOException {
CloseableHttpClient client = HttpClientBuilder.create()
.disableRedirectHandling()
.build();
client.execute(new HttpGet("http://t.co/I5YYd9tddw"), response -> {
assertThat(response.getCode()).isEqualTo(301);
return response;
});
}
@Test
void givenHeadersAddedToRequest_thenCorrect() throws IOException {
HttpGet request = new HttpGet(SAMPLE_GET_URL);
request.addHeader(HttpHeaders.ACCEPT, "application/xml");
httpClient.execute(request,
response -> {
assertThat(response.getCode()).isEqualTo(200);
return response;
}
);
}
@Test
void givenRequestWasSet_whenAnalyzingTheHeadersOfTheResponse_thenCorrect() throws IOException {
HttpGet httpGet = new HttpGet(SAMPLE_GET_URL);
httpClient.execute(httpGet,
response -> {
Header[] headers = response.getHeaders(HttpHeaders.CONTENT_TYPE);
assertThat(headers, not(emptyArray()));
return response;
}
);
}
@Test
void givenAutoClosableClient_thenCorrect() throws IOException {
HttpGet httpGet = new HttpGet(SAMPLE_GET_URL);
try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
httpClient.execute(httpGet, resp -> {
assertThat(resp.getCode()).isEqualTo(200);
return resp;
});
}
}
}

View File

@@ -8,7 +8,7 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
### Relevant Articles:
- [Apache HttpClient Cancel Request](https://www.baeldung.com/httpclient-cancel-request)
- [Apache HttpClient 4 Cookbook](https://www.baeldung.com/httpclient4)
- [Apache HttpClient Cookbook](https://www.baeldung.com/apache-httpclient-cookbook)
- [Apache HttpClient Follow Redirects for POST](https://www.baeldung.com/httpclient-redirect-on-http-post)
- [Multipart Upload with Apache HttpClient](https://www.baeldung.com/httpclient-multipart-upload)
- [Apache HttpAsyncClient Tutorial](https://www.baeldung.com/httpasyncclient-tutorial)

View File

@@ -90,6 +90,12 @@
</exclusions>
</dependency>
<dependency>
<groupId>org.mock-server</groupId>
<artifactId>mockserver-netty</artifactId>
<version>${mockserver.version}</version>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock</artifactId>
@@ -112,6 +118,7 @@
<!-- util -->
<httpasyncclient.version>4.1.4</httpasyncclient.version>
<!-- testing -->
<mockserver.version>5.6.1</mockserver.version>
<wiremock.version>2.5.1</wiremock.version>
<httpclient.version>4.5.8</httpclient.version> <!-- 4.3.6 --> <!-- 4.4-beta1 -->
<!-- http client & core 5 -->

View File

@@ -0,0 +1,78 @@
package com.baeldung.httpclient;
import static org.mockserver.integration.ClientAndServer.startClientAndServer;
import static org.mockserver.matchers.Times.exactly;
import static org.mockserver.model.HttpRequest.request;
import static org.mockserver.model.HttpResponse.response;
import java.io.IOException;
import java.net.ServerSocket;
import org.apache.http.HttpStatus;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.mockserver.client.MockServerClient;
import org.mockserver.integration.ClientAndServer;
public class GetRequestMockServer {
public static ClientAndServer mockServer;
public static int serverPort;
public static final String SERVER_ADDRESS = "127.0.0.1";
public static final String SECURITY_PATH = "/spring-security-rest-basic-auth/api/foos/1";
public static final String UPLOAD_PATH = "/spring-mvc-java/stub/multipart";
@BeforeAll
static void startServer() throws IOException {
serverPort = getFreePort();
System.out.println("Free port " + serverPort);
mockServer = startClientAndServer(serverPort);
mockGetRequest();
}
@AfterAll
static void stopServer() {
mockServer.stop();
}
private static void mockGetRequest() {
MockServerClient client = new MockServerClient(SERVER_ADDRESS, serverPort);
client.when(
request()
.withPath(SECURITY_PATH)
.withMethod("GET"),
exactly(1)
)
.respond(
response()
.withStatusCode(HttpStatus.SC_OK)
.withBody("{\"status\":\"ok\"}")
);
client.when(
request()
.withPath(UPLOAD_PATH)
.withMethod("POST"),
exactly(4)
)
.respond(
response()
.withStatusCode(HttpStatus.SC_OK)
.withBody("{\"status\":\"ok\"}")
.withHeader("Content-Type", "multipart/form-data")
);
}
private static int getFreePort() throws IOException {
try (ServerSocket serverSocket = new ServerSocket(0)) {
return serverSocket.getLocalPort();
}
}
}

View File

@@ -1,7 +1,7 @@
package com.baeldung.httpclient;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
@@ -9,30 +9,35 @@ import java.util.concurrent.Future;
import javax.net.ssl.SSLContext;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.conn.ssl.TrustStrategy;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.cookie.BasicClientCookie;
import org.apache.http.impl.nio.client.CloseableHttpAsyncClient;
import org.apache.http.impl.nio.client.HttpAsyncClients;
import org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager;
import org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor;
import org.apache.http.nio.reactor.ConnectingIOReactor;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HttpContext;
import org.apache.http.ssl.SSLContexts;
import org.junit.Test;
import org.apache.hc.client5.http.async.methods.SimpleHttpRequest;
import org.apache.hc.client5.http.async.methods.SimpleHttpResponse;
import org.apache.hc.client5.http.async.methods.SimpleRequestBuilder;
import org.apache.hc.client5.http.auth.AuthScope;
import org.apache.hc.client5.http.auth.UsernamePasswordCredentials;
import org.apache.hc.client5.http.classic.methods.HttpGet;
import org.apache.hc.client5.http.cookie.BasicCookieStore;
import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient;
import org.apache.hc.client5.http.impl.async.HttpAsyncClients;
import org.apache.hc.client5.http.impl.auth.BasicCredentialsProvider;
import org.apache.hc.client5.http.impl.cookie.BasicClientCookie;
import org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManager;
import org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManagerBuilder;
import org.apache.hc.client5.http.impl.routing.DefaultProxyRoutePlanner;
import org.apache.hc.client5.http.protocol.HttpClientContext;
import org.apache.hc.client5.http.ssl.ClientTlsStrategyBuilder;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.nio.ssl.TlsStrategy;
import org.apache.hc.core5.http.protocol.BasicHttpContext;
import org.apache.hc.core5.http.protocol.HttpContext;
import org.apache.hc.core5.reactor.IOReactorConfig;
import org.apache.hc.core5.ssl.SSLContexts;
import org.apache.hc.core5.ssl.TrustStrategy;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.junit.jupiter.api.Test;
public class HttpAsyncClientLiveTest {
class HttpAsyncClientLiveTest extends GetRequestMockServer {
private static final String HOST = "http://www.google.com";
private static final String HOST_WITH_SSL = "https://mms.nw.ru/";
@@ -48,23 +53,31 @@ public class HttpAsyncClientLiveTest {
// tests
@Test
public void whenUseHttpAsyncClient_thenCorrect() throws InterruptedException, ExecutionException, IOException {
final CloseableHttpAsyncClient client = HttpAsyncClients.createDefault();
void whenUseHttpAsyncClient_thenCorrect() throws InterruptedException, ExecutionException, IOException {
final SimpleHttpRequest request = SimpleRequestBuilder.get(HOST_WITH_COOKIE)
.build();
final CloseableHttpAsyncClient client = HttpAsyncClients.custom()
.build();
client.start();
final HttpGet request = new HttpGet(HOST);
final Future<HttpResponse> future = client.execute(request, null);
final Future<SimpleHttpResponse> future = client.execute(request, null);
final HttpResponse response = future.get();
assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
assertThat(response.getCode(), equalTo(200));
client.close();
}
@Test
public void whenUseMultipleHttpAsyncClient_thenCorrect() throws Exception {
final ConnectingIOReactor ioReactor = new DefaultConnectingIOReactor();
final PoolingNHttpClientConnectionManager cm = new PoolingNHttpClientConnectionManager(ioReactor);
final CloseableHttpAsyncClient client = HttpAsyncClients.custom().setConnectionManager(cm).build();
void whenUseMultipleHttpAsyncClient_thenCorrect() throws Exception {
final IOReactorConfig ioReactorConfig = IOReactorConfig
.custom()
.build();
final CloseableHttpAsyncClient client = HttpAsyncClients.custom()
.setIOReactorConfig(ioReactorConfig)
.build();
client.start();
final String[] toGet = { "http://www.google.com/", "http://www.apache.org/", "http://www.bing.com/" };
@@ -85,36 +98,54 @@ public class HttpAsyncClientLiveTest {
}
@Test
public void whenUseProxyWithHttpClient_thenCorrect() throws Exception {
final CloseableHttpAsyncClient client = HttpAsyncClients.createDefault();
void whenUseProxyWithHttpClient_thenCorrect() throws Exception {
final HttpHost proxy = new HttpHost("127.0.0.1", GetRequestMockServer.serverPort);
DefaultProxyRoutePlanner routePlanner = new DefaultProxyRoutePlanner(proxy);
final CloseableHttpAsyncClient client = HttpAsyncClients.custom()
.setRoutePlanner(routePlanner)
.build();
client.start();
final HttpHost proxy = new HttpHost("127.0.0.1", 8080);
final RequestConfig config = RequestConfig.custom().setProxy(proxy).build();
final HttpGet request = new HttpGet(HOST_WITH_PROXY);
request.setConfig(config);
final Future<HttpResponse> future = client.execute(request, null);
final HttpResponse response = future.get();
assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
final SimpleHttpRequest request = new SimpleHttpRequest("GET" ,HOST_WITH_PROXY);
final Future<SimpleHttpResponse> future = client.execute(request, null);
final HttpResponse response = future.get();
assertThat(response.getCode(), equalTo(200));
client.close();
}
@Test
public void whenUseSSLWithHttpAsyncClient_thenCorrect() throws Exception {
void whenUseSSLWithHttpAsyncClient_thenCorrect() throws Exception {
final TrustStrategy acceptingTrustStrategy = (certificate, authType) -> true;
final SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy).build();
final CloseableHttpAsyncClient client = HttpAsyncClients.custom().setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE).setSSLContext(sslContext).build();
final SSLContext sslContext = SSLContexts.custom()
.loadTrustMaterial(null, acceptingTrustStrategy)
.build();
final TlsStrategy tlsStrategy = ClientTlsStrategyBuilder.create()
.setHostnameVerifier(SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER)
.setSslContext(sslContext)
.build();
final PoolingAsyncClientConnectionManager cm = PoolingAsyncClientConnectionManagerBuilder.create()
.setTlsStrategy(tlsStrategy)
.build();
final CloseableHttpAsyncClient client = HttpAsyncClients.custom()
.setConnectionManager(cm)
.build();
client.start();
final HttpGet request = new HttpGet(HOST_WITH_SSL);
final Future<HttpResponse> future = client.execute(request, null);
final SimpleHttpRequest request = new SimpleHttpRequest("GET",HOST_WITH_SSL);
final Future<SimpleHttpResponse> future = client.execute(request, null);
final HttpResponse response = future.get();
assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
assertThat(response.getCode(), equalTo(200));
client.close();
}
@Test
public void whenUseCookiesWithHttpAsyncClient_thenCorrect() throws Exception {
void whenUseCookiesWithHttpAsyncClient_thenCorrect() throws Exception {
final BasicCookieStore cookieStore = new BasicCookieStore();
final BasicClientCookie cookie = new BasicClientCookie(COOKIE_NAME, "1234");
cookie.setDomain(COOKIE_DOMAIN);
@@ -122,29 +153,36 @@ public class HttpAsyncClientLiveTest {
cookieStore.addCookie(cookie);
final CloseableHttpAsyncClient client = HttpAsyncClients.custom().build();
client.start();
final HttpGet request = new HttpGet(HOST_WITH_COOKIE);
final SimpleHttpRequest request = new SimpleHttpRequest("GET" ,HOST_WITH_COOKIE);
final HttpContext localContext = new BasicHttpContext();
localContext.setAttribute(HttpClientContext.COOKIE_STORE, cookieStore);
final Future<HttpResponse> future = client.execute(request, localContext, null);
final Future<SimpleHttpResponse> future = client.execute(request, localContext, null);
final HttpResponse response = future.get();
assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
assertThat(response.getCode(), equalTo(200));
client.close();
}
@Test
public void whenUseAuthenticationWithHttpAsyncClient_thenCorrect() throws Exception {
final CredentialsProvider provider = new BasicCredentialsProvider();
final UsernamePasswordCredentials creds = new UsernamePasswordCredentials(DEFAULT_USER, DEFAULT_PASS);
provider.setCredentials(AuthScope.ANY, creds);
final CloseableHttpAsyncClient client = HttpAsyncClients.custom().setDefaultCredentialsProvider(provider).build();
void whenUseAuthenticationWithHttpAsyncClient_thenCorrect() throws Exception {
final BasicCredentialsProvider credsProvider = new BasicCredentialsProvider();
final UsernamePasswordCredentials credentials =
new UsernamePasswordCredentials(DEFAULT_USER, DEFAULT_PASS.toCharArray());
credsProvider.setCredentials(new AuthScope(URL_SECURED_BY_BASIC_AUTHENTICATION, 80) ,credentials);
final CloseableHttpAsyncClient client = HttpAsyncClients
.custom()
.setDefaultCredentialsProvider(credsProvider).build();
final SimpleHttpRequest request = new SimpleHttpRequest("GET" ,URL_SECURED_BY_BASIC_AUTHENTICATION);
final HttpGet request = new HttpGet(URL_SECURED_BY_BASIC_AUTHENTICATION);
client.start();
final Future<HttpResponse> future = client.execute(request, null);
final Future<SimpleHttpResponse> future = client.execute(request, null);
final HttpResponse response = future.get();
assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
assertThat(response.getCode(), equalTo(200));
client.close();
}
@@ -163,9 +201,9 @@ public class HttpAsyncClientLiveTest {
@Override
public void run() {
try {
final Future<HttpResponse> future = client.execute(request, context, null);
final Future<SimpleHttpResponse> future = client.execute(SimpleHttpRequest.copy(request), context, null);
final HttpResponse response = future.get();
assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
assertThat(response.getCode(), equalTo(200));
} catch (final Exception ex) {
System.out.println(ex.getLocalizedMessage());
}

View File

@@ -19,7 +19,7 @@ class HttpClientCancelRequestLiveTest {
void whenRequestIsCanceled_thenCorrect() throws IOException {
HttpGet request = new HttpGet(SAMPLE_URL);
try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
httpClient.execute(request, response -> {
httpClient.execute(request, response -> {
HttpEntity entity = response.getEntity();
System.out.println("----------------------------------------");
@@ -28,6 +28,12 @@ class HttpClientCancelRequestLiveTest {
System.out.println("Response content length: " + entity.getContentLength());
}
System.out.println("----------------------------------------");
if (entity != null) {
// Closes this stream and releases any system resources
entity.close();
}
// Do not feel like reading the response body
// Call abort on the request object
request.abort();

View File

@@ -4,6 +4,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.hc.core5.http.ParseException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -13,7 +14,6 @@ import org.apache.hc.client5.http.entity.mime.HttpMultipartMode;
import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder;
import org.apache.hc.client5.http.entity.mime.StringBody;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
import org.apache.hc.core5.http.ContentType;
@@ -28,9 +28,7 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import com.baeldung.httpclient.handler.CustomHttpClientResponseHandler;
class HttpClientMultipartLiveTest {
class HttpClientMultipartLiveTest extends GetRequestMockServer {
// No longer available
// private static final String SERVER = "http://echo.200please.com";
@@ -45,13 +43,15 @@ class HttpClientMultipartLiveTest {
@BeforeEach
public void before() {
post = new HttpPost(SERVER);
String URL = "http://localhost:" + serverPort + "/spring-mvc-java/stub/multipart";
post = new HttpPost(URL);
}
@Test
void givenFileandMultipleTextParts_whenUploadwithAddPart_thenNoExceptions() throws IOException {
final URL url = Thread.currentThread()
.getContextClassLoader()
.getResource("uploads/" + TEXTFILENAME);
.getContextClassLoader()
.getResource("uploads/" + TEXTFILENAME);
final File file = new File(url.getPath());
final FileBody fileBody = new FileBody(file, ContentType.DEFAULT_BINARY);
@@ -66,27 +66,28 @@ class HttpClientMultipartLiveTest {
final HttpEntity entity = builder.build();
post.setEntity(entity);
try(CloseableHttpClient client = HttpClientBuilder.create()
.build();
try (CloseableHttpClient client = HttpClientBuilder.create()
.build()) {
CloseableHttpResponse response = (CloseableHttpResponse) client
.execute(post, new CustomHttpClientResponseHandler())){
final int statusCode = response.getCode();
final String responseString = getContent(response.getEntity());
final String contentTypeInHeader = getContentTypeHeader();
client.execute(post, response -> {
final int statusCode = response.getCode();
final String responseString = getContent(response.getEntity());
final String contentTypeInHeader = getContentTypeHeader();
assertThat(statusCode, equalTo(HttpStatus.SC_OK));
assertTrue(contentTypeInHeader.contains("Content-Type: multipart/form-data;"));
System.out.println(responseString);
System.out.println("POST Content Type: " + contentTypeInHeader);
assertThat(statusCode, equalTo(HttpStatus.SC_OK));
assertTrue(contentTypeInHeader.contains("multipart/form-data"));
System.out.println(responseString);
System.out.println("POST Content Type: " + contentTypeInHeader);
return response;
});
}
}
@Test
void givenFileandTextPart_whenUploadwithAddBinaryBodyandAddTextBody_ThenNoExeption() throws IOException {
final URL url = Thread.currentThread()
.getContextClassLoader()
.getResource("uploads/" + TEXTFILENAME);
.getContextClassLoader()
.getResource("uploads/" + TEXTFILENAME);
final File file = new File(url.getPath());
final String message = "This is a multipart post";
final MultipartEntityBuilder builder = MultipartEntityBuilder.create();
@@ -96,30 +97,31 @@ class HttpClientMultipartLiveTest {
final HttpEntity entity = builder.build();
post.setEntity(entity);
try(CloseableHttpClient client = HttpClientBuilder.create()
.build();
try (CloseableHttpClient client = HttpClientBuilder.create()
.build()) {
CloseableHttpResponse response = (CloseableHttpResponse) client
.execute(post, new CustomHttpClientResponseHandler())){
client.execute(post, response -> {
final int statusCode = response.getCode();
final String responseString = getContent(response.getEntity());
final String contentTypeInHeader = getContentTypeHeader();
assertThat(statusCode, equalTo(HttpStatus.SC_OK));
assertTrue(contentTypeInHeader.contains("Content-Type: multipart/form-data;"));
System.out.println(responseString);
System.out.println("POST Content Type: " + contentTypeInHeader);
final int statusCode = response.getCode();
final String responseString = getContent(response.getEntity());
final String contentTypeInHeader = getContentTypeHeader();
assertThat(statusCode, equalTo(HttpStatus.SC_OK));
assertTrue(contentTypeInHeader.contains("multipart/form-data"));
System.out.println(responseString);
System.out.println("POST Content Type: " + contentTypeInHeader);
return response;
});
}
}
@Test
void givenFileAndInputStreamandText_whenUploadwithAddBinaryBodyandAddTextBody_ThenNoException() throws IOException {
final URL url = Thread.currentThread()
.getContextClassLoader()
.getResource("uploads/" + ZIPFILENAME);
.getContextClassLoader()
.getResource("uploads/" + ZIPFILENAME);
final URL url2 = Thread.currentThread()
.getContextClassLoader()
.getResource("uploads/" + IMAGEFILENAME);
.getContextClassLoader()
.getResource("uploads/" + IMAGEFILENAME);
final InputStream inputStream = new FileInputStream(url.getPath());
final File file = new File(url2.getPath());
final String message = "This is a multipart post";
@@ -131,25 +133,25 @@ class HttpClientMultipartLiveTest {
final HttpEntity entity = builder.build();
post.setEntity(entity);
try(CloseableHttpClient client = HttpClientBuilder.create()
.build();
try (CloseableHttpClient client = HttpClientBuilder.create()
.build()) {
CloseableHttpResponse response = (CloseableHttpResponse) client
.execute(post, new CustomHttpClientResponseHandler())){
final int statusCode = response.getCode();
final String responseString = getContent(response.getEntity());
final String contentTypeInHeader = getContentTypeHeader();
assertThat(statusCode, equalTo(HttpStatus.SC_OK));
assertTrue(contentTypeInHeader.contains("Content-Type: multipart/form-data;"));
System.out.println(responseString);
System.out.println("POST Content Type: " + contentTypeInHeader);
inputStream.close();
client.execute(post, response -> {
final int statusCode = response.getCode();
final String responseString = getContent(response.getEntity());
final String contentTypeInHeader = getContentTypeHeader();
assertThat(statusCode, equalTo(HttpStatus.SC_OK));
assertTrue(contentTypeInHeader.contains("multipart/form-data;"));
System.out.println(responseString);
System.out.println("POST Content Type: " + contentTypeInHeader);
inputStream.close();
return response;
});
}
}
@Test
void givenCharArrayandText_whenUploadwithAddBinaryBodyandAddTextBody_ThenNoException() throws IOException {
void givenCharArrayandText_whenUploadwithAddBinaryBodyandAddTextBody_ThenNoException() throws IOException, ParseException {
final String message = "This is a multipart post";
final byte[] bytes = "binary code".getBytes();
final MultipartEntityBuilder builder = MultipartEntityBuilder.create();
@@ -159,21 +161,20 @@ class HttpClientMultipartLiveTest {
final HttpEntity entity = builder.build();
post.setEntity(entity);
try(CloseableHttpClient client = HttpClientBuilder.create()
.build();
try (CloseableHttpClient httpClient = HttpClientBuilder.create()
.build()) {
CloseableHttpResponse response = (CloseableHttpResponse) client
.execute(post, new CustomHttpClientResponseHandler())){
final int statusCode = response.getCode();
final String responseString = getContent(response.getEntity());
final String contentTypeInHeader = getContentTypeHeader();
assertThat(statusCode, equalTo(HttpStatus.SC_OK));
assertTrue(contentTypeInHeader.contains("Content-Type: multipart/form-data;"));
System.out.println(responseString);
System.out.println("POST Content Type: " + contentTypeInHeader);
httpClient.execute(post, response -> {
final int statusCode = response.getCode();
final String responseString = getContent(response.getEntity());
final String contentTypeInHeader = getContentTypeHeader();
assertThat(statusCode, equalTo(HttpStatus.SC_OK));
assertTrue(contentTypeInHeader.contains("multipart/form-data;"));
System.out.println(responseString);
System.out.println("POST Content Type: " + contentTypeInHeader);
return response;
});
}
}
// UTIL

View File

@@ -1,98 +1,61 @@
package com.baeldung.httpclient;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpHead;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.DefaultRedirectStrategy;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.client.LaxRedirectStrategy;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.apache.hc.client5.http.classic.methods.HttpGet;
import org.apache.hc.client5.http.classic.methods.HttpPost;
import org.apache.hc.client5.http.impl.DefaultRedirectStrategy;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
import org.apache.hc.client5.http.impl.classic.HttpClients;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import java.io.IOException;
import java.util.Arrays;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
public class HttpClientRedirectLiveTest {
private CloseableHttpClient instance;
private CloseableHttpResponse response;
@Before
public final void before() {
instance = HttpClientBuilder.create().build();
}
@After
public final void after() throws IllegalStateException, IOException {
ResponseUtil.closeResponse(response);
}
// tests
class HttpClientRedirectLiveTest {
@Test
public final void givenRedirectsAreDisabledViaNewApi_whenConsumingUrlWhichRedirects_thenNotRedirected() throws IOException {
instance = HttpClients.custom().disableRedirectHandling().build();
void givenRedirectsAreDisabled_whenConsumingUrlWhichRedirects_thenNotRedirected() throws IOException {
final HttpGet httpGet = new HttpGet("http://t.co/I5YYd9tddw");
response = instance.execute(httpGet);
final HttpGet request = new HttpGet("http://t.co/I5YYd9tddw");
assertThat(response.getStatusLine().getStatusCode(), equalTo(301));
try (CloseableHttpClient httpClient = HttpClients.custom()
.disableRedirectHandling()
.build()) {
httpClient.execute(request, response -> {
assertThat(response.getCode(), equalTo(301));
return response;
});
}
}
@Test
public final void givenRedirectsAreDisabled_whenConsumingUrlWhichRedirects_thenNotRedirected() throws IOException {
instance = HttpClientBuilder.create().disableRedirectHandling().build();
response = instance.execute(new HttpGet("http://t.co/I5YYd9tddw"));
assertThat(response.getStatusLine().getStatusCode(), equalTo(301));
}
void givenRedirectingPOST_whenConsumingUrlWhichRedirectsWithPOST_thenRedirected() throws IOException {
// redirect with POST
final HttpPost request = new HttpPost("http://t.co/I5YYd9tddw");
@Test
public final void givenPostRequest_whenConsumingUrlWhichRedirects_thenNotRedirected() throws IOException {
instance = HttpClientBuilder.create().build();
response = instance.execute(new HttpPost("http://t.co/I5YYd9tddw"));
assertThat(response.getStatusLine().getStatusCode(), equalTo(301));
try (CloseableHttpClient httpClient = HttpClientBuilder.create()
.build()) {
httpClient.execute(request, response -> {
assertThat(response.getCode(), equalTo(200));
return response;
});
}
}
@Test
public final void givenRedirectingPOSTViaPost4_2Api_whenConsumingUrlWhichRedirectsWithPOST_thenRedirected() throws IOException {
final CloseableHttpClient client = HttpClients.custom().setRedirectStrategy(new DefaultRedirectStrategy() {
/** Redirectable methods. */
private final String[] REDIRECT_METHODS = new String[]{HttpGet.METHOD_NAME, HttpPost.METHOD_NAME, HttpHead.METHOD_NAME};
void givenRedirectingPOST_whenUsingDefaultRedirectStrategy_thenRedirected() throws IOException {
@Override
protected boolean isRedirectable(final String method) {
return Arrays.stream(REDIRECT_METHODS)
.anyMatch(m -> m.equalsIgnoreCase(method));
}
}).build();
final HttpPost request = new HttpPost("http://t.co/I5YYd9tddw");
response = client.execute(new HttpPost("http://t.co/I5YYd9tddw"));
assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
try (CloseableHttpClient httpClient = HttpClientBuilder.create()
.setRedirectStrategy(new DefaultRedirectStrategy())
.build()) {
httpClient.execute(request, response -> {
assertThat(response.getCode(), equalTo(200));
return response;
});
}
}
@Test
public final void givenRedirectingPOSTVia4_2Api_whenConsumingUrlWhichRedirectsWithPOST_thenRedirected() throws IOException {
final CloseableHttpClient client = HttpClients.custom().setRedirectStrategy(new LaxRedirectStrategy()).build();
response = client.execute(new HttpPost("http://t.co/I5YYd9tddw"));
assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
}
@Test
public final void givenRedirectingPOST_whenConsumingUrlWhichRedirectsWithPOST_thenRedirected() throws IOException {
instance = HttpClientBuilder.create().setRedirectStrategy(new LaxRedirectStrategy()).build();
response = instance.execute(new HttpPost("http://t.co/I5YYd9tddw"));
assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
}
}

View File

@@ -43,7 +43,7 @@ public class HttpClientLiveTest {
@Test(expected = ConnectTimeoutException.class)
public final void givenLowTimeout_whenExecutingRequestWithTimeout_thenException() throws IOException {
final RequestConfig requestConfig = RequestConfig.custom().setConnectionRequestTimeout(50).setConnectTimeout(50).setSocketTimeout(20).build();
final RequestConfig requestConfig = RequestConfig.custom().setConnectionRequestTimeout(5).setConnectTimeout(5).setSocketTimeout(2).build();
final HttpGet request = new HttpGet(SAMPLE_URL);
request.setConfig(requestConfig);
response = instance.execute(request);

View File

@@ -1,5 +1,6 @@
package com.baeldung.httpclient.base;
import com.baeldung.httpclient.GetRequestMockServer;
import com.baeldung.httpclient.ResponseUtil;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
@@ -9,14 +10,14 @@ import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.io.IOException;
/*
* NOTE : Need module spring-security-rest-basic-auth to be running
*/
public class HttpClientSandboxLiveTest {
public class HttpClientSandboxLiveTest extends GetRequestMockServer {
@Test
public final void givenGetRequestExecuted_whenAnalyzingTheResponse_thenCorrectStatusCode() throws IOException {
@@ -26,7 +27,7 @@ public class HttpClientSandboxLiveTest {
final CloseableHttpClient client = HttpClientBuilder.create().setDefaultCredentialsProvider(credentialsProvider).build();
final HttpGet httpGet = new HttpGet("http://localhost:8080/spring-security-rest-basic-auth/api/foos/1");
final HttpGet httpGet = new HttpGet("http://localhost:" + serverPort + "/spring-security-rest-basic-auth/api/foos/1");
final CloseableHttpResponse response = client.execute(httpGet);
System.out.println(response.getStatusLine());

View File

@@ -1,11 +0,0 @@
package com.baeldung.httpclient.handler;
import org.apache.hc.core5.http.ClassicHttpResponse;
import org.apache.hc.core5.http.io.HttpClientResponseHandler;
public class CustomHttpClientResponseHandler implements HttpClientResponseHandler<ClassicHttpResponse> {
@Override
public ClassicHttpResponse handleResponse(ClassicHttpResponse response) {
return response;
}
}

View File

@@ -11,6 +11,7 @@ This module contains articles about Apache HttpClient 4.5
- [Apache HttpClient vs. CloseableHttpClient](https://www.baeldung.com/apache-httpclient-vs-closeablehttpclient)
- [Expand Shortened URLs with Apache HttpClient](https://www.baeldung.com/apache-httpclient-expand-url)
- [Retrying Requests using Apache HttpClient](https://www.baeldung.com/java-retrying-requests-using-apache-httpclient)
- [Apache HttpClient Follow Redirects for POST](https://www.baeldung.com/httpclient-redirect-on-http-post)
### Running the Tests
To run the live tests, use the command: mvn clean install -Plive

View File

@@ -199,33 +199,7 @@
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven-war-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>${cargo-maven2-plugin.version}</version>
<configuration>
<wait>true</wait>
<container>
<containerId>jetty8x</containerId>
<type>embedded</type>
<systemProperties>
<!-- <provPersistenceTarget>cargo</provPersistenceTarget> -->
</systemProperties>
</container>
<configuration>
<properties>
<cargo.servlet.port>8082</cargo.servlet.port>
</properties>
</configuration>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
@@ -233,26 +207,6 @@
<id>live</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<executions>
<execution>
<id>start-server</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-server</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
@@ -269,9 +223,6 @@
<includes>
<include>**/*LiveTest.java</include>
</includes>
<systemPropertyVariables>
<webTarget>cargo</webTarget>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
@@ -291,7 +242,6 @@
<httpclient.version>4.5.14</httpclient.version>
<mockserver.version>5.11.2</mockserver.version>
<!-- maven plugins -->
<cargo-maven2-plugin.version>1.6.1</cargo-maven2-plugin.version>
<maven-war-plugin.version>3.3.2</maven-war-plugin.version>
</properties>

View File

@@ -0,0 +1,56 @@
package com.baeldung;
import static org.mockserver.integration.ClientAndServer.startClientAndServer;
import static org.mockserver.model.HttpRequest.request;
import static org.mockserver.model.HttpResponse.response;
import java.io.IOException;
import java.net.ServerSocket;
import org.apache.http.HttpStatus;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.mockserver.client.MockServerClient;
import org.mockserver.integration.ClientAndServer;
public class GetRequestMockServer {
public static ClientAndServer mockServer;
public static int serverPort;
public static String simplePathUrl;
public static final String SERVER_ADDRESS = "127.0.0.1";
public static final String SIMPLE_PATH = "/httpclient-simple/api/bars/1";
@BeforeAll
static void startServer() throws IOException {
serverPort = getFreePort();
System.out.println("Free port " + serverPort);
mockServer = startClientAndServer(serverPort);
simplePathUrl = "http://" + SERVER_ADDRESS + ":" + serverPort + SIMPLE_PATH;
mockGetRequest();
}
@AfterAll
static void stopServer() {
mockServer.stop();
}
private static void mockGetRequest() {
MockServerClient client = new MockServerClient(SERVER_ADDRESS, serverPort);
client.when(request().withPath(SIMPLE_PATH)
.withMethod("GET"))
.respond(response().withStatusCode(HttpStatus.SC_OK)
.withBody("{\"status\":\"ok\"}"));
}
private static int getFreePort() throws IOException {
try (ServerSocket serverSocket = new ServerSocket(0)) {
return serverSocket.getLocalPort();
}
}
}

View File

@@ -10,7 +10,7 @@ import java.io.IOException;
import java.security.GeneralSecurityException;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLPeerUnverifiedException;
import javax.net.ssl.SSLHandshakeException;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
@@ -31,10 +31,10 @@ import org.springframework.http.ResponseEntity;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;
import com.baeldung.GetRequestMockServer;
class ClientLiveTest {
class ClientLiveTest extends GetRequestMockServer {
final String urlOverHttps = "http://localhost:8082/httpclient-simple/api/bars/1";
@Test
void givenAcceptingAllCertificates_whenHttpsUrlIsConsumed_thenOk_2() throws GeneralSecurityException {
@@ -54,13 +54,13 @@ class ClientLiveTest {
.build();
final HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient);
final ResponseEntity<String> response = new RestTemplate(requestFactory).exchange(urlOverHttps, HttpMethod.GET, null, String.class);
final ResponseEntity<String> response = new RestTemplate(requestFactory).exchange(simplePathUrl, HttpMethod.GET, null, String.class);
assertThat(response.getStatusCode().value(), equalTo(200));
}
@Test
void givenAcceptingAllCertificates_whenHttpsUrlIsConsumed_thenCorrect() throws IOException {
final HttpGet getMethod = new HttpGet(urlOverHttps);
final HttpGet getMethod = new HttpGet(simplePathUrl);
try (final CloseableHttpClient httpClient = HttpClients.custom()
.setSSLHostnameVerifier(new NoopHostnameVerifier())
@@ -80,20 +80,22 @@ class ClientLiveTest {
final HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory();
requestFactory.setHttpClient(httpClient);
final ResponseEntity<String> response = new RestTemplate(requestFactory).exchange(urlOverHttps, HttpMethod.GET, null, String.class);
final ResponseEntity<String> response = new RestTemplate(requestFactory).exchange(simplePathUrl, HttpMethod.GET, null, String.class);
assertThat(response.getStatusCode().value(), equalTo(200));
}
@Test
void whenHttpsUrlIsConsumed_thenException() {
String urlOverHttps = "https://localhost:8082/httpclient-simple";
String urlOverHttps = "https://localhost:"+serverPort+"/httpclient-simple/api/bars/1";
HttpGet getMethod = new HttpGet(urlOverHttps);
assertThrows(SSLPeerUnverifiedException.class, () -> {
assertThrows(SSLHandshakeException.class, () -> {
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpResponse response = httpClient.execute(getMethod);
assertThat(response.getStatusLine()
.getStatusCode(), equalTo(200));
});
}
}

View File

@@ -1,6 +1,5 @@
package com.baeldung.client;
import static org.apache.http.conn.ssl.SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
@@ -89,4 +88,5 @@ public class RestClientV4LiveManualTest {
HttpResponse response = httpClient.execute(getMethod);
assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
}
}

View File

@@ -0,0 +1,20 @@
package com.baeldung.httpclient;
import java.io.IOException;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.impl.client.CloseableHttpClient;
public final class ClientUtil {
private ClientUtil(){}
public static void closeClient(CloseableHttpClient client) throws IOException {
if (client == null) {
return;
}
client.close();
}
}

View File

@@ -0,0 +1,176 @@
package com.baeldung.httpclient;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import javax.net.ssl.SSLContext;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.conn.ssl.TrustStrategy;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.cookie.BasicClientCookie;
import org.apache.http.impl.nio.client.CloseableHttpAsyncClient;
import org.apache.http.impl.nio.client.HttpAsyncClients;
import org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager;
import org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor;
import org.apache.http.nio.reactor.ConnectingIOReactor;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HttpContext;
import org.apache.http.ssl.SSLContexts;
import org.junit.jupiter.api.Test;
import com.baeldung.GetRequestMockServer;
class HttpAsyncClientV4LiveTest extends GetRequestMockServer {
private static final String HOST = "http://www.google.com";
private static final String HOST_WITH_SSL = "https://mms.nw.ru/";
private static final String HOST_WITH_PROXY = "http://httpbin.org/";
private static final String URL_SECURED_BY_BASIC_AUTHENTICATION = "http://browserspy.dk/password-ok.php";// "http://localhost:8080/spring-security-rest-basic-auth/api/foos/1";
private static final String DEFAULT_USER = "test";// "user1";
private static final String DEFAULT_PASS = "test";// "user1Pass";
private static final String HOST_WITH_COOKIE = "http://yuilibrary.com/yui/docs/cookie/cookie-simple-example.html"; // "http://github.com";
private static final String COOKIE_DOMAIN = ".yuilibrary.com"; // ".github.com";
private static final String COOKIE_NAME = "example"; // "JSESSIONID";
// tests
@Test
void whenUseHttpAsyncClient_thenCorrect() throws InterruptedException, ExecutionException, IOException {
final CloseableHttpAsyncClient client = HttpAsyncClients.createDefault();
client.start();
final HttpGet request = new HttpGet(HOST);
final Future<HttpResponse> future = client.execute(request, null);
final HttpResponse response = future.get();
assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
client.close();
}
@Test
void whenUseMultipleHttpAsyncClient_thenCorrect() throws Exception {
final ConnectingIOReactor ioReactor = new DefaultConnectingIOReactor();
final PoolingNHttpClientConnectionManager cm = new PoolingNHttpClientConnectionManager(ioReactor);
final CloseableHttpAsyncClient client = HttpAsyncClients.custom().setConnectionManager(cm).build();
client.start();
final String[] toGet = { "http://www.google.com/", "http://www.apache.org/", "http://www.bing.com/" };
final GetThread[] threads = new GetThread[toGet.length];
for (int i = 0; i < threads.length; i++) {
final HttpGet request = new HttpGet(toGet[i]);
threads[i] = new GetThread(client, request);
}
for (final GetThread thread : threads) {
thread.start();
}
for (final GetThread thread : threads) {
thread.join();
}
}
@Test
void whenUseProxyWithHttpClient_thenCorrect() throws Exception {
final CloseableHttpAsyncClient client = HttpAsyncClients.createDefault();
client.start();
final HttpHost proxy = new HttpHost("127.0.0.1", GetRequestMockServer.serverPort);
final RequestConfig config = RequestConfig.custom().setProxy(proxy).build();
final HttpGet request = new HttpGet(HOST_WITH_PROXY);
request.setConfig(config);
final Future<HttpResponse> future = client.execute(request, null);
final HttpResponse response = future.get();
assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
client.close();
}
@Test
void whenUseSSLWithHttpAsyncClient_thenCorrect() throws Exception {
final TrustStrategy acceptingTrustStrategy = (certificate, authType) -> true;
final SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy).build();
final CloseableHttpAsyncClient client = HttpAsyncClients.custom().setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE).setSSLContext(sslContext).build();
client.start();
final HttpGet request = new HttpGet(HOST_WITH_SSL);
final Future<HttpResponse> future = client.execute(request, null);
final HttpResponse response = future.get();
assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
client.close();
}
@Test
void whenUseCookiesWithHttpAsyncClient_thenCorrect() throws Exception {
final BasicCookieStore cookieStore = new BasicCookieStore();
final BasicClientCookie cookie = new BasicClientCookie(COOKIE_NAME, "1234");
cookie.setDomain(COOKIE_DOMAIN);
cookie.setPath("/");
cookieStore.addCookie(cookie);
final CloseableHttpAsyncClient client = HttpAsyncClients.custom().build();
client.start();
final HttpGet request = new HttpGet(HOST_WITH_COOKIE);
final HttpContext localContext = new BasicHttpContext();
localContext.setAttribute(HttpClientContext.COOKIE_STORE, cookieStore);
final Future<HttpResponse> future = client.execute(request, localContext, null);
final HttpResponse response = future.get();
assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
client.close();
}
@Test
void whenUseAuthenticationWithHttpAsyncClient_thenCorrect() throws Exception {
final CredentialsProvider provider = new BasicCredentialsProvider();
final UsernamePasswordCredentials creds = new UsernamePasswordCredentials(DEFAULT_USER, DEFAULT_PASS);
provider.setCredentials(AuthScope.ANY, creds);
final CloseableHttpAsyncClient client = HttpAsyncClients.custom().setDefaultCredentialsProvider(provider).build();
final HttpGet request = new HttpGet(URL_SECURED_BY_BASIC_AUTHENTICATION);
client.start();
final Future<HttpResponse> future = client.execute(request, null);
final HttpResponse response = future.get();
assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
client.close();
}
static class GetThread extends Thread {
private final CloseableHttpAsyncClient client;
private final HttpContext context;
private final HttpGet request;
GetThread(final CloseableHttpAsyncClient client, final HttpGet request) {
this.client = client;
context = HttpClientContext.create();
this.request = request;
}
@Override
public void run() {
try {
final Future<HttpResponse> future = client.execute(request, context, null);
final HttpResponse response = future.get();
assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
} catch (final Exception ex) {
System.out.println(ex.getLocalizedMessage());
}
}
}
}

View File

@@ -44,7 +44,9 @@ public class HttpClientCancelRequestV4LiveTest {
System.out.println(response.getStatusLine());
if (entity != null) {
System.out.println("Response content length: " + entity.getContentLength());
entity.getContent().close();
}
System.out.println("----------------------------------------");
// Do not feel like reading the response body

View File

@@ -0,0 +1,184 @@
package com.baeldung.httpclient;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.hamcrest.Matchers.emptyArray;
import static org.hamcrest.Matchers.not;
import java.io.IOException;
import java.io.InputStream;
import java.net.SocketTimeoutException;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.Consts;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHeaders;
import org.apache.http.NameValuePair;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
class HttpClientCookBookV4LiveTest {
private static final String SAMPLE_GET_URL = "http://www.google.com";
private static final String SAMPLE_POST_URL = "http://www.github.com";
private CloseableHttpClient client;
private CloseableHttpResponse response;
@BeforeEach
public final void before() {
client = HttpClientBuilder.create().build();
}
@AfterEach
public final void after() throws IllegalStateException, IOException {
ResponseUtil.closeResponse(response);
ClientUtil.closeClient(client);
}
@Test
void givenGetRequestExecuted_thenCorrectStatusCode() throws IOException {
HttpGet httpGet = new HttpGet(SAMPLE_GET_URL);
response = client.execute(httpGet);
assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
}
@Test
void givenGetRequestExecuted_thenCorrectContentMimeType() throws IOException {
CloseableHttpResponse response = client.execute(new HttpGet(SAMPLE_GET_URL));
String contentMimeType = ContentType.getOrDefault(response.getEntity()).getMimeType();
assertThat(contentMimeType, equalTo(ContentType.TEXT_HTML.getMimeType()));
}
@Test
void givenGetRequestExecuted_thenCorrectResponse() throws IOException {
CloseableHttpResponse response = client.execute(new HttpGet(SAMPLE_GET_URL));
String bodyAsString = EntityUtils.toString(response.getEntity());
assertThat(bodyAsString, notNullValue());
}
@Test
void givenLowSocketTimeOut_whenExecutingRequestWithTimeout_thenException() throws IOException {
RequestConfig requestConfig = RequestConfig.custom()
.setConnectionRequestTimeout(1000)
.setConnectTimeout(1000)
.setSocketTimeout(20)
.build();
HttpGet request = new HttpGet(SAMPLE_POST_URL);
request.setConfig(requestConfig);
assertThrows(SocketTimeoutException.class, () -> {
response = client.execute(request);
});
}
@Test
void givenLowSocketTimeOut_whenSettingTimeoutOnTheClient_thenException(){
RequestConfig requestConfig = RequestConfig.custom()
.setConnectionRequestTimeout(1000)
.setConnectTimeout(1000)
.setSocketTimeout(20).build();
HttpClientBuilder builder = HttpClientBuilder.create().setDefaultRequestConfig(requestConfig);
client = builder.build();
HttpGet request = new HttpGet(SAMPLE_GET_URL);
assertThrows(SocketTimeoutException.class, () -> {
response = client.execute(request);
});
}
@Test
void whenExecutingPostRequest_thenNoExceptions() throws IOException {
response = client.execute(new HttpPost(SAMPLE_POST_URL));
assertThat(response.getStatusLine().getStatusCode(), equalTo(301));
}
@Test
void givenParametersAddedToRequest_thenCorrect() throws IOException {
final HttpPost httpPost = new HttpPost(SAMPLE_POST_URL);
final List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("key1", "value1"));
params.add(new BasicNameValuePair("key2", "value2"));
httpPost.setEntity(new UrlEncodedFormEntity(params, Consts.UTF_8));
response = client.execute(new HttpPost(SAMPLE_POST_URL));
assertThat(response.getStatusLine().getStatusCode(), equalTo(301));
}
@Test
void givenRedirectsAreDisabled_whenConsumingUrlWhichRedirects_thenNotRedirected() throws IOException {
CloseableHttpClient client = HttpClientBuilder.create()
.disableRedirectHandling()
.build();
CloseableHttpResponse response = client.execute(new HttpGet("http://t.co/I5YYd9tddw"));
assertThat(response.getStatusLine().getStatusCode(), equalTo(301));
}
@Test
void givenHeadersAddedToRequest_thenCorrect() throws IOException {
HttpGet request = new HttpGet(SAMPLE_GET_URL);
request.addHeader(HttpHeaders.ACCEPT, "application/xml");
response = client.execute(request);
assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
}
@Test
void givenRequestWasSet_whenAnalyzingTheHeadersOfTheResponse_thenCorrect() throws IOException {
CloseableHttpResponse response = client.execute(new HttpGet(SAMPLE_GET_URL));
Header[] headers = response.getHeaders(HttpHeaders.CONTENT_TYPE);
assertThat(headers, not(emptyArray()));
}
@Test
void givenStreamIsClosed_thenCloseResponse() throws IOException {
response = client.execute(new HttpGet(SAMPLE_GET_URL));
try {
HttpEntity entity = response.getEntity();
if (entity != null) {
InputStream instream = entity.getContent();
instream.close();
}
} finally {
response.close();
}
}
@Test
void givenAutoClosableClient_thenCorrect() throws IOException {
try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
HttpGet httpGet = new HttpGet(SAMPLE_GET_URL);
try (CloseableHttpResponse response = httpClient.execute(httpGet)) {
// handle response;
HttpEntity entity = response.getEntity();
if (entity != null) {
try (InputStream instream = entity.getContent()) {
// Process the input stream if needed
}
}
assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
}
}
}
}

View File

@@ -0,0 +1,70 @@
package com.baeldung.httpclient;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import java.io.IOException;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.client.LaxRedirectStrategy;
class HttpClientRedirectV4LiveTest {
private CloseableHttpClient instance;
private CloseableHttpResponse response;
@BeforeEach
public final void before() {
instance = HttpClientBuilder.create()
.build();
}
@AfterEach
public final void after() throws IllegalStateException, IOException {
ResponseUtil.closeResponse(response);
}
@Test
void givenRedirectsAreDisabled_whenConsumingUrlWhichRedirects_thenNotRedirected() throws IOException {
instance = HttpClients.custom()
.disableRedirectHandling()
.build();
final HttpGet httpGet = new HttpGet("http://t.co/I5YYd9tddw");
response = instance.execute(httpGet);
assertThat(response.getStatusLine()
.getStatusCode(), equalTo(301));
}
// redirect with POST
@Test
void givenPostRequest_whenConsumingUrlWhichRedirects_thenNotRedirected() throws IOException {
instance = HttpClientBuilder.create()
.build();
response = instance.execute(new HttpPost("http://t.co/I5YYd9tddw"));
assertThat(response.getStatusLine()
.getStatusCode(), equalTo(301));
}
@Test
void givenRedirectingPOST_whenConsumingUrlWhichRedirectsWithPOST_thenRedirected() throws IOException {
instance = HttpClientBuilder.create()
.setRedirectStrategy(new LaxRedirectStrategy())
.build();
response = instance.execute(new HttpPost("http://t.co/I5YYd9tddw"));
assertThat(response.getStatusLine()
.getStatusCode(), equalTo(200));
}
}

View File

@@ -21,7 +21,9 @@ import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
class HttpClientTimeoutV4LiveTest {
import com.baeldung.GetRequestMockServer;
class HttpClientTimeoutV4LiveTest extends GetRequestMockServer {
private CloseableHttpResponse response;
@@ -97,7 +99,7 @@ class HttpClientTimeoutV4LiveTest {
int timeout = 20; // seconds
RequestConfig requestConfig = RequestConfig.custom().setConnectionRequestTimeout(timeout * 1000)
.setConnectTimeout(timeout * 1000).setSocketTimeout(timeout * 1000).build();
HttpGet getMethod = new HttpGet("http://localhost:8082/httpclient-simple/api/bars/1");
HttpGet getMethod = new HttpGet(simplePathUrl);
getMethod.setConfig(requestConfig);
int hardTimeout = 5; // seconds

View File

@@ -13,13 +13,15 @@ import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.junit.jupiter.api.Test;
import com.baeldung.GetRequestMockServer;
class ApacheHttpClientUnitTest extends GetRequestMockServer {
@Test
void givenDeveloperUsedCloseableHttpResponse_whenExecutingGetRequest_thenStatusIsOk() throws IOException {
try (CloseableHttpClient httpClient = HttpClientBuilder.create().build()) {
HttpGet httpGet = new HttpGet(serviceOneUrl);
HttpGet httpGet = new HttpGet(simplePathUrl);
try (CloseableHttpResponse response = httpClient.execute(httpGet)) {
HttpEntity entity = response.getEntity();
EntityUtils.consume(entity);

View File

@@ -1,78 +0,0 @@
package com.baeldung.httpclient.httpclient;
import org.apache.http.HttpStatus;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.mockserver.client.MockServerClient;
import org.mockserver.integration.ClientAndServer;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.URISyntaxException;
import static org.mockserver.integration.ClientAndServer.startClientAndServer;
import static org.mockserver.matchers.Times.exactly;
import static org.mockserver.model.HttpRequest.request;
import static org.mockserver.model.HttpResponse.response;
public class GetRequestMockServer {
public static ClientAndServer mockServer;
public static String serviceOneUrl;
public static String serviceTwoUrl;
private static int serverPort;
public static final String SERVER_ADDRESS = "127.0.0.1";
public static final String PATH_ONE = "/test1";
public static final String PATH_TWO = "/test2";
public static final String METHOD = "GET";
@BeforeAll
static void startServer() throws IOException, URISyntaxException {
serverPort = getFreePort();
serviceOneUrl = "http://" + SERVER_ADDRESS + ":" + serverPort + PATH_ONE;
serviceTwoUrl = "http://" + SERVER_ADDRESS + ":" + serverPort + PATH_TWO;
mockServer = startClientAndServer(serverPort);
mockGetRequest();
}
@AfterAll
static void stopServer() {
mockServer.stop();
}
private static void mockGetRequest() {
new MockServerClient(SERVER_ADDRESS, serverPort)
.when(
request()
.withPath(PATH_ONE)
.withMethod(METHOD),
exactly(5)
)
.respond(
response()
.withStatusCode(HttpStatus.SC_OK)
.withBody("{\"status\":\"ok\"}")
);
new MockServerClient(SERVER_ADDRESS, serverPort)
.when(
request()
.withPath(PATH_TWO)
.withMethod(METHOD),
exactly(1)
)
.respond(
response()
.withStatusCode(HttpStatus.SC_OK)
.withBody("{\"status\":\"ok\"}")
);
}
private static int getFreePort () throws IOException {
try (ServerSocket serverSocket = new ServerSocket(0)) {
return serverSocket.getLocalPort();
}
}
}

View File

@@ -8,3 +8,7 @@ You can build the project from the command line using: *mvn clean install*, or i
### Relevant Articles:
- [Guide to Check if Apache Kafka Server Is Running](https://www.baeldung.com/apache-kafka-check-server-is-running)
- [Add Custom Headers to a Kafka Message](https://www.baeldung.com/java-kafka-custom-headers)
- [Get Last N Messages in Apache Kafka Topic](https://www.baeldung.com/java-apache-kafka-get-last-n-messages)
- [Is a Key Required as Part of Sending Messages to Kafka?](https://www.baeldung.com/java-kafka-message-key)
- [Read Data From the Beginning Using Kafka Consumer API](https://www.baeldung.com/java-kafka-consumer-api-read)
- [Get Partition Count for a Topic in Kafka](https://www.baeldung.com/java-kafka-partition-count-topic)

View File

@@ -0,0 +1,81 @@
package com.baeldung.kafka.consumer;
import java.time.Duration;
import java.util.Arrays;
import java.util.Properties;
import java.util.UUID;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.consumer.ConsumerRecords;
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerConfig;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.common.serialization.StringDeserializer;
import org.apache.kafka.common.serialization.StringSerializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ConsumeFromBeginning {
private static Logger logger = LoggerFactory.getLogger(ConsumeFromBeginning.class);
private static String TOPIC = "baeldung";
private static int messagesInTopic = 10;
private static KafkaProducer<String, String> producer;
private static KafkaConsumer<String, String> consumer;
public static void main(String[] args) {
setup();
publishMessages();
consumeFromBeginning();
}
private static void consumeFromBeginning() {
consumer.subscribe(Arrays.asList(TOPIC));
ConsumerRecords<String, String> records = consumer.poll(Duration.ofSeconds(10));
for (ConsumerRecord<String, String> record : records) {
logger.info(record.value());
}
consumer.seekToBeginning(consumer.assignment());
records = consumer.poll(Duration.ofSeconds(10));
for (ConsumerRecord<String, String> record : records) {
logger.info(record.value());
}
}
private static void publishMessages() {
for (int i = 1; i <= messagesInTopic; i++) {
ProducerRecord<String, String> record = new ProducerRecord<>(TOPIC, String.valueOf(i));
producer.send(record);
}
}
private static void setup() {
Properties producerProperties = new Properties();
producerProperties.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
producerProperties.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
producerProperties.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
Properties consumerProperties = new Properties();
consumerProperties.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
consumerProperties.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
consumerProperties.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
consumerProperties.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
consumerProperties.put(ConsumerConfig.GROUP_ID_CONFIG, UUID.randomUUID()
.toString());
producer = new KafkaProducer<>(producerProperties);
consumer = new KafkaConsumer<>(consumerProperties);
}
}

View File

@@ -0,0 +1,106 @@
package com.baeldung.kafka.message;
import java.time.Duration;
import java.util.Arrays;
import java.util.Collections;
import java.util.Properties;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import org.apache.kafka.clients.admin.Admin;
import org.apache.kafka.clients.admin.AdminClientConfig;
import org.apache.kafka.clients.admin.NewTopic;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.consumer.ConsumerRecords;
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerConfig;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.clients.producer.RecordMetadata;
import org.apache.kafka.common.serialization.StringDeserializer;
import org.apache.kafka.common.serialization.StringSerializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MessageWithKey {
private static Logger logger = LoggerFactory.getLogger(MessageWithKey.class);
private static String TOPIC = "baeldung";
private static int PARTITIONS = 5;
private static short REPLICATION_FACTOR = 1;
private static String MESSAGE_KEY = "message-key";
private static Admin admin;
private static KafkaProducer<String, String> producer;
private static KafkaConsumer<String, String> consumer;
public static void main(String[] args) throws ExecutionException, InterruptedException {
setup();
publishMessagesWithoutKey();
consumeMessages();
publishMessagesWithKey();
consumeMessages();
}
private static void consumeMessages() {
consumer.subscribe(Arrays.asList(TOPIC));
ConsumerRecords<String, String> records = consumer.poll(Duration.ofSeconds(5));
for (ConsumerRecord<String, String> record : records) {
logger.info("Key : {}, Value : {}", record.key(), record.value());
}
}
private static void publishMessagesWithKey() throws ExecutionException, InterruptedException {
for (int i = 1; i <= 10; i++) {
ProducerRecord<String, String> record = new ProducerRecord<>(TOPIC, MESSAGE_KEY, String.valueOf(i));
Future<RecordMetadata> future = producer.send(record);
RecordMetadata metadata = future.get();
logger.info(String.valueOf(metadata.partition()));
}
}
private static void publishMessagesWithoutKey() throws ExecutionException, InterruptedException {
for (int i = 1; i <= 10; i++) {
ProducerRecord<String, String> record = new ProducerRecord<>(TOPIC, String.valueOf(i));
Future<RecordMetadata> future = producer.send(record);
RecordMetadata metadata = future.get();
logger.info(String.valueOf(metadata.partition()));
}
}
private static void setup() {
Properties adminProperties = new Properties();
adminProperties.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
Properties producerProperties = new Properties();
producerProperties.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
producerProperties.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
producerProperties.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
Properties consumerProperties = new Properties();
consumerProperties.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
consumerProperties.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
consumerProperties.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
consumerProperties.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
consumerProperties.put(ConsumerConfig.GROUP_ID_CONFIG, UUID.randomUUID()
.toString());
admin = Admin.create(adminProperties);
producer = new KafkaProducer<>(producerProperties);
consumer = new KafkaConsumer<>(consumerProperties);
admin.createTopics(Collections.singleton(new NewTopic(TOPIC, PARTITIONS, REPLICATION_FACTOR)));
}
}

View File

@@ -28,7 +28,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
@Testcontainers
public class KafaConsumeLastNMessages {
public class KafaConsumeLastNMessagesLiveTest {
private static String TOPIC1 = "baeldung-github";
private static String TOPIC2 = "baeldung-blog";

View File

@@ -0,0 +1,83 @@
package com.baeldung.kafka;
import org.apache.kafka.clients.admin.AdminClient;
import org.apache.kafka.clients.admin.DescribeTopicsResult;
import org.apache.kafka.clients.admin.TopicDescription;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerConfig;
import org.apache.kafka.common.KafkaFuture;
import org.apache.kafka.common.PartitionInfo;
import org.apache.kafka.common.serialization.StringSerializer;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.testcontainers.containers.KafkaContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.utility.DockerImageName;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.ExecutionException;
@Testcontainers
public class KafkaCountPartitionsLiveTest {
@Container
private static final KafkaContainer KAFKA_CONTAINER = new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka:latest"));
private final static String TOPIC = "baeldung-kafka-github";
private final static Integer PARTITION_NUMBER = 3;
private static KafkaProducer<String, String> producer;
@BeforeAll
static void setup() throws IOException, InterruptedException {
KAFKA_CONTAINER.addExposedPort(9092);
KAFKA_CONTAINER.execInContainer(
"/bin/sh",
"-c",
"/usr/bin/kafka-topics " +
"--bootstrap-server localhost:9092 " +
"--create " +
"--replication-factor 1 " +
"--partitions " + PARTITION_NUMBER + " " +
"--topic " + TOPIC
);
Properties producerProperties = new Properties();
producerProperties.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, KAFKA_CONTAINER.getBootstrapServers());
producerProperties.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
producerProperties.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
producer = new KafkaProducer<>(producerProperties);
}
@AfterAll
static void destroy() {
KAFKA_CONTAINER.stop();
}
@Test
void testPartitionsForTopic_isEqualToActualNumberAssignedDuringCreation() {
List<PartitionInfo> info = producer.partitionsFor(TOPIC);
Assertions.assertEquals(PARTITION_NUMBER, info.size());
}
@Test
void testTopicPartitionDescription_isEqualToActualNumberAssignedDuringCreation() {
Properties props = new Properties();
props.put("bootstrap.servers", KAFKA_CONTAINER.getBootstrapServers());
props.put("client.id","java-admin-client");
props.put("request.timeout.ms", 3000);
props.put("connections.max.idle.ms", 5000);
try(AdminClient client = AdminClient.create(props)){
DescribeTopicsResult describeTopicsResult = client.describeTopics(Collections.singletonList(TOPIC));
Map<String, KafkaFuture<TopicDescription>> values = describeTopicsResult.values();
KafkaFuture<TopicDescription> topicDescription = values.get(TOPIC);
Assertions.assertEquals(PARTITION_NUMBER, topicDescription.get().partitions().size());
} catch (ExecutionException | InterruptedException e) {
throw new RuntimeException(e);
}
}
}

View File

@@ -0,0 +1,109 @@
package com.baeldung.kafka.consumer;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.time.Duration;
import java.util.Arrays;
import java.util.Properties;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.consumer.ConsumerRecords;
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerConfig;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.common.serialization.StringDeserializer;
import org.apache.kafka.common.serialization.StringSerializer;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testcontainers.containers.KafkaContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.utility.DockerImageName;
// This live test needs a Docker Daemon running so that a kafka container can be created
@Testcontainers
public class ConsumeFromBeginningLiveTest {
private static Logger logger = LoggerFactory.getLogger(ConsumeFromBeginningLiveTest.class);
private static String TOPIC = "baeldung";
private static int messagesInTopic = 10;
private static KafkaProducer<String, String> producer;
private static KafkaConsumer<String, String> consumer;
@Container
private static final KafkaContainer KAFKA_CONTAINER = new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka:latest"));
@BeforeAll
static void setup() {
KAFKA_CONTAINER.addExposedPort(9092);
Properties producerProperties = new Properties();
producerProperties.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, KAFKA_CONTAINER.getBootstrapServers());
producerProperties.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
producerProperties.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
Properties consumerProperties = new Properties();
consumerProperties.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, KAFKA_CONTAINER.getBootstrapServers());
consumerProperties.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
consumerProperties.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
consumerProperties.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
consumerProperties.put(ConsumerConfig.GROUP_ID_CONFIG, UUID.randomUUID()
.toString());
producer = new KafkaProducer<>(producerProperties);
consumer = new KafkaConsumer<>(consumerProperties);
}
private static void publishMessages() throws ExecutionException, InterruptedException {
for (int i = 1; i <= messagesInTopic; i++) {
ProducerRecord<String, String> record = new ProducerRecord<>(TOPIC, String.valueOf(i));
producer.send(record)
.get();
}
}
@AfterAll
static void destroy() {
KAFKA_CONTAINER.stop();
}
@Test
void givenMessages_whenConsumedFromBeginning_thenCheckIfConsumedFromBeginning() throws ExecutionException, InterruptedException {
publishMessages();
consumer.subscribe(Arrays.asList(TOPIC));
ConsumerRecords<String, String> records = consumer.poll(Duration.ofSeconds(10));
int messageCount = 0;
for (ConsumerRecord<String, String> record : records) {
logger.info(record.value());
messageCount++;
}
assertEquals(messagesInTopic, messageCount);
consumer.seekToBeginning(consumer.assignment());
records = consumer.poll(Duration.ofSeconds(10));
messageCount = 0;
for (ConsumerRecord<String, String> record : records) {
logger.info(record.value());
messageCount++;
}
assertEquals(messagesInTopic, messageCount);
}
}

View File

@@ -0,0 +1,130 @@
package com.baeldung.kafka.message;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.time.Duration;
import java.util.Arrays;
import java.util.Collections;
import java.util.Properties;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import org.apache.kafka.clients.admin.Admin;
import org.apache.kafka.clients.admin.AdminClientConfig;
import org.apache.kafka.clients.admin.NewTopic;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.consumer.ConsumerRecords;
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerConfig;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.clients.producer.RecordMetadata;
import org.apache.kafka.common.serialization.StringDeserializer;
import org.apache.kafka.common.serialization.StringSerializer;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.testcontainers.containers.KafkaContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.utility.DockerImageName;
// This live test needs a Docker Daemon running so that a kafka container can be created
@Testcontainers
public class MessageWithKeyLiveTest {
private static String TOPIC = "baeldung";
private static int PARTITIONS = 5;
private static short REPLICATION_FACTOR = 1;
private static String MESSAGE_KEY = "message-key";
private static String MESSAGE_VALUE = "Hello World";
private static Admin admin;
private static KafkaProducer<String, String> producer;
private static KafkaConsumer<String, String> consumer;
@Container
private static final KafkaContainer KAFKA_CONTAINER = new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka:latest"));
@BeforeAll
static void setup() {
KAFKA_CONTAINER.addExposedPort(9092);
Properties adminProperties = new Properties();
adminProperties.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, KAFKA_CONTAINER.getBootstrapServers());
Properties producerProperties = new Properties();
producerProperties.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, KAFKA_CONTAINER.getBootstrapServers());
producerProperties.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
producerProperties.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
Properties consumerProperties = new Properties();
consumerProperties.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, KAFKA_CONTAINER.getBootstrapServers());
consumerProperties.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
consumerProperties.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
consumerProperties.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
consumerProperties.put(ConsumerConfig.GROUP_ID_CONFIG, UUID.randomUUID()
.toString());
admin = Admin.create(adminProperties);
producer = new KafkaProducer<>(producerProperties);
consumer = new KafkaConsumer<>(consumerProperties);
admin.createTopics(Collections.singleton(new NewTopic(TOPIC, PARTITIONS, REPLICATION_FACTOR)));
}
@AfterAll
static void destroy() {
KAFKA_CONTAINER.stop();
}
@Test
void givenAMessageWithKey_whenPublishedToKafkaAndConsumed_thenCheckForKey() throws ExecutionException, InterruptedException {
ProducerRecord<String, String> producerRecord = new ProducerRecord<>(TOPIC, MESSAGE_KEY, MESSAGE_VALUE);
Future<RecordMetadata> future = producer.send(producerRecord);
RecordMetadata metadata = future.get();
assertNotNull(metadata);
consumer.subscribe(Arrays.asList(TOPIC));
ConsumerRecords<String, String> records = consumer.poll(Duration.ofSeconds(5));
for (ConsumerRecord<String, String> consumerRecord : records) {
assertEquals(MESSAGE_KEY, consumerRecord.key());
assertEquals(MESSAGE_VALUE, consumerRecord.value());
}
}
@Test
void givenAListOfMessageWithKeys_whenPublishedToKafka_thenCheckedIfPublishedToSamePartition() throws ExecutionException, InterruptedException {
boolean isSamePartition = true;
int partition = 0;
for (int i = 1; i <= 10; i++) {
ProducerRecord<String, String> producerRecord = new ProducerRecord<>(TOPIC, MESSAGE_KEY, MESSAGE_VALUE);
Future<RecordMetadata> future = producer.send(producerRecord);
RecordMetadata metadata = future.get();
assertNotNull(metadata);
if (i == 1) {
partition = metadata.partition();
} else {
if (partition != metadata.partition()) {
isSamePartition = false;
}
}
}
assertTrue(isSamePartition);
}
}

View File

@@ -12,4 +12,5 @@ This module contains articles about Apache POI.
- [Finding the Last Row in an Excel Spreadsheet From Java](https://www.baeldung.com/java-excel-find-last-row)
- [Setting Formulas in Excel with Apache POI](https://www.baeldung.com/java-apache-poi-set-formulas)
- [Set the Date Format Using Apache POI](https://www.baeldung.com/java-apache-poi-date-format)
- [Replacing Variables in a Document Template with Java](https://www.baeldung.com/java-replace-pattern-word-document-doc-docx)
- More articles: [[<-- prev]](../apache-poi)

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>apache-poi-2</artifactId>
@@ -19,10 +19,15 @@
<artifactId>poi-ooxml</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>${poi.version}</version>
</dependency>
</dependencies>
<properties>
<poi.version>5.2.0</poi.version>
<poi.version>5.2.3</poi.version>
</properties>
</project>

View File

@@ -0,0 +1,38 @@
package com.baeldung.poi.replacevariables;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.usermodel.Range;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
public class DocTextReplacer {
public void replaceText() throws IOException {
String filePath = getClass().getClassLoader()
.getResource("baeldung.doc")
.getPath();
try (InputStream inputStream = new FileInputStream(filePath); POIFSFileSystem fileSystem = new POIFSFileSystem(inputStream)) {
HWPFDocument doc = new HWPFDocument(fileSystem);
doc = replaceText(doc, "Baeldung", "Hello");
saveFile(filePath, doc);
doc.close();
}
}
private HWPFDocument replaceText(HWPFDocument doc, String originalText, String updatedText) {
Range range = doc.getRange();
range.replaceText(originalText, updatedText);
return doc;
}
private void saveFile(String filePath, HWPFDocument doc) throws IOException {
try (FileOutputStream out = new FileOutputStream(filePath)) {
doc.write(out);
}
}
}

View File

@@ -0,0 +1,63 @@
package com.baeldung.poi.replacevariables;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.apache.poi.xwpf.usermodel.XWPFRun;
import org.apache.poi.xwpf.usermodel.XWPFTable;
import org.apache.poi.xwpf.usermodel.XWPFTableCell;
import org.apache.poi.xwpf.usermodel.XWPFTableRow;
public class DocxNaiveTextReplacer {
public void replaceText() throws IOException {
String filePath = getClass().getClassLoader()
.getResource("baeldung-copy.docx")
.getPath();
try (InputStream inputStream = new FileInputStream(filePath)) {
XWPFDocument doc = new XWPFDocument(inputStream);
doc = replaceText(doc, "Baeldung", "Hello");
saveFile(filePath, doc);
doc.close();
}
}
private XWPFDocument replaceText(XWPFDocument doc, String originalText, String updatedText) {
replaceTextInParagraphs(doc.getParagraphs(), originalText, updatedText);
for (XWPFTable tbl : doc.getTables()) {
for (XWPFTableRow row : tbl.getRows()) {
for (XWPFTableCell cell : row.getTableCells()) {
replaceTextInParagraphs(cell.getParagraphs(), originalText, updatedText);
}
}
}
return doc;
}
private void replaceTextInParagraphs(List<XWPFParagraph> paragraphs, String originalText, String updatedText) {
paragraphs.forEach(paragraph -> replaceTextInParagraph(paragraph, originalText, updatedText));
}
private void replaceTextInParagraph(XWPFParagraph paragraph, String originalText, String updatedText) {
List<XWPFRun> runs = paragraph.getRuns();
for (XWPFRun run : runs) {
String text = run.getText(0);
if (text != null && text.contains(originalText)) {
String updatedRunText = text.replace(originalText, updatedText);
run.setText(updatedRunText, 0);
}
}
}
private void saveFile(String filePath, XWPFDocument doc) throws IOException {
try (FileOutputStream out = new FileOutputStream(filePath)) {
doc.write(out);
}
}
}

View File

@@ -0,0 +1,65 @@
package com.baeldung.poi.replacevariables;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Objects;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.apache.poi.xwpf.usermodel.XWPFRun;
import org.apache.poi.xwpf.usermodel.XWPFTable;
import org.apache.poi.xwpf.usermodel.XWPFTableCell;
import org.apache.poi.xwpf.usermodel.XWPFTableRow;
public class DocxTextReplacer {
public void replaceText() throws IOException {
String filePath = getClass().getClassLoader()
.getResource("baeldung.docx")
.getPath();
try (InputStream inputStream = new FileInputStream(filePath)) {
XWPFDocument doc = new XWPFDocument(inputStream);
doc = replaceText(doc, "Baeldung", "Hello");
saveFile(filePath, doc);
doc.close();
}
}
private XWPFDocument replaceText(XWPFDocument doc, String originalText, String updatedText) {
replaceTextInParagraphs(doc.getParagraphs(), originalText, updatedText);
for (XWPFTable tbl : doc.getTables()) {
for (XWPFTableRow row : tbl.getRows()) {
for (XWPFTableCell cell : row.getTableCells()) {
replaceTextInParagraphs(cell.getParagraphs(), originalText, updatedText);
}
}
}
return doc;
}
private void replaceTextInParagraphs(List<XWPFParagraph> paragraphs, String originalText, String updatedText) {
paragraphs.forEach(paragraph -> replaceTextInParagraph(paragraph, originalText, updatedText));
}
private void replaceTextInParagraph(XWPFParagraph paragraph, String originalText, String updatedText) {
String paragraphText = paragraph.getParagraphText();
if (paragraphText.contains(originalText)) {
String updatedParagraphText = paragraphText.replace(originalText, updatedText);
while (paragraph.getRuns().size() > 0) {
paragraph.removeRun(0);
}
XWPFRun newRun = paragraph.createRun();
newRun.setText(updatedParagraphText);
}
}
private void saveFile(String filePath, XWPFDocument doc) throws IOException {
try (FileOutputStream out = new FileOutputStream(filePath)) {
doc.write(out);
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,31 @@
package com.baeldung.poi.replacevariables;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Arrays;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.extractor.WordExtractor;
import org.junit.jupiter.api.Test;
class DocTextReplacerUnitTest {
@Test
void whenReplaceText_ThenTextReplaced() throws IOException {
new DocTextReplacer().replaceText();
String filePath = getClass().getClassLoader()
.getResource("baeldung.doc")
.getPath();
try (FileInputStream fis = new FileInputStream(filePath); HWPFDocument document = new HWPFDocument(fis); WordExtractor extractor = new WordExtractor(document)) {
long occurrencesOfHello = Arrays.stream(extractor.getText()
.split("\\s+"))
.filter(s -> s.contains("Hello"))
.count();
assertEquals(5, occurrencesOfHello);
}
}
}

View File

@@ -0,0 +1,31 @@
package com.baeldung.poi.replacevariables;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Arrays;
import org.apache.poi.xwpf.extractor.XWPFWordExtractor;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.junit.jupiter.api.Test;
class DocxNaiveTextReplacerUnitTest {
@Test
void whenReplaceText_ThenTextReplaced() throws IOException {
new DocxNaiveTextReplacer().replaceText();
String filePath = getClass().getClassLoader()
.getResource("baeldung-copy.docx")
.getPath();
try (FileInputStream fis = new FileInputStream(filePath); XWPFDocument document = new XWPFDocument(fis); XWPFWordExtractor extractor = new XWPFWordExtractor(document)) {
long occurrencesOfHello = Arrays.stream(extractor.getText()
.split("\\s+"))
.filter(s -> s.contains("Hello"))
.count();
assertTrue(occurrencesOfHello < 5);
}
}
}

View File

@@ -0,0 +1,31 @@
package com.baeldung.poi.replacevariables;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Arrays;
import org.apache.poi.xwpf.extractor.XWPFWordExtractor;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.junit.jupiter.api.Test;
class DocxTestReplacerUnitTest {
@Test
void whenReplaceText_ThenTextReplaced() throws IOException {
new DocxTextReplacer().replaceText();
String filePath = getClass().getClassLoader()
.getResource("baeldung.docx")
.getPath();
try (FileInputStream fis = new FileInputStream(filePath); XWPFDocument document = new XWPFDocument(fis); XWPFWordExtractor extractor = new XWPFWordExtractor(document)) {
long occurrencesOfHello = Arrays.stream(extractor.getText()
.split("\\s+"))
.filter(s -> s.contains("Hello"))
.count();
assertEquals(5, occurrencesOfHello);
}
}
}

View File

@@ -62,7 +62,7 @@ public class JExcelHelper {
sheet.addCell(cellLabel);
Number cellNumber = new Number(1, 2, 20, cellFormat);
sheet.addCell(cellNumber);
workbook.write();
} finally {
if (workbook != null) {

View File

@@ -33,36 +33,29 @@ public class ExcelPOIHelper {
data.put(i, new ArrayList<String>());
for (Cell cell : row) {
switch (cell.getCellType()) {
case STRING:
data.get(i)
.add(cell.getRichStringCellValue()
.getString());
break;
case NUMERIC:
if (DateUtil.isCellDateFormatted(cell)) {
data.get(i)
.add(cell.getDateCellValue() + "");
} else {
data.get(i)
.add((int)cell.getNumericCellValue() + "");
}
break;
case BOOLEAN:
data.get(i)
.add(cell.getBooleanCellValue() + "");
break;
case FORMULA:
data.get(i)
.add(cell.getCellFormula() + "");
break;
default:
data.get(i)
.add(" ");
case STRING:
data.get(i).add(cell.getRichStringCellValue().getString());
break;
case NUMERIC:
if (DateUtil.isCellDateFormatted(cell)) {
data.get(i).add(cell.getDateCellValue() + "");
} else {
data.get(i).add((int) cell.getNumericCellValue() + "");
}
break;
case BOOLEAN:
data.get(i).add(cell.getBooleanCellValue() + "");
break;
case FORMULA:
data.get(i).add(cell.getCellFormula() + "");
break;
default:
data.get(i).add(" ");
}
}
i++;
}
if (workbook != null){
if (workbook != null) {
workbook.close();
}
return data;
@@ -117,9 +110,9 @@ public class ExcelPOIHelper {
workbook.write(outputStream);
} finally {
if (workbook != null) {
workbook.close();
workbook.close();
}
}
}

View File

@@ -13,6 +13,7 @@ import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class ExcelUtility {
private static final String ENDLINE = System.getProperty("line.separator");
public static String readExcel(String filePath) throws IOException {
@@ -23,13 +24,9 @@ public class ExcelUtility {
inputStream = new FileInputStream(file);
Workbook baeuldungWorkBook = new XSSFWorkbook(inputStream);
for (Sheet sheet : baeuldungWorkBook) {
toReturn.append("--------------------------------------------------------------------")
.append(ENDLINE);
toReturn.append("Worksheet :")
.append(sheet.getSheetName())
.append(ENDLINE);
toReturn.append("--------------------------------------------------------------------")
.append(ENDLINE);
toReturn.append("--------------------------------------------------------------------").append(ENDLINE);
toReturn.append("Worksheet :").append(sheet.getSheetName()).append(ENDLINE);
toReturn.append("--------------------------------------------------------------------").append(ENDLINE);
int firstRow = sheet.getFirstRowNum();
int lastRow = sheet.getLastRowNum();
for (int index = firstRow + 1; index <= lastRow; index++) {
@@ -39,8 +36,7 @@ public class ExcelUtility {
Cell cell = row.getCell(cellIndex, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
printCellValue(cell, toReturn);
}
toReturn.append(" ||")
.append(ENDLINE);
toReturn.append(" ||").append(ENDLINE);
}
}
inputStream.close();
@@ -53,24 +49,19 @@ public class ExcelUtility {
}
public static void printCellValue(Cell cell, StringBuilder toReturn) {
CellType cellType = cell.getCellType()
.equals(CellType.FORMULA) ? cell.getCachedFormulaResultType() : cell.getCellType();
CellType cellType = cell.getCellType().equals(CellType.FORMULA) ? cell.getCachedFormulaResultType() : cell.getCellType();
if (cellType.equals(CellType.STRING)) {
toReturn.append(cell.getStringCellValue())
.append(" | ");
toReturn.append(cell.getStringCellValue()).append(" | ");
}
if (cellType.equals(CellType.NUMERIC)) {
if (DateUtil.isCellDateFormatted(cell)) {
toReturn.append(cell.getDateCellValue())
.append(" | ");
toReturn.append(cell.getDateCellValue()).append(" | ");
} else {
toReturn.append(cell.getNumericCellValue())
.append(" | ");
toReturn.append(cell.getNumericCellValue()).append(" | ");
}
}
if (cellType.equals(CellType.BOOLEAN)) {
toReturn.append(cell.getBooleanCellValue())
.append(" | ");
toReturn.append(cell.getBooleanCellValue()).append(" | ");
}
}
}

View File

@@ -9,7 +9,7 @@ public class CellStyleHandler {
public void changeCellBackgroundColor(Cell cell) {
CellStyle cellStyle = cell.getCellStyle();
if(cellStyle == null) {
if (cellStyle == null) {
cellStyle = cell.getSheet().getWorkbook().createCellStyle();
}
cellStyle.setFillForegroundColor(IndexedColors.LIGHT_BLUE.getIndex());
@@ -19,7 +19,7 @@ public class CellStyleHandler {
public void changeCellBackgroundColorWithPattern(Cell cell) {
CellStyle cellStyle = cell.getCellStyle();
if(cellStyle == null) {
if (cellStyle == null) {
cellStyle = cell.getSheet().getWorkbook().createCellStyle();
}
cellStyle.setFillBackgroundColor(IndexedColors.BLACK.index);

View File

@@ -8,6 +8,7 @@ import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.apache.poi.ss.usermodel.Workbook;
public class CellStyler {
public CellStyle createWarningColor(Workbook workbook) {
CellStyle style = workbook.createCellStyle();

View File

@@ -4,13 +4,10 @@ import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
public class MultilineText {
public void formatMultilineText(Cell cell, int cellNumber) {
cell.getRow()
.setHeightInPoints(cell.getSheet()
.getDefaultRowHeightInPoints() * 2);
CellStyle cellStyle = cell.getSheet()
.getWorkbook()
.createCellStyle();
cell.getRow().setHeightInPoints(cell.getSheet().getDefaultRowHeightInPoints() * 2);
CellStyle cellStyle = cell.getSheet().getWorkbook().createCellStyle();
cellStyle.setWrapText(true);
cell.setCellStyle(cellStyle);
}

View File

@@ -54,8 +54,7 @@ public class CellValueAndNotFormulaHelper {
Workbook workbook = new XSSFWorkbook(inputStream);
Sheet sheet = workbook.getSheetAt(0);
FormulaEvaluator evaluator = workbook.getCreationHelper()
.createFormulaEvaluator();
FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator();
CellAddress cellAddress = new CellAddress(cellLocation);
Row row = sheet.getRow(cellAddress.getRow());

View File

@@ -36,22 +36,18 @@ public class JExcelIntegrationTest {
public void whenParsingJExcelFile_thenCorrect() throws IOException, BiffException {
Map<Integer, List<String>> data = jExcelHelper.readJExcel(fileLocation);
assertEquals("Name", data.get(0)
.get(0));
assertEquals("Age", data.get(0)
.get(1));
assertEquals("Name", data.get(0).get(0));
assertEquals("Age", data.get(0).get(1));
assertEquals("John Smith", data.get(2)
.get(0));
assertEquals("20", data.get(2)
.get(1));
assertEquals("John Smith", data.get(2).get(0));
assertEquals("20", data.get(2).get(1));
}
@After
public void cleanup(){
public void cleanup() {
File testFile = new File(fileLocation);
if (testFile.exists()) {
testFile.delete();
testFile.delete();
}
}
}

View File

@@ -14,6 +14,7 @@ import org.junit.Before;
import org.junit.Test;
public class ExcelCellFormatterUnitTest {
private static final String FILE_NAME = "ExcelCellFormatterTest.xlsx";
private static final int STRING_CELL_INDEX = 0;
private static final int BOOLEAN_CELL_INDEX = 1;
@@ -25,7 +26,7 @@ public class ExcelCellFormatterUnitTest {
@Before
public void setup() throws IOException, URISyntaxException {
fileLocation = Paths.get(ClassLoader.getSystemResource(FILE_NAME).toURI()).toString();
fileLocation = Paths.get(ClassLoader.getSystemResource(FILE_NAME).toURI()).toString();
}
@Test

View File

@@ -33,22 +33,18 @@ public class ExcelIntegrationTest {
public void whenParsingPOIExcelFile_thenCorrect() throws IOException {
Map<Integer, List<String>> data = excelPOIHelper.readExcel(fileLocation);
assertEquals("Name", data.get(0)
.get(0));
assertEquals("Age", data.get(0)
.get(1));
assertEquals("Name", data.get(0).get(0));
assertEquals("Age", data.get(0).get(1));
assertEquals("John Smith", data.get(1)
.get(0));
assertEquals("20", data.get(1)
.get(1));
assertEquals("John Smith", data.get(1).get(0));
assertEquals("20", data.get(1).get(1));
}
@After
public void cleanup(){
public void cleanup() {
File testFile = new File(fileLocation);
if (testFile.exists()) {
testFile.delete();
testFile.delete();
}
}
}

View File

@@ -13,6 +13,7 @@ import org.junit.Before;
import org.junit.Test;
public class ExcelUtilityUnitTest {
private static final String FILE_NAME = "baeldung.xlsx";
private String fileLocation;
private static final String ENDLINE = System.getProperty("line.separator");
@@ -21,39 +22,18 @@ public class ExcelUtilityUnitTest {
@Before
public void setupUnitTest() throws IOException, URISyntaxException, ParseException {
output = new StringBuilder();
output.append("--------------------------------------------------------------------")
.append(ENDLINE);
output.append("Worksheet :Sheet1")
.append(ENDLINE);
output.append("--------------------------------------------------------------------")
.append(ENDLINE);
output.append("|| Name1 | Surname1 | 3.55696564113E11 | ")
.append(new SimpleDateFormat("dd/MM/yyyy").parse("4/11/2021")
.toString())
.append(" | ‡ | ||")
.append(ENDLINE);
output.append("|| Name2 | Surname2 | 5.646513512E9 | ")
.append(new SimpleDateFormat("dd/MM/yyyy").parse("4/12/2021")
.toString())
.append(" | false | ||")
.append(ENDLINE);
output.append("|| Name3 | Surname3 | 3.55696564113E11 | ")
.append(new SimpleDateFormat("dd/MM/yyyy").parse("4/11/2021")
.toString())
.append(" | 7.17039641738E11 | ||")
.append(ENDLINE);
output.append("--------------------------------------------------------------------")
.append(ENDLINE);
output.append("Worksheet :Sheet2")
.append(ENDLINE);
output.append("--------------------------------------------------------------------")
.append(ENDLINE);
output.append("|| Name4 | Surname4 | 3.55675623232E11 | 13/04/2021 | ||")
.append(ENDLINE);
output.append("--------------------------------------------------------------------").append(ENDLINE);
output.append("Worksheet :Sheet1").append(ENDLINE);
output.append("--------------------------------------------------------------------").append(ENDLINE);
output.append("|| Name1 | Surname1 | 3.55696564113E11 | ").append(new SimpleDateFormat("dd/MM/yyyy").parse("4/11/2021").toString()).append(" | ‡ | ||").append(ENDLINE);
output.append("|| Name2 | Surname2 | 5.646513512E9 | ").append(new SimpleDateFormat("dd/MM/yyyy").parse("4/12/2021").toString()).append(" | false | ||").append(ENDLINE);
output.append("|| Name3 | Surname3 | 3.55696564113E11 | ").append(new SimpleDateFormat("dd/MM/yyyy").parse("4/11/2021").toString()).append(" | 7.17039641738E11 | ||").append(ENDLINE);
output.append("--------------------------------------------------------------------").append(ENDLINE);
output.append("Worksheet :Sheet2").append(ENDLINE);
output.append("--------------------------------------------------------------------").append(ENDLINE);
output.append("|| Name4 | Surname4 | 3.55675623232E11 | 13/04/2021 | ||").append(ENDLINE);
fileLocation = Paths.get(ClassLoader.getSystemResource(FILE_NAME)
.toURI())
.toString();
fileLocation = Paths.get(ClassLoader.getSystemResource(FILE_NAME).toURI()).toString();
}
@Test

View File

@@ -12,6 +12,7 @@ import java.nio.file.Paths;
import static org.junit.Assert.assertEquals;
public class CellBorderHandlerUnitTest {
private static final String FILE_NAME = "cellstyle/CellStyleBorderHandlerTest.xlsx";
private static final int SHEET_INDEX = 0;

View File

@@ -16,6 +16,7 @@ import org.junit.Before;
import org.junit.Test;
public class CellStyleHandlerUnitTest {
private static final String FILE_NAME = "cellstyle/CellStyleHandlerTest.xlsx";
private static final int SHEET_INDEX = 0;
private static final int ROW_INDEX = 0;

View File

@@ -15,15 +15,14 @@ import org.junit.Before;
import org.junit.Test;
public class CellStylerUnitTest {
private static String FILE_NAME = "com/baeldung/poi/excel/cellstyle/CellStyle.xlsx";
private static final String NEW_FILE_NAME = "CellStyleTest_output.xlsx";
private String fileLocation;
@Before
public void setup() throws IOException, URISyntaxException {
fileLocation = Paths.get(ClassLoader.getSystemResource(FILE_NAME)
.toURI())
.toString();
fileLocation = Paths.get(ClassLoader.getSystemResource(FILE_NAME).toURI()).toString();
}
@Test

View File

@@ -14,6 +14,7 @@ import java.net.URISyntaxException;
import java.nio.file.Paths;
public class ExcelInsertRowUnitTest {
private static final String FILE_NAME = "test.xlsx";
private static final String NEW_FILE_NAME = "new_test.xlsx";
private String fileLocation;

View File

@@ -14,12 +14,13 @@ import org.junit.Before;
import org.junit.Test;
public class ExcelCellMergerUnitTest {
private static final String FILE_NAME = "ExcelCellFormatterTest.xlsx";
private String fileLocation;
@Before
public void setup() throws IOException, URISyntaxException {
fileLocation = Paths.get(ClassLoader.getSystemResource(FILE_NAME).toURI()).toString();
fileLocation = Paths.get(ClassLoader.getSystemResource(FILE_NAME).toURI()).toString();
}
@Test
@@ -28,9 +29,9 @@ public class ExcelCellMergerUnitTest {
Sheet sheet = workbook.getSheetAt(0);
assertEquals(0, sheet.getNumMergedRegions());
int firstRow = 0;
int lastRow = 0;
int firstCol = 0;
int firstRow = 0;
int lastRow = 0;
int firstCol = 0;
int lastCol = 2;
sheet.addMergedRegion(new CellRangeAddress(firstRow, lastRow, firstCol, lastCol));
assertEquals(1, sheet.getNumMergedRegions());
@@ -43,7 +44,7 @@ public class ExcelCellMergerUnitTest {
Workbook workbook = new XSSFWorkbook(fileLocation);
Sheet sheet = workbook.getSheetAt(0);
assertEquals(0, sheet.getNumMergedRegions());
assertEquals(0, sheet.getNumMergedRegions());
sheet.addMergedRegion(CellRangeAddress.valueOf("A1:C1"));
assertEquals(1, sheet.getNumMergedRegions());

View File

@@ -20,6 +20,7 @@ import org.junit.Before;
import org.junit.Test;
public class MultilineTextUnitTest {
private static String FILE_NAME = "com/baeldung/poi/excel/multilinetext/MultilineTextTest.xlsx";
private static final String NEW_FILE_NAME = "MultilineTextTest_output.xlsx";
private static final int STRING_ROW_INDEX = 1;
@@ -29,9 +30,7 @@ public class MultilineTextUnitTest {
@Before
public void setup() throws IOException, URISyntaxException {
fileLocation = Paths.get(ClassLoader.getSystemResource(FILE_NAME)
.toURI())
.toString();
fileLocation = Paths.get(ClassLoader.getSystemResource(FILE_NAME).toURI()).toString();
}
@Test
@@ -53,13 +52,9 @@ public class MultilineTextUnitTest {
File file = new File(NEW_FILE_NAME);
FileInputStream fileInputStream = new FileInputStream(file);
Workbook testWorkbook = new XSSFWorkbook(fileInputStream);
assertTrue(row.getHeightInPoints() == testWorkbook.getSheetAt(0)
.getRow(STRING_ROW_INDEX)
.getHeightInPoints());
assertTrue(row.getHeightInPoints() == testWorkbook.getSheetAt(0).getRow(STRING_ROW_INDEX).getHeightInPoints());
DataFormatter formatter = new DataFormatter();
assertEquals("Hello \n world!", formatter.formatCellValue(testWorkbook.getSheetAt(0)
.getRow(STRING_ROW_INDEX)
.getCell(STRING_CELL_INDEX)));
assertEquals("Hello \n world!", formatter.formatCellValue(testWorkbook.getSheetAt(0).getRow(STRING_ROW_INDEX).getCell(STRING_CELL_INDEX)));
testWorkbook.close();
fileInputStream.close();
file.delete();

View File

@@ -17,17 +17,17 @@
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<artifactId>spark-core_2.12</artifactId>
<version>${org.apache.spark.spark-core.version}</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.11</artifactId>
<artifactId>spark-sql_2.12</artifactId>
<version>${org.apache.spark.spark-sql.version}</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-graphx_2.11</artifactId>
<artifactId>spark-graphx_2.12</artifactId>
<version>${org.apache.spark.spark-graphx.version}</version>
</dependency>
<dependency>
@@ -37,22 +37,22 @@
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming_2.11</artifactId>
<artifactId>spark-streaming_2.12</artifactId>
<version>${org.apache.spark.spark-streaming.version}</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-mllib_2.11</artifactId>
<artifactId>spark-mllib_2.12</artifactId>
<version>${org.apache.spark.spark-mllib.version}</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming-kafka-0-10_2.11</artifactId>
<artifactId>spark-streaming-kafka-0-10_2.12</artifactId>
<version>${org.apache.spark.spark-streaming-kafka.version}</version>
</dependency>
<dependency>
<groupId>com.datastax.spark</groupId>
<artifactId>spark-cassandra-connector_2.11</artifactId>
<artifactId>spark-cassandra-connector_2.12</artifactId>
<version>${com.datastax.spark.spark-cassandra-connector.version}</version>
</dependency>
<dependency>
@@ -97,17 +97,17 @@
</repositories>
<properties>
<org.apache.spark.spark-core.version>2.4.8</org.apache.spark.spark-core.version>
<org.apache.spark.spark-sql.version>2.4.8</org.apache.spark.spark-sql.version>
<org.apache.spark.spark-streaming.version>2.4.8</org.apache.spark.spark-streaming.version>
<org.apache.spark.spark-mllib.version>2.4.8</org.apache.spark.spark-mllib.version>
<org.apache.spark.spark-graphx.version>2.4.8</org.apache.spark.spark-graphx.version>
<org.apache.spark.spark-core.version>3.3.2</org.apache.spark.spark-core.version>
<org.apache.spark.spark-sql.version>3.3.2</org.apache.spark.spark-sql.version>
<org.apache.spark.spark-streaming.version>3.3.2</org.apache.spark.spark-streaming.version>
<org.apache.spark.spark-mllib.version>3.3.2</org.apache.spark.spark-mllib.version>
<org.apache.spark.spark-graphx.version>3.3.2</org.apache.spark.spark-graphx.version>
<graphframes.version>0.8.1-spark3.0-s_2.12</graphframes.version>
<org.apache.spark.spark-streaming-kafka.version>2.4.8</org.apache.spark.spark-streaming-kafka.version>
<com.datastax.spark.spark-cassandra-connector.version>2.5.2</com.datastax.spark.spark-cassandra-connector.version>
<org.apache.spark.spark-streaming-kafka.version>3.3.2</org.apache.spark.spark-streaming-kafka.version>
<com.datastax.spark.spark-cassandra-connector.version>3.3.0</com.datastax.spark.spark-cassandra-connector.version>
<com.datastax.spark.spark-cassandra-connector-java.version>1.6.0-M1</com.datastax.spark.spark-cassandra-connector-java.version>
<maven-assembly-plugin.version>3.3.0</maven-assembly-plugin.version>
<postgres.version>42.3.3</postgres.version>
<postgres.version>42.5.4</postgres.version>
</properties>
</project>

View File

@@ -16,8 +16,11 @@ import org.apache.log4j.Logger;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.api.java.Optional;
import org.apache.spark.api.java.function.Function2;
import org.apache.spark.api.java.function.Function3;
import org.apache.spark.streaming.Durations;
import org.apache.spark.streaming.State;
import org.apache.spark.streaming.StateSpec;
import org.apache.spark.streaming.api.java.JavaDStream;
import org.apache.spark.streaming.api.java.JavaInputDStream;
@@ -74,7 +77,8 @@ public class WordCountingAppWithCheckpoint {
JavaPairDStream<String, Integer> wordCounts = words.mapToPair(s -> new Tuple2<>(s, 1))
.reduceByKey((Function2<Integer, Integer, Integer>) (i1, i2) -> i1 + i2);
JavaMapWithStateDStream<String, Integer, Integer, Tuple2<String, Integer>> cumulativeWordCounts = wordCounts.mapWithState(StateSpec.function((word, one, state) -> {
JavaMapWithStateDStream<String, Integer, Integer, Tuple2<String, Integer>> cumulativeWordCounts =
wordCounts.mapWithState(StateSpec.function((Function3<String, Optional<Integer>, State<Integer>, Tuple2<String, Integer>>) (word, one, state) -> {
int sum = one.orElse(0) + (state.exists() ? state.get() : 0);
Tuple2<String, Integer> output = new Tuple2<>(word, sum);
state.update(sum);

Some files were not shown because too many files have changed in this diff Show More