Java源码示例:org.openide.modules.InstalledFileLocator
示例1
private void injectEventSpy(final BeanRunConfig clonedConfig) {
//TEMP
String mavenPath = clonedConfig.getProperties().get(CosChecker.MAVENEXTCLASSPATH);
File jar = InstalledFileLocator.getDefault().locate("maven-nblib/netbeans-eventspy.jar", "org.netbeans.modules.maven", false);
if (mavenPath == null) {
mavenPath = "";
} else {
String delimiter = Utilities.isWindows() ? ";" : ":";
if(mavenPath.contains(jar + delimiter)) {
// invoked by output view > rerun? see also issue #249971
return;
}
mavenPath = delimiter + mavenPath;
}
//netbeans-eventspy.jar comes first on classpath
mavenPath = jar.getAbsolutePath() + mavenPath;
clonedConfig.setProperty(CosChecker.MAVENEXTCLASSPATH, mavenPath);
}
示例2
private void doTestCompileCP() {
File fakeJdkClasses = InstalledFileLocator.getDefault().locate("modules/ext/fakeJdkClasses.zip", "org.netbeans.modules.java.openjdk.project", false);
checkCompileClassPath("repo/src/test1",
"${wd}/jdk/src/java.base/fake-target.jar" +
File.pathSeparatorChar +
"${wd}/langtools/src/java.compiler/fake-target.jar" +
File.pathSeparatorChar +
fakeJdkClasses.getAbsolutePath());
checkCompileClassPath("repo/src/test2",
"${wd}/jdk/src/java.base/fake-target.jar" +
File.pathSeparatorChar +
"${wd}/langtools/src/java.compiler/fake-target.jar" +
File.pathSeparatorChar +
"${wd}/langtools/src/jdk.compiler/fake-target.jar" +
File.pathSeparatorChar +
fakeJdkClasses.getAbsolutePath());
checkCompileClassPath("repo/src/test3",
"${wd}/jdk/src/java.base/fake-target.jar" +
File.pathSeparatorChar +
"${wd}/repo/src/test2/fake-target.jar" +
File.pathSeparatorChar +
fakeJdkClasses.getAbsolutePath());
}
示例3
public static void commonSetUp(File workingDir) throws Exception {
File testuserdir = new File(workingDir.getParentFile(), "testuser");
System.getProperties().setProperty("netbeans.user", testuserdir.getAbsolutePath());
//SaasServicesModel.getInstance().reset();
FileObject websvcHome = SaasServicesModel.getWebServiceHome();
File userconfig = FileUtil.toFile(websvcHome.getParent());
MainFS fs = new MainFS();
fs.setConfigRootDir(userconfig);
TestRepository.defaultFileSystem = fs;
MockServices.setServices(InstalledFileLocatorImpl.class, TestRepository.class);
InstalledFileLocatorImpl locator = (InstalledFileLocatorImpl)Lookup.getDefault().lookup(InstalledFileLocator.class);
locator.setUserConfigRoot(userconfig);
//File targetBuildProperties = new File(testuserdir, "build.properties");
//generatePropertiesFile(targetBuildProperties);
}
示例4
public static void commonSetUp(File workingDir) throws Exception {
File testuserdir = new File(workingDir.getParentFile(), "testuser");
System.getProperties().setProperty("netbeans.user", testuserdir.getAbsolutePath());
SaasServicesModelTest.resetSaasServicesModel();
FileObject websvcHome = SaasServicesModel.getWebServiceHome();
File userconfig = FileUtil.toFile(websvcHome.getParent());
MainFS fs = new MainFS();
fs.setConfigRootDir(userconfig);
TestRepository.defaultFileSystem = fs;
MockServices.setServices(DialogDisplayerNotifier.class, InstalledFileLocatorImpl.class, TestRepository.class);
InstalledFileLocatorImpl locator = (InstalledFileLocatorImpl)Lookup.getDefault().lookup(InstalledFileLocator.class);
locator.setUserConfigRoot(userconfig);
File targetBuildProperties = new File(testuserdir, "build.properties");
generatePropertiesFile(targetBuildProperties);
}
示例5
/**
* Find a path such that InstalledFileLocator.getDefault().locate(path, null, false)
* yields the given file. Only guaranteed to work in case the logical path is a suffix of
* the file's absolute path (after converting path separators); otherwise there is no
* general way to invert locate(...) so this heuristic may fail. However for the IFL
* implementation used in a plain NB installation (i.e.
* org.netbeans.core.modules.InstalledFileLocatorImpl), this condition will in fact hold.
* @return the inverse of locate(...), or null if there is no such path
* @see "#34069"
*/
private static String findLogicalPath(File f, String codeNameBase) {
InstalledFileLocator l = InstalledFileLocator.getDefault();
String path = f.getName();
File parent = f.getParentFile();
while (parent != null) {
File probe = l.locate(path, codeNameBase, false);
//System.err.println("Util.fLP: f=" + f + " parent=" + parent + " probe=" + probe + " f.equals(probe)=" + f.equals(probe));
if (f.equals(probe)) {
return path;
}
path = parent.getName() + '/' + path;
parent = parent.getParentFile();
}
return null;
}
示例6
@Override
public void startServer(File jsTestDriverJar, int port, boolean strictMode, ServerListener listener) {
if (wasStartedExternally(port)) {
externallyStarted = true;
IOProvider.getDefault().getIO("js-test-driver Server", false).getOut().
println("Port "+port+" is busy. Server was started outside of the IDE.");
return;
}
ExecutionDescriptor descriptor = new ExecutionDescriptor().
controllable(false).
// outLineBased(true).
// errLineBased(true).
outProcessorFactory(new ServerInputProcessorFactory(listener)).
frontWindowOnError(true);
File extjar = InstalledFileLocator.getDefault().locate("modules/ext/libs.jstestdriver-ext.jar", "org.netbeans.libs.jstestdriver", false); // NOI18N
ExternalProcessBuilder processBuilder = new ExternalProcessBuilder(getJavaBinary()).
addArgument("-cp").
addArgument(jsTestDriverJar.getAbsolutePath()+File.pathSeparatorChar+extjar.getAbsolutePath()).
addArgument("org.netbeans.libs.jstestdriver.ext.StartServer").
addArgument(""+port).
addArgument(""+strictMode);
ExecutionService service = ExecutionService.newService(processBuilder, descriptor, "js-test-driver Server");
task = service.run();
running = true;
}
示例7
public static JsObject getGlobalObject(ModelElementFactory modelElementFactory) {
if (skipInTest) {
return null;
}
if (globalObject == null) {
File apiFile = InstalledFileLocator.getDefault().locate(JQueryCodeCompletion.HELP_LOCATION, "org.netbeans.modules.javascript2.jquery", false); //NoI18N
if (apiFile != null) {
globalObject = modelElementFactory.newGlobalObject(
FileUtil.toFileObject(apiFile), (int) apiFile.length());
JsFunction function = new JQFunction(modelElementFactory.newFunction(
(DeclarationScope) globalObject, globalObject, JQueryUtils.JQUERY, Collections.<String>emptyList())); // NOI18N
jQuery = modelElementFactory.putGlobalProperty(globalObject, function);
rjQuery = modelElementFactory.newReference(JQueryUtils.JQUERY$, jQuery, false); // NOI18N
SelectorsLoader.addToModel(apiFile, modelElementFactory, jQuery);
globalObject.addProperty(rjQuery.getName(), rjQuery);
}
}
return globalObject;
}
示例8
@Override
protected String getCurrentPluginVersion(){
File extensionFile = InstalledFileLocator.getDefault().locate(
EXTENSION_PATH,PLUGIN_MODULE_NAME, false);
if (extensionFile == null) {
Logger.getLogger(ChromeExtensionManager.class.getCanonicalName()).
info("Could not find chrome extension in installation directory!"); // NOI18N
return null;
}
String content = Utils.readZip( extensionFile, "manifest.json"); // NOI18N
int index = content.indexOf(VERSION);
if ( index == -1){
return null;
}
index = content.indexOf(',',index);
return getValue(content, 0, index , VERSION);
}
示例9
@Override
@Messages({"WARN_NoNode=node.js not found, TypeScript support disabled.",
"DESC_NoNode=Please specify node.js location in the Tools/Options, and restart the IDE."
})
public LanguageServerDescription startServer(Lookup lookup) {
String node = NodeJsSupport.getInstance().getNode(null);
if (node == null || node.isEmpty()) {
NotificationDisplayer.getDefault().notify(Bundle.WARN_NoNode(), ImageUtilities.loadImageIcon("org/netbeans/modules/typescript/editor/icon.png", true), Bundle.DESC_NoNode(), evt -> {
OptionsDisplayer.getDefault().open("Html5/NodeJs");
});
return null;
}
File server = InstalledFileLocator.getDefault().locate("typescript-lsp/node_modules/typescript-language-server/lib/cli.js", null, false);
try {
Process p = new ProcessBuilder(new String[] {node, server.getAbsolutePath(), "--stdio"}).directory(server.getParentFile().getParentFile()).redirectError(ProcessBuilder.Redirect.INHERIT).start();
return LanguageServerDescription.create(p.getInputStream(), p.getOutputStream(), p);
} catch (IOException ex) {
LOG.log(Level.FINE, null, ex);
return null;
}
}
示例10
static URL getZipURL() {
if (DOC_ZIP_URL == null) {
File file = InstalledFileLocator.getDefault().locate(DOC_ZIP_FILE_NAME, null, false);
if (file != null) {
try {
URL url = Utilities.toURI(file).toURL();
DOC_ZIP_URL = FileUtil.getArchiveRoot(url);
} catch (MalformedURLException ex) {
Logger.getLogger(JsfDocumentation.class.getName()).log(Level.SEVERE, null, ex);
}
} else {
Logger.getAnonymousLogger().warning(String.format("Cannot locate the %s documentation file.", DOC_ZIP_FILE_NAME)); //NOI18N
}
}
return DOC_ZIP_URL;
}
示例11
/**
* Bootstrapping method.
* @return ParserLoader or null if library can not be located
*/
public static synchronized ParserLoader getInstance() {
if (instance != null) return instance;
try {
InstalledFileLocator installedFileLocator = InstalledFileLocator.getDefault();
URL xer2url = installedFileLocator.locate(XERCES_ARCHIVE, CODENAME_BASE, false).toURL(); // NOI18N
if ( Util.THIS.isLoggable() ) Util.THIS.debug ("Isolated library URL=" + xer2url); // NOI18N
// The isolating classloader itself (not parent) must also see&load interface
// implementation class because all subsequent classes must be loaded by the
// isolating classloader (not its parent that does not see isolated jar)
URL module = installedFileLocator.locate(MODULE_ARCHIVE, CODENAME_BASE, false).toURL(); // NOI18N
if ( Util.THIS.isLoggable() ) Util.THIS.debug ("Isolated module URL=" + module); // NOI18N
instance = new ParserLoader(new URL[] {xer2url, module});
} catch (MalformedURLException ex) {
if ( Util.THIS.isLoggable() ) Util.THIS.debug (ex);
}
return instance;
}
示例12
private void processLine(String line) {
ContextLogSupport.LineInfo lineInfo = logSupport.analyzeLine(line);
if (lineInfo.isError()) {
if (lineInfo.isAccessible()) {
try {
errorWriter.println(line, logSupport.getLink(lineInfo.message(), lineInfo.path(), lineInfo.line()));
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
} else {
errorWriter.println(line);
}
} else {
if (line.contains("java.lang.LinkageError: JAXB 2.0 API")) { // NOI18N
File jaxwsApi = InstalledFileLocator.getDefault().locate("modules/ext/jaxws21/api/jaxws-api.jar", null, false); // NOI18N
File jaxbApi = InstalledFileLocator.getDefault().locate("modules/ext/jaxb/api/jaxb-api.jar", null, false); // NOI18N
File endoresedDir = tomcatManager.getTomcatProperties().getJavaEndorsedDir();
if (jaxwsApi != null && jaxbApi != null) {
writer.println(NbBundle.getMessage(LogViewer.class, "MSG_WSSERVLET11", jaxwsApi.getParent(), jaxbApi.getParent(), endoresedDir));
} else {
writer.println(NbBundle.getMessage(LogViewer.class, "MSG_WSSERVLET11_NOJAR", endoresedDir));
}
}
writer.println(line);
}
}
示例13
public static synchronized URL getHelpZIPURL() {
if (HELP_ZIP_URL == null) {
File f = InstalledFileLocator.getDefault().locate(HELP_LOCATION, null, false); //NoI18N
if (f != null) {
try {
URL urll = f.toURI().toURL(); //toURI should escape the illegal characters like spaces
HELP_ZIP_URL = FileUtil.getArchiveRoot(urll);
} catch (java.net.MalformedURLException e) {
ErrorManager.getDefault().notify(e);
}
} else {
Logger.getLogger(CssHelpResolver.class.getSimpleName())
.info("Cannot locate the css documentation file " + HELP_LOCATION ); //NOI18N
}
}
return HELP_ZIP_URL;
}
示例14
public List/*<URL>*/ getJavadocs() {
String path = ip.getProperty(PROP_JAVADOCS);
if (path == null) {
ArrayList list = new ArrayList();
// tomcat docs
File jspApiDoc = new File(homeDir, "webapps/tomcat-docs/jspapi"); // NOI18N
File servletApiDoc = new File(homeDir, "webapps/tomcat-docs/servletapi"); // NOI18N
if (jspApiDoc.exists() && servletApiDoc.exists()) {
addFileToList(list, jspApiDoc);
addFileToList(list, servletApiDoc);
} else {
File j2eeDoc = InstalledFileLocator.getDefault().locate("docs/javaee-doc-api.jar", null, false); // NOI18N
if (j2eeDoc != null) {
addFileToList(list, j2eeDoc);
}
}
// jwsdp docs
File docs = new File(homeDir, "docs/api"); // NOI18N
if (docs.exists()) {
addFileToList(list, docs);
}
return list;
}
return CustomizerSupport.tokenizePath(path);
}
示例15
private static ClassPath extendClassPathWithJaxRsApisIfNecessary(ClassPath classPath) {
if (classPath.findResource("javax/ws/rs/core/Application.class") != null) {
return classPath;
}
File jerseyRoot = InstalledFileLocator.getDefault().locate(JERSEY_API_LOCATION, "org.netbeans.modules.websvc.restlib", false);
if (jerseyRoot != null && jerseyRoot.isDirectory()) {
File[] jsr311Jars = jerseyRoot.listFiles(new MiscPrivateUtilities.JerseyFilter(JSR311_JAR_PATTERN));
if (jsr311Jars != null && jsr311Jars.length>0) {
FileObject fo = FileUtil.toFileObject(jsr311Jars[0]);
if (fo != null) {
fo = FileUtil.getArchiveRoot(fo);
if (fo != null) {
return ClassPathSupport.createProxyClassPath(classPath,
ClassPathSupport.createClassPath(fo));
}
}
}
}
return classPath;
}
示例16
protected void addJerseySpringJar() throws IOException {
FileObject srcRoot = MiscUtilities.findSourceRoot(getProject());
if (srcRoot != null) {
ClassPath cp = ClassPath.getClassPath(srcRoot, ClassPath.COMPILE);
if (cp ==null ||cp.findResource(
"com/sun/jersey/api/spring/Autowire.class") == null) //NOI18N
{
File jerseyRoot = InstalledFileLocator.getDefault().locate(JERSEY_API_LOCATION, null, false);
if (jerseyRoot != null && jerseyRoot.isDirectory()) {
File[] jerseyJars = jerseyRoot.listFiles(new MiscPrivateUtilities.JerseyFilter(JERSEY_SPRING_JAR_PATTERN));
if (jerseyJars != null && jerseyJars.length>0) {
URL url = FileUtil.getArchiveRoot(jerseyJars[0].toURI().toURL());
ProjectClassPathModifier.addRoots(new URL[] {url}, srcRoot, ClassPath.COMPILE);
}
}
}
}
}
示例17
/**
* Get list of folders, where asignatures file for PHP runtime are.
* These files are also preindexed.
* @return list of folders
*/
public static synchronized List<FileObject> getPreindexedFolders() {
if (phpStubsFolder == null) {
// Core classes: Stubs generated for the "builtin" php runtime and extenstions.
File clusterFile = InstalledFileLocator.getDefault().locate("docs/phpsigfiles.zip", "org.netbeans.modules.php.project", true); //NOI18N
if (clusterFile != null) {
FileObject root = FileUtil.getArchiveRoot(FileUtil.toFileObject(clusterFile));
phpStubsFolder = root.getFileObject("phpstubs/phpruntime"); //NOI18N
}
}
if (phpStubsFolder == null) {
// during tests
return Collections.emptyList();
}
return Collections.singletonList(phpStubsFolder);
}
示例18
@Override
protected File getLocalFile(final HostInfo hostInfo) throws MissingResourceException {
String osname = hostInfo.getOS().getFamily().cname();
String platform = hostInfo.getCpuFamily().name().toLowerCase();
String bitness = hostInfo.getOS().getBitness() == HostInfo.Bitness._64 ? "_64" : ""; // NOI18N
// This method is called while HostInfo initialization so we cannot
// use MacroExpander here (the same is for parent methods)
InstalledFileLocator fl = InstalledFileLocatorProvider.getDefault();
StringBuilder path = new StringBuilder("bin/nativeexecution/"); // NOI18N
path.append(osname).append('-').append(platform).append(bitness).append("/pty"); // NOI18N
File file = fl.locate(path.toString(), codeNameBase, false);
if (file == null || !file.exists()) {
throw new MissingResourceException(path.toString(), null, null);
}
return file;
}
示例19
public File[] getToolClasspathEntries(String toolName) {
if (J2eePlatform.TOOL_WSIMPORT.equals(toolName)) {
return getJaxWsLibraries();
}
if (J2eePlatform.TOOL_WSGEN.equals(toolName)) {
return getJaxWsLibraries();
}
if (J2eePlatform.TOOL_WSCOMPILE.equals(toolName)) {
File root = InstalledFileLocator.getDefault().locate("modules/ext/jaxrpc16", null, false); // NOI18N
return new File[] {
new File(root, "saaj-api.jar"), // NOI18N
new File(root, "saaj-impl.jar"), // NOI18N
new File(root, "jaxrpc-api.jar"), // NOI18N
new File(root, "jaxrpc-impl.jar"), // NOI18N
};
}
if (J2eePlatform.TOOL_APP_CLIENT_RUNTIME.equals(toolName)) {
return new File(properties.getRootDir(), "client").listFiles(new FF()); // NOI18N
}
return null;
}
示例20
public static void removeDictionary(Locale remove) {
File toRemove = dictionaryFile(remove.toString(), false);
toRemove.delete();
toRemove = dictionaryFile(remove.toString(), true);
toRemove.delete();
if (InstalledFileLocator.getDefault().locate("modules/dict/dictionary_" + remove.toString() + ".description", null, false) != null) {
String filename = userdir;
filename += File.separator + "modules" + File.separator + "dict"; // NOI18N
filename += File.separator + "dictionary";
filename += "_" + remove.toString();
File hiddenDictionaryFile = new File(filename + ".description_hidden");
hiddenDictionaryFile.getParentFile().mkdirs();
try {
new FileOutputStream(hiddenDictionaryFile).close(); // NOI18N
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
}
}
示例21
private static FileObject getSampleFile(String sampleName)
throws DatabaseException {
try {
File jarfile = InstalledFileLocator.getDefault().locate(
MODULE_JAR_FILE, null, false); // NOI18N
JarFileSystem jarfs = new JarFileSystem();
jarfs.setJarFile(jarfile);
String filename = "/create-" + sampleName + ".sql";
return jarfs.findResource(RESOURCE_DIR_PATH + filename);
} catch (Exception e) {
DatabaseException dbe = new DatabaseException(
Utils.getMessage(
"MSG_ErrorLoadingSampleSQL", sampleName,
e.getMessage()));
dbe.initCause(e);
throw dbe;
}
}
示例22
private String getSDKProperties(String javaPath, String javacPath, String path) throws IOException {
try {
String probeDir = Places.getCacheSubdirectory("j2seplatform/probe").getAbsolutePath();
File probeSrc = InstalledFileLocator.getDefault().locate("scripts/J2SEPlatformProbe.java", "org.netbeans.modules.java.j2seplatform", false);
Process compile = new ProcessBuilder(javacPath,
"-d",
probeDir,
probeSrc.getAbsolutePath())
.inheritIO()
.start();
compile.waitFor();
int compileExitValue = compile.exitValue();
if (compileExitValue != 0) {
throw new IOException(String.format("javac process exit code: %d", compileExitValue)); //NOI18N
}
Process probe = new ProcessBuilder(javaPath,
"-cp",
probeDir,
"J2SEPlatformProbe",
path)
.inheritIO()
.start();
// PENDING -- this may be better done by using ExecEngine, since
// it produces a cancellable task.
probe.waitFor();
int probeExitValue = probe.exitValue();
if (probeExitValue != 0) {
throw new IOException(String.format("Java process exit code: %d", probeExitValue)); //NOI18N
}
return probeDir;
} catch (InterruptedException ex) {
IOException e = new IOException(ex);
throw e;
}
}
示例23
private static String computeJavacVersion() {
if (NoJavacHelper.hasNbJavac()) {
File nbJavac = InstalledFileLocator.getDefault().locate("modules/ext/nb-javac-impl.jar", "org.netbeans.modules.nbjavac.impl", false);
if (nbJavac != null) {
return String.valueOf(nbJavac.lastModified());
}
return "-1";
} else {
return System.getProperty("java.vm.version", "unknown");
}
}
示例24
private static List<URL> getJaxbApiJars() throws IOException {
List<URL> urls = new ArrayList<URL>();
File apiJar = InstalledFileLocator.getDefault().locate("modules/ext/jaxb/api/jaxb-api.jar", null, false); // NOI18N
if (apiJar != null) {
URL url = apiJar.toURI().toURL();
if (FileUtil.isArchiveFile(url)) {
urls.add(FileUtil.getArchiveRoot(url));
}
}
return urls;
}
示例25
private String createClasspathString(String dummy) {
File remoteProbeJar = InstalledFileLocator.getDefault().locate(
"modules/ext/nb-custom-jshell-probe.jar", "org.netbeans.libs.jshell", false);
File replJar = InstalledFileLocator.getDefault().locate("modules/ext/nb-jshell.jar", "org.netbeans.libs.jshell", false);
File toolsJar = null;
for (FileObject jdkInstallDir : getPlatform().getInstallFolders()) {
FileObject toolsJarFO = jdkInstallDir.getFileObject("lib/tools.jar");
if (toolsJarFO == null) {
toolsJarFO = jdkInstallDir.getFileObject("../lib/tools.jar");
}
if (toolsJarFO != null) {
toolsJar = FileUtil.toFile(toolsJarFO);
}
}
ClassPath compilePath = getClasspathInfo().getClassPath(ClasspathInfo.PathKind.COMPILE);
FileObject[] roots = compilePath.getRoots();
File[] urlFiles = new File[roots.length];
int index = 0;
for (FileObject fo : roots) {
File f = FileUtil.toFile(fo);
if (f != null) {
urlFiles[index++] = f;
}
}
String cp = addClassPath(
toolsJar != null ? toClassPath(remoteProbeJar, toolsJar) :
toClassPath(remoteProbeJar),
urlFiles) + System.getProperty("path.separator") + " "; // NOI18N avoid REPL bug
return "-classpath " + cp; // NOI18N
}
示例26
public void testInstalledFileLocator() throws Exception {
File antHome = InstalledFileLocator.getDefault().locate("ant", null, false);
assertNotNull("found antHome", antHome);
assertTrue(antHome + " is a directory", antHome.isDirectory());
assertTrue("contains ant.jar", new File(new File(antHome, "lib"), "ant.jar").isFile());
File antBridge = InstalledFileLocator.getDefault().locate("ant/nblib/bridge.jar", null, false);
assertNotNull("found antBridge", antBridge);
assertTrue("is a file", antBridge.isFile());
}
示例27
private static ClassLoader createBridgeClassLoader(ClassLoader main) throws Exception {
File bridgeJar = InstalledFileLocator.getDefault().locate("ant/nblib/bridge.jar", "org.apache.tools.ant.module", false); // NOI18N
if (bridgeJar == null) {
// Run-in-classpath mode.
return main;
}
return createAuxClassLoader(bridgeJar, main, AntBridge.class.getClassLoader());
}
示例28
/**
* Get the JaCoCo-Agent JAR file that is registered in the IDE.
*
* @return the JaCoCo-Agent JAR.
*/
public static File getJacocoAgentJar() {
if (Config.isUseCustomJacocoJar()) {
File jacocoagent = new File(Config.getCustomJacocoJarPath());
if (jacocoagent.exists()) {
return jacocoagent;
}
}
return InstalledFileLocator.getDefault().locate("modules/ext/jacocoagent.jar", "fr.tikione.jacoco.lib", false);
}
示例29
@Override
protected void setUp() throws Exception {
AntBridge.NO_MODULE_SYSTEM = true;
MockServices.setServices(IFL.class);
ii = IntrospectedInfo.getDefaults();
InstalledFileLocator ilf = Lookup.getDefault().lookup(InstalledFileLocator.class);
assertNotNull("Locator found", ilf);
assertEquals("right class: " + ilf, IFL.class, ilf.getClass());
}
示例30
private static void generatePropertiesFile(File target) throws IOException {
String separator = System.getProperty("path.separator");
File apiBase = InstalledFileLocator.getDefault().locate(ENDORSED_REF, null, true).getParentFile();
File jaxWsBase = apiBase.getParentFile();
FileFilter jarFilter = new FileFilter() {
public boolean accept(File pathname) {
return pathname.isFile() && pathname.getName().endsWith(".jar");
}
};
File[] apiJars = apiBase.listFiles(jarFilter);
File[] implJars = jaxWsBase.listFiles(jarFilter);
Properties result = new Properties();
StringBuffer classpath = new StringBuffer();
for (int i = 0; i < apiJars.length; i++) {
String pathElement = apiJars[i].getAbsolutePath() + separator;
classpath.append(pathElement);
}
for (int i = 0; i < implJars.length; i++) {
classpath.append(implJars[i].getAbsolutePath());
if (i != implJars.length - 1) {
classpath.append(separator);
}
}
result.setProperty(JAXWS_LIB_PROPERTY, classpath.toString());
FileOutputStream fos = new FileOutputStream(target);
result.store(fos, "build.properties file");
}