File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/cfg/ListenerTest.java | File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/onetomany/OneToManyTest.java | |||
Method name: void testSetListenerClassName()
|
Method name: void testManyToManySize()
|
|||
Number of AST nodes: 5 | Number of AST nodes: 6 | |||
1 | Configuration cfg = new Configuration();↵ | 1 | Session ↵ | |
2 | assertNotNull( cfg.getEventListeners().getDeleteEventListeners() );↵ | |||
3 | cfg.setListener( "delete", DeleteListenerForTest.class.getName() );↵ | 2 | s = openSession();↵ | |
3 | Transaction t = s.beginTransaction();↵ | |||
4 | //this test raise an exception right now HHH-570↵ | |||
4 | assertEquals( 1, cfg.getEventListeners().getDeleteEventListeners().length );↵ | 5 | assertEquals( 0, ↵ | |
5 | assertTrue( cfg.getEventListeners().getDeleteEventListeners()[0] instanceof DeleteListenerForTest ↵ | 6 | s.createQuery("from Parent p where size(p.children) = 0").list().size() );↵ | |
7 | assertEquals( 0, s.createQuery("from Parent p where p.children.size = 0").list().size() );↵ | |||
8 | t.commit();↵ | |||
6 | ); | 9 | s.close(); | |
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 | 30 |
Number of mapped statements | 2 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 4 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
| 1 | Session s = openSession(); | ||||||||||||||||||||||
1 | Configuration cfg = new Configuration(); |
| | ||||||||||||||||||||||
| 2 | Transaction t = s.beginTransaction(); | |||||||||||||||||||||||
2 | assertNotNull(cfg.getEventListeners().getDeleteEventListeners()); |
| 3 | assertEquals(0, s.createQuery("from Parent p where size(p.children) = 0").list().size()); | |||||||||||||||||||||
3 | cfg.setListener("delete", DeleteListenerForTest.class.getName()); |
| | ||||||||||||||||||||||
4 | assertEquals(1, cfg.getEventListeners().getDeleteEventListeners().length); |
| 4 | assertEquals(0, s.createQuery("from Parent p where p.children.size = 0").list().size()); | |||||||||||||||||||||
|
| 5 | t.commit(); | ||||||||||||||||||||||
5 | assertTrue(cfg.getEventListeners().getDeleteEventListeners()[0] instanceof DeleteListenerForTest); | | |||||||||||||||||||||||
| 6 | s.close(); |
Row | Violation |
---|---|
1 | Unmatched statement Session s=openSession(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
2 | Unmatched statement Configuration cfg=new Configuration(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
3 | Expression assertNotNull(cfg.getEventListeners().getDeleteEventListeners()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression assertEquals(0,s.createQuery("from Parent p where size(p.children) = 0").list().size()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression assertNotNull(cfg.getEventListeners().getDeleteEventListeners()) is a void method call, and thus it cannot be parameterized |
6 | Expression assertEquals(0,s.createQuery("from Parent p where size(p.children) = 0").list().size()) is a void method call, and thus it cannot be parameterized |
7 | Expression assertNotNull(cfg.getEventListeners().getDeleteEventListeners()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Expression assertEquals(0,s.createQuery("from Parent p where size(p.children) = 0").list().size()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
9 | Expression assertNotNull(cfg.getEventListeners().getDeleteEventListeners()) is a void method call, and thus it cannot be parameterized |
10 | Expression assertEquals(0,s.createQuery("from Parent p where size(p.children) = 0").list().size()) is a void method call, and thus it cannot be parameterized |
11 | Unmatched statement cfg.setListener("delete",DeleteListenerForTest.class.getName()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
12 | Expression cfg.getEventListeners().getDeleteEventListeners().length cannot be parameterized, because it has dependencies to/from statements that will be extracted |
13 | Expression s.createQuery("from Parent p where p.children.size = 0").list().size() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
14 | Unmatched statement t.commit(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |