ConnectionString { public static VendorConnection parseConnectionString(String connectionString) throws MalformedURLException { VendorConnection vc = new VendorConnection(); vc.vendor = vendorFromURL(connectionString); String vendorURL; if( vc.vendor == null ) { vc.vendor = guessVendorFromURL(connectionString); vendorURL = connectionString; } else { vendorURL = connectionString.substring(vc.vendor.name().length()+1); } if( vc.vendor != null ) { int optionStartIndex = vendorURL.indexOf(urlOptionsDelimiter); if( optionStartIndex > -1 ) { String urlPart = vendorURL.substring(0, optionStartIndex); String optionsPart = vendorURL.substring(optionStartIndex+1); log.debug("URL part: {}", urlPart); vc.url = new URL(urlPart); vc.options = parseOptions(optionsPart); } else { vc.url = new URL(vendorURL); vc.options = null; } } return vc; } ConnectionString();  ConnectionString(Vendor vendor, String addOnConnectionString);  ConnectionString(String connectionString); static VendorConnection parseConnectionString(String connectionString); String getConnectionStringWithPrefix(); String getConnectionString(); URL getURL(); String getAddOnConnectionString(); Hostname getHostname(); String getManagementServerName(); Integer getPort(); Vendor getVendor(); static ConnectionString forIntel(String hostname); static ConnectionString forIntel(Hostname hostname); static ConnectionString forIntel(Hostname hostname, Integer port); static ConnectionString forIntel(String hostname, Integer port); static ConnectionString forIntel(String hostname, Integer port, String username, String password); static ConnectionString forMicorsoft(String hostname); static ConnectionString forMicorsoft(Hostname hostname); static ConnectionString forMicorsoft(Hostname hostname, Integer port); static ConnectionString forMicrosoft(String hostname, Integer port); static ConnectionString forMicrosoft(String hostname, Integer port, String username, String password); static ConnectionString forCitrix(Hostname hostname, String username, String password); static ConnectionString forCitrix(Hostname hostname, Integer port, String username, String password); static ConnectionString forVmware(Hostname hostname, Hostname vcenter, String username, String password); static ConnectionString forVmware(Hostname hostname, Hostname vcenter, Integer port, String username, String password); static ConnectionString forVmware(Hostname hostname, URL vcenter, String username, String password); static ConnectionString from(TxtHostRecord host); static final String OPT_USERNAME; static final String OPT_PASSWORD; static final String OPT_HOSTNAME; }
@Test public void testParseIntelVendorConnectionString() throws MalformedURLException { String url = "intel:https: ConnectionString.VendorConnection vc = ConnectionString.parseConnectionString(url); log.debug("Intel vendor: {}", vc.vendor); log.debug("Intel url: {}", vc.url); validate(url); }
@Test public void testParseCitrixVendorConnectionString() throws MalformedURLException { String url = "citrix:https: ConnectionString.VendorConnection vc = ConnectionString.parseConnectionString(url); log.debug("Citrix vendor: {}", vc.vendor); log.debug("Citrix url: {}", vc.url); log.debug("Citrix option username: {}", vc.options == null ? "no options" : vc.options.getString("u")); log.debug("Citrix option password: {}", vc.options == null ? "no options" : vc.options.getString("p")); validate(url); }
@Test public void testParseCitrixVendorConnectionStringWithNamedOptions() throws MalformedURLException { String url = "citrix:https: ConnectionString.VendorConnection vc = ConnectionString.parseConnectionString(url); log.debug("Citrix vendor: {}", vc.vendor); log.debug("Citrix url: {}", vc.url); log.debug("Citrix option username: {}", vc.options == null ? "no options" : vc.options.getString("u")); log.debug("Citrix option password: {}", vc.options == null ? "no options" : vc.options.getString("p")); validate(url); }
@Test public void testParseVmwareVendorConnectionStringWithHostname() throws MalformedURLException { String url = "vmware:https: ConnectionString.VendorConnection vc = ConnectionString.parseConnectionString(url); log.debug("Vmware vendor: {}", vc.vendor); log.debug("Vmware url: {}", vc.url); log.debug("Vmware option username: {}", vc.options == null ? "no options" : vc.options.getString("u")); log.debug("Vmware option password: {}", vc.options == null ? "no options" : vc.options.getString("p")); log.debug("Vmware option hostname: {}", vc.options == null ? "no options" : vc.options.getString("h")); validate(url); }
@Test public void testParseVmwareVendorConnectionString() throws MalformedURLException { String url = "vmware:https: ConnectionString.VendorConnection vc = ConnectionString.parseConnectionString(url); log.debug("Vmware vendor: {}", vc.vendor); log.debug("Vmware url: {}", vc.url); log.debug("Vmware option username: {}", vc.options == null ? "no options" : vc.options.getString("u")); log.debug("Vmware option password: {}", vc.options == null ? "no options" : vc.options.getString("p")); log.debug("Vmware option hostname: {}", vc.options == null ? "no options" : vc.options.getString("h")); validate(url); }
@Test public void testParseVmwareVendorConnectionStringWithNamedOptions() throws MalformedURLException { String url = "vmware:https: ConnectionString.VendorConnection vc = ConnectionString.parseConnectionString(url); log.debug("Vmware vendor: {}", vc.vendor); log.debug("Vmware url: {}", vc.url); log.debug("Vmware option username: {}", vc.options == null ? "no options" : vc.options.getString("u")); log.debug("Vmware option password: {}", vc.options == null ? "no options" : vc.options.getString("p")); log.debug("Vmware option hostname: {}", vc.options == null ? "no options" : vc.options.getString("h")); validate(url); }