File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java | File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/legacy/FooBarTest.java | |||
Method name: void testSuperclassPropertyReferenceAfterCollectionIndexedAccess()
|
Method name: void testCreateUpdate()
|
|||
Number of AST nodes: 30 | Number of AST nodes: 29 | |||
1 | Session s = openSession();↵ | 1 | Session s = openSession();↵ | |
2 | s.beginTransaction();↵ | 2 | ↵ | |
3 | Mammal tiger = new Mammal();↵ | 3 | Foo foo = new ↵ | |
4 | tiger.setDescription( "Tiger" );↵ | |||
5 | s.persist( tiger );↵ | |||
6 | Mammal mother = new Mammal();↵ | |||
7 | mother.setDescription( "Tiger's mother" );↵ | |||
8 | mother.setBodyWeight( 4.0f );↵ | |||
9 | mother.addOffspring( tiger );↵ | |||
10 | s.persist( mother ↵ | 4 | Foo();↵ | |
5 | s.save(foo);↵ | |||
6 | foo.setString("dirty");↵ | |||
7 | s.flush();↵ | |||
8 | s.connection().commit();↵ | |||
9 | s.close();↵ | |||
11 | );↵ | 10 | s = openSession();↵ | |
12 | Zoo zoo = new Zoo();↵ | 11 | Foo foo2 = new Foo();↵ | |
13 | zoo.setName( "Austin Zoo" );↵ | 12 | ↵ | |
14 | zoo.setMammals( new HashMap() );↵ | |||
15 | zoo.getMammals().put( "tiger", tiger );↵ | |||
16 | s.persist( zoo );↵ | |||
17 | s.getTransa↵ | 13 | s.load( foo2, foo.getKey() );↵ | |
14 | // There is an interbase bug that causes null integers to return as 0, also numeric precision is <= 15↵ | |||
15 | assertTrue( "create-update", foo.equalsFoo(foo2) );↵ | |||
16 | //System.out.println( s.print(foo2) );↵ | |||
17 | s.delete(foo2);↵ | |||
18 | s.flush();↵ | |||
18 | ction().commit();↵ | 19 | s.connection().commit();↵ | |
19 | s.close();↵ | 20 | s.close();↵ | |
20 | s = openSession();↵ | 21 | s = openSession();↵ | |
21 | s.beginTransaction();↵ | 22 | ↵ | |
22 | List results = s.createQuery( "from Zoo zoo where zoo.mammals['tiger'].mother.bodyWeight > 3.0f" ).list();↵ | |||
23 | assertEquals( 1, results.size() );↵ | |||
24 | s.getTransa↵ | 23 | foo = new Foo();↵ | |
24 | s.save(foo, "assignedid");↵ | |||
25 | foo.setString("dirty");↵ | |||
26 | s.flush();↵ | |||
25 | ction().commit();↵ | 27 | s.connection().commit();↵ | |
26 | s.close();↵ | 28 | s.close();↵ | |
27 | s = openSession();↵ | 29 | s = openSession();↵ | |
28 | s.beginTransaction();↵ | 30 | s.↵ | |
29 | s.delete( tiger );↵ | |||
30 | s.delete( mother );↵ | |||
31 | s.delete( zoo );↵ | |||
32 | s.getTransa↵ | 31 | load(foo2, "assignedid");↵ | |
32 | // There is an interbase bug that causes null integers to return as 0, also numeric precision is <= 15↵ | |||
33 | assertTrue( "create-update", foo.equalsFoo(foo2) );↵ | |||
34 | //System.out.println( s.print(foo2) );↵ | |||
35 | s.delete(foo2);↵ | |||
36 | s.flush();↵ | |||
33 | ction().commit();↵ | 37 | s.connection().commit();↵ | |
34 | s.close(); | 38 |
| |
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 | 714 |
Number of mapped statements | 11 |
Number of unmapped statements in the first code fragment | 19 |
Number of unmapped statements in the second code fragment | 18 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Session s = openSession(); | ||||||||||||||||||||||||
1 | Session s = openSession(); | | ||||||||||||||||||||||||
| 2 | Foo foo = new Foo(); | ||||||||||||||||||||||||
2 | s.beginTransaction(); | | ||||||||||||||||||||||||
| 3 | s.save(foo); | ||||||||||||||||||||||||
3 | Mammal tiger = new Mammal(); | | ||||||||||||||||||||||||
4 | tiger.setDescription("Tiger"); | | ||||||||||||||||||||||||
| 5 | s.flush(); | ||||||||||||||||||||||||
5 | s.persist(tiger); | | ||||||||||||||||||||||||
6 | Mammal mother = new Mammal(); | | ||||||||||||||||||||||||
| 7 | s.close(); | ||||||||||||||||||||||||
7 | mother.setDescription("Tiger's mother"); | | ||||||||||||||||||||||||
|
| 8 | s = openSession(); | |||||||||||||||||||||||
8 | mother.setBodyWeight(4.0f); | | ||||||||||||||||||||||||
| 9 | Foo foo2 = new Foo(); | ||||||||||||||||||||||||
9 | mother.addOffspring(tiger); | | ||||||||||||||||||||||||
| 10 | s.load(foo2, foo.getKey()); | ||||||||||||||||||||||||
10 | s.persist(mother); |
| 11 | assertTrue("create-update", foo.equalsFoo(foo2)); | ||||||||||||||||||||||
11 | Zoo zoo = new Zoo(); | | ||||||||||||||||||||||||
12 | zoo.setName("Austin Zoo"); | | ||||||||||||||||||||||||
| 13 | s.flush(); | ||||||||||||||||||||||||
13 | zoo.setMammals(new HashMap()); | | ||||||||||||||||||||||||
14 | zoo.getMammals().put("tiger", tiger); | | ||||||||||||||||||||||||
|
| 16 | s = openSession(); | |||||||||||||||||||||||
|
| 17 | foo = new Foo(); | |||||||||||||||||||||||
| 18 | s.save(foo, "assignedid"); | ||||||||||||||||||||||||
|
| 19 | foo.setString("dirty"); | |||||||||||||||||||||||
| 20 | s.flush(); | ||||||||||||||||||||||||
|
| 23 | s = openSession(); | |||||||||||||||||||||||
| 24 | s.load(foo2, "assignedid"); | ||||||||||||||||||||||||
15 | s.persist(zoo); |
| 25 | assertTrue("create-update", foo.equalsFoo(foo2)); | ||||||||||||||||||||||
16 | s.getTransaction().commit(); |
| 14 | s.connection().commit(); | ||||||||||||||||||||||
17 | s.close(); |
| 15 | s.close(); | ||||||||||||||||||||||
18 | s = openSession(); |
| | |||||||||||||||||||||||
19 | s.beginTransaction(); | | ||||||||||||||||||||||||
20 | List results = s.createQuery("from Zoo zoo where zoo.mammals['tiger'].mother.bodyWeight > 3.0f").list(); | | ||||||||||||||||||||||||
21 | assertEquals(1, results.size()); |
| 4 | foo.setString("dirty"); | ||||||||||||||||||||||
22 | s.getTransaction().commit(); |
| 21 | s.connection().commit(); | ||||||||||||||||||||||
23 | s.close(); |
| 22 | s.close(); | ||||||||||||||||||||||
24 | s = openSession(); |
| | |||||||||||||||||||||||
25 | s.beginTransaction(); | | ||||||||||||||||||||||||
26 | s.delete(tiger); |
| 26 | s.delete(foo2); | ||||||||||||||||||||||
27 | s.delete(mother); |
| 12 | s.delete(foo2); | ||||||||||||||||||||||
28 | s.delete(zoo); | | ||||||||||||||||||||||||
29 | s.getTransaction().commit(); |
| 6 | s.connection().commit(); | ||||||||||||||||||||||
| 27 | s.flush(); | ||||||||||||||||||||||||
| 28 | s.connection().commit(); | ||||||||||||||||||||||||
30 | s.close(); |
| 29 | s.close(); |
Row | Violation |
---|---|
1 | Unmatched statement s=openSession(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Expression assertTrue("create-update",foo.equalsFoo(foo2)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression s.persist(mother) is a void method call, and thus it cannot be parameterized |
4 | Expression assertTrue("create-update",foo.equalsFoo(foo2)) is a void method call, and thus it cannot be parameterized |
5 | Expression assertTrue("create-update",foo.equalsFoo(foo2)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression s.persist(mother) is a void method call, and thus it cannot be parameterized |
7 | Expression assertTrue("create-update",foo.equalsFoo(foo2)) is a void method call, and thus it cannot be parameterized |
8 | Unmatched statement s=openSession(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
9 | Unmatched statement foo=new Foo(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
10 | Unmatched statement foo.setString("dirty"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
11 | Unmatched statement s=openSession(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
12 | Expression s.persist(zoo) is a void method call, and thus it cannot be parameterized |
13 | Expression assertTrue("create-update",foo.equalsFoo(foo2)) is a void method call, and thus it cannot be parameterized |
14 | Expression s.persist(zoo) is a void method call, and thus it cannot be parameterized |
15 | Expression assertTrue("create-update",foo.equalsFoo(foo2)) is a void method call, and thus it cannot be parameterized |
16 | Type org.hibernate.Transaction of variable s.getTransaction() does not match with type java.sql.Connection of variable s.connection() |
17 | Type org.hibernate.Session of variable s does not match with type org.hibernate.classic.Session of variable s |
18 | Type org.hibernate.Session of variable s does not match with type org.hibernate.classic.Session of variable s |
19 | Unmatched statement s=openSession(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
20 | Expression assertEquals(1,results.size()) is a void method call, and thus it cannot be parameterized |
21 | Expression foo.setString("dirty") is a void method call, and thus it cannot be parameterized |
22 | Expression assertEquals(1,results.size()) is a void method call, and thus it cannot be parameterized |
23 | Expression foo.setString("dirty") is a void method call, and thus it cannot be parameterized |
24 | Type org.hibernate.Transaction of variable s.getTransaction() does not match with type java.sql.Connection of variable s.connection() |
25 | Type org.hibernate.Session of variable s does not match with type org.hibernate.classic.Session of variable s |
26 | Type org.hibernate.Session of variable s does not match with type org.hibernate.classic.Session of variable s |
27 | Unmatched statement s=openSession(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
28 | Type org.hibernate.test.hql.Mammal of variable tiger does not match with type org.hibernate.test.legacy.Foo of variable foo2 |
29 | Type org.hibernate.Session of variable s does not match with type org.hibernate.classic.Session of variable s |
30 | Type org.hibernate.test.hql.Mammal of variable mother does not match with type org.hibernate.test.legacy.Foo of variable foo2 |
31 | Type org.hibernate.Session of variable s does not match with type org.hibernate.classic.Session of variable s |
32 | Type org.hibernate.Transaction of variable s.getTransaction() does not match with type java.sql.Connection of variable s.connection() |
33 | Type org.hibernate.Session of variable s does not match with type org.hibernate.classic.Session of variable s |
34 | Type org.hibernate.Session of variable s does not match with type org.hibernate.classic.Session of variable s |