@Test(dataProvider = "endpointProvider") public void testBuildForceApiEndpoint(String endpoint, String expectedProtocol, String expectedHost, int expectedPort) throws MalformedURLException { URL apiUrl = new URL(ForceConnectorUtils.buildForceApiEndpoint(endpoint)); assertEquals(apiUrl.getProtocol(), expectedProtocol); assertEquals(apiUrl.getHost(), expectedHost); assertEquals(apiUrl.getPort(), expectedPort); assertEquals(apiUrl.getPath(), new URL(com.sforce.soap.partner.Connector.END_POINT).getPath()); }
public static String buildForceApiEndpoint(String endpoint) { String[] parsedEndpoint = endpoint.split(": String endpointNoProtocol = parsedEndpoint[parsedEndpoint.length - 1]; StringBuffer apiEndpoint = new StringBuffer(endpointNoProtocol); if (!endpointNoProtocol.contains("/services/Soap/u")) { if (endpointNoProtocol.charAt(endpointNoProtocol.length() - 1) == '/') { apiEndpoint.deleteCharAt(endpointNoProtocol.length() - 1); } apiEndpoint.append(FORCE_API_ENDPOINT_PATH); } if (endpointNoProtocol.startsWith("localhost") || endpointNoProtocol.contains("internal")) { if (parsedEndpoint.length == 2) { apiEndpoint.insert(0, ": apiEndpoint.insert(0, parsedEndpoint[0]); } else { apiEndpoint.insert(0, "http: } } else { apiEndpoint.insert(0, "https: } return apiEndpoint.toString(); }
ForceConnectorUtils { public static String buildForceApiEndpoint(String endpoint) { String[] parsedEndpoint = endpoint.split(": String endpointNoProtocol = parsedEndpoint[parsedEndpoint.length - 1]; StringBuffer apiEndpoint = new StringBuffer(endpointNoProtocol); if (!endpointNoProtocol.contains("/services/Soap/u")) { if (endpointNoProtocol.charAt(endpointNoProtocol.length() - 1) == '/') { apiEndpoint.deleteCharAt(endpointNoProtocol.length() - 1); } apiEndpoint.append(FORCE_API_ENDPOINT_PATH); } if (endpointNoProtocol.startsWith("localhost") || endpointNoProtocol.contains("internal")) { if (parsedEndpoint.length == 2) { apiEndpoint.insert(0, ": apiEndpoint.insert(0, parsedEndpoint[0]); } else { apiEndpoint.insert(0, "http: } } else { apiEndpoint.insert(0, "https: } return apiEndpoint.toString(); } }
ForceConnectorUtils { public static String buildForceApiEndpoint(String endpoint) { String[] parsedEndpoint = endpoint.split(": String endpointNoProtocol = parsedEndpoint[parsedEndpoint.length - 1]; StringBuffer apiEndpoint = new StringBuffer(endpointNoProtocol); if (!endpointNoProtocol.contains("/services/Soap/u")) { if (endpointNoProtocol.charAt(endpointNoProtocol.length() - 1) == '/') { apiEndpoint.deleteCharAt(endpointNoProtocol.length() - 1); } apiEndpoint.append(FORCE_API_ENDPOINT_PATH); } if (endpointNoProtocol.startsWith("localhost") || endpointNoProtocol.contains("internal")) { if (parsedEndpoint.length == 2) { apiEndpoint.insert(0, ": apiEndpoint.insert(0, parsedEndpoint[0]); } else { apiEndpoint.insert(0, "http: } } else { apiEndpoint.insert(0, "https: } return apiEndpoint.toString(); } private  ForceConnectorUtils(); }
ForceConnectorUtils { public static String buildForceApiEndpoint(String endpoint) { String[] parsedEndpoint = endpoint.split(": String endpointNoProtocol = parsedEndpoint[parsedEndpoint.length - 1]; StringBuffer apiEndpoint = new StringBuffer(endpointNoProtocol); if (!endpointNoProtocol.contains("/services/Soap/u")) { if (endpointNoProtocol.charAt(endpointNoProtocol.length() - 1) == '/') { apiEndpoint.deleteCharAt(endpointNoProtocol.length() - 1); } apiEndpoint.append(FORCE_API_ENDPOINT_PATH); } if (endpointNoProtocol.startsWith("localhost") || endpointNoProtocol.contains("internal")) { if (parsedEndpoint.length == 2) { apiEndpoint.insert(0, ": apiEndpoint.insert(0, parsedEndpoint[0]); } else { apiEndpoint.insert(0, "http: } } else { apiEndpoint.insert(0, "https: } return apiEndpoint.toString(); } private  ForceConnectorUtils(); static String buildForceApiEndpoint(String endpoint); static boolean isInjectable(String var); static String extractValue(String var); static Map<ForceConnectionProperty, String> loadConnectorPropsFromName(String connectionName); static Map<ForceConnectionProperty, String> loadConnectorPropsFromUrl(String connectionUrl); static void clearCache(); }
ForceConnectorUtils { public static String buildForceApiEndpoint(String endpoint) { String[] parsedEndpoint = endpoint.split(": String endpointNoProtocol = parsedEndpoint[parsedEndpoint.length - 1]; StringBuffer apiEndpoint = new StringBuffer(endpointNoProtocol); if (!endpointNoProtocol.contains("/services/Soap/u")) { if (endpointNoProtocol.charAt(endpointNoProtocol.length() - 1) == '/') { apiEndpoint.deleteCharAt(endpointNoProtocol.length() - 1); } apiEndpoint.append(FORCE_API_ENDPOINT_PATH); } if (endpointNoProtocol.startsWith("localhost") || endpointNoProtocol.contains("internal")) { if (parsedEndpoint.length == 2) { apiEndpoint.insert(0, ": apiEndpoint.insert(0, parsedEndpoint[0]); } else { apiEndpoint.insert(0, "http: } } else { apiEndpoint.insert(0, "https: } return apiEndpoint.toString(); } private  ForceConnectorUtils(); static String buildForceApiEndpoint(String endpoint); static boolean isInjectable(String var); static String extractValue(String var); static Map<ForceConnectionProperty, String> loadConnectorPropsFromName(String connectionName); static Map<ForceConnectionProperty, String> loadConnectorPropsFromUrl(String connectionUrl); static void clearCache();  }