Author: marius.bogoevici
Date: 2009-10-18 01:49:43 -0400 (Sun, 18 Oct 2009)
New Revision: 4176
Modified:
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/PassivationActivationInterceptor.java
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/PassivationActivationTest.java
Log:
Improved test - verify that the value set on the interceptor is actually serialized and
deserialized
Modified:
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/PassivationActivationInterceptor.java
===================================================================
---
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/PassivationActivationInterceptor.java 2009-10-17
21:42:10 UTC (rev 4175)
+++
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/PassivationActivationInterceptor.java 2009-10-18
05:49:43 UTC (rev 4176)
@@ -33,11 +33,22 @@
public static boolean prePassivateInvoked;
public static boolean postActivateInvoked;
+ public static String initialMessage;
+
+ public PassivationActivationInterceptor()
+ {
+ this.message = initialMessage;
+ }
+
+ public static PassivationActivationInterceptor instance;
+ public String message = null;
+
@PrePassivate
public void prePassivate(InvocationContext invocationContext) throws Exception
{
prePassivateInvoked = true;
invocationContext.proceed();
+ instance = this;
}
@@ -46,6 +57,7 @@
{
postActivateInvoked = true;
invocationContext.proceed();
+ instance = this;
}
}
Modified:
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/PassivationActivationTest.java
===================================================================
---
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/PassivationActivationTest.java 2009-10-17
21:42:10 UTC (rev 4175)
+++
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/PassivationActivationTest.java 2009-10-18
05:49:43 UTC (rev 4176)
@@ -44,21 +44,33 @@
{
Bean bean = getCurrentManager().getBeans(Ball.class).iterator().next();
CreationalContext creationalContext =
getCurrentManager().createCreationalContext(bean);
+
+ PassivationActivationInterceptor.initialMessage = "Goal!";
+
Ball ball = (Ball) bean.create(creationalContext);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
new ObjectOutputStream(byteArrayOutputStream).writeObject(ball);
+ PassivationActivationInterceptor oldInterceptor =
PassivationActivationInterceptor.instance;
+
+ PassivationActivationInterceptor.initialMessage = "Miss!";
+
assert PassivationActivationInterceptor.prePassivateInvoked;
assert !PassivationActivationInterceptor.postActivateInvoked;
+ assert PassivationActivationInterceptor.instance != null;
PassivationActivationInterceptor.prePassivateInvoked = false;
PassivationActivationInterceptor.postActivateInvoked = false;
-
+ PassivationActivationInterceptor.instance = null;
+
ball = (Ball)new ObjectInputStream(new
ByteArrayInputStream(byteArrayOutputStream.toByteArray())).readObject();
assert !PassivationActivationInterceptor.prePassivateInvoked;
assert PassivationActivationInterceptor.postActivateInvoked;
-
+ assert PassivationActivationInterceptor.instance != null;
+ assert PassivationActivationInterceptor.instance != oldInterceptor;
+ assert PassivationActivationInterceptor.instance.message != null;
+ assert
PassivationActivationInterceptor.instance.message.equals(oldInterceptor.message);
}
}
Show replies by date