Permalink
Browse files

Shocking advice ordering tests.

  • Loading branch information...
1 parent 3bf34d5 commit 6647f778fa35a3038839a9d4ab20fb712d06b45d @jfabry jfabry committed Sep 24, 2012
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>AJ-LMP-AdviceOrdering</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.ajdt.core.ajbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.ajdt.ui.ajnature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
@@ -0,0 +1,29 @@
+package cl.pleiad.ajlmp.testAdviceOrdering;
+
+public class BaseClass {
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ BaseClass bc = new BaseClass();
+ bc.baseMethod1();
+ System.out.println("----------");
+ bc.baseMethod2();
+ System.out.println("----------");
+ System.out.println("----------");
+ bc.baseMethod3();
+ }
+
+ public void baseMethod1(){
+ System.out.println("Base Method 1");
+ }
+
+ public void baseMethod2(){
+ System.out.println("Base Method 2");
+ }
+
+ public void baseMethod3(){
+ System.out.println("Base Method 2");
+ }
+}
@@ -0,0 +1,53 @@
+package cl.pleiad.ajlmp.testAdviceOrdering;
+
+public aspect FirstAspect {
+
+ public pointcut pc1() : call(* BaseClass.*1());
+
+ void around(): pc1(){
+ System.out.println("Ar-1");
+ proceed();
+ System.out.println("Ar-2");
+ }
+
+ before(): pc1(){
+ System.out.println("Be");
+ }
+
+ after(): pc1(){
+ System.out.println("Af");
+ }
+
+ public pointcut pc2() : call(* BaseClass.*2());
+
+ before(): pc2(){
+ System.out.println("Be");
+ }
+
+ void around(): pc2(){
+ System.out.println("Ar-1");
+ proceed();
+ System.out.println("Ar-2");
+ }
+
+ after(): pc2(){
+ System.out.println("Af");
+ }
+
+ pointcut pc3() : call(* BaseClass.*3());
+
+ void around(): pc3(){
+ System.out.println("1Ar-1");
+ proceed();
+ System.out.println("1Ar-2");
+ }
+
+ before(): pc3(){
+ System.out.println("1Be");
+ }
+
+ after(): pc3(){
+ System.out.println("1Af");
+ }
+
+}
@@ -0,0 +1,23 @@
+package cl.pleiad.ajlmp.testAdviceOrdering;
+
+public aspect SecondAspect {
+
+ declare precedence: FirstAspect,SecondAspect;
+
+ pointcut pc3() : call(* BaseClass.*3());
+
+ void around(): pc3(){
+ System.out.println("2Ar-1");
+ proceed();
+ System.out.println("2Ar-2");
+ }
+
+ before(): pc3(){
+ System.out.println("2Be");
+ }
+
+ after(): pc3(){
+ System.out.println("2Af");
+ }
+
+}

0 comments on commit 6647f77

Please sign in to comment.