You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by vm...@apache.org on 2004/05/08 01:09:22 UTC
cvs commit: maven-plugins/aspectj/src/plugin-test/src/main/org/apache/maven/aspectj Dummy.java
vmassol 2004/05/07 16:09:22
Added: aspectj/src/plugin-test/src/aspect/org/apache/maven/aspectj
Sample.aj
aspectj/src/plugin-test/src/test/org/apache/maven/aspectj
AspectTest.java
aspectj/src/plugin-test project.xml maven.xml
project.properties
aspectj/src/plugin-test/src/main/org/apache/maven/aspectj
Dummy.java
Log:
added unit tests
Revision Changes Path
1.1 maven-plugins/aspectj/src/plugin-test/src/aspect/org/apache/maven/aspectj/Sample.aj
Index: Sample.aj
===================================================================
package org.apache.maven.aspectj;
/* ====================================================================
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
public aspect Sample
{
pointcut testPointcut() :
execution(public * org.apache.maven.aspectj.Dummy.someMethod());
before() : testPointcut()
{
throw new RuntimeException("test exception voluntarily raised and that should caught in the test case");
}
}
1.1 maven-plugins/aspectj/src/plugin-test/src/test/org/apache/maven/aspectj/AspectTest.java
Index: AspectTest.java
===================================================================
package org.apache.maven.aspectj;
/* ====================================================================
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
import junit.framework.TestCase;
public class AspectTest extends TestCase
{
public void testAspectIsCorrectlyWeaved()
{
Dummy dummy = new Dummy();
try
{
dummy.someMethod();
fail("The Aspect should have thrown an exception");
} catch (Exception expected)
{
assertEquals("test exception voluntarily raised and that should "
+ "caught in the test case", expected.getMessage());
}
}
}
1.1 maven-plugins/aspectj/src/plugin-test/project.xml
Index: project.xml
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project>
<pomVersion>3</pomVersion>
<id>test-maven-aspectj-plugin</id>
<name>Test project for Maven AspectJ Plugin</name>
<groupId>maven</groupId>
<currentVersion>1.0-SNAPSHOT</currentVersion>
<organization>
<name>Apache Software Foundation</name>
<url>http://www.apache.org/</url>
<logo>http://maven.apache.org/images/jakarta-logo-blue.gif</logo>
</organization>
<inceptionYear>2001</inceptionYear>
<package>org.apache.maven</package>
<logo>http://maven.apache.org/images/maven.jpg</logo>
<description>Test for Maven AspectJ plugin</description>
<shortDescription>Test for Maven AspectJ plugin</shortDescription>
<url>http://maven.apache.org/reference/plugins/aspectj/</url>
<siteDirectory>/www/maven.apache.org/reference/plugins/aspectj/</siteDirectory>
<repository>
<connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven/src/plugins-build/aspectj/</connection>
<url>http://cvs.apache.org/viewcvs/maven/src/plugins-build/aspectj/</url>
</repository>
<developers>
<developer>
<name>Vincent Massol</name>
<id>vmassol</id>
<email>vmassol@pivolis.com</email>
<organization>Pivolis</organization>
<roles>
<role>Java Developer</role>
</roles>
</developer>
</developers>
<dependencies>
<dependency>
<groupId>aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.2rc1</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main</sourceDirectory>
<unitTestSourceDirectory>src/test</unitTestSourceDirectory>
<aspectSourceDirectory>src/aspect</aspectSourceDirectory>
</build>
</project>
1.1 maven-plugins/aspectj/src/plugin-test/maven.xml
Index: maven.xml
===================================================================
<!--
/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project xmlns:util="jelly:util" xmlns:j="jelly:core">
<goal name="testPlugin" prereqs="clean,test-aspectj-weave">
</goal>
<goal name="test-aspectj-weave" prereqs="java:compile,aspectj:compile,test:test">
</goal>
</project>
1.1 maven-plugins/aspectj/src/plugin-test/project.properties
Index: project.properties
===================================================================
# -------------------------------------------------------------------
# Copyright 2004 The Apache Software Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -------------------------------------------------------------------
1.1 maven-plugins/aspectj/src/plugin-test/src/main/org/apache/maven/aspectj/Dummy.java
Index: Dummy.java
===================================================================
package org.apache.maven.aspectj;
/* ====================================================================
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
public class Dummy
{
public void someMethod()
{
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org