File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/legacy/FooBarTest.java | File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/legacy/FooBarTest.java | |||
Method name: void testCachedCollection()
|
Method name: void testCollectionCache()
|
|||
Number of AST nodes: 20 | Number of AST nodes: 18 | |||
1 | Session s = openSession();↵ | 1 | Session s = openSession();↵ | |
2 | Baz baz = new Baz();↵ | 2 | Baz baz = new Baz();↵ | |
3 | baz.setDefaults();↵ | 3 | baz.setDefaults();↵ | |
4 | s.save(baz);↵ | 4 | s.save(baz);↵ | |
5 | s.flush();↵ | 5 | s.flush();↵ | |
6 | s.connection().commit();↵ | 6 | s.connection().commit();↵ | |
7 | s.close();↵ | 7 | s.close();↵ | |
8 | s = openSession();↵ | 8 | s = openSession();↵ | |
9 | baz = (Baz) s.load( Baz.class, baz.getCode() );↵ | 9 | s.load( Baz.class, baz.getCode() );↵ | |
10 | ( (FooComponent) baz.getTopComponents().get(0) ).setCount(99);↵ | 10 | ↵ | |
11 | s.flush();↵ | 11 | s.flush();↵ | |
12 | s.connection().commit();↵ | 12 | s.connection().commit();↵ | |
13 | s.close();↵ | 13 | s.close();↵ | |
14 | s = openSession();↵ | 14 | s = openSession();↵ | |
15 | baz = (Baz) s.load( Baz.class, baz.getCode() );↵ | 15 | baz = (Baz) s.load( Baz.class, baz.getCode() );↵ | |
16 | assertTrue( ( (FooComponent) baz.getTopComponents().get(0) ).getCount()==99 );↵ | 16 | ↵ | |
17 | s.delete(baz);↵ | 17 | s.delete(baz);↵ | |
18 | s.flush();↵ | 18 | s.flush();↵ | |
19 | s.connection().commit();↵ | 19 | s.connection().commit();↵ | |
20 | s.close(); | 20 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
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 | 70 |
Number of mapped statements | 17 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||
---|---|---|---|---|---|---|---|
1 | Session s = openSession(); | 1 | Session s = openSession(); | ||||
2 | Baz baz = new Baz(); | 2 | Baz baz = new Baz(); | ||||
3 | baz.setDefaults(); | 3 | baz.setDefaults(); | ||||
4 | s.save(baz); | 4 | s.save(baz); | ||||
5 | s.flush(); | 5 | s.flush(); | ||||
6 | s.connection().commit(); | 6 | s.connection().commit(); | ||||
7 | s.close(); | 7 | s.close(); | ||||
8 | s = openSession(); | 8 | s = openSession(); | ||||
|
| 9 | s.load(Baz.class, baz.getCode()); | ||||
9 | baz = (Baz)s.load(Baz.class, baz.getCode()); | 14 | baz = (Baz)s.load(Baz.class, baz.getCode()); | ||||
10 | ((FooComponent)baz.getTopComponents().get(0)).setCount(99); | | |||||
11 | s.flush(); | 10 | s.flush(); | ||||
12 | s.connection().commit(); | 11 | s.connection().commit(); | ||||
13 | s.close(); | 12 | s.close(); | ||||
14 | s = openSession(); | 13 | s = openSession(); | ||||
15 | baz = (Baz)s.load(Baz.class, baz.getCode()); |
| | ||||
16 | assertTrue(((FooComponent)baz.getTopComponents().get(0)).getCount() == 99); | | |||||
17 | s.delete(baz); | 15 | s.delete(baz); | ||||
18 | s.flush(); | 16 | s.flush(); | ||||
19 | s.connection().commit(); | 17 | s.connection().commit(); | ||||
20 | s.close(); | 18 | s.close(); |
Row | Violation |
---|---|
1 | Unmatched statement s.load(Baz.class,baz.getCode()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement baz=(Baz)s.load(Baz.class,baz.getCode()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Clone fragment #1 returns variables baz, s , while Clone fragment #2 returns variables baz, s |