@Override
 protected void setUp() throws Exception {
   super.setUp();
   testdir = new File("build/TestDirPluginScanner");
   FileUtils.deleteDir(testdir);
   testdir.mkdirs();
 }
Exemplo n.º 2
0
 /** Remove any cache dir for the file */
 private synchronized boolean removeScriptPluginCache() {
   final File fileExpandedDir = getFileCacheDir();
   if (null != fileExpandedDir && fileExpandedDir.exists()) {
     debug("removeScriptPluginCache: " + fileExpandedDir);
     return FileUtils.deleteDir(fileExpandedDir);
   }
   return true;
 }
Exemplo n.º 3
0
  JarPluginScanner(
      final File extdir,
      final File cachedir,
      final FileCache<ProviderLoader> filecache,
      final int rescanInterval) {
    super(extdir, filecache, rescanInterval);
    this.cachedir = cachedir;
    this.pluginJarCacheDirectory =
        new File(Constants.getBaseTempDirectory() + Constants.FILE_SEP + JAR_SCRATCH_DIRECTORY);

    // Clean up old caches on startup.
    log.info(String.format("Deleting plugin jar cache at %s", pluginJarCacheDirectory));
    if (pluginJarCacheDirectory.exists() && !FileUtils.deleteDir(pluginJarCacheDirectory)) {
      log.warn("Could not delete plugin jar cache");
    }
    log.info(String.format("Deleting plugin lib dependency directory at %s", this.cachedir));
    if (this.cachedir.exists() && !FileUtils.deleteDir(this.cachedir)) {
      log.warn("Could not delete plugin lib dependency directory");
    }

    // Create the directories
    this.cachedir.mkdirs();
    this.pluginJarCacheDirectory.mkdirs();
  }
Exemplo n.º 4
0
 /** Expire the loader cache item */
 public void expire() {
   debug("expire jar provider loader for: " + pluginJar);
   removeScriptPluginCache();
   classCache.clear();
   this.cachedJar = null;
   // close loaders
   for (File file : classLoaders.keySet()) {
     try {
       debug("expire classLoaders for: " + file);
       classLoaders.remove(file).close();
     } catch (IOException e) {
       e.printStackTrace();
     }
   }
   // remove cache files
   for (File file : cachedFiles) {
     debug("remove cache dir: " + file);
     FileUtils.deleteDir(file);
   }
 }
Exemplo n.º 5
0
 public void tearDown() throws Exception {
   super.tearDown();
   File projectdir = new File(getFrameworkProjectsBase(), PROJ_NAME);
   FileUtils.deleteDir(projectdir);
 }
  protected void tearDown() throws Exception {
    super.tearDown();

    File projectdir = new File(getFrameworkProjectsBase(), TEST_PROJECT);
    FileUtils.deleteDir(projectdir);
  }
 @Override
 protected void tearDown() throws Exception {
   super.tearDown();
   FileUtils.deleteDir(testdir);
 }