maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject svn commit: r1215322 - in /maven/plugin-tools/trunk/maven-plugin-tools-java/src/test: java/org/apache/maven/tools/plugin/extractor/java/ resources/source/ resources/source/jdoc/
Date Fri, 16 Dec 2011 22:28:38 GMT
Author: hboutemy
Date: Fri Dec 16 22:28:37 2011
New Revision: 1215322

URL: http://svn.apache.org/viewvc?rev=1215322&view=rev
Log:
transformed unit test to a more complete one

Added:
    maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source/jdoc/
    maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source/jdoc/Default.java
  (with props)
    maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source/jdoc/Full.java
  (with props)
Removed:
    maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source/JavaExtractorTestOne.java
    maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source/JavaExtractorTestTwo.java
Modified:
    maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java
    maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source/plugin-expected.xml

Modified: maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java?rev=1215322&r1=1215321&r2=1215322&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java
(original)
+++ maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java
Fri Dec 16 22:28:37 2011
@@ -155,22 +155,6 @@ public class JavaMojoDescriptorExtractor
         return descriptor.getMojos();
     }
 
-    public void testShouldFindTwoMojoDescriptorsInTestSourceDirectory()
-        throws Exception
-    {
-        List<MojoDescriptor> results = extract( "source" );
-        
-        assertEquals( "Extracted mojos", 2, results.size() );
-
-        for ( MojoDescriptor mojoDescriptor : results )
-        {
-            assertEquals( 1, mojoDescriptor.getParameters().size() );
-            Parameter parameter = (Parameter) mojoDescriptor.getParameters().get( 0 );
-            assertEquals( "project", parameter.getName() );
-            assertEquals( "java.lang.String[]", parameter.getType() );
-        }
-    }
-
     public void testShouldPropagateImplementationParameter()
         throws Exception
     {

Added: maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source/jdoc/Default.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source/jdoc/Default.java?rev=1215322&view=auto
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source/jdoc/Default.java
(added)
+++ maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source/jdoc/Default.java
Fri Dec 16 22:28:37 2011
@@ -0,0 +1,59 @@
+package source.jdoc;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.plugin.AbstractMojo;
+import org.apache.maven.tools.plugin.scanner.MojoScanner;
+
+/**
+ * Test default values.
+ *
+ * @goal default-values
+ */
+public class Default
+    extends AbstractMojo
+{
+    /**
+     * A parameter.
+     *
+     * @parameter
+     */
+    protected String[] parameter;
+
+    /**
+     * An attribute not published as parameter.
+     */
+    protected String[] attribute;
+
+    /**
+     * A component.
+     * 
+     * @component
+     */
+    private MojoScanner component;
+
+    public Default()
+    {
+    }
+
+    public void execute()
+    {
+    }
+}

Propchange: maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source/jdoc/Default.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source/jdoc/Default.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source/jdoc/Default.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source/jdoc/Full.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source/jdoc/Full.java?rev=1215322&view=auto
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source/jdoc/Full.java
(added)
+++ maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source/jdoc/Full.java
Fri Dec 16 22:28:37 2011
@@ -0,0 +1,84 @@
+package source.jdoc;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 java.io.File;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.tools.plugin.scanner.MojoScanner;
+
+/**
+ * Test defining every javadoc annotation.
+ *
+ * @goal full-annotations
+ * @aggregator
+ * @configurator "role-hint"
+ * @execute phase="site-deploy" lifecycle="site"
+ * @executionStrategy always
+ * @inheritByDefault false
+ * @instantiationStrategy singleton
+ * @phase install
+ * @requiresDependencyResolution compile+runtime
+ * @requiresDependencyCollection test
+ * @requiresDirectInvocation true
+ * @requiresOnline true
+ * @requiresProject false
+ * @requiresReports true
+ * @threadSafe
+ * @since now
+ * @deprecated deprecation text test
+ */
+public class Full
+    extends AbstractMojo
+{
+    /**
+     * A parameter.
+     *
+     * @parameter
+     */
+    protected String[] parameter;
+
+    /**
+     * @parameter alias="myAlias" expression="${aSystemProperty}" default-value="${anExpression}"
+     * @readonly
+     * @required
+     * @since tomorrow
+     * @deprecated after tomorrow
+     */
+    private File file;
+
+    /**
+     * A component.
+     * 
+     * @component role="role" roleHint="hint"
+     * @readonly
+     * @required
+     * @since tomorrow
+     * @deprecated after tomorrow
+     */
+    private MojoScanner component;
+
+    public Full()
+    {
+    }
+
+    public void execute()
+    {
+    }
+}

Propchange: maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source/jdoc/Full.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source/jdoc/Full.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source/jdoc/Full.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source/plugin-expected.xml
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source/plugin-expected.xml?rev=1215322&r1=1215321&r2=1215322&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source/plugin-expected.xml
(original)
+++ maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source/plugin-expected.xml
Fri Dec 16 22:28:37 2011
@@ -30,54 +30,84 @@
   <inheritedByDefault>true</inheritedByDefault>
   <mojos>
     <mojo>
-      <goal>ideaOne</goal>
-      <description>Create an IDEA project file from a Maven project.</description>
-      <requiresDependencyResolution>runtime</requiresDependencyResolution>
+      <goal>default-values</goal>
+      <description>Test default values.</description>
       <requiresDirectInvocation>false</requiresDirectInvocation>
       <requiresProject>true</requiresProject>
       <requiresReports>false</requiresReports>
       <aggregator>false</aggregator>
       <requiresOnline>false</requiresOnline>
       <inheritedByDefault>true</inheritedByDefault>
-      <implementation>source.JavaExtractorTestOne</implementation>
+      <implementation>source.jdoc.Default</implementation>
       <language>java</language>
       <instantiationStrategy>per-lookup</instantiationStrategy>
       <executionStrategy>once-per-session</executionStrategy>
       <threadSafe>false</threadSafe>
       <parameters>
         <parameter>
-          <name>project</name>
+          <name>parameter</name>
           <type>java.lang.String[]</type>
-          <required>true</required>
+          <required>false</required>
           <editable>true</editable>
-          <description>Maven project used to generate IDEA project files.</description>
+          <description>A parameter.</description>
         </parameter>
       </parameters>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.tools.plugin.scanner.MojoScanner</role>
+          <field-name>component</field-name>
+        </requirement>
+      </requirements>
     </mojo>
     <mojo>
-      <goal>ideaTwo</goal>
-      <description>Create an IDEA project file from a Maven project.</description>
-      <requiresDependencyResolution>compile</requiresDependencyResolution>
-      <requiresDirectInvocation>false</requiresDirectInvocation>
-      <requiresProject>true</requiresProject>
-      <requiresReports>false</requiresReports>
-      <aggregator>false</aggregator>
-      <requiresOnline>false</requiresOnline>
-      <inheritedByDefault>true</inheritedByDefault>
-      <implementation>source.JavaExtractorTestTwo</implementation>
+      <goal>full-annotations</goal>
+      <description>Test defining every javadoc annotation.</description>
+      <requiresDependencyResolution>compile+runtime</requiresDependencyResolution>
+      <requiresDirectInvocation>true</requiresDirectInvocation>
+      <requiresProject>false</requiresProject>
+      <requiresReports>true</requiresReports>
+      <aggregator>true</aggregator>
+      <requiresOnline>true</requiresOnline>
+      <inheritedByDefault>false</inheritedByDefault>
+      <phase>install</phase>
+      <executePhase>site-deploy</executePhase>
+      <executeLifecycle>site</executeLifecycle>
+      <implementation>source.jdoc.Full</implementation>
       <language>java</language>
-      <instantiationStrategy>per-lookup</instantiationStrategy>
+      <configurator>&quot;role-hint&quot;</configurator>
+      <instantiationStrategy>singleton</instantiationStrategy>
       <executionStrategy>once-per-session</executionStrategy>
-      <threadSafe>false</threadSafe>
+      <deprecated>deprecation text test</deprecated>
+      <requiresDependencyCollection>test</requiresDependencyCollection>
+      <threadSafe>true</threadSafe>
       <parameters>
         <parameter>
-          <name>project</name>
-          <type>java.lang.String[]</type>
+          <name>file</name>
+          <alias>myAlias</alias>
+          <type>java.io.File</type>
+          <deprecated>after tomorrow</deprecated>
           <required>true</required>
+          <editable>false</editable>
+          <description></description>
+        </parameter>
+        <parameter>
+          <name>parameter</name>
+          <type>java.lang.String[]</type>
+          <required>false</required>
           <editable>true</editable>
-          <description>Maven project used to generate IDEA project files.</description>
+          <description>A parameter.</description>
         </parameter>
       </parameters>
+      <configuration>
+        <file implementation="java.io.File" default-value="${anExpression}">${aSystemProperty}</file>
+      </configuration>
+      <requirements>
+        <requirement>
+          <role>role</role>
+          <role-hint>hint</role-hint>
+          <field-name>component</field-name>
+        </requirement>
+      </requirements>
     </mojo>
   </mojos>
   <dependencies/>



Mime
View raw message