Coverage Report - org.mule.endpoint.SocketEndpointURIBuilder
 
Classes in this File Line Coverage Branch Coverage Complexity
SocketEndpointURIBuilder
0%
0/11
0%
0/6
5
 
 1  
 /*
 2  
  * $Id: SocketEndpointURIBuilder.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  
 
 15  
 import java.net.URI;
 16  
 import java.util.Properties;
 17  
 
 18  
 /**
 19  
  * <code>SocketEndpointBuilder</code> builds an endpointUri based on host and port
 20  
  * only
 21  
  */
 22  0
 public class SocketEndpointURIBuilder extends AbstractEndpointURIBuilder
 23  
 {
 24  
     protected void setEndpoint(URI uri, Properties props) throws MalformedEndpointException
 25  
     {
 26  
         // set the endpointUri to be a proper url if host and port are set
 27  0
         if (uri.getPort() == -1)
 28  
         {
 29  
             // try the form tcp://6666
 30  
             try
 31  
             {
 32  0
                 int port = Integer.parseInt(uri.getHost());
 33  0
                 this.address = uri.getScheme() + "://localhost:" + port;
 34  
             }
 35  0
             catch (NumberFormatException e)
 36  
             {
 37  
                 // ignore
 38  0
             }
 39  
         }
 40  
 
 41  0
         if (address == null)
 42  
         {
 43  0
             this.address = uri.getScheme() + "://" + uri.getHost();
 44  0
             if (uri.getPort() != -1)
 45  
             {
 46  0
                 this.address += ":" + uri.getPort();
 47  
             }
 48  
         }
 49  0
     }
 50  
 }