Package org.springframework.batch.support.transaction

Examples of org.springframework.batch.support.transaction.ResourcelessTransactionManager


  protected void setUp() throws Exception {
    factory.setBeanName("RepeatOperationsStep");
    factory.setItemReader(new ListItemReader<String>(new ArrayList<String>()));
    factory.setItemWriter(new EmptyItemWriter<String>());
    factory.setJobRepository(new JobRepositorySupport());
    factory.setTransactionManager(new ResourcelessTransactionManager());
  }
View Full Code Here


  public void testStepOperationsWithoutChunkListener() throws Exception {

    factory.setItemReader(new ListItemReader<String>(new ArrayList<String>()));
    factory.setItemWriter(new EmptyItemWriter<String>());
    factory.setJobRepository(new JobRepositorySupport());
    factory.setTransactionManager(new ResourcelessTransactionManager());

    factory.setStepOperations(new RepeatOperations() {

      @Override
      public RepeatStatus iterate(RepeatCallback callback) {
View Full Code Here

  public void init() {
    taskletStep = new TaskletStep();
    taskletStep.setTasklet(new ExceptionTasklet());
    jobRepository = new UpdateCountingJobRepository();
    taskletStep.setJobRepository(jobRepository);
    taskletStep.setTransactionManager(new ResourcelessTransactionManager());

    JobInstance jobInstance = new JobInstance(1L, "testJob");
    JobExecution jobExecution = new JobExecution(jobInstance, new JobParameters());
    stepExecution = new StepExecution("testStep", jobExecution);
  }
View Full Code Here

  @SuppressWarnings("serial")
  @Test
  public void testCommitError() throws Exception {

    taskletStep.setTransactionManager(new ResourcelessTransactionManager() {
      @Override
      protected void doCommit(DefaultTransactionStatus status) throws TransactionException {
        throw new RuntimeException("bar");
      }
View Full Code Here

  @SuppressWarnings("serial")
  @Test
  public void testUnexpectedRollback() throws Exception {

    taskletStep.setTransactionManager(new ResourcelessTransactionManager() {
      @Override
      protected void doCommit(DefaultTransactionStatus status) throws TransactionException {
        super.doRollback(status);
        throw new UnexpectedRollbackException("bar");
      }
View Full Code Here

  @Test
  public void testTransactionalRestart() throws Exception {
    writer.open(executionContext);

    PlatformTransactionManager transactionManager = new ResourcelessTransactionManager();

    new TransactionTemplate(transactionManager).execute(new TransactionCallback<Void>() {
      @Override
      public Void doInTransaction(TransactionStatus status) {
        try {
View Full Code Here

  private void testTransactionalRestartWithMultiByteCharacter(String encoding) throws Exception {
    writer.setEncoding(encoding);
    writer.open(executionContext);

    PlatformTransactionManager transactionManager = new ResourcelessTransactionManager();

    new TransactionTemplate(transactionManager).execute(new TransactionCallback<Void>() {
      @Override
      public Void doInTransaction(TransactionStatus status) {
        try {
View Full Code Here

  }

  @Test
  public void testTransactionalRestartFailOnFirstWrite() throws Exception {

    PlatformTransactionManager transactionManager = new ResourcelessTransactionManager();

    writer.open(executionContext);
    try {
      new TransactionTemplate(transactionManager).execute(new TransactionCallback<Void>() {
        @Override
View Full Code Here

    assertEquals("c", reader.read());
    assertEquals(null, reader.read());
  }

  public void testCommit() throws Exception {
    PlatformTransactionManager transactionManager = new ResourcelessTransactionManager();
    final List<Object> taken = new ArrayList<Object>();
    try {
      new TransactionTemplate(transactionManager).execute(new TransactionCallback<Void>() {
                @Override
        public Void doInTransaction(TransactionStatus status) {
View Full Code Here

    // System.err.println(taken);
    assertFalse(taken.contains("a"));
  }

  public void testTransactionalExhausted() throws Exception {
    PlatformTransactionManager transactionManager = new ResourcelessTransactionManager();
    final List<Object> taken = new ArrayList<Object>();
    new TransactionTemplate(transactionManager).execute(new TransactionCallback<Void>() {
            @Override
      public Void doInTransaction(TransactionStatus status) {
        Object next = reader.read();
View Full Code Here

TOP

Related Classes of org.springframework.batch.support.transaction.ResourcelessTransactionManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.