Commit Graph

1490 Commits

Author SHA1 Message Date
Philippe Marschall
2aa94d09d1 Replace #initMocks with MockitoRule
Replace all references of MockitoAnnotations#initMocks with the
MockitoRule JUnit rule.
2021-08-09 18:33:39 +02:00
Henning Pöttker
8258325413 Refactor deprecated method extractDatabaseMetaData
Issue #3838
2021-08-09 18:22:35 +02:00
Henning Poettker
0ad68037b6 Reduce naming collisions in consecutive tests 2021-08-09 13:36:31 +02:00
Mahmoud Ben Hassine
55c2df8782 Remove unused constant in StaxEventItemWriterBuilderTests 2021-08-06 22:17:51 +02:00
Mahmoud Ben Hassine
66c33372a6 Remove unused logger in MongoItemReader 2021-08-05 21:17:26 +02:00
abielewicz
f4e14ddf66 Change the order in which datum writer is selected
Due to GenericRecord being checked before SpecificRecordBase,
GenericDatumWriter was used incorrectly for types that extend
SpecificRecordBase.

Resolves #3859
2021-05-18 17:46:31 +02:00
이동욱
4b8331d724 Replace ArrayList with LinkedList in ListItemReader
Issue #3782
2021-05-18 10:30:20 +02:00
Parikshit Dutta
d76c083b04 Updated verifyCursorPosition default to true in JdbcCursorItemReaderBuilder
Issue #3893
2021-05-12 14:51:00 +02:00
Marten Deinum
11bac7c4e1 Reduce the toCharArray overhead
Both the PatternMatcher and JdbcParameterUtils use String.toCharArray for
processing. This will create a new char[] which needs to be collected. The
same code has been rewritten to use String.charAt to reduce the overhead.

Additionally unneeded object creation in the PatternMatcher has been removed
as well, to reduce further objects needed to be gc'ed.
2021-03-17 18:25:18 +01:00
Marten Deinum
e9bdcc6d66 Better sizes for StringBuilder
StringBuilder by default has a size of 16, however there
are some places that already create larger strings already.
For efficiency and garbage reduction it would be better to have
larger sizes to begin with.
2021-03-17 15:50:38 +01:00
Marten Deinum
b7d144c10d Added isXXXEnabled for logging statements
Guarded the logging statements which do concatenation of strings
or calling toString on objects. When a log level isn't enabled
this still would produce garbage that would need to be collected.

Guarded all logging up to info, warn and error can be assumed to be
enabled on a production system.
2021-03-17 14:50:57 +01:00
Niels Ferguson
63b6dea514 Fix incorrect usage of StringBuilder#append in TransactionAwareBufferedWriter
Issue #3745
2021-03-10 10:13:24 +01:00
Mahmoud Ben Hassine
a15496805b Add timeout when flushing items to Kafka in KafkaItemWriter
Issue #3773
2021-03-09 14:48:25 +01:00
Mahmoud Ben Hassine
572a302725 Refine contribution #3827
* Update year in licence headers
* Update Javadoc
* Add `this` keyword where appropriate
2021-03-09 14:07:15 +01:00
Jacob Botuck
c886a60b4d KafkaItemWriter.write should not return until items are confirmed to have been written
Issue #3773
2021-03-09 14:04:19 +01:00
Mahmoud Ben Hassine
7b2d7d1993 Refine af14a2e471
* Make default constructors call other constructors with default values
* Fix formatting
* Update year in license headers
2021-02-23 15:56:51 +01:00
Marten Deinum
af14a2e471 Provide constructors for injection
Currently when reading/writing JSON and using the reader/marshaller provided
and you want a custom Gson or ObjectMapper instance it still creates the not
needed instance. Move the construction to a constructor and provide a constructor
to directly pass in the pre-configured Gson or ObjectMapper instance.

The same approach is used in Spring itself where Gson or ObjectMapper instances
can be passed in.
2021-02-23 15:39:53 +01:00
Mahmoud Ben Hassine
fc113be4a7 Temporarily ignore intermittently failing tests
This commit temporarily ignores tests that are failing
intermittently on Windows. A link to the corresponding
issue has been added to each test.

FTR, I tried to ignore those tests only on Windows by
using `Assume.assumeFalse(SystemUtils.IS_OS_WINDOWS);`
where `SystemUtils` is from `org.apache.commons.lang3`
but this assumption does not seem to work as expected.
2021-02-18 18:09:40 +01:00
Mahmoud Ben Hassine
eaeb415521 Remove outdated IDE specific resources 2021-02-05 16:40:47 +01:00
Mahmoud Ben Hassine
329457e672 Remove irrelevant test
The test `testCompareNewWithOldAfterCopy` does
not work on linux/unix unless a `Thread.sleep`
is added before the file copying (see cbcf28c3).

This test does not work on windows neither,
because it is based on apache commons
`FileUtils.copyFile` which does not honor
`preserveFileDate=false` on windows.

The following test works on linux/unix
but not on windows:

```
@Test
public void testLastModifiedAfterCopy() throws IOException {
    File existing = new FileSystemResource(FILE_PATH).getFile();
    File temp = new File("target/temp.txt");
    assertFalse(temp.exists());
    FileUtils.copyFile(existing, temp, false);
    assertTrue(temp.lastModified() > existing.lastModified());
}
```

On windows, even though `preserveFileDate=false`,
the last modification date of the copy is equal
(ie preserved) to the one of the original file,
which is not the case on linux/unix. Trying to
use an alternative like `java.nio.file.Files#copy`
does not work since it only offers the ability
to either copy file attributes or replace the
existing file (which is not the idea of this test).

This test does not add any value and should have
been removed since a long time (see TODO in 12d6613).
2021-02-05 16:28:13 +01:00
Mahmoud Ben Hassine
2cc807de62 Fix tests failing on Windows
Before this commit, tests in this change set
were failing on MS Windows due to the file
comparison method which was based on file
content hash comparison. With this method,
differences between OS line endings
(LF vs CRLF) in generated json files produce
different hashes.

This commit uses a logical json comparison
based on the jsonassert library.
2021-02-04 16:01:22 +01:00
Mahmoud Ben Hassine
ee282ab97f Fix assumption in ScriptItemProcessorTests.testItemBinding
This test fails on Java 15 because the Javascript engine
has been removed in Java 15 (JEP 372).

This commit updates the test to assume that the JavaScript
engine is provided to the JVM through a factory (similar
to other tests).
2021-02-02 13:49:12 +01:00
Mahmoud Ben Hassine
fa26246d80 Fix Javadoc errors 2021-02-02 13:43:24 +01:00
Mahmoud Ben Hassine
d0493906a8 Replace usage of "build" directory with "target" 2021-01-29 11:45:34 +01:00
Mahmoud Ben Hassine
91cd55ecaa Update configuration to run unit/integration tests separately
This commit updates the configuration to run unit tests
with maven-surefire-plugin and integration tests with
maven-failsafe-plugin. JSR-352 TCK tests are considered
as integration tests and are executed with other integration
tests (no need for a separate profile to run them).

Some unit tests were failing when integration tests were
skipped.. Those tests have been temporarily ignored.
2021-01-29 11:45:32 +01:00
Mahmoud Ben Hassine
8cfec33ef0 Re-organize documentation resources
This commit also adds scaling diagrams [1]
to Figures.ppt. Those diagrams were not under
source control.

[1]: https://docs.spring.io/spring-batch/docs/current/reference/html/spring-batch-integration.html#externalizing-batch-process-execution
2021-01-29 11:45:31 +01:00
Mahmoud Ben Hassine
fa53dde01e Update build to use Maven instead of Gradle 2021-01-29 11:45:26 +01:00
Mahmoud Ben Hassine
bf612650ea Merge spring-batch-infrastructure-tests in spring-batch-infrastructure 2020-12-04 14:13:33 +01:00
Mahmoud Ben Hassine
12926b46c9 Remove ignored test
Based on the commit message of df1783a7, this
test has no added value.
2020-12-03 16:01:04 +01:00
Mahmoud Ben Hassine
c8e5e507f4 Polish contribution feb46fd3f7
* Update year in license header
* Use "this" keyword where appropriate
2020-11-27 23:19:24 +01:00
Aditya Sathe
feb46fd3f7 Make kafkaTemplate protected in KafkaItemWriter
Issue #3802
2020-11-27 23:14:05 +01:00
Antoine Kapps
cbdb251441 Fix incorrect behaviour of RepositoryItemReader#jumpToItem() on restart
* Corrects unit tests with expected behavior.
* Creates integration tests highlighting Hibernate lazy-loading failure if the reader has requested the page on open().

Issue #1074
2020-11-20 13:17:43 +01:00
lucap
7d45f2c567 Use isQuoteCharacter instead of direct char comparison in DelimitedLineTokenizer
Issue #682
2020-11-19 16:48:03 +01:00
Mahmoud Ben Hassine
5826111b85 Fix KafkaItemReaderTests
Tests in this class fail intermittently because
they send messages to Kafka in an asynchronous
way and assert on the results immediately without
waiting for the send operation to complete.

This commit updates the tests to wait for
send results before asserting on them
(similar to a140a9f5).
2020-11-18 16:50:10 +01:00
Parikshit Dutta
1ce4da5cce Fix for setting name of StaxEventItemReader at build 2020-09-25 10:17:47 +02:00
Parikshit Dutta
c2625b1f87 Add support to build StaxEventItemReader when no Resource is provided
Resolves #3736
2020-09-21 14:22:32 +02:00
Mahmoud Ben Hassine
4000d1d579 Polish contribution 2020-09-21 13:16:38 +02:00
Santiago Molano
c78e2b518b Add support to build JsonItemReader when no Resource is provided
Resolves #3731
2020-09-21 13:16:37 +02:00
Mahmoud Ben Hassine
41854008e8 Add JpaCursorItemReader implementation
Issue #901
2020-09-16 15:52:28 -05:00
Mahmoud Ben Hassine
264243b73c Deprecate org.springframework.batch.item.xml.StaxUtils
This commit deprecates org.springframework.batch.item.xml.StaxUtils
in favor of org.springframework.util.xml.StaxUtils.

Resolves #3779
2020-09-16 10:08:28 +02:00
Mahmoud Ben Hassine
9449551d9f Deprecate Alignment enum
Resolves #3778
2020-09-15 20:59:25 +02:00
Mahmoud Ben Hassine
08d7f56eea Deprecate AbstractNeo4jItemReader
Resolves #3777
2020-09-15 20:39:40 +02:00
Mahmoud Ben Hassine
f6a8d10595 Deprecate MultiResourceItemReader#getCurrentResource
Resolves #3776
2020-09-15 17:00:08 +02:00
Michael Minella
7e485a1b2b Polish 2020-09-14 10:01:13 -05:00
Mahmoud Ben Hassine
615a4aee2c Add initial support for Java 14 records mapping
Issue #3693
2020-09-10 10:23:07 +02:00
Mahmoud Ben Hassine
65d31bff1d Polish d65203e2d3
* Minor formatting update
* Use a regexp to discard xml header in tests
2020-09-09 21:09:50 +02:00
Parikshit Dutta
d65203e2d3 Add support for 'standalone' attribute in StaxEventItemWriter
Issue #758
2020-09-09 21:09:10 +02:00
Mahmoud Ben Hassine
ce22cddbbc Add partitionOffsets setter in KafkaItemReaderBuilder
Resolves #3761
2020-08-14 21:39:27 +02:00
Mahmoud Ben Hassine
15a393b8ef Add ability to start reading from a custom offset in KafkaItemReader
Issue #737
2020-08-10 12:18:49 +02:00
Mahmoud Ben Hassine
9dde586442 Open FlatFileItemReader#isComment for extension
Resolves #1134
2020-07-24 16:18:02 +02:00