### Eclipse Workspace Patch 1.0 #P tests Index: features171/pr386341/X.aj =================================================================== --- features171/pr386341/X.aj (revision 0) +++ features171/pr386341/X.aj (revision 0) @@ -0,0 +1,20 @@ +/******************************************************************************* + * Copyright (c) 2010 Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andy Clement - Repro test case + * Abraham Nevado + *******************************************************************************/ + +aspect X { + after(): execution(* *.*()) { + System.out.println("It Worked-after"); + } + before(): execution(* *.*()) { + System.out.println("It Worked-before"); + } +} Index: features171/pr386341/A.java =================================================================== --- features171/pr386341/A.java (revision 0) +++ features171/pr386341/A.java (revision 0) @@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2010 Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andy Clement - Repro test case + * Abraham Nevado + *******************************************************************************/ + +class AtomicAction { + int status() { return 1; } + int commit(int n) { return 1; } +} + +public class A { + public static void main(String []argv) throws Exception { + A a = new A(); + a.m(); + } + + public void m() throws Exception{ + Thread.sleep(5*1000); + } + +} + Index: features171/pr386341/aop.xml =================================================================== --- features171/pr386341/aop.xml (revision 0) +++ features171/pr386341/aop.xml (revision 0) @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file Index: src/org/aspectj/systemtest/ajc171/AllTestsAspectJ171.java =================================================================== --- src/org/aspectj/systemtest/ajc171/AllTestsAspectJ171.java (revision 157) +++ src/org/aspectj/systemtest/ajc171/AllTestsAspectJ171.java (working copy) @@ -10,6 +10,8 @@ *******************************************************************************/ package org.aspectj.systemtest.ajc171; +import org.aspectj.systemtest.ajc1610.NewFeatures; + import junit.framework.Test; import junit.framework.TestSuite; @@ -19,6 +21,7 @@ TestSuite suite = new TestSuite("AspectJ 1.7.1 tests"); // $JUnit-BEGIN$ suite.addTest(Ajc171Tests.suite()); + suite.addTest(NewFeatures.suite()); // $JUnit-END$ return suite; } Index: src/org/aspectj/systemtest/ajc171/NewFeatures.java =================================================================== --- src/org/aspectj/systemtest/ajc171/NewFeatures.java (revision 0) +++ src/org/aspectj/systemtest/ajc171/NewFeatures.java (revision 0) @@ -0,0 +1,71 @@ +/******************************************************************************* + * Copyright (c) 2012 Lucierna + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Abraham Nevado (lucierna) - initial implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc171; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.Method; +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class NewFeatures extends org.aspectj.testing.XMLBasedAjcTestCase { + + public void testSharedCache() { + this.runTest("Test Shared Cache"); + File cacheFolder = new File(ajc.getSandboxDirectory().getAbsolutePath() + File.separator + "panenka.cache"); + this.assertTrue("Cache folder should be written when using share cache", cacheFolder.exists()); + //Delete the cache from the ajc sandbox + deleteFolder(cacheFolder); + } + + public void testPerClassLoaderCache() { + this.runTest("Test Per ClassLoader Cache"); + File cacheFolder = new File(ajc.getSandboxDirectory().getAbsolutePath() + File.separator + "panenka.cache"); + this.assertFalse("Shared Cache Folder should not be present", cacheFolder.exists()); + } + + public void testDefaultCachePerClassloader() { + this.runTest("Test Default Cache Per ClassLoader"); + File cacheFolder = new File(ajc.getSandboxDirectory().getAbsolutePath() + File.separator + "panenka.cache"); + this.assertFalse("By Default Per ClassLoader Cache should be used and not the shared one", cacheFolder.exists()); + } + + // /////////////////////////////////////// + + private static void deleteFolder(File folder) { + File[] files = folder.listFiles(); + if(files!=null) { //some JVMs return null for empty dirs + for(File f: files) { + if(f.isDirectory()) { + deleteFolder(f); + } else { + f.delete(); + } + } + } + folder.delete(); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(NewFeatures.class); + } + + private JavaClass getMyClass(String className) throws ClassNotFoundException { + return getClassFrom(ajc.getSandboxDirectory(), className); + } + + protected File getSpecFile() { + return new File("../tests/src/org/aspectj/systemtest/ajc171/newfeatures-tests.xml"); + } + +} \ No newline at end of file Index: src/org/aspectj/systemtest/ajc171/newfeatures-tests.xml =================================================================== --- src/org/aspectj/systemtest/ajc171/newfeatures-tests.xml (revision 0) +++ src/org/aspectj/systemtest/ajc171/newfeatures-tests.xml (revision 0) @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +