Source code: com/tripi/asp/test/ADODBTest.java
1 /**
2 * ArrowHead ASP Server
3 * This is a source file for the ArrowHead ASP Server - an 100% Java
4 * VBScript interpreter and ASP server.
5 *
6 * For more information, see http://www.tripi.com/arrowhead
7 *
8 * Copyright (C) 2002 Terence Haddock
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 */
25 package com.tripi.asp.test;
26
27 import com.tripi.asp.AspException;
28 import com.tripi.asp.Constants;
29 import com.tripi.asp.IdentNode;
30 import junit.framework.*;
31 import java.io.IOException;
32
33 /**
34 * The MiscTest class contains the unit tests for ASP operators
35 * @author Terence Haddock
36 */
37 public class ADODBTest
38 {
39 /**
40 * JUnit test suite factory. Returns a test suite containing this
41 * class's tests.
42 * @return new test suite
43 */
44 public static Test suite()
45 {
46 TestSuite suite = new TestSuite("ADODB test");
47 suite.addTest(new TestSuite(ConnectionTest.class));
48 suite.addTest(new TestSuite(CommandTest.class));
49 suite.addTest(new TestSuite(RecordSetTest.class));
50 suite.addTest(new TestSuite(FieldTest.class));
51 return suite;
52 }
53
54 /**
55 * This class contains the connection object tests
56 */
57 public static class ConnectionTest extends TestCase
58 {
59 /**
60 * Test suite constructor.
61 * @param name test name
62 */
63 public ConnectionTest(String name) throws AspException
64 {
65 super(name);
66 }
67
68 /** Cursor Location test 1 */
69 public void test_cursorlocation1() throws IOException
70 {
71 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
72 "test-connection-cursorlocation1"));
73 }
74
75 /** Errors test 1 */
76 public void test_errors1() throws IOException
77 {
78 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
79 "test-connection-errors1"));
80 }
81
82 /** Execute test 1 */
83 public void test_execute1() throws IOException
84 {
85 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
86 "test-connection-execute1"));
87 }
88
89 /** Execute test 2 */
90 public void test_execute2() throws IOException
91 {
92 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
93 "test-connection-execute2"));
94 }
95
96 /** Fields test 1 */
97 /* XXX Not yet implemented
98 public void test_fields1() throws IOException
99 {
100 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
101 "test-connection-fields1"));
102 }
103 */
104
105 /** Open test 1 */
106 public void test_open1() throws IOException
107 {
108 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
109 "test-connection-open1"));
110 }
111
112 /** Open test 2 */
113 public void test_open2() throws IOException
114 {
115 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
116 "test-connection-open2"));
117 }
118
119 /** Open test 3 */
120 public void test_open3() throws IOException
121 {
122 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
123 "test-connection-open3"));
124 }
125
126 /** OpenSchema test 1 */
127 /* XXX Not yet implemented
128 public void test_openschema1() throws IOException
129 {
130 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
131 "test-connection-openschema1"));
132 }
133 */
134
135 /** Properties test 1 */
136 /* XXX Not yet implemented
137 public void test_properties1() throws IOException
138 {
139 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
140 "test-connection-properties1"));
141 }
142 */
143
144 /** State test 1 */
145 public void test_state1() throws IOException
146 {
147 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
148 "test-connection-state1"));
149 }
150
151 /** Transactions test 1 */
152 public void test_transactions1() throws IOException
153 {
154 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
155 "test-connection-transactions1"));
156 }
157
158 /** Transactions test 2 */
159 public void test_transactions2() throws IOException
160 {
161 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
162 "test-connection-transactions2"));
163 }
164 }
165
166 /**
167 * This class contains the ADODB.Command object tests
168 */
169 public static class CommandTest extends TestCase
170 {
171 /**
172 * Test suite constructor.
173 * @param name test name
174 */
175 public CommandTest(String name) throws AspException
176 {
177 super(name);
178 }
179
180 /** Active Connection test 1 */
181 public void test_activeconnection1() throws IOException
182 {
183 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
184 "test-command-activeconnection1"));
185 }
186
187 /** Active Connection test 2 */
188 public void test_activeconnection2() throws IOException
189 {
190 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
191 "test-command-activeconnection2"));
192 }
193
194 /** Execute test 1 */
195 public void test_execute1() throws IOException
196 {
197 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
198 "test-command-execute1"));
199 }
200 }
201
202 /**
203 * This class contains the recordset object tests
204 */
205 public static class RecordSetTest extends TestCase
206 {
207 /**
208 * Test suite constructor.
209 * @param name test name
210 */
211 public RecordSetTest(String name) throws AspException
212 {
213 super(name);
214 }
215
216 /** Execute activerecordset1 */
217 public void test_activerecordset1() throws IOException
218 {
219 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
220 "test-recordset-activecommand1"));
221 }
222
223 /** Execute activeconnection1 */
224 public void test_activeconnection1() throws IOException
225 {
226 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
227 "test-recordset-activeconnection1"));
228 }
229
230 /** Execute addnew1 */
231 public void test_addnew1() throws IOException
232 {
233 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
234 "test-recordset-addnew1"));
235 }
236
237 /** Execute addnew2 */
238 public void test_addnew2() throws IOException
239 {
240 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
241 "test-recordset-addnew2"));
242 }
243
244 /** Execute bof1 */
245 public void test_bof1() throws IOException
246 {
247 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
248 "test-recordset-bof1"));
249 }
250
251 /** Execute bof2 */
252 public void test_bof2() throws IOException
253 {
254 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
255 "test-recordset-bof2"));
256 }
257
258 /** Execute cancelupdate1 */
259 public void test_cancelupdate1() throws IOException
260 {
261 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
262 "test-recordset-cancelupdate1"));
263 }
264
265 /** Execute move1 */
266 public void test_move1() throws IOException
267 {
268 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
269 "test-recordset-move1"));
270 }
271
272 /** Execute move2 */
273 public void test_move2() throws IOException
274 {
275 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
276 "test-recordset-move2"));
277 }
278
279 /** Execute paging1 */
280 public void test_paging1() throws IOException
281 {
282 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
283 "test-recordset-paging1"));
284 }
285
286 /** Execute position1 */
287 public void test_position1() throws IOException
288 {
289 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
290 "test-recordset-position1"));
291 }
292
293 /** Execute requery1 */
294 public void test_requery1() throws IOException
295 {
296 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
297 "test-recordset-requery1"));
298 }
299
300 /** Execute update1 */
301 public void test_update1() throws IOException
302 {
303 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
304 "test-recordset-update1"));
305 }
306 }
307
308 /**
309 * This class contains the field object tests
310 */
311 public static class FieldTest extends TestCase
312 {
313 /**
314 * Test suite constructor.
315 * @param name test name
316 */
317 public FieldTest(String name) throws AspException
318 {
319 super(name);
320 }
321
322 /** Execute actualsize1 */
323 public void test_actualsize1() throws IOException
324 {
325 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
326 "test-field-actualsize1"));
327 }
328
329 /** Execute attributes1 */
330 /* XXX TODO
331 public void test_attributes1() throws IOException
332 {
333 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
334 "test-field-attributes1"));
335 }
336 */
337
338 /** Test Fields.Count */
339 public void test_fieldscount1() throws IOException
340 {
341 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
342 "test-field-count1"));
343 }
344
345 /** Execute definedsize1 */
346 public void test_definedsize1() throws IOException
347 {
348 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
349 "test-field-definedsize1"));
350 }
351
352 /** Execute name1 */
353 public void test_name1() throws IOException
354 {
355 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
356 "test-field-name1"));
357 }
358
359 /** Execute numericscale1 */
360 public void test_numericscale1() throws IOException
361 {
362 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
363 "test-field-numericscale1"));
364 }
365
366 /** Execute originalvalue1 */
367 /* XXX TODO
368 public void test_originalvalue1() throws IOException
369 {
370 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
371 "test-field-originalvalue1"));
372 }
373 */
374
375 /** Execute precision1 */
376 public void test_precision1() throws IOException
377 {
378 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
379 "test-field-precision1"));
380 }
381
382 /** Execute type1 */
383 /* XXX TODO
384 public void test_type1() throws IOException
385 {
386 Assert.assertTrue(AspTest.doSimpleTest("ADODB",
387 "test-field-type1"));
388 }
389 */
390 }
391 }