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 {
022 private ConnectorTestModule connectorTestModule;
023 private ConnectorMockObjectFactory connectorMockObjectFactory;
024
025 public BasicConnectorTestCaseAdapter()
026 {
027
028 }
029
030 public BasicConnectorTestCaseAdapter(String name)
031 {
032 super(name);
033 }
034
035 protected void tearDown() throws Exception
036 {
037 super.tearDown();
038 connectorTestModule = null;
039 connectorMockObjectFactory = null;
040 }
041
042 /**
043 * Creates the {@link com.mockrunner.connector.ConnectorTestModule}. If you
044 * overwrite this method, you must call <code>super.setUp()</code>.
045 */
046 protected void setUp() throws Exception
047 {
048 super.setUp();
049 connectorTestModule = createConnectorTestModule(getConnectorMockObjectFactory());
050 }
051
052 /**
053 * Creates a {@link com.mockrunner.mock.connector.cci.ConnectorMockObjectFactory}.
054 * @return the created {@link com.mockrunner.mock.connector.cci.ConnectorMockObjectFactory}
055 */
056 protected ConnectorMockObjectFactory createConnectorMockObjectFactory()
057 {
058 return new ConnectorMockObjectFactory();
059 }
060
061 /**
062 * Gets the {@link com.mockrunner.mock.connector.cci.ConnectorMockObjectFactory}.
063 * @return the {@link com.mockrunner.mock.connector.cci.ConnectorMockObjectFactory}
064 */
065 protected ConnectorMockObjectFactory getConnectorMockObjectFactory()
066 {
067 synchronized(ConnectorMockObjectFactory.class)
068 {
069 if(connectorMockObjectFactory == null)
070 {
071 connectorMockObjectFactory = createConnectorMockObjectFactory();
072 }
073 }
074 return connectorMockObjectFactory;
075 }
076
077 /**
078 * Sets the {@link com.mockrunner.mock.connector.cci.ConnectorMockObjectFactory}.
079 * @param connectorMockObjectFactory the {@link com.mockrunner.mock.connector.cci.ConnectorMockObjectFactory}
080 */
081 protected void setConnectorMockObjectFactory(ConnectorMockObjectFactory connectorMockObjectFactory)
082 {
083 this.connectorMockObjectFactory = connectorMockObjectFactory;
084 }
085
086 /**
087 * Creates a {@link com.mockrunner.connector.ConnectorTestModule} based on the current
088 * {@link com.mockrunner.mock.connector.cci.ConnectorMockObjectFactory}.
089 * Same as <code>createConnectorTestModule(getConnectorMockObjectFactory())</code>.
090 * @return the created {@link com.mockrunner.connector.ConnectorTestModule}
091 */
092 protected ConnectorTestModule createConnectorTestModule()
093 {
094 return new ConnectorTestModule(getConnectorMockObjectFactory());
095 }
096
097 /**
098 * Creates a {@link com.mockrunner.connector.ConnectorTestModule} with the specified
099 * {@link com.mockrunner.mock.connector.cci.ConnectorMockObjectFactory}.
100 * @return the created {@link com.mockrunner.connector.ConnectorTestModule}
101 */
102 protected ConnectorTestModule createConnectorTestModule(ConnectorMockObjectFactory mockFactory)
103 {
104 return new ConnectorTestModule(mockFactory);
105 }
106
107 /**
108 * Gets the {@link com.mockrunner.connector.ConnectorTestModule}.
109 * @return the {@link com.mockrunner.connector.ConnectorTestModule}
110 */
111 protected ConnectorTestModule getConnectorTestModule()
112 {
113 return connectorTestModule;
114 }
115
116 /**
117 * Sets the {@link com.mockrunner.connector.ConnectorTestModule}.
118 * @param connectorTestModule the {@link com.mockrunner.connector.ConnectorTestModule}
119 */
120 protected void setConnectorTestModule(ConnectorTestModule connectorTestModule)
121 {
122 this.connectorTestModule = connectorTestModule;
123 }
124
125 /**
126 * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#verifyConnectionClosed}
127 */
128 protected void verifyConnectionClosed()
129 {
130 connectorTestModule.verifyConnectionClosed();
131 }
132
133 /**
134 * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#getInteractionHandler}
135 */
136 protected InteractionHandler getInteractionHandler()
137 {
138 return connectorTestModule.getInteractionHandler();
139 }
140
141 /**
142 * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#getInteractionList}
143 */
144 protected List getInteractionList()
145 {
146 return connectorTestModule.getInteractionList();
147 }
148
149 /**
150 * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#getCreatedIndexedRecords(String)}
151 */
152 protected List getCreatedIndexedRecords(String recordName)
153 {
154 return connectorTestModule.getCreatedIndexedRecords(recordName);
155 }
156
157 /**
158 * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#getCreatedIndexedRecords}
159 */
160 protected List getCreatedIndexedRecords()
161 {
162 return connectorTestModule.getCreatedIndexedRecords();
163 }
164
165 /**
166 * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#getCreatedMappedRecords(String)}
167 */
168 protected List getCreatedMappedRecords(String recordName)
169 {
170 return connectorTestModule.getCreatedMappedRecords(recordName);
171 }
172
173 /**
174 * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#getCreatedMappedRecords}
175 */
176 protected List getCreatedMappedRecords()
177 {
178 return connectorTestModule.getCreatedMappedRecords();
179 }
180
181 /**
182 * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#verifyAllInteractionsClosed}
183 */
184 protected void verifyAllInteractionsClosed()
185 {
186 connectorTestModule.verifyAllInteractionsClosed();
187 }
188
189 /**
190 * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#verifyInteractionClosed(int)}
191 */
192 protected void verifyInteractionClosed(int index)
193 {
194 connectorTestModule.verifyInteractionClosed(index);
195 }
196
197 /**
198 * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#verifyNumberCreatedIndexedRecords(int)}
199 */
200 protected void verifyNumberCreatedIndexedRecords(int expected)
201 {
202 connectorTestModule.verifyNumberCreatedIndexedRecords(expected);
203 }
204
205 /**
206 * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#verifyNumberCreatedIndexedRecords(String, int)}
207 */
208 protected void verifyNumberCreatedIndexedRecords(String recordName, int expected)
209 {
210 connectorTestModule.verifyNumberCreatedIndexedRecords(recordName, expected);
211 }
212
213 /**
214 * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#verifyNumberCreatedMappedRecords(int)}
215 */
216 protected void verifyNumberCreatedMappedRecords(int expected)
217 {
218 connectorTestModule.verifyNumberCreatedMappedRecords(expected);
219 }
220
221 /**
222 * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#verifyNumberCreatedMappedRecords(String, int)}
223 */
224 protected void verifyNumberCreatedMappedRecords(String recordName, int expected)
225 {
226 connectorTestModule.verifyNumberCreatedMappedRecords(recordName, expected);
227 }
228
229 /**
230 * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#verifyLocalTransactionCommitted}
231 */
232 protected void verifyLocalTransactionCommitted()
233 {
234 connectorTestModule.verifyLocalTransactionCommitted();
235 }
236
237 /**
238 * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#verifyLocalTransactionNotCommitted}
239 */
240 protected void verifyLocalTransactionNotCommitted()
241 {
242 connectorTestModule.verifyLocalTransactionNotCommitted();
243 }
244
245 /**
246 * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#verifyLocalTransactionRolledBack}
247 */
248 protected void verifyLocalTransactionRolledBack()
249 {
250 connectorTestModule.verifyLocalTransactionRolledBack();
251 }
252
253 /**
254 * Delegates to {@link com.mockrunner.connector.ConnectorTestModule#verifyLocalTransactionNotRolledBack}
255 */
256 protected void verifyLocalTransactionNotRolledBack()
257 {
258 connectorTestModule.verifyLocalTransactionNotRolledBack();
259 }
260 }