Coverage Report - org.mule.endpoint.UrlEndpointURIBuilder
 
Classes in this File Line Coverage Branch Coverage Complexity
UrlEndpointURIBuilder
0%
0/11
0%
0/8
5
 
 1  
 /*
 2  
  * $Id: UrlEndpointURIBuilder.java 19191 2010-08-25 21:05:23Z tcarlson $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.endpoint;
 12  
 
 13  
 import org.mule.api.endpoint.MalformedEndpointException;
 14  
 import org.mule.util.StringUtils;
 15  
 
 16  
 import java.net.URI;
 17  
 import java.util.Properties;
 18  
 
 19  
 /**
 20  
  * <code>UrlEndpointBuilder</code> is the default endpointUri strategy suitable for
 21  
  * most connectors
 22  
  */
 23  
 
 24  0
 public class UrlEndpointURIBuilder extends AbstractEndpointURIBuilder
 25  
 {
 26  
 
 27  
     protected void setEndpoint(URI uri, Properties props) throws MalformedEndpointException
 28  
     {
 29  0
         address = "";
 30  0
         if (uri.getHost() != null)
 31  
         {
 32  
             // set the endpointUri to be a proper url if host and port are set
 33  0
             this.address = uri.getScheme() + "://" + uri.getHost();
 34  0
             if (uri.getPort() != -1)
 35  
             {
 36  0
                 address += ":" + uri.getPort();
 37  
             }
 38  
         }
 39  0
         if (StringUtils.isNotBlank(uri.getRawPath()))
 40  
         {
 41  0
             address += uri.getRawPath();
 42  
         }
 43  
 
 44  0
         if (StringUtils.isNotBlank(uri.getRawQuery()))
 45  
         {
 46  0
             address += "?" + uri.getRawQuery();
 47  
         }
 48  0
     }
 49  
 }