tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject svn commit: r1155987 - in /tapestry/tapestry5/trunk/plastic/src/test: groovy/org/apache/tapestry5/plastic/MethodAdviceTests.groovy java/testsubjects/FieldConduitAdvisedMethodComplexCase.java
Date Wed, 10 Aug 2011 00:51:25 GMT
Author: hlship
Date: Wed Aug 10 00:51:25 2011
New Revision: 1155987

URL: http://svn.apache.org/viewvc?rev=1155987&view=rev
Log:
Add another test to try and replicate the issue ProQuest has been seeing

Added:
    tapestry/tapestry5/trunk/plastic/src/test/java/testsubjects/FieldConduitAdvisedMethodComplexCase.java
Modified:
    tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodAdviceTests.groovy

Modified: tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodAdviceTests.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodAdviceTests.groovy?rev=1155987&r1=1155986&r2=1155987&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodAdviceTests.groovy
(original)
+++ tapestry/tapestry5/trunk/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodAdviceTests.groovy
Wed Aug 10 00:51:25 2011
@@ -221,7 +221,6 @@ class MethodAdviceTests extends Abstract
 
             pc.getMethodsWithAnnotation(MethodAnnotation.class).each({ m ->
                 m.addAdvice(justProceed)
-                m.addAdvice(justProceed)
             })
 
             pc.getFieldsWithAnnotation(FieldAnnotation.class).each({ f ->
@@ -241,4 +240,42 @@ class MethodAdviceTests extends Abstract
 
         1 * container.magic() >> "via context and mock"
     }
+
+    def "method advice on method that accesses a field with a conduit (more complex structure)"()
+    {
+        MagicContainer container = Mock()
+
+        FieldConduit fc = [get: { instance, context ->
+
+            return context.get(MagicContainer.class)
+
+        }, set: { instance, context -> }] as FieldConduit
+
+        MethodAdvice justProceed = { inv -> inv.proceed() } as MethodAdvice
+
+        def mgr = createMgr({ PlasticClass pc ->
+
+            pc.getMethodsWithAnnotation(MethodAnnotation.class).each({ m ->
+                m.addAdvice(justProceed)
+            })
+
+            pc.getFieldsWithAnnotation(FieldAnnotation.class).each({ f ->
+                f.setConduit(fc)
+            })
+        } as PlasticClassTransformer)
+
+        if (false) { enableBytecodeDebugging(mgr) }
+
+        def o = mgr.getClassInstantiator("testsubjects.FieldConduitAdvisedMethodComplexCase").with(MagicContainer.class,
container).newInstance()
+
+        when:
+
+        o.magic == "via context"
+
+        then:
+
+        1 * container.magic() >> "via context"
+
+    }
+
 }

Added: tapestry/tapestry5/trunk/plastic/src/test/java/testsubjects/FieldConduitAdvisedMethodComplexCase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/test/java/testsubjects/FieldConduitAdvisedMethodComplexCase.java?rev=1155987&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/test/java/testsubjects/FieldConduitAdvisedMethodComplexCase.java
(added)
+++ tapestry/tapestry5/trunk/plastic/src/test/java/testsubjects/FieldConduitAdvisedMethodComplexCase.java
Wed Aug 10 00:51:25 2011
@@ -0,0 +1,18 @@
+package testsubjects;
+
+import testannotations.FieldAnnotation;
+import testannotations.MethodAnnotation;
+import testinterfaces.MagicContainer;
+
+
+public class FieldConduitAdvisedMethodComplexCase
+{
+    @FieldAnnotation
+    private MagicContainer container;
+
+    @MethodAnnotation
+    public String getMagic()
+    {
+        return container.magic();
+    }
+}



Mime
View raw message