Coverage Report - org.apache.maven.wagon.shared.http.HttpConfiguration
 
Classes in this File Line Coverage Branch Coverage Complexity
HttpConfiguration
38 %
8/21
50 %
3/6
1,667
 
 1  
 package org.apache.maven.wagon.shared.http;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import org.apache.commons.httpclient.HttpMethod;
 23  
 import org.apache.commons.httpclient.methods.GetMethod;
 24  
 import org.apache.commons.httpclient.methods.HeadMethod;
 25  
 import org.apache.commons.httpclient.methods.PutMethod;
 26  
 import org.apache.commons.httpclient.params.HttpClientParams;
 27  
 
 28  4
 public class HttpConfiguration
 29  
 {
 30  
     
 31  1
     private static final HttpMethodConfiguration DEFAULT_PUT =
 32  
         new HttpMethodConfiguration().addParam( HttpClientParams.USE_EXPECT_CONTINUE, "%b,true" );
 33  
     
 34  
     private HttpMethodConfiguration all;
 35  
     
 36  
     private HttpMethodConfiguration get;
 37  
     
 38  
     private HttpMethodConfiguration put;
 39  
     
 40  
     private HttpMethodConfiguration head;
 41  
 
 42  
     public HttpMethodConfiguration getAll()
 43  
     {
 44  0
         return all;
 45  
     }
 46  
 
 47  
     public HttpConfiguration setAll( HttpMethodConfiguration all )
 48  
     {
 49  4
         this.all = all;
 50  4
         return this;
 51  
     }
 52  
 
 53  
     public HttpMethodConfiguration getGet()
 54  
     {
 55  0
         return get;
 56  
     }
 57  
     
 58  
     public HttpConfiguration setGet( HttpMethodConfiguration get )
 59  
     {
 60  0
         this.get = get;
 61  0
         return this;
 62  
     }
 63  
 
 64  
     public HttpMethodConfiguration getPut()
 65  
     {
 66  0
         return put;
 67  
     }
 68  
 
 69  
     public HttpConfiguration setPut( HttpMethodConfiguration put )
 70  
     {
 71  0
         this.put = put;
 72  0
         return this;
 73  
     }
 74  
 
 75  
     public HttpMethodConfiguration getHead()
 76  
     {
 77  0
         return head;
 78  
     }
 79  
 
 80  
     public HttpConfiguration setHead( HttpMethodConfiguration head )
 81  
     {
 82  0
         this.head = head;
 83  0
         return this;
 84  
     }
 85  
     
 86  
     public HttpMethodConfiguration getMethodConfiguration( HttpMethod method )
 87  
     {
 88  4
         if ( method instanceof GetMethod )
 89  
         {
 90  0
             return HttpMethodConfiguration.merge( all, get );
 91  
         }
 92  4
         else if ( method instanceof PutMethod )
 93  
         {
 94  0
             return HttpMethodConfiguration.merge( DEFAULT_PUT, all, put );
 95  
         }
 96  4
         else if ( method instanceof HeadMethod )
 97  
         {
 98  4
             return HttpMethodConfiguration.merge( all, head );
 99  
         }
 100  
         
 101  0
         return all;
 102  
     }
 103  
 
 104  
 }