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/ParentChildTest.java | |||
Method name: void testEmptyCollection()
|
Method name: void testObjectType()
|
|||
Number of AST nodes: 18 | Number of AST nodes: 17 | |||
1 | Session s = openSession();↵ | 1 | Session s = openSession();↵ | |
2 | Serializable id = s.save( new Baz() ↵ | 2 | Parent g = new Parent();↵ | |
3 | Foo foo = new Foo();↵ | |||
4 | g.setAny(foo);↵ | |||
5 | s.save(g);↵ | |||
3 | );↵ | 6 | s.save(foo);↵ | |
4 | s.flush();↵ | 7 | s.flush();↵ | |
5 | s.connection().commit();↵ | 8 | s.connection().commit();↵ | |
6 | s.close();↵ | 9 | s.close();↵ | |
7 | s = openSession();↵ | 10 | s = openSession();↵ | |
8 | Baz baz = (Baz) s.load(Baz.class, id);↵ | 11 | g = (Parent) s.load( Parent.class, ↵ | |
9 | Set foos = baz.getFooSet();↵ | |||
10 | assertTrue( foos.size()==0 );↵ | |||
11 | Foo foo = new Foo();↵ | |||
12 | foos.add(foo);↵ | |||
13 | s.save(foo);↵ | |||
14 | s.flush(↵ | 12 | new Long( g.getId() ) );↵ | |
15 | );↵ | 13 | assertTrue( g.getAny()!=null && g.getAny() instanceof FooProxy );↵ | |
16 | s.delete(foo);↵ | 14 | s.delete( g.getAny() );↵ | |
17 | s.delete(baz);↵ | 15 | s.delete(g);↵ | |
18 | s.flush();↵ | 16 | s.flush();↵ | |
19 | s.connection().commit();↵ | 17 | s.connection().commit();↵ | |
20 | s.close(); | 18 |
| |
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 | 127 |
Number of mapped statements | 12 |
Number of unmapped statements in the first code fragment | 6 |
Number of unmapped statements in the second code fragment | 5 |
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 | Parent g = new Parent(); | ||||||||||||||||||||||||
2 | Serializable id = s.save(new Baz()); |
| | |||||||||||||||||||||||
3 | s.flush(); | 7 | s.flush(); | |||||||||||||||||||||||
4 | s.connection().commit(); | 8 | s.connection().commit(); | |||||||||||||||||||||||
5 | s.close(); | 9 | s.close(); | |||||||||||||||||||||||
6 | s = openSession(); | 10 | s = openSession(); | |||||||||||||||||||||||
7 | Baz baz = (Baz)s.load(Baz.class, id); | | ||||||||||||||||||||||||
8 | Set foos = baz.getFooSet(); | | ||||||||||||||||||||||||
9 | assertTrue(foos.size() == 0); | | ||||||||||||||||||||||||
10 | Foo foo = new Foo(); | 3 | Foo foo = new Foo(); | |||||||||||||||||||||||
|
| 4 | g.setAny(foo); | |||||||||||||||||||||||
11 | foos.add(foo); | | ||||||||||||||||||||||||
12 | s.save(foo); |
| 5 | s.save(g); | ||||||||||||||||||||||
|
| 6 | s.save(foo); | |||||||||||||||||||||||
|
| 11 | g = (Parent)s.load(Parent.class, new Long(g.getId())); | |||||||||||||||||||||||
13 | s.flush(); |
| 12 | assertTrue(g.getAny() != null && g.getAny() instanceof FooProxy); | ||||||||||||||||||||||
| 13 | s.delete(g.getAny()); | ||||||||||||||||||||||||
14 | s.delete(foo); |
| 14 | s.delete(g); | ||||||||||||||||||||||
15 | s.delete(baz); | | ||||||||||||||||||||||||
16 | s.flush(); | 15 | s.flush(); | |||||||||||||||||||||||
17 | s.connection().commit(); | 16 | s.connection().commit(); | |||||||||||||||||||||||
18 | s.close(); | 17 | 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 g.setAny(foo); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Expression foo cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Type org.hibernate.test.legacy.Foo of variable foo does not match with type org.hibernate.test.legacy.Parent of variable g |
5 | 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 |
6 | Unmatched statement g=(Parent)s.load(Parent.class,new Long(g.getId())); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
7 | Expression s.flush() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Expression s.flush() is a void method call, and thus it cannot be parameterized |
9 | Expression assertTrue(g.getAny() != null && g.getAny() instanceof FooProxy) is a void method call, and thus it cannot be parameterized |
10 | Expression s.flush() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
11 | Expression s.flush() is a void method call, and thus it cannot be parameterized |
12 | Expression assertTrue(g.getAny() != null && g.getAny() instanceof FooProxy) is a void method call, and thus it cannot be parameterized |
13 | Expression foo cannot be parameterized, because it has dependencies to/from statements that will be extracted |
14 | Type org.hibernate.test.legacy.Foo of variable foo does not match with type org.hibernate.test.legacy.Parent of variable g |
15 | Clone fragment #1 returns variables s, foo , while Clone fragment #2 returns variables foo, s |