From: aclement Date: Thu, 19 Nov 2009 17:01:09 +0000 (+0000) Subject: 293457: test and fix X-Git-Tag: V1_6_7~45 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=dc53b77e2494a2960423314a0ea7425a6c0eff7d;p=aspectj.git 293457: test and fix --- diff --git a/tests/bugs167/pr293457/com/citi/gdos/smart/applib/service/cache/CachingIntroduction.aj b/tests/bugs167/pr293457/com/citi/gdos/smart/applib/service/cache/CachingIntroduction.aj new file mode 100644 index 000000000..33c99defb --- /dev/null +++ b/tests/bugs167/pr293457/com/citi/gdos/smart/applib/service/cache/CachingIntroduction.aj @@ -0,0 +1,11 @@ + package com.citi.gdos.smart.applib.service.cache; + + import org.springmodules.cache.annotations.Cacheable; + + public aspect CachingIntroduction { + + declare @method: public * *..I*Dao+.set*(..): @Setter; + declare @method: !@Setter public * *..I*Dao+.*(..): + @Cacheable(modelId="fooModel"); + + } \ No newline at end of file diff --git a/tests/bugs167/pr293457/org/springmodules/cache/annotations/Cacheable.java b/tests/bugs167/pr293457/org/springmodules/cache/annotations/Cacheable.java new file mode 100644 index 000000000..e43cc745f --- /dev/null +++ b/tests/bugs167/pr293457/org/springmodules/cache/annotations/Cacheable.java @@ -0,0 +1,5 @@ +package org.springmodules.cache.annotations; + +public @interface Cacheable { + +} diff --git a/tests/src/org/aspectj/systemtest/ajc167/Ajc167Tests.java b/tests/src/org/aspectj/systemtest/ajc167/Ajc167Tests.java index 5703a9824..2b79abd49 100644 --- a/tests/src/org/aspectj/systemtest/ajc167/Ajc167Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc167/Ajc167Tests.java @@ -18,6 +18,10 @@ import org.aspectj.testing.XMLBasedAjcTestCase; public class Ajc167Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + public void testHierarchyBuilderNPE_pr293457() { + runTest("hierarchy builder npe"); + } + public void testTimers_1() { runTest("timers - 1"); } diff --git a/tests/src/org/aspectj/systemtest/ajc167/IntertypeTests.java b/tests/src/org/aspectj/systemtest/ajc167/IntertypeTests.java new file mode 100644 index 000000000..5aa2d4110 --- /dev/null +++ b/tests/src/org/aspectj/systemtest/ajc167/IntertypeTests.java @@ -0,0 +1,77 @@ +/******************************************************************************* + * Copyright (c) 2008 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 - initial API and implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc167; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * Tests for the new all singing all dancing intertype syntax. + * + * @author Andy Clement + */ +public class IntertypeTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + // absolutely trivial, just parse something and dont crash + public void testSimple() { + runTest("simple"); + } + + // simple field inside the intertype scope + public void testSimpleWithField() { + runTest("simple with field"); + } + + // simple field inside the intertype scope and method after the intertype scope + public void testSimpleWithField2() { + runTest("simple with field2"); + } + + // now a method that new's up an instance of the type targetted by the intertype scope + public void testNewInstance() { + runTest("new instance"); + } + + // now aspect method attempts to new up target of the itd scope and access something introduced by it + public void testNewInstanceAndAccess() { + runTest("new instance and access"); + } + + // two fields + public void testNewInstanceAndAccess2() { + runTest("new instance and access to two fields"); + } + + // more tests: + // intertype X { int a,b,c=4; } + // intertype X { int a=4,b=3; } // can we say that? + + // extends/implements on the intertype become declare parents + // annotations on the intertype become declare @type + + // what about recovery when we have a problem leaving the scope of the intertype block? How do we make sure + // we don't accidentally use the activeScope for ordinary methods? Can we even check that... + + + // -- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(IntertypeTests.class); + } + + protected File getSpecFile() { + return new File("../tests/src/org/aspectj/systemtest/ajc167/intertype.xml"); + } + +} \ No newline at end of file diff --git a/tests/src/org/aspectj/systemtest/ajc167/ajc167.xml b/tests/src/org/aspectj/systemtest/ajc167/ajc167.xml index 8306be1e1..be134a2f0 100644 --- a/tests/src/org/aspectj/systemtest/ajc167/ajc167.xml +++ b/tests/src/org/aspectj/systemtest/ajc167/ajc167.xml @@ -2,6 +2,14 @@ + + + + + + + + diff --git a/tests/src/org/aspectj/systemtest/ajc167/intertype.xml b/tests/src/org/aspectj/systemtest/ajc167/intertype.xml new file mode 100644 index 000000000..a432ee188 --- /dev/null +++ b/tests/src/org/aspectj/systemtest/ajc167/intertype.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file