]> source.dussan.org Git - aspectj.git/commitdiff
added test entries instead of autowiredtest for Andy sake, fix 1.4 dependancies in...
authoravasseur <avasseur>
Fri, 13 May 2005 09:37:31 +0000 (09:37 +0000)
committeravasseur <avasseur>
Fri, 13 May 2005 09:37:31 +0000 (09:37 +0000)
loadtime/src/org/aspectj/weaver/loadtime/definition/DocumentParser.java
testing-util/src/org/aspectj/testing/util/TestUtil.java
tests/java5/ataspectj/ataspectj/TestHelper.java
tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java
tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjMisuseTests.java
tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java
tests/src/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml
util/src/org/aspectj/util/FileUtil.java
util/src/org/aspectj/util/LangUtil.java
weaver/src/org/aspectj/weaver/PerObjectInterfaceTypeMunger.java
weaver/src/org/aspectj/weaver/patterns/PerObject.java

index 4e1967870b6b9a2e7decdf5043c4f2ed319cc001..92f2c4b8976198ebd484c103da44ddbca9a5d430 100644 (file)
@@ -19,6 +19,7 @@ import org.xml.sax.SAXParseException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.DefaultHandler;
 import org.xml.sax.helpers.XMLReaderFactory;
+import org.aspectj.util.LangUtil;
 
 import java.io.InputStream;
 import java.net.URL;
@@ -83,12 +84,21 @@ public class DocumentParser extends DefaultHandler {
 
             try {
                 xmlReader.setFeature("http://xml.org/sax/features/validation", false);
+            } catch (SAXException e) {
+                ;//fine, the parser don't do validation
+            }
+            try {
                 xmlReader.setFeature("http://xml.org/sax/features/external-general-entities", false);
+            } catch (SAXException e) {
+                ;//fine, the parser don't do validation
+            }
+            try {
                 xmlReader.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
-            } catch (SAXNotRecognizedException e) {
+            } catch (SAXException e) {
                 ;//fine, the parser don't do validation
             }
 
+
             xmlReader.setEntityResolver(parser);
             in = url.openStream();
             xmlReader.parse(new InputSource(in));
@@ -106,6 +116,10 @@ public class DocumentParser extends DefaultHandler {
         if (publicId.equals(DTD_PUBLIC_ID) || publicId.equals(DTD_PUBLIC_ID_ALIAS)) {
             InputStream in = DTD_STREAM;
             if (in == null) {
+                System.err.println(
+                        "AspectJ - WARN - could not read DTD "
+                        + publicId
+                );
                 return null;
             } else {
                 return new InputSource(in);
@@ -203,8 +217,7 @@ public class DocumentParser extends DefaultHandler {
 
     private static String replaceXmlAnd(String expression) {
         //TODO AV do we need to handle "..)AND" or "AND(.." ?
-        //FIXME AV Java 1.4 code - if KO, use some Strings util
-        return expression.replaceAll(" AND ", " && ");
+        return LangUtil.replace(expression, " AND ", " && ");
     }
 
     private boolean isNull(String s) {
index 6bf3350cf51e8e98b30050e4336c4e13ddeb292e..4b62f9a907c5b3a285b6a2a957e46e9c90484504 100644 (file)
@@ -135,7 +135,7 @@ public final class TestUtil {
 
     public static URL fileToURL(File file) {
         try {
-            return file.toURI().toURL();
+            return file.toURL();
         } catch (MalformedURLException e) {
             return null;
         }
@@ -223,7 +223,7 @@ public final class TestUtil {
     public static URL libURL(String rpath) {
         File file = libFile(rpath);
         try {
-            return file.toURI().toURL();
+            return file.toURL();
         } catch (MalformedURLException e) {
             throw new IllegalArgumentException("bad URL from: " + file);
         }        
index c1e75532dc015331111e607ca7b69909a1a6d6dd..10855a5db2e96bd81a3ad4c8a60d74f7a9778d85 100644 (file)
@@ -18,7 +18,6 @@ import junit.framework.TestFailure;
 
 import java.util.Enumeration;
 
-import org.aspectj.bridge.IMessageHandler;
 import org.aspectj.bridge.IMessage;
 import org.aspectj.bridge.AbortException;
 import org.aspectj.weaver.loadtime.DefaultMessageHandler;
@@ -61,6 +60,7 @@ public class TestHelper extends DefaultMessageHandler {
         } else {
             // we do exit here since Assert.fail will only trigger a runtime exception that might
             // be catched by the weaver anyway
+            System.err.println("*** Exiting - got a warning/fail/error/abort IMessage");
             System.exit(-1);
         }
         return ret;
index 0f820873e09b4caa9726158e38f2f16677180104..a4ba644a377b75fde413780762fc8ca4089c7432 100644 (file)
@@ -11,7 +11,7 @@
  *******************************************************************************/
 package org.aspectj.systemtest.ajc150.ataspectj;
 
-import org.aspectj.testing.AutowiredXMLBasedAjcTestCase;
+import org.aspectj.testing.XMLBasedAjcTestCase;
 import junit.framework.Test;
 
 import java.io.File;
@@ -19,13 +19,25 @@ import java.io.File;
 /**
  * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
  */
-public class AtAjLTWTests extends AutowiredXMLBasedAjcTestCase {
+public class AtAjLTWTests extends XMLBasedAjcTestCase {
 
        public static Test suite() {
-           return AutowiredXMLBasedAjcTestCase.loadSuite(org.aspectj.systemtest.ajc150.ataspectj.AtAjLTWTests.class);
+           return XMLBasedAjcTestCase.loadSuite(org.aspectj.systemtest.ajc150.ataspectj.AtAjLTWTests.class);
        }
 
        protected File getSpecFile() {
          return new File("../tests/src/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml");
        }
+
+       public void testRunThemAllWithJavacCompiledAndLTW() {
+               runTest("RunThemAllWithJavacCompiledAndLTW");
+       }
+
+       public void testAjcLTWPerClauseTest_XnoWeave() {
+               runTest("AjcLTW PerClauseTest -XnoWeave");
+       }
+
+       public void testAjcLTWPerClauseTest_Xreweavable() {
+               runTest("AjcLTW PerClauseTest -Xreweavable");
+       }
 }
index 82bee5e6382e09ed28996f8c28939d050533fad7..318d60295e30a0adb74f8a172ffab8e8fe06052a 100644 (file)
@@ -14,18 +14,50 @@ import java.io.File;
 
 import junit.framework.Test;
 
-import org.aspectj.testing.AutowiredXMLBasedAjcTestCase;
+import org.aspectj.testing.XMLBasedAjcTestCase;
 
 /**
  * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
  */
-public class AtAjMisuseTests extends AutowiredXMLBasedAjcTestCase {
+public class AtAjMisuseTests extends XMLBasedAjcTestCase {
 
     protected File getSpecFile() {
         return new File("../tests/src/org/aspectj/systemtest/ajc150/ataspectj/misuse.xml");
     }
 
     public static Test suite() {
-        return AutowiredXMLBasedAjcTestCase.loadSuite(AtAjMisuseTests.class);
+        return XMLBasedAjcTestCase.loadSuite(AtAjMisuseTests.class);
     }
+
+    public void testQAspectClassExtendingQAspectClass() {
+               runTest("@Aspect class extending @Aspect class");
+       }
+
+       public void testClassWithQBeforeExtendingQAspectClass() {
+               runTest("class with @Before extending @Aspect class");
+       }
+
+       public void testQPointcutNotReturningVoid() {
+               runTest("@Pointcut not returning void");
+       }
+
+       public void testQPointcutWithGarbageString() {
+               runTest("@Pointcut with garbage string");
+       }
+
+       public void testQPointcutWithThrowsClause() {
+               runTest("@Pointcut with throws clause");
+       }
+
+       public void testQAfterReturningWithWrongNumberOfArgs() {
+               runTest("@AfterReturning with wrong number of args");
+       }
+
+       public void testQBeforeOnNon_publicMethod() {
+               runTest("@Before on non-public method");
+       }
+
+       public void testQBeforeOnMethodNotReturningVoid() {
+               runTest("@Before on method not returning void");
+       }
 }
index 7927a267591dcec792129e390e8fa40544ae126b..a23806e06aa8e15e08bd0cfd676ea1daa54416eb 100644 (file)
@@ -16,21 +16,69 @@ import java.io.File;
 import junit.framework.Test;
 
 import org.aspectj.testing.XMLBasedAjcTestCase;
-import org.aspectj.testing.AutowiredXMLBasedAjcTestCase;
 
 /**                              
  * A suite for @AspectJ aspects located in java5/ataspectj
  *
  * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
  */
-public class AtAjSyntaxTests extends AutowiredXMLBasedAjcTestCase {
+public class AtAjSyntaxTests extends XMLBasedAjcTestCase {
        
        public static Test suite() {
-           return AutowiredXMLBasedAjcTestCase.loadSuite(AtAjSyntaxTests.class);
+           return XMLBasedAjcTestCase.loadSuite(AtAjSyntaxTests.class);
        }
 
        protected File getSpecFile() {
          return new File("../tests/src/org/aspectj/systemtest/ajc150/ataspectj/syntax.xml");
        }
 
+
+    public void testSimpleBefore() {
+        runTest("SimpleBefore");
+    }
+
+    public void testSimpleAfter() {
+        runTest("SimpleAfter");
+    }
+
+    public void testSingletonAspectBindings() {
+        runTest("singletonAspectBindings");
+    }
+
+    public void testCflowTest() {
+        runTest("CflowTest");
+    }
+
+    public void testPointcutReferenceTest() {
+        runTest("PointcutReferenceTest");
+    }
+
+    public void testXXJoinPointTest() {
+        runTest("XXJoinPointTest");
+    }
+
+    public void testPrecedenceTest() {
+        runTest("PrecedenceTest");
+    }
+
+    public void testAfterXTest() {
+        runTest("AfterXTest");
+    }
+
+    public void testBindingTest() {
+        runTest("BindingTest");
+    }
+
+    public void testBindingTestNoInline() {
+        runTest("BindingTest no inline");
+    }
+
+    public void testPerClause() {
+        runTest("PerClause");
+    }
+
+    public void testAroundInlineMunger() {
+        runTest("AroundInlineMunger");
+    }
+
 }
\ No newline at end of file
index ae296871c2f7e9fbdbe07e21d3d139a1ca97ecda..e44aef3f9e622c2673f9d205e80d9792de09b92f 100644 (file)
@@ -2,7 +2,7 @@
 <suite>
 
     <ajc-test dir="java5/ataspectj" title="RunThemAllWithJavacCompiledAndLTW">
-        <ant file="ajc-ant.xml" target="javac.ltw"/>
+        <ant file="ajc-ant.xml" target="javac.ltw" verbose="true"/>
     </ajc-test>
 
     <ajc-test dir="java5/ataspectj" title="AjcLTW PerClauseTest -XnoWeave">
index 2d2a90e0edc4f9e399b5c407d6aad6c8319188e1..ddaeedb43a2929049e187ec307bfd098e9506286 100644 (file)
@@ -879,7 +879,7 @@ public class FileUtil {
                LangUtil.throwIaxIfNull(file, "file");
         URL result = null;
         try {
-            result = file.toURI().toURL();
+            result = file.toURL();//TODO AV - was toURI.toURL that does not works on Java 1.3 
             if (null != result) {
                 return result;
             }
index 7e88949ae629753011ba26eae6603c15da42134b..d33e54d99f64f4388e8d62315356eaf86ddba2d9 100644 (file)
@@ -210,7 +210,7 @@ public class LangUtil {
      * Splits <code>input</code> at commas, 
      * trimming any white space.
      *
-     * @param text <code>String</code> to split.
+     * @param input <code>String</code> to split.
      * @return List of String of elements.
      */
     public static List commaSplit(String input) {
@@ -265,8 +265,8 @@ public class LangUtil {
      * no delimiters, the input itself is returned
      * after trimming white space.
      *
-     * @param text <code>String</code> to split.
-     * @param delimiter <code>String</code> separators for input.
+     * @param input <code>String</code> to split.
+     * @param delim <code>String</code> separators for input.
      * @return List of String of elements.
      */
     public static List anySplit(String input, String delim) {
index a9f885d0cb4e65632395d4d8738669f582666d53..512f9ca4f6138f57c233ca39ce89599a7083f5f5 100644 (file)
@@ -97,6 +97,8 @@ public class PerObjectInterfaceTypeMunger extends ResolvedTypeMunger {
             // FIXME AV - #75442 see thread
             // back off on old style : it can happen for perTarget that target type is presented first to the weaver
             // while caller side is not thus we have advisedTypeToAspects still empty..
+
+            // note: needed only for perTarget if lateMunger is used (see PerObject)
             return !matchType.isInterface() && !matchType.isAnnotationStyleAspect();
         } else {
             return aspects.contains(aspectType);
index 45602d386d9f55f65a09543a5c2700b7834651cb..aec9f7f4daa8a66efaff284328553c9525edd43c 100644 (file)
@@ -109,7 +109,7 @@ public class PerObject extends PerClause {
         // see #75442 thread. Issue with weaving order.
                ResolvedTypeMunger munger =
                        new PerObjectInterfaceTypeMunger(inAspect, concreteEntry);
-               inAspect.crosscuttingMembers.addTypeMunger(world.concreteTypeMunger(munger, inAspect));
+               inAspect.crosscuttingMembers.addLateTypeMunger(world.concreteTypeMunger(munger, inAspect));
 
         //ATAJ: add a munger to add the aspectOf(..) to the @AJ aspects
         if (inAspect.isAnnotationStyleAspect()) {