KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > triactive > jdo > test > QueryFullTest


1 /**
2  * Copyright 2002 (C) TJDO.
3  * All rights reserved.
4  *
5  * This software is distributed under the terms of the TJDO License version 1.0.
6  * See the terms of the TJDO License in the documentation provided with this software.
7  *
8  * $id$
9  *
10  */

11 package com.triactive.jdo.test;
12
13 import java.util.Collection JavaDoc;
14 import java.util.ArrayList JavaDoc;
15 import java.util.Iterator JavaDoc;
16 import java.text.DecimalFormat JavaDoc;
17 import javax.jdo.PersistenceManager;
18 import javax.jdo.Extent;
19 import javax.jdo.Query;
20 import javax.jdo.Transaction;
21
22 import junit.framework.TestCase;
23
24
25 /**
26  * This class contains JUnit tests for JDO Queries
27  */

28 public class QueryFullTest extends PersistenceTestCase
29 {
30
31     // test data
32
private static boolean[] booleanValues = { false, true, false };
33
34     private static byte[] byteValues;
35
36     private static byte[] normalByteValues = { -0x80, 0, 0x7F };
37     private static byte[] positiveByteValues = { 0, 0x3F, 0x7F };
38
39     private static char[] charValues = { 'a', 'm', 'z' };
40     private static short[] shortValues = { -32768, 0, 32767 };
41
42     private static int[] intValues = { -0x80000000, 0, 0x7FFFFFFF };
43     private static long[] longValues = { -8000000000000000L, 0L, 0x7FFFFFFFFFFFFFFFL };
44
45     // max deltas are computed based on the maximum exponent value of the data type
46
// see Java specification section 2nd edition section 2.4.3
47
private static float[] floatDelta = { 1e-6F, 0, 1.0e33f };
48     private static double[] doubleDelta = { 1e-15F, 0, (Math.pow(2, 971) + 1.0F) };
49
50     private static float[] floatValues = { FloatWidget.MIN_FLOAT_VALUE, 1, FloatWidget.MAX_FLOAT_VALUE };
51     private static double[] doubleValues = { FloatWidget.MIN_DOUBLE_VALUE, 1, FloatWidget.MAX_DOUBLE_VALUE};
52
53     private static String JavaDoc[] fixedLengthStringValues = {
54         "fixedLengthString1--",
55         "fixedLengthString2--",
56         "fixedLengthString3--"
57     };
58     private static String JavaDoc[] stringValues = { "stringValue1", "stringValue2", "stringValue3" };
59     private static java.util.Date JavaDoc[] utilDateValues = { new java.util.Date JavaDoc(System.currentTimeMillis()),
60                                    new java.util.Date JavaDoc(System.currentTimeMillis() + 4000L),
61                                    new java.util.Date JavaDoc(System.currentTimeMillis() + 8000L) };
62     private static java.sql.Date JavaDoc[] sqlDateValues = { java.sql.Date.valueOf("2000-01-01"),
63                                               java.sql.Date.valueOf("2001-06-31"),
64                                               java.sql.Date.valueOf("2001-12-31") };
65     private static java.sql.Timestamp JavaDoc[] sqlTimestampValues = { new java.sql.Timestamp JavaDoc(utilDateValues[0].getTime()),
66                                  new java.sql.Timestamp JavaDoc(utilDateValues[1].getTime()),
67                                  new java.sql.Timestamp JavaDoc(utilDateValues[2].getTime()) };
68
69     private static String JavaDoc hugeStringValue;
70
71     // @to-do - this code should be merged with similar code
72
// in com.triactive.jdo.store.test
73
static
74     {
75         StringBuffer JavaDoc s = new StringBuffer JavaDoc();
76         java.util.Random JavaDoc r = new java.util.Random JavaDoc();
77         int length = 1024 * 1024;
78
79         while (length-- > 0)
80         {
81             char nextChar = (char) (' ' + r.nextInt(94));
82             s.append(nextChar);
83         }
84
85         hugeStringValue = s.toString();
86     }
87
88
89
90
91     /**
92      * Used by the JUnit framework to construct tests.
93      *
94      * @param name Name of the <tt>TestCase</tt>.
95      */

96     public QueryFullTest(String JavaDoc name)
97     {
98         super(name);
99     }
100
101
102
103
104
105
106     public void testRelationalOperatorsWithConstantsAndExtentCandidate()
107     {
108         TestDataSet dataset = null;
109         PersistenceManager pm = pmf.getPersistenceManager();
110         Transaction tx = pm.currentTransaction();
111
112         try
113         {
114             Query q =
115               pm.newQuery(pm.getExtent(com.triactive.jdo.test.Primitive.class, false));
116
117             int[][] expectedResultsByOperator = { {1, 0, 2, 1, 3} ,
118                                                   {1, 1, 1, 2, 2} ,
119                                                   {1, 2, 0, 3, 1} };
120
121             dataset = new TestDataSet(q, expectedResultsByOperator);
122
123             tryRelationalOperatorsWithConstants(dataset, tx);
124         }
125         finally
126         {
127             if (tx.isActive())
128                 tx.rollback();
129
130             pm.close();
131         }
132     }
133
134
135     public void testRelationalOperatorsWithConstantsAndNormalCollectionCandidate()
136     {
137         TestDataSet dataset = null;
138         PersistenceManager pm = pmf.getPersistenceManager();
139         Transaction tx = pm.currentTransaction();
140
141         try
142         {
143             // first, get the CollectionFieldTester created in setup
144
Query q = pm.newQuery(pm.getExtent(CollectionFieldTester.class, true));
145
146             int[][] expectedResultsByOperator = { {1, 0, 2, 1, 3} ,
147                                                   {1, 1, 1, 2, 2} ,
148                                                   {1, 2, 0, 3, 1} };
149
150             tx.begin();
151
152             CollectionFieldTester tester;
153             Collection JavaDoc c = (Collection JavaDoc)q.execute();
154
155             try
156             {
157                 assertEquals(1, c.size());
158                 tester = (CollectionFieldTester)c.iterator().next();
159             }
160             finally
161             {
162                 q.closeAll();
163             }
164
165             // next, create a collection candidate data set
166
q = pm.newQuery(Primitive.class, tester.getPrimitiveCollection());
167             tx.commit();
168
169             dataset = new TestDataSet(q, expectedResultsByOperator);
170
171             tryRelationalOperatorsWithConstants(dataset, tx);
172         }
173         finally
174         {
175             if (tx.isActive())
176                 tx.rollback();
177
178             pm.close();
179         }
180     }
181
182
183     public void testRelationalOperatorsWithConstantsAndInverseCollectionCandidate()
184     {
185         TestDataSet dataset = null;
186         PersistenceManager pm = pmf.getPersistenceManager();
187         Transaction tx = pm.currentTransaction();
188
189         try
190         {
191             // first, get the CollectionFieldTester created in setup
192
Query q = pm.newQuery(pm.getExtent(CollectionFieldTester.class, true));
193
194             int[][] expectedResultsByOperator = { {1, 0, 2, 1, 3} ,
195                                                   {1, 1, 1, 2, 2} ,
196                                                   {1, 2, 0, 3, 1} };
197
198             tx.begin();
199
200             CollectionFieldTester tester;
201             Collection JavaDoc c = (Collection JavaDoc)q.execute();
202
203             try
204             {
205                 assertEquals(1, c.size());
206                 tester = (CollectionFieldTester)c.iterator().next();
207             }
208             finally
209             {
210                 q.closeAll();
211             }
212
213             // next, create a collection candidate data set
214
q = pm.newQuery(InversePrimitive.class, tester.getInversePrimitiveCollection());
215             assertTrue(!tester.getInversePrimitiveCollection().isEmpty());
216             tx.commit();
217
218             dataset = new TestDataSet(q, expectedResultsByOperator);
219
220             tryRelationalOperatorsWithConstants(dataset, tx);
221         }
222         finally
223         {
224             if (tx.isActive())
225                 tx.rollback();
226
227             pm.close();
228         }
229     }
230
231
232     /**
233      * Common logic for executing relational operator with constants tests
234      * against various candidate data sets
235      */

236     private void tryRelationalOperatorsWithConstants(TestDataSet dataset, Transaction tx)
237     {
238         String JavaDoc[] operators = { "==", "<", ">", "<=", ">=" };
239
240         // iterate through type value arrays
241
for (int i = 0; i < 3; i++)
242         {
243             // for each type value, iterate through operators
244
for (int j = 0; j < operators.length; j++)
245             {
246                 Query q = dataset.getQuery();
247
248                 Collection JavaDoc collection = null;
249                     ArrayList JavaDoc filterList = genConstantsFiltersList(operators[j], i);
250
251                 for (int l = 0; l < filterList.size(); l++)
252                 {
253                     String JavaDoc filter = (String JavaDoc) filterList.get(l);
254                     q.setFilter(filter);
255                     int expectedCollectionSize = dataset.getResults()[i][j];
256
257                     tx.begin();
258                     collection = (Collection JavaDoc)q.execute();
259
260                     try
261                     {
262                         assertEquals("Wrong result set size: " + filter, expectedCollectionSize, collection.size());
263
264                         Iterator JavaDoc resultsIterator = collection.iterator();
265
266                         while (resultsIterator.hasNext())
267                         {
268                             Primitive p = (Primitive)resultsIterator.next();
269                             assertResult(p, operators[j], i);
270                         }
271                     }
272                     finally
273                     {
274                         q.close(collection);
275                     }
276
277                     tx.commit();
278                 }
279             }
280         }
281     }
282
283
284     private ArrayList JavaDoc genConstantsFiltersList(String JavaDoc qOperator, int valueArrayIndex)
285     {
286         ArrayList JavaDoc filterStringList = new ArrayList JavaDoc();
287         DecimalFormat JavaDoc df = new DecimalFormat JavaDoc("0.0#####E00");
288
289         filterStringList.add("byteField " + qOperator + " " + byteValues[valueArrayIndex]);
290         filterStringList.add("byteObjField " + qOperator + " " + byteValues[valueArrayIndex]);
291         filterStringList.add("charField " + qOperator + " '" + charValues[valueArrayIndex] + "'");
292         filterStringList.add("charObjField " + qOperator + " '" + charValues[valueArrayIndex] + "'");
293         filterStringList.add("shortField " + qOperator + " " + shortValues[valueArrayIndex]);
294         filterStringList.add("shortObjField " + qOperator + " " + shortValues[valueArrayIndex]);
295         filterStringList.add("intField " + qOperator + " " + intValues[valueArrayIndex]);
296         filterStringList.add("intObjField " + qOperator + " " + intValues[valueArrayIndex]);
297         filterStringList.add("longField " + qOperator + " " + longValues[valueArrayIndex]);
298         filterStringList.add("longObjField " + qOperator + " " + longValues[valueArrayIndex]);
299         filterStringList.add("normalString " + qOperator + " \"" +
300             stringValues[valueArrayIndex] + "\"");
301         filterStringList.add("fixedLengthString " + qOperator + " \"" +
302             fixedLengthStringValues[valueArrayIndex] + "\"");
303
304         // note: equality is not tested on floats and doubles due to round
305
// off error
306
if (qOperator.equals("<"))
307         {
308             filterStringList.add("floatField " + qOperator + " " +
309                 df.format(0.5 * floatValues[valueArrayIndex]));
310             filterStringList.add("floatObjField " + qOperator + " " +
311                 df.format(0.5 * floatValues[valueArrayIndex]));
312             filterStringList.add("doubleField " + qOperator + " " +
313                 df.format(0.5 * doubleValues[valueArrayIndex]));
314             filterStringList.add("doubleObjField " + qOperator + " " +
315                 df.format(0.5 * doubleValues[valueArrayIndex]));
316         }
317         else if (qOperator.equals(">"))
318         {
319             filterStringList.add("floatField " + qOperator + " " +
320                 df.format(2 * floatValues[valueArrayIndex]));
321             filterStringList.add("floatObjField " + qOperator + " " +
322                 df.format(2 * floatValues[valueArrayIndex]));
323             filterStringList.add("doubleField " + qOperator + " " +
324                 df.format(2 * doubleValues[valueArrayIndex]));
325             filterStringList.add("doubleObjField " + qOperator + " " +
326                 df.format(2 * doubleValues[valueArrayIndex]));
327         }
328
329         return filterStringList;
330     }
331
332
333     protected void setUp() throws Exception JavaDoc
334     {
335         super.setUp();
336
337         if (TestObject.allowNegativeByteValues)
338             byteValues = normalByteValues;
339         else
340             byteValues = positiveByteValues;
341
342         clearData();
343
344         PersistenceManager pm = pmf.getPersistenceManager();
345         Transaction tx = pm.currentTransaction();
346
347         try
348         {
349             Primitive p;
350             CollectionFieldTester tester = new CollectionFieldTester();
351
352             tx.begin();
353
354             for (int i = 0; i < 3; i++)
355             {
356                 p = new Primitive();
357                 p.setBoolean(booleanValues[i]);
358                 p.setBooleanObject(new Boolean JavaDoc(booleanValues[i]));
359                 p.setByte(byteValues[i]);
360                 p.setByteObject(new Byte JavaDoc(byteValues[i]));
361                 p.setChar(charValues[i]);
362                 p.setCharObject(new Character JavaDoc(charValues[i]));
363                 p.setDouble(doubleValues[i]);
364                 p.setDoubleObject(new Double JavaDoc(doubleValues[i]));
365                 p.setFixedLengthString(fixedLengthStringValues[i]);
366                 p.setFloat(floatValues[i]);
367                 p.setFloatObject(new Float JavaDoc(floatValues[i]));
368                 p.setHugeString(stringValues[i]);
369                 p.setInt(intValues[i]);
370                 p.setIntObject(new Integer JavaDoc(intValues[i]));
371                 p.setLong(longValues[i]);
372                 p.setLongObject(new Long JavaDoc(longValues[i]));
373                 p.setNormalString(stringValues[i]);
374                 p.setShort(shortValues[i]);
375                 p.setShortObject(new Short JavaDoc(shortValues[i]));
376                 p.setSqlDateField(sqlDateValues[i]);
377                 p.setUtilDateField(utilDateValues[i]);
378                 p.setSqlTimestamp(sqlTimestampValues[i]);
379
380                 tester.getPrimitiveCollection().add(p);
381             }
382
383             pm.makePersistent(tester);
384
385             for (int i = 0; i < 3; i++)
386             {
387                 p = new InversePrimitive();
388                 p.setBoolean(booleanValues[i]);
389                 p.setBooleanObject(new Boolean JavaDoc(booleanValues[i]));
390                 p.setByte(byteValues[i]);
391                 p.setByteObject(new Byte JavaDoc(byteValues[i]));
392                 p.setChar(charValues[i]);
393                 p.setCharObject(new Character JavaDoc(charValues[i]));
394                 p.setDouble(doubleValues[i]);
395                 p.setDoubleObject(new Double JavaDoc(doubleValues[i]));
396                 p.setFixedLengthString(fixedLengthStringValues[i]);
397                 p.setFloat(floatValues[i]);
398                 p.setFloatObject(new Float JavaDoc(floatValues[i]));
399                 p.setHugeString(stringValues[i]);
400                 p.setInt(intValues[i]);
401                 p.setIntObject(new Integer JavaDoc(intValues[i]));
402                 p.setLong(longValues[i]);
403                 p.setLongObject(new Long JavaDoc(longValues[i]));
404                 p.setNormalString(stringValues[i]);
405                 p.setShort(shortValues[i]);
406                 p.setShortObject(new Short JavaDoc(shortValues[i]));
407                 p.setSqlDateField(sqlDateValues[i]);
408                 p.setUtilDateField(utilDateValues[i]);
409                 p.setSqlTimestamp(sqlTimestampValues[i]);
410
411                 tester.getInversePrimitiveCollection().add(p);
412             }
413
414
415             tx.commit();
416         }
417         finally
418         {
419             if (tx.isActive())
420                 tx.rollback();
421
422             pm.close();
423         }
424
425     }
426
427
428     public void tearDown() throws Exception JavaDoc
429     {
430         super.tearDown();
431         clearData();
432     }
433
434     protected void clearData()
435     {
436         Extent ext = null;
437         java.util.Iterator JavaDoc it = null;
438         PersistenceManager pm = pmf.getPersistenceManager();
439         Transaction tx = pm.currentTransaction();
440
441         try
442         {
443           // delete all InversePrimitive objects
444
tx.begin();
445
446           ext = pm.getExtent(InversePrimitive.class, false);
447           it = ext.iterator();
448
449           while (it.hasNext())
450           {
451             InversePrimitive ip = (InversePrimitive) it.next();
452             pm.deletePersistent(ip);
453           }
454
455           tx.commit();
456
457
458           // delete all CollectionFieldTester objects
459
tx.begin();
460
461           ext = pm.getExtent(CollectionFieldTester.class, false);
462           it = ext.iterator();
463
464           while (it.hasNext())
465           {
466             CollectionFieldTester t = (CollectionFieldTester) it.next();
467             t.getPrimitiveCollection().clear();
468             pm.deletePersistent(t);
469           }
470
471           tx.commit();
472
473           // delete all Primative objects
474
tx.begin();
475
476           ext = pm.getExtent(Primitive.class, false);
477           it = ext.iterator();
478
479           while (it.hasNext())
480           {
481             Primitive p = (Primitive) it.next();
482             pm.deletePersistent(p);
483           }
484
485           tx.commit();
486
487           // disassociate all Employees and Departments from their Managers
488
tx.begin();
489
490           ext = pm.getExtent(com.triactive.jdo.test.Manager.class, false);
491           it = ext.iterator();
492
493           while (it.hasNext())
494           {
495             Manager mgr = (Manager) it.next();
496             mgr.getSubordinates().clear();
497             mgr.getDepartments().clear();
498           }
499
500           tx.commit();
501
502           // delete all Employee objects
503
tx.begin();
504
505           ext = pm.getExtent(Employee.class, false);
506           it = ext.iterator();
507
508           while (it.hasNext())
509           {
510             Employee emp = (Employee) it.next();
511             pm.deletePersistent(emp);
512           }
513
514           tx.commit();
515           tx.begin();
516
517           // dekete all Department objects
518
ext = pm.getExtent(Department.class, false);
519           it = ext.iterator();
520
521           while (it.hasNext())
522           {
523             Department d = (Department) it.next();
524             pm.deletePersistent(d);
525           }
526
527           tx.commit();
528
529           // delete all Manager objects
530
tx.begin();
531
532           ext = pm.getExtent(Manager.class, false);
533           it = ext.iterator();
534
535           while (it.hasNext())
536           {
537             Manager mgr = (Manager) it.next();
538             pm.deletePersistent(mgr);
539           }
540
541           tx.commit();
542
543           // delete all Person objects
544
tx.begin();
545
546           ext = pm.getExtent(Person.class, true);
547           it = ext.iterator();
548
549           while (it.hasNext())
550           {
551             Person person = (Person) it.next();
552             pm.deletePersistent(person);
553           }
554
555           tx.commit();
556         }
557         finally
558         {
559           if (tx.isActive())
560               tx.rollback();
561
562           pm.close();
563         }
564     }
565
566
567
568     /**
569      * This is basically a struct use to pair a Query object with a the
570      * expected size of the resulting Collection when the query is run.
571      */

572     class TestDataSet
573     {
574         private Query query;
575         private int[][] resultArray;
576
577         TestDataSet(Query q, int[][] results)
578         {
579             query = q;
580             resultArray = results;
581         }
582
583         public Query getQuery()
584         {
585             return query;
586         }
587
588         public int[][] getResults()
589         {
590             return resultArray;
591         }
592
593     }
594
595
596     private void assertResult(Primitive p, String JavaDoc op, int i)
597     {
598
599         if (op.equals("=="))
600         {
601             assertEquals(booleanValues[i], p.getBoolean());
602             assertEquals(booleanValues[i], p.getBooleanObject().booleanValue());
603             assertEquals(byteValues[i], p.getByte());
604             assertEquals(byteValues[i], p.getByteObject().byteValue());
605             assertEquals(charValues[i], p.getChar());
606             assertEquals(charValues[i], p.getCharObject().charValue());
607             assertTrue(FloatWidget.approximates(doubleValues[i], p.getDouble()));
608             assertTrue(FloatWidget.approximates(doubleValues[i], p.getDoubleObject().doubleValue()));
609             assertEquals(fixedLengthStringValues[i], p.getFixedLengthString());
610             assertTrue(FloatWidget.approximates(floatValues[i], p.getFloat()));
611             assertTrue(FloatWidget.approximates(floatValues[i], p.getFloatObject().floatValue()));
612             assertEquals(stringValues[i], p.getHugeString());
613             assertEquals(intValues[i], p.getInt());
614             assertEquals(intValues[i], p.getIntObject().intValue());
615             assertEquals(longValues[i], p.getLong());
616             assertEquals(longValues[i], p.getLongObject().longValue());
617             assertEquals(stringValues[i], p.getNormalString());
618             assertEquals(shortValues[i], p.getShort());
619             assertEquals(shortValues[i], p.getShortObject().shortValue());
620             assertEquals(utilDateValues[i].getTime() / 1000, p.getUtilDateField().getTime() / 1000);
621             assertEquals(sqlDateValues[i], p.getSqlDateField());
622             assertEquals(sqlTimestampValues[i].getTime() / 1000, p.getSqlTimestamp().getTime() / 1000);
623         }
624         else if (op.equals("<="))
625         {
626             assertTrue(p.getByte() <= byteValues[i]);
627             assertTrue(p.getByteObject().byteValue() <= byteValues[i]);
628             assertTrue(p.getChar() <= charValues[i]);
629             assertTrue(p.getCharObject().charValue() <= charValues[i]);
630 // assertTrue(p.getDouble(), doubleValues[i], doubleDelta[i]);
631
// assertTrue(p.getDoubleObject().doubleValue(), doubleValues[i], doubleDelta[i]);
632
assertTrue(p.getFixedLengthString().compareTo(fixedLengthStringValues[i]) <= 0);
633 // assertTrue(p.getFloat() <= floatValues[i]);
634
// assertTrue(p.getFloatObject().floatValue() <= floatValues[i]);
635
assertTrue(p.getHugeString().compareTo(stringValues[i]) <= 0);
636             assertTrue(p.getInt() <= intValues[i]);
637             assertTrue(p.getIntObject().intValue() <= intValues[i]);
638             assertTrue(p.getLong() <= longValues[i]);
639             assertTrue(p.getLongObject().longValue() <= longValues[i]);
640             assertTrue(p.getNormalString().compareTo(stringValues[i]) <= 0);
641             assertTrue(p.getShort() <= shortValues[i]);
642             assertTrue(p.getShortObject().shortValue() <= shortValues[i]);
643             assertTrue(p.getUtilDateField().getTime() / 1000 <= utilDateValues[i].getTime() / 1000);
644             assertTrue(p.getSqlDateField().compareTo(sqlDateValues[i]) <= 0);
645             assertTrue(p.getSqlTimestamp().getTime() / 1000 <= sqlTimestampValues[i].getTime() / 1000);
646         }
647         else if (op.equals(">="))
648         {
649             assertTrue(p.getByte() >= byteValues[i]);
650             assertTrue(p.getByteObject().byteValue() >= byteValues[i]);
651             assertTrue(p.getChar() >= charValues[i]);
652             assertTrue(p.getCharObject().charValue() >= charValues[i]);
653 // assertTrue(p.getDouble(), doubleValues[i], doubleDelta[i]);
654
// assertTrue(p.getDoubleObject().doubleValue(), doubleValues[i], doubleDelta[i]);
655
assertTrue(p.getFixedLengthString().compareTo(fixedLengthStringValues[i]) >= 0);
656 // assertTrue(p.getFloat() >= floatValues[i]);
657
// assertTrue(p.getFloatObject().floatValue() >= floatValues[i]);
658
assertTrue(p.getHugeString().compareTo(stringValues[i]) >= 0);
659             assertTrue(p.getInt() >= intValues[i]);
660             assertTrue(p.getIntObject().intValue() >= intValues[i]);
661             assertTrue(p.getLong() >= longValues[i]);
662             assertTrue(p.getLongObject().longValue() >= longValues[i]);
663             assertTrue(p.getNormalString().compareTo(stringValues[i]) >= 0);
664             assertTrue(p.getShort() >= shortValues[i]);
665             assertTrue(p.getShortObject().shortValue() >= shortValues[i]);
666             assertTrue(p.getUtilDateField().getTime() / 1000 >= utilDateValues[i].getTime() / 1000);
667             assertTrue(p.getSqlDateField().compareTo(sqlDateValues[i]) >= 0);
668             assertTrue(p.getSqlTimestamp().getTime() / 1000 >= sqlTimestampValues[i].getTime() / 1000);
669         }
670         else if (op.equals("<"))
671         {
672             assertTrue(p.getByte() < byteValues[i]);
673             assertTrue(p.getByteObject().byteValue() < byteValues[i]);
674             assertTrue(p.getChar() < charValues[i]);
675             assertTrue(p.getCharObject().charValue() < charValues[i]);
676             assertTrue(p.getDouble() < doubleValues[i]);
677             assertTrue(p.getDoubleObject().doubleValue() < doubleValues[i]);
678             assertTrue(p.getFixedLengthString().compareTo(fixedLengthStringValues[i]) < 0);
679             assertTrue(p.getFloat() < floatValues[i]);
680             assertTrue(p.getFloatObject().floatValue() < floatValues[i]);
681             assertTrue(p.getHugeString().compareTo(stringValues[i]) < 0);
682             assertTrue(p.getInt() < intValues[i]);
683             assertTrue(p.getIntObject().intValue() < intValues[i]);
684             assertTrue(p.getLong() < longValues[i]);
685             assertTrue(p.getLongObject().longValue() < longValues[i]);
686             assertTrue(p.getNormalString().compareTo(stringValues[i]) < 0);
687             assertTrue(p.getShort() < shortValues[i]);
688             assertTrue(p.getShortObject().shortValue() < shortValues[i]);
689             assertTrue(p.getUtilDateField().getTime() / 1000 < utilDateValues[i].getTime() / 1000);
690             assertTrue(p.getSqlDateField().compareTo(sqlDateValues[i]) < 0);
691             assertTrue(p.getSqlTimestamp().getTime() / 1000 < sqlTimestampValues[i].getTime() / 1000);
692         }
693         else if (op.equals(">"))
694         {
695             assertTrue(p.getByte() > byteValues[i]);
696             assertTrue(p.getByteObject().byteValue() > byteValues[i]);
697             assertTrue(p.getChar() > charValues[i]);
698             assertTrue(p.getCharObject().charValue() > charValues[i]);
699             assertTrue(p.getDouble() > doubleValues[i]);
700             assertTrue(p.getDoubleObject().doubleValue() > doubleValues[i]);
701             assertTrue(p.getFixedLengthString().compareTo(fixedLengthStringValues[i]) > 0);
702             assertTrue(p.getFloat() > floatValues[i]);
703             assertTrue(p.getFloatObject().floatValue() > floatValues[i]);
704             assertTrue(p.getHugeString().compareTo(stringValues[i]) > 0);
705             assertTrue(p.getInt() > intValues[i]);
706             assertTrue(p.getIntObject().intValue() > intValues[i]);
707             assertTrue(p.getLong() > longValues[i]);
708             assertTrue(p.getLongObject().longValue() > longValues[i]);
709             assertTrue(p.getNormalString().compareTo(stringValues[i]) > 0);
710             assertTrue(p.getShort() > shortValues[i]);
711             assertTrue(p.getShortObject().shortValue() > shortValues[i]);
712             assertTrue(p.getUtilDateField().getTime() / 1000 > utilDateValues[i].getTime() / 1000);
713             assertTrue(p.getSqlDateField().compareTo(sqlDateValues[i]) > 0);
714             assertTrue(p.getSqlTimestamp().getTime() / 1000 > sqlTimestampValues[i].getTime() / 1000);
715         }
716     }
717 }
718
Popular Tags