Package org.jboss.virtual

Examples of org.jboss.virtual.VFS


         }
         cache.setPermanentRoots(Collections.<URL, ExceptionHandler>singletonMap(rootURL, null));
         cache.start();

         // setup VFS
         VFS vfs = VFS.getVFS(rootURL);
         VFSUtils.enableCopy(vfs);
         TrackingTempStore store = new TrackingTempStore(new MockTempStore(new Random().nextLong()));
         vfs.setTempStore(store);

         try
         {
            URL directRootURL = new URL("file://" + rootText);
            VirtualFile root = VFS.getRoot(directRootURL);
View Full Code Here


   }

   public void testOptionsPropagation() throws Exception
   {
      URL url = getResource("/vfs/test");
      VFS vfs = VFS.getVFS(url);
      VFSUtils.enableNoReaper(vfs);
      VirtualFile root = vfs.getRoot();
      assertOption(root, "nested", VFSUtils.NO_REAPER_QUERY);
      assertOption(root, "nested/nested.jar", VFSUtils.NO_REAPER_QUERY);
      assertOption(root, "nested/nested.jar/META-INF", VFSUtils.NO_REAPER_QUERY);
      assertOption(root, "nested/nested.jar/META-INF/empty.txt", VFSUtils.NO_REAPER_QUERY);
      assertOption(root, "nested/nested.jar/complex.jar", VFSUtils.NO_REAPER_QUERY);
View Full Code Here

  
   public void testArchive2() throws Exception
   {
      URL url = getResource("/vfs/sundry/jar/archive.jar");
      url = JarUtils.createJarURL(url);
      VFS vfs = VFS.getVFS(url);
      VirtualFile file = vfs.getRoot();
      log.debug(file.getName() + " " + file);
      assertFalse("Should not be a leaf", file.isLeaf());
      file = file.findChild("empty");
      log.debug(file.getName() + " " + file);
   }
View Full Code Here

   private void writeObject(ObjectOutputStream out) throws IOException, URISyntaxException
   {
      URL url = rootUrl;
      if (url == null)
      {
         VFS vfs = getFile().getVFS();
         url = vfs.getRoot().toURL();
      }
      String pathName = path;
      if (pathName == null)
         pathName = getFile().getPathName();
View Full Code Here

   public void testPathWithPluses() throws Exception
   {
      URL rootURL = getResource("/vfs/test/path+with+plusses/jar1.jar");
      VFSContext context = getVFSContext(rootURL);
      VFS vfs = context.getVFS();
      VirtualFile jar = vfs.getRoot();
      assertNotNull("jar != null", jar);
      assertNotNull(jar.getChild(JarFile.MANIFEST_NAME));
   }
View Full Code Here

   public void testGetVFS() throws Exception
   {
      VFSContext context = getVFSContext("simple");
      URI rootURI = context.getRootURI();
      VFS vfs = context.getVFS();
      VirtualFile rootFile = vfs.getRoot();

      URI uri = new URI("vfs" + rootURI);
      URI rfUri = rootFile.toURI();
      assertEquals(uri.getPath(), rfUri.getPath());
   }
View Full Code Here

            throw new FileNotFoundException("Profile contains no deploy dir: "+applicationDir);
      }

      for (File applicationDir : applicationDirs)
      {
         VFS deployVFS = VFS.getVFS(applicationDir.toURI());
         loadApplications(deployVFS.getRoot());
      }
      this.lastModified = System.currentTimeMillis();
   }
View Full Code Here

      File tmpRoot = File.createTempFile("vfs", ".root");
      tmpRoot.delete();
      tmpRoot.mkdir();

      File tmp = File.createTempFile("testFileContextZipDelete", ".jar", tmpRoot);
      VFS vfs = VFS.getVFS(tmpRoot.toURI().toURL());

      Manifest mf = new Manifest();
      mf.getMainAttributes().putValue("Created-By", getClass().getName() + "." + "testEntryModified");
      FileOutputStream fos = new FileOutputStream(tmp);
      JarOutputStream jos = new JarOutputStream(fos, mf);
      try
      {
         jos.setComment("testJarURLs");
         jos.setLevel(0);
         jos.flush();
      }
      finally
      {
         jos.close();
      }

      // children() exist
      List<VirtualFile> children = vfs.getChildren();
      assertTrue(tmpRoot + ".getChildren().size() == 1", children.size() == 1);

      // specific child exists()
      VirtualFile tmpVF = vfs.getChild(tmp.getName());
      assertTrue(tmp + ".exists()", tmpVF.exists());


      // test jar entry
      // specific zip entry exists(), delete() not, exists()
      VirtualFile entryVF = tmpVF.getChild("META-INF");
      assertTrue(entryVF.getName() + " .exists()", entryVF.exists());
      assertFalse(entryVF.getName() + " .delete() == false", entryVF.delete());
      assertTrue(entryVF.getName() + " .exists()", entryVF.exists());

      // children() exist
      children = tmpVF.getChildren();
      assertTrue(tmpVF + ".getChildren().size() == 1", children.size() == 1);

      // getChild() returns not-null
      entryVF = tmpVF.getChild("META-INF");
      assertNotNull(tmpVF + ".getChild('META-INF') != null", entryVF);


      // continue with jar
      // specific child delete(), exists() not
      assertTrue(tmp + ".delete()", tmpVF.delete());
      assertFalse(tmp + ".exists() == false", tmpVF.exists());

      // children() don't exist
      children = vfs.getChildren();
      assertTrue(tmpRoot + ".getChildren().size() == 0", children.size() == 0);

      // getChild() returns null
      tmpVF = vfs.getChild(tmp.getName());
      assertNull(tmpRoot + ".getChild('" + tmp.getName() + "') == null", tmpVF);

      // directory delete()
      assertTrue(tmpRoot + ".delete()", vfs.getRoot().delete());
   }
View Full Code Here

      finally
      {
         jos.close();
      }

      VFS vfs = VFS.getVFS(tmp.toURI().toURL());

      // children() exist
      List<VirtualFile> children = vfs.getChildren();
      assertTrue(tmp + ".getChildren().size() == 1", children.size() == 1);

      // specific child exists(), delete() not, exists()
      VirtualFile tmpVF = vfs.getChild("META-INF");
      assertTrue(tmp + ".exists()", tmpVF.exists());
      assertFalse(tmp + ".delete() == false", tmpVF.delete());
      assertTrue(tmp + ".exists()", tmpVF.exists());

      // children() exist
      children = vfs.getChildren();
      assertTrue(tmp + ".getChildren().size() == 1", children.size() == 1);

      // getChild() returns not-null
      tmpVF = vfs.getChild("META-INF");
      assertNotNull(tmp + ".getChild('META-INF') != null", tmpVF);

      // archive delete(), exists() not
      assertTrue(tmp + ".delete()", vfs.getRoot().delete());
      assertFalse(tmp + ".exists() == false", vfs.getRoot().exists());
   }
View Full Code Here

   }

   public void testZipEntriesInit() throws Exception
   {
      URL url = getResource("/vfs/test");
      VFS vfs = VFS.getVFS(url);
      vfs.setExceptionHandler(new NamesExceptionHandler("_sqljdbc.jar"));
      VirtualFile root = vfs.getRoot();
      VirtualFile zipeinit = root.findChild("zipeinit.jar");
      VirtualFile child = zipeinit.findChild("sqljdbc.jar");
      List<VirtualFile> children = child.getChildren();
      assertTrue(children.isEmpty());
   }
View Full Code Here

TOP

Related Classes of org.jboss.virtual.VFS

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.