Commit Graph

1118 Commits

Author SHA1 Message Date
Michael Minella
7d2a26a136 Add an ItemProcessor that delegates to a java.util.function.Function
This commit adds a new `ItemProcessor` that delegates to a
`java.util.function.Function`.  It also enables users to configure a
`Function` as an `ItemProcessor` via the builders (so they don't need to
worry about the `ItemProcessor` wrapper in the first place).

Resolves BATCH-2641
2017-09-15 16:44:54 -05:00
Michael Minella
b180c75ce0 Housecleaning of build warnings 2017-09-15 15:58:22 -05:00
Jimmy Praet
3968b77421 fix build on windows 2017-07-19 09:02:19 -05:00
Michael Minella
263e978a1f Updated for various code warnings
This commit addresses a number of deprications and other code warnings.
There are still many more to address, but this is a start.
2017-05-02 12:48:03 -05:00
Michael Minella
4ad00166f8 Changed default ExecutionContext serialization mechanism
The current default for serializing the ExecutionContext is via XStream
using Jettison's driver.  However, recent updates to Jettison make it
incompatible with XStream with no progress on a fix.  Because of this,
and to encourage the use of well supported library combinations, the
default ExecutionContext serialization mechanism for Spring Batch has
been switched to Jackson (via the
Jackson2ExecutionContextStringSerializer).  This commit also depricates
the XStreamExecutionContextStringSerializer for removal at a later date.
However, it is still available for users that require that during a
migration.

Resolves BATCH-2575
2017-03-22 15:25:14 -05:00
Michael Minella
a6c4dacbbe Refactored bootstrapping of JSR-352 base context
Spring Batch's implementation of JSR-352 previously relied on Spring's
ContextSingletonBeanFactoryLocator.  However, this has been removed in
Spring 5 as a relic of older EJB based use cases.  This commit now
lazily bootstraps the base context on it's own when the first
JsrJobOperator is requested.

Resolves BATCH-2572
2017-03-09 12:16:41 -06:00
Michael Minella
54a90beed7 Upgraded Mockito
This commit upgrades mockito to the latest currently available version
as well as does some additional cleanup.
2017-01-24 14:18:05 -06:00
Michael Minella
26b02fb836 Replaced snapshot versions and addressed deprications
This commit moves all SNAPSHOT dependencies to the latest available
released versions.  It also addresses a number of deprications in the
Spring Data realm.  Specifically around the deprication of the
Neo4JOperations and the package reorganization within Hibernate.
2016-12-30 14:04:58 -06:00
Michael Minella
80a153527f Updated test based on new error message returned by Spring Framework 5 2016-11-18 10:33:41 -06:00
Michael Minella
a75b067ebc Added builder for JdbcCursorItemReader
This provides a builder for the JdbcCursorItemReader to simplify java
configuration.

Resolves BATCH-2555
2016-11-18 09:18:26 -06:00
Michael Minella
eb2f752b16 Unwrap StepListenerFailedException when determining skip/rollback
When determining if an exception should be skipped or not, the business
exception should be used.  However, when an exception is thrown in the
listener, it's wrapped by a `StepListenerFailedException`.  This leads
to it hiding the underlying exception.  This commit will unwrap the
cause of a `StepListenerFailedException` and use that to determine if it
should be skipped or not.

Resolves BATCH-2322
2016-10-17 11:27:15 -05:00
Michael Minella
ca847e2760 Addressed stopped jobs from a job step
Prior to this commit, when using the `JobStep`, if the child job was
stopped (left in the `STOPPED` state), the step executing that job was
marked as `COMPLETE`, preventing it from being restarted.  This commit
now marks a step that was executing the stopped job also as stopped,
allowing for it to be restarted.

Resolves BATCH-2429
2016-10-14 12:07:48 -05:00
Michael Minella
23f599f1f5 Updated test to dynamically obtain java executable location 2016-10-03 12:56:33 -05:00
Michael Minella
f4c0530730 Upgraded dependency versions and minor polish 2016-08-09 13:19:14 -05:00
Michael Minella
ade242f2c4 Updated SimpleStepExecutionSplitter to return a Set with addressable elements 2016-04-19 16:31:23 -05:00
Marten Deinum
22109eea84 This commit adds a ExecutionContextSerializer based on Jackson2.
It has been tested with Jackson 2.3.3 which is the Jackson version
used with the Spring dependency.

Tests have been updated to use Hamcrest matchers and made a bit more reusable.
2016-04-19 12:54:59 -05:00
Philippe Marschall
dcc9da8273 BATCH-2407 Use StringBuilder instead of StringBuffer
With Java 1.5 StringBuilder is preferred over StringBuffer for single
threaded access as is has less overhead.

This is evidenced by the class comment of StringBuffer and Effective
Java 2nd Edition Item 67: Avoid excessive synchronization.

> The StringBuilder class should generally be used in preference to
> this one, as it supports all of the same operations but it is faster,
> as it performs no synchronization.

 - replace StringBuffer with StringBuilder where possible

Issue: BATCH-2407
2015-08-06 10:22:39 -05:00
Philippe Marschall
7ec7152c5e BATCH-2410 junit.framework.Assert is deprecated 2015-07-31 12:44:25 -05:00
Alex Jablonski
cbc83015d5 Add regression unit test covering behavior reported in BATCH_2346
Observed that deleting the code fixing issue BATCH_2346 didn't cause
any tests to fail
2015-07-14 14:21:41 -05:00
jpraet
61638d52bd BATCH-2311 JobLauncher allows restart of job_execution with status
UNKNOWN

* additionally prevent restart of step executions with status STARTING,
STARTED or STOPPING
* additionally prevent restart of job executions with status UNKNOWN or
STOPPING
2015-06-09 10:06:15 -05:00
Michael Minella
c8f8be3b8e Added additional tests around *Aware callbacks in GenericApplicatioNContextFactory BATCH-2358 2015-05-15 11:39:47 -05:00
sparsick
fa01295ce6 BATCH-2359: fix for the problem that job arguments defined after an empty line are ignored 2015-04-15 09:49:59 -04:00
Michael Minella
8b32462072 Clear context to job name mapping when clearing contexts BATCH-2347 2015-03-06 11:54:44 -06:00
Michael Minella
4839102ed5 Refactored AbstractJsrTestCase to expose JobOperator instance 2015-02-19 13:06:51 -06:00
Gerald Quintana
ffc896ebbc BATCH-2282: SplitBuilder shouldn't add empty state in flow 2015-02-05 16:56:29 -06:00
Michael Minella
bd644108f7 JsrJobOperator now implements ApplicationContextAware 2015-01-02 14:22:57 -06:00
thebignet
c662914896 Added unit test to verify JobScope works when using both @EnableBatchProcessing and XML namespace 2015-01-02 12:39:31 -06:00
Michael Minella
fecbe075d4 Added ability for SystemCommandTasklet to be stopped
Prior to this commit, the SystemCommandTasklet is able to be stopped
only by an external process calling directly into it or updating the
instance of the StepExecution it holds onto.  This update allows the
tasklet to poll the job repository for stop requests in a similar way
chunk based processing does.

BATCH-2331
2014-12-31 12:10:47 -06:00
Michael Minella
92e551e05d Add ability to override JSR-352 baseContext.xml
While existing functionality provided the ability to override the
components provided in the baseContext.xml (as required for JSR-352
functionality) at a job by job level, this commit allows a user to
specify a base context for all of the JSR-352 based jobs within a JVM.
To set the location of the custom base context, a JVM property
JSR-352-BASE-CONTEXT should be set.

BATCH-2290
2014-12-30 16:16:02 -06:00
Michael Minella
c10469367f Fixed manual wiring of JsrJobOperator
While the JSR-352 provides only one way to access the JobOperator
(BatchRuntime.getJobOperator()), it is useful for testing and embedding
to be able to wire your own JsrJobOperator instance.  This commit
addresses previous issues with using the constructor that provided that
functionality.

Note: This is a breaking change in that there is a new parameter on the
non-default constructor (adding a PlatformTransactionManager reference).
Users using the JsrJobOperator through the BatchRuntime as previously
mentioned should not be impacted.  Since this is the *only* method
perscribed by the JSR to consume that class, it is not expected to have
a large impact.

This fix partially addresses BATCH-2290.
2014-12-22 16:57:16 -06:00
Michael Minella
7683700662 Filter out duplicate ApplicationContextAwareProcessors in parent/child
contexts scenarios

AbstractApplicationContextFactory, when configuring a child context,
copies all of the BeanPostProcessors from the parent to the child.
Normally this is a good thing.  However, in the case of teh
ApplicationContextAwareProcessor, the child context ends up with two
instances, one for the parent context and one for the child context.
This brings two issues to light:
  1. Unknown which context is being injected - On beans implementing
ApplicationContextAware, it can't be determined which context (the
parent or the child) will be injected since both BPPs will be called in
an indeterimant order.
 2. Errors occur with ApplicationObjectSupport - If the child context
contains a bean that extends ApplicationObjectSupport, when the second
ApplicationContextAwareProcessor is called, the bean will throw an
exception since it is only allowed to be initialized with one
application context.

This fix adds additional logic to remove the
ApplicationContextAwareProcessor from the parent context before adding
all the BPPs to the child.

This fix addresses BATCH-2319.
2014-11-05 16:34:51 -06:00
Chris Schaefer
8b26504db1 BATCH-2242: Stopping a job in STARTING state throws OptimisticLockingFailureException 2014-10-17 11:40:38 -05:00
Michael Minella
8b22a6e98d Ignoring tests that I had unignored 2014-09-24 09:34:10 -05:00
Michael Minella
5b056e8126 Handle scenario where scanned item is filtered out
BATCH-2302 documents a scenario where an item throws an exception in a
fault tollerant step in the write, then in the process, throws an
exception as well.  This leads to an infinite loop.  To address this,
prior to attempting to write items during scanning we need to validate
that the there are items to be written (we were not which was causing a
NoSuchElementException when we did inputs.next().

This commit also removes an eronous System.out left in the
CoreNamespaceUtils.
2014-09-23 14:12:48 -05:00
Michael Minella
a2f2df0b17 Conditionally add custom scopes when using XML configuration
When using a combination of Java configuration and the XML namespace
configuration, prior to this commit, we would add the batch custom
scopes twice which lead to issues.  This commit gives priority to the
custom scopes provided by the java configuration.  If you've used
@EnableBatchProcessing and have configured batch components using the
batch namespace, the custom scopes that come with the java config will
take precidence.

This commit addresses Jira BATCH-2266
2014-09-22 13:48:28 -05:00
Michael Minella
04b339b8f4 Add BeanCreationException to list of standard failure exceptions
Without this change, when passing an invalid job parameter to a bean
that is created internally by Spring Batch will cause a
BeanCreationException that is essentially ignored.  Due to it being
ignored, an infinite loop occurs in processing.
2014-09-16 11:01:30 -05:00
Chris Schaefer
47eba434d8 BATCH-1863: The batch namespace can not be used with allowBeanDefinitionOverriding=false 2014-09-15 15:05:26 -05:00
Chris Schaefer
587680ba56 XD-1027: Create script-based batch ItemProcessor 2014-07-18 11:55:17 -05:00
Michael Minella
8f8600c14d BATCH-2253: Added automatic registraiton of Job Scope to java config and
added support for a @JobScope annotation.
2014-07-18 11:55:17 -05:00
Michael Minella
752fe55e88 BATCH-2257: Added process skip count and filter count to the aggregate 2014-07-18 11:55:17 -05:00
Chris Schaefer
0f5a7af1a3 Final attempt at fixing test failure on build machine. Works as expected in a cloned plan 2014-07-18 11:55:17 -05:00
Chris Schaefer
1f8cc9a557 Re-ignore.. apparently not the appropriate fix.. 2014-07-18 11:55:17 -05:00
Chris Schaefer
3b36c132d5 Remove @Ignore from test, fix build system issue 2014-07-18 11:55:17 -05:00
Chris Schaefer
cfe2bfb60d Temporarily ignore test until build issue is fixed 2014-07-18 11:55:17 -05:00
Michael Minella
751e7162a5 BATCH-2250: Added @FixMethodOrder(MethodSorters.JVM) to override new default method sorting by JUnit 4.11 2014-07-18 11:55:17 -05:00
Chris Schaefer
1ff1e6c7d0 BATCH-2242: Stopping a job in STARTING state throws OptimisticLockingFailureException 2014-07-18 11:55:17 -05:00
Michael Minella
6b6118263b BATCH-2247: Added creation of a JobExplorer by default to address the inability to create a Map based JobExplorer using java config 2014-07-18 11:55:16 -05:00
Michael Minella
e3e16f864b XD-1390: Updated SimpleJobRepository to return StepExecutions from previous run so UNKNOWN check will apply 2014-05-27 11:06:18 -05:00
Michael Minella
88f73791fb XD-1622: Add tasklet and step type to Step's ExecutionContext for XD usage 2014-05-23 15:47:23 -05:00
Michael Minella
936d966712 Added tests to address more situations as well as cleaned up logic a bit 2014-05-22 11:31:41 -05:00