OPEN - issue BATCH-673: Add new Java 5.0 features

http://jira.springframework.org/browse/BATCH-673

Removed some unnecessary classes and added javadocs.
This commit is contained in:
lucasward
2008-11-25 05:42:10 +00:00
parent cea101921c
commit 477df02abe
4 changed files with 20 additions and 351 deletions

View File

@@ -1,91 +0,0 @@
/**
*
*/
package org.springframework.batch.core.job;
import static org.easymock.EasyMock.createMock;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobExecutionException;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.annotation.AfterJob;
import org.springframework.batch.core.annotation.BeforeJob;
import org.springframework.batch.core.repository.JobRepository;
/**
* @author Lucas Ward
*
*/
public class JobListenerAnnotationBeanPostProcessorTests {
JobListenerAnnotationBeanPostProcessor postProcessor;
AnnotatedClassStub annotatedClass;
StubJob job;
JobExecution jobExecution;
@Before
public void init(){
job = new StubJob();
annotatedClass = new AnnotatedClassStub();
postProcessor = new JobListenerAnnotationBeanPostProcessor(job);
jobExecution = new JobExecution(1L);
}
@Test
public void testBeforeJob(){
postProcessor.postProcessBeforeInitialization(annotatedClass, "test");
job.execute(jobExecution);
assertTrue(annotatedClass.beforeJobCalled);
assertTrue(annotatedClass.beforeJobWithExecutionCalled);
assertTrue(annotatedClass.afterJobCalled);
assertTrue(annotatedClass.afterJobWithExecutionCalled);
}
private class AnnotatedClassStub{
boolean beforeJobCalled = false;
boolean beforeJobWithExecutionCalled = false;
boolean afterJobCalled = false;
boolean afterJobWithExecutionCalled = false;
@BeforeJob
public void beforeJobMethod(){
beforeJobCalled = true;
};
@BeforeJob
public void beforeJobMethodWithExecution(JobExecution jobExecution){
beforeJobWithExecutionCalled = true;
}
@AfterJob
public void afterJobMethod(){
afterJobCalled = true;
}
@AfterJob
public void afterJobMethodWithExecution(JobExecution jobExecution){
afterJobWithExecutionCalled = true;
}
}
private class StubJob extends AbstractJob{
public StubJob() {
super.setJobRepository(createMock(JobRepository.class));
}
@Override
protected StepExecution doExecute(JobExecution execution)
throws JobExecutionException {
return null;
}
}
}