]> source.dussan.org Git - aspectj.git/commitdiff
262154: test and fix
authoraclement <aclement>
Fri, 23 Jan 2009 17:49:30 +0000 (17:49 +0000)
committeraclement <aclement>
Fri, 23 Jan 2009 17:49:30 +0000 (17:49 +0000)
tests/multiIncremental/pr262154/base/src/DeliveryCallbackInterceptor.java [new file with mode: 0644]
tests/multiIncremental/pr262154/inc1/src/DeliveryCallbackInterceptor.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java

diff --git a/tests/multiIncremental/pr262154/base/src/DeliveryCallbackInterceptor.java b/tests/multiIncremental/pr262154/base/src/DeliveryCallbackInterceptor.java
new file mode 100644 (file)
index 0000000..ddc1899
--- /dev/null
@@ -0,0 +1,32 @@
+import java.util.Map;
+
+import org.aspectj.lang.annotation.AfterThrowing;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+
+@Aspect
+//@Goo("abc")
+@SuppressWarnings("unchecked")
+public class DeliveryCallbackInterceptor {
+       @Pointcut("execution(boolean org.springframework.integration.message.MessageHandler+.handleMessage(Message))&& args(message)")
+       public void handleMethod(Message message) {
+       }
+
+       @AfterThrowing(pointcut = "handleMethod(message)", throwing = "e")
+       public void invokeDeliveryCallback(Message message, Throwable e) {
+               ((DeliveryFailureCallback) message.getHeaders().get("errorcallback")).onDeliveryFailed(message, e);
+       }
+}
+
+class DeliveryFailureCallback {
+       public void onDeliveryFailed(Object o, Object p) {
+       }
+}
+
+class Message {
+       public Map<String, DeliveryFailureCallback> getHeaders() {
+               return null;
+       }
+}
+
+@interface Goo { String value(); }
diff --git a/tests/multiIncremental/pr262154/inc1/src/DeliveryCallbackInterceptor.java b/tests/multiIncremental/pr262154/inc1/src/DeliveryCallbackInterceptor.java
new file mode 100644 (file)
index 0000000..229dddf
--- /dev/null
@@ -0,0 +1,32 @@
+import java.util.Map;
+
+import org.aspectj.lang.annotation.AfterThrowing;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+
+@Aspect
+//@Goo("abc")
+@SuppressWarnings("unchecked")
+public class DeliveryCallbackInterceptor {
+       @Pointcut("execution(boolean org.springframework.integration.message.MessageHandler+.handleMessage(Message))&& args(message)")
+       public void handleMethod(Message message) {
+       }
+
+       @AfterThrowing(pointcut = "handleMethod(message, e)", throwing = "e")
+       public void invokeDeliveryCallback(Message message, Throwable e) {
+               ((DeliveryFailureCallback) message.getHeaders().get("errorcallback")).onDeliveryFailed(message, e);
+       }
+}
+
+class DeliveryFailureCallback {
+       public void onDeliveryFailed(Object o, Object p) {
+       }
+}
+
+class Message {
+       public Map<String, DeliveryFailureCallback> getHeaders() {
+               return null;
+       }
+}
+
+@interface Goo { String value(); }
index 74710c1c5320075f97af2ee11bc90987836fb936..8e8eb585fde3965b5e0bffdf107b087830ad8f18 100644 (file)
@@ -244,6 +244,17 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
                assertEquals("=BrokenHandles<p{GetInfo.java}GetInfo`declare parents!3", ipe.getHandleIdentifier());
        }
 
+       public void testAnnotations_pr262154() {
+               String p = "pr262154";
+               initialiseProject(p);
+               build(p);
+               checkWasFullBuild();
+               alter(p, "inc1");
+               build(p);
+               List l = getCompilerErrorMessages(p);
+               assertEquals("Unexpected compiler error", 0, l.size());
+       }
+
        public void testAnnotations_pr255555() {
                String p = "pr255555";
                initialiseProject(p);
@@ -261,8 +272,8 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
        }
 
        /**
-        * Test what is in the model for package declarations and import statements.  Package Declaration nodes are new
-        * in AspectJ 1.6.4.  Import statements are contained with an 'import references' node.
+        * Test what is in the model for package declarations and import statements. Package Declaration nodes are new in AspectJ 1.6.4.
+        * Import statements are contained with an 'import references' node.
         */
        public void testImportHandles() {
                String p = "Imports";
@@ -270,21 +281,20 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
                build(p);
 
                IProgramElement root = getModelFor(p).getHierarchy().getRoot();
-               
+
                // Looking for 'package p.q'
                IProgramElement ipe = findElementAtLine(root, 1);
-               ipe = (IProgramElement)ipe.getChildren().get(0); // package decl is first entry in the type
-               System.out.println(ipe.getHandleIdentifier()+"  "+ipe.getKind());
+               ipe = (IProgramElement) ipe.getChildren().get(0); // package decl is first entry in the type
+               System.out.println(ipe.getHandleIdentifier() + "  " + ipe.getKind());
                assertEquals(IProgramElement.Kind.PACKAGE_DECLARATION, ipe.getKind());
                assertEquals("=Imports<p.q*Example.aj%p.q", ipe.getHandleIdentifier());
                assertEquals("package p.q;", ipe.getSourceSignature());
-               assertEquals(ipe.getSourceLocation().getOffset(),8); // "package p.q" - location of p.q
+               assertEquals(ipe.getSourceLocation().getOffset(), 8); // "package p.q" - location of p.q
 
-               
                // Looking for import containing containing string and integer
                ipe = findElementAtLine(root, 3); // first import
                ipe = ipe.getParent(); // imports container
-               System.out.println(ipe.getHandleIdentifier()+"  "+ipe.getKind());
+               System.out.println(ipe.getHandleIdentifier() + "  " + ipe.getKind());
                dumptree(getModelFor(p).getHierarchy().getRoot(), 0);
                assertEquals("=Imports<p.q*Example.aj#", ipe.getHandleIdentifier());
        }
@@ -384,7 +394,6 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
                checkWasntFullBuild();
        }
 
-
        public void testIncrementalBuildsWithItds_pr259528() {
                String p = "pr259528";
                AjdeInteractionTestbed.VERBOSE = true;