]> review.fuel-infra Code Review - packages/trusty/mysql-wsrep-5.6.git/blob
9a4e1eea4a4f8a308ba2f517a60572fe53ffa260
[packages/trusty/mysql-wsrep-5.6.git] /
1 /*
2    Copyright 2010 Sun Microsystems, Inc.
3    All rights reserved. Use is subject to license terms.
4
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; version 2 of the License.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program; if not, write to the Free Software
16    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
17 */
18
19 package testsuite.clusterj;
20
21 import testsuite.clusterj.model.AllPrimitives;
22
23 public class QueryNotTest extends AbstractQueryTest {
24
25     @Override
26     public Class<?> getInstanceType() {
27         return AllPrimitives.class;
28     }
29
30     @Override
31     void createInstances(int number) {
32         createAllPrimitivesInstances(10);
33     }
34
35     /** Test "not" queries using AllPrimitives.
36 drop table if exists allprimitives;
37 create table allprimitives (
38  id int not null primary key,
39
40  int_not_null_hash int not null,
41  int_not_null_btree int not null,
42  int_not_null_both int not null,
43  int_not_null_none int not null,
44  int_null_hash int,
45  int_null_btree int,
46  int_null_both int,
47  int_null_none int,
48
49  byte_not_null_hash tinyint not null,
50  byte_not_null_btree tinyint not null,
51  byte_not_null_both tinyint not null,
52  byte_not_null_none tinyint not null,
53  byte_null_hash tinyint,
54  byte_null_btree tinyint,
55  byte_null_both tinyint,
56  byte_null_none tinyint,
57
58  short_not_null_hash smallint not null,
59  short_not_null_btree smallint not null,
60  short_not_null_both smallint not null,
61  short_not_null_none smallint not null,
62  short_null_hash smallint,
63  short_null_btree smallint,
64  short_null_both smallint,
65  short_null_none smallint,
66
67  long_not_null_hash bigint not null,
68  long_not_null_btree bigint not null,
69  long_not_null_both bigint not null,
70  long_not_null_none bigint not null,
71  long_null_hash bigint,
72  long_null_btree bigint,
73  long_null_both bigint,
74  long_null_none bigint
75      */
76
77     public void test() {
78         btreeIndexScanInt();
79         failOnError();
80     }
81
82     public void btreeIndexScanInt() {
83         notEqualQuery("int_not_null_btree", "none", 8, 0, 1, 2, 3, 4, 5, 6, 7, 9);
84         notNotEqualQuery("int_not_null_btree", "none", 8, 8);
85         notNotNotEqualQuery("int_not_null_btree", "none", 8, 0, 1, 2, 3, 4, 5, 6, 7, 9);
86         notGreaterEqualQuery("int_not_null_btree", "none", 7, 0, 1, 2, 3, 4, 5, 6);
87         notGreaterThanQuery("int_not_null_btree", "none", 6, 0, 1, 2, 3, 4, 5, 6);
88         notLessEqualQuery("int_not_null_btree", "none", 4, 5, 6, 7, 8, 9);
89         notLessThanQuery("int_not_null_btree", "none", 4, 4, 5, 6, 7, 8, 9);
90         notBetweenQuery("int_not_null_btree", "none", 4, 6, 0, 1, 2, 3, 7, 8, 9);
91         greaterEqualAndNotGreaterEqualQuery("int_not_null_btree", "idx_int_not_null_btree", 4, 6, 4, 5);
92         greaterThanAndNotGreaterEqualQuery("int_not_null_btree", "idx_int_not_null_btree", 4, 6, 5);
93         greaterEqualAndNotGreaterThanQuery("int_not_null_btree", "idx_int_not_null_btree", 4, 6, 4, 5, 6);
94         greaterThanAndNotGreaterThanQuery("int_not_null_btree", "idx_int_not_null_btree", 4, 6, 5, 6);
95
96         notEqualQuery("int_null_btree", "none", 8, 0, 1, 2, 3, 4, 5, 6, 7, 9);
97         notNotEqualQuery("int_null_btree", "none", 8, 8);
98         notNotNotEqualQuery("int_null_btree", "none", 8, 0, 1, 2, 3, 4, 5, 6, 7, 9);
99         notGreaterEqualQuery("int_null_btree", "none", 7, 0, 1, 2, 3, 4, 5, 6);
100         notGreaterThanQuery("int_null_btree", "none", 6, 0, 1, 2, 3, 4, 5, 6);
101         notLessEqualQuery("int_null_btree", "none", 4, 5, 6, 7, 8, 9);
102         notLessThanQuery("int_null_btree", "none", 4, 4, 5, 6, 7, 8, 9);
103         notBetweenQuery("int_null_btree", "none", 4, 6, 0, 1, 2, 3, 7, 8, 9);
104         greaterEqualAndNotGreaterEqualQuery("int_null_btree", "idx_int_null_btree", 4, 6, 4, 5);
105         greaterThanAndNotGreaterEqualQuery("int_null_btree", "idx_int_null_btree", 4, 6, 5);
106         greaterEqualAndNotGreaterThanQuery("int_null_btree", "idx_int_null_btree", 4, 6, 4, 5, 6);
107         greaterThanAndNotGreaterThanQuery("int_null_btree", "idx_int_null_btree", 4, 6, 5, 6);
108     }
109
110 }