Author: olamy
Date: Mon Dec 12 13:52:15 2011
New Revision: 1213244

URL: http://svn.apache.org/viewvc?rev=1213244&view=rev
Log:
 add it test to ensure readTimeOut is read from settings

Added:
    
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5175WagonHttpTest.java
   (with props)
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5175/
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5175/pom.xml
   (with props)
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5175/settings-template.xml
   (with props)

Added: 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5175WagonHttpTest.java
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5175WagonHttpTest.java?rev=1213244&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5175WagonHttpTest.java
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5175WagonHttpTest.java
 Mon Dec 12 13:52:15 2011
@@ -0,0 +1,126 @@
+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.util.ResourceExtractor;
+import org.mortbay.jetty.Handler;
+import org.mortbay.jetty.Request;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.handler.AbstractHandler;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.IOException;
+import java.util.Properties;
+
+/**
+ * This is a test set for <a 
href="http://jira.codehaus.org/browse/MNG-5175";>MNG-5175</a>.
+ * test correct integration of wagon http: read time out configuration from 
settings.xml
+ *
+ * @version $Id$
+ */
+public class MavenITmng5175WagonHttpTest
+    extends AbstractMavenIntegrationTestCase
+{
+    private Server server;
+
+    private int port;
+
+    public MavenITmng5175WagonHttpTest()
+    {
+        super( "[3.0-4,)" ); // 3.0.4+
+    }
+
+    public void setUp()
+        throws Exception
+    {
+        Handler handler = new AbstractHandler()
+        {
+            public void handle( String target, HttpServletRequest request, 
HttpServletResponse response, int dispatch )
+                throws IOException, ServletException
+            {
+                try
+                {
+                    Thread.sleep( 15 );
+                }
+                catch ( InterruptedException e )
+                {
+                    throw new ServletException( e.getMessage() );
+                }
+                response.setContentType( "text/plain" );
+                response.setStatus( HttpServletResponse.SC_OK );
+                response.getWriter().println( "some content" );
+                response.getWriter().println();
+
+                ( (Request) request ).setHandled( true );
+            }
+        };
+
+        server = new Server( 0 );
+        server.setHandler( handler );
+        server.start();
+
+        port = server.getConnectors()[0].getLocalPort();
+    }
+
+    protected void tearDown()
+        throws Exception
+    {
+        super.tearDown();
+
+        if ( server != null )
+        {
+            server.stop();
+            server = null;
+        }
+    }
+
+    /**
+     * Test that the read time out from settings is used.
+     * basically use a 1ms time out and wait a bit in the handler
+     */
+    public void testmng5175_ReadTimeOutFromSettings()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), 
"/mng-5175" );
+
+        Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+
+        Properties filterProps = new Properties();
+        filterProps.setProperty( "@port@", Integer.toString( port ) );
+
+        verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", 
filterProps );
+
+        verifier.getCliOptions().add( "-U" );
+        verifier.getCliOptions().add( "--settings" );
+        verifier.getCliOptions().add( "settings.xml" );
+        //verifier.
+        verifier.executeGoal( "validate" );
+
+        verifier.verifyTextInLog( "Read timed out" );
+        verifier.resetStreams();
+
+
+    }
+
+
+}

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

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

Added: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5175/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5175/pom.xml?rev=1213244&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5175/pom.xml
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5175/pom.xml
 Mon Dec 12 13:52:15 2011
@@ -0,0 +1,20 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.its.mng5175</groupId>
+  <artifactId>test-project</artifactId>
+  <packaging>jar</packaging>
+  <version>1.0-SNAPSHOT</version>
+  <name>test-project</name>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.its.mng5175</groupId>
+        <artifactId>fake-dependency</artifactId>
+        <version>1.0-SNAPSHOT</version>
+        <extensions>true</extensions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

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

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

Added: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5175/settings-template.xml
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5175/settings-template.xml?rev=1213244&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5175/settings-template.xml
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-5175/settings-template.xml
 Mon Dec 12 13:52:15 2011
@@ -0,0 +1,23 @@
+<settings>
+  <servers>
+    <server>
+      <id>test-small-timeout</id>
+      <configuration>
+        <httpConfiguration>
+          <all>
+            <readTimeout>10</readTimeout>
+          </all>
+        </httpConfiguration>
+      </configuration>
+    </server>
+  </servers>
+  <mirrors>
+    <mirror>
+      <name>archiva</name>
+      <mirrorOf>*</mirrorOf>
+      <id>test-small-timeout</id>
+      <url>http://localhost:@port@/archiva/repository/internal/</url>
+    </mirror>
+  </mirrors>
+</settings>
+ 

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

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


Reply via email to