Here you can find the source of loadCredentials(File credentials, String credentialsAppend)
private static void loadCredentials(File credentials, String credentialsAppend) throws IOException
//package com.java2s; //License from project: Apache License import java.io.*; import java.util.Properties; public class Main { /********************************************** *// w w w.j a v a 2 s . c o m * Helper methods for test case setup or reporting * **********************************************/ private static String username; private static String password; private static String teamworkServer; private static String teamworkPort; private static String twCloudServer; private static String twCloudPort; private static void loadCredentials(File credentials, String credentialsAppend) throws IOException { InputStream propertiesFileStream = new FileInputStream(credentials); if (propertiesFileStream == null) { throw new IOException("Credentials stream is invalid."); } Properties prop = new Properties(); prop.load(propertiesFileStream); if (prop.containsKey("user.name" + credentialsAppend)) { username = prop.getProperty("user.name" + credentialsAppend); password = prop.getProperty("user.pass" + credentialsAppend); } else { username = prop.getProperty("user.name") + credentialsAppend; password = prop.getProperty("user.pass") + credentialsAppend; } teamworkServer = prop.getProperty("tw.url"); teamworkPort = prop.getProperty("tw.port"); twCloudServer = prop.getProperty("twc.url"); twCloudPort = prop.getProperty("twc.port"); if (teamworkServer != null && teamworkServer.indexOf("//") != -1) teamworkServer = teamworkServer.substring(teamworkServer .indexOf("//") + 2); if (teamworkServer != null && teamworkServer.lastIndexOf(':') != -1) teamworkServer = teamworkServer.substring(0, teamworkServer.lastIndexOf(':')); } }