/** * Load the JMeter properties file; if not found, then * default to "org/apache/jmeter/jmeter.properties" from the classpath * * c.f. loadProperties * */ public static void loadJMeterProperties(String file) { Properties p = new Properties(System.getProperties()); InputStream ins = null; try { File f = new File(file); ins = new FileInputStream(f); p.load(ins); } catch (IOException e) { try { ins = ClassLoader.getSystemResourceAsStream("org/apache/jmeter/jmeter.properties"); // $NON-NLS-1$ if (ins == null) { //throw new RuntimeException("Could not read JMeter properties file"); } p.load(ins); } catch (IOException ex) { // JMeter.fail("Could not read internal resource. " + // "Archive is broken."); } } finally { JOrphanUtils.closeQuietly(ins); } appProperties = p; }
public static Properties loadProperties() { Properties nameMap = new Properties(); FileInputStream fis = null; try { fis = new FileInputStream(JMeterUtils.getJMeterHome() + JMeterUtils.getPropDefault(SAVESERVICE_PROPERTIES, SAVESERVICE_PROPERTIES_FILE)); nameMap.load(fis); } finally { JOrphanUtils.closeQuietly(fis); } return(nameMap); }
/** * This method loads a property file that may reside in the user space, or * in the classpath * * @param file * the file to load * @param defaultProps a set of default properties * @return the Properties from the file; if it could not be processed, the defaultProps are returned. */ public static Properties loadProperties(String file, Properties defaultProps) { Properties p = new Properties(defaultProps); InputStream ins = null; try { File f = new File(file); ins = new FileInputStream(f); p.load(ins); } catch (IOException e) { //try //{ // sealed URL resource = NetMeterUtils.class.getClassLoader().getResource(file); // if (resource == null) // { // //log.warn("Cannot find " + file); // return defaultProps; // } // ins = resource.openStream(); // if (ins == null) // { // log.warn("Cannot open " + file); // return defaultProps; // } // p.load(ins); //} //catch (IOException ex) //{ // log.warn("Error reading " + file + " " + ex.toString()); // return defaultProps; //} } finally { JOrphanUtils.closeQuietly(ins); } return(p); }
public String[] getTestPlanClasspathArray() { return(JOrphanUtils.split(this.getTestPlanClasspath(), CLASSPATH_SEPARATOR)); }