001: package com.mockrunner.connector;
002:
003: import java.util.List;
004:
005: import junit.framework.TestCase;
006:
007: import com.mockrunner.mock.connector.cci.ConnectorMockObjectFactory;
008:
009: /**
010: * Delegator for {@link com.mockrunner.connector.ConnectorTestModule}. You can
011: * subclass this adapter or use {@link com.mockrunner.connector.ConnectorTestModule}
012: * directly (so your test case can use another base class).
013: * This basic adapter can be used if you don't need any other modules. It
014: * does not extend {@link com.mockrunner.base.BaseTestCase}. If you want
015: * to use several modules in conjunction, consider subclassing
016: * {@link com.mockrunner.connector.ConnectorTestCaseAdapter}.
017: * <b>This class is generated from the {@link com.mockrunner.connector.ConnectorTestModule}
018: * and should not be edited directly</b>.
019: */
020: public abstract class BasicConnectorTestCaseAdapter extends TestCase {
021: private ConnectorTestModule connectorTestModule;
022: private ConnectorMockObjectFactory connectorMockObjectFactory;
023:
024: public BasicConnectorTestCaseAdapter() {
025:
026: }
027:
028: public BasicConnectorTestCaseAdapter(String name) {
029: super (name);
030: }
031:
032: protected void tearDown() throws Exception {
033: super .tearDown();
034: connectorTestModule = null;
035: connectorMockObjectFactory = null;
036: }
037:
038: /**
039: * Creates the {@link com.mockrunner.connector.ConnectorTestModule}. If you
040: * overwrite this method, you must call <code>super.setUp()</code>.
041: */
042: protected void setUp() throws Exception {
043: super .setUp();
044: connectorTestModule = createConnectorTestModule(getConnectorMockObjectFactory());
045: }
046:
047: /**
048: * Creates a {@link com.mockrunner.mock.connector.cci.ConnectorMockObjectFactory}.
049: * @return the created {@link com.mockrunner.mock.connector.cci.ConnectorMockObjectFactory}
050: */
051: protected ConnectorMockObjectFactory createConnectorMockObjectFactory() {
052: return new ConnectorMockObjectFactory();
053: }
054:
055: /**
056: * Gets the {@link com.mockrunner.mock.connector.cci.ConnectorMockObjectFactory}.
057: * @return the {@link com.mockrunner.mock.connector.cci.ConnectorMockObjectFactory}
058: */
059: protected ConnectorMockObjectFactory getConnectorMockObjectFactory() {
060: synchronized (ConnectorMockObjectFactory.class) {
061: if (connectorMockObjectFactory == null) {
062: connectorMockObjectFactory = createConnectorMockObjectFactory();
063: }
064: }
065: return connectorMockObjectFactory;
066: }
067:
068: /**
069: * Sets the {@link com.mockrunner.mock.connector.cci.ConnectorMockObjectFactory}.
070: * @param connectorMockObjectFactory the {@link com.mockrunner.mock.connector.cci.ConnectorMockObjectFactory}
071: */
072: protected void setConnectorMockObjectFactory(
073: ConnectorMockObjectFactory connectorMockObjectFactory) {
074: this .connectorMockObjectFactory = connectorMockObjectFactory;
075: }
076:
077: /**
078: * Creates a {@link com.mockrunner.connector.ConnectorTestModule} based on the current
079: * {@link com.mockrunner.mock.connector.cci.ConnectorMockObjectFactory}.
080: * Same as <code>createConnectorTestModule(getConnectorMockObjectFactory())</code>.
081: * @return the created {@link com.mockrunner.connector.ConnectorTestModule}
082: */
083: protected ConnectorTestModule createConnectorTestModule() {
084: return new ConnectorTestModule(getConnectorMockObjectFactory());
085: }
086:
087: /**
088: * Creates a {@link com.mockrunner.connector.ConnectorTestModule} with the specified
089: * {@link com.mockrunner.mock.connector.cci.ConnectorMockObjectFactory}.
090: * @return the created {@link com.mockrunner.connector.ConnectorTestModule}
091: */
092: protected ConnectorTestModule createConnectorTestModule(
093: ConnectorMockObjectFactory mockFactory) {
094: return new ConnectorTestModule(mockFactory);
095: }
096:
097: /**
098: * Gets the {@link com.mockrunner.connector.ConnectorTestModule}.
099: * @return the {@link com.mockrunner.connector.ConnectorTestModule}
100: */
101: protected ConnectorTestModule getConnectorTestModule() {
102: return connectorTestModule;
103: }
104:
105: /**
106: * Sets the {@link com.mockrunner.connector.ConnectorTestModule}.
107: * @param connectorTestModule the {@link com.mockrunner.connector.ConnectorTestModule}
108: */
109: protected void setConnectorTestModule(
110: ConnectorTestModule connectorTestModule) {
111: this .connectorTestModule = connectorTestModule;
112: }
113:
114: /**
115: * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#verifyConnectionClosed}
116: */
117: protected void verifyConnectionClosed() {
118: connectorTestModule.verifyConnectionClosed();
119: }
120:
121: /**
122: * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#getInteractionHandler}
123: */
124: protected InteractionHandler getInteractionHandler() {
125: return connectorTestModule.getInteractionHandler();
126: }
127:
128: /**
129: * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#getInteractionList}
130: */
131: protected List getInteractionList() {
132: return connectorTestModule.getInteractionList();
133: }
134:
135: /**
136: * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#getCreatedIndexedRecords(String)}
137: */
138: protected List getCreatedIndexedRecords(String recordName) {
139: return connectorTestModule.getCreatedIndexedRecords(recordName);
140: }
141:
142: /**
143: * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#getCreatedIndexedRecords}
144: */
145: protected List getCreatedIndexedRecords() {
146: return connectorTestModule.getCreatedIndexedRecords();
147: }
148:
149: /**
150: * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#getCreatedMappedRecords(String)}
151: */
152: protected List getCreatedMappedRecords(String recordName) {
153: return connectorTestModule.getCreatedMappedRecords(recordName);
154: }
155:
156: /**
157: * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#getCreatedMappedRecords}
158: */
159: protected List getCreatedMappedRecords() {
160: return connectorTestModule.getCreatedMappedRecords();
161: }
162:
163: /**
164: * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#verifyAllInteractionsClosed}
165: */
166: protected void verifyAllInteractionsClosed() {
167: connectorTestModule.verifyAllInteractionsClosed();
168: }
169:
170: /**
171: * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#verifyInteractionClosed(int)}
172: */
173: protected void verifyInteractionClosed(int index) {
174: connectorTestModule.verifyInteractionClosed(index);
175: }
176:
177: /**
178: * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#verifyNumberCreatedIndexedRecords(int)}
179: */
180: protected void verifyNumberCreatedIndexedRecords(int expected) {
181: connectorTestModule.verifyNumberCreatedIndexedRecords(expected);
182: }
183:
184: /**
185: * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#verifyNumberCreatedIndexedRecords(String, int)}
186: */
187: protected void verifyNumberCreatedIndexedRecords(String recordName,
188: int expected) {
189: connectorTestModule.verifyNumberCreatedIndexedRecords(
190: recordName, expected);
191: }
192:
193: /**
194: * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#verifyNumberCreatedMappedRecords(int)}
195: */
196: protected void verifyNumberCreatedMappedRecords(int expected) {
197: connectorTestModule.verifyNumberCreatedMappedRecords(expected);
198: }
199:
200: /**
201: * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#verifyNumberCreatedMappedRecords(String, int)}
202: */
203: protected void verifyNumberCreatedMappedRecords(String recordName,
204: int expected) {
205: connectorTestModule.verifyNumberCreatedMappedRecords(
206: recordName, expected);
207: }
208:
209: /**
210: * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#verifyLocalTransactionCommitted}
211: */
212: protected void verifyLocalTransactionCommitted() {
213: connectorTestModule.verifyLocalTransactionCommitted();
214: }
215:
216: /**
217: * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#verifyLocalTransactionNotCommitted}
218: */
219: protected void verifyLocalTransactionNotCommitted() {
220: connectorTestModule.verifyLocalTransactionNotCommitted();
221: }
222:
223: /**
224: * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#verifyLocalTransactionRolledBack}
225: */
226: protected void verifyLocalTransactionRolledBack() {
227: connectorTestModule.verifyLocalTransactionRolledBack();
228: }
229:
230: /**
231: * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#verifyLocalTransactionNotRolledBack}
232: */
233: protected void verifyLocalTransactionNotRolledBack() {
234: connectorTestModule.verifyLocalTransactionNotRolledBack();
235: }
236: }
|