diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/lockmgr/TestJPA2LockManager.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/lockmgr/TestJPA2LockManager.java index 0846127d1..7342f6423 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/lockmgr/TestJPA2LockManager.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/lockmgr/TestJPA2LockManager.java @@ -825,7 +825,7 @@ public class TestJPA2LockManager extends LockManagerTestBase { } // TODO: - @AllowFailure(msg="OPENJPA-924 is preventing RR behavior: pessimistic lock " + @AllowFailure(message="OPENJPA-924 is preventing RR behavior: pessimistic lock " + "blocked read on thread 2, once thread-1 commit, thread-2 returns " + "with pre-thread 1 committed data. hence causing an " + "OptimisticLockException. Disable FinderCache to workaround the " @@ -1192,7 +1192,7 @@ public class TestJPA2LockManager extends LockManagerTestBase { } // TODO: - @AllowFailure(msg="OPENJPA-924 is preventing RR behavior: pessimistic lock " + @AllowFailure(message="OPENJPA-924 is preventing RR behavior: pessimistic lock " + "blocked read on thread 2, once thread-1 commit, thread-2 returns " + "with pre-thread 1 committed data. hence causing an " + "OptimisticLockException. Disable FinderCache to workaround the " diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/lockmgr/TestPessimisticLockManager.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/lockmgr/TestPessimisticLockManager.java index f78797a7b..9146fb703 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/lockmgr/TestPessimisticLockManager.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/lockmgr/TestPessimisticLockManager.java @@ -133,7 +133,7 @@ public class TestPessimisticLockManager extends LockManagerTestBase { } // TODO: - @AllowFailure(msg="OPENJPA-924 is preventing RR behavior: pessimistic lock " + @AllowFailure(message="OPENJPA-924 is preventing RR behavior: pessimistic lock " + "blocked read on thread 2, once thread-1 commit, thread-2 returns " + "with pre-thread 1 committed data. hence causing an " + "OptimisticLockException. Disable FinderCache to workaround the " @@ -488,7 +488,7 @@ public class TestPessimisticLockManager extends LockManagerTestBase { } // TODO: - @AllowFailure(msg="OPENJPA-924 is preventing RR behavior: pessimistic lock " + @AllowFailure(message="OPENJPA-924 is preventing RR behavior: pessimistic lock " + "blocked read on thread 2, once thread-1 commit, thread-2 returns " + "with pre-thread 1 committed data. hence causing an " + "OptimisticLockException. Disable FinderCache to workaround the " @@ -843,7 +843,7 @@ public class TestPessimisticLockManager extends LockManagerTestBase { } // TODO: - @AllowFailure(msg="OPENJPA-924 is preventing RR behavior: pessimistic lock " + @AllowFailure(message="OPENJPA-924 is preventing RR behavior: pessimistic lock " + "blocked read on thread 2, once thread-1 commit, thread-2 returns " + "with pre-thread 1 committed data. hence causing an " + "OptimisticLockException. Disable FinderCache to workaround the " @@ -1210,7 +1210,7 @@ public class TestPessimisticLockManager extends LockManagerTestBase { } // TODO: - @AllowFailure(msg="OPENJPA-924 is preventing RR behavior: pessimistic lock " + @AllowFailure(message="OPENJPA-924 is preventing RR behavior: pessimistic lock " + "blocked read on thread 2, once thread-1 commit, thread-2 returns " + "with pre-thread 1 committed data. hence causing an " + "OptimisticLockException. Disable FinderCache to workaround the " diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/AllowFailure.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/AllowFailure.java index b08f4176a..6ace82d33 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/AllowFailure.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/AllowFailure.java @@ -34,5 +34,5 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; @Retention(RUNTIME) public @interface AllowFailure { boolean value() default true; - String msg() default ""; + String message() default ""; } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java index 342766f37..45366744f 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java @@ -452,11 +452,11 @@ public abstract class PersistenceTestCase try { super.runBare(); } catch (Throwable t) { - String allowFailureMsg = getAllowFailureMsg(); - if ( allowFailureMsg != null ) { + AllowFailure allowFailure = getAllowFailure(); + if ( allowFailure != null && allowFailure.value()==true) { System.err.println("*** FAILED (but ignored): " + this); System.err.println("*** Reason : " - + allowFailureMsg); + + allowFailure.message()); System.err.println("Stacktrace of failure"); t.printStackTrace(); } else { @@ -470,21 +470,18 @@ public abstract class PersistenceTestCase * @AllowFailure. Method level annotation has higher precedence than Class * level annotation. */ - protected String getAllowFailureMsg() { + protected AllowFailure getAllowFailure() { try { Method runMethod = getClass().getMethod(getName(), (Class[])null); AllowFailure anno = runMethod.getAnnotation(AllowFailure.class); if (anno != null) - return anno.value() ? anno.msg() : null; + return anno; } catch (SecurityException e) { //ignore } catch (NoSuchMethodException e) { //ignore } - AllowFailure anno = getClass().getAnnotation(AllowFailure.class); - if (anno != null) - return anno.value() ? anno.msg() : null; - return null; + return getClass().getAnnotation(AllowFailure.class); } /**