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/AbstractCollectionEventTest.java | |||
Method name: void testDeleteParentWithNullChildren()
|
Method name: void testDeleteParentWithNoChildren()
|
|||
Number of AST nodes: 14 | Number of AST nodes: 14 | |||
1 | CollectionListeners listeners = new CollectionListeners( getSessions() );↵ | 1 | CollectionListeners listeners = new CollectionListeners( getSessions() );↵ | |
2 | ParentWithCollection parent = createParentWithNullChildren( "parent" );↵ | 2 | ParentWithCollection parent = createParentWithNoChildren( "parent" );↵ | |
3 | listeners.clear();↵ | 3 | listeners.clear();↵ | |
4 | Session s = openSession();↵ | 4 | Session s = openSession();↵ | |
5 | Transaction tx = s.beginTransaction();↵ | 5 | Transaction tx = s.beginTransaction();↵ | |
6 | parent = ( ParentWithCollection ) s.get( parent.getClass(), parent.getId() );↵ | 6 | parent = ( ParentWithCollection ) s.get( parent.getClass(), parent.getId() );↵ | |
7 | s.delete( parent );↵ | 7 | s.delete( parent );↵ | |
8 | tx.commit();↵ | 8 | tx.commit();↵ | |
9 | s.close();↵ | 9 | s.close();↵ | |
10 | int index = 0;↵ | 10 | int index = 0;↵ | |
11 | checkResult( listeners, listeners.getInitializeCollectionListener(), parent, index++ );↵ | 11 | checkResult( listeners, listeners.getInitializeCollectionListener(), parent, index++ );↵ | |
12 | checkResult( listeners, listeners.getPreCollectionRemoveListener(), parent, index++ );↵ | 12 | checkResult( listeners, listeners.getPreCollectionRemoveListener(), parent, index++ );↵ | |
13 | checkResult( listeners, listeners.getPostCollectionRemoveListener(), parent, index++ );↵ | 13 | checkResult( listeners, listeners.getPostCollectionRemoveListener(), parent, index++ );↵ | |
14 | checkNumberOfResults( listeners, index ); | 14 |
| |
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.0 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 128 |
Number of mapped statements | 14 |
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) | 0.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | CollectionListeners listeners = new CollectionListeners(getSessions()); | 1 | CollectionListeners listeners = new CollectionListeners(getSessions()); | |||||||||||
2 | ParentWithCollection parent = createParentWithNullChildren("parent"); |
| 2 | ParentWithCollection parent = createParentWithNoChildren("parent"); | ||||||||||
3 | listeners.clear(); | 3 | listeners.clear(); | |||||||||||
4 | Session s = openSession(); | 4 | Session s = openSession(); | |||||||||||
5 | Transaction tx = s.beginTransaction(); | 5 | Transaction tx = s.beginTransaction(); | |||||||||||
6 | parent = (ParentWithCollection)s.get(parent.getClass(), parent.getId()); | 6 | parent = (ParentWithCollection)s.get(parent.getClass(), parent.getId()); | |||||||||||
7 | s.delete(parent); | 7 | s.delete(parent); | |||||||||||
8 | tx.commit(); | 8 | tx.commit(); | |||||||||||
9 | s.close(); | 9 | s.close(); | |||||||||||
10 | int index = 0; | 10 | int index = 0; | |||||||||||
11 | checkResult(listeners, listeners.getInitializeCollectionListener(), parent, index++); | 11 | checkResult(listeners, listeners.getInitializeCollectionListener(), parent, index++); | |||||||||||
12 | checkResult(listeners, listeners.getPreCollectionRemoveListener(), parent, index++); | 12 | checkResult(listeners, listeners.getPreCollectionRemoveListener(), parent, index++); | |||||||||||
13 | checkResult(listeners, listeners.getPostCollectionRemoveListener(), parent, index++); | 13 | checkResult(listeners, listeners.getPostCollectionRemoveListener(), parent, index++); | |||||||||||
14 | checkNumberOfResults(listeners, index); | 14 | checkNumberOfResults(listeners, index); |
Row | Violation |
---|