1 17 18 package org.apache.geronimo.connector.mock; 19 20 import javax.resource.ResourceException ; 21 import javax.resource.spi.LocalTransaction ; 22 23 29 public class MockSPILocalTransaction implements LocalTransaction { 30 31 32 private boolean inTransaction; 33 private boolean begun; 34 private boolean committed; 35 private boolean rolledBack; 36 37 public MockSPILocalTransaction() { 38 } 39 40 public void begin() throws ResourceException { 41 assert !inTransaction; 42 inTransaction = true; 43 begun = true; 44 } 45 46 public void commit() throws ResourceException { 47 assert inTransaction; 48 inTransaction = false; 49 committed = true; 50 } 51 52 public void rollback() throws ResourceException { 53 assert inTransaction; 54 inTransaction = false; 55 rolledBack = true; 56 } 57 58 public void reset() { 59 inTransaction = false; 60 begun = false; 61 committed = false; 62 rolledBack = false; 63 } 64 65 public boolean isInTransaction() { 66 return inTransaction; 67 } 68 69 public boolean isBegun() { 70 return begun; 71 } 72 73 public boolean isCommitted() { 74 return committed; 75 } 76 77 public boolean isRolledBack() { 78 return rolledBack; 79 } 80 } 81 | Popular Tags |