File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/event/collection/AbstractCollectionEventTest.java | File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/event/collection/BrokenCollectionEventTest.java | |||
Method name: void cleanupTest()
|
Method name: void cleanupTest()
|
|||
Number of AST nodes: 15 | Number of AST nodes: 15 | |||
1 | ParentWithCollection dummyParent = createParent( "dummyParent" );↵ | 1 | ParentWithCollection dummyParent = createParent( "dummyParent" );↵ | |
2 | dummyParent.newChildren( createCollection() );↵ | 2 | dummyParent.setChildren( createCollection() );↵ | |
3 | Child dummyChild = dummyParent.addChild( "dummyChild" );↵ | 3 | Child dummyChild = dummyParent.addChild( "dummyChild" );↵ | |
4 | Session s = openSession();↵ | 4 | Session s = openSession();↵ | |
5 | Transaction tx = s.beginTransaction();↵ | 5 | Transaction tx = s.beginTransaction();↵ | |
6 | List children = s.createCriteria( dummyChild.getClass() ).list();↵ | 6 | List children = s.createCriteria( dummyChild.getClass() ).list();↵ | |
7 | List parents = s.createCriteria( dummyParent.getClass() ).list();↵ | 7 | List parents = s.createCriteria( dummyParent.getClass() ).list();↵ | |
8 | for ( Iterator it = parents.iterator(); it.hasNext(); ) {↵ | 8 | for ( Iterator it = parents.iterator(); it.hasNext(); ) {↵ | |
9 | ParentWithCollection parent = ( ParentWithCollection ) it.next();↵ | 9 | ParentWithCollection parent = ( ParentWithCollection ) it.next();↵ | |
10 | parent.clearChildren();↵ | 10 | parent.clearChildren();↵ | |
11 | s.delete( parent );↵ | 11 | s.delete( parent );↵ | |
12 | }↵ | 12 | }↵ | |
13 | for ( Iterator it = children.iterator(); it.hasNext(); ) {↵ | 13 | for ( Iterator it = children.iterator(); it.hasNext(); ) {↵ | |
14 | s.delete( it.next() );↵ | 14 | s.delete( it.next() );↵ | |
15 | }↵ | 15 | }↵ | |
16 | tx.commit();↵ | 16 | tx.commit();↵ | |
17 | s.close(); | 17 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.5 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 66 |
Number of mapped statements | 15 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 25.4 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | ParentWithCollection dummyParent = createParent("dummyParent"); | 1 | ParentWithCollection dummyParent = createParent("dummyParent"); | |||||||||||||||
2 | dummyParent.newChildren(createCollection()); |
| 2 | dummyParent.setChildren(createCollection()); | ||||||||||||||
3 | Child dummyChild = dummyParent.addChild("dummyChild"); | 3 | Child dummyChild = dummyParent.addChild("dummyChild"); | |||||||||||||||
4 | Session s = openSession(); | 4 | Session s = openSession(); | |||||||||||||||
5 | Transaction tx = s.beginTransaction(); | 5 | Transaction tx = s.beginTransaction(); | |||||||||||||||
6 | List children = s.createCriteria(dummyChild.getClass()).list(); | 6 | List children = s.createCriteria(dummyChild.getClass()).list(); | |||||||||||||||
7 | List parents = s.createCriteria(dummyParent.getClass()).list(); | 7 | List parents = s.createCriteria(dummyParent.getClass()).list(); | |||||||||||||||
8 | for (Iterator it = parents.iterator(); it.hasNext(); ) | 8 | for (Iterator it = parents.iterator(); it.hasNext(); ) | |||||||||||||||
9 | ParentWithCollection parent = (ParentWithCollection)it.next(); | 9 | ParentWithCollection parent = (ParentWithCollection)it.next(); | |||||||||||||||
10 | parent.clearChildren(); | 10 | parent.clearChildren(); | |||||||||||||||
11 | s.delete(parent); | 11 | s.delete(parent); | |||||||||||||||
12 | for (Iterator it = children.iterator(); it.hasNext(); ) | 12 | for (Iterator it = children.iterator(); it.hasNext(); ) | |||||||||||||||
13 | s.delete(it.next()); | 13 | s.delete(it.next()); | |||||||||||||||
14 | tx.commit(); | 14 | tx.commit(); | |||||||||||||||
15 | s.close(); | 15 | s.close(); |
Row | Violation |
---|---|
1 | Expression dummyParent.newChildren(createCollection()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression dummyParent.setChildren(createCollection()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression dummyParent.newChildren(createCollection()) is a void method call, and thus it cannot be parameterized |
4 | Expression dummyParent.setChildren(createCollection()) is a void method call, and thus it cannot be parameterized |