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 testSaveOrUpdateCopyAny()
|
Method name: void testEmptyCollection()
|
|||
Number of AST nodes: 19 | Number of AST nodes: 18 | |||
1 | Session s = openSession();↵ | 1 | Session s = openSession();↵ | |
2 | Bar bar = new Bar();↵ | 2 | Serializable id = s.save( new Baz() );↵ | |
3 | One one = new One();↵ | 3 | ↵ | |
4 | bar.setObj↵ | 4 | s.flush();↵ | |
5 | ect(one);↵ | 5 | s.connection↵ | |
6 | s.save(bar);↵ | |||
7 | GlarchProxy g = bar.getComponent().getGlarch();↵ | |||
8 | bar.getComponent().setGlarch(null);↵ | |||
9 | s.delete(g);↵ | |||
10 | s.flush↵ | 6 | ().commit();↵ | |
7 | s.close();↵ | |||
8 | s = openSession();↵ | |||
9 | Baz baz = (Baz) s.load(Baz.class, id);↵ | |||
11 | ();↵ | 10 | Set foos = baz.getFooSet();↵ | |
12 | assertTrue( s.contains(one) );↵ | 11 | assertTrue( ↵ | |
13 | s.connection().commit();↵ | |||
14 | s.close();↵ | |||
15 | s = openSession();↵ | |||
16 | Bar bar2 = (Bar) s.saveOrUpdateCopy(bar↵ | 12 | foos.size()==0 );↵ | |
13 | Foo foo = new Foo();↵ | |||
14 | foos.add(foo);↵ | |||
17 | );↵ | 15 | s.save(foo);↵ | |
18 | s.flush();↵ | 16 | s.flush();↵ | |
19 | s.delete(bar2↵ | 17 | s.delete(foo);↵ | |
20 | );↵ | 18 | s.delete(baz);↵ | |
21 | s.flush();↵ | 19 | s.flush();↵ | |
22 | s.connection().commit();↵ | 20 | s.connection().commit();↵ | |
23 | s.close(); | 21 |
| |
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 | 133 |
Number of mapped statements | 11 |
Number of unmapped statements in the first code fragment | 8 |
Number of unmapped statements in the second code fragment | 7 |
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 | Serializable id = s.save(new Baz()); | ||||||||||||||||||||
2 | Bar bar = new Bar(); |
| 10 | Foo foo = new Foo(); | |||||||||||||||||||
3 | One one = new One(); | | |||||||||||||||||||||
4 | bar.setObject(one); |
| | ||||||||||||||||||||
5 | s.save(bar); |
| | ||||||||||||||||||||
6 | GlarchProxy g = bar.getComponent().getGlarch(); |
| | ||||||||||||||||||||
|
| 7 | Baz baz = (Baz)s.load(Baz.class, id); | ||||||||||||||||||||
7 | bar.getComponent().setGlarch(null); |
| | ||||||||||||||||||||
| 8 | Set foos = baz.getFooSet(); | |||||||||||||||||||||
8 | s.delete(g); |
| | ||||||||||||||||||||
| 9 | assertTrue(foos.size() == 0); | |||||||||||||||||||||
|
| 11 | foos.add(foo); | ||||||||||||||||||||
|
| 12 | s.save(foo); | ||||||||||||||||||||
9 | s.flush(); | 13 | s.flush(); | ||||||||||||||||||||
10 | assertTrue(s.contains(one)); |
| | ||||||||||||||||||||
|
| 14 | s.delete(foo); | ||||||||||||||||||||
11 | s.connection().commit(); | 17 | s.connection().commit(); | ||||||||||||||||||||
12 | s.close(); | 18 | s.close(); | ||||||||||||||||||||
13 | s = openSession(); | 6 | s = openSession(); | ||||||||||||||||||||
14 | Bar bar2 = (Bar)s.saveOrUpdateCopy(bar); |
| | ||||||||||||||||||||
15 | s.flush(); | 16 | s.flush(); | ||||||||||||||||||||
16 | s.delete(bar2); |
| 15 | s.delete(baz); | |||||||||||||||||||
17 | s.flush(); | 3 | s.flush(); | ||||||||||||||||||||
18 | s.connection().commit(); | 4 | s.connection().commit(); | ||||||||||||||||||||
19 | s.close(); | 5 | s.close(); |
Row | Violation |
---|---|
1 | Unmatched statement Serializable id=s.save(new Baz()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement bar.setObject(one); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement s.save(bar); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched statement GlarchProxy g=bar.getComponent().getGlarch(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Unmatched statement Baz baz=(Baz)s.load(Baz.class,id); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
6 | Unmatched statement bar.getComponent().setGlarch(null); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
7 | Unmatched statement s.delete(g); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
8 | Unmatched statement foos.add(foo); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
9 | Unmatched statement s.save(foo); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
10 | Unmatched statement assertTrue(s.contains(one)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
11 | Unmatched statement s.delete(foo); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
12 | Unmatched statement Bar bar2=(Bar)s.saveOrUpdateCopy(bar); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
13 | Type org.hibernate.test.legacy.Bar of variable bar2 does not match with type org.hibernate.test.legacy.Baz of variable baz |
14 | Clone fragment #1 returns variables bar, s , while Clone fragment #2 returns variables s, foo |