File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/AbstractEntityCacheFunctionalTestCase.java | File path: /hibernate-distribution-3.3.2.GA/project/testing/src/main/java/org/hibernate/test/cache/BaseCacheProviderTestCase.java | |||
Method name: void testStaleWritesLeaveCacheConsistent()
|
Method name: void testStaleWritesLeaveCacheConsistent()
|
|||
Number of AST nodes: 7 | Number of AST nodes: 7 | |||
1 | try {↵ | 1 | try {↵ | |
2 | s = openSession();↵ | 2 | s = openSession();↵ | |
3 | txn = s.beginTransaction();↵ | 3 | txn = s.beginTransaction();↵ | |
4 | s.update(item);↵ | 4 | s.update( item );↵ | |
5 | txn.commit();↵ | 5 | txn.commit();↵ | |
6 | s.close();↵ | |||
7 | ↵ | 6 | s.close();↵ | |
8 | fail("expected stale write to fail");↵ | 7 | fail( "expected stale write to fail" );↵ | |
9 | } ↵ | 8 | }↵ | |
10 | catch (Throwable expected) {↵ | 9 | catch( Throwable expected ) {↵ | |
11 | // expected behavior here↵ | 10 | // expected behavior here↵ | |
12 | if (txn != null) {↵ | 11 | if ( txn != null ) {↵ | |
13 | try {↵ | |||
14 | txn.rollback();↵ | |||
15 | } ↵ | 12 | try {↵ | |
13 | txn.rollback();↵ | |||
14 | }↵ | |||
16 | catch (Throwable ignore) {↵ | 15 | catch( Throwable ignore ) {↵ | |
17 | }↵ | |||
18 | }↵ | |||
19 | } finally {↵ | |||
20 | ↵ | 16 | }↵ | |
17 | }↵ | |||
18 | }↵ | |||
19 | finally {↵ | |||
21 | if (s != null && s.isOpen()) {↵ | 20 | if ( s != null && s.isOpen() ) {↵ | |
22 | try {↵ | |||
23 | s.close();↵ | |||
24 | } ↵ | 21 | try {↵ | |
22 | s.close();↵ | |||
23 | }↵ | |||
25 | catch (Throwable ignore) {↵ | 24 | catch( Throwable ignore ) {↵ | |
26 | }↵ | |||
27 | }↵ | |||
28 | ↵ | 25 | }↵ | |
26 | }↵ | |||
29 | } | 27 | } | |
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.4 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 49 |
Number of mapped statements | 7 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 3.4 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11 | try | 11 | try | ||||||||||||
12 | s = openSession(); | 12 | s = openSession(); | ||||||||||||
13 | txn = s.beginTransaction(); | 13 | txn = s.beginTransaction(); | ||||||||||||
14 | s.update(item); |
| 14 | s.update(item); | |||||||||||
15 | txn.commit(); | 15 | txn.commit(); | ||||||||||||
16 | s.close(); | 16 | s.close(); | ||||||||||||
17 | fail("expected stale write to fail"); | 17 | fail("expected stale write to fail"); |
Row | Violation |
---|---|
1 | Type org.hibernate.test.cache.jbc2.functional.VersionedItem of variable item does not match with type org.hibernate.test.cache.VersionedItem of variable item |