package org.aspectj.systemtest.ajc150.ataspectj;
import java.io.File;
-import java.io.FilenameFilter;
import junit.framework.Test;
// before
File f = new File("_ajdump/_before/com/foo/bar");
- CountingFilenameFilter cff = new CountingFilenameFilter();
+ CountingFilenameFilter cff = new CountingFilenameFilter(".class");
f.listFiles(cff);
assertEquals("Expected dump file in " + f.getAbsolutePath(),1,cff.getCount());
// after
f = new File("_ajdump/com/foo/bar");
- cff = new CountingFilenameFilter();
+ cff = new CountingFilenameFilter(".class");
f.listFiles(cff);
assertEquals("Expected dump file in " + f.getAbsolutePath(),1,cff.getCount());
// The working directory is different because this test must be forked
File dir = new File("../tests/java5/ataspectj");
File f = new File(dir,"_ajdump/_before");
- CountingFilenameFilter cff = new CountingFilenameFilter();
+ CountingFilenameFilter cff = new CountingFilenameFilter(".class");
f.listFiles(cff);
assertEquals("Expected dump file in " + f.getAbsolutePath(),1,cff.getCount());
f = new File(dir,"_ajdump");
- cff = new CountingFilenameFilter();
+ cff = new CountingFilenameFilter(".class");
f.listFiles(cff);
assertEquals(1,cff.getCount());
public void testCflowBelowStack() {
runTest("CflowBelowStack");
}
-
- private static class CountingFilenameFilter implements FilenameFilter {
-
- private int count;
-
- public boolean accept(File dir, String name) {
- if (name.endsWith(".class")) count++;
- return false;
- }
-
- public int getCount() {
- return count;
- }
- }
}
</ajc-test>
<ajc-test dir="ltw" title="reweavableAspectNotRegistered error">
- <compile files="HelloWorld.java, ExceptionHandler.aj" options="-showWeaveInfo">
- <message kind="weave" text="Join point 'method-execution(void HelloWorld.main(java.lang.String[]))' in Type 'HelloWorld' (HelloWorld.java:3) advised by around advice from 'ExceptionHandler' (ExceptionHandler.aj:2)"/>
+ <compile files="HelloWorldWithException.java, ExceptionHandler.aj" options="-showWeaveInfo">
+ <message kind="weave" text="Join point 'method-execution(void HelloWorldWithException.main(java.lang.String[]))' in Type 'HelloWorldWithException' (HelloWorldWithException.java:3) advised by around advice from 'ExceptionHandler' (ExceptionHandler.aj:2)"/>
</compile>
<compile files="EmptyAspect.aj">
</compile>
- <run class="HelloWorld" ltw="aop-missingaspect.xml">
+ <run class="HelloWorldWithException" ltw="aop-missingaspect.xml">
<stdout>
<line text="Hello World!"/>
</stdout>
<stderr>
- <line text="error aspect 'ExceptionHandler' woven into 'HelloWorld' must be defined to the weaver (placed on the aspectpath, or defined in an aop.xml file if using LTW)."/>
+ <line text="error aspect 'ExceptionHandler' woven into 'HelloWorldWithException' must be defined to the weaver (placed on the aspectpath, or defined in an aop.xml file if using LTW)."/>
</stderr>
</run>
</ajc-test>
<ajc-test dir="ltw" title="NPE with custom agent" keywords="ltw">
<compile files="java/net/URLClassLoader.java"/>
- <compile files="HelloWorld.java" options="-outjar hello.jar"/>
+ <compile files="HelloWorldWithException.java" options="-outjar hello.jar"/>
<compile files="ExceptionHandler.aj" options="-outxml -outjar handler.jar"/>
<compile files="NullSecurityManager.java" options="-outjar security.jar"/>
<ant file="ant.xml" target="NPE with custom agent" verbose="true">