File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/cascade/MultiPathCascadeTest.java | File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/jpa/removed/RemovedEntityTest.java | |||
Method name: void testMultiPathMergeModifiedDetached()
|
Method name: void testRemoveThenContains()
|
|||
Number of AST nodes: 14 | Number of AST nodes: 14 | |||
1 | Session s = openSession();↵ | 1 | Session s = openSession(); ↵ | |
2 | s.beginTransaction();↵ | 2 | s.beginTransaction(); ↵ | |
3 | A a = new A();↵ | 3 | Item item = new Item(); ↵ | |
4 | a.setData( "Anna" );↵ | 4 | item.setName( "dummy" ); ↵ | |
5 | s.save( a );↵ | 5 | s.persist( item ); ↵ | |
6 | s.getTransaction().commit();↵ | 6 | s.getTransaction().commit(); ↵ | |
7 | s.close();↵ | 7 | s.close();↵ | |
8 | // modify detached entity↵ | |||
9 | modifyEntity( a );↵ | |||
8 | ↵ | |||
10 | s = openSession();↵ | 9 | s = openSession(); ↵ | |
11 | s.beginTransaction();↵ | 10 | s.beginTransaction(); ↵ | |
12 | a = ( A ) s.merge( a↵ | 11 | s.delete( item );↵ | |
13 | );↵ | 12 | boolean contains = s.contains( item ); ↵ | |
14 | s.getTransaction().commit();↵ | 13 | s.getTransaction().commit(); ↵ | |
15 | s.close();↵ | 14 | s.close();↵ | |
16 | verifyModifications( a.getId()↵ | |||
17 | ); | 15 | assertFalse( "expecting removed entity to not be contained", contains ); | |
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 | 76 |
Number of mapped statements | 9 |
Number of unmapped statements in the first code fragment | 5 |
Number of unmapped statements in the second code fragment | 5 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Session s = openSession(); | 1 | Session s = openSession(); | |||||||||||||||||||||||||
2 | s.beginTransaction(); | 2 | s.beginTransaction(); | |||||||||||||||||||||||||
| 3 | Item item = new Item(); | ||||||||||||||||||||||||||
3 | A a = new A(); |
| | |||||||||||||||||||||||||
|
| 4 | item.setName("dummy"); | |||||||||||||||||||||||||
4 | a.setData("Anna"); |
| | |||||||||||||||||||||||||
|
| 5 | s.persist(item); | |||||||||||||||||||||||||
5 | s.save(a); |
| | |||||||||||||||||||||||||
6 | s.getTransaction().commit(); | 6 | s.getTransaction().commit(); | |||||||||||||||||||||||||
7 | s.close(); | 7 | s.close(); | |||||||||||||||||||||||||
8 | modifyEntity(a); |
| 14 | assertFalse("expecting removed entity to not be contained", contains); | ||||||||||||||||||||||||
9 | s = openSession(); | 8 | s = openSession(); | |||||||||||||||||||||||||
10 | s.beginTransaction(); | 9 | s.beginTransaction(); | |||||||||||||||||||||||||
|
| 10 | s.delete(item); | |||||||||||||||||||||||||
|
| 11 | boolean contains = s.contains(item); | |||||||||||||||||||||||||
11 | a = (A)s.merge(a); |
| | |||||||||||||||||||||||||
12 | s.getTransaction().commit(); | 12 | s.getTransaction().commit(); | |||||||||||||||||||||||||
13 | s.close(); | 13 | s.close(); | |||||||||||||||||||||||||
14 | verifyModifications(a.getId()); | |
Row | Violation |
---|---|
1 | Unmatched statement A a=new A(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
2 | Unmatched statement item.setName("dummy"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
3 | Unmatched statement a.setData("Anna"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
4 | Unmatched statement s.persist(item); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Unmatched statement s.save(a); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
6 | Expression modifyEntity(a) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression assertFalse("expecting removed entity to not be contained",contains) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Expression modifyEntity(a) is a void method call, and thus it cannot be parameterized |
9 | Expression assertFalse("expecting removed entity to not be contained",contains) is a void method call, and thus it cannot be parameterized |
10 | Expression modifyEntity(a) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
11 | Expression assertFalse("expecting removed entity to not be contained",contains) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
12 | Expression modifyEntity(a) is a void method call, and thus it cannot be parameterized |
13 | Expression assertFalse("expecting removed entity to not be contained",contains) is a void method call, and thus it cannot be parameterized |
14 | Unmatched statement s.delete(item); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
15 | Unmatched statement boolean contains=s.contains(item); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
16 | Unmatched statement a=(A)s.merge(a); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |