/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License.
*/
// workdir stuff /** * name of the system property defining root workdir direcory * - it must be set before running tests using workdir * - in the case of running tests from XTest framework, this * property is set by the framework itself * - otherwise the default is ${java.io.tmpdir}/tests
*/ publicstaticfinal String NBJUNIT_WORKDIR = "nbjunit.workdir";
// nbjunit home dir - directory where nbjunit.jar and other files are stored publicstaticfinal String NBJUNIT_HOME = "nbjunit.home";
static {
fPreferences = new Properties();
fPreferences.put(PROP_DIFF_IMPL, DEFAULT_DIFF_IMPL);
}
if (path == null) { // try to get property from user's settings
readProperties();
path = fPreferences.getProperty(NBJUNIT_HOME);
} if (path != null) {
path = path.replace('/', File.separatorChar); return path;
} else { thrownew IOException("Cannot determine NbJUnit home. Please make sure you have "+NBJUNIT_HOME
+" property set in your "+JUNIT_PROPERTIES_FILENAME+" file.");
}
}
publicstatic File getNbJUnitHome() throws IOException {
File nbJUnitHome = normalizeFile(new File(getNbJUnitHomePath())); if (nbJUnitHome.isDirectory()) { return nbJUnitHome;
} else { thrownew IOException("Property "+NBJUNIT_HOME+" does not point to nbjunit home.");
}
}
privatestatic File getPreferencesFile() {
String junitPropertiesLocation = System.getProperty(Manager.JUNIT_PROPERTIES_LOCATION_PROPERTY); if (junitPropertiesLocation != null) {
File propertyFile = new File(junitPropertiesLocation); if (propertyFile.exists()) { return propertyFile;
}
} // property file was not found - lets fall back to defaults
String home= System.getProperty("user.home"); returnnew File(home, Manager.JUNIT_PROPERTIES_FILENAME);
}
/** * Normalize java.io.File, that is make sure that returned File has * normalized case on Windows; that old Windows 8.3 filename is normalized; * that Unix symlinks are not followed; that relative path is changed to * absolute; etc. * @param file file to normalize * @return normalized file
*/ publicstatic File normalizeFile(File file) {
Runnable off = Log.internalLog(); try { // taken from org.openide.util.FileUtil if (System.getProperty ("os.name").startsWith("Windows")) { // NOI18N // On Windows, best to canonicalize. try {
file = file.getCanonicalFile();
} catch (IOException e) {
Logger.getLogger(Manager.class.getName()).warning("getCanonicalFile() on file " + file + " failed: " + e); // OK, so at least try to absolutize the path
file = file.getAbsoluteFile();
}
} else { // On Unix, do not want to traverse symlinks.
@SuppressWarnings("URI.normalize")
URI normalized = file.toURI().normalize();
file = new File(normalized).getAbsoluteFile();
} return file;
} finally {
off.run();
}
}
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.31 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.