19 package testsuite.clusterj;
21 import testsuite.clusterj.model.DateAsUtilDateTypes;
23 import java.util.Date;
24 import testsuite.clusterj.model.IdBase;
34 void createInstances(
int number) {
35 createAllDateTypesInstances(number);
73 public void btreeIndexScanDate() {
74 equalQuery(
"date_not_null_btree",
"idx_date_not_null_btree", getDateFor(8), 8);
75 greaterEqualQuery(
"date_not_null_btree",
"idx_date_not_null_btree", getDateFor(7), 7, 8, 9);
76 greaterThanQuery(
"date_not_null_btree",
"idx_date_not_null_btree", getDateFor(6), 7, 8, 9);
77 lessEqualQuery(
"date_not_null_btree",
"idx_date_not_null_btree", getDateFor(4), 4, 3, 2, 1, 0);
78 lessThanQuery(
"date_not_null_btree",
"idx_date_not_null_btree", getDateFor(4), 3, 2, 1, 0);
79 betweenQuery(
"date_not_null_btree",
"idx_date_not_null_btree", getDateFor(4), getDateFor(6), 4, 5, 6);
80 greaterEqualAndLessEqualQuery(
"date_not_null_btree",
"idx_date_not_null_btree", getDateFor(4), getDateFor(6), 4, 5, 6);
81 greaterThanAndLessEqualQuery(
"date_not_null_btree",
"idx_date_not_null_btree", getDateFor(4), getDateFor(6), 5, 6);
82 greaterEqualAndLessThanQuery(
"date_not_null_btree",
"idx_date_not_null_btree", getDateFor(4), getDateFor(6), 4, 5);
83 greaterThanAndLessThanQuery(
"date_not_null_btree",
"idx_date_not_null_btree", getDateFor(4), getDateFor(6), 5);
86 public void hashIndexScanDate() {
87 equalQuery(
"date_not_null_hash",
"idx_date_not_null_hash", getDateFor(8), 8);
88 greaterEqualQuery(
"date_not_null_hash",
"none", getDateFor(7), 7, 8, 9);
89 greaterThanQuery(
"date_not_null_hash",
"none", getDateFor(6), 7, 8, 9);
90 lessEqualQuery(
"date_not_null_hash",
"none", getDateFor(4), 4, 3, 2, 1, 0);
91 lessThanQuery(
"date_not_null_hash",
"none", getDateFor(4), 3, 2, 1, 0);
92 betweenQuery(
"date_not_null_hash",
"none", getDateFor(4), getDateFor(6), 4, 5, 6);
93 greaterEqualAndLessEqualQuery(
"date_not_null_hash",
"none", getDateFor(4), getDateFor(6), 4, 5, 6);
94 greaterThanAndLessEqualQuery(
"date_not_null_hash",
"none", getDateFor(4), getDateFor(6), 5, 6);
95 greaterEqualAndLessThanQuery(
"date_not_null_hash",
"none", getDateFor(4), getDateFor(6), 4, 5);
96 greaterThanAndLessThanQuery(
"date_not_null_hash",
"none", getDateFor(4), getDateFor(6), 5);
99 public void bothIndexScanDate() {
100 equalQuery(
"date_not_null_both",
"idx_date_not_null_both", getDateFor(8), 8);
101 greaterEqualQuery(
"date_not_null_both",
"idx_date_not_null_both", getDateFor(7), 7, 8, 9);
102 greaterThanQuery(
"date_not_null_both",
"idx_date_not_null_both", getDateFor(6), 7, 8, 9);
103 lessEqualQuery(
"date_not_null_both",
"idx_date_not_null_both", getDateFor(4), 4, 3, 2, 1, 0);
104 lessThanQuery(
"date_not_null_both",
"idx_date_not_null_both", getDateFor(4), 3, 2, 1, 0);
105 betweenQuery(
"date_not_null_both",
"idx_date_not_null_both", getDateFor(4), getDateFor(6), 4, 5, 6);
106 greaterEqualAndLessEqualQuery(
"date_not_null_both",
"idx_date_not_null_both", getDateFor(4), getDateFor(6), 4, 5, 6);
107 greaterThanAndLessEqualQuery(
"date_not_null_both",
"idx_date_not_null_both", getDateFor(4), getDateFor(6), 5, 6);
108 greaterEqualAndLessThanQuery(
"date_not_null_both",
"idx_date_not_null_both", getDateFor(4), getDateFor(6), 4, 5);
109 greaterThanAndLessThanQuery(
"date_not_null_both",
"idx_date_not_null_both", getDateFor(4), getDateFor(6), 5);
112 public void noneIndexScanDate() {
113 equalQuery(
"date_not_null_none",
"none", getDateFor(8), 8);
114 greaterEqualQuery(
"date_not_null_none",
"none", getDateFor(7), 7, 8, 9);
115 greaterThanQuery(
"date_not_null_none",
"none", getDateFor(6), 7, 8, 9);
116 lessEqualQuery(
"date_not_null_none",
"none", getDateFor(4), 4, 3, 2, 1, 0);
117 lessThanQuery(
"date_not_null_none",
"none", getDateFor(4), 3, 2, 1, 0);
118 betweenQuery(
"date_not_null_none",
"none", getDateFor(4), getDateFor(6), 4, 5, 6);
119 greaterEqualAndLessEqualQuery(
"date_not_null_none",
"none", getDateFor(4), getDateFor(6), 4, 5, 6);
120 greaterThanAndLessEqualQuery(
"date_not_null_none",
"none", getDateFor(4), getDateFor(6), 5, 6);
121 greaterEqualAndLessThanQuery(
"date_not_null_none",
"none", getDateFor(4), getDateFor(6), 4, 5);
122 greaterThanAndLessThanQuery(
"date_not_null_none",
"none", getDateFor(4), getDateFor(6), 5);
125 private void createAllDateTypesInstances(
int number) {
126 for (
int i = 0;
i < number; ++
i) {
127 DateAsUtilDateTypes instance = session.
newInstance(DateAsUtilDateTypes.class);
129 instance.setDate_not_null_hash(getDateFor(
i));
130 instance.setDate_not_null_btree(getDateFor(
i));
131 instance.setDate_not_null_both(getDateFor(
i));
132 instance.setDate_not_null_none(getDateFor(
i));
137 protected Date getDateFor(
int i) {
141 public static String toString(IdBase instance) {
142 DateAsUtilDateTypes datetype = (DateAsUtilDateTypes)instance;
144 buffer.append(datetype.getId());
145 buffer.append(
"; date_not_null_both: ");
146 buffer.append(datetype.getDate_not_null_both().toString());
147 buffer.append(
"; date_not_null_btree: ");
148 buffer.append(datetype.getDate_not_null_btree().toString());
149 buffer.append(
"; date_not_null_hash: ");
150 buffer.append(datetype.getDate_not_null_hash().toString());
151 buffer.append(
"; date_not_null_none: ");
152 buffer.append(datetype.getDate_not_null_none().toString());
153 return buffer.toString();