001: /**
002: * Copyright 2002 (C) TJDO.
003: * All rights reserved.
004: *
005: * This software is distributed under the terms of the TJDO License version 1.0.
006: * See the terms of the TJDO License in the documentation provided with this software.
007: *
008: * $id$
009: *
010: */package com.triactive.jdo.test;
011:
012: import java.util.Collection;
013: import java.util.ArrayList;
014: import java.util.Iterator;
015: import java.text.DecimalFormat;
016: import javax.jdo.PersistenceManager;
017: import javax.jdo.Extent;
018: import javax.jdo.Query;
019: import javax.jdo.Transaction;
020:
021: import junit.framework.TestCase;
022:
023: /**
024: * This class contains JUnit tests for JDO Queries
025: */
026: public class QueryFullTest extends PersistenceTestCase {
027:
028: // test data
029: private static boolean[] booleanValues = { false, true, false };
030:
031: private static byte[] byteValues;
032:
033: private static byte[] normalByteValues = { -0x80, 0, 0x7F };
034: private static byte[] positiveByteValues = { 0, 0x3F, 0x7F };
035:
036: private static char[] charValues = { 'a', 'm', 'z' };
037: private static short[] shortValues = { -32768, 0, 32767 };
038:
039: private static int[] intValues = { -0x80000000, 0, 0x7FFFFFFF };
040: private static long[] longValues = { -8000000000000000L, 0L,
041: 0x7FFFFFFFFFFFFFFFL };
042:
043: // max deltas are computed based on the maximum exponent value of the data type
044: // see Java specification section 2nd edition section 2.4.3
045: private static float[] floatDelta = { 1e-6F, 0, 1.0e33f };
046: private static double[] doubleDelta = { 1e-15F, 0,
047: (Math.pow(2, 971) + 1.0F) };
048:
049: private static float[] floatValues = { FloatWidget.MIN_FLOAT_VALUE,
050: 1, FloatWidget.MAX_FLOAT_VALUE };
051: private static double[] doubleValues = {
052: FloatWidget.MIN_DOUBLE_VALUE, 1,
053: FloatWidget.MAX_DOUBLE_VALUE };
054:
055: private static String[] fixedLengthStringValues = {
056: "fixedLengthString1--", "fixedLengthString2--",
057: "fixedLengthString3--" };
058: private static String[] stringValues = { "stringValue1",
059: "stringValue2", "stringValue3" };
060: private static java.util.Date[] utilDateValues = {
061: new java.util.Date(System.currentTimeMillis()),
062: new java.util.Date(System.currentTimeMillis() + 4000L),
063: new java.util.Date(System.currentTimeMillis() + 8000L) };
064: private static java.sql.Date[] sqlDateValues = {
065: java.sql.Date.valueOf("2000-01-01"),
066: java.sql.Date.valueOf("2001-06-31"),
067: java.sql.Date.valueOf("2001-12-31") };
068: private static java.sql.Timestamp[] sqlTimestampValues = {
069: new java.sql.Timestamp(utilDateValues[0].getTime()),
070: new java.sql.Timestamp(utilDateValues[1].getTime()),
071: new java.sql.Timestamp(utilDateValues[2].getTime()) };
072:
073: private static String hugeStringValue;
074:
075: // @to-do - this code should be merged with similar code
076: // in com.triactive.jdo.store.test
077: static {
078: StringBuffer s = new StringBuffer();
079: java.util.Random r = new java.util.Random();
080: int length = 1024 * 1024;
081:
082: while (length-- > 0) {
083: char nextChar = (char) (' ' + r.nextInt(94));
084: s.append(nextChar);
085: }
086:
087: hugeStringValue = s.toString();
088: }
089:
090: /**
091: * Used by the JUnit framework to construct tests.
092: *
093: * @param name Name of the <tt>TestCase</tt>.
094: */
095: public QueryFullTest(String name) {
096: super (name);
097: }
098:
099: public void testRelationalOperatorsWithConstantsAndExtentCandidate() {
100: TestDataSet dataset = null;
101: PersistenceManager pm = pmf.getPersistenceManager();
102: Transaction tx = pm.currentTransaction();
103:
104: try {
105: Query q = pm.newQuery(pm.getExtent(
106: com.triactive.jdo.test.Primitive.class, false));
107:
108: int[][] expectedResultsByOperator = { { 1, 0, 2, 1, 3 },
109: { 1, 1, 1, 2, 2 }, { 1, 2, 0, 3, 1 } };
110:
111: dataset = new TestDataSet(q, expectedResultsByOperator);
112:
113: tryRelationalOperatorsWithConstants(dataset, tx);
114: } finally {
115: if (tx.isActive())
116: tx.rollback();
117:
118: pm.close();
119: }
120: }
121:
122: public void testRelationalOperatorsWithConstantsAndNormalCollectionCandidate() {
123: TestDataSet dataset = null;
124: PersistenceManager pm = pmf.getPersistenceManager();
125: Transaction tx = pm.currentTransaction();
126:
127: try {
128: // first, get the CollectionFieldTester created in setup
129: Query q = pm.newQuery(pm.getExtent(
130: CollectionFieldTester.class, true));
131:
132: int[][] expectedResultsByOperator = { { 1, 0, 2, 1, 3 },
133: { 1, 1, 1, 2, 2 }, { 1, 2, 0, 3, 1 } };
134:
135: tx.begin();
136:
137: CollectionFieldTester tester;
138: Collection c = (Collection) q.execute();
139:
140: try {
141: assertEquals(1, c.size());
142: tester = (CollectionFieldTester) c.iterator().next();
143: } finally {
144: q.closeAll();
145: }
146:
147: // next, create a collection candidate data set
148: q = pm.newQuery(Primitive.class, tester
149: .getPrimitiveCollection());
150: tx.commit();
151:
152: dataset = new TestDataSet(q, expectedResultsByOperator);
153:
154: tryRelationalOperatorsWithConstants(dataset, tx);
155: } finally {
156: if (tx.isActive())
157: tx.rollback();
158:
159: pm.close();
160: }
161: }
162:
163: public void testRelationalOperatorsWithConstantsAndInverseCollectionCandidate() {
164: TestDataSet dataset = null;
165: PersistenceManager pm = pmf.getPersistenceManager();
166: Transaction tx = pm.currentTransaction();
167:
168: try {
169: // first, get the CollectionFieldTester created in setup
170: Query q = pm.newQuery(pm.getExtent(
171: CollectionFieldTester.class, true));
172:
173: int[][] expectedResultsByOperator = { { 1, 0, 2, 1, 3 },
174: { 1, 1, 1, 2, 2 }, { 1, 2, 0, 3, 1 } };
175:
176: tx.begin();
177:
178: CollectionFieldTester tester;
179: Collection c = (Collection) q.execute();
180:
181: try {
182: assertEquals(1, c.size());
183: tester = (CollectionFieldTester) c.iterator().next();
184: } finally {
185: q.closeAll();
186: }
187:
188: // next, create a collection candidate data set
189: q = pm.newQuery(InversePrimitive.class, tester
190: .getInversePrimitiveCollection());
191: assertTrue(!tester.getInversePrimitiveCollection()
192: .isEmpty());
193: tx.commit();
194:
195: dataset = new TestDataSet(q, expectedResultsByOperator);
196:
197: tryRelationalOperatorsWithConstants(dataset, tx);
198: } finally {
199: if (tx.isActive())
200: tx.rollback();
201:
202: pm.close();
203: }
204: }
205:
206: /**
207: * Common logic for executing relational operator with constants tests
208: * against various candidate data sets
209: */
210: private void tryRelationalOperatorsWithConstants(
211: TestDataSet dataset, Transaction tx) {
212: String[] operators = { "==", "<", ">", "<=", ">=" };
213:
214: // iterate through type value arrays
215: for (int i = 0; i < 3; i++) {
216: // for each type value, iterate through operators
217: for (int j = 0; j < operators.length; j++) {
218: Query q = dataset.getQuery();
219:
220: Collection collection = null;
221: ArrayList filterList = genConstantsFiltersList(
222: operators[j], i);
223:
224: for (int l = 0; l < filterList.size(); l++) {
225: String filter = (String) filterList.get(l);
226: q.setFilter(filter);
227: int expectedCollectionSize = dataset.getResults()[i][j];
228:
229: tx.begin();
230: collection = (Collection) q.execute();
231:
232: try {
233: assertEquals(
234: "Wrong result set size: " + filter,
235: expectedCollectionSize, collection
236: .size());
237:
238: Iterator resultsIterator = collection
239: .iterator();
240:
241: while (resultsIterator.hasNext()) {
242: Primitive p = (Primitive) resultsIterator
243: .next();
244: assertResult(p, operators[j], i);
245: }
246: } finally {
247: q.close(collection);
248: }
249:
250: tx.commit();
251: }
252: }
253: }
254: }
255:
256: private ArrayList genConstantsFiltersList(String qOperator,
257: int valueArrayIndex) {
258: ArrayList filterStringList = new ArrayList();
259: DecimalFormat df = new DecimalFormat("0.0#####E00");
260:
261: filterStringList.add("byteField " + qOperator + " "
262: + byteValues[valueArrayIndex]);
263: filterStringList.add("byteObjField " + qOperator + " "
264: + byteValues[valueArrayIndex]);
265: filterStringList.add("charField " + qOperator + " '"
266: + charValues[valueArrayIndex] + "'");
267: filterStringList.add("charObjField " + qOperator + " '"
268: + charValues[valueArrayIndex] + "'");
269: filterStringList.add("shortField " + qOperator + " "
270: + shortValues[valueArrayIndex]);
271: filterStringList.add("shortObjField " + qOperator + " "
272: + shortValues[valueArrayIndex]);
273: filterStringList.add("intField " + qOperator + " "
274: + intValues[valueArrayIndex]);
275: filterStringList.add("intObjField " + qOperator + " "
276: + intValues[valueArrayIndex]);
277: filterStringList.add("longField " + qOperator + " "
278: + longValues[valueArrayIndex]);
279: filterStringList.add("longObjField " + qOperator + " "
280: + longValues[valueArrayIndex]);
281: filterStringList.add("normalString " + qOperator + " \""
282: + stringValues[valueArrayIndex] + "\"");
283: filterStringList.add("fixedLengthString " + qOperator + " \""
284: + fixedLengthStringValues[valueArrayIndex] + "\"");
285:
286: // note: equality is not tested on floats and doubles due to round
287: // off error
288: if (qOperator.equals("<")) {
289: filterStringList.add("floatField " + qOperator + " "
290: + df.format(0.5 * floatValues[valueArrayIndex]));
291: filterStringList.add("floatObjField " + qOperator + " "
292: + df.format(0.5 * floatValues[valueArrayIndex]));
293: filterStringList.add("doubleField " + qOperator + " "
294: + df.format(0.5 * doubleValues[valueArrayIndex]));
295: filterStringList.add("doubleObjField " + qOperator + " "
296: + df.format(0.5 * doubleValues[valueArrayIndex]));
297: } else if (qOperator.equals(">")) {
298: filterStringList.add("floatField " + qOperator + " "
299: + df.format(2 * floatValues[valueArrayIndex]));
300: filterStringList.add("floatObjField " + qOperator + " "
301: + df.format(2 * floatValues[valueArrayIndex]));
302: filterStringList.add("doubleField " + qOperator + " "
303: + df.format(2 * doubleValues[valueArrayIndex]));
304: filterStringList.add("doubleObjField " + qOperator + " "
305: + df.format(2 * doubleValues[valueArrayIndex]));
306: }
307:
308: return filterStringList;
309: }
310:
311: protected void setUp() throws Exception {
312: super .setUp();
313:
314: if (TestObject.allowNegativeByteValues)
315: byteValues = normalByteValues;
316: else
317: byteValues = positiveByteValues;
318:
319: clearData();
320:
321: PersistenceManager pm = pmf.getPersistenceManager();
322: Transaction tx = pm.currentTransaction();
323:
324: try {
325: Primitive p;
326: CollectionFieldTester tester = new CollectionFieldTester();
327:
328: tx.begin();
329:
330: for (int i = 0; i < 3; i++) {
331: p = new Primitive();
332: p.setBoolean(booleanValues[i]);
333: p.setBooleanObject(new Boolean(booleanValues[i]));
334: p.setByte(byteValues[i]);
335: p.setByteObject(new Byte(byteValues[i]));
336: p.setChar(charValues[i]);
337: p.setCharObject(new Character(charValues[i]));
338: p.setDouble(doubleValues[i]);
339: p.setDoubleObject(new Double(doubleValues[i]));
340: p.setFixedLengthString(fixedLengthStringValues[i]);
341: p.setFloat(floatValues[i]);
342: p.setFloatObject(new Float(floatValues[i]));
343: p.setHugeString(stringValues[i]);
344: p.setInt(intValues[i]);
345: p.setIntObject(new Integer(intValues[i]));
346: p.setLong(longValues[i]);
347: p.setLongObject(new Long(longValues[i]));
348: p.setNormalString(stringValues[i]);
349: p.setShort(shortValues[i]);
350: p.setShortObject(new Short(shortValues[i]));
351: p.setSqlDateField(sqlDateValues[i]);
352: p.setUtilDateField(utilDateValues[i]);
353: p.setSqlTimestamp(sqlTimestampValues[i]);
354:
355: tester.getPrimitiveCollection().add(p);
356: }
357:
358: pm.makePersistent(tester);
359:
360: for (int i = 0; i < 3; i++) {
361: p = new InversePrimitive();
362: p.setBoolean(booleanValues[i]);
363: p.setBooleanObject(new Boolean(booleanValues[i]));
364: p.setByte(byteValues[i]);
365: p.setByteObject(new Byte(byteValues[i]));
366: p.setChar(charValues[i]);
367: p.setCharObject(new Character(charValues[i]));
368: p.setDouble(doubleValues[i]);
369: p.setDoubleObject(new Double(doubleValues[i]));
370: p.setFixedLengthString(fixedLengthStringValues[i]);
371: p.setFloat(floatValues[i]);
372: p.setFloatObject(new Float(floatValues[i]));
373: p.setHugeString(stringValues[i]);
374: p.setInt(intValues[i]);
375: p.setIntObject(new Integer(intValues[i]));
376: p.setLong(longValues[i]);
377: p.setLongObject(new Long(longValues[i]));
378: p.setNormalString(stringValues[i]);
379: p.setShort(shortValues[i]);
380: p.setShortObject(new Short(shortValues[i]));
381: p.setSqlDateField(sqlDateValues[i]);
382: p.setUtilDateField(utilDateValues[i]);
383: p.setSqlTimestamp(sqlTimestampValues[i]);
384:
385: tester.getInversePrimitiveCollection().add(p);
386: }
387:
388: tx.commit();
389: } finally {
390: if (tx.isActive())
391: tx.rollback();
392:
393: pm.close();
394: }
395:
396: }
397:
398: public void tearDown() throws Exception {
399: super .tearDown();
400: clearData();
401: }
402:
403: protected void clearData() {
404: Extent ext = null;
405: java.util.Iterator it = null;
406: PersistenceManager pm = pmf.getPersistenceManager();
407: Transaction tx = pm.currentTransaction();
408:
409: try {
410: // delete all InversePrimitive objects
411: tx.begin();
412:
413: ext = pm.getExtent(InversePrimitive.class, false);
414: it = ext.iterator();
415:
416: while (it.hasNext()) {
417: InversePrimitive ip = (InversePrimitive) it.next();
418: pm.deletePersistent(ip);
419: }
420:
421: tx.commit();
422:
423: // delete all CollectionFieldTester objects
424: tx.begin();
425:
426: ext = pm.getExtent(CollectionFieldTester.class, false);
427: it = ext.iterator();
428:
429: while (it.hasNext()) {
430: CollectionFieldTester t = (CollectionFieldTester) it
431: .next();
432: t.getPrimitiveCollection().clear();
433: pm.deletePersistent(t);
434: }
435:
436: tx.commit();
437:
438: // delete all Primative objects
439: tx.begin();
440:
441: ext = pm.getExtent(Primitive.class, false);
442: it = ext.iterator();
443:
444: while (it.hasNext()) {
445: Primitive p = (Primitive) it.next();
446: pm.deletePersistent(p);
447: }
448:
449: tx.commit();
450:
451: // disassociate all Employees and Departments from their Managers
452: tx.begin();
453:
454: ext = pm.getExtent(com.triactive.jdo.test.Manager.class,
455: false);
456: it = ext.iterator();
457:
458: while (it.hasNext()) {
459: Manager mgr = (Manager) it.next();
460: mgr.getSubordinates().clear();
461: mgr.getDepartments().clear();
462: }
463:
464: tx.commit();
465:
466: // delete all Employee objects
467: tx.begin();
468:
469: ext = pm.getExtent(Employee.class, false);
470: it = ext.iterator();
471:
472: while (it.hasNext()) {
473: Employee emp = (Employee) it.next();
474: pm.deletePersistent(emp);
475: }
476:
477: tx.commit();
478: tx.begin();
479:
480: // dekete all Department objects
481: ext = pm.getExtent(Department.class, false);
482: it = ext.iterator();
483:
484: while (it.hasNext()) {
485: Department d = (Department) it.next();
486: pm.deletePersistent(d);
487: }
488:
489: tx.commit();
490:
491: // delete all Manager objects
492: tx.begin();
493:
494: ext = pm.getExtent(Manager.class, false);
495: it = ext.iterator();
496:
497: while (it.hasNext()) {
498: Manager mgr = (Manager) it.next();
499: pm.deletePersistent(mgr);
500: }
501:
502: tx.commit();
503:
504: // delete all Person objects
505: tx.begin();
506:
507: ext = pm.getExtent(Person.class, true);
508: it = ext.iterator();
509:
510: while (it.hasNext()) {
511: Person person = (Person) it.next();
512: pm.deletePersistent(person);
513: }
514:
515: tx.commit();
516: } finally {
517: if (tx.isActive())
518: tx.rollback();
519:
520: pm.close();
521: }
522: }
523:
524: /**
525: * This is basically a struct use to pair a Query object with a the
526: * expected size of the resulting Collection when the query is run.
527: */
528: class TestDataSet {
529: private Query query;
530: private int[][] resultArray;
531:
532: TestDataSet(Query q, int[][] results) {
533: query = q;
534: resultArray = results;
535: }
536:
537: public Query getQuery() {
538: return query;
539: }
540:
541: public int[][] getResults() {
542: return resultArray;
543: }
544:
545: }
546:
547: private void assertResult(Primitive p, String op, int i) {
548:
549: if (op.equals("==")) {
550: assertEquals(booleanValues[i], p.getBoolean());
551: assertEquals(booleanValues[i], p.getBooleanObject()
552: .booleanValue());
553: assertEquals(byteValues[i], p.getByte());
554: assertEquals(byteValues[i], p.getByteObject().byteValue());
555: assertEquals(charValues[i], p.getChar());
556: assertEquals(charValues[i], p.getCharObject().charValue());
557: assertTrue(FloatWidget.approximates(doubleValues[i], p
558: .getDouble()));
559: assertTrue(FloatWidget.approximates(doubleValues[i], p
560: .getDoubleObject().doubleValue()));
561: assertEquals(fixedLengthStringValues[i], p
562: .getFixedLengthString());
563: assertTrue(FloatWidget.approximates(floatValues[i], p
564: .getFloat()));
565: assertTrue(FloatWidget.approximates(floatValues[i], p
566: .getFloatObject().floatValue()));
567: assertEquals(stringValues[i], p.getHugeString());
568: assertEquals(intValues[i], p.getInt());
569: assertEquals(intValues[i], p.getIntObject().intValue());
570: assertEquals(longValues[i], p.getLong());
571: assertEquals(longValues[i], p.getLongObject().longValue());
572: assertEquals(stringValues[i], p.getNormalString());
573: assertEquals(shortValues[i], p.getShort());
574: assertEquals(shortValues[i], p.getShortObject()
575: .shortValue());
576: assertEquals(utilDateValues[i].getTime() / 1000, p
577: .getUtilDateField().getTime() / 1000);
578: assertEquals(sqlDateValues[i], p.getSqlDateField());
579: assertEquals(sqlTimestampValues[i].getTime() / 1000, p
580: .getSqlTimestamp().getTime() / 1000);
581: } else if (op.equals("<=")) {
582: assertTrue(p.getByte() <= byteValues[i]);
583: assertTrue(p.getByteObject().byteValue() <= byteValues[i]);
584: assertTrue(p.getChar() <= charValues[i]);
585: assertTrue(p.getCharObject().charValue() <= charValues[i]);
586: // assertTrue(p.getDouble(), doubleValues[i], doubleDelta[i]);
587: // assertTrue(p.getDoubleObject().doubleValue(), doubleValues[i], doubleDelta[i]);
588: assertTrue(p.getFixedLengthString().compareTo(
589: fixedLengthStringValues[i]) <= 0);
590: // assertTrue(p.getFloat() <= floatValues[i]);
591: // assertTrue(p.getFloatObject().floatValue() <= floatValues[i]);
592: assertTrue(p.getHugeString().compareTo(stringValues[i]) <= 0);
593: assertTrue(p.getInt() <= intValues[i]);
594: assertTrue(p.getIntObject().intValue() <= intValues[i]);
595: assertTrue(p.getLong() <= longValues[i]);
596: assertTrue(p.getLongObject().longValue() <= longValues[i]);
597: assertTrue(p.getNormalString().compareTo(stringValues[i]) <= 0);
598: assertTrue(p.getShort() <= shortValues[i]);
599: assertTrue(p.getShortObject().shortValue() <= shortValues[i]);
600: assertTrue(p.getUtilDateField().getTime() / 1000 <= utilDateValues[i]
601: .getTime() / 1000);
602: assertTrue(p.getSqlDateField().compareTo(sqlDateValues[i]) <= 0);
603: assertTrue(p.getSqlTimestamp().getTime() / 1000 <= sqlTimestampValues[i]
604: .getTime() / 1000);
605: } else if (op.equals(">=")) {
606: assertTrue(p.getByte() >= byteValues[i]);
607: assertTrue(p.getByteObject().byteValue() >= byteValues[i]);
608: assertTrue(p.getChar() >= charValues[i]);
609: assertTrue(p.getCharObject().charValue() >= charValues[i]);
610: // assertTrue(p.getDouble(), doubleValues[i], doubleDelta[i]);
611: // assertTrue(p.getDoubleObject().doubleValue(), doubleValues[i], doubleDelta[i]);
612: assertTrue(p.getFixedLengthString().compareTo(
613: fixedLengthStringValues[i]) >= 0);
614: // assertTrue(p.getFloat() >= floatValues[i]);
615: // assertTrue(p.getFloatObject().floatValue() >= floatValues[i]);
616: assertTrue(p.getHugeString().compareTo(stringValues[i]) >= 0);
617: assertTrue(p.getInt() >= intValues[i]);
618: assertTrue(p.getIntObject().intValue() >= intValues[i]);
619: assertTrue(p.getLong() >= longValues[i]);
620: assertTrue(p.getLongObject().longValue() >= longValues[i]);
621: assertTrue(p.getNormalString().compareTo(stringValues[i]) >= 0);
622: assertTrue(p.getShort() >= shortValues[i]);
623: assertTrue(p.getShortObject().shortValue() >= shortValues[i]);
624: assertTrue(p.getUtilDateField().getTime() / 1000 >= utilDateValues[i]
625: .getTime() / 1000);
626: assertTrue(p.getSqlDateField().compareTo(sqlDateValues[i]) >= 0);
627: assertTrue(p.getSqlTimestamp().getTime() / 1000 >= sqlTimestampValues[i]
628: .getTime() / 1000);
629: } else if (op.equals("<")) {
630: assertTrue(p.getByte() < byteValues[i]);
631: assertTrue(p.getByteObject().byteValue() < byteValues[i]);
632: assertTrue(p.getChar() < charValues[i]);
633: assertTrue(p.getCharObject().charValue() < charValues[i]);
634: assertTrue(p.getDouble() < doubleValues[i]);
635: assertTrue(p.getDoubleObject().doubleValue() < doubleValues[i]);
636: assertTrue(p.getFixedLengthString().compareTo(
637: fixedLengthStringValues[i]) < 0);
638: assertTrue(p.getFloat() < floatValues[i]);
639: assertTrue(p.getFloatObject().floatValue() < floatValues[i]);
640: assertTrue(p.getHugeString().compareTo(stringValues[i]) < 0);
641: assertTrue(p.getInt() < intValues[i]);
642: assertTrue(p.getIntObject().intValue() < intValues[i]);
643: assertTrue(p.getLong() < longValues[i]);
644: assertTrue(p.getLongObject().longValue() < longValues[i]);
645: assertTrue(p.getNormalString().compareTo(stringValues[i]) < 0);
646: assertTrue(p.getShort() < shortValues[i]);
647: assertTrue(p.getShortObject().shortValue() < shortValues[i]);
648: assertTrue(p.getUtilDateField().getTime() / 1000 < utilDateValues[i]
649: .getTime() / 1000);
650: assertTrue(p.getSqlDateField().compareTo(sqlDateValues[i]) < 0);
651: assertTrue(p.getSqlTimestamp().getTime() / 1000 < sqlTimestampValues[i]
652: .getTime() / 1000);
653: } else if (op.equals(">")) {
654: assertTrue(p.getByte() > byteValues[i]);
655: assertTrue(p.getByteObject().byteValue() > byteValues[i]);
656: assertTrue(p.getChar() > charValues[i]);
657: assertTrue(p.getCharObject().charValue() > charValues[i]);
658: assertTrue(p.getDouble() > doubleValues[i]);
659: assertTrue(p.getDoubleObject().doubleValue() > doubleValues[i]);
660: assertTrue(p.getFixedLengthString().compareTo(
661: fixedLengthStringValues[i]) > 0);
662: assertTrue(p.getFloat() > floatValues[i]);
663: assertTrue(p.getFloatObject().floatValue() > floatValues[i]);
664: assertTrue(p.getHugeString().compareTo(stringValues[i]) > 0);
665: assertTrue(p.getInt() > intValues[i]);
666: assertTrue(p.getIntObject().intValue() > intValues[i]);
667: assertTrue(p.getLong() > longValues[i]);
668: assertTrue(p.getLongObject().longValue() > longValues[i]);
669: assertTrue(p.getNormalString().compareTo(stringValues[i]) > 0);
670: assertTrue(p.getShort() > shortValues[i]);
671: assertTrue(p.getShortObject().shortValue() > shortValues[i]);
672: assertTrue(p.getUtilDateField().getTime() / 1000 > utilDateValues[i]
673: .getTime() / 1000);
674: assertTrue(p.getSqlDateField().compareTo(sqlDateValues[i]) > 0);
675: assertTrue(p.getSqlTimestamp().getTime() / 1000 > sqlTimestampValues[i]
676: .getTime() / 1000);
677: }
678: }
679: }
|