KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jcorporate > expresso > core > dbobj > tests > RowSecuredDBObjectTest


1 /* ====================================================================
2  * The Jcorporate Apache Style Software License, Version 1.2 05-07-2002
3  *
4  * Copyright (c) 1995-2002 Jcorporate Ltd. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in
15  * the documentation and/or other materials provided with the
16  * distribution.
17  *
18  * 3. The end-user documentation included with the redistribution,
19  * if any, must include the following acknowledgment:
20  * "This product includes software developed by Jcorporate Ltd.
21  * (http://www.jcorporate.com/)."
22  * Alternately, this acknowledgment may appear in the software itself,
23  * if and wherever such third-party acknowledgments normally appear.
24  *
25  * 4. "Jcorporate" and product names such as "Expresso" must
26  * not be used to endorse or promote products derived from this
27  * software without prior written permission. For written permission,
28  * please contact info@jcorporate.com.
29  *
30  * 5. Products derived from this software may not be called "Expresso",
31  * or other Jcorporate product names; nor may "Expresso" or other
32  * Jcorporate product names appear in their name, without prior
33  * written permission of Jcorporate Ltd.
34  *
35  * 6. No product derived from this software may compete in the same
36  * market space, i.e. framework, without prior written permission
37  * of Jcorporate Ltd. For written permission, please contact
38  * partners@jcorporate.com.
39  *
40  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
41  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
42  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
43  * DISCLAIMED. IN NO EVENT SHALL JCORPORATE LTD OR ITS CONTRIBUTORS
44  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
45  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
46  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
47  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
48  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
49  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
50  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51  * SUCH DAMAGE.
52  * ====================================================================
53  *
54  * This software consists of voluntary contributions made by many
55  * individuals on behalf of the Jcorporate Ltd. Contributions back
56  * to the project(s) are encouraged when you make modifications.
57  * Please send them to support@jcorporate.com. For more information
58  * on Jcorporate Ltd. and its products, please see
59  * <http://www.jcorporate.com/>.
60  *
61  * Portions of this software are based upon other open source
62  * products and are subject to their respective licenses.
63  */

64
65 package com.jcorporate.expresso.core.dbobj.tests;
66
67 import com.jcorporate.expresso.core.db.DBConnection;
68 import com.jcorporate.expresso.core.db.DBConnectionPool;
69 import com.jcorporate.expresso.core.db.DBException;
70 import com.jcorporate.expresso.core.db.TableCreator;
71 import com.jcorporate.expresso.core.db.exception.DBRecordNotFoundException;
72 import com.jcorporate.expresso.core.misc.ConfigManager;
73 import com.jcorporate.expresso.core.misc.ConfigurationException;
74 import com.jcorporate.expresso.core.registry.RequestRegistry;
75 import com.jcorporate.expresso.core.security.User;
76 import com.jcorporate.expresso.services.test.TestSystemInitializer;
77 import junit.framework.Test;
78 import junit.framework.TestCase;
79 import junit.framework.TestSuite;
80 import org.apache.log4j.Logger;
81
82 import java.util.Enumeration JavaDoc;
83 import java.util.Vector JavaDoc;
84
85 /**
86  * A test case to verify the functions of DBObject.
87  *
88  * @todo Create test case where you add in one security context,
89  * and try to modify it in another.
90  */

91 public class RowSecuredDBObjectTest
92         extends TestCase {
93
94     private static Logger log = Logger.getLogger(RowSecuredDBObjectTest.class);
95
96     /**
97      * Constructs a test case with the given name.
98      *
99      * @param name The name of the test case
100      */

101     public RowSecuredDBObjectTest(String JavaDoc name) {
102         super(name);
103     } /* DBObjectTest(String) */
104
105
106     public static void main(String JavaDoc[] args)
107             throws Exception JavaDoc {
108
109         //Set the system properties we need
110
junit.textui.TestRunner.run(suite());
111         ConfigManager.destroy();
112     }
113
114     /**
115      * Sets up the fixture, for example, open a network connection.
116      * This method is called before a test is executed.
117      *
118      * @throws Exception upon error
119      */

120     public void setUp()
121             throws Exception JavaDoc {
122         TestSystemInitializer.setUp();
123
124         try {
125             ConfigManager.getContext(TestSystemInitializer.getTestContext());
126         } catch (ConfigurationException ce) {
127             fail(
128                     "Specified context to test:" + TestSystemInitializer.getTestContext() + " but couldn't find that context");
129         }
130
131         RowSecuredDBObjectTestSchema ts = new RowSecuredDBObjectTestSchema();
132         Vector JavaDoc v = TableCreator.getInstance().createAsNeeded(ts, TestSystemInitializer.getTestContext());
133
134         for (Enumeration JavaDoc ev = v.elements(); ev.hasMoreElements();) {
135             log.info((String JavaDoc) ev.nextElement());
136         }
137
138         RequestRegistry.superUser(User.getAdmin(TestSystemInitializer.getTestContext()));
139     } /* setUp() */
140
141
142     /**
143      * Tears down the fixture, for example, close a network connection.
144      * This method is called after a test is executed.
145      *
146      * @throws Exception upon error
147      */

148     public void tearDown()
149             throws Exception JavaDoc {
150         try {
151
152             /* Clean out the test tables */
153             RowSecuredDBObjectTest1 test1List = new RowSecuredDBObjectTest1();
154             test1List.setDataContext(TestSystemInitializer.getTestContext());
155             test1List.deleteAll();
156             RequestRegistry.revertUser();
157
158         } catch (DBException de) {
159             de.printStackTrace();
160             log.error(de);
161         }
162     } /* tearDown() */
163
164     /**
165      * First test: Make sure we're getting permissions transferred to the
166      * RowSecuredDBObject
167      *
168      * @throws DBException upon error.
169      */

170     public void testRequestRegistryWithRowSecuredDBObject() throws DBException {
171         RowSecuredDBObjectTest1 test = new RowSecuredDBObjectTest1();
172         assertEquals(TestSystemInitializer.getTestContext(),
173                 test.getDataContext());
174         assertEquals(User.getAdminId(TestSystemInitializer.getTestContext()),
175                 test.getRequestingUid());
176     }
177
178
179     /**
180      * Tests to make sure get/set fields is working properly Specifically
181      * we also test that fields are appropriately set for null values.
182      */

183     public void testGetSetFields() {
184         try {
185             RowSecuredDBObjectTest1 oneTest = new RowSecuredDBObjectTest1();
186             oneTest.setDataContext(TestSystemInitializer.getTestContext());
187             oneTest.setField("TestKey", "1");
188
189             String JavaDoc value = oneTest.getField("CharTest");
190             assertTrue("Should be getting blank from value",
191                     value == null || value.length() == 0);
192
193             value = oneTest.getField("DecimalTest");
194             assertTrue("Should be getting blank from value",
195                     value == null || value.length() == 0);
196
197             value = oneTest.getField("IntTest");
198             assertTrue("Should be getting blank from value",
199                     value == null || value.length() == 0);
200
201             int testInt = oneTest.getFieldInt("IntTest");
202             assertTrue("Must get zero for blank field IntTest", testInt == 0);
203
204             boolean testBoolean = oneTest.getFieldBoolean("BooleanTest");
205             assertTrue("Must get false for blank field BooleanTest", testBoolean == false);
206
207             java.util.Date JavaDoc dt = oneTest.getFieldDate("DateTest");
208             assertTrue("Should get null date for blank field", dt == null);
209
210             float fl = oneTest.getFieldFloat("FloatTest");
211             assertTrue("Should get zero back for a blank float field", fl == 0.0);
212
213             value = oneTest.getFieldDecimalFormatted("DecimalTest", "######");
214             assertTrue("Should get null back for decimal formatted", value == null);
215
216
217             oneTest.setField("TextTest", "abcdefg");
218             oneTest.setField("BooleanTest", true);
219             oneTest.setField("CharTest", "abcd");
220             oneTest.setField("DecimalTest", "3");
221             oneTest.setField("FloatTest", "3.141");
222             oneTest.setField("IntTest", 123985);
223             oneTest.setField("VarCharTest", "lmnop");
224             oneTest.setField("DateTest", com.jcorporate.expresso.core.misc
225                     .DateTime.getDateForDB());
226
227
228             value = oneTest.getField("CharTest");
229             assertTrue("Should be getting abcd from CharTest got"
230                     + value + " instead", value.equals("abcd"));
231
232             value = oneTest.getField("DecimalTest");
233             assertTrue("Should be getting 3 from value got + " + value + " instead",
234                     value.equals("3"));
235
236             testInt = oneTest.getFieldInt("IntTest");
237             assertTrue("Must get 123985 for blank field IntTest got "
238                     + testInt + " instead", testInt == 123985);
239
240             testBoolean = oneTest.getFieldBoolean("BooleanTest");
241             assertTrue("Must get true for set field BooleanTest", testBoolean = true);
242
243             dt = oneTest.getFieldDate("DateTest");
244             assertTrue("Should not get a null date for set field", dt != null);
245
246             fl = oneTest.getFieldFloat("FloatTest");
247
248             assertTrue("Should get 3.141 for float value got " + fl + " instead",
249                     java.lang.Math.abs(fl - 3.141) < .001);
250
251         } catch (DBException ex) {
252             ex.printStackTrace();
253             fail("Caught exception testing update support" + ex.getMessage());
254         }
255     }
256
257
258     /**
259      * Test Adding the object to the database. We also test adding duplicate
260      * keys to the database
261      */

262     public void testAdd() {
263
264         try {
265
266             /* Add a record */
267             RowSecuredDBObjectTest1 oneTest = new RowSecuredDBObjectTest1();
268             oneTest.setDataContext(TestSystemInitializer.getTestContext());
269             oneTest.setField("TestKey", "1");
270             oneTest.setField("DateTest", "1999-10-01");
271             oneTest.setField("BooleanTest", true);
272             oneTest.setField("CharTest", "abcd");
273             oneTest.setField("DecimalTest", "3");
274             oneTest.setField("FloatTest", "3.141");
275             oneTest.setField("IntTest", 123985);
276             oneTest.setField("VarCharTest", "lmnop");
277
278             oneTest.add();
279             oneTest.clear();
280         } catch (DBException ce) {
281             log.error(ce);
282             fail("DB exception occurred - see log");
283         }
284         /* Try to add a duplicate - make sure it fails */
285         try {
286
287             /* Add a duplicate record */
288             RowSecuredDBObjectTest1 oneTest = new RowSecuredDBObjectTest1();
289             oneTest.setDataContext(TestSystemInitializer.getTestContext());
290             oneTest.setField("TestKey", "1");
291             log.warn(
292                     "About to throw intentional exception having to do with duplicate key. \nIgnore this dup-key exception.");
293             oneTest.add();
294             fail("Test add should have thrown exception on duplicate key here");
295         } catch (DBException ce) {
296
297             /* Do nothing here - it's good that we throw */
298         }
299
300         try {
301             RowSecuredDBObjectTest1 oneTest = new RowSecuredDBObjectTest1();
302             oneTest.setDataContext(TestSystemInitializer.getTestContext());
303             oneTest.setField("TestKey", "1");
304             oneTest.retrieve();
305         } catch (DBException ce) {
306             log.error(ce);
307             fail("DB exception occurred on retrieve test - see log");
308         }
309         try {
310             RowSecuredDBObjectTest1 oneTest = new RowSecuredDBObjectTest1();
311             oneTest.setDataContext(TestSystemInitializer.getTestContext());
312             oneTest.setField("TestKey", "1");
313
314             if (!oneTest.find()) {
315                 fail("DB exception occurred on find test - see log");
316             }
317         } catch (DBException ce) {
318             ce.printStackTrace();
319             log.error(ce);
320             fail("DB exception occurred on find test - see log");
321         }
322     }
323
324     /**
325      * Tests to make sure that we can work with custom where clauses and nothing
326      * breaks.
327      */

328     public void testCustomWhereClause() {
329         try {
330             /* Add a record */
331             RowSecuredDBObjectTest1 oneTest = new RowSecuredDBObjectTest1();
332             oneTest.setDataContext(TestSystemInitializer.getTestContext());
333             oneTest.setField("TestKey", "1");
334             oneTest.add();
335
336             oneTest.clear();
337             oneTest.setCustomWhereClause("TESTKEY = 1");
338             boolean found = oneTest.find();
339             assertTrue("Must find a record", found == true);
340
341             oneTest.clear();
342             oneTest.setCustomWhereClause("TESTKEY = 1");
343             int numRecords = oneTest.count();
344             assertTrue("Must have one record in the database table", numRecords == 1);
345         } catch (DBException ce) {
346             log.error(ce);
347             fail("DB exception occurred - see log");
348         }
349
350     }
351
352     /**
353      * Tests retrieve We also make sure that the exceptions we expect to be
354      * thrown are thrown... such as for bogus key values, keys not set.
355      */

356     public void testRetrieve() {
357         try {
358             /* Add a record */
359             RowSecuredDBObjectTest1 oneTest = new RowSecuredDBObjectTest1();
360             oneTest.setDataContext(TestSystemInitializer.getTestContext());
361             oneTest.setField("TestKey", "1");
362             oneTest.add();
363
364             oneTest.clear();
365             oneTest.setField("TestKey", "1");
366             oneTest.retrieve();
367             assertTrue("Should have proper return value for testkey",
368                     "1".equals(oneTest.getField("TestKey")));
369
370
371             oneTest.clear();
372             oneTest.setField("TestKey", "232");
373             try {
374                 oneTest.retrieve();
375                 fail("Retrieve for bogus key should have thrown DBRecordNotFoundException");
376             } catch (DBRecordNotFoundException ex) {
377                 //we're ok here.
378
}
379
380             oneTest.clear();
381             try {
382                 oneTest.retrieve();
383                 fail("Retrieve with no keys set should have thrown an exception");
384             } catch (DBException dbe) {
385                 //we're ok if we get here.
386
}
387         } catch (DBException ce) {
388             log.error(ce);
389             fail("DB exception occurred - see log");
390         }
391     }
392
393     /**
394      * Tests the 'setFieldsToRetrieve()' functionality.
395      */

396     public void testFieldsToRetrieve() {
397         try {
398             /* Add a record */
399             RowSecuredDBObjectTest1 oneTest = new RowSecuredDBObjectTest1();
400             oneTest.setDataContext(TestSystemInitializer.getTestContext());
401             oneTest.setField("TestKey", "1");
402             oneTest.setField("IntTest", 24);
403             oneTest.setField("FloatTest", "3.141592");
404             oneTest.add();
405
406             oneTest.clear();
407             oneTest.setField("TestKey", "1");
408             oneTest.setFieldsToRetrieve("TestKey|IntTest");
409             oneTest.retrieve();
410             assertTrue("Should have proper return value for testkey",
411                     "1".equals(oneTest.getField("TestKey")));
412
413             assertTrue("Should have retrieved TestInt field:",
414                     24 == oneTest.getFieldInt("IntTest"));
415
416             assertTrue("Should not have retrieved FloatTest:",
417                     oneTest.getDataField("FloatTest").isNull());
418
419             //Now make sure clear() properly resets the fields to retrieve
420
oneTest.clear();
421             oneTest.setField("TestKey", "1");
422             oneTest.clearFieldsToRetrieve();
423             oneTest.retrieve();
424             assertTrue("Should have proper return value for testkey",
425                     "1".equals(oneTest.getField("TestKey")));
426
427             assertTrue("Should have retrieved TestInt field:",
428                     24 == oneTest.getFieldInt("IntTest"));
429
430             assertTrue("Should have retrieved FloatTest:",
431                     !oneTest.getDataField("FloatTest").isNull());
432
433
434         } catch (DBException ce) {
435             log.error(ce);
436             fail("DB exception occurred - see log");
437         }
438
439     }
440
441     /**
442      * This test demonstrates/tests the basic functionality for Text-based
443      * data fields. You set and retrieve the text data as usual and the
444      * underlying framework saves/retrieves the CLOB field when you want it.
445      */

446     public void testCLOBSupport() {
447         final String JavaDoc testString = "LONG Character Update Test";
448         final String JavaDoc testKey = "1";
449         try {
450             RowSecuredDBObjectTest1 oneTest = new RowSecuredDBObjectTest1();
451             oneTest.setDataContext(TestSystemInitializer.getTestContext());
452             oneTest.setField("TestKey", testKey);
453             oneTest.setField("TextTest", testString);
454             oneTest.add();
455
456             oneTest.clear();
457             oneTest.setField("TestKey", testKey);
458             oneTest.retrieve();
459             String JavaDoc fieldData = oneTest.getField("TextTest");
460             assertTrue("CLOB Field data must not be null", fieldData != null);
461
462             assertTrue("CLOB field data must be equal to the original data. Got "
463                     + fieldData + " instead", testString.equals(fieldData));
464
465         } catch (Throwable JavaDoc t) {
466             t.printStackTrace();
467             fail("Caught exception testing CLOB Support: " + t.getMessage());
468         }
469     }
470
471     /**
472      * This test makes sure that special characters such as backslashes
473      * or single quotes get properly escaped so we read them back properly
474      */

475     public void testSpecialCharacters() {
476         final String JavaDoc testString = "' \\ abcdefg";
477         final String JavaDoc testKey = "1";
478
479         try {
480             RowSecuredDBObjectTest1 oneTest = new RowSecuredDBObjectTest1();
481             oneTest.setDataContext(TestSystemInitializer.getTestContext());
482             oneTest.setField("TestKey", testKey);
483             oneTest.setField("VarCharTest", testString);
484             oneTest.setField("CharTest", testString);
485             oneTest.add();
486
487             oneTest.clear();
488             oneTest.setField("TestKey", testKey);
489             oneTest.retrieve();
490             String JavaDoc fieldData = oneTest.getField("VarCharTest");
491             assertTrue("Varchar Field data must not be null", fieldData != null);
492
493             assertTrue("Varchar field data must be equal to the original data. Got "
494                     + fieldData + " instead", testString.equals(fieldData));
495             fieldData = oneTest.getField("CharTest");
496             assertTrue("CharTest Field data must not be null", fieldData != null);
497
498             assertTrue("CharTest field data must be equal to the original data. Got "
499                     + fieldData + " instead", testString.equals(fieldData));
500         } catch (Exception JavaDoc ex) {
501             ex.printStackTrace();
502             fail("Caught exception processing Special Characters "
503                     + ex.getMessage());
504         }
505
506     }
507
508
509     /**
510      * Test Transaction Capabilities
511      */

512     public void testTransactions() {
513         try {
514             DBConnectionPool pool = DBConnectionPool.getInstance(TestSystemInitializer.getTestContext());
515             DBConnection oneConnection = pool.getConnection("Test Transaction");
516             if (!oneConnection.supportsTransactions()) {
517                 log.warn("Cannot test transactions because this DB does not support them.");
518                 oneConnection.release();
519                 return;
520             }
521
522
523             try {
524
525                 // before test, make sure no object exists in db (during autocommit)
526
RowSecuredDBObjectTest1 test1 = new RowSecuredDBObjectTest1(oneConnection,
527                         User.getAdminId(TestSystemInitializer.getTestContext()));
528                 test1.setField("TestKey", 1);
529                 if (test1.find()) test1.delete();
530
531                 //
532
// turn on transaction
533
//
534
oneConnection.setAutoCommit(false);
535
536                 // add item during transaction
537
test1 = new RowSecuredDBObjectTest1(oneConnection,
538                         User.getAdminId(TestSystemInitializer.getTestContext()));
539                 test1.setField("TestKey", 1);
540                 test1.setField("TextTest", "Long Test");
541                 test1.add();
542
543                 //
544
// ok, rollback, which should remove objects
545
//
546
oneConnection.rollback();
547
548                 assertTrue(test1.count() == 0);
549
550                 //
551
//Now add and commit.
552
//
553
test1.setField("TestKey", 1);
554                 test1.setField("TextTest", "Long Test");
555                 test1.add();
556
557                 oneConnection.commit();
558                 assertTrue(test1.count() == 1);
559
560                 //
561
//Try clear, retrieve, update, clear, retrieve, update
562
//
563
test1.clear();
564                 test1.setField("TestKey", 1);
565                 test1.retrieve();
566
567                 test1.setField("TextTest", "Some other value");
568                 test1.update();
569
570                 test1.clear();
571                 test1.setField("TestKey", 1);
572                 test1.setField("TextTest", "Yet another Value");
573                 test1.update();
574
575                 test1.clear();
576                 test1.setField("TestKey", 1);
577                 test1.retrieve();
578
579
580             } catch (DBException dbe) {
581                 try {
582                     oneConnection.rollback();
583                 } catch (DBException ex) {
584                     log.error("Error rolling back transaction");
585                 }
586                 dbe.printStackTrace();
587                 fail("Caught DBException attempting to execute statements");
588             } finally {
589                 pool.release(oneConnection);
590             }
591
592         } catch (Exception JavaDoc ex) {
593             ex.printStackTrace();
594             fail("Caught exception processing TestTransaction "
595                     + ex.getMessage());
596         }
597     }
598
599
600     /**
601      * Tests the DBObject update routine.
602      */

603     public void testUpdate() {
604         try {
605             /* Add a record */
606             RowSecuredDBObjectTest1 oneTest = new RowSecuredDBObjectTest1();
607             oneTest.setDataContext(TestSystemInitializer.getTestContext());
608             oneTest.setField("TestKey", "1");
609             oneTest.add();
610
611             oneTest.setField("TextTest", "abcdefg");
612             oneTest.setField("BooleanTest", true);
613             oneTest.setField("CharTest", "abcd");
614             oneTest.setField("DecimalTest", "3");
615             oneTest.setField("FloatTest", "3.141");
616             oneTest.setField("IntTest", 123985);
617             oneTest.setField("VarCharTest", "lmnop");
618             oneTest.setField("DateTest", "1999-10-01");
619             oneTest.update();
620
621             //Make sure it really was there.
622
oneTest.clear();
623             oneTest.setField("TestKey", "1");
624             if (!oneTest.find()) {
625                 fail("Unable to locate record we just updated");
626             }
627             oneTest.delete();
628         } catch (DBException ex) {
629             ex.printStackTrace();
630             fail("Caught exception testing update support" + ex.getMessage());
631         }
632
633     }
634
635     /**
636      * This function tests adding blank dates since some databases don't tolerate
637      * it very well.
638      */

639     public void testDateAdd() {
640         final String JavaDoc testStringValue = "";
641         final String JavaDoc testKey = "1";
642         try {
643             RowSecuredDBObjectTest1 oneTest = new RowSecuredDBObjectTest1();
644             oneTest.setDataContext(TestSystemInitializer.getTestContext());
645             oneTest.setField("TestKey", testKey);
646             oneTest.setField("DateTest", testStringValue);
647             oneTest.add();
648
649             oneTest.clear();
650             oneTest.setField("TestKey", testKey);
651             oneTest.retrieve();
652
653             String JavaDoc fieldData = oneTest.getField("DateTest");
654             assertTrue(fieldData.equals(testStringValue));
655
656         } catch (Throwable JavaDoc t) {
657             t.printStackTrace();
658             fail("Caught exception testing CLOB Support: " + t.getMessage());
659         }
660     }
661
662     public void testDateSetField() {
663         final String JavaDoc testKey = "1";
664         try {
665             RowSecuredDBObjectTest1 oneTest = new RowSecuredDBObjectTest1();
666             oneTest.setDataContext(TestSystemInitializer.getTestContext());
667             oneTest.setField("TestKey", testKey);
668             oneTest.setField("DateTest", new java.util.Date JavaDoc());
669             oneTest.setField("DateTimeTest", new java.util.Date JavaDoc());
670             oneTest.setField("TimeTest", new java.util.Date JavaDoc());
671             oneTest.add();
672
673             oneTest.clear();
674             oneTest.setField("TestKey", testKey);
675             oneTest.retrieve();
676
677             System.out.println("Date: " + oneTest.getField("DateTest"));
678             System.out.println("DateTime: " + oneTest.getField("DateTimeTest"));
679             System.out.println("Time: " + oneTest.getField("TimeTest"));
680 // assertTrue(fieldData.equals(testStringValue));
681

682         } catch (Throwable JavaDoc t) {
683             t.printStackTrace();
684             fail("Caught exception testing CLOB Support: " + t.getMessage());
685         }
686     }
687
688
689     /**
690      * Define the suite of tests that verify each function of the cache
691      *
692      * @return an instantiated test suite
693      */

694     public static Test suite() {
695         TestSuite suite = new TestSuite(RowSecuredDBObjectTest.class);
696
697         return suite;
698     } /* suite() */
699
700 } /* DBObjectTest */
701
Popular Tags