Author: bentmann
Date: Sat Dec 19 23:56:41 2009
New Revision: 892534

URL: http://svn.apache.org/viewvc?rev=892534&view=rev
Log:
[MNG-4500] [regression] Maven checks for updates of timestamped snapshots

o Added IT

Added:
    
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4500NoUpdateOfTimestampedSnapshotsTest.java
   (with props)
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/pom.xml
   (with props)
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/repo/
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/repo/org/
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/repo/org/apache/
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/repo/org/apache/maven/
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/repo/org/apache/maven/its/
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/repo/org/apache/maven/its/mng4500/
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/repo/org/apache/maven/its/mng4500/dep/
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/repo/org/apache/maven/its/mng4500/dep/0.1-SNAPSHOT/
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/repo/org/apache/maven/its/mng4500/dep/0.1-SNAPSHOT/dep-0.1-20091219.230823-1.jar
   (with props)
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/repo/org/apache/maven/its/mng4500/dep/0.1-SNAPSHOT/dep-0.1-20091219.230823-1.pom
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/repo/org/apache/maven/its/mng4500/dep/0.1-SNAPSHOT/maven-metadata.xml
   (with props)
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/settings-template.xml
   (with props)
Modified:
    
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java

Modified: 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java?rev=892534&r1=892533&r2=892534&view=diff
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
 (original)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
 Sat Dec 19 23:56:41 2009
@@ -85,6 +85,7 @@
         // suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class );
         // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- 
MNG-3137
 
+        suite.addTestSuite( 
MavenITmng4500NoUpdateOfTimestampedSnapshotsTest.class );
         suite.addTestSuite( MavenITmng4498IgnoreBrokenMetadataTest.class );
         suite.addTestSuite( MavenITmng4489MirroringOfExtensionRepoTest.class );
         suite.addTestSuite( 
MavenITmng4488ValidateExternalParenPomLenientTest.class );

Added: 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4500NoUpdateOfTimestampedSnapshotsTest.java
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4500NoUpdateOfTimestampedSnapshotsTest.java?rev=892534&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4500NoUpdateOfTimestampedSnapshotsTest.java
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4500NoUpdateOfTimestampedSnapshotsTest.java
 Sat Dec 19 23:56:41 2009
@@ -0,0 +1,129 @@
+package org.apache.maven.it;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.it.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.handler.AbstractHandler;
+import org.mortbay.jetty.handler.DefaultHandler;
+import org.mortbay.jetty.handler.HandlerList;
+import org.mortbay.jetty.handler.ResourceHandler;
+
+/**
+ * This is a test set for <a 
href="http://jira.codehaus.org/browse/MNG-4500";>MNG-4500</a>.
+ * 
+ * @author Benjamin Bentmann
+ */
+public class MavenITmng4500NoUpdateOfTimestampedSnapshotsTest
+    extends AbstractMavenIntegrationTestCase
+{
+
+    public MavenITmng4500NoUpdateOfTimestampedSnapshotsTest()
+    {
+        super( "[2.0.3,3.0-alpha-1),[3.0-alpha-6,)" );
+    }
+
+    /**
+     * Test that timestamped snapshots are treated as immutable, i.e. Maven 
should never check for updates of them
+     * once downloaded from a remote repo regardless of the update policy.
+     */
+    public void testit()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), 
"/mng-4500" );
+
+        String pomUri = 
"/repo/org/apache/maven/its/mng4500/dep/0.1-SNAPSHOT/dep-0.1-20091219.230823-1.pom";
+        String jarUri = 
"/repo/org/apache/maven/its/mng4500/dep/0.1-SNAPSHOT/dep-0.1-20091219.230823-1.jar";
+
+        final List requestedUris = new ArrayList();
+
+        AbstractHandler logHandler = new AbstractHandler()
+        {
+            public void handle( String target, HttpServletRequest request, 
HttpServletResponse response, int dispatch )
+                throws IOException, ServletException
+            {
+                requestedUris.add( request.getRequestURI() );
+            }
+        };
+
+        ResourceHandler repoHandler = new ResourceHandler();
+        repoHandler.setResourceBase( testDir.getAbsolutePath() );
+
+        HandlerList handlerList = new HandlerList();
+        handlerList.addHandler( logHandler );
+        handlerList.addHandler( repoHandler );
+        handlerList.addHandler( new DefaultHandler() );
+
+        Server server = new Server( 0 );
+        server.setHandler( handlerList );
+        server.start();
+
+        Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+        try
+        {
+            verifier.setAutoclean( false );
+            verifier.deleteDirectory( "target" );
+            verifier.deleteArtifacts( "org.apache.maven.its.mng4500" );
+            Properties filterProps = verifier.newDefaultFilterProperties();
+            filterProps.setProperty( "@port@", Integer.toString( 
server.getConnectors()[0].getLocalPort() ) );
+            verifier.filterFile( "settings-template.xml", "settings.xml", 
"UTF-8", filterProps );
+            verifier.getCliOptions().add( "-s" );
+            verifier.getCliOptions().add( "settings.xml" );
+
+            verifier.setLogFileName( "log-1.txt" );
+            verifier.executeGoal( "validate" );
+            verifier.verifyErrorFreeLog();
+
+            List classpath = verifier.loadLines( "target/classpath.txt", 
"UTF-8" );
+            assertTrue( classpath.toString(), classpath.contains( 
"dep-0.1-SNAPSHOT.jar" ) );
+            assertTrue( requestedUris.toString(), requestedUris.contains( 
pomUri ) );
+            assertTrue( requestedUris.toString(), requestedUris.contains( 
jarUri ) );
+
+            requestedUris.clear();
+
+            verifier.setLogFileName( "log-2.txt" );
+            verifier.executeGoal( "validate" );
+            verifier.verifyErrorFreeLog();
+
+            classpath = verifier.loadLines( "target/classpath.txt", "UTF-8" );
+            assertTrue( classpath.toString(), classpath.contains( 
"dep-0.1-SNAPSHOT.jar" ) );
+            assertFalse( requestedUris.toString(), requestedUris.contains( 
pomUri ) );
+            assertFalse( requestedUris.toString(), requestedUris.contains( 
jarUri ) );
+        }
+        finally
+        {
+            verifier.resetStreams();
+            server.stop();
+        }
+    }
+
+}

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4500NoUpdateOfTimestampedSnapshotsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4500NoUpdateOfTimestampedSnapshotsTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/pom.xml?rev=892534&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/pom.xml
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/pom.xml
 Sat Dec 19 23:56:41 2009
@@ -0,0 +1,65 @@
+<?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.
+-->
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.mng4500</groupId>
+  <artifactId>test</artifactId>
+  <version>0.1</version>
+
+  <name>Maven Integration Test :: MNG-4500</name>
+  <description>
+    Test that timestamped snapshots are treated as immutable, i.e. Maven 
should never check for updates of them
+    once downloaded from a remote repo regardless of the update policy.
+  </description>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.its.mng4500</groupId>
+      <artifactId>dep</artifactId>
+      <version>0.1-SNAPSHOT</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.its.plugins</groupId>
+        <artifactId>maven-it-plugin-dependency-resolution</artifactId>
+        <version>2.1-SNAPSHOT</version>
+        <configuration>
+          <testClassPath>target/classpath.txt</testClassPath>
+          <significantPathLevels>1</significantPathLevels>
+        </configuration>
+        <executions>
+          <execution>
+            <id>test</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>test</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/repo/org/apache/maven/its/mng4500/dep/0.1-SNAPSHOT/dep-0.1-20091219.230823-1.jar
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/repo/org/apache/maven/its/mng4500/dep/0.1-SNAPSHOT/dep-0.1-20091219.230823-1.jar?rev=892534&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/repo/org/apache/maven/its/mng4500/dep/0.1-SNAPSHOT/dep-0.1-20091219.230823-1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/repo/org/apache/maven/its/mng4500/dep/0.1-SNAPSHOT/dep-0.1-20091219.230823-1.pom
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/repo/org/apache/maven/its/mng4500/dep/0.1-SNAPSHOT/dep-0.1-20091219.230823-1.pom?rev=892534&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/repo/org/apache/maven/its/mng4500/dep/0.1-SNAPSHOT/dep-0.1-20091219.230823-1.pom
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/repo/org/apache/maven/its/mng4500/dep/0.1-SNAPSHOT/dep-0.1-20091219.230823-1.pom
 Sat Dec 19 23:56:41 2009
@@ -0,0 +1,38 @@
+<?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.
+-->
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.mng4500</groupId>
+  <artifactId>dep</artifactId>
+  <version>0.1-SNAPSHOT</version>
+  <packaging>jar</packaging>
+
+  <name>Maven Integration Test :: MNG-4500</name>
+
+  <distributionManagement>
+    <repository>
+      <id>maven-core-it</id>
+      <url>file:///${basedir}/repo</url>
+    </repository>
+  </distributionManagement>
+</project>

Added: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/repo/org/apache/maven/its/mng4500/dep/0.1-SNAPSHOT/maven-metadata.xml
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/repo/org/apache/maven/its/mng4500/dep/0.1-SNAPSHOT/maven-metadata.xml?rev=892534&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/repo/org/apache/maven/its/mng4500/dep/0.1-SNAPSHOT/maven-metadata.xml
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/repo/org/apache/maven/its/mng4500/dep/0.1-SNAPSHOT/maven-metadata.xml
 Sat Dec 19 23:56:41 2009
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata>
+  <groupId>org.apache.maven.its.mng4500</groupId>
+  <artifactId>dep</artifactId>
+  <version>0.1-SNAPSHOT</version>
+  <versioning>
+    <snapshot>
+      <timestamp>20091219.230823</timestamp>
+      <buildNumber>1</buildNumber>
+    </snapshot>
+    <lastUpdated>20091219230823</lastUpdated>
+  </versioning>
+</metadata>

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/repo/org/apache/maven/its/mng4500/dep/0.1-SNAPSHOT/maven-metadata.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/repo/org/apache/maven/its/mng4500/dep/0.1-SNAPSHOT/maven-metadata.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/settings-template.xml
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/settings-template.xml?rev=892534&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/settings-template.xml
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/settings-template.xml
 Sat Dec 19 23:56:41 2009
@@ -0,0 +1,45 @@
+<?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>
+      <id>maven-core-it-repo</id>
+      <repositories>
+        <repository>
+          <id>maven-core-it</id>
+          <url>http://localhost:@port@/repo</url>
+          <releases>
+            <enabled>false</enabled>
+          </releases>
+          <snapshots>
+            <!-- The update policy should only apply to metadata but not to 
timestamped snapshots themselves! -->
+            <updatePolicy>always</updatePolicy>
+            <checksumPolicy>ignore</checksumPolicy>
+          </snapshots>
+        </repository>
+      </repositories>
+    </profile>
+  </profiles>
+  <activeProfiles>
+    <activeProfile>maven-core-it-repo</activeProfile>
+  </activeProfiles>
+</settings>

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/settings-template.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4500/settings-template.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision


Reply via email to