maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject svn commit: r1200891 - in /maven/plugin-tools/trunk/maven-plugin-tools-java/src/test: java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java resources/java-1.5/MyEnum.java resources/source3/TestAnnotation.java
Date Fri, 11 Nov 2011 14:05:46 GMT
Author: hboutemy
Date: Fri Nov 11 14:05:46 2011
New Revision: 1200891

URL: http://svn.apache.org/viewvc?rev=1200891&view=rev
Log:
use generics and other little code improvements

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/java-1.5/MyEnum.java
    maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source3/TestAnnotation.java

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=1200891&r1=1200890&r2=1200891&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 Nov 11 14:05:46 2011
@@ -28,6 +28,7 @@ import org.apache.maven.project.MavenPro
 import org.apache.maven.tools.plugin.DefaultPluginToolsRequest;
 import org.apache.maven.tools.plugin.ExtendedMojoDescriptor;
 import org.apache.maven.tools.plugin.PluginToolsRequest;
+import org.apache.maven.tools.plugin.extractor.MojoDescriptorExtractor;
 import org.codehaus.plexus.util.FileUtils;
 
 import java.io.File;
@@ -55,13 +56,10 @@ public class JavaMojoDescriptorExtractor
         return result;
     }
 
-    public List<MojoDescriptor> extract( String directory )
+    protected List<MojoDescriptor> extract( String directory )
         throws Exception
     {
-        JavaMojoDescriptorExtractor extractor = new JavaMojoDescriptorExtractor();
-
         File sourceFile = fileOf( "dir-flag.txt" );
-
         File dir = sourceFile.getParentFile();
 
         Model model = new Model();
@@ -77,6 +75,8 @@ public class JavaMojoDescriptorExtractor
 
         PluginToolsRequest request = new DefaultPluginToolsRequest( project, pluginDescriptor
).setEncoding( "UTF-8" );
 
+        MojoDescriptorExtractor extractor = new JavaMojoDescriptorExtractor();
+
         return extractor.execute( request );
     }
 
@@ -87,9 +87,8 @@ public class JavaMojoDescriptorExtractor
         
         assertEquals( "Extracted mojos", 2, results.size() );
 
-        for ( int i = 0; i < 2; i++ )
+        for ( MojoDescriptor mojoDescriptor : results )
         {
-            MojoDescriptor mojoDescriptor = (MojoDescriptor) results.get( i );
             assertEquals( 1, mojoDescriptor.getParameters().size() );
             Parameter parameter = (Parameter) mojoDescriptor.getParameters().get( 0 );
             assertEquals( "project", parameter.getName() );
@@ -104,7 +103,7 @@ public class JavaMojoDescriptorExtractor
 
         assertEquals( 1, results.size() );
 
-        MojoDescriptor mojoDescriptor = (MojoDescriptor) results.get( 0 );
+        MojoDescriptor mojoDescriptor = results.get( 0 );
 
         @SuppressWarnings( "unchecked" )
         List<Parameter> parameters = mojoDescriptor.getParameters();

Modified: maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/java-1.5/MyEnum.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/java-1.5/MyEnum.java?rev=1200891&r1=1200890&r2=1200891&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/java-1.5/MyEnum.java
(original)
+++ maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/java-1.5/MyEnum.java
Fri Nov 11 14:05:46 2011
@@ -1,14 +1,14 @@
 public enum MyEnum
 {
 
-    @Deprecated()
+    @Deprecated( )
     SOME_VALUE,
 
     // cf. MPLUGIN-151
-    @SuppressWarnings("all")
+    @SuppressWarnings( "all" )
     ANOTHER_VALUE,
 
-    @SuppressWarnings(value = { "all" })
+    @SuppressWarnings( value = { "all" } )
     YET_ANOTHER_VALUE;
 
 }

Modified: maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source3/TestAnnotation.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source3/TestAnnotation.java?rev=1200891&r1=1200890&r2=1200891&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source3/TestAnnotation.java
(original)
+++ maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/resources/source3/TestAnnotation.java
Fri Nov 11 14:05:46 2011
@@ -1,8 +1,8 @@
 package source3;
 
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.ANNOTATION_TYPE)
+@Retention( RetentionPolicy.RUNTIME )
+@Target( ElementType.ANNOTATION_TYPE )
+public @interface TestAnnotation
+{
 
-public @interface TestAnnotation {
-    
 }



Mime
View raw message