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 testSchemaTools()
|
Method name: void testSchemaToolsNonQuote()
|
|||
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 | // we can run schema validation. Note that in the setUp method a *wrong* table↵ | 14 | // we can run schema validation. Note that in the setUp method a *wrong* table↵ | |
15 | // has been created with different column names↵ | 15 | // has been created with different column names↵ | |
16 | // if schema validator chooses the bad db schema, then the testcase will fail (exception)↵ | 16 | // if schema validator chooses the bad db schema, then the testcase will fail (exception)↵ | |
17 | SchemaValidator sv = new SchemaValidator(getCfg());↵ | 17 | SchemaValidator sv = new SchemaValidator(getCfg());↵ | |
18 | sv.validate();↵ | 18 | sv.validate();↵ | |
19 | ↵ | 19 | ↵ | |
20 | // it's time to clean our database↵ | 20 | // it's time to clean our database↵ | |
21 | se.drop(true,true);↵ | 21 | se.drop(true,true);↵ | |
22 | ↵ | 22 | ↵ | |
23 | // then the schemas and false table.↵ | 23 | // then the schemas and false table.↵ | |
24 | stat.execute("DROP TABLE \"SA\".\"Team\" ");↵ | 24 | stat.execute("DROP TABLE \"SA\".\"Team\" ");↵ | |
25 | stat.execute(" DROP SCHEMA sa ");↵ | 25 | stat.execute(" DROP SCHEMA sa ");↵ | |
26 | stat.execute("DROP SCHEMA sb ");↵ | 26 | stat.execute("DROP SCHEMA sb ");↵ | |
27 | stat.close();↵ | 27 | stat.close();↵ | |
28 | session.close(); | 28 |
| |
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.0 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 114 |
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) | 0.0 |
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 | SchemaUpdate su = new SchemaUpdate(getCfg()); | 7 | SchemaUpdate su = new SchemaUpdate(getCfg()); | |||||||||||
8 | su.execute(true, true); | 8 | su.execute(true, true); | |||||||||||
9 | SchemaValidator sv = new SchemaValidator(getCfg()); | 9 | SchemaValidator sv = new SchemaValidator(getCfg()); | |||||||||||
10 | sv.validate(); | 10 | sv.validate(); | |||||||||||
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 |
---|