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 2009/06/21 19:12:12 UTC

svn commit: r787053 - /maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0768OfflineModeTest.java

Author: bentmann
Date: Sun Jun 21 17:12:12 2009
New Revision: 787053

URL: http://svn.apache.org/viewvc?rev=787053&view=rev
Log:
o Fixed IT setup to detect failure to respect offline mode

Modified:
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0768OfflineModeTest.java

Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0768OfflineModeTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0768OfflineModeTest.java?rev=787053&r1=787052&r2=787053&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0768OfflineModeTest.java (original)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng0768OfflineModeTest.java Sun Jun 21 17:12:12 2009
@@ -23,8 +23,6 @@
 import org.apache.maven.it.util.ResourceExtractor;
 
 import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
 
 /**
  * This is a test set for <a href="http://jira.codehaus.org/browse/MNG-768">MNG-768</a>.
@@ -65,14 +63,12 @@
         }
 
         {
-            // phase 2: run build in offline mode to check it still passes (after deleting test repo, to be sure)
+            // phase 2: run build in offline mode to check it still passes
+            // NOTE: We don't add the settings here to ensure Maven has no chance to access the required remote repo
             Verifier verifier = new Verifier( testDir.getAbsolutePath() );
             verifier.setAutoclean( false );
             verifier.deleteDirectory( "target" );
-            verifier.deleteDirectory( "repo" );
-            List cliOptions = new ArrayList();
-            cliOptions.add( "-o" );
-            verifier.setCliOptions( cliOptions );
+            verifier.getCliOptions().add( "-o" );
             verifier.setLogFileName( "log2.txt" );
             verifier.executeGoal( "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution:2.1-SNAPSHOT:compile" );
             verifier.assertFilePresent( "target/compile.txt" );
@@ -82,19 +78,20 @@
 
         {
             // phase 3: delete test artifact and run build in offline mode to check it fails now
+            // NOTE: We add the settings again to offer Maven the bad choice of using the remote repo
             Verifier verifier = new Verifier( testDir.getAbsolutePath() );
             verifier.setAutoclean( false );
             verifier.deleteDirectory( "target" );
             verifier.deleteArtifacts( "org.apache.maven.its.it0069" );
-            List cliOptions = new ArrayList();
-            cliOptions.add( "-o" );
-            verifier.setCliOptions( cliOptions );
+            verifier.getCliOptions().add( "-o" );
+            verifier.getCliOptions().add( "--settings" );
+            verifier.getCliOptions().add( "settings.xml" );
             verifier.setLogFileName( "log3.txt" );
             try
             {
                 verifier.executeGoal( "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution:2.1-SNAPSHOT:compile" );
                 verifier.verifyErrorFreeLog();
-                fail( "Build did not fail!" );
+                fail( "Build did not fail to resolve missing dependency although Maven ought to work offline!" );
             }
             catch( VerificationException e )
             {