Coverage Report - org.mule.transport.jdbc.JdbcEndpointURIBuilder
 
Classes in this File Line Coverage Branch Coverage Complexity
JdbcEndpointURIBuilder
0%
0/13
0%
0/12
5
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.transport.jdbc;
 8  
 
 9  
 import org.mule.api.endpoint.MalformedEndpointException;
 10  
 import org.mule.endpoint.AbstractEndpointURIBuilder;
 11  
 
 12  
 import java.net.URI;
 13  
 import java.util.Properties;
 14  
 
 15  
 /**
 16  
  * Parses a JDBC style endpoint to a MuleEndpointURI
 17  
  */
 18  0
 public class JdbcEndpointURIBuilder extends AbstractEndpointURIBuilder
 19  
 {
 20  
 
 21  
     protected void setEndpoint(URI uri, Properties props) throws MalformedEndpointException
 22  
     {
 23  0
         if (uri.getHost() != null && !"localhost".equals(uri.getHost()))
 24  
         {
 25  0
             endpointName = uri.getHost();
 26  
         }
 27  0
         int i = uri.getPath().indexOf("/", 1);
 28  0
         if (i > 0)
 29  
         {
 30  0
             endpointName = uri.getPath().substring(1, i);
 31  0
             address = uri.getPath().substring(i + 1);
 32  
         }
 33  0
         else if (uri.getPath() != null && uri.getPath().length() != 0)
 34  
         {
 35  0
             address = uri.getPath().substring(1);
 36  
         }
 37  
         else
 38  
         {
 39  0
             address = uri.getAuthority();
 40  
         }
 41  
         // JDBC endpoints can just have a param string, hence te address is left
 42  
         // null, but the address
 43  
         // should always be a non-null value
 44  0
         if (address == null)
 45  
         {
 46  0
             address = uri.getScheme();
 47  
         }
 48  0
     }
 49  
 }