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/MultiTableTest.java | |||
Method name: void testEmptyCollection()
|
Method name: void testCollectionPointer()
|
|||
Number of AST nodes: 18 | Number of AST nodes: 19 | |||
1 | Session s = openSession();↵ | 1 | Session sess = openSession();↵ | |
2 | ↵ | 2 | Lower ls = new Lower();↵ | |
3 | List list = new ArrayList();↵ | |||
4 | ls.setBag(list);↵ | |||
5 | Top s = new Top();↵ | |||
3 | Serializable id = s.save( new Baz() );↵ | 6 | Serializable id = sess.save(↵ | |
4 | ↵ | 7 | ls);↵ | |
8 | sess.save(s);↵ | |||
9 | sess.flush();↵ | |||
10 | list.add(s);↵ | |||
5 | s.flush();↵ | 11 | sess.flush();↵ | |
6 | s.connection().commit();↵ | 12 | sess.connection().commit();↵ | |
7 | s.close();↵ | 13 | sess.close();↵ | |
8 | s = openSession();↵ | 14 | sess = openSession();↵ | |
9 | Baz baz = (Baz) s.load(Baz.class, id);↵ | 15 | ls = (Lower) sess.load(Lower.class, id);↵ | |
10 | Set foos = baz.getFooSet();↵ | 16 | ↵ | |
11 | assertTrue( foos.size()==0 );↵ | 17 | assertTrue( ls.getBag().size()==1 );↵ | |
12 | Foo foo = new Foo();↵ | 18 | ↵ | |
13 | foos.add(foo);↵ | |||
14 | s.save(foo);↵ | |||
15 | s.flush();↵ | |||
16 | s.delete(foo);↵ | |||
17 | s.delete(baz);↵ | 19 | sess.delete("from java.lang.Object");↵ | |
18 | s.flush();↵ | 20 | sess.flush();↵ | |
19 | s.connection().commit();↵ | 21 | sess.connection().commit();↵ | |
20 | s.close(); | 22 | sess.close(); | |
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 in different classes having the same super class |
Number of node comparisons | 342 |
Number of mapped statements | 12 |
Number of unmapped statements in the first code fragment | 6 |
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 sess = openSession(); | ||||||||||||||||||||||||
| 2 | Lower ls = new Lower(); | ||||||||||||||||||||||||||
2 | Serializable id = s.save(new Baz()); |
| | |||||||||||||||||||||||||
| 3 | List list = new ArrayList(); | ||||||||||||||||||||||||||
| 4 | ls.setBag(list); | ||||||||||||||||||||||||||
| 5 | Top s = new Top(); | ||||||||||||||||||||||||||
|
| 6 | Serializable id = sess.save(ls); | |||||||||||||||||||||||||
3 | s.flush(); |
| 8 | sess.flush(); | ||||||||||||||||||||||||
4 | s.connection().commit(); |
| 18 | sess.connection().commit(); | ||||||||||||||||||||||||
5 | s.close(); |
| 12 | sess.close(); | ||||||||||||||||||||||||
6 | s = openSession(); |
| 13 | sess = openSession(); | ||||||||||||||||||||||||
7 | Baz baz = (Baz)s.load(Baz.class, id); | | ||||||||||||||||||||||||||
8 | Set foos = baz.getFooSet(); | | ||||||||||||||||||||||||||
9 | assertTrue(foos.size() == 0); |
| 11 | sess.connection().commit(); | ||||||||||||||||||||||||
10 | Foo foo = new Foo(); | | ||||||||||||||||||||||||||
11 | foos.add(foo); |
| 9 | list.add(s); | ||||||||||||||||||||||||
12 | s.save(foo); |
| 7 | sess.save(s); | ||||||||||||||||||||||||
13 | s.flush(); |
| 10 | sess.flush(); | ||||||||||||||||||||||||
|
| 14 | ls = (Lower)sess.load(Lower.class, id); | |||||||||||||||||||||||||
14 | s.delete(foo); |
| 17 | sess.flush(); | ||||||||||||||||||||||||
15 | s.delete(baz); | | ||||||||||||||||||||||||||
16 | s.flush(); |
| 15 | assertTrue(ls.getBag().size() == 1); | ||||||||||||||||||||||||
| 16 | sess.delete("from java.lang.Object"); | ||||||||||||||||||||||||||
17 | s.connection().commit(); | | ||||||||||||||||||||||||||
18 | s.close(); |
| 19 | sess.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 Serializable id=sess.save(ls); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Expression sess.connection().commit() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression assertTrue(foos.size() == 0) is a void method call, and thus it cannot be parameterized |
5 | Expression sess.connection().commit() is a void method call, and thus it cannot be parameterized |
6 | Expression sess.connection().commit() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression assertTrue(foos.size() == 0) is a void method call, and thus it cannot be parameterized |
8 | Expression sess.connection().commit() is a void method call, and thus it cannot be parameterized |
9 | Type org.hibernate.test.legacy.Foo of variable foo does not match with type org.hibernate.test.legacy.Top of variable s |
10 | Type java.util.Set of variable foos does not match with type java.util.List of variable list |
11 | Type org.hibernate.test.legacy.Foo of variable foo does not match with type org.hibernate.test.legacy.Top of variable s |
12 | Unmatched statement ls=(Lower)sess.load(Lower.class,id); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
13 | Expression s.delete(foo) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
14 | Expression sess.flush() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
15 | Expression s.delete(foo) is a void method call, and thus it cannot be parameterized |
16 | Expression sess.flush() is a void method call, and thus it cannot be parameterized |
17 | Expression s.delete(foo) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
18 | Expression sess.flush() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
19 | Expression s.delete(foo) is a void method call, and thus it cannot be parameterized |
20 | Expression sess.flush() is a void method call, and thus it cannot be parameterized |
21 | Expression s.flush() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
22 | Expression s.flush() is a void method call, and thus it cannot be parameterized |
23 | Expression assertTrue(ls.getBag().size() == 1) is a void method call, and thus it cannot be parameterized |
24 | Expression s.flush() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
25 | Expression s.flush() is a void method call, and thus it cannot be parameterized |
26 | Expression assertTrue(ls.getBag().size() == 1) is a void method call, and thus it cannot be parameterized |