protected @Override void setUp() throws Exception {
    MockLookup.setLayersAndInstances(TestUtil.testProjectFactory());
    ProjectManager.getDefault().reset();
    FileOwnerQuery.reset();
    scratch = TestUtil.makeScratchDir(this);
    projdir = scratch.createFolder("my-project");
    projdir.createFolder("testproject");
    randomfile = scratch.createData("randomfile");
    projfile = projdir.createData("projfile");
    FileObject projsubdir = projdir.createFolder("projsubdir");
    projfile2 = projsubdir.createData("projfile2");
    subprojdir = projdir.createFolder("subproject");
    subprojdir.createFolder("testproject");
    subprojfile = subprojdir.createData("subprojfile");
    scratch.createFolder("external1").createFolder("subdir").createData("file");
    scratch.createFolder("external2").createFolder("subdir").createData("file");
    scratch.createFolder("external3").createFolder("subproject").createFolder("testproject");
    p = ProjectManager.getDefault().findProject(projdir);
    assertNotNull("found a project successfully", p);

    // make jar:file:/.../projdir/foo.jar!/zipfile/zippedfile
    FileObject foojar = TestFileUtils.writeZipFile(projdir, "foo.jar", "zipdir/zippedfile:");
    FileObject foojarRoot = FileUtil.getArchiveRoot(foojar);
    assertNotNull("have an archive in " + foojar, foojarRoot);
    zippedfile = foojarRoot.getFileObject("zipdir/zippedfile");
    assertNotNull("zippedfile found in it", zippedfile);

    hashedFile = TestFileUtils.writeZipFile(projdir, ".#webapp.jar.1.45", "zipdir/zippedfile:");
    foojarRoot = FileUtil.getArchiveRoot(hashedFile);
    assertNotNull("have an archive in " + hashedFile, foojarRoot);
    hashedFile = foojarRoot.getFileObject("zipdir/zippedfile");
  }
Esempio n. 2
0
  @Override
  protected void setUp() throws Exception {
    super.setUp();

    MockLookup.setLayersAndInstances();
    BugtrackingUtil.getBugtrackingConnectors(); // ensure conector

    System.setProperty("netbeans.user", getWorkDir().getAbsolutePath());
    cleanupStoredIssues();
  }
  @Override
  protected void setUp() throws Exception {
    super.setUp();

    MockLookup.init();
    Collection<? extends AntBasedProjectType> all =
        Lookups.forPath("Services/AntBasedProjectTypes").lookupAll(AntBasedProjectType.class);
    Iterator<? extends AntBasedProjectType> it = all.iterator();
    AntBasedProjectType t = it.next();
    MockLookup.setInstances(
        t,
        new org.netbeans.modules.java.project.ProjectSourceLevelQueryImpl(),
        new org.netbeans.modules.projectapi.SimpleFileOwnerQueryImplementation(),
        new TestPlatformProvider());
    Properties p = System.getProperties();
    if (p.getProperty("netbeans.user") == null) {
      p.put("netbeans.user", FileUtil.toFile(makeScratchDir(this)).getAbsolutePath());
    }
  }