Commit Graph

833 Commits

Author SHA1 Message Date
Shaoqiang Lu
1add2830f5 Auto-detect the class/interface to be mocked
Issue #4426
2023-08-03 09:51:59 +02:00
Mahmoud Ben Hassine
5bccfed523 Replace synchronized blocks and methods with locks
This commit replaces synchronized blocks and methods
that are used frequently or that guard blocking I/O
operations with locks. This is required to prevent
virtual threads pinning, as explained in JEP 444 [1].

Note that synchronized blocks and methods that are used
infrequently (like AutomaticJobRegistrar#start/stop) or
that guard in-memory operations were not replaced as this
is not required, see JEP 444 [1].

Resolves to #4399

---
[1]: https://openjdk.org/jeps/444
2023-07-15 08:18:07 +02:00
Mahmoud Ben Hassine
05168089f1 Add test suite for virtual threads support
Related to #4399
2023-07-14 23:53:20 +02:00
Mahmoud Ben Hassine
f82c16b825 Fix javadoc errors and warnings
Resolves #1624
2023-07-06 06:46:26 +02:00
Mahmoud Ben Hassine
efdb59e570 Replace hardcoded charsets with StandardCharsets 2023-07-05 08:03:48 +02:00
Mahmoud Ben Hassine
f0137bc54c Remove redundant modifiers 2023-07-05 08:03:48 +02:00
Mahmoud Ben Hassine
0a1cdb095f Mark fields as final where appropriate 2023-07-05 08:03:48 +02:00
Mahmoud Ben Hassine
241e37e672 Remove concatenation with empty string 2023-07-05 08:03:47 +02:00
Mahmoud Ben Hassine
96f8d6bd35 Replace anonymous types with lambda expressions or method references 2023-07-04 18:50:16 +02:00
Mahmoud Ben Hassine
ee30af4789 Remove redundant "extends Object" 2023-06-22 11:17:13 +02:00
Mahmoud Ben Hassine
850c27e08e Fix datasource configuration in metrics sample 2023-06-15 22:38:12 +02:00
Mahmoud Ben Hassine
93d911e100 Use lambdas and method references where appropriate 2023-06-12 16:43:46 +02:00
Mahmoud Ben Hassine
c5b4f1a777 Remove unnecessary boxing/unboxing 2023-06-12 16:17:32 +02:00
Mahmoud Ben Hassine
cb1b68d165 Replace if statements with switch statements where appropriate 2023-06-12 15:39:25 +02:00
Mahmoud Ben Hassine
7f80b7230b Remove System.err.println from tests 2023-06-07 15:47:56 +02:00
Mahmoud Ben Hassine
27e2ab02c0 Remove Hibernate debug details from tests 2023-06-07 15:47:56 +02:00
Mahmoud Ben Hassine
92159cbc2b Use diamond operator where appropriate 2023-06-05 13:48:49 +02:00
Mahmoud Ben Hassine
0dc5b63469 Replace identical catch sections with multi-catch blocks 2023-06-05 13:30:23 +02:00
Mahmoud Ben Hassine
8070751da8 Improve String concatenation where appropriate 2023-06-05 13:19:28 +02:00
Mahmoud Ben Hassine
c25cd55901 Upgrade spring-javaformat maven plugin to version 0.0.39 2023-06-05 11:11:48 +02:00
Minsoo Kim
4a971a0764 Enhance switch statements
Issue #4365
2023-05-03 23:59:16 +02:00
Mahmoud Ben Hassine
972951a40a Remove unused imports and apply imports code style 2023-04-11 16:28:36 +02:00
Henning Poettker
e61065ab00 Reduce use of deprecated APIs 2023-03-29 15:34:48 +02:00
jinwoo-Bae
2cc0be4a0c Replace usage of deprecated jobOperator#start method with newer version
Related to #4303
2023-02-21 15:52:25 +01:00
Henning Poettker
523386e674 Prefer Slice over Page in RepositoryItemReader
Resolves #4115
2023-02-17 17:13:36 +01:00
Mahmoud Ben Hassine
0dfa73773b Remove unused job parameters in samples 2023-02-16 15:47:14 +01:00
Danilo Piazzalunga
fc0ec01ff8 Throw IllegalStateException from afterPropertiesSet
Consistently use Assert.state in the afterPropertiesSet()
methods to throw IllegalStateException instead of
IllegalArgumentException when some properties are missing
and/or invalid.

Resolves #2244
2022-11-23 12:22:26 +01:00
Mahmoud Ben Hassine
05bbd3f7ea Remove dependency autowiring in test utilities
Issue #4233
2022-11-16 14:21:17 +01:00
Henning Poettker
3bb7ce532b Improve @SpringBatchTest to autowire the job under test in JobLauncherTestUtils if it is unique
Issue #4218
2022-11-08 13:16:36 +01:00
Mahmoud Ben Hassine
2660f2bb27 Add support to use any type as a job parameter
This commit also changes the way job parameters
are parsed and persisted.

NB: This commit should ideally have been split
into two change sets. But the changes are tightly
related that is was not possible to separate them.

Related to:

* https://github.com/spring-projects/spring-batch/issues/3960
* https://github.com/spring-projects/spring-batch/issues/2122
* https://github.com/spring-projects/spring-batch/issues/1035
* https://github.com/spring-projects/spring-batch/issues/1983
2022-10-04 20:35:50 +02:00
Mahmoud Ben Hassine
40b4be3c14 Add transaction support in JobExplorerFactoryBean
This commit adds support to create a transactional
proxy around the JobExplorer created by the
JobExplorerFactoryBean.

Resolves #1307
2022-09-21 03:28:59 +02:00
Mahmoud Ben Hassine
f39f07075a Improve Step/Job builder APIs to guide users to set mandatory properties
Before this commit, the user had to manually set the job repository and transaction
manager on `JobBuilder` and `StepBuilder` instances with a chained call to
`.repository(jobRepository)` and `.transactionManager(transactionManager)`.
This is error prone and can lead to runtime errors if these properties are not set.

This commit introduces new APIs to guide the user to set these properties at
builder creation time.

Resolves #4192
2022-09-17 22:31:12 +02:00
Mahmoud Ben Hassine
6e443cb1b1 Deprecate Job/Step builder factories
This commit deprecates JobBuilderFactory and StepBuilderFactory
in favor of the respective builders they create.

It also removes the exposure of such utilities as beans in the
application context when using `@EnableBatchProcessing`.

Resolves https://github.com/spring-projects/spring-batch/issues/4188
2022-09-13 16:56:01 +02:00
Mahmoud Ben Hassine
7c8fb172a7 Move the transaction manager configuration to AbstractTaskletStepBuilder
Before this commit, the transaction manager was configurable
at the StepBuilder level, which is inconsistent with the XML
config style in addition to be not needed for most step types.

This commit moves the configuration of the transaction manager
from the StepBuilder down to the AbstractTaskletStepBuilder,
which is the level where the transaction manager is needed.

Resolves #4130
2022-09-08 11:35:14 +02:00
Mahmoud Ben Hassine
4d0ed63dd7 Deprecate AssertFile
Resolves #4181
2022-08-24 15:17:34 +02:00
Mahmoud Ben Hassine
7e535afb73 Refine contribution #4112
Revert the removal of `@SpringJUnitConfig`
usage in the test suite of samples.

Related to #4111
2022-08-24 10:37:02 +02:00
Glenn Renfro
8ca9802da4 Remove the JUnit dependency in AssertFile
The side effect is a breaking change in that it will now
throw IllegalStateException instead of the Compare and
AssertExceptions provided by JUnit.

Resolves #4111
2022-08-24 10:29:45 +02:00
Mahmoud Ben Hassine
fe40370f39 Refine contribution #4167
The documentation generation change introduced
in #4167 seems to scan more files than previously
WRT checking the code formatting style.

This commit fixes the formatting of the files
that do not conform to the Spring style.
2022-08-21 09:52:35 +02:00
Mahmoud Ben Hassine
c506a49988 Remove job autowiring in JobLauncherTestUtils
Before this commit, registering the JobLauncherTestUtils
as a bean in the test context (either manually or via
`@SpringBatchTest`) was failing when multiple jobs are
defined in the test context.

This commit removes the autowiring of the job under test
in JobLauncherTestUtils.

Resolves #1237
2022-08-20 12:39:02 +02:00
Mahmoud Ben Hassine
e67c0069f1 Use the Chunk API consistently
This commit replaces the usage of List with Chunk
where appropriate. Summary of changes:

- The Chunk class was moved from the `org.springframework.batch.core.step.item` package to the `org.springframework.batch.item` package
- The signature of the method `ItemWriter#write(List)` was changed to `ItemWriter#write(Chunk)`
- All implementations of `ItemWriter` were updated to use the Chunk API instead of List
- All methods in the `ItemWriteListener` interface were updated to use the Chunk API instead of List
- All implementations of `ItemWriteListener` were updated to use the Chunk API instead of List
- The constructor of `ChunkRequest` was changed to accept a Chunk instead of a Collection of items
- The return type of `ChunkRequest#getItems()` was changed from List to Chunk

Resolves #3954
2022-08-19 13:40:09 +02:00
Henning Poettker
1e4a23e3eb Migrate Spring Batch Samples to JUnit Jupiter 2022-08-02 17:18:12 +02:00
Henning Poettker
a393dc533d Replace deprecated IntegrationFlows 2022-07-20 18:28:34 +02:00
Marvin Deng
c0791039dc Rename SimpleJobLauncher to TaskExecutorJobLauncher
Resolves #4123
2022-07-19 13:34:23 +02:00
Henning Poettker
a55f556893 Use Hibernate mapping DTD from classpath 2022-07-18 12:45:06 +02:00
Mahmoud Ben Hassine
565ddcdf96 Change transaction manager type in default batch configuration
This commits changes the type of the transaction manager
from `DataSourceTransactionManager` to `JdbcTransactionManager`
in the default configuration of `@EnableBatchProcessing`.

The `JdbcTransactionManager` adds common JDBC exception translation
which is beneficial for Spring Batch to improve exception handling
and error reporting.

Resolves #4126
2022-07-16 17:52:43 +02:00
Mahmoud Ben Hassine
c4ad90b9b1 Apply spring-javaformat style for consistency with other projects
Resolves #4118
2022-05-25 23:06:48 +02:00
Mahmoud Ben Hassine
984570a1b1 Rename schema-oracle10g.sql to schema-oracle.sql
Resolves ##1057
2022-03-22 17:29:59 +01:00
Mahmoud Ben Hassine
968a5b5b2e Refine contribution #595
- Update versions of jdbc driver and docker image
- Update Javadocs
- Remove JOB_CONFIGURATION_LOCATION from DDL schema
- Remove unused resources
2022-03-18 17:45:36 +01:00
Jonathan Bregler
9388abb589 Integrate SAP Hana as supported Spring Batch database
This commit adds SAP HANA as a supported Spring Batch database, enabling
developers to seamlessly move their existing Spring Batch projects to SAP HANA
or easily starting new Spring Batch projects on SAP HANA.

This commit contains the following changes:

- Add SAP HANA to the DatabaseType enum
- Add HanaPagingQueryProvider and tests
- Add properties files for SAP HANA

Issue #2515
2022-03-18 16:52:50 +01:00
Mahmoud Ben Hassine
9cbde4eea6 Fix RepositoryFunctionalTests
Due to the decoupling of `PagingAndSortingRepository` from
`CrudRepository` in Spring Data 3 [1], this test has to be updated
to use different repositories between the reader and the writer
according to the expected types for the `repository` property.

[1]: https://github.com/spring-projects/spring-data-commons/issues/2537
2022-03-16 17:15:56 +01:00