18 package testsuite.clusterj;
20 import testsuite.clusterj.model.ByteArrayTypes;
21 import testsuite.clusterj.model.IdBase;
33 void createInstances(
int number) {
34 createAllByteArrayTypesInstances(number);
37 static byte[][] bytes =
new byte[][] {
38 new byte[] {
'a',
'a',
'a',
'a'},
39 new byte[] {
'a',
'a',
'a',
'b'},
40 new byte[] {
'a',
'a',
'b',
'a'},
41 new byte[] {
'a',
'a',
'b',
'b'},
42 new byte[] {
'a',
'b',
'a',
'a'},
43 new byte[] {
'a',
'b',
'a',
'b'},
44 new byte[] {
'a',
'b',
'b',
'a'},
45 new byte[] {
'a',
'b',
'b',
'b'},
46 new byte[] {
'b',
'a',
'a',
'a'},
47 new byte[] {
'b',
'a',
'a',
'b'},
68 btreeIndexScanString();
69 hashIndexScanString();
70 bothIndexScanString();
71 noneIndexScanString();
75 public void btreeIndexScanString() {
76 likeQuery(
"bytes_null_btree",
"none",
new byte[] {(byte)
'%'}, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
77 likeQuery(
"bytes_null_btree",
"none",
new byte[] {(byte)
'_'});
78 likeQuery(
"bytes_null_btree",
"none",
new byte[] {(byte)
'_', (byte)
'_', (byte)
'_', (byte)
'_'}, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
79 likeQuery(
"bytes_null_btree",
"none",
new byte[] {(byte)
'_', (byte)
'a', (byte)
'a', (byte)
'a'}, 0, 8);
80 likeQuery(
"bytes_null_btree",
"none",
new byte[] {(byte)
'a', (byte)
'b', (byte)
'a', (byte)
'a'}, 4);
81 likeQuery(
"bytes_null_btree",
"none",
new byte[] {(byte)
'a', (byte)
'b', (byte)
'a', (byte)
'%'}, 4, 5);
82 likeQuery(
"bytes_null_btree",
"none",
new byte[] {(byte)
'a', (byte)
'b', (byte)
'%'}, 4, 5, 6, 7);
83 greaterEqualAndLikeQuery(
"bytes_null_btree",
"idx_bytes_null_btree", getBytes(4),
new byte[] {(byte)
'%'}, 4, 5, 6, 7, 8, 9);
84 greaterEqualAndLikeQuery(
"bytes_null_btree",
"idx_bytes_null_btree", getBytes(4),
new byte[] {(byte)
'a', (byte)
'%', (byte)
'b'}, 5, 7);
85 greaterThanAndLikeQuery(
"bytes_null_btree",
"idx_bytes_null_btree", getBytes(4),
new byte[] {(byte)
'%', (byte)
'b', (byte)
'b', (byte)
'%'}, 6, 7);
88 public void hashIndexScanString() {
89 greaterEqualAndLikeQuery(
"bytes_null_hash",
"none", getBytes(3),
new byte[] {(byte)
'%', (byte)
'b', (byte)
'b', (byte)
'%'}, 3, 6, 7);
90 greaterThanAndLikeQuery(
"bytes_null_hash",
"none", getBytes(3),
new byte[] {(byte)
'%', (byte)
'b', (byte)
'b', (byte)
'%'}, 6, 7);
93 public void bothIndexScanString() {
94 greaterEqualAndLikeQuery(
"bytes_null_both",
"idx_bytes_null_both", getBytes(3),
new byte[] {(byte)
'%', (byte)
'b', (byte)
'b', (byte)
'%'}, 3, 6, 7);
95 greaterThanAndLikeQuery(
"bytes_null_both",
"idx_bytes_null_both", getBytes(3),
new byte[] {(byte)
'%', (byte)
'b', (byte)
'b', (byte)
'%'}, 6, 7);
98 public void noneIndexScanString() {
99 greaterEqualAndLikeQuery(
"bytes_null_none",
"none", getBytes(3),
new byte[] {(byte)
'%', (byte)
'b', (byte)
'b', (byte)
'%'}, 3, 6, 7);
100 greaterThanAndLikeQuery(
"bytes_null_none",
"none", getBytes(3),
new byte[] {(byte)
'%', (byte)
'b', (byte)
'b', (byte)
'%'}, 6, 7);
103 private void createAllByteArrayTypesInstances(
int number) {
104 for (
int i = 0;
i < number; ++
i) {
105 ByteArrayTypes instance = session.
newInstance(ByteArrayTypes.class);
107 instance.setBytes_null_hash(getBytes(
i));
108 instance.setBytes_null_btree(getBytes(
i));
109 instance.setBytes_null_both(getBytes(
i));
110 instance.setBytes_null_none(getBytes(
i));
115 protected byte[] getBytes(
int number) {
116 return bytes[number];
126 @SuppressWarnings(
"unused")
127 ByteArrayTypes stringType = (ByteArrayTypes)instance;