File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/ops/MergeTest.java | File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/ops/SaveOrUpdateTest.java | |||
Method name: void testMergeDeepTree()
|
Method name: void testSaveOrUpdateDeepTree()
|
|||
Number of AST nodes: 47 | Number of AST nodes: 47 | |||
1 | clearCounts();↵ | 1 | clearCounts();↵ | |
2 | Session s = openSession();↵ | 2 | Session s = openSession();↵ | |
3 | Transaction tx = s.beginTransaction();↵ | 3 | Transaction tx = s.beginTransaction();↵ | |
4 | Node root = new Node("root");↵ | 4 | Node root = new Node( "root" );↵ | |
5 | Node child = new Node("child");↵ | 5 | Node child = new Node( "child" );↵ | |
6 | Node grandchild = new Node("grandchild");↵ | 6 | Node grandchild = new Node( "grandchild" );↵ | |
7 | root.addChild(child);↵ | 7 | root.addChild( child );↵ | |
8 | child.addChild(grandchild);↵ | 8 | child.addChild( grandchild );↵ | |
9 | s.merge(root);↵ | 9 | s.saveOrUpdate( root );↵ | |
10 | tx.commit();↵ | 10 | tx.commit();↵ | |
11 | s.close();↵ | 11 | s.close();↵ | |
12 | assertInsertCount(3);↵ | 12 | assertInsertCount( 3 );↵ | |
13 | assertUpdateCount(0);↵ | 13 | assertUpdateCount( 0 );↵ | |
14 | clearCounts();↵ | 14 | clearCounts();↵ | |
15 | grandchild.setDescription("the grand child");↵ | 15 | grandchild.setDescription( "the grand child" );↵ | |
16 | Node grandchild2 = new Node("grandchild2");↵ | 16 | Node grandchild2 = new Node( "grandchild2" );↵ | |
17 | child.addChild( grandchild2 );↵ | 17 | child.addChild( grandchild2 );↵ | |
18 | s = openSession();↵ | 18 | s = openSession();↵ | |
19 | tx = s.beginTransaction();↵ | 19 | tx = s.beginTransaction();↵ | |
20 | s.merge(root);↵ | 20 | s.saveOrUpdate( root );↵ | |
21 | tx.commit();↵ | 21 | tx.commit();↵ | |
22 | s.close();↵ | 22 | s.close();↵ | |
23 | assertInsertCount(1);↵ | 23 | assertInsertCount( 1 );↵ | |
24 | assertUpdateCount(1);↵ | 24 | assertUpdateCount( 1 );↵ | |
25 | clearCounts();↵ | 25 | clearCounts();↵ | |
26 | Node child2 = new Node("child2");↵ | 26 | Node child2 = new Node( "child2" );↵ | |
27 | Node grandchild3 = new Node("grandchild3");↵ | 27 | Node grandchild3 = new Node( "grandchild3" );↵ | |
28 | child2.addChild( grandchild3 );↵ | 28 | child2.addChild( grandchild3 );↵ | |
29 | root.addChild(child2);↵ | 29 | root.addChild( child2 );↵ | |
30 | s = openSession();↵ | 30 | s = openSession();↵ | |
31 | tx = s.beginTransaction();↵ | 31 | tx = s.beginTransaction();↵ | |
32 | s.merge(root);↵ | 32 | s.saveOrUpdate( root );↵ | |
33 | tx.commit();↵ | 33 | tx.commit();↵ | |
34 | s.close();↵ | 34 | s.close();↵ | |
35 | assertInsertCount(2);↵ | 35 | assertInsertCount( 2 );↵ | |
36 | assertUpdateCount(0);↵ | 36 | assertUpdateCount( 0 );↵ | |
37 | clearCounts();↵ | 37 | clearCounts();↵ | |
38 | s = openSession();↵ | 38 | s = openSession();↵ | |
39 | tx = s.beginTransaction();↵ | 39 | tx = s.beginTransaction();↵ | |
40 | s.delete(grandchild);↵ | 40 | s.delete( grandchild );↵ | |
41 | s.delete(grandchild2);↵ | 41 | s.delete( grandchild2 );↵ | |
42 | s.delete(grandchild3);↵ | 42 | s.delete( grandchild3 );↵ | |
43 | s.delete(child);↵ | 43 | s.delete( child );↵ | |
44 | s.delete(child2);↵ | 44 | s.delete( child2 );↵ | |
45 | s.delete(root);↵ | 45 | s.delete( root );↵ | |
46 | tx.commit();↵ | 46 | tx.commit();↵ | |
47 | s.close(); | 47 |
| |
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 in different classes having the same super class |
Number of node comparisons | 402 |
Number of mapped statements | 44 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 3 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||
---|---|---|---|---|---|---|---|
1 | clearCounts(); | 1 | clearCounts(); | ||||
2 | Session s = openSession(); | 2 | Session s = openSession(); | ||||
3 | Transaction tx = s.beginTransaction(); | 3 | Transaction tx = s.beginTransaction(); | ||||
4 | Node root = new Node("root"); | 4 | Node root = new Node("root"); | ||||
5 | Node child = new Node("child"); | 5 | Node child = new Node("child"); | ||||
6 | Node grandchild = new Node("grandchild"); | 6 | Node grandchild = new Node("grandchild"); | ||||
7 | root.addChild(child); | 7 | root.addChild(child); | ||||
8 | child.addChild(grandchild); | 8 | child.addChild(grandchild); | ||||
|
| 9 | s.saveOrUpdate(root); | ||||
9 | s.merge(root); |
| | ||||
10 | tx.commit(); | 10 | tx.commit(); | ||||
11 | s.close(); | 11 | s.close(); | ||||
12 | assertInsertCount(3); | 12 | assertInsertCount(3); | ||||
13 | assertUpdateCount(0); | 13 | assertUpdateCount(0); | ||||
14 | clearCounts(); | 14 | clearCounts(); | ||||
15 | grandchild.setDescription("the grand child"); | 15 | grandchild.setDescription("the grand child"); | ||||
16 | Node grandchild2 = new Node("grandchild2"); | 16 | Node grandchild2 = new Node("grandchild2"); | ||||
17 | child.addChild(grandchild2); | 17 | child.addChild(grandchild2); | ||||
18 | s = openSession(); | 18 | s = openSession(); | ||||
19 | tx = s.beginTransaction(); | 19 | tx = s.beginTransaction(); | ||||
|
| 20 | s.saveOrUpdate(root); | ||||
20 | s.merge(root); |
| | ||||
21 | tx.commit(); | 21 | tx.commit(); | ||||
22 | s.close(); | 22 | s.close(); | ||||
23 | assertInsertCount(1); | 23 | assertInsertCount(1); | ||||
24 | assertUpdateCount(1); | 24 | assertUpdateCount(1); | ||||
25 | clearCounts(); | 25 | clearCounts(); | ||||
26 | Node child2 = new Node("child2"); | 26 | Node child2 = new Node("child2"); | ||||
27 | Node grandchild3 = new Node("grandchild3"); | 27 | Node grandchild3 = new Node("grandchild3"); | ||||
28 | child2.addChild(grandchild3); | 28 | child2.addChild(grandchild3); | ||||
29 | root.addChild(child2); | 29 | root.addChild(child2); | ||||
30 | s = openSession(); | 30 | s = openSession(); | ||||
31 | tx = s.beginTransaction(); | 31 | tx = s.beginTransaction(); | ||||
|
| 32 | s.saveOrUpdate(root); | ||||
32 | s.merge(root); |
| | ||||
33 | tx.commit(); | 33 | tx.commit(); | ||||
34 | s.close(); | 34 | s.close(); | ||||
35 | assertInsertCount(2); | 35 | assertInsertCount(2); | ||||
36 | assertUpdateCount(0); | 36 | assertUpdateCount(0); | ||||
37 | clearCounts(); | 37 | clearCounts(); | ||||
38 | s = openSession(); | 38 | s = openSession(); | ||||
39 | tx = s.beginTransaction(); | 39 | tx = s.beginTransaction(); | ||||
40 | s.delete(grandchild); | 40 | s.delete(grandchild); | ||||
41 | s.delete(grandchild2); | 41 | s.delete(grandchild2); | ||||
42 | s.delete(grandchild3); | 42 | s.delete(grandchild3); | ||||
43 | s.delete(child); | 43 | s.delete(child); | ||||
44 | s.delete(child2); | 44 | s.delete(child2); | ||||
45 | s.delete(root); | 45 | s.delete(root); | ||||
46 | tx.commit(); | 46 | tx.commit(); | ||||
47 | s.close(); | 47 | s.close(); |
Row | Violation |
---|---|
1 | Unmatched statement s.saveOrUpdate(root); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement s.merge(root); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement s.saveOrUpdate(root); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched statement s.merge(root); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Unmatched statement s.saveOrUpdate(root); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
6 | Unmatched statement s.merge(root); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |