01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.geronimo.connector.mock;
17:
18: import javax.resource.ResourceException;
19: import javax.resource.spi.LocalTransaction;
20:
21: /**
22: *
23: *
24: * @version $Rev: 476049 $ $Date: 2006-11-16 20:35:17 -0800 (Thu, 16 Nov 2006) $
25: *
26: * */
27: public class MockSPILocalTransaction implements LocalTransaction {
28:
29: private boolean inTransaction;
30: private boolean begun;
31: private boolean committed;
32: private boolean rolledBack;
33:
34: public MockSPILocalTransaction() {
35: }
36:
37: public void begin() throws ResourceException {
38: assert !inTransaction;
39: inTransaction = true;
40: begun = true;
41: }
42:
43: public void commit() throws ResourceException {
44: assert inTransaction;
45: inTransaction = false;
46: committed = true;
47: }
48:
49: public void rollback() throws ResourceException {
50: assert inTransaction;
51: inTransaction = false;
52: rolledBack = true;
53: }
54:
55: public void reset() {
56: inTransaction = false;
57: begun = false;
58: committed = false;
59: rolledBack = false;
60: }
61:
62: public boolean isInTransaction() {
63: return inTransaction;
64: }
65:
66: public boolean isBegun() {
67: return begun;
68: }
69:
70: public boolean isCommitted() {
71: return committed;
72: }
73:
74: public boolean isRolledBack() {
75: return rolledBack;
76: }
77: }
|