File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/component/basic/ComponentTest.java | File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/timestamp/TimestampTest.java | |||
Method name: void testUpdateFalse()
|
Method name: void testUpdateFalse()
|
|||
Number of AST nodes: 19 | Number of AST nodes: 19 | |||
1 | getSessions().getStatistics().clear();↵ | 1 | getSessions().getStatistics().clear();↵ | |
2 | ↵ | 2 | ↵ | |
3 | Session s = openSession();↵ | 3 | Session s = openSession();↵ | |
4 | Transaction t = s.beginTransaction();↵ | 4 | Transaction t = s.beginTransaction();↵ | |
5 | User u = new User( "gavin", "secret", new Person("Gavin King", new Date(), "Karbarook Ave") );↵ | 5 | User u = new User( "gavin", "secret", new Person("Gavin King", new Date(), "Karbarook Ave") );↵ | |
6 | s.persist(u);↵ | 6 | s.persist(u);↵ | |
7 | s.flush();↵ | 7 | s.flush();↵ | |
8 | u.getPerson().setName("XXXXYYYYY");↵ | 8 | u.getPerson().setName("XXXXYYYYY");↵ | |
9 | t.commit();↵ | 9 | t.commit();↵ | |
10 | s.close();↵ | 10 | s.close();↵ | |
11 | ↵ | 11 | ↵ | |
12 | assertEquals( 1, getSessions().getStatistics().getEntityInsertCount() );↵ | 12 | assertEquals( 1, getSessions().getStatistics().getEntityInsertCount() );↵ | |
13 | assertEquals( 0, getSessions().getStatistics().getEntityUpdateCount() );↵ | 13 | assertEquals( 0, getSessions().getStatistics().getEntityUpdateCount() );↵ | |
14 | s = openSession();↵ | 14 | s = openSession();↵ | |
15 | t = s.beginTransaction();↵ | 15 | t = s.beginTransaction();↵ | |
16 | u = (User) s.get(User.class, "gavin");↵ | 16 | u = (User) s.get(User.class, "gavin");↵ | |
17 | assertEquals( u.getPerson().getName(), "Gavin King" );↵ | 17 | assertEquals( u.getPerson().getName(), "Gavin King" );↵ | |
18 | s.delete(u);↵ | 18 | s.delete(u);↵ | |
19 | t.commit();↵ | 19 | t.commit();↵ | |
20 | s.close();↵ | 20 | s.close();↵ | |
21 | ↵ | 21 | ↵ | |
22 | assertEquals( 1, getSessions().getStatistics().getEntityDeleteCount() ); | 22 |
| |
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 | 212 |
Number of mapped statements | 17 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | getSessions().getStatistics().clear(); | 1 | getSessions().getStatistics().clear(); | ||||||||||||||||
2 | Session s = openSession(); | 2 | Session s = openSession(); | ||||||||||||||||
3 | Transaction t = s.beginTransaction(); | 3 | Transaction t = s.beginTransaction(); | ||||||||||||||||
| 4 | User u = new User("gavin", "secret", new Person("Gavin King", new Date(), "Karbarook Ave")); | |||||||||||||||||
4 | User u = new User("gavin", "secret", new Person("Gavin King", new Date(), "Karbarook Ave")); | | |||||||||||||||||
5 | s.persist(u); |
| 5 | s.persist(u); | |||||||||||||||
6 | s.flush(); | 6 | s.flush(); | ||||||||||||||||
7 | u.getPerson().setName("XXXXYYYYY"); |
| 7 | u.getPerson().setName("XXXXYYYYY"); | |||||||||||||||
8 | t.commit(); | 8 | t.commit(); | ||||||||||||||||
9 | s.close(); | 9 | s.close(); | ||||||||||||||||
10 | assertEquals(1, getSessions().getStatistics().getEntityInsertCount()); | 10 | assertEquals(1, getSessions().getStatistics().getEntityInsertCount()); | ||||||||||||||||
11 | assertEquals(0, getSessions().getStatistics().getEntityUpdateCount()); | 11 | assertEquals(0, getSessions().getStatistics().getEntityUpdateCount()); | ||||||||||||||||
12 | s = openSession(); | 12 | s = openSession(); | ||||||||||||||||
13 | t = s.beginTransaction(); | 13 | t = s.beginTransaction(); | ||||||||||||||||
|
| 14 | u = (User)s.get(User.class, "gavin"); | ||||||||||||||||
14 | u = (User)s.get(User.class, "gavin"); |
| | ||||||||||||||||
15 | assertEquals(u.getPerson().getName(), "Gavin King"); |
| 15 | assertEquals(u.getPerson().getName(), "Gavin King"); | |||||||||||||||
16 | s.delete(u); |
| 16 | s.delete(u); | |||||||||||||||
17 | t.commit(); | 17 | t.commit(); | ||||||||||||||||
18 | s.close(); | 18 | s.close(); | ||||||||||||||||
19 | assertEquals(1, getSessions().getStatistics().getEntityDeleteCount()); | 19 | assertEquals(1, getSessions().getStatistics().getEntityDeleteCount()); |
Row | Violation |
---|---|
1 | Type org.hibernate.test.component.basic.User of variable u does not match with type org.hibernate.test.timestamp.User of variable u |
2 | Type org.hibernate.test.component.basic.Person of variable u.getPerson() does not match with type org.hibernate.test.timestamp.Person of variable u.getPerson() |
3 | Type org.hibernate.test.component.basic.User of variable u does not match with type org.hibernate.test.timestamp.User of variable u |
4 | Unmatched statement u=(User)s.get(User.class,"gavin"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Unmatched statement u=(User)s.get(User.class,"gavin"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
6 | Type org.hibernate.test.component.basic.Person of variable u.getPerson() does not match with type org.hibernate.test.timestamp.Person of variable u.getPerson() |
7 | Type org.hibernate.test.component.basic.User of variable u does not match with type org.hibernate.test.timestamp.User of variable u |
8 | Type org.hibernate.test.component.basic.User of variable u does not match with type org.hibernate.test.timestamp.User of variable u |