[jboss-cvs] jboss-seam/src/test/integration/src/org/jboss/seam/test/integration ...
Norman Richards
norman.richards at jboss.com
Tue Nov 27 18:36:20 EST 2007
User: nrichards
Date: 07/11/27 18:36:20
Modified: src/test/integration/src/org/jboss/seam/test/integration
EntityPassivationTest.java EntityTest.java
Removed: src/test/integration/src/org/jboss/seam/test/integration
EntityExceptionObserver.java
Log:
fix testStale
Revision Changes Path
1.3 +0 -1 jboss-seam/src/test/integration/src/org/jboss/seam/test/integration/EntityPassivationTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: EntityPassivationTest.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/test/integration/src/org/jboss/seam/test/integration/EntityPassivationTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- EntityPassivationTest.java 18 Nov 2007 01:32:25 -0000 1.2
+++ EntityPassivationTest.java 27 Nov 2007 23:36:20 -0000 1.3
@@ -54,7 +54,6 @@
Map thingMap = (Map) getValue("#{entitytest.someComponent.thingsAsMap}");
assert thingMap!=null && thingMap.size() > 0;
- System.out.println("MAP: " + thingMap);
}
}.run();
1.4 +28 -3 jboss-seam/src/test/integration/src/org/jboss/seam/test/integration/EntityTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: EntityTest.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/test/integration/src/org/jboss/seam/test/integration/EntityTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- EntityTest.java 11 Oct 2007 10:52:03 -0000 1.3
+++ EntityTest.java 27 Nov 2007 23:36:20 -0000 1.4
@@ -7,6 +7,8 @@
import javax.persistence.EntityManager;
import org.hibernate.StaleStateException;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Observer;
import org.jboss.seam.contexts.Contexts;
import org.jboss.seam.core.Manager;
import org.testng.Assert;
@@ -108,11 +110,15 @@
try {
new FacesRequest("/page.xhtml", conversation1) {
+ EntityExceptionObserver observer;
+
@Override
protected void invokeApplication() throws Exception {
Thing thing = (Thing) Contexts.getConversationContext().get("thing");
thing.setName("bar");
+ observer = (EntityExceptionObserver) getValue("#{entityExceptionObserver}");
+ assert observer != null;
}
@Override
@@ -122,12 +128,31 @@
@Override
protected void afterRequest() {
- assert getValue("#{entityExceptionObserver.optimisticLockExceptionSeen}").equals(Boolean.TRUE);
+ assert observer.getOptimisticLockExceptionSeen();
}
-
}.run();
} catch (StaleStateException e) {
}
}
+
+ @Name("entityExceptionObserver")
+ public static class EntityExceptionObserver {
+
+ private boolean exceptionSeen;
+
+ @Observer(value="org.jboss.seam.exceptionHandled.javax.persistence.OptimisticLockException")
+ public void handleException(Exception e) {
+ exceptionSeen=true;
+ }
+
+ public boolean getOptimisticLockExceptionSeen() {
+ return exceptionSeen;
+ }
+
+ @Override
+ public String toString() {
+ return "EntityExceptionObserver[" + exceptionSeen + "]";
+ }
+ }
}
More information about the jboss-cvs-commits
mailing list