private static JobRepository repo;
@BeforeClass
public static void beforeClass() throws Exception {
final BatchEnvironment batchEnvironment = new BatchEnvironment() {
@Override
public ClassLoader getClassLoader() {
return Thread.currentThread().getContextClassLoader();
}
@Override
public ArtifactFactory getArtifactFactory() {
return null;
}
@Override
public Future<?> submitTask(final Runnable task) {
return null;
}
@Override
public <T> Future<T> submitTask(final Runnable task, final T result) {
return null;
}
@Override
public <T> Future<T> submitTask(final Callable<T> task) {
return null;
}
@Override
public TransactionManager getTransactionManager() {
return new TransactionManager() {
@Override
public void begin() throws NotSupportedException, SystemException {
}
@Override
public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, IllegalStateException, SystemException {
}
@Override
public void rollback() throws IllegalStateException, SecurityException, SystemException {
}
@Override
public void setRollbackOnly() throws IllegalStateException, SystemException {
}
@Override
public int getStatus() throws SystemException {
return 0;
}
@Override
public Transaction getTransaction() throws SystemException {
return NO_OP_TRANSACTION;
}
@Override
public void setTransactionTimeout(final int seconds) throws SystemException {
}
@Override
public Transaction suspend() throws SystemException {
return NO_OP_TRANSACTION;
}
@Override
public void resume(final Transaction tobj) throws InvalidTransactionException, IllegalStateException, SystemException {
}
};
}
@Override
public JobRepository getJobRepository() {
return InMemoryRepository.getInstance();
}
@Override
public Properties getBatchConfigurationProperties() {
final Properties props = new Properties();
//props.setProperty(JobRepositoryFactory.JOB_REPOSITORY_TYPE_KEY, JobRepositoryFactory.REPOSITORY_TYPE_JDBC);
return props;
}
};
repo = batchEnvironment.getJobRepository();
}