]> review.fuel-infra Code Review - packages/trusty/mysql-wsrep-5.6.git/blob
a2bae403134a2b3f0bfae3faf07c4df093b76a05
[packages/trusty/mysql-wsrep-5.6.git] /
1 /*
2    Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
3
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; version 2 of the License.
7
8    This program is distributed in the hope that it will be useful,
9    but WITHOUT ANY WARRANTY; without even the implied warranty of
10    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11    GNU General Public License for more details.
12
13    You should have received a copy of the GNU General Public License
14    along with this program; if not, write to the Free Software
15    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
16 */
17
18 package testsuite.clusterj;
19
20 import com.mysql.clusterj.ClusterJUserException;
21 import testsuite.clusterj.model.BadEmployeeWrongPrimaryKeyAnnotationOnClass;
22 import testsuite.clusterj.model.BadEmployeeNoPrimaryKeyAnnotationOnClass;
23 import testsuite.clusterj.model.BadEmployeePrimaryKeyAnnotationColumnAndColumns;
24 import testsuite.clusterj.model.BadEmployeePrimaryKeyAnnotationNoColumnOrColumns;
25 import testsuite.clusterj.model.BadEmployeePrimaryKeyAnnotationOnClassMisspelledField;
26 import testsuite.clusterj.model.BadIndexDuplicateColumn;
27 import testsuite.clusterj.model.BadIndexDuplicateIndexName;
28 import testsuite.clusterj.model.BadIndexMissingColumn;
29
30 public class NegativeMetadataTest extends AbstractClusterJModelTest {
31
32     @Override
33     public void localSetUp() {
34         createSessionFactory();
35         session = sessionFactory.getSession();
36     }
37
38     public void test() {
39         // doTestFor(BadEmployeeNoPrimaryKeyAnnotationOnClass.class);
40         // doTestFor(BadEmployeePrimaryKeyAnnotationOnClassMisspelledField.class);
41         // doTestFor(BadEmployeeWrongPrimaryKeyAnnotationOnClass.class);
42         // doTestFor(BadEmployeePrimaryKeyAnnotationColumnAndColumns.class);
43         // doTestFor(BadEmployeePrimaryKeyAnnotationNoColumnOrColumns.class);
44         // doTestFor(BadIndexDuplicateIndexName.class);
45         // doTestFor(BadIndexMissingColumn.class);
46         // doTestFor(BadIndexDuplicateColumn.class);
47         failOnError();
48     }
49
50     public void doTestFor(Class<?> cls) {
51         try {
52             session.newInstance(cls);
53             error("failed to throw exception for " + cls.getName());
54         } catch (ClusterJUserException ex) {
55             // good catch
56             if (debug) {
57                 System.out.println(ex.getMessage());
58             }
59         }
60     }
61
62 }