MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QueryNotNullTest.java
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 
28 public class QueryNotNullTest extends AbstractQueryTest {
29  /*
30  drop table if exists allprimitives;
31  create table allprimitives (
32  id int not null primary key,
33 
34  int_not_null_hash int not null,
35  int_not_null_btree int not null,
36  int_not_null_both int not null,
37  int_not_null_none int not null,
38  int_null_hash int,
39  int_null_btree int,
40  int_null_both int,
41  int_null_none int,
42 
43  byte_not_null_hash tinyint not null,
44  byte_not_null_btree tinyint not null,
45  byte_not_null_both tinyint not null,
46  byte_not_null_none tinyint not null,
47  byte_null_hash tinyint,
48  byte_null_btree tinyint,
49  byte_null_both tinyint,
50  byte_null_none tinyint,
51 
52  short_not_null_hash smallint not null,
53  short_not_null_btree smallint not null,
54  short_not_null_both smallint not null,
55  short_not_null_none smallint not null,
56  short_null_hash smallint,
57  short_null_btree smallint,
58  short_null_both smallint,
59  short_null_none smallint,
60 
61  long_not_null_hash bigint not null,
62  long_not_null_btree bigint not null,
63  long_not_null_both bigint not null,
64  long_not_null_none bigint not null,
65  long_null_hash bigint,
66  long_null_btree bigint,
67  long_null_both bigint,
68  long_null_none bigint
69  */
70 
71  @Override
72  public Class<?> getInstanceType() {
73  return AllPrimitives.class;
74  }
75 
76  @Override
77  void createInstances(int number) {
78  createAllPrimitivesInstances(10);
79  }
80 
81  public void testExtraEqualNotEqualNull() {
82  equalAnd1ExtraQuery("int_not_null_btree", 8, "int_null_none", extraNotEqualPredicateProvider, null, "idx_int_not_null_btree", 8);
83  equalAnd1ExtraQuery("int_not_null_hash", 8, "int_null_none", extraNotEqualPredicateProvider, null, "none", 8);
84  equalAnd1ExtraQuery("int_not_null_both", 8, "int_null_none", extraNotEqualPredicateProvider, null, "idx_int_not_null_both", 8);
85  equalAnd1ExtraQuery("int_not_null_none", 8, "int_null_none", extraNotEqualPredicateProvider, null, "none", 8);
86  failOnError();
87  }
88 
89  public void testBtreeNotEqualNull() {
90  notEqualQuery("int_not_null_btree", "none", null, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
91  notEqualQuery("int_null_btree", "none", null, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
92  failOnError();
93  }
94 
95  public void testHashNotEqualNull() {
96  notEqualQuery("int_not_null_hash", "none", null, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
97  notEqualQuery("int_null_hash", "none", null, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
98  failOnError();
99  }
100 
101  public void testBothNotEqualNull() {
102  notEqualQuery("int_not_null_both", "none", null, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
103  notEqualQuery("int_null_both", "none", null, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
104  failOnError();
105  }
106 
107  public void testNoneNotEqualNull() {
108  notEqualQuery("int_not_null_none", "none", null, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
109  notEqualQuery("int_null_none", "none", null, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
110  failOnError();
111  }
112 
113 }