Author: olamy
Date: Thu Dec 15 10:19:47 2011
New Revision: 1214687

URL: http://svn.apache.org/viewvc?rev=1214687&view=rev
Log:
enhance test with checking chunked is not used as not supported by ngnix

Added:
    
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/utils/
    
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/utils/DeployedResource.java
   (with props)
Modified:
    
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4235HttpAuthDeploymentChecksumsTest.java
    
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4470AuthenticatedDeploymentToProxyTest.java

Modified: 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4235HttpAuthDeploymentChecksumsTest.java
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4235HttpAuthDeploymentChecksumsTest.java?rev=1214687&r1=1214686&r2=1214687&view=diff
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4235HttpAuthDeploymentChecksumsTest.java
 (original)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4235HttpAuthDeploymentChecksumsTest.java
 Thu Dec 15 10:19:47 2011
@@ -20,6 +20,7 @@ package org.apache.maven.it;
  */
 
 import org.apache.maven.it.util.ResourceExtractor;
+import org.apache.maven.it.utils.DeployedResource;
 import org.codehaus.plexus.util.StringUtils;
 import org.mortbay.jetty.HttpMethods;
 import org.mortbay.jetty.Request;
@@ -149,8 +150,6 @@ public class MavenITmng4235HttpAuthDeplo
         assertHash( verifier, 
"repo/org/apache/maven/its/mng4235/test/maven-metadata.xml", ".sha1", "SHA-1" );
         assertHash( verifier, 
"repo/org/apache/maven/its/mng4235/test/maven-metadata.xml", ".md5", "MD5" );
 
-        //  System.out.println( "deployedResources:" + 
repoHandler.deployedResources );
-
         for ( DeployedResource deployedResource : 
repoHandler.deployedResources )
         {
             if ( StringUtils.equalsIgnoreCase( "chunked", 
deployedResource.transferEncoding ) )
@@ -227,32 +226,5 @@ public class MavenITmng4235HttpAuthDeplo
         }
     }
 
-    static class DeployedResource
-    {
-        String httpMethod;
-
-        String requestUri;
 
-        String contentLength;
-
-        String transferEncoding;
-
-        public DeployedResource()
-        {
-            // no op
-        }
-
-        @Override
-        public String toString()
-        {
-            final StringBuilder sb = new StringBuilder();
-            sb.append( "DeployedResource" );
-            sb.append( "{httpMethod='" ).append( httpMethod ).append( '\'' );
-            sb.append( ", requestUri='" ).append( requestUri ).append( '\'' );
-            sb.append( ", contentLength='" ).append( contentLength ).append( 
'\'' );
-            sb.append( ", transferEncoding='" ).append( transferEncoding 
).append( '\'' );
-            sb.append( '}' );
-            return sb.toString();
-        }
-    }
 }

Modified: 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4470AuthenticatedDeploymentToProxyTest.java
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4470AuthenticatedDeploymentToProxyTest.java?rev=1214687&r1=1214686&r2=1214687&view=diff
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4470AuthenticatedDeploymentToProxyTest.java
 (original)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4470AuthenticatedDeploymentToProxyTest.java
 Thu Dec 15 10:19:47 2011
@@ -21,7 +21,9 @@ package org.apache.maven.it;
 
 import java.io.File;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Collections;
+import java.util.List;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
@@ -29,6 +31,8 @@ import javax.servlet.http.HttpServletRes
 
 import org.apache.maven.it.Verifier;
 import org.apache.maven.it.util.ResourceExtractor;
+import org.apache.maven.it.utils.DeployedResource;
+import org.codehaus.plexus.util.StringUtils;
 import org.mortbay.jetty.Handler;
 import org.mortbay.jetty.Request;
 import org.mortbay.jetty.Server;
@@ -56,6 +60,8 @@ public class MavenITmng4470Authenticated
 
     private volatile boolean deployed;
 
+    List<DeployedResource> deployedResources = new 
ArrayList<DeployedResource>();
+
     public MavenITmng4470AuthenticatedDeploymentToProxyTest()
     {
         super( "[2.0.3,3.0-alpha-1),[3.0-alpha-6,)" );
@@ -87,11 +93,21 @@ public class MavenITmng4470Authenticated
                     response.addHeader( "Proxy-Authenticate", "Basic 
realm=\"Squid proxy-caching web server\"" );
                     ( (Request) request ).setHandled( true );
                 }
+
+                DeployedResource deployedResource = new DeployedResource();
+
+                deployedResource.httpMethod = request.getMethod();
+                deployedResource.requestUri = request.getRequestURI();
+                deployedResource.transferEncoding = request.getHeader( 
"Transfer-Encoding" );
+                deployedResource.contentLength = request.getHeader( 
"Content-Length" );
+
+                deployedResources.add( deployedResource );
             }
         };
 
         Handler repoHandler = new AbstractHandler()
         {
+
             public void handle( String target, HttpServletRequest request, 
HttpServletResponse response, int dispatch )
                 throws IOException, ServletException
             {
@@ -108,6 +124,15 @@ public class MavenITmng4470Authenticated
                 }
 
                 ( (Request) request ).setHandled( true );
+
+                DeployedResource deployedResource = new DeployedResource();
+
+                deployedResource.httpMethod = request.getMethod();
+                deployedResource.requestUri = request.getRequestURI();
+                deployedResource.transferEncoding = request.getHeader( 
"Transfer-Encoding" );
+                deployedResource.contentLength = request.getHeader( 
"Content-Length" );
+
+                deployedResources.add( deployedResource );
             }
         };
 
@@ -175,6 +200,9 @@ public class MavenITmng4470Authenticated
     private void testit( String project )
         throws Exception
     {
+
+        deployedResources = new ArrayList<DeployedResource>();
+
         File testDir = ResourceExtractor.simpleExtractResources( getClass(), 
"/mng-4470/" + project );
 
         Verifier verifier = newVerifier( testDir.getAbsolutePath() );
@@ -187,6 +215,15 @@ public class MavenITmng4470Authenticated
         verifier.verifyErrorFreeLog();
         verifier.resetStreams();
 
+        for ( DeployedResource deployedResource : deployedResources )
+        {
+            if ( StringUtils.equalsIgnoreCase( "chunked", 
deployedResource.transferEncoding ) )
+            {
+                fail( "deployedResource " + deployedResource
+                          + " use chuncked transfert encoding some http server 
doesn't support that" );
+            }
+        }
+
         assertTrue( deployed );
     }
 

Added: 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/utils/DeployedResource.java
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/utils/DeployedResource.java?rev=1214687&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/utils/DeployedResource.java
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/utils/DeployedResource.java
 Thu Dec 15 10:19:47 2011
@@ -0,0 +1,51 @@
+package org.apache.maven.it.utils;
+/*
+ * 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.
+ */
+
+/**
+ * @author Olivier Lamy
+ */
+public class DeployedResource
+{
+    public String httpMethod;
+
+    public String requestUri;
+
+    public String contentLength;
+
+    public String transferEncoding;
+
+    public DeployedResource()
+    {
+        // no op
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb = new StringBuilder();
+        sb.append( "DeployedResource" );
+        sb.append( "{httpMethod='" ).append( httpMethod ).append( '\'' );
+        sb.append( ", requestUri='" ).append( requestUri ).append( '\'' );
+        sb.append( ", contentLength='" ).append( contentLength ).append( '\'' 
);
+        sb.append( ", transferEncoding='" ).append( transferEncoding ).append( 
'\'' );
+        sb.append( '}' );
+        return sb.toString();
+    }
+}

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

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


Reply via email to