File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/unmaintained/org/hibernate/test/tool/TestSchemaTools.java | File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/unmaintained/org/hibernate/test/tool/TestSchemaTools.java | |||
Method name: void testFailingQuoteValidation()
|
Method name: void testFailingNonQuoteValidation()
|
|||
Number of AST nodes: 16 | Number of AST nodes: 16 | |||
1 | SchemaExport se = new SchemaExport(getCfg());↵ | 1 | SchemaExport se = new SchemaExport(getCfg());↵ | |
2 | se.create(true,true);↵ | 2 | se.create(true,true);↵ | |
3 | ↵ | 3 | ↵ | |
4 | // here we modify the generated table in order to test SchemaUpdate↵ | 4 | // here we modify the generated table in order to test SchemaUpdate↵ | |
5 | Session session = openSession();↵ | 5 | Session session = openSession();↵ | |
6 | Connection conn = session.connection();↵ | 6 | Connection conn = session.connection();↵ | |
7 | Statement stat = conn.createStatement();↵ | 7 | Statement stat = conn.createStatement();↵ | |
8 | stat.execute("ALTER TABLE \"SB\".\"Team\" DROP COLUMN name ");↵ | 8 | stat.execute("ALTER TABLE \"SB\".\"TEAM\" DROP COLUMN xname ");↵ | |
9 | ↵ | 9 | ↵ | |
10 | // update schema↵ | 10 | // update schema↵ | |
11 | //SchemaUpdate su = new SchemaUpdate(getCfg());↵ | 11 | //SchemaUpdate su = new SchemaUpdate(getCfg());↵ | |
12 | //su.execute(true,true);↵ | 12 | //su.execute(true,true);↵ | |
13 | ↵ | 13 | ↵ | |
14 | try {↵ | 14 | try {↵ | |
15 | SchemaValidator sv = new SchemaValidator(getCfg());↵ | 15 | SchemaValidator sv = new SchemaValidator(getCfg());↵ | |
16 | sv.validate();↵ | 16 | sv.validate();↵ | |
17 | fail("should fail since we mutated the current schema.");↵ | 17 | fail("should fail since we mutated the current schema.");↵ | |
18 | } catch(HibernateException he) {↵ | 18 | } catch(HibernateException he) {↵ | |
19 | ↵ | 19 | ↵ | |
20 | }↵ | 20 | }↵ | |
21 | ↵ | 21 | ↵ | |
22 | // it's time to clean our database↵ | 22 | // it's time to clean our database↵ | |
23 | se.drop(true,true);↵ | 23 | se.drop(true,true);↵ | |
24 | ↵ | 24 | ↵ | |
25 | // then the schemas and false table.↵ | 25 | // then the schemas and false table.↵ | |
26 | stat.execute("DROP TABLE \"SA\".\"Team\" ");↵ | 26 | stat.execute("DROP TABLE \"SA\".\"Team\" ");↵ | |
27 | stat.execute(" DROP SCHEMA sa ");↵ | 27 | stat.execute(" DROP SCHEMA sa ");↵ | |
28 | stat.execute("DROP SCHEMA sb ");↵ | 28 | stat.execute("DROP SCHEMA sb ");↵ | |
29 | stat.close();↵ | 29 | stat.close();↵ | |
30 | session.close(); | 30 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.1 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 106 |
Number of mapped statements | 16 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 4.8 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | SchemaExport se = new SchemaExport(getCfg()); | 1 | SchemaExport se = new SchemaExport(getCfg()); | |||||||||||
2 | se.create(true, true); | 2 | se.create(true, true); | |||||||||||
3 | Session session = openSession(); | 3 | Session session = openSession(); | |||||||||||
4 | Connection conn = session.connection(); | 4 | Connection conn = session.connection(); | |||||||||||
5 | Statement stat = conn.createStatement(); | 5 | Statement stat = conn.createStatement(); | |||||||||||
6 | stat.execute("ALTER TABLE \"SB\".\"Team\" DROP COLUMN name "); |
| 6 | stat.execute("ALTER TABLE \"SB\".\"TEAM\" DROP COLUMN xname "); | ||||||||||
7 | try | 7 | try | |||||||||||
8 | SchemaValidator sv = new SchemaValidator(getCfg()); | 8 | SchemaValidator sv = new SchemaValidator(getCfg()); | |||||||||||
9 | sv.validate(); | 9 | sv.validate(); | |||||||||||
10 | fail("should fail since we mutated the current schema."); | 10 | fail("should fail since we mutated the current schema."); | |||||||||||
11 | se.drop(true, true); | 11 | se.drop(true, true); | |||||||||||
12 | stat.execute("DROP TABLE \"SA\".\"Team\" "); | 12 | stat.execute("DROP TABLE \"SA\".\"Team\" "); | |||||||||||
13 | stat.execute(" DROP SCHEMA sa "); | 13 | stat.execute(" DROP SCHEMA sa "); | |||||||||||
14 | stat.execute("DROP SCHEMA sb "); | 14 | stat.execute("DROP SCHEMA sb "); | |||||||||||
15 | stat.close(); | 15 | stat.close(); | |||||||||||
16 | session.close(); | 16 | session.close(); |
Row | Violation |
---|