File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/collection/list/PersistentListTest.java | File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/collection/bag/PersistentBagTest.java | |||
Method name: void testWriteMethodDirtying()
|
Method name: void testWriteMethodDirtying()
|
|||
Number of AST nodes: 29 | Number of AST nodes: 29 | |||
1 | ListOwner parent = new ListOwner( "root" );↵ | 1 | BagOwner parent = new BagOwner( "root" );↵ | |
2 | ListOwner child = new ListOwner( "c1" );↵ | 2 | BagOwner child = new BagOwner( "c1" );↵ | |
3 | parent.getChildren().add( child );↵ | 3 | parent.getChildren().add( child );↵ | |
4 | child.setParent( parent );↵ | 4 | child.setParent( parent );↵ | |
5 | ListOwner otherChild = new ListOwner( "c2" );↵ | 5 | BagOwner otherChild = new BagOwner( "c2" );↵ | |
6 | Session session = openSession();↵ | 6 | Session session = openSession();↵ | |
7 | session.beginTransaction();↵ | 7 | session.beginTransaction();↵ | |
8 | session.save( parent );↵ | 8 | session.save( parent );↵ | |
9 | session.flush();↵ | 9 | session.flush();↵ | |
10 | // at this point, the list on parent has now been replaced with a PersistentList...↵ | 10 | // at this point, the list on parent has now been replaced with a PersistentBag...↵ | |
11 | PersistentList children = ( PersistentList ) parent.getChildren();↵ | 11 | PersistentBag children = ( PersistentBag ) parent.getChildren();↵ | |
12 | assertFalse( children.remove( otherChild ) );↵ | 12 | assertFalse( children.remove( otherChild ) );↵ | |
13 | assertFalse( children.isDirty() );↵ | 13 | assertFalse( children.isDirty() );↵ | |
14 | ArrayList otherCollection = new ArrayList();↵ | 14 | ArrayList otherCollection = new ArrayList();↵ | |
15 | otherCollection.add( child );↵ | 15 | otherCollection.add( child );↵ | |
16 | assertFalse( children.retainAll( otherCollection ) );↵ | 16 | assertFalse( children.retainAll( otherCollection ) );↵ | |
17 | assertFalse( children.isDirty() );↵ | 17 | assertFalse( children.isDirty() );↵ | |
18 | otherCollection = new ArrayList();↵ | 18 | otherCollection = new ArrayList();↵ | |
19 | otherCollection.add( otherChild );↵ | 19 | otherCollection.add( otherChild );↵ | |
20 | assertFalse( children.removeAll( otherCollection ) );↵ | 20 | assertFalse( children.removeAll( otherCollection ) );↵ | |
21 | assertFalse( children.isDirty() );↵ | 21 | assertFalse( children.isDirty() );↵ | |
22 | children.clear();↵ | 22 | children.clear();↵ | |
23 | session.delete( child );↵ | 23 | session.delete( child );↵ | |
24 | assertTrue( children.isDirty() );↵ | 24 | assertTrue( children.isDirty() );↵ | |
25 | session.flush();↵ | 25 | session.flush();↵ | |
26 | children.clear();↵ | 26 | children.clear();↵ | |
27 | assertFalse( children.isDirty() );↵ | 27 | assertFalse( children.isDirty() );↵ | |
28 | session.delete( parent );↵ | 28 | session.delete( parent );↵ | |
29 | session.getTransaction().commit();↵ | 29 | session.getTransaction().commit();↵ | |
30 | session.close(); | 30 |
| |
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 | 368 |
Number of mapped statements | 25 |
Number of unmapped statements in the first code fragment | 4 |
Number of unmapped statements in the second code fragment | 4 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | BagOwner parent = new BagOwner("root"); | ||||||||||||||||||||||||
1 | ListOwner parent = new ListOwner("root"); | | ||||||||||||||||||||||||
| 2 | BagOwner child = new BagOwner("c1"); | ||||||||||||||||||||||||
2 | ListOwner child = new ListOwner("c1"); | | ||||||||||||||||||||||||
3 | parent.getChildren().add(child); |
| 3 | parent.getChildren().add(child); | ||||||||||||||||||||||
4 | child.setParent(parent); |
| 4 | child.setParent(parent); | ||||||||||||||||||||||
| 5 | BagOwner otherChild = new BagOwner("c2"); | ||||||||||||||||||||||||
5 | ListOwner otherChild = new ListOwner("c2"); | | ||||||||||||||||||||||||
6 | Session session = openSession(); | 6 | Session session = openSession(); | |||||||||||||||||||||||
7 | session.beginTransaction(); | 7 | session.beginTransaction(); | |||||||||||||||||||||||
8 | session.save(parent); |
| 8 | session.save(parent); | ||||||||||||||||||||||
9 | session.flush(); | 9 | session.flush(); | |||||||||||||||||||||||
| 10 | PersistentBag children = (PersistentBag)parent.getChildren(); | ||||||||||||||||||||||||
10 | PersistentList children = (PersistentList)parent.getChildren(); | | ||||||||||||||||||||||||
11 | assertFalse(children.remove(otherChild)); |
| 28 | session.getTransaction().commit(); | ||||||||||||||||||||||
12 | assertFalse(children.isDirty()); |
| 12 | assertFalse(children.isDirty()); | ||||||||||||||||||||||
13 | ArrayList otherCollection = new ArrayList(); | 13 | ArrayList otherCollection = new ArrayList(); | |||||||||||||||||||||||
14 | otherCollection.add(child); |
| 14 | otherCollection.add(child); | ||||||||||||||||||||||
15 | assertFalse(children.retainAll(otherCollection)); |
| 15 | assertFalse(children.retainAll(otherCollection)); | ||||||||||||||||||||||
16 | assertFalse(children.isDirty()); |
| 16 | assertFalse(children.isDirty()); | ||||||||||||||||||||||
17 | otherCollection = new ArrayList(); | 17 | otherCollection = new ArrayList(); | |||||||||||||||||||||||
18 | otherCollection.add(otherChild); |
| 18 | otherCollection.add(otherChild); | ||||||||||||||||||||||
19 | assertFalse(children.removeAll(otherCollection)); |
| 19 | assertFalse(children.removeAll(otherCollection)); | ||||||||||||||||||||||
20 | assertFalse(children.isDirty()); |
| 20 | assertFalse(children.isDirty()); | ||||||||||||||||||||||
21 | children.clear(); |
| 21 | children.clear(); | ||||||||||||||||||||||
22 | session.delete(child); |
| 22 | session.delete(child); | ||||||||||||||||||||||
23 | assertTrue(children.isDirty()); |
| 23 | assertTrue(children.isDirty()); | ||||||||||||||||||||||
24 | session.flush(); | 24 | session.flush(); | |||||||||||||||||||||||
25 | children.clear(); |
| 25 | children.clear(); | ||||||||||||||||||||||
26 | assertFalse(children.isDirty()); |
| 26 | assertFalse(children.isDirty()); | ||||||||||||||||||||||
27 | session.delete(parent); |
| 27 | session.delete(parent); | ||||||||||||||||||||||
28 | session.getTransaction().commit(); |
| 11 | assertFalse(children.remove(otherChild)); | ||||||||||||||||||||||
29 | session.close(); | 29 | session.close(); |
Row | Violation |
---|---|
1 | Type org.hibernate.test.collection.list.ListOwner of variable child does not match with type org.hibernate.test.collection.bag.BagOwner of variable child |
2 | Type org.hibernate.test.collection.list.ListOwner of variable parent does not match with type org.hibernate.test.collection.bag.BagOwner of variable parent |
3 | Type org.hibernate.test.collection.list.ListOwner of variable parent does not match with type org.hibernate.test.collection.bag.BagOwner of variable parent |
4 | Type org.hibernate.test.collection.list.ListOwner of variable child does not match with type org.hibernate.test.collection.bag.BagOwner of variable child |
5 | Type org.hibernate.test.collection.list.ListOwner of variable parent does not match with type org.hibernate.test.collection.bag.BagOwner of variable parent |
6 | Expression session.getTransaction().commit() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression assertFalse(children.remove(otherChild)) is a void method call, and thus it cannot be parameterized |
8 | Expression session.getTransaction().commit() is a void method call, and thus it cannot be parameterized |
9 | Expression session.getTransaction().commit() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
10 | Expression assertFalse(children.remove(otherChild)) is a void method call, and thus it cannot be parameterized |
11 | Expression session.getTransaction().commit() is a void method call, and thus it cannot be parameterized |
12 | Type org.hibernate.test.collection.list.ListOwner of variable child does not match with type org.hibernate.test.collection.bag.BagOwner of variable child |
13 | Expression children cannot be unified with expression children , because common superclass org.hibernate.collection.AbstractPersistentCollection does not declare member(s) public boolean retainAll(Collection#RAW) |
14 | Type org.hibernate.test.collection.list.ListOwner of variable otherChild does not match with type org.hibernate.test.collection.bag.BagOwner of variable otherChild |
15 | Expression children cannot be unified with expression children , because common superclass org.hibernate.collection.AbstractPersistentCollection does not declare member(s) public boolean removeAll(Collection#RAW) |
16 | Expression children cannot be unified with expression children , because common superclass org.hibernate.collection.AbstractPersistentCollection does not declare member(s) public void clear() |
17 | Type org.hibernate.test.collection.list.ListOwner of variable child does not match with type org.hibernate.test.collection.bag.BagOwner of variable child |
18 | Expression children cannot be unified with expression children , because common superclass org.hibernate.collection.AbstractPersistentCollection does not declare member(s) public void clear() |
19 | Type org.hibernate.test.collection.list.ListOwner of variable parent does not match with type org.hibernate.test.collection.bag.BagOwner of variable parent |
20 | Expression session.getTransaction().commit() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
21 | Expression session.getTransaction().commit() is a void method call, and thus it cannot be parameterized |
22 | Expression assertFalse(children.remove(otherChild)) is a void method call, and thus it cannot be parameterized |
23 | Expression session.getTransaction().commit() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
24 | Expression session.getTransaction().commit() is a void method call, and thus it cannot be parameterized |
25 | Expression assertFalse(children.remove(otherChild)) is a void method call, and thus it cannot be parameterized |