openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1538943 - /openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/InterceptorProxySerializationTest.java
Date Tue, 05 Nov 2013 11:10:41 GMT
Author: rmannibucau
Date: Tue Nov  5 11:10:41 2013
New Revision: 1538943

URL: http://svn.apache.org/r1538943
Log:
enhancing test InterceptorProxySerializationTest

Modified:
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/InterceptorProxySerializationTest.java

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/InterceptorProxySerializationTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/InterceptorProxySerializationTest.java?rev=1538943&r1=1538942&r2=1538943&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/InterceptorProxySerializationTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/proxy/InterceptorProxySerializationTest.java
Tue Nov  5 11:10:41 2013
@@ -22,6 +22,7 @@ import org.apache.webbeans.newtests.Abst
 import org.junit.Test;
 
 import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Inject;
 import javax.interceptor.AroundInvoke;
 import javax.interceptor.Interceptor;
@@ -52,7 +53,7 @@ public class InterceptorProxySerializati
     public void testProxyMappingConfig() throws Exception
     {
         addInterceptor(IBInterceptor.class);
-        startContainer(Arrays.<Class<?>>asList(Intercepted.class, AutoIntercepted.class),
null, true);
+        startContainer(Arrays.<Class<?>>asList(Intercepted.class, AutoIntercepted.class,
InjectMeInInterceptor.class), null, true);
 
         try
         {
@@ -76,7 +77,7 @@ public class InterceptorProxySerializati
     public void testSerializableEvenIfAutoIntercepted() throws Exception
     {
         addInterceptor(IBInterceptor.class);
-        startContainer(Arrays.<Class<?>>asList(Intercepted.class, AutoIntercepted.class),
null, true);
+        startContainer(Arrays.<Class<?>>asList(Intercepted.class, AutoIntercepted.class,
InjectMeInInterceptor.class), null, true);
 
         try
         {
@@ -85,14 +86,13 @@ public class InterceptorProxySerializati
             assertTrue(AutoIntercepted.called);
 
             final AutoIntercepted deserializeInit = AutoIntercepted.class.cast(deserialize(serialize(auto)));
-
             AutoIntercepted.called = false;
-            auto.touch();
+            deserializeInit.touch();
             assertTrue(AutoIntercepted.called);
 
             final AutoIntercepted deserializeState = AutoIntercepted.class.cast(deserialize(serialize(deserializeInit)));
             AutoIntercepted.called = false;
-            auto.touch();
+            deserializeState.touch();
             assertTrue(AutoIntercepted.called);
         }
         finally
@@ -108,14 +108,23 @@ public class InterceptorProxySerializati
     {
     }
 
+    public static class InjectMeInInterceptor implements Serializable {
+        public void touch() {}
+    }
+
     @Interceptor @IB
     public static class IBInterceptor implements Serializable
     {
         private boolean called = false; // just here to represent a state in the serialization
 
+        @Inject
+        private InjectMeInInterceptor injected;
+
         @AroundInvoke
         public Object intercept(final InvocationContext ctx) throws Exception
         {
+            injected.touch(); // will throw NPE if wrongly serialized
+
             final String name = ctx.getMethod().getName();
 
             if (name.equals("isInterceptorCalled"))



Mime
View raw message