Refine contribution #3934

* Add default methods in all listener interfaces
* Remove usage of newly deprecated support classes

Issue #3924
This commit is contained in:
Mahmoud Ben Hassine
2021-09-10 21:46:42 +02:00
parent ba0900127d
commit f85a662ebf
46 changed files with 286 additions and 372 deletions

View File

@@ -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<T, S> 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<T, S> 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<T, S> 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) {
}
}

View File

@@ -30,7 +30,8 @@ public interface ItemReadListener<T> extends StepListener {
/**
* Called before {@link ItemReader#read()}
*/
void beforeRead();
default void beforeRead() {
}
/**
* Called after {@link ItemReader#read()}.
@@ -39,12 +40,14 @@ public interface ItemReadListener<T> 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) {
}
}

View File

@@ -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;
*</p>
*
* @author Lucas Ward
* @author Mahmoud Ben Hassine
*
*/
public interface ItemWriteListener<S> extends StepListener {
@@ -47,7 +48,8 @@ public interface ItemWriteListener<S> 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<S> 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<S> 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) {
}
}

View File

@@ -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<T,S> extends StepListener {
@@ -37,7 +38,8 @@ public interface SkipListener<T,S> 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<T,S> 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<T,S> 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) {
}
}

View File

@@ -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;

View File

@@ -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<I, O> implements ItemReadListener<I>, ItemProcessListener<I, O>, ItemWriteListener<O> {
/*
* (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) {
}
}

View File

@@ -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<String> keys = null;

View File

@@ -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<T,S> implements SkipListener<T,S> {
/* (non-Javadoc)

View File

@@ -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<T,S> implements StepExecutionListener, ChunkListener,
ItemReadListener<T>, ItemProcessListener<T,S>, ItemWriteListener<S>, SkipListener<T, S> {
/* (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<T,S> extends ItemListenerSupport<T, S>
implements StepExecutionListener, ChunkListener, SkipListener<T, S> {
}

View File

@@ -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;
* </p>
*
* @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) {

View File

@@ -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

View File

@@ -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);

View File

@@ -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) {

View File

@@ -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 {
}

View File

@@ -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 {
}

View File

@@ -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 {
}

View File

@@ -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;
}
}

View File

@@ -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<String> stepNamesList = null;

View File

@@ -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) {

View File

@@ -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);
}

View File

@@ -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;
}
}

View File

@@ -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"));

View File

@@ -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<Class<? extends ItemStream>> streams = Arrays.asList(CompositeItemStream.class, TestReader.class);
List<Class<? extends RetryListener>> retryListeners = Arrays.asList(RetryListenerSupport.class,
DummyRetryListener.class);
List<Class<? extends StepExecutionListener>> stepListeners = Arrays.asList(StepExecutionListenerSupport.class,
List<Class<? extends StepExecutionListener>> stepListeners = Arrays.asList(DummyStepExecutionListener.class,
CompositeStepExecutionListener.class);
List<Class<? extends SkippableRuntimeException>> noRollback = Arrays.asList(FatalRuntimeException.class,
SkippableRuntimeException.class);

View File

@@ -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");

View File

@@ -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");

View File

@@ -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");

View File

@@ -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<Object,Object>() {
multicast.register(new SkipListener<Object,Object>() {
@Override
public void onSkipInRead(Throwable t) {
count++;
super.onSkipInRead(t);
}
});
multicast.onSkipInRead(new RuntimeException("foo"));
@@ -419,7 +419,7 @@ public class MulticasterBatchListenerTests {
*/
@Test
public void testOnSkipInReadFails() {
multicast.register(new SkipListenerSupport<Object,Object>() {
multicast.register(new SkipListener<Object,Object>() {
@Override
public void onSkipInRead(Throwable t) {
count++;
@@ -445,11 +445,10 @@ public class MulticasterBatchListenerTests {
*/
@Test
public void testOnSkipInWrite() {
multicast.register(new SkipListenerSupport<Object,Object>() {
multicast.register(new SkipListener<Object,Object>() {
@Override
public void onSkipInWrite(Object item, Throwable t) {
count++;
super.onSkipInWrite(item, t);
}
});
multicast.onSkipInWrite(null, new RuntimeException("foo"));
@@ -463,7 +462,7 @@ public class MulticasterBatchListenerTests {
*/
@Test
public void testOnSkipInWriteFails() {
multicast.register(new SkipListenerSupport<Object,Object>() {
multicast.register(new SkipListener<Object,Object>() {
@Override
public void onSkipInWrite(Object item, Throwable t) {
count++;
@@ -489,11 +488,10 @@ public class MulticasterBatchListenerTests {
*/
@Test
public void testOnSkipInProcess() {
multicast.register(new SkipListenerSupport<Object,Object>() {
multicast.register(new SkipListener<Object,Object>() {
@Override
public void onSkipInProcess(Object item, Throwable t) {
count++;
super.onSkipInWrite(item, t);
}
});
multicast.onSkipInProcess(null, new RuntimeException("foo"));
@@ -507,7 +505,7 @@ public class MulticasterBatchListenerTests {
*/
@Test
public void testOnSkipInProcessFails() {
multicast.register(new SkipListenerSupport<Object,Object>() {
multicast.register(new SkipListener<Object,Object>() {
@Override
public void onSkipInProcess(Object item, Throwable t) {
count++;

View File

@@ -33,6 +33,7 @@ import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersBuilder;
import org.springframework.batch.core.SkipListener;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.StepListener;
@@ -452,7 +453,7 @@ public class FaultTolerantStepFactoryBeanRetryTests {
@Test
public void testSkipAndRetryWithWriteFailure() throws Exception {
factory.setListeners(new StepListener[] { new SkipListenerSupport<String, String>() {
factory.setListeners(new StepListener[] { new SkipListener<String, String>() {
@Override
public void onSkipInWrite(String item, Throwable t) {
recovered.add(item);
@@ -517,7 +518,7 @@ public class FaultTolerantStepFactoryBeanRetryTests {
throws Exception {
factory.setCommitInterval(3);
factory.setListeners(new StepListener[] { new SkipListenerSupport<String, String>() {
factory.setListeners(new StepListener[] { new SkipListener<String, String>() {
@Override
public void onSkipInWrite(String item, Throwable t) {
recovered.add(item);

View File

@@ -543,7 +543,7 @@ public class FaultTolerantStepFactoryBeanTests {
final List<Throwable> listenerCalls = new ArrayList<>();
factory.setListeners(new StepListener[] { new SkipListenerSupport<String, String>() {
factory.setListeners(new StepListener[] { new SkipListener<String, String>() {
@Override
public void onSkipInRead(Throwable t) {
listenerCalls.add(t);
@@ -578,7 +578,7 @@ public class FaultTolerantStepFactoryBeanTests {
writer.setFailures("4");
factory.setSkipLimit(3);
factory.setListeners(new StepListener[] { new SkipListenerSupport<String, String>() {
factory.setListeners(new StepListener[] { new SkipListener<String, String>() {
@Override
public void onSkipInRead(Throwable t) {
throw new RuntimeException("oops");
@@ -613,7 +613,7 @@ public class FaultTolerantStepFactoryBeanTests {
writer.setFailures("4");
factory.setSkipLimit(3);
factory.setListeners(new StepListener[] { new SkipListenerSupport<String, String>() {
factory.setListeners(new StepListener[] { new SkipListener<String, String>() {
@Override
public void onSkipInWrite(String item, Throwable t) {
throw new RuntimeException("oops");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2019 the original author or authors.
* Copyright 2008-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,7 +26,6 @@ import org.springframework.batch.core.Step;
import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.StepExecutionListener;
import org.springframework.batch.core.listener.StepExecutionListenerSupport;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException;
import org.springframework.batch.core.repository.JobRepository;
@@ -62,6 +61,7 @@ import static org.springframework.batch.core.BatchStatus.UNKNOWN;
* @author Lucas Ward
* @author Dave Syer
* @author David Turanski
* @author Mahmoud Ben Hassine
*
*/
public class TaskletStepExceptionTests {
@@ -139,7 +139,7 @@ public class TaskletStepExceptionTests {
public void testBeforeStepFailure() throws Exception {
final RuntimeException exception = new RuntimeException();
taskletStep.setStepExecutionListeners(new StepExecutionListenerSupport[] { new StepExecutionListenerSupport() {
taskletStep.setStepExecutionListeners(new StepExecutionListener[] { new StepExecutionListener() {
@Override
public void beforeStep(StepExecution stepExecution) {
throw exception;
@@ -155,7 +155,7 @@ public class TaskletStepExceptionTests {
public void testAfterStepFailureWhenTaskletSucceeds() throws Exception {
final RuntimeException exception = new RuntimeException();
taskletStep.setStepExecutionListeners(new StepExecutionListenerSupport[] { new StepExecutionListenerSupport() {
taskletStep.setStepExecutionListeners(new StepExecutionListener[] { new StepExecutionListener() {
@Nullable
@Override
public ExitStatus afterStep(StepExecution stepExecution) {
@@ -184,7 +184,7 @@ public class TaskletStepExceptionTests {
public void testAfterStepFailureWhenTaskletFails() throws Exception {
final RuntimeException exception = new RuntimeException();
taskletStep.setStepExecutionListeners(new StepExecutionListenerSupport[] { new StepExecutionListenerSupport() {
taskletStep.setStepExecutionListeners(new StepExecutionListener[] { new StepExecutionListener() {
@Nullable
@Override
public ExitStatus afterStep(StepExecution stepExecution) {
@@ -480,7 +480,7 @@ public class TaskletStepExceptionTests {
}
}
private static class InterruptionListener extends StepExecutionListenerSupport {
private static class InterruptionListener implements StepExecutionListener {
@Override
public void beforeStep(StepExecution stepExecution) {

View File

@@ -39,7 +39,6 @@ import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.StepExecutionListener;
import org.springframework.batch.core.job.JobSupport;
import org.springframework.batch.core.listener.StepExecutionListenerSupport;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.core.repository.dao.Jackson2ExecutionContextStringSerializer;
import org.springframework.batch.core.repository.dao.JdbcExecutionContextDao;
@@ -326,7 +325,7 @@ public class TaskletStepTests {
};
step.setTasklet(new TestingChunkOrientedTasklet<>(itemReader, itemWriter));
step.registerStepExecutionListener(new StepExecutionListenerSupport() {
step.registerStepExecutionListener(new StepExecutionListener() {
@Nullable
@Override
public ExitStatus afterStep(StepExecution stepExecution) {
@@ -497,7 +496,7 @@ public class TaskletStepTests {
@Test
public void testDirectlyInjectedListener() throws Exception {
step.registerStepExecutionListener(new StepExecutionListenerSupport() {
step.registerStepExecutionListener(new StepExecutionListener() {
@Override
public void beforeStep(StepExecution stepExecution) {
list.add("foo");
@@ -542,7 +541,7 @@ public class TaskletStepTests {
final ExitStatus customStatus = new ExitStatus("COMPLETED_CUSTOM");
step.setStepExecutionListeners(new StepExecutionListener[] { new StepExecutionListenerSupport() {
step.setStepExecutionListeners(new StepExecutionListener[] { new StepExecutionListener() {
@Nullable
@Override
public ExitStatus afterStep(StepExecution stepExecution) {
@@ -566,7 +565,7 @@ public class TaskletStepTests {
@Test
public void testDirectlyInjectedListenerOnError() throws Exception {
step.registerStepExecutionListener(new StepExecutionListenerSupport() {
step.registerStepExecutionListener(new StepExecutionListener() {
@Nullable
@Override
public ExitStatus afterStep(StepExecution stepExecution) {
@@ -877,7 +876,7 @@ public class TaskletStepTests {
*/
@Test
public void testStepFailureInAfterStepCallback() throws JobInterruptedException {
StepExecutionListener listener = new StepExecutionListenerSupport() {
StepExecutionListener listener = new StepExecutionListener() {
@Nullable
@Override
public ExitStatus afterStep(StepExecution stepExecution) {

View File

@@ -14,7 +14,7 @@
<listeners merge="true">
<listener>
<beans:bean
class="org.springframework.batch.core.listener.JobExecutionListenerSupport" />
class="org.springframework.batch.core.configuration.xml.DummyJobExecutionListener" />
</listener>
</listeners>
</job>
@@ -27,7 +27,7 @@
<listeners>
<listener>
<beans:bean
class="org.springframework.batch.core.listener.JobExecutionListenerSupport" />
class="org.springframework.batch.core.configuration.xml.DummyJobExecutionListener" />
</listener>
</listeners>
</job>
@@ -88,7 +88,7 @@
<beans:list>
<job-listener>
<beans:bean
class="org.springframework.batch.core.listener.JobExecutionListenerSupport" />
class="org.springframework.batch.core.configuration.xml.DummyJobExecutionListener" />
</job-listener>
</beans:list>
</beans:property>

View File

@@ -11,7 +11,7 @@
<tasklet ref="dummyTasklet" />
<listeners>
<listener>
<beans:bean class="org.springframework.batch.core.listener.StepExecutionListenerSupport" />
<beans:bean class="org.springframework.batch.core.configuration.xml.DummyStepExecutionListener" />
</listener>
</listeners>
</step>
@@ -19,7 +19,7 @@
<tasklet ref="dummyTasklet" />
<listeners>
<listener>
<beans:bean class="org.springframework.batch.core.listener.ChunkListenerSupport" />
<beans:bean class="org.springframework.batch.core.configuration.xml.DummyChunkListener" />
</listener>
</listeners>
</step>
@@ -27,13 +27,13 @@
<tasklet ref="dummyTasklet">
<listeners>
<listener>
<beans:bean class="org.springframework.batch.core.listener.ChunkListenerSupport" />
<beans:bean class="org.springframework.batch.core.configuration.xml.DummyChunkListener" />
</listener>
</listeners>
</tasklet>
<listeners>
<listener>
<beans:bean class="org.springframework.batch.core.listener.StepExecutionListenerSupport" />
<beans:bean class="org.springframework.batch.core.configuration.xml.DummyStepExecutionListener" />
</listener>
</listeners>
</step>
@@ -49,7 +49,7 @@
</tasklet>
<listeners>
<listener>
<beans:bean class="org.springframework.batch.core.listener.StepExecutionListenerSupport" />
<beans:bean class="org.springframework.batch.core.configuration.xml.DummyStepExecutionListener" />
</listener>
</listeners>
</step>

View File

@@ -22,7 +22,7 @@
<tasklet ref="dummyTasklet">
<listeners>
<listener>
<beans:bean class="org.springframework.batch.core.listener.StepExecutionListenerSupport" />
<beans:bean class="org.springframework.batch.core.configuration.xml.DummyStepExecutionListener" />
</listener>
<listener ref="toplevel2" />
</listeners>
@@ -49,7 +49,7 @@
</job>
<step-listener id="toplevel1">
<beans:bean class="org.springframework.batch.core.listener.StepExecutionListenerSupport" />
<beans:bean class="org.springframework.batch.core.configuration.xml.DummyStepExecutionListener" />
</step-listener>
<step-listener id="toplevel2">
<beans:bean class="org.springframework.batch.core.configuration.xml.DummyAnnotationStepExecutionListener" />

View File

@@ -86,7 +86,7 @@
<transaction-attributes timeout="10"/>
<listeners>
<listener>
<beans:bean class="org.springframework.batch.core.listener.StepExecutionListenerSupport" />
<beans:bean class="org.springframework.batch.core.configuration.xml.DummyStepExecutionListener" />
</listener>
</listeners>
</tasklet>
@@ -168,7 +168,7 @@
</chunk>
<listeners>
<listener>
<beans:bean class="org.springframework.batch.core.listener.StepExecutionListenerSupport"/>
<beans:bean class="org.springframework.batch.core.configuration.xml.DummyStepExecutionListener"/>
</listener>
</listeners>
<no-rollback-exception-classes>