/** Look for the specified resource on the project classpath. */
 public URL findResource(String resourceName) {
   Classpath cp;
   synchronized (this.classpathEntries) {
     cp = new Classpath(this.classpathEntries);
   }
   return new URLClassLoader(cp.urls()).findResource(resourceName);
 }
 private MWRelationalProject buildProject() {
   MWRelationalProject result =
       new MWRelationalProject(
           this.getClass().getName(), MappingsModelTestTools.buildSPIManager(), null);
   Classpath cp = Classpath.javaClasspath();
   Classpath.Entry[] entries = cp.getEntries();
   for (int i = 0; i < entries.length; i++) {
     result.getRepository().addClasspathEntry(entries[i].fileName());
   }
   return result;
 }
  private static Set buildCoreClassNames() {
    Set result = new HashSet(10000);

    // void, boolean, int, float, etc.
    CollectionTools.addAll(result, MWClass.nonReferenceClassNames());

    List locations = buildCoreClassLocations();
    Classpath cp = new Classpath(locations);
    cp.addClassNamesTo(result);

    return result;
  }
 private static List<String> buildCoreClassLocations() {
   List<String> locations = new ArrayList<String>();
   for (int i = 0; i < CORE_KEYS.length; i++) {
     String classpath = Classpath.locationFor(CORE_KEYS[i]);
     if (!locations.contains(classpath)) {
       locations.add(classpath);
     }
   }
   return locations;
 }
  private void verifyJavaExport(MWRelationalProject project) throws Exception {
    this.configureDeploymentLogin(project);
    // write the project first, so it can be read via the command-line
    project.setSaveDirectory(this.tempDir);
    new ProjectIOManager().write(project);

    project.setProjectSourceDirectoryName(this.tempDir.getPath());
    project.setProjectSourceClassName(this.className(project));

    List classpathEntries = new ArrayList();
    classpathEntries.add(this.tempDir.getAbsolutePath());
    classpathEntries.add(Classpath.locationFor(MWProject.class)); // elmwcore.jar
    classpathEntries.add(Classpath.locationFor(JavaSourceGenerator.class)); // eclipselinkmw.jar
    classpathEntries.add(Classpath.locationFor(ValueHolderInterface.class)); // ecilpselink.jar
    classpathEntries.add(Classpath.locationFor(XMLParserConfiguration.class)); // xercesImpl.jar
    classpathEntries.add(
        FileTools.resourceFile("/platforms.dpr").getParentFile().getAbsolutePath()); // config dir
    Classpath classpath = new Classpath(classpathEntries);

    String input = project.saveFile().getAbsolutePath();
    String output = project.projectSourceFile().getAbsolutePath();
    //		String log = new File(this.tempDir, "JavaSourceGenerator.log").getAbsolutePath();
    String[] args = new String[] {input, output};

    JavaTools.java(JavaSourceGenerator.class.getName(), classpath.path(), args);
    //		JavaSourceGenerator.main(args);

    this.compileAndCheckJavaExport(project);
  }
 protected void setUp() throws Exception {
   super.setUp();
   this.application = new TestApplication();
   String classpathEntry = Classpath.locationFor(this.getClass());
   this.executingFromClassDir = !Classpath.fileNameIsArchive(classpathEntry);
 }
 private Iterator buildClassNames(String[] args) {
   if ((args == null) || (args.length == 0)) {
     return Classpath.bootClasspath().classNamesStream();
   }
   return new Classpath(new String[] {args[0]}).classNamesStream();
 }
 private Object[] buildCompleteList2() {
   String classpathEntry = Classpath.locationFor(this.getClass());
   return CollectionTools.sort(
       CollectionTools.array(this.buildTypes(new String[] {classpathEntry})));
 }