You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2008/11/04 16:56:54 UTC

svn commit: r711281 - in /maven/core-integration-testing/trunk/core-it-suite/src/test: java/org/apache/maven/it/MavenITmng2883LegacyRepoOfflineTest.java resources/mng-2883/settings-template.xml

Author: bentmann
Date: Tue Nov  4 07:56:53 2008
New Revision: 711281

URL: http://svn.apache.org/viewvc?rev=711281&view=rev
Log:
o Extended IT to check that offline builds do not fail when required artifacts reside in local repo
  (MNG-2883 was originally meant as an addition to MNG-2433)

Modified:
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2883LegacyRepoOfflineTest.java
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2883/settings-template.xml

Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2883LegacyRepoOfflineTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2883LegacyRepoOfflineTest.java?rev=711281&r1=711280&r2=711281&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2883LegacyRepoOfflineTest.java (original)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2883LegacyRepoOfflineTest.java Tue Nov  4 07:56:53 2008
@@ -51,22 +51,23 @@
 public class MavenITmng2883LegacyRepoOfflineTest
     extends AbstractMavenIntegrationTestCase
 {
+
     public MavenITmng2883LegacyRepoOfflineTest()
     {
-        super( "(2.0.4,)" );
+        super( "(2.0.9,2.1.0-M1),(2.1.0-M1,)" );
     }
 
     public void testParentUnresolvable()
         throws Exception
     {
         String testName = "parent";
-        File testDir = ResourceExtractor.simpleExtractResources( getClass(),
-                                                                 "/mng-2883/"
-                                                                                 + testName );
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2883/" + testName );
 
         Verifier verifier;
 
         verifier = new Verifier( testDir.getAbsolutePath() );
+        verifier.setAutoclean( false );
+        verifier.deleteDirectory( "target" );
 
         File settings = writeSettings( testDir );
         List cliOptions = new ArrayList();
@@ -93,14 +94,17 @@
         cliOptions.add( "-o" );
 
         verifier.setCliOptions( cliOptions );
-        verifier.setAutoclean( false );
+
+        // re-run in offline mode, should still succeed by using local repo
+        verifier.setLogFileName( "log-parent-b.txt" );
+        verifier.executeGoal( "initialize" );
 
         // clear out the parent POM if it's in the local repository.
         verifier.deleteArtifact( "org.apache.maven.its.mng2883", "parent", "1.0-SNAPSHOT", "pom" );
 
         try
         {
-            verifier.setLogFileName( "log-parent-b.txt" );
+            verifier.setLogFileName( "log-parent-c.txt" );
             verifier.executeGoal( "initialize" );
 
             fail( "Build should fail with unresolvable parent POM." );
@@ -153,13 +157,13 @@
         throws Exception
     {
         String testName = "dependency";
-        File testDir = ResourceExtractor.simpleExtractResources( getClass(),
-                                                                 "/mng-2883/"
-                                                                                 + testName );
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2883/" + testName );
 
         Verifier verifier;
 
         verifier = new Verifier( testDir.getAbsolutePath() );
+        verifier.setAutoclean( false );
+        verifier.deleteDirectory( "target" );
 
         List cliOptions = new ArrayList();
 
@@ -188,13 +192,17 @@
 
         verifier.setCliOptions( cliOptions );
 
+        // re-run in offline mode, should still succeed by using local repo
+        verifier.setLogFileName( "log-dep-b.txt" );
+        verifier.executeGoal( "compile" );
+
         // clear out the dependency if it's in the local repository.
         verifier.deleteArtifact( "org.apache.maven.its.mng2883", "dep", "1.0-SNAPSHOT", "pom" );
         verifier.deleteArtifact( "org.apache.maven.its.mng2883", "dep", "1.0-SNAPSHOT", "jar" );
 
         try
         {
-            verifier.setLogFileName( "log-dep-b.txt" );
+            verifier.setLogFileName( "log-dep-c.txt" );
             verifier.executeGoal( "compile" );
 
             fail( "Build should fail with unresolvable dependency artifact." );
@@ -249,19 +257,16 @@
         throws Exception
     {
         String testName = "plugin";
-        File testDir = ResourceExtractor.simpleExtractResources( getClass(),
-                                                                 "/mng-2883/"
-                                                                                 + testName );
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2883/" + testName );
 
         Verifier verifier;
 
         verifier = new Verifier( testDir.getAbsolutePath() );
+        verifier.setAutoclean( false );
+        verifier.deleteDirectory( "target" );
 
         List cliOptions = new ArrayList();
 
-        // the centerpiece of these tests!
-        cliOptions.add( "-o" );
-
         File settings = writeSettings( testDir );
 
         // used to inject the remote repository
@@ -270,6 +275,18 @@
 
         verifier.setCliOptions( cliOptions );
 
+        verifier.setLogFileName( "log-plugin-a.txt" );
+        verifier.executeGoal( "org.apache.maven.its.mng2883:plugin:1.0-SNAPSHOT:run" );
+
+        // the centerpiece of these tests!
+        cliOptions.add( "-o" );
+
+        verifier.setCliOptions( cliOptions );
+
+        // re-run in offline mode, should still succeed by using local repo
+        verifier.setLogFileName( "log-plugin-b.txt" );
+        verifier.executeGoal( "org.apache.maven.its.mng2883:plugin:1.0-SNAPSHOT:run" );
+
         // clear out the dependency if it's in the local repository.
         verifier.deleteArtifact( "org.apache.maven.its.mng2883", "plugin", "1.0-SNAPSHOT", "pom" );
         verifier.deleteArtifact( "org.apache.maven.its.mng2883", "plugin", "1.0-SNAPSHOT", "jar" );

Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2883/settings-template.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2883/settings-template.xml?rev=711281&r1=711280&r2=711281&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2883/settings-template.xml (original)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2883/settings-template.xml Tue Nov  4 07:56:53 2008
@@ -1,3 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
 <settings>
   <profiles>
     <profile>
@@ -7,6 +28,11 @@
           <id>testing-repo</id>
           <url>file://@TESTDIR@/remote-repository</url>
           <layout>legacy</layout>
+          <snapshots>
+            <checksumPolicy>ignore</checksumPolicy>
+            <!-- NOTE: Trigger update regardless of timestamps -->
+            <updatePolicy>always</updatePolicy>
+          </snapshots>
         </repository>
       </repositories>
       <pluginRepositories>
@@ -14,6 +40,11 @@
           <id>testing-repo</id>
           <url>file://@TESTDIR@/remote-repository</url>
           <layout>legacy</layout>
+          <snapshots>
+            <checksumPolicy>ignore</checksumPolicy>
+            <!-- NOTE: Trigger update regardless of timestamps -->
+            <updatePolicy>always</updatePolicy>
+          </snapshots>
         </pluginRepository>
       </pluginRepositories>
     </profile>
@@ -21,4 +52,4 @@
   <activeProfiles>
     <activeProfile>remote-repository</activeProfile>
   </activeProfiles>
-</settings>
\ No newline at end of file
+</settings>