diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/ItemProcessListener.java b/spring-batch-core/src/main/java/org/springframework/batch/core/ItemProcessListener.java
index 8000ef17e..4f44d8166 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/ItemProcessListener.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/ItemProcessListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2018 the original author or authors.
+ * Copyright 2006-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,7 +35,8 @@ public interface ItemProcessListener extends StepListener {
*
* @param item to be processed.
*/
- void beforeProcess(T item);
+ default void beforeProcess(T item) {
+ }
/**
* Called after {@link ItemProcessor#process(Object)} returns. If the
@@ -45,7 +46,8 @@ public interface ItemProcessListener extends StepListener {
* @param item to be processed
* @param result of processing
*/
- void afterProcess(T item, @Nullable S result);
+ default void afterProcess(T item, @Nullable S result) {
+ }
/**
* Called if an exception was thrown from {@link ItemProcessor#process(Object)}.
@@ -53,5 +55,6 @@ public interface ItemProcessListener extends StepListener {
* @param item attempted to be processed
* @param e - exception thrown during processing.
*/
- void onProcessError(T item, Exception e);
+ default void onProcessError(T item, Exception e) {
+ }
}
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/ItemReadListener.java b/spring-batch-core/src/main/java/org/springframework/batch/core/ItemReadListener.java
index 9a71bbed9..d4f31fc25 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/ItemReadListener.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/ItemReadListener.java
@@ -30,7 +30,8 @@ public interface ItemReadListener extends StepListener {
/**
* Called before {@link ItemReader#read()}
*/
- void beforeRead();
+ default void beforeRead() {
+ }
/**
* Called after {@link ItemReader#read()}.
@@ -39,12 +40,14 @@ public interface ItemReadListener extends StepListener {
*
* @param item returned from read()
*/
- void afterRead(T item);
+ default void afterRead(T item) {
+ }
/**
* Called if an error occurs while trying to read.
*
* @param ex thrown from {@link ItemReader}
*/
- void onReadError(Exception ex);
+ default void onReadError(Exception ex) {
+ }
}
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/ItemWriteListener.java b/spring-batch-core/src/main/java/org/springframework/batch/core/ItemWriteListener.java
index 7fda29adc..b69faa9f5 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/ItemWriteListener.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/ItemWriteListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2013 the original author or authors.
+ * Copyright 2006-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,6 +38,7 @@ import org.springframework.batch.item.ItemWriter;
*
*
* @author Lucas Ward
+ * @author Mahmoud Ben Hassine
*
*/
public interface ItemWriteListener extends StepListener {
@@ -47,7 +48,8 @@ public interface ItemWriteListener extends StepListener {
*
* @param items to be written
*/
- void beforeWrite(List extends S> items);
+ default void beforeWrite(List extends S> items) {
+ }
/**
* Called after {@link ItemWriter#write(java.util.List)} This will be
@@ -56,7 +58,8 @@ public interface ItemWriteListener extends StepListener {
*
* @param items written items
*/
- void afterWrite(List extends S> items);
+ default void afterWrite(List extends S> items) {
+ }
/**
* Called if an error occurs while trying to write. Will be called inside a
@@ -67,5 +70,6 @@ public interface ItemWriteListener extends StepListener {
* @param exception thrown from {@link ItemWriter}
* @param items attempted to be written.
*/
- void onWriteError(Exception exception, List extends S> items);
+ default void onWriteError(Exception exception, List extends S> items) {
+ }
}
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/SkipListener.java b/spring-batch-core/src/main/java/org/springframework/batch/core/SkipListener.java
index a3e7afd08..e76315df0 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/SkipListener.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/SkipListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2007 the original author or authors.
+ * Copyright 2006-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@ package org.springframework.batch.core;
*
* @author Dave Syer
* @author Robert Kasanicky
+ * @author Mahmoud Ben Hassine
*
*/
public interface SkipListener extends StepListener {
@@ -37,7 +38,8 @@ public interface SkipListener extends StepListener {
*
* @param t cause of the failure
*/
- void onSkipInRead(Throwable t);
+ default void onSkipInRead(Throwable t) {
+ }
/**
* This item failed on write with the given exception, and a skip was called
@@ -46,7 +48,8 @@ public interface SkipListener extends StepListener {
* @param item the failed item
* @param t the cause of the failure
*/
- void onSkipInWrite(S item, Throwable t);
+ default void onSkipInWrite(S item, Throwable t) {
+ }
/**
* This item failed on processing with the given exception, and a skip was called
@@ -55,6 +58,7 @@ public interface SkipListener extends StepListener {
* @param item the failed item
* @param t the cause of the failure
*/
- void onSkipInProcess(T item, Throwable t);
+ default void onSkipInProcess(T item, Throwable t) {
+ }
}
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/ExecutionContextPromotionListener.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/ExecutionContextPromotionListener.java
index da6af4529..d0950adab 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/ExecutionContextPromotionListener.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/ExecutionContextPromotionListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2019 the original author or authors.
+ * Copyright 2006-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.StepExecution;
+import org.springframework.batch.core.StepExecutionListener;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.support.PatternMatcher;
import org.springframework.beans.factory.InitializingBean;
@@ -37,9 +38,10 @@ import org.springframework.util.Assert;
* promotion will only occur for steps with an exit code of "COMPLETED".
*
* @author Dan Garrette
+ * @author Mahmoud Ben Hassine
* @since 2.0
*/
-public class ExecutionContextPromotionListener extends StepExecutionListenerSupport implements InitializingBean {
+public class ExecutionContextPromotionListener implements StepExecutionListener, InitializingBean {
private String[] keys = null;
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/ItemListenerSupport.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/ItemListenerSupport.java
index 556e224be..420973ce6 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/ItemListenerSupport.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/ItemListenerSupport.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2018 the original author or authors.
+ * Copyright 2006-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,87 +34,4 @@ import org.springframework.lang.Nullable;
*/
public class ItemListenerSupport implements ItemReadListener, ItemProcessListener, ItemWriteListener {
- /*
- * (non-Javadoc)
- *
- * @see org.springframework.batch.core.domain.ItemReadListener#afterRead(java.lang.Object)
- */
- @Override
- public void afterRead(I item) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.springframework.batch.core.domain.ItemReadListener#beforeRead()
- */
- @Override
- public void beforeRead() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.springframework.batch.core.domain.ItemReadListener#onReadError(java.lang.Exception)
- */
- @Override
- public void onReadError(Exception ex) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.springframework.batch.core.ItemProcessListener#afterProcess(java.lang.Object,
- * java.lang.Object)
- */
- @Override
- public void afterProcess(I item, @Nullable O result) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.springframework.batch.core.ItemProcessListener#beforeProcess(java.lang.Object)
- */
- @Override
- public void beforeProcess(I item) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.springframework.batch.core.ItemProcessListener#onProcessError(java.lang.Object,
- * java.lang.Exception)
- */
- @Override
- public void onProcessError(I item, Exception e) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.springframework.batch.core.domain.ItemWriteListener#afterWrite()
- */
- @Override
- public void afterWrite(List extends O> item) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.springframework.batch.core.domain.ItemWriteListener#beforeWrite(java.lang.Object)
- */
- @Override
- public void beforeWrite(List extends O> item) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.springframework.batch.core.domain.ItemWriteListener#onWriteError(java.lang.Exception,
- * java.lang.Object)
- */
- @Override
- public void onWriteError(Exception ex, List extends O> item) {
- }
}
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/JobParameterExecutionContextCopyListener.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/JobParameterExecutionContextCopyListener.java
index 80d0112b4..640d15ee3 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/JobParameterExecutionContextCopyListener.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/JobParameterExecutionContextCopyListener.java
@@ -21,6 +21,7 @@ import java.util.Collection;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.StepExecution;
+import org.springframework.batch.core.StepExecutionListener;
import org.springframework.batch.item.ExecutionContext;
/**
@@ -30,9 +31,10 @@ import org.springframework.batch.item.ExecutionContext;
* {@link ExecutionContext} that should be copied.
*
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
* @since 2.0
*/
-public class JobParameterExecutionContextCopyListener extends StepExecutionListenerSupport {
+public class JobParameterExecutionContextCopyListener implements StepExecutionListener {
private Collection keys = null;
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/SkipListenerSupport.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/SkipListenerSupport.java
index 69d54856d..437206747 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/SkipListenerSupport.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/SkipListenerSupport.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2013 the original author or authors.
+ * Copyright 2006-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,8 +21,12 @@ import org.springframework.batch.core.SkipListener;
* Basic no-op implementations of all {@link SkipListener} implementations.
*
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
+ *
+ * @deprecated as of v5.0 in favor of the default methods in {@link SkipListener}.
*
*/
+@Deprecated
public class SkipListenerSupport implements SkipListener {
/* (non-Javadoc)
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerSupport.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerSupport.java
index 9482c9b7f..6fc03fb03 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerSupport.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerSupport.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2019 the original author or authors.
+ * Copyright 2006-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,125 +36,7 @@ import org.springframework.lang.Nullable;
* @author Robert Kasanicky
* @author Mahmoud Ben Hassine
*/
-public class StepListenerSupport implements StepExecutionListener, ChunkListener,
-ItemReadListener, ItemProcessListener, ItemWriteListener, SkipListener {
-
- /* (non-Javadoc)
- * @see org.springframework.batch.core.StepExecutionListener#afterStep(org.springframework.batch.core.StepExecution)
- */
- @Nullable
- @Override
- public ExitStatus afterStep(StepExecution stepExecution) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.springframework.batch.core.StepExecutionListener#beforeStep(org.springframework.batch.core.StepExecution)
- */
- @Override
- public void beforeStep(StepExecution stepExecution) {
- }
-
- /* (non-Javadoc)
- * @see org.springframework.batch.core.domain.ChunkListener#afterChunk(ChunkContext context)
- */
- @Override
- public void afterChunk(ChunkContext context) {
- }
-
- /* (non-Javadoc)
- * @see org.springframework.batch.core.domain.ChunkListener#beforeChunk(ChunkContext context)
- */
- @Override
- public void beforeChunk(ChunkContext context) {
- }
-
- /* (non-Javadoc)
- * @see org.springframework.batch.core.domain.ItemReadListener#afterRead(java.lang.Object)
- */
- @Override
- public void afterRead(T item) {
- }
-
- /* (non-Javadoc)
- * @see org.springframework.batch.core.domain.ItemReadListener#beforeRead()
- */
- @Override
- public void beforeRead() {
- }
-
- /* (non-Javadoc)
- * @see org.springframework.batch.core.domain.ItemReadListener#onReadError(java.lang.Exception)
- */
- @Override
- public void onReadError(Exception ex) {
- }
-
- /* (non-Javadoc)
- * @see org.springframework.batch.core.ItemWriteListener#afterWrite(java.util.List)
- */
- @Override
- public void afterWrite(List extends S> items) {
- }
-
- /* (non-Javadoc)
- * @see org.springframework.batch.core.ItemWriteListener#beforeWrite(java.util.List)
- */
- @Override
- public void beforeWrite(List extends S> items) {
- }
-
- /* (non-Javadoc)
- * @see org.springframework.batch.core.ItemWriteListener#onWriteError(java.lang.Exception, java.util.List)
- */
- @Override
- public void onWriteError(Exception exception, List extends S> items) {
- }
-
- /* (non-Javadoc)
- * @see org.springframework.batch.core.ItemProcessListener#afterProcess(java.lang.Object, java.lang.Object)
- */
- @Override
- public void afterProcess(T item, @Nullable S result) {
- }
-
- /* (non-Javadoc)
- * @see org.springframework.batch.core.ItemProcessListener#beforeProcess(java.lang.Object)
- */
- @Override
- public void beforeProcess(T item) {
- }
-
- /* (non-Javadoc)
- * @see org.springframework.batch.core.ItemProcessListener#onProcessError(java.lang.Object, java.lang.Exception)
- */
- @Override
- public void onProcessError(T item, Exception e) {
- }
-
- /* (non-Javadoc)
- * @see org.springframework.batch.core.SkipListener#onSkipInProcess(java.lang.Object, java.lang.Throwable)
- */
- @Override
- public void onSkipInProcess(T item, Throwable t) {
- }
-
- /* (non-Javadoc)
- * @see org.springframework.batch.core.SkipListener#onSkipInRead(java.lang.Throwable)
- */
- @Override
- public void onSkipInRead(Throwable t) {
- }
-
- /* (non-Javadoc)
- * @see org.springframework.batch.core.SkipListener#onSkipInWrite(java.lang.Object, java.lang.Throwable)
- */
- @Override
- public void onSkipInWrite(S item, Throwable t) {
- }
-
- @Override
- public void afterChunkError(ChunkContext context) {
- }
+public class StepListenerSupport extends ItemListenerSupport
+ implements StepExecutionListener, ChunkListener, SkipListener {
}
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/resource/StepExecutionSimpleCompletionPolicy.java b/spring-batch-core/src/main/java/org/springframework/batch/core/resource/StepExecutionSimpleCompletionPolicy.java
index ccbdb833d..cd82bb1cd 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/resource/StepExecutionSimpleCompletionPolicy.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/resource/StepExecutionSimpleCompletionPolicy.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2013 the original author or authors.
+ * Copyright 2006-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@ package org.springframework.batch.core.resource;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.StepExecutionListener;
-import org.springframework.batch.core.listener.StepExecutionListenerSupport;
import org.springframework.batch.repeat.CompletionPolicy;
import org.springframework.batch.repeat.RepeatContext;
import org.springframework.batch.repeat.RepeatStatus;
@@ -44,10 +43,11 @@ import org.springframework.util.Assert;
*
*
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
*
* @see CompletionPolicy
*/
-public class StepExecutionSimpleCompletionPolicy extends StepExecutionListenerSupport implements CompletionPolicy {
+public class StepExecutionSimpleCompletionPolicy implements StepExecutionListener, CompletionPolicy {
private CompletionPolicy delegate;
@@ -69,7 +69,7 @@ public class StepExecutionSimpleCompletionPolicy extends StepExecutionListenerSu
* key name, the intValue of this parameter is used. If not an exception
* will be thrown.
*
- * @see org.springframework.batch.core.listener.StepExecutionListenerSupport#beforeStep(org.springframework.batch.core.StepExecution)
+ * @see org.springframework.batch.core.listener.StepExecutionListener#beforeStep(org.springframework.batch.core.StepExecution)
*/
@Override
public void beforeStep(StepExecution stepExecution) {
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/NoWorkFoundStepExecutionListener.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/NoWorkFoundStepExecutionListener.java
index ad1e94184..e30e9bd42 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/NoWorkFoundStepExecutionListener.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/NoWorkFoundStepExecutionListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2019 the original author or authors.
+ * Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,15 +18,16 @@ package org.springframework.batch.core.step;
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.StepExecution;
-import org.springframework.batch.core.listener.StepExecutionListenerSupport;
+import org.springframework.batch.core.StepExecutionListener;
import org.springframework.lang.Nullable;
/**
* Fails the step if no items have been processed ( item count is 0).
*
* @author Robert Kasanicky
+ * @author Mahmoud Ben Hassine
*/
-public class NoWorkFoundStepExecutionListener extends StepExecutionListenerSupport {
+public class NoWorkFoundStepExecutionListener implements StepExecutionListener {
@Nullable
@Override
diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/SystemCommandTasklet.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/SystemCommandTasklet.java
index a1be7bcf6..86dd1127a 100644
--- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/SystemCommandTasklet.java
+++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/tasklet/SystemCommandTasklet.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2019 the original author or authors.
+ * Copyright 2006-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,8 +28,8 @@ import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobInterruptedException;
import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.StepExecution;
+import org.springframework.batch.core.StepExecutionListener;
import org.springframework.batch.core.explore.JobExplorer;
-import org.springframework.batch.core.listener.StepExecutionListenerSupport;
import org.springframework.batch.core.scope.context.ChunkContext;
import org.springframework.batch.repeat.RepeatStatus;
import org.springframework.beans.factory.InitializingBean;
@@ -59,8 +59,9 @@ import org.springframework.util.Assert;
*
* @author Robert Kasanicky
* @author Will Schipp
+ * @author Mahmoud Ben Hassine
*/
-public class SystemCommandTasklet extends StepExecutionListenerSupport implements StoppableTasklet, InitializingBean {
+public class SystemCommandTasklet implements StepExecutionListener, StoppableTasklet, InitializingBean {
protected static final Log logger = LogFactory.getLog(SystemCommandTasklet.class);
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DefaultUnknownJobParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DefaultUnknownJobParserTests.java
index 04f6b8a40..505bb5a62 100644
--- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DefaultUnknownJobParserTests.java
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DefaultUnknownJobParserTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2019 the original author or authors.
+ * Copyright 2006-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,13 +23,14 @@ import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.StepExecution;
-import org.springframework.batch.core.listener.StepExecutionListenerSupport;
+import org.springframework.batch.core.StepExecutionListener;
import org.springframework.lang.Nullable;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* @author Dan Garrette
+ * @author Mahmoud Ben Hassine
* @since 2.0
*/
@ContextConfiguration
@@ -57,7 +58,7 @@ public class DefaultUnknownJobParserTests extends AbstractJobParserTests {
}
- public static class UnknownListener extends StepExecutionListenerSupport {
+ public static class UnknownListener implements StepExecutionListener {
@Nullable
@Override
public ExitStatus afterStep(StepExecution stepExecution) {
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyChunkListener.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyChunkListener.java
new file mode 100644
index 000000000..90000e5d3
--- /dev/null
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyChunkListener.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2021 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.batch.core.configuration.xml;
+
+import org.springframework.batch.core.ChunkListener;
+
+/**
+ * @author Mahmoud Ben Hassine
+ */
+public class DummyChunkListener implements ChunkListener {
+}
\ No newline at end of file
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyJobExecutionListener.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyJobExecutionListener.java
new file mode 100644
index 000000000..95cc024ef
--- /dev/null
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyJobExecutionListener.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2021 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.batch.core.configuration.xml;
+
+import org.springframework.batch.core.JobExecutionListener;
+
+/**
+ * @author Mahmoud Ben Hassine
+ */
+public class DummyJobExecutionListener implements JobExecutionListener {
+}
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyStepExecutionListener.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyStepExecutionListener.java
new file mode 100644
index 000000000..e543f78c5
--- /dev/null
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DummyStepExecutionListener.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2021 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.batch.core.configuration.xml;
+
+import org.springframework.batch.core.StepExecutionListener;
+
+/**
+ * @author Mahmoud Ben Hassine
+ */
+public class DummyStepExecutionListener implements StepExecutionListener {
+}
\ No newline at end of file
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/JobParserParentAttributeTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/JobParserParentAttributeTests.java
index 938c05eb8..9b60b028b 100644
--- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/JobParserParentAttributeTests.java
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/JobParserParentAttributeTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2009 the original author or authors.
+ * Copyright 2006-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,6 +39,7 @@ import org.springframework.test.util.ReflectionTestUtils;
/**
* @author Dan Garrette
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
* @since 2.0
*/
@ContextConfiguration
@@ -80,7 +81,7 @@ public class JobParserParentAttributeTests {
if (l instanceof DummyAnnotationJobExecutionListener) {
a = true;
}
- else if (l instanceof JobExecutionListenerSupport) {
+ else if (l instanceof DummyJobExecutionListener) {
b = true;
}
}
@@ -94,7 +95,7 @@ public class JobParserParentAttributeTests {
assertEquals(1, job2Listeners.size());
boolean c = false;
for (Object l : job2Listeners) {
- if (l instanceof JobExecutionListenerSupport) {
+ if (l instanceof DummyJobExecutionListener) {
c = true;
}
}
@@ -111,7 +112,7 @@ public class JobParserParentAttributeTests {
if (l instanceof DummyAnnotationJobExecutionListener) {
a = true;
}
- else if (l instanceof JobExecutionListenerSupport) {
+ else if (l instanceof DummyJobExecutionListener) {
b = true;
}
}
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/NameStoringTasklet.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/NameStoringTasklet.java
index bdb00fb61..a36de68ef 100644
--- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/NameStoringTasklet.java
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/NameStoringTasklet.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2019 the original author or authors.
+ * Copyright 2006-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@ import java.util.List;
import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.StepExecution;
-import org.springframework.batch.core.listener.StepExecutionListenerSupport;
+import org.springframework.batch.core.StepExecutionListener;
import org.springframework.batch.core.scope.context.ChunkContext;
import org.springframework.batch.core.step.tasklet.Tasklet;
import org.springframework.batch.repeat.RepeatStatus;
@@ -29,9 +29,10 @@ import org.springframework.lang.Nullable;
* This class will store the step name when it is executed.
*
* @author Dan Garrette
+ * @author Mahmoud Ben Hassine
* @since 2.0
*/
-public class NameStoringTasklet extends StepExecutionListenerSupport implements Tasklet {
+public class NameStoringTasklet implements StepExecutionListener, Tasklet {
private String stepName = null;
private List stepNamesList = null;
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/NextAttributeUnknownJobParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/NextAttributeUnknownJobParserTests.java
index 52cce6596..ebe596fd4 100644
--- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/NextAttributeUnknownJobParserTests.java
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/NextAttributeUnknownJobParserTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2019 the original author or authors.
+ * Copyright 2006-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,13 +23,14 @@ import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.StepExecution;
-import org.springframework.batch.core.listener.StepExecutionListenerSupport;
+import org.springframework.batch.core.StepExecutionListener;
import org.springframework.lang.Nullable;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
* @since 2.1.9
*/
@ContextConfiguration
@@ -57,7 +58,7 @@ public class NextAttributeUnknownJobParserTests extends AbstractJobParserTests {
}
- public static class UnknownListener extends StepExecutionListenerSupport {
+ public static class UnknownListener implements StepExecutionListener {
@Nullable
@Override
public ExitStatus afterStep(StepExecution stepExecution) {
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepListenerInStepParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepListenerInStepParserTests.java
index c25948d85..2dc5412f5 100644
--- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepListenerInStepParserTests.java
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepListenerInStepParserTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,10 +25,9 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.aop.framework.Advised;
import org.springframework.batch.core.Step;
+import org.springframework.batch.core.StepExecutionListener;
import org.springframework.batch.core.StepListener;
-import org.springframework.batch.core.listener.ChunkListenerSupport;
import org.springframework.batch.core.listener.ItemListenerSupport;
-import org.springframework.batch.core.listener.StepExecutionListenerSupport;
import org.springframework.batch.core.step.tasklet.TaskletStep;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -38,6 +37,7 @@ import org.springframework.test.util.ReflectionTestUtils;
/**
* @author Dan Garrette
+ * @author Mahmoud Ben Hassine
* @since 2.0
*/
@ContextConfiguration
@@ -52,7 +52,7 @@ public class StepListenerInStepParserTests {
Step step = (Step) beanFactory.getBean("s1");
List> list = getListeners(step);
assertEquals(1, list.size());
- assertTrue(list.get(0) instanceof StepExecutionListenerSupport);
+ assertTrue(list.get(0) instanceof DummyStepExecutionListener );
}
@Test
@@ -61,7 +61,7 @@ public class StepListenerInStepParserTests {
Step step = (Step) beanFactory.getBean("s2");
List> list = getListeners(step);
assertEquals(1, list.size());
- assertTrue(list.get(0) instanceof ChunkListenerSupport);
+ assertTrue(list.get(0) instanceof DummyChunkListener);
}
@Test
@@ -69,8 +69,8 @@ public class StepListenerInStepParserTests {
Step step = (Step) beanFactory.getBean("s3");
List> list = getListeners(step);
assertEquals(2, list.size());
- assertTrue(list.get(0) instanceof StepExecutionListenerSupport);
- assertTrue(list.get(1) instanceof ChunkListenerSupport);
+ assertTrue(list.get(0) instanceof DummyStepExecutionListener);
+ assertTrue(list.get(1) instanceof DummyChunkListener);
}
@Test
@@ -78,7 +78,7 @@ public class StepListenerInStepParserTests {
Step step = (Step) beanFactory.getBean("s4");
List> list = getListeners(step);
assertEquals(2, list.size());
- assertTrue(list.get(0) instanceof StepExecutionListenerSupport);
+ assertTrue(list.get(0) instanceof DummyStepExecutionListener);
assertTrue(list.get(1) instanceof ItemListenerSupport);
}
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepListenerParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepListenerParserTests.java
index 7fa7fcbb0..06331860b 100644
--- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepListenerParserTests.java
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepListenerParserTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,7 +28,6 @@ import org.springframework.batch.core.Step;
import org.springframework.batch.core.StepListener;
import org.springframework.batch.core.listener.CompositeStepExecutionListener;
import org.springframework.batch.core.listener.ItemListenerSupport;
-import org.springframework.batch.core.listener.StepExecutionListenerSupport;
import org.springframework.batch.core.step.tasklet.TaskletStep;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
@@ -38,6 +37,7 @@ import org.springframework.test.util.ReflectionTestUtils;
/**
* @author Dan Garrette
+ * @author Mahmoud Ben Hassine
* @since 2.0
*/
@ContextConfiguration
@@ -69,7 +69,7 @@ public class StepListenerParserTests {
if (listener instanceof DummyAnnotationStepExecutionListener) {
a = true;
}
- else if (listener instanceof StepExecutionListenerSupport) {
+ else if (listener instanceof DummyStepExecutionListener) {
b = true;
}
else if (listener instanceof CompositeStepExecutionListener) {
@@ -93,7 +93,7 @@ public class StepListenerParserTests {
if (listener instanceof DummyAnnotationStepExecutionListener) {
a = true;
}
- else if (listener instanceof StepExecutionListenerSupport) {
+ else if (listener instanceof DummyStepExecutionListener) {
b = true;
}
}
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserStepFactoryBeanTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserStepFactoryBeanTests.java
index 76e0d9641..76c7aff4e 100644
--- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserStepFactoryBeanTests.java
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserStepFactoryBeanTests.java
@@ -23,10 +23,10 @@ import org.junit.Test;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.framework.ProxyFactory;
+import org.springframework.batch.core.StepExecutionListener;
import org.springframework.batch.core.StepListener;
import org.springframework.batch.core.job.flow.FlowStep;
import org.springframework.batch.core.job.flow.support.SimpleFlow;
-import org.springframework.batch.core.listener.StepExecutionListenerSupport;
import org.springframework.batch.core.partition.PartitionHandler;
import org.springframework.batch.core.partition.support.PartitionStep;
import org.springframework.batch.core.partition.support.SimplePartitioner;
@@ -54,6 +54,7 @@ import static org.junit.Assert.assertTrue;
/**
* @author Dan Garrette
+ * @author Mahmoud Ben Hassine
* @since 2.0
*/
public class StepParserStepFactoryBeanTests {
@@ -108,7 +109,7 @@ public class StepParserStepFactoryBeanTests {
fb.setStartLimit(5);
fb.setTasklet(new DummyTasklet());
fb.setTransactionManager(new ResourcelessTransactionManager());
- fb.setListeners(new StepExecutionListenerSupport[] { new StepExecutionListenerSupport() });
+ fb.setListeners(new StepExecutionListener[] { new StepExecutionListener() {} });
fb.setIsolation(Isolation.DEFAULT);
fb.setTransactionTimeout(-1);
fb.setPropagation(Propagation.REQUIRED);
@@ -140,7 +141,7 @@ public class StepParserStepFactoryBeanTests {
fb.setJobRepository(new JobRepositorySupport());
fb.setStartLimit(5);
fb.setTransactionManager(new ResourcelessTransactionManager());
- fb.setListeners(new StepListener[] { new StepExecutionListenerSupport() });
+ fb.setListeners(new StepListener[] { new StepExecutionListener() {} });
fb.setIsolation(Isolation.DEFAULT);
fb.setTransactionTimeout(-1);
fb.setPropagation(Propagation.REQUIRED);
@@ -166,7 +167,7 @@ public class StepParserStepFactoryBeanTests {
fb.setJobRepository(new JobRepositorySupport());
fb.setStartLimit(5);
fb.setTransactionManager(new ResourcelessTransactionManager());
- fb.setListeners(new StepListener[] { new StepExecutionListenerSupport() });
+ fb.setListeners(new StepListener[] { new StepExecutionListener() {} });
fb.setIsolation(Isolation.DEFAULT);
fb.setTransactionTimeout(-1);
fb.setPropagation(Propagation.REQUIRED);
@@ -200,7 +201,7 @@ public class StepParserStepFactoryBeanTests {
fb.setJobRepository(new JobRepositorySupport());
fb.setStartLimit(5);
fb.setTransactionManager(new ResourcelessTransactionManager());
- fb.setListeners(new StepListener[] { new StepExecutionListenerSupport() });
+ fb.setListeners(new StepListener[] { new StepExecutionListener() {} });
fb.setIsolation(Isolation.DEFAULT);
fb.setTransactionTimeout(-1);
fb.setPropagation(Propagation.REQUIRED);
@@ -226,7 +227,7 @@ public class StepParserStepFactoryBeanTests {
fb.setJobRepository(new JobRepositorySupport());
fb.setStartLimit(5);
fb.setTransactionManager(new ResourcelessTransactionManager());
- fb.setListeners(new StepListener[] { new StepExecutionListenerSupport() });
+ fb.setListeners(new StepListener[] { new StepExecutionListener(){} });
fb.setChunkCompletionPolicy(new DummyCompletionPolicy());
fb.setTaskExecutor(new SyncTaskExecutor());
fb.setItemReader(new DummyItemReader());
@@ -264,7 +265,7 @@ public class StepParserStepFactoryBeanTests {
fb.setAllowStartIfComplete(true);
fb.setJobRepository(new JobRepositorySupport());
fb.setStartLimit(5);
- fb.setListeners(new StepListener[] { new StepExecutionListenerSupport() });
+ fb.setListeners(new StepListener[] { new StepExecutionListener(){} });
fb.setTaskExecutor(new SyncTaskExecutor());
SimplePartitioner partitioner = new SimplePartitioner();
@@ -284,7 +285,7 @@ public class StepParserStepFactoryBeanTests {
fb.setAllowStartIfComplete(true);
fb.setJobRepository(new JobRepositorySupport());
fb.setStartLimit(5);
- fb.setListeners(new StepListener[] { new StepExecutionListenerSupport() });
+ fb.setListeners(new StepListener[] { new StepExecutionListener(){} });
fb.setTaskExecutor(new SyncTaskExecutor());
SimplePartitioner partitioner = new SimplePartitioner();
@@ -307,7 +308,7 @@ public class StepParserStepFactoryBeanTests {
fb.setAllowStartIfComplete(true);
fb.setJobRepository(new JobRepositorySupport());
fb.setStartLimit(5);
- fb.setListeners(new StepListener[] { new StepExecutionListenerSupport() });
+ fb.setListeners(new StepListener[] { new StepExecutionListener(){} });
fb.setTaskExecutor(new SyncTaskExecutor());
fb.setFlow(new SimpleFlow("foo"));
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java
index f1b7d770f..8e6160be3 100644
--- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java
@@ -34,7 +34,6 @@ import org.springframework.batch.core.Step;
import org.springframework.batch.core.StepExecutionListener;
import org.springframework.batch.core.job.AbstractJob;
import org.springframework.batch.core.listener.CompositeStepExecutionListener;
-import org.springframework.batch.core.listener.StepExecutionListenerSupport;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.core.repository.support.SimpleJobRepository;
import org.springframework.batch.core.step.AbstractStep;
@@ -170,16 +169,16 @@ public class StepParserTests {
ApplicationContext ctx = stepParserParentAttributeTestsCtx;
// Inline Step
- assertTrue(getListener("s1", ctx) instanceof StepExecutionListenerSupport);
+ assertTrue(getListener("s1", ctx) instanceof DummyStepExecutionListener);
// Standalone Step
- assertTrue(getListener("s2", ctx) instanceof StepExecutionListenerSupport);
+ assertTrue(getListener("s2", ctx) instanceof DummyStepExecutionListener);
// Inline With Tasklet Attribute Step
- assertTrue(getListener("s3", ctx) instanceof StepExecutionListenerSupport);
+ assertTrue(getListener("s3", ctx) instanceof DummyStepExecutionListener);
// Standalone With Tasklet Attribute Step
- assertTrue(getListener("s4", ctx) instanceof StepExecutionListenerSupport);
+ assertTrue(getListener("s4", ctx) instanceof DummyStepExecutionListener);
}
@Test
@@ -442,7 +441,7 @@ public class StepParserTests {
List> streams = Arrays.asList(CompositeItemStream.class, TestReader.class);
List> retryListeners = Arrays.asList(RetryListenerSupport.class,
DummyRetryListener.class);
- List> stepListeners = Arrays.asList(StepExecutionListenerSupport.class,
+ List> stepListeners = Arrays.asList(DummyStepExecutionListener.class,
CompositeStepExecutionListener.class);
List> noRollback = Arrays.asList(FatalRuntimeException.class,
SkippableRuntimeException.class);
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/job/SimpleJobTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/job/SimpleJobTests.java
index fc9eb5a51..b87df3efd 100644
--- a/spring-batch-core/src/test/java/org/springframework/batch/core/job/SimpleJobTests.java
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/job/SimpleJobTests.java
@@ -230,7 +230,7 @@ public class SimpleJobTests {
@Test
public void testRunNormallyWithListener() throws Exception {
- job.setJobExecutionListeners(new JobExecutionListenerSupport[] { new JobExecutionListenerSupport() {
+ job.setJobExecutionListeners(new JobExecutionListener[] { new JobExecutionListener() {
@Override
public void beforeJob(JobExecution jobExecution) {
list.add("before");
@@ -310,7 +310,7 @@ public class SimpleJobTests {
@Test
public void testFailedWithListener() throws Exception {
- job.setJobExecutionListeners(new JobExecutionListenerSupport[] { new JobExecutionListenerSupport() {
+ job.setJobExecutionListeners(new JobExecutionListener[] { new JobExecutionListener() {
@Override
public void afterJob(JobExecution jobExecution) {
list.add("afterJob");
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeJobExecutionListenerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeJobExecutionListenerTests.java
index 8288d58f9..b9d499982 100644
--- a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeJobExecutionListenerTests.java
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeJobExecutionListenerTests.java
@@ -22,10 +22,12 @@ import java.util.List;
import junit.framework.TestCase;
import org.springframework.batch.core.JobExecution;
+import org.springframework.batch.core.JobExecutionListener;
import org.springframework.batch.core.JobInstance;
/**
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
*
*/
public class CompositeJobExecutionListenerTests extends TestCase {
@@ -39,12 +41,12 @@ public class CompositeJobExecutionListenerTests extends TestCase {
* {@link org.springframework.batch.core.listener.CompositeJobExecutionListener#setListeners(List)}
*/
public void testSetListeners() {
- listener.setListeners(Arrays.asList(new JobExecutionListenerSupport() {
+ listener.setListeners(Arrays.asList(new JobExecutionListener() {
@Override
public void afterJob(JobExecution jobExecution) {
list.add("fail");
}
- }, new JobExecutionListenerSupport() {
+ }, new JobExecutionListener() {
@Override
public void afterJob(JobExecution jobExecution) {
list.add("continue");
@@ -60,7 +62,7 @@ public class CompositeJobExecutionListenerTests extends TestCase {
* .
*/
public void testSetListener() {
- listener.register(new JobExecutionListenerSupport() {
+ listener.register(new JobExecutionListener() {
@Override
public void afterJob(JobExecution jobExecution) {
list.add("fail");
@@ -76,7 +78,7 @@ public class CompositeJobExecutionListenerTests extends TestCase {
* .
*/
public void testOpen() {
- listener.register(new JobExecutionListenerSupport() {
+ listener.register(new JobExecutionListener() {
@Override
public void beforeJob(JobExecution stepExecution) {
list.add("foo");
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeStepExecutionListenerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeStepExecutionListenerTests.java
index 7aad3ea6e..33408c19b 100644
--- a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeStepExecutionListenerTests.java
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeStepExecutionListenerTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2019 the original author or authors.
+ * Copyright 2006-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,6 +28,7 @@ import org.springframework.lang.Nullable;
/**
* @author Dave Syer
+ * @author Mahmoud Ben Hassine
*
*/
public class CompositeStepExecutionListenerTests extends TestCase {
@@ -44,7 +45,7 @@ public class CompositeStepExecutionListenerTests extends TestCase {
public void testSetListeners() {
JobExecution jobExecution = new JobExecution(1L);
StepExecution stepExecution = new StepExecution("s1", jobExecution);
- listener.setListeners(new StepExecutionListener[] { new StepExecutionListenerSupport() {
+ listener.setListeners(new StepExecutionListener[] { new StepExecutionListener() {
@Nullable
@Override
public ExitStatus afterStep(StepExecution stepExecution) {
@@ -52,7 +53,7 @@ public class CompositeStepExecutionListenerTests extends TestCase {
list.add("fail");
return ExitStatus.FAILED;
}
- }, new StepExecutionListenerSupport() {
+ }, new StepExecutionListener() {
@Nullable
@Override
public ExitStatus afterStep(StepExecution stepExecution) {
@@ -72,7 +73,7 @@ public class CompositeStepExecutionListenerTests extends TestCase {
public void testSetListener() {
JobExecution jobExecution = new JobExecution(1L);
StepExecution stepExecution = new StepExecution("s1", jobExecution);
- listener.register(new StepExecutionListenerSupport() {
+ listener.register(new StepExecutionListener() {
@Nullable
@Override
public ExitStatus afterStep(StepExecution stepExecution) {
@@ -90,7 +91,7 @@ public class CompositeStepExecutionListenerTests extends TestCase {
* .
*/
public void testOpen() {
- listener.register(new StepExecutionListenerSupport() {
+ listener.register(new StepExecutionListener() {
@Override
public void beforeStep(StepExecution stepExecution) {
list.add("foo");
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/MulticasterBatchListenerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/MulticasterBatchListenerTests.java
index 2996d17da..dada2f44a 100644
--- a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/MulticasterBatchListenerTests.java
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/MulticasterBatchListenerTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2019 the original author or authors.
+ * Copyright 2006-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,6 +26,7 @@ import org.junit.Before;
import org.junit.Test;
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.JobExecution;
+import org.springframework.batch.core.SkipListener;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.StepListener;
import org.springframework.batch.core.annotation.AfterChunk;
@@ -401,11 +402,10 @@ public class MulticasterBatchListenerTests {
*/
@Test
public void testOnSkipInRead() {
- multicast.register(new SkipListenerSupport