You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sn...@apache.org on 2006/02/14 21:42:43 UTC
svn commit: r377824 - in /maven/maven-1/plugins-sandbox/trunk/source/src:
plugin-test/ plugin-test/codeGenerationTest/
plugin-test/codeGenerationTest/src/ plugin-test/codeGenerationTest/src/main/
plugin-test/codeGenerationTest/src/main/java/ plugin-tes...
Author: snicoll
Date: Tue Feb 14 12:42:39 2006
New Revision: 377824
URL: http://svn.apache.org/viewcvs?rev=377824&view=rev
Log:
Added test cases for the maven source plugin.
Added:
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/maven.xml
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/project.xml
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/main/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/main/java/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/main/java/org/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/main/java/org/apache/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/main/java/org/apache/maven/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/main/java/org/apache/maven/plugin/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/main/java/org/apache/maven/plugin/source/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/main/java/org/apache/maven/plugin/source/test/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/main/java/org/apache/maven/plugin/source/test/FakeSessionBean.java
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/xdoclet/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/xdoclet/java/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/xdoclet/java/org/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/xdoclet/java/org/apache/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/xdoclet/java/org/apache/maven/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/xdoclet/java/org/apache/maven/plugin/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/xdoclet/java/org/apache/maven/plugin/source/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/xdoclet/java/org/apache/maven/plugin/source/test/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/xdoclet/java/org/apache/maven/plugin/source/test/FakeSessionLocal.java
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/xdoclet/java/org/apache/maven/plugin/source/test/FakeSessionLocalHome.java
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/maven.xml
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/project.xml
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/simpleTest/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/simpleTest/maven.xml
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/simpleTest/project.xml
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/simpleTest/src/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/simpleTest/src/main/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/simpleTest/src/main/java/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/simpleTest/src/main/java/org/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/simpleTest/src/main/java/org/apache/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/simpleTest/src/main/java/org/apache/maven/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/simpleTest/src/main/java/org/apache/maven/plugin/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/simpleTest/src/main/java/org/apache/maven/plugin/source/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/simpleTest/src/main/java/org/apache/maven/plugin/source/test/
maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/simpleTest/src/main/java/org/apache/maven/plugin/source/test/App.java
maven/maven-1/plugins-sandbox/trunk/source/src/test/
maven/maven-1/plugins-sandbox/trunk/source/src/test/org/
maven/maven-1/plugins-sandbox/trunk/source/src/test/org/apache/
maven/maven-1/plugins-sandbox/trunk/source/src/test/org/apache/maven/
maven/maven-1/plugins-sandbox/trunk/source/src/test/org/apache/maven/plugin/
maven/maven-1/plugins-sandbox/trunk/source/src/test/org/apache/maven/plugin/source/
maven/maven-1/plugins-sandbox/trunk/source/src/test/org/apache/maven/plugin/source/JavaSourceArtifactTypeHandlerTest.java
Added: maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/maven.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/maven.xml?rev=377824&view=auto
==============================================================================
--- maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/maven.xml (added)
+++ maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/maven.xml Tue Feb 14 12:42:39 2006
@@ -0,0 +1,56 @@
+<!--
+/*
+ * Copyright 2001-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:j="jelly:core"
+ xmlns:u="jelly:util"
+ xmlns:x="jelly:xml"
+ xmlns:assert="assert"
+ xmlns:maven="jelly:maven">
+
+ <preGoal name="java:compile">
+ <!-- Invoke fake xdoclet plugin and update maven.compile.src.set -->
+ <path id="fake.xdoclet.compile.src.set" location="src/xdoclet/java"/>
+ <maven:addPath id="maven.compile.src.set" refid="fake.xdoclet.compile.src.set"/>
+ </preGoal>
+
+ <goal name="testPlugin" prereqs="source:source,test-source">
+ <attainGoal name="clean"/>
+ </goal>
+
+ <goal name="test-source">
+
+ <j:set var="sourceFile" value="${maven.build.dir}/${maven.source.final.name}"/>
+ <!-- tests that the source is generated -->
+ <assert:assertFileExists file="${sourceFile}"/>
+
+ <!-- unzip the source and look for the App in the right package structure -->
+ <j:set var="unzipDir" value= "${maven.build.dir}/sourceTest"/>
+ <mkdir dir="${unzipDir}"/>
+ <unzip src="${sourceFile}" dest="${unzipDir}"/>
+
+ <!-- check for source -->
+ <assert:assertFileExists file="${unzipDir}/org/apache/maven/plugin/source/test/FakeSessionBean.java"
+ msg="FakeSessionBean.java was not bundled"/>
+
+ <!-- check for generated code -->
+ <assert:assertFileExists file="${unzipDir}/org/apache/maven/plugin/source/test/FakeSessionLocal.java"
+ msg="FakeSessionLocal.java was not bundled"/>
+ <assert:assertFileExists file="${unzipDir}/org/apache/maven/plugin/source/test/FakeSessionLocalHome.java"
+ msg="FakeSessionLocalHome.java was not bundled"/>
+
+ </goal>
+</project>
Added: maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/project.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/project.xml?rev=377824&view=auto
==============================================================================
--- maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/project.xml (added)
+++ maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/project.xml Tue Feb 14 12:42:39 2006
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+ * Copyright 2001-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-source-plugin-codeGenerationTest</id>
+ <name>Code Generation Test Case for Maven Source 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/apache-maven-project.png</logo>
+ </organization>
+ <inceptionYear>2006</inceptionYear>
+ <package>org.apache.maven</package>
+ <logo>http://maven.apache.org/images/maven.gif</logo>
+ <description>Test for Maven Source plugin</description>
+ <shortDescription>Test for Maven Source plugin</shortDescription>
+ <url>http://maven.apache.org/maven-1.x/reference/plugins/source/</url>
+ <siteDirectory>/www/maven.apache.org/maven-1.x/reference/plugins/source/</siteDirectory>
+ <repository>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk/source/</connection>
+ <url>http://svn.apache.org/viewcvs.cgi/maven/maven-1/plugins/trunk/source/</url>
+ </repository>
+ <build>
+ <defaultGoal>testPlugin</defaultGoal>
+ <sourceDirectory>src/main/java</sourceDirectory>
+ </build>
+</project>
\ No newline at end of file
Added: maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/main/java/org/apache/maven/plugin/source/test/FakeSessionBean.java
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/main/java/org/apache/maven/plugin/source/test/FakeSessionBean.java?rev=377824&view=auto
==============================================================================
--- maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/main/java/org/apache/maven/plugin/source/test/FakeSessionBean.java (added)
+++ maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/main/java/org/apache/maven/plugin/source/test/FakeSessionBean.java Tue Feb 14 12:42:39 2006
@@ -0,0 +1,35 @@
+package org.apache.maven.plugin.source.test;
+
+/* ====================================================================
+ * Copyright 2001-2005 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.
+ * ====================================================================
+ */
+
+/**
+ * @author <a href="mailto:snicoll@apache.org">Stephane Nicoll</a>
+ * @version $Id: App.java 232640 2005-08-14 20:46:54Z snicoll $
+ */
+public class FakeSessionBean
+{
+
+ // Only for testing purposes!!
+ private FakeSessionLocal local;
+
+ public FakeSessionBean()
+ {
+
+ }
+
+}
Added: maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/xdoclet/java/org/apache/maven/plugin/source/test/FakeSessionLocal.java
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/xdoclet/java/org/apache/maven/plugin/source/test/FakeSessionLocal.java?rev=377824&view=auto
==============================================================================
--- maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/xdoclet/java/org/apache/maven/plugin/source/test/FakeSessionLocal.java (added)
+++ maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/xdoclet/java/org/apache/maven/plugin/source/test/FakeSessionLocal.java Tue Feb 14 12:42:39 2006
@@ -0,0 +1,27 @@
+package org.apache.maven.plugin.source.test;
+
+/* ====================================================================
+ * Copyright 2001-2005 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.
+ * ====================================================================
+ */
+
+/**
+ * @author <a href="mailto:snicoll@apache.org">Stephane Nicoll</a>
+ * @version $Id: App.java 232640 2005-08-14 20:46:54Z snicoll $
+ */
+public class FakeSessionLocal
+{
+ // Fake just as if xdoclet generated it
+}
Added: maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/xdoclet/java/org/apache/maven/plugin/source/test/FakeSessionLocalHome.java
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/xdoclet/java/org/apache/maven/plugin/source/test/FakeSessionLocalHome.java?rev=377824&view=auto
==============================================================================
--- maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/xdoclet/java/org/apache/maven/plugin/source/test/FakeSessionLocalHome.java (added)
+++ maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/codeGenerationTest/src/xdoclet/java/org/apache/maven/plugin/source/test/FakeSessionLocalHome.java Tue Feb 14 12:42:39 2006
@@ -0,0 +1,27 @@
+package org.apache.maven.plugin.source.test;
+
+/* ====================================================================
+ * Copyright 2001-2005 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.
+ * ====================================================================
+ */
+
+/**
+ * @author <a href="mailto:snicoll@apache.org">Stephane Nicoll</a>
+ * @version $Id: App.java 232640 2005-08-14 20:46:54Z snicoll $
+ */
+public class FakeSessionLocalHome
+{
+ // Fake just as if xdoclet generated it
+}
Added: maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/maven.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/maven.xml?rev=377824&view=auto
==============================================================================
--- maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/maven.xml (added)
+++ maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/maven.xml Tue Feb 14 12:42:39 2006
@@ -0,0 +1,30 @@
+<?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
+ xmlns:maven="jelly:maven">
+
+ <goal name="testPlugin">
+ <maven:reactor basedir="${basedir}"
+ includes="*Test/project.xml"
+ goals="testPlugin"
+ banner="Test"
+ ignoreFailures="false"/>
+ </goal>
+
+</project>
Added: maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/project.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/project.xml?rev=377824&view=auto
==============================================================================
--- maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/project.xml (added)
+++ maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/project.xml Tue Feb 14 12:42:39 2006
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+ * Copyright 2001-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>
+ <name>Test project for Maven Source Plugin</name>
+ <groupId>maven</groupId>
+ <currentVersion>1.0</currentVersion>
+ <organization>
+ <name>Apache Software Foundation</name>
+ <url>http://www.apache.org/</url>
+ <logo>http://maven.apache.org/images/apache-maven-project.png</logo>
+ </organization>
+ <inceptionYear>2006</inceptionYear>
+ <package>org.apache.maven</package>
+ <logo>http://maven.apache.org/images/maven.gif</logo>
+ <description>Test for Maven Source plugin</description>
+ <shortDescription>Test for Maven Source plugin</shortDescription>
+ <url>http://maven.apache.org/maven-1.x/reference/plugins/source/</url>
+ <siteDirectory>/www/maven.apache.org/maven-1.x/reference/plugins/source/</siteDirectory>
+ <repository>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk/source/</connection>
+ <url>http://svn.apache.org/viewcvs.cgi/maven/maven-1/plugins/trunk/source/</url>
+ </repository>
+ <build>
+ <defaultGoal>testPlugin</defaultGoal>
+ </build>
+</project>
\ No newline at end of file
Added: maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/simpleTest/maven.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/simpleTest/maven.xml?rev=377824&view=auto
==============================================================================
--- maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/simpleTest/maven.xml (added)
+++ maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/simpleTest/maven.xml Tue Feb 14 12:42:39 2006
@@ -0,0 +1,43 @@
+<!--
+/*
+ * Copyright 2001-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:j="jelly:core"
+ xmlns:u="jelly:util"
+ xmlns:x="jelly:xml"
+ xmlns:assert="assert">
+
+ <goal name="testPlugin" prereqs="source:source,test-source">
+ <attainGoal name="clean"/>
+ </goal>
+
+ <goal name="test-source">
+
+ <j:set var="sourceFile" value="${maven.build.dir}/${maven.source.final.name}"/>
+ <!-- tests that the source is generated -->
+ <assert:assertFileExists file="${sourceFile}"/>
+
+ <!-- unzip the source and look for the App in the right package structure -->
+ <j:set var="unzipDir" value= "${maven.build.dir}/sourceTest"/>
+ <mkdir dir="${unzipDir}"/>
+ <unzip src="${sourceFile}" dest="${unzipDir}"/>
+
+ <!-- check for source -->
+ <assert:assertFileExists file="${unzipDir}/org/apache/maven/plugin/source/test/App.java"
+ msg="App.java was not bundled"/>
+
+ </goal>
+</project>
Added: maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/simpleTest/project.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/simpleTest/project.xml?rev=377824&view=auto
==============================================================================
--- maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/simpleTest/project.xml (added)
+++ maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/simpleTest/project.xml Tue Feb 14 12:42:39 2006
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+ * Copyright 2001-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-source-plugin-simpleTest</id>
+ <name>Simple Test Case for Maven Source 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/apache-maven-project.png</logo>
+ </organization>
+ <inceptionYear>2006</inceptionYear>
+ <package>org.apache.maven</package>
+ <logo>http://maven.apache.org/images/maven.gif</logo>
+ <description>Test for Maven Source plugin</description>
+ <shortDescription>Test for Maven Source plugin</shortDescription>
+ <url>http://maven.apache.org/maven-1.x/reference/plugins/source/</url>
+ <siteDirectory>/www/maven.apache.org/maven-1.x/reference/plugins/source/</siteDirectory>
+ <repository>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk/source/</connection>
+ <url>http://svn.apache.org/viewcvs.cgi/maven/maven-1/plugins/trunk/source/</url>
+ </repository>
+ <build>
+ <defaultGoal>testPlugin</defaultGoal>
+ <sourceDirectory>src/main/java</sourceDirectory>
+ </build>
+</project>
\ No newline at end of file
Added: maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/simpleTest/src/main/java/org/apache/maven/plugin/source/test/App.java
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/simpleTest/src/main/java/org/apache/maven/plugin/source/test/App.java?rev=377824&view=auto
==============================================================================
--- maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/simpleTest/src/main/java/org/apache/maven/plugin/source/test/App.java (added)
+++ maven/maven-1/plugins-sandbox/trunk/source/src/plugin-test/simpleTest/src/main/java/org/apache/maven/plugin/source/test/App.java Tue Feb 14 12:42:39 2006
@@ -0,0 +1,31 @@
+package org.apache.maven.plugin.source.test;
+
+/* ====================================================================
+ * Copyright 2001-2005 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.
+ * ====================================================================
+ */
+
+/**
+ * @author <a href="mailto:snicoll@apache.org">Stephane Nicoll</a>
+ * @version $Id: App.java 232640 2005-08-14 20:46:54Z snicoll $
+ */
+public class App
+{
+
+ public static void main( String[] args )
+ {
+ System.out.println("Hello World!");
+ }
+}
Added: maven/maven-1/plugins-sandbox/trunk/source/src/test/org/apache/maven/plugin/source/JavaSourceArtifactTypeHandlerTest.java
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins-sandbox/trunk/source/src/test/org/apache/maven/plugin/source/JavaSourceArtifactTypeHandlerTest.java?rev=377824&view=auto
==============================================================================
--- maven/maven-1/plugins-sandbox/trunk/source/src/test/org/apache/maven/plugin/source/JavaSourceArtifactTypeHandlerTest.java (added)
+++ maven/maven-1/plugins-sandbox/trunk/source/src/test/org/apache/maven/plugin/source/JavaSourceArtifactTypeHandlerTest.java Tue Feb 14 12:42:39 2006
@@ -0,0 +1,76 @@
+package org.apache.maven.plugin.source;
+
+/* ====================================================================
+ * Copyright 2001-2005 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 org.apache.maven.project.Project;
+import org.apache.maven.repository.ArtifactTypeHandler;
+import org.apache.maven.MavenException;
+import junit.framework.TestCase;
+
+/**
+ * Tests the java source artifact type handler implementation.
+ *
+ * @author <a href="mailto:snicoll@apache.org">Stephane Nicoll</a>
+ * @version $Id: JavaSourceArtifactTypeHandlerTest.java 232640 2005-08-14 20:46:54Z snicoll $
+ */
+public class JavaSourceArtifactTypeHandlerTest
+ extends TestCase
+{
+ private Project project;
+
+ private ArtifactTypeHandler handler;
+
+ private static final String VERSION = "VERSION";
+
+ public void setUp()
+ throws Exception
+ {
+ project = new Project();
+ project.setGroupId( "groupId" );
+ project.setArtifactId( "artifactId" );
+ handler = new JavaSourceArtifactTypeHandler();
+ }
+
+ public void testConstructRepositoryDirectoryPath()
+ throws Exception
+ {
+ assertEquals( "check artifact directory", "groupId/java-sources/",
+ handler.constructRepositoryDirectoryPath( "java-source", project ) );
+ }
+
+ public void testConstructRepositoryFullPath()
+ throws Exception
+ {
+ assertEquals( "check artifact path", "groupId/java-sources/artifactId-VERSION-sources.jar",
+ handler.constructRepositoryFullPath( "java-source", project, VERSION ) );
+ }
+
+ public void testConstructRepositoryFullPathWithInvalidType()
+ throws Exception
+ {
+ try
+ {
+ handler.constructRepositoryFullPath( "foo", project, VERSION );
+ fail( "expected exception" );
+ }
+ catch ( MavenException expected )
+ {
+ assertEquals( "Unrecognised java-source type (is foo)", expected.getMessage() );
+ }
+ }
+}
\ No newline at end of file