Author: ogusakov Date: Thu Apr 9 03:46:24 2009 New Revision: 763503 URL: http://svn.apache.org/viewvc?rev=763503&view=rev Log: [MERCURY-112,MERCURY-113,MERCURY-115] added a delay for test writes, added "always SNAPSHOT" flag to the local M2 repo
Modified: maven/mercury/trunk/mercury-it/src/test/java/org/apache/maven/mercury/repository/tests/ComprehensiveRepositoryTest.java maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2.java Modified: maven/mercury/trunk/mercury-it/src/test/java/org/apache/maven/mercury/repository/tests/ComprehensiveRepositoryTest.java URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-it/src/test/java/org/apache/maven/mercury/repository/tests/ComprehensiveRepositoryTest.java?rev=763503&r1=763502&r2=763503&view=diff ============================================================================== --- maven/mercury/trunk/mercury-it/src/test/java/org/apache/maven/mercury/repository/tests/ComprehensiveRepositoryTest.java (original) +++ maven/mercury/trunk/mercury-it/src/test/java/org/apache/maven/mercury/repository/tests/ComprehensiveRepositoryTest.java Thu Apr 9 03:46:24 2009 @@ -218,6 +218,7 @@ count--; } } + Thread.sleep( 1000L ); // [MERCURY-112] ? } public List<Artifact> readArtifact( String name , List<Repository> repos ) Modified: maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2.java URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2.java?rev=763503&r1=763502&r2=763503&view=diff ============================================================================== --- maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2.java (original) +++ maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2.java Thu Apr 9 03:46:24 2009 @@ -66,6 +66,11 @@ private static final IMercuryLogger LOG = MercuryLoggerManager.getLogger( LocalRepositoryReaderM2.class ); private static final Language LANG = new DefaultLanguage( LocalRepositoryReaderM2.class ); + + /** indicates that if a-1.0-SNAPSHOT.jar exists, it wins despite any timestamps + * required for Maven comatibility + **/ + private boolean _snapshotAlwaysWins = false; // --------------------------------------------------------------------------------------------------------------- private static final String[] _protocols = new String[] { "file" }; @@ -103,7 +108,7 @@ } // --------------------------------------------------------------------------------------------------------------- - private static ArtifactLocation calculateLocation( String root, ArtifactMetadata bmd, AbstractRepOpResult res ) + private ArtifactLocation calculateLocation( String root, ArtifactMetadata bmd, AbstractRepOpResult res ) { ArtifactLocation loc = new ArtifactLocation( root, bmd ); @@ -176,6 +181,7 @@ // gavDir.getAbsolutePath() ) ) ); if( LOG.isDebugEnabled() ) LOG.debug( LANG.getMessage( "gavdir.not.found", bmd.toString(), gavDir.getAbsolutePath() ) ); + return null; } @@ -411,7 +417,7 @@ } // --------------------------------------------------------------------------------------------------------------- - private static boolean findLatestSnapshot( final ArtifactMetadata md, final ArtifactLocation loc, AbstractRepOpResult res ) + private boolean findLatestSnapshot( final ArtifactMetadata md, final ArtifactLocation loc, AbstractRepOpResult res ) { File snapshotFile = new File( loc.getAbsPath() ); @@ -451,6 +457,9 @@ return true; } + if( _snapshotAlwaysWins ) + return false; + // otherwise - only add it if older'n the SNAPSHOT long fLM = new File( dir, name ).lastModified(); @@ -675,4 +684,11 @@ { } // --------------------------------------------------------------------------------------------------------------- + + public void setSnapshotAlwaysWins( boolean alwaysWins ) + { + _snapshotAlwaysWins = alwaysWins; + } + + }