BATCH-1786: Added the type to the AbstractJobRepositoryFactoryBean's FactoryBean definition and depricated AbstractJobRepositoryFactoryBean#getJobRepository in favor of FactoryBean#getObject()
This commit is contained in:
@@ -22,7 +22,7 @@ public class MapJobExplorerFactoryBeanTests {
|
||||
public void testCreateExplorer() throws Exception {
|
||||
|
||||
MapJobRepositoryFactoryBean repositoryFactory = new MapJobRepositoryFactoryBean();
|
||||
((JobRepository)repositoryFactory.getObject()).createJobExecution("foo", new JobParameters());
|
||||
(repositoryFactory.getObject()).createJobExecution("foo", new JobParameters());
|
||||
|
||||
MapJobExplorerFactoryBean tested = new MapJobExplorerFactoryBean(repositoryFactory);
|
||||
tested.afterPropertiesSet();
|
||||
|
||||
@@ -15,10 +15,6 @@
|
||||
*/
|
||||
package org.springframework.batch.core.explore.support;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobParametersBuilder;
|
||||
@@ -34,6 +30,10 @@ import org.springframework.batch.core.step.tasklet.TaskletStep;
|
||||
import org.springframework.batch.repeat.RepeatStatus;
|
||||
import org.springframework.core.task.SimpleAsyncTaskExecutor;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
@@ -48,7 +48,7 @@ public class MapJobExplorerIntegrationTests {
|
||||
SimpleJobLauncher jobLauncher = new SimpleJobLauncher();
|
||||
MapJobRepositoryFactoryBean repositoryFactory = new MapJobRepositoryFactoryBean();
|
||||
repositoryFactory.afterPropertiesSet();
|
||||
JobRepository jobRepository = (JobRepository) repositoryFactory.getObject();
|
||||
JobRepository jobRepository = repositoryFactory.getObject();
|
||||
jobLauncher.setJobRepository(jobRepository);
|
||||
jobLauncher.setTaskExecutor(new SimpleAsyncTaskExecutor());
|
||||
jobLauncher.afterPropertiesSet();
|
||||
|
||||
@@ -15,16 +15,6 @@
|
||||
*/
|
||||
package org.springframework.batch.core.job;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.core.BatchStatus;
|
||||
@@ -39,6 +29,16 @@ import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
import org.springframework.batch.core.step.StepSupport;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
@@ -51,7 +51,7 @@ public class ExtendedAbstractJobTests {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
MapJobRepositoryFactoryBean factory = new MapJobRepositoryFactoryBean();
|
||||
jobRepository = (JobRepository) factory.getObject();
|
||||
jobRepository = factory.getObject();
|
||||
job = new StubJob("job", jobRepository);
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ public class ExtendedAbstractJobTests {
|
||||
|
||||
MapJobRepositoryFactoryBean factory = new MapJobRepositoryFactoryBean();
|
||||
factory.afterPropertiesSet();
|
||||
JobRepository repository = (JobRepository) factory.getObject();
|
||||
JobRepository repository = factory.getObject();
|
||||
job.setJobRepository(repository);
|
||||
job.setRestartable(true);
|
||||
|
||||
|
||||
@@ -15,16 +15,6 @@
|
||||
*/
|
||||
package org.springframework.batch.core.job.flow;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.core.BatchStatus;
|
||||
@@ -52,6 +42,16 @@ import org.springframework.batch.core.repository.dao.JobExecutionDao;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
import org.springframework.batch.core.step.StepSupport;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* @author Michael Minella
|
||||
@@ -74,7 +74,7 @@ public class FlowJobTests {
|
||||
MapJobRepositoryFactoryBean factory = new MapJobRepositoryFactoryBean();
|
||||
factory.afterPropertiesSet();
|
||||
jobExecutionDao = factory.getJobExecutionDao();
|
||||
jobRepository = (JobRepository) factory.getObject();
|
||||
jobRepository = factory.getObject();
|
||||
job.setJobRepository(jobRepository);
|
||||
jobExecution = jobRepository.createJobExecution("job", new JobParameters());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2014 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.
|
||||
@@ -15,18 +15,6 @@
|
||||
*/
|
||||
package org.springframework.batch.core.jsr.job.flow;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.batch.api.Decider;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.core.BatchStatus;
|
||||
@@ -59,6 +47,17 @@ import org.springframework.batch.core.repository.dao.JobExecutionDao;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
import org.springframework.batch.core.step.StepSupport;
|
||||
|
||||
import javax.batch.api.Decider;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* @author Michael Minella
|
||||
@@ -83,7 +82,7 @@ public class JsrFlowJobTests {
|
||||
MapJobRepositoryFactoryBean jobRepositoryFactory = new MapJobRepositoryFactoryBean();
|
||||
jobRepositoryFactory.afterPropertiesSet();
|
||||
jobExecutionDao = jobRepositoryFactory.getJobExecutionDao();
|
||||
jobRepository = (JobRepository) jobRepositoryFactory.getObject();
|
||||
jobRepository = jobRepositoryFactory.getObject();
|
||||
job.setJobRepository(jobRepository);
|
||||
jobExecution = jobRepository.createJobExecution("job", new JobParameters());
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2014 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.
|
||||
@@ -15,14 +15,6 @@
|
||||
*/
|
||||
package org.springframework.batch.core.partition.support;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.core.BatchStatus;
|
||||
@@ -35,6 +27,14 @@ import org.springframework.batch.core.partition.StepExecutionSplitter;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
@@ -48,7 +48,7 @@ public class PartitionStepTests {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
MapJobRepositoryFactoryBean factory = new MapJobRepositoryFactoryBean();
|
||||
jobRepository = (JobRepository) factory.getObject();
|
||||
jobRepository = factory.getObject();
|
||||
step.setJobRepository(jobRepository);
|
||||
step.setName("partitioned");
|
||||
}
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
package org.springframework.batch.core.partition.support;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.core.BatchStatus;
|
||||
@@ -17,6 +11,12 @@ import org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
public class RemoteStepExecutionAggregatorTests {
|
||||
|
||||
private RemoteStepExecutionAggregator aggregator = new RemoteStepExecutionAggregator();
|
||||
@@ -32,7 +32,7 @@ public class RemoteStepExecutionAggregatorTests {
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
MapJobRepositoryFactoryBean factory = new MapJobRepositoryFactoryBean();
|
||||
JobRepository jobRepository = (JobRepository) factory.getObject();
|
||||
JobRepository jobRepository = factory.getObject();
|
||||
aggregator.setJobExplorer((JobExplorer) new MapJobExplorerFactoryBean(factory).getObject());
|
||||
jobExecution = jobRepository.createJobExecution("job", new JobParameters());
|
||||
result = jobExecution.createStepExecution("aggregate");
|
||||
|
||||
@@ -1,16 +1,5 @@
|
||||
package org.springframework.batch.core.partition.support;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.core.BatchStatus;
|
||||
@@ -25,6 +14,17 @@ import org.springframework.batch.core.repository.support.MapJobRepositoryFactory
|
||||
import org.springframework.batch.core.step.tasklet.TaskletStep;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class SimpleStepExecutionSplitterTests {
|
||||
|
||||
private Step step;
|
||||
@@ -37,7 +37,7 @@ public class SimpleStepExecutionSplitterTests {
|
||||
public void setUp() throws Exception {
|
||||
step = new TaskletStep("step");
|
||||
MapJobRepositoryFactoryBean factory = new MapJobRepositoryFactoryBean();
|
||||
jobRepository = (JobRepository) factory.getObject();
|
||||
jobRepository = factory.getObject();
|
||||
stepExecution = jobRepository.createJobExecution("job", new JobParameters()).createStepExecution("bar");
|
||||
jobRepository.add(stepExecution);
|
||||
}
|
||||
|
||||
@@ -15,20 +15,6 @@
|
||||
*/
|
||||
package org.springframework.batch.core.repository.support;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertNotNull;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static junit.framework.Assert.fail;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.Types;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
@@ -50,6 +36,19 @@ import org.springframework.test.util.ReflectionTestUtils;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.support.DefaultTransactionDefinition;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.Types;
|
||||
import java.util.Map;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertNotNull;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
import static junit.framework.Assert.fail;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
* @author Lucas Ward
|
||||
* @author Will Schipp
|
||||
@@ -225,7 +224,7 @@ public class JobRepositoryFactoryBeanTests {
|
||||
catch (IllegalArgumentException ex) {
|
||||
// expected
|
||||
String message = ex.getMessage();
|
||||
assertTrue("Wrong message: " + message, message.indexOf("DataSource") >= 0);
|
||||
assertTrue("Wrong message: " + message, message.contains("DataSource"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -245,7 +244,7 @@ public class JobRepositoryFactoryBeanTests {
|
||||
catch (IllegalArgumentException ex) {
|
||||
// expected
|
||||
String message = ex.getMessage();
|
||||
assertTrue("Wrong message: " + message, message.indexOf("TransactionManager") >= 0);
|
||||
assertTrue("Wrong message: " + message, message.contains("TransactionManager"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -263,7 +262,7 @@ public class JobRepositoryFactoryBeanTests {
|
||||
catch (IllegalArgumentException ex) {
|
||||
// expected
|
||||
String message = ex.getMessage();
|
||||
assertTrue("Wrong message: " + message, message.indexOf("foo") >= 0);
|
||||
assertTrue("Wrong message: " + message, message.contains("foo"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -287,7 +286,7 @@ public class JobRepositoryFactoryBeanTests {
|
||||
@Test
|
||||
public void testTransactionAttributesForCreateMethodNullHypothesis() throws Exception {
|
||||
testCreateRepository();
|
||||
JobRepository repository = (JobRepository) factory.getObject();
|
||||
JobRepository repository = factory.getObject();
|
||||
DefaultTransactionDefinition transactionDefinition = new DefaultTransactionDefinition(
|
||||
DefaultTransactionDefinition.PROPAGATION_REQUIRES_NEW);
|
||||
when(transactionManager.getTransaction(transactionDefinition)).thenReturn(null);
|
||||
@@ -309,7 +308,7 @@ public class JobRepositoryFactoryBeanTests {
|
||||
public void testTransactionAttributesForCreateMethod() throws Exception {
|
||||
|
||||
testCreateRepository();
|
||||
JobRepository repository = (JobRepository) factory.getObject();
|
||||
JobRepository repository = factory.getObject();
|
||||
DefaultTransactionDefinition transactionDefinition = new DefaultTransactionDefinition(
|
||||
DefaultTransactionDefinition.PROPAGATION_REQUIRES_NEW);
|
||||
transactionDefinition.setIsolationLevel(DefaultTransactionDefinition.ISOLATION_SERIALIZABLE);
|
||||
@@ -334,7 +333,7 @@ public class JobRepositoryFactoryBeanTests {
|
||||
|
||||
factory.setIsolationLevelForCreate("ISOLATION_READ_UNCOMMITTED");
|
||||
testCreateRepository();
|
||||
JobRepository repository = (JobRepository) factory.getObject();
|
||||
JobRepository repository = factory.getObject();
|
||||
DefaultTransactionDefinition transactionDefinition = new DefaultTransactionDefinition(
|
||||
DefaultTransactionDefinition.PROPAGATION_REQUIRES_NEW);
|
||||
transactionDefinition.setIsolationLevel(DefaultTransactionDefinition.ISOLATION_READ_UNCOMMITTED);
|
||||
@@ -363,7 +362,7 @@ public class JobRepositoryFactoryBeanTests {
|
||||
public void testCustomLobType() throws Exception {
|
||||
factory.setClobType(Types.ARRAY);
|
||||
testCreateRepository();
|
||||
JobRepository repository = (JobRepository) factory.getObject();
|
||||
JobRepository repository = factory.getObject();
|
||||
assertNotNull(repository);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package org.springframework.batch.core.repository.support;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
@@ -9,6 +7,8 @@ import org.springframework.batch.core.job.JobSupport;
|
||||
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
* Tests for {@link MapJobRepositoryFactoryBean}.
|
||||
*/
|
||||
@@ -23,7 +23,7 @@ public class MapJobRepositoryFactoryBeanTests {
|
||||
@Test
|
||||
public void testCreateRepository() throws Exception {
|
||||
tested.afterPropertiesSet();
|
||||
JobRepository repository = (JobRepository) tested.getObject();
|
||||
JobRepository repository = tested.getObject();
|
||||
Job job = new JobSupport("jobName");
|
||||
JobParameters jobParameters = new JobParameters();
|
||||
|
||||
|
||||
@@ -1,20 +1,5 @@
|
||||
package org.springframework.batch.core.step.item;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.instanceOf;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.springframework.batch.core.BatchStatus.FAILED;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.junit.After;
|
||||
@@ -43,6 +28,21 @@ import org.springframework.transaction.interceptor.TransactionAttribute;
|
||||
import org.springframework.transaction.interceptor.TransactionAttributeEditor;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.instanceOf;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.springframework.batch.core.BatchStatus.FAILED;
|
||||
|
||||
/**
|
||||
* Tests for {@link FaultTolerantStepFactoryBean}.
|
||||
*/
|
||||
@@ -93,7 +93,7 @@ public class FaultTolerantStepFactoryBeanRollbackTests {
|
||||
MapJobRepositoryFactoryBean repositoryFactory = new MapJobRepositoryFactoryBean();
|
||||
repositoryFactory.setTransactionManager(transactionManager);
|
||||
repositoryFactory.afterPropertiesSet();
|
||||
repository = (JobRepository) repositoryFactory.getObject();
|
||||
repository = repositoryFactory.getObject();
|
||||
factory.setJobRepository(repository);
|
||||
|
||||
jobExecution = repository.createJobExecution("skipJob", new JobParameters());
|
||||
|
||||
@@ -1,16 +1,5 @@
|
||||
package org.springframework.batch.core.step.item;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -56,6 +45,17 @@ import org.springframework.scheduling.concurrent.ConcurrentTaskExecutor;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* Tests for {@link FaultTolerantStepFactoryBean}.
|
||||
*/
|
||||
@@ -111,7 +111,7 @@ public class FaultTolerantStepFactoryBeanTests {
|
||||
|
||||
MapJobRepositoryFactoryBean repositoryFactory = new MapJobRepositoryFactoryBean();
|
||||
repositoryFactory.afterPropertiesSet();
|
||||
repository = (JobRepository) repositoryFactory.getObject();
|
||||
repository = repositoryFactory.getObject();
|
||||
factory.setJobRepository(repository);
|
||||
|
||||
jobExecution = repository.createJobExecution("skipJob", new JobParameters());
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
package org.springframework.batch.core.step.item;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.junit.Test;
|
||||
@@ -28,6 +22,11 @@ import org.springframework.transaction.TransactionException;
|
||||
import org.springframework.transaction.UnexpectedRollbackException;
|
||||
import org.springframework.transaction.support.DefaultTransactionStatus;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Tests for {@link FaultTolerantStepFactoryBean} with unexpected rollback.
|
||||
*/
|
||||
@@ -74,7 +73,7 @@ public class FaultTolerantStepFactoryBeanUnexpectedRollbackTests {
|
||||
repositoryFactory.setDataSource(dataSource);
|
||||
repositoryFactory.setTransactionManager(transactionManager);
|
||||
repositoryFactory.afterPropertiesSet();
|
||||
JobRepository repository = (JobRepository) repositoryFactory.getObject();
|
||||
JobRepository repository = repositoryFactory.getObject();
|
||||
factory.setJobRepository(repository);
|
||||
|
||||
JobExecution jobExecution = repository.createJobExecution("job", new JobParameters());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2010 the original author or authors.
|
||||
* Copyright 2006-2014 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.
|
||||
@@ -15,11 +15,6 @@
|
||||
*/
|
||||
package org.springframework.batch.core.step.job;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.core.BatchStatus;
|
||||
@@ -33,6 +28,11 @@ import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
@@ -49,7 +49,7 @@ public class JobStepTests {
|
||||
public void setUp() throws Exception {
|
||||
step.setName("step");
|
||||
MapJobRepositoryFactoryBean factory = new MapJobRepositoryFactoryBean();
|
||||
jobRepository = (JobRepository) factory.getObject();
|
||||
jobRepository = factory.getObject();
|
||||
step.setJobRepository(jobRepository);
|
||||
JobExecution jobExecution = jobRepository.createJobExecution("job", new JobParameters());
|
||||
stepExecution = jobExecution.createStepExecution("step");
|
||||
|
||||
Reference in New Issue
Block a user