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/MergeTest.java | |||
Method name: void testMergeTree()
|
Method name: void testMergeTreeWithGeneratedId()
|
|||
Number of AST nodes: 23 | Number of AST nodes: 23 | |||
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 | NumberedNode root = new NumberedNode("root");↵ | |
5 | Node child = new Node("child");↵ | 5 | NumberedNode child = new NumberedNode("child");↵ | |
6 | root.addChild(child);↵ | 6 | root.addChild(child);↵ | |
7 | s.persist(root);↵ | 7 | s.persist(root);↵ | |
8 | tx.commit();↵ | 8 | tx.commit();↵ | |
9 | s.close();↵ | 9 | s.close();↵ | |
10 | assertInsertCount(2);↵ | 10 | assertInsertCount(2);↵ | |
11 | clearCounts();↵ | 11 | clearCounts();↵ | |
12 | root.setDescription("The root node");↵ | 12 | root.setDescription("The root node");↵ | |
13 | child.setDescription("The child node");↵ | 13 | child.setDescription("The child node");↵ | |
14 | Node secondChild = new Node("second child");↵ | 14 | NumberedNode secondChild = new NumberedNode("second child");↵ | |
15 | root.addChild(secondChild);↵ | 15 | root.addChild(secondChild);↵ | |
16 | s = openSession();↵ | 16 | s = openSession();↵ | |
17 | tx = s.beginTransaction();↵ | 17 | tx = s.beginTransaction();↵ | |
18 | s.merge(root);↵ | 18 | s.merge(root);↵ | |
19 | tx.commit();↵ | 19 | tx.commit();↵ | |
20 | s.close();↵ | 20 | s.close();↵ | |
21 | assertInsertCount(1);↵ | 21 | assertInsertCount(1);↵ | |
22 | assertUpdateCount(2);↵ | 22 | assertUpdateCount(2);↵ | |
23 | cleanup(); | 23 |
| |
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 declared in the same class |
Number of node comparisons | 250 |
Number of mapped statements | 18 |
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 | clearCounts(); | 1 | clearCounts(); | ||||||||||||
2 | Session s = openSession(); | 2 | Session s = openSession(); | ||||||||||||
3 | Transaction tx = s.beginTransaction(); | 3 | Transaction tx = s.beginTransaction(); | ||||||||||||
| 4 | NumberedNode root = new NumberedNode("root"); | |||||||||||||
4 | Node root = new Node("root"); | | |||||||||||||
| 5 | NumberedNode child = new NumberedNode("child"); | |||||||||||||
5 | Node child = new Node("child"); | | |||||||||||||
| 6 | root.addChild(child); | |||||||||||||
6 | root.addChild(child); | | |||||||||||||
7 | s.persist(root); |
| 7 | s.persist(root); | |||||||||||
8 | tx.commit(); | 8 | tx.commit(); | ||||||||||||
9 | s.close(); | 9 | s.close(); | ||||||||||||
10 | assertInsertCount(2); | 10 | assertInsertCount(2); | ||||||||||||
11 | clearCounts(); | 11 | clearCounts(); | ||||||||||||
12 | root.setDescription("The root node"); |
| 12 | root.setDescription("The root node"); | |||||||||||
13 | child.setDescription("The child node"); |
| 13 | child.setDescription("The child node"); | |||||||||||
| 14 | NumberedNode secondChild = new NumberedNode("second child"); | |||||||||||||
14 | Node secondChild = new Node("second child"); | | |||||||||||||
| 15 | root.addChild(secondChild); | |||||||||||||
15 | root.addChild(secondChild); | | |||||||||||||
16 | s = openSession(); | 16 | s = openSession(); | ||||||||||||
17 | tx = s.beginTransaction(); | 17 | tx = s.beginTransaction(); | ||||||||||||
18 | s.merge(root); |
| 18 | s.merge(root); | |||||||||||
19 | tx.commit(); | 19 | tx.commit(); | ||||||||||||
20 | s.close(); | 20 | s.close(); | ||||||||||||
21 | assertInsertCount(1); | 21 | assertInsertCount(1); | ||||||||||||
22 | assertUpdateCount(2); | 22 | assertUpdateCount(2); | ||||||||||||
23 | cleanup(); | 23 | cleanup(); |
Row | Violation |
---|---|
1 | Type org.hibernate.test.ops.Node of variable root does not match with type org.hibernate.test.ops.NumberedNode of variable root |
2 | Type org.hibernate.test.ops.Node of variable root does not match with type org.hibernate.test.ops.NumberedNode of variable root |
3 | Type org.hibernate.test.ops.Node of variable child does not match with type org.hibernate.test.ops.NumberedNode of variable child |
4 | Type org.hibernate.test.ops.Node of variable root does not match with type org.hibernate.test.ops.NumberedNode of variable root |