You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ag...@apache.org on 2015/03/23 22:28:20 UTC

svn commit: r1668744 - in /maven/plugins/trunk/maven-eclipse-plugin: ./ src/main/java/org/apache/maven/plugin/ide/ src/test/java/org/apache/maven/plugin/eclipse/ src/test/java/org/apache/maven/plugin/eclipse/it/ src/test/java/org/apache/maven/plugin/ec...

Author: agudian
Date: Mon Mar 23 21:28:20 2015
New Revision: 1668744

URL: http://svn.apache.org/r1668744
Log:
o Fix a couple of unit tests / ITs on Windows

Modified:
    maven/plugins/trunk/maven-eclipse-plugin/pom.xml
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java
    maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/TempEclipseWorkspace.java
    maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java
    maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocationsTest.java
    maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-10/pom.xml

Modified: maven/plugins/trunk/maven-eclipse-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/pom.xml?rev=1668744&r1=1668743&r2=1668744&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/pom.xml Mon Mar 23 21:28:20 2015
@@ -108,7 +108,7 @@ under the License.
     <dependency>
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>
-      <version>1.4</version>
+      <version>2.2</version>
     </dependency>
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
@@ -237,12 +237,12 @@ under the License.
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-resources-plugin</artifactId>
-          <version>2.3</version>
+          <version>2.7</version>
         </plugin>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-surefire-report-plugin</artifactId>
-          <version>2.12</version>
+          <version>2.18.1</version>
           <configuration>
             <reportsDirectories>
               <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
@@ -420,7 +420,7 @@ under the License.
           <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-failsafe-plugin</artifactId>
-            <version>2.12</version>
+            <version>2.18.1</version>
             <executions>
               <execution>
                 <goals>
@@ -460,7 +460,7 @@ under the License.
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-report-plugin</artifactId>
-        <version>2.12</version>
+        <version>2.18.1</version>
         <reportSets>
           <reportSet>
             <id>integration-tests</id>

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java?rev=1668744&r1=1668743&r2=1668744&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java Mon Mar 23 21:28:20 2015
@@ -940,7 +940,7 @@ public abstract class AbstractIdeSupport
                 if (artifact.isResolved()) {
                     if ("sources".equals(inClassifier)) {
                         dependency.setSourceAttachment(artifact.getFile());
-                    } else if ("javadoc".equals(inClassifier)) {
+                    } else if ("javadoc".equals(inClassifier) && includeRemoteRepositories ) {
                         dependency.setJavadocAttachment(artifact.getFile());
                     }
                 } else {

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/TempEclipseWorkspace.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/TempEclipseWorkspace.java?rev=1668744&r1=1668743&r2=1668744&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/TempEclipseWorkspace.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/TempEclipseWorkspace.java Mon Mar 23 21:28:20 2015
@@ -29,20 +29,15 @@ import java.io.IOException;
 import java.net.MalformedURLException;
 import java.util.Properties;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.maven.plugin.eclipse.reader.ReadWorkspaceLocations;
 import org.codehaus.plexus.util.IOUtil;
 import org.eclipse.core.internal.localstore.ILocalStoreConstants;
 
 public class TempEclipseWorkspace
 {
-    private static TempEclipseWorkspace rad7WithDefault14;
-
-    private static TempEclipseWorkspace eclipseWithDefault15;
-
-    private static TempEclipseWorkspace eclipseWithDefault13;
-
-    private static TempEclipseWorkspace dynamicWorkspace;
-
+    private static int workspaceNumber = 0;
+    
     /**
      * @return RAD 7 workspace, JDK 14, includes projects: "direct-compile"
      * @throws Exception
@@ -50,11 +45,7 @@ public class TempEclipseWorkspace
     public static TempEclipseWorkspace getFixtureEclipseWorkspaceWithRad7Default14()
         throws Exception
     {
-        if ( rad7WithDefault14 == null )
-        {
-            rad7WithDefault14 = new TempEclipseWorkspace( "rad7WithDefault14", new String[] { "direct-compile" } );
-        }
-        return rad7WithDefault14;
+        return new TempEclipseWorkspace( "rad7WithDefault14", new String[] { "direct-compile" } );
     }
 
     /**
@@ -64,11 +55,7 @@ public class TempEclipseWorkspace
     public static TempEclipseWorkspace getFixtureEclipseWithDefault15()
         throws Exception
     {
-        if ( eclipseWithDefault15 == null )
-        {
-            eclipseWithDefault15 = new TempEclipseWorkspace( "eclipseWithDefault15", new String[] { "direct-compile" } );
-        }
-        return eclipseWithDefault15;
+        return new TempEclipseWorkspace( "eclipseWithDefault15", new String[] { "direct-compile" } );
     }
 
     /**
@@ -78,11 +65,7 @@ public class TempEclipseWorkspace
     public static TempEclipseWorkspace getFixtureEclipseWithDefault13()
         throws Exception
     {
-        if ( eclipseWithDefault13 == null )
-        {
-            eclipseWithDefault13 = new TempEclipseWorkspace( "eclipseWithDefault13", new String[] { "direct-compile" } );
-        }
-        return eclipseWithDefault13;
+        return new TempEclipseWorkspace( "eclipseWithDefault13", new String[] { "direct-compile" } );
     }
 
     /**
@@ -92,12 +75,7 @@ public class TempEclipseWorkspace
     public static TempEclipseWorkspace getFixtureEclipseDynamicWorkspace()
         throws Exception
     {
-        if ( dynamicWorkspace == null )
-        {
-            dynamicWorkspace =
-                new TempEclipseWorkspace( "dynamicWorkspace", new String[] { "project-A/module-A1", "../project-O" } );
-        }
-        return dynamicWorkspace;
+        return new TempEclipseWorkspace( "dynamicWorkspace", new String[] { "project-A/module-A1", "../project-O" } );
     }
 
     public File workspaceLocation;
@@ -106,7 +84,11 @@ public class TempEclipseWorkspace
         throws Exception
     {
 
-        File eclipseLocation = new java.io.File( "target/test-classes/eclipse" ).getCanonicalFile();
+        File tempWorkspace = new File( "target/tmp-workspace" + workspaceNumber++ );
+        FileUtils.deleteDirectory( tempWorkspace );
+        FileUtils.copyDirectoryToDirectory( new File( "src/test/resources/eclipse" ), tempWorkspace );
+
+        File eclipseLocation = new File( tempWorkspace, "eclipse" ).getCanonicalFile();
 
         File jdkLocation = new File( eclipseLocation, "dummyJDK" );
 

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java?rev=1668744&r1=1668743&r2=1668744&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java Mon Mar 23 21:28:20 2015
@@ -23,6 +23,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Properties;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.eclipse.TempEclipseWorkspace;
 
@@ -34,10 +35,20 @@ import org.apache.maven.plugin.eclipse.T
 public class EclipsePluginIT
     extends AbstractEclipsePluginIT
 {
+    private static boolean initialized = false;
+
     protected void setUp()
         throws Exception
     {
         super.setUp();
+
+        if ( !initialized )
+        {
+            File tempWorkspace = new File( "target/test-classes/eclipse" );
+            FileUtils.deleteDirectory( tempWorkspace );
+            FileUtils.copyDirectoryToDirectory( new File( "src/test/resources/eclipse" ), tempWorkspace );
+            initialized = true;
+        }
     }
 
     /**

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocationsTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocationsTest.java?rev=1668744&r1=1668743&r2=1668744&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocationsTest.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocationsTest.java Mon Mar 23 21:28:20 2015
@@ -19,6 +19,7 @@ import java.util.HashMap;
 
 import junit.framework.TestCase;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.maven.plugin.eclipse.TempEclipseWorkspace;
 import org.apache.maven.plugin.eclipse.WorkspaceConfiguration;
 import org.apache.maven.plugin.logging.Log;
@@ -33,16 +34,18 @@ public class ReadWorkspaceLocationsTest
     extends TestCase
 {
 
-    private static final File PROJECTS_DIRECTORY = new File( "target/test-classes/eclipse" );
-
-    private static final File DYNAMIC_WORKSPACE_DIRECTORY = new File( PROJECTS_DIRECTORY, "dynamicWorkspace" );
-
-    private static final File WORKSPACE_DIRECTORY = new File( DYNAMIC_WORKSPACE_DIRECTORY, "workspace" );
-
-    private static final File WORKSPACE_PROJECT_METADATA_DIRECTORY =
-        new File( WORKSPACE_DIRECTORY, ReadWorkspaceLocations.METADATA_PLUGINS_ORG_ECLIPSE_CORE_RESOURCES_PROJECTS );
+//    private final File PROJECTS_DIRECTORY = new File( "target/tmp-workspace/eclipse" );
+//
+//    private final File DYNAMIC_WORKSPACE_DIRECTORY = TempEclipseWorkspace.getFixtureEclipseDynamicWorkspace().workspaceLocation;
+//
+//    private static final File WORKSPACE_DIRECTORY = new File( DYNAMIC_WORKSPACE_DIRECTORY, "workspace" );
+//
+//    private static final File WORKSPACE_PROJECT_METADATA_DIRECTORY =
+//        new File( WORKSPACE_DIRECTORY, ReadWorkspaceLocations.METADATA_PLUGINS_ORG_ECLIPSE_CORE_RESOURCES_PROJECTS );
 
     private MockManager mm = new MockManager();
+private File workspaceLocation;
+private File metaDataDirectory;
 
     /**
      * {@inheritDoc}
@@ -51,6 +54,10 @@ public class ReadWorkspaceLocationsTest
         throws Exception
     {
         super.setUp();
+        
+        workspaceLocation = TempEclipseWorkspace.getFixtureEclipseDynamicWorkspace().workspaceLocation;
+        metaDataDirectory = new File( workspaceLocation, ReadWorkspaceLocations.METADATA_PLUGINS_ORG_ECLIPSE_CORE_RESOURCES_PROJECTS );;
+
     }
 
     /**
@@ -65,11 +72,11 @@ public class ReadWorkspaceLocationsTest
     {
         ReadWorkspaceLocations objectUnderTest = new ReadWorkspaceLocations();
 
-        File metadataProjectDirectory = new File( WORKSPACE_PROJECT_METADATA_DIRECTORY, "project-A" );
+        File metadataProjectDirectory = new File( metaDataDirectory , "project-A" );
 
-        File projectLocation = objectUnderTest.getProjectLocation( WORKSPACE_DIRECTORY, metadataProjectDirectory );
+        File projectLocation = objectUnderTest.getProjectLocation( workspaceLocation, metadataProjectDirectory );
 
-        File expectedProjectDirectory = new File( WORKSPACE_DIRECTORY, "project-A" );
+        File expectedProjectDirectory = new File( workspaceLocation, "project-A" );
         assertFileEquals( expectedProjectDirectory, projectLocation );
     }
 
@@ -86,11 +93,11 @@ public class ReadWorkspaceLocationsTest
     {
         ReadWorkspaceLocations objectUnderTest = new ReadWorkspaceLocations();
 
-        File metadataProjectDirectory = new File( WORKSPACE_PROJECT_METADATA_DIRECTORY, "module-A1" );
+        File metadataProjectDirectory = new File( metaDataDirectory, "module-A1" );
         File expectedProjectDirectory =
-            new File( TempEclipseWorkspace.getFixtureEclipseDynamicWorkspace().workspaceLocation, "project-A/module-A1" );
+            new File( workspaceLocation, "project-A/module-A1" );
 
-        File projectLocation = objectUnderTest.getProjectLocation( WORKSPACE_DIRECTORY, metadataProjectDirectory );
+        File projectLocation = objectUnderTest.getProjectLocation( workspaceLocation, metadataProjectDirectory );
 
         assertFileEquals( expectedProjectDirectory, projectLocation );
     }
@@ -108,10 +115,10 @@ public class ReadWorkspaceLocationsTest
     {
         ReadWorkspaceLocations objectUnderTest = new ReadWorkspaceLocations();
 
-        File metadataProjectDirectory = new File( WORKSPACE_PROJECT_METADATA_DIRECTORY, "project-O" );
-        File expectedProjectDirectory = new File( DYNAMIC_WORKSPACE_DIRECTORY, "project-O" );
+        File metadataProjectDirectory = new File( metaDataDirectory, "project-O" );
+        File expectedProjectDirectory = new File( workspaceLocation, "../project-O" );
 
-        File projectLocation = objectUnderTest.getProjectLocation( WORKSPACE_DIRECTORY, metadataProjectDirectory );
+        File projectLocation = objectUnderTest.getProjectLocation( workspaceLocation, metadataProjectDirectory );
 
         assertFileEquals( expectedProjectDirectory, projectLocation );
     }

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-10/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-10/pom.xml?rev=1668744&r1=1668743&r2=1668744&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-10/pom.xml (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-10/pom.xml Mon Mar 23 21:28:20 2015
@@ -50,6 +50,7 @@ under the License.
         <configuration>
           <workspace>${basedir}/../../eclipse/workspaceDoesNotExist</workspace>
           <wtpversion>R7</wtpversion>
+          <downloadJavadoc>true</downloadJavadoc>
           <projectnatures>
             <projectnature>org.eclipse.jdt.core.javanature</projectnature>
           </projectnatures>