Search in sources :

Example 91 with VirtualFile

use of org.jboss.vfs.VirtualFile in project wildfly by wildfly.

the class Utils method isSymlink.

public static boolean isSymlink(VirtualFile vFile) throws IOException {
    File file = vFile.getPhysicalFile();
    if (Utils.isWindows()) {
        return false;
    }
    File fileInCanonicalDir = null;
    if (file.getParent() == null) {
        fileInCanonicalDir = file;
    } else {
        File canonicalDir = file.getParentFile().getCanonicalFile();
        fileInCanonicalDir = new File(canonicalDir, file.getName());
    }
    if (fileInCanonicalDir.getCanonicalFile().equals(fileInCanonicalDir.getAbsoluteFile())) {
        return false;
    } else {
        return true;
    }
}
Also used : JarFile(java.util.jar.JarFile) VirtualFile(org.jboss.vfs.VirtualFile) File(java.io.File)

Example 92 with VirtualFile

use of org.jboss.vfs.VirtualFile in project wildfly by wildfly.

the class ScannerTest method testInputStreamZippedJar.

@Test
public void testInputStreamZippedJar() throws Exception {
    File defaultPar = buildDefaultPar();
    addPackageToClasspath(defaultPar);
    final VirtualFile virtualFile = VFS.getChild(defaultPar.getAbsolutePath());
    Closeable closeable = VFS.mountZip(virtualFile, virtualFile, tempFileProvider);
    try {
        ArchiveDescriptor archiveDescriptor = VirtualFileSystemArchiveDescriptorFactory.INSTANCE.buildArchiveDescriptor(defaultPar.toURI().toURL());
        AbstractScannerImpl.ResultCollector resultCollector = new AbstractScannerImpl.ResultCollector(new StandardScanOptions());
        archiveDescriptor.visitArchive(new AbstractScannerImpl.ArchiveContextImpl(new PersistenceUnitDescriptorAdapter(), true, resultCollector));
        validateResults(resultCollector, ApplicationServer.class, Version.class);
    } finally {
        closeable.close();
    }
}
Also used : VirtualFile(org.jboss.vfs.VirtualFile) AbstractScannerImpl(org.hibernate.jpa.boot.scan.spi.AbstractScannerImpl) Closeable(java.io.Closeable) ArchiveDescriptor(org.hibernate.jpa.boot.archive.spi.ArchiveDescriptor) VirtualFile(org.jboss.vfs.VirtualFile) File(java.io.File) StandardScanOptions(org.hibernate.jpa.boot.scan.internal.StandardScanOptions) Test(org.junit.Test)

Example 93 with VirtualFile

use of org.jboss.vfs.VirtualFile in project wildfly by wildfly.

the class ScannerTest method testJarProtocol.

@Test
public void testJarProtocol() throws Exception {
    File war = buildWar();
    addPackageToClasspath(war);
    final VirtualFile warVirtualFile = VFS.getChild(war.getAbsolutePath());
    Closeable closeable = VFS.mountZip(warVirtualFile, warVirtualFile, tempFileProvider);
    try {
        ArchiveDescriptor archiveDescriptor = VirtualFileSystemArchiveDescriptorFactory.INSTANCE.buildArchiveDescriptor(warVirtualFile.toURL());
        AbstractScannerImpl.ResultCollector resultCollector = new AbstractScannerImpl.ResultCollector(new StandardScanOptions());
        archiveDescriptor.visitArchive(new AbstractScannerImpl.ArchiveContextImpl(new PersistenceUnitDescriptorAdapter(), true, resultCollector));
        validateResults(resultCollector, org.hibernate.jpa.test.pack.war.ApplicationServer.class, org.hibernate.jpa.test.pack.war.Version.class);
    } finally {
        closeable.close();
    }
}
Also used : VirtualFile(org.jboss.vfs.VirtualFile) AbstractScannerImpl(org.hibernate.jpa.boot.scan.spi.AbstractScannerImpl) Closeable(java.io.Closeable) ArchiveDescriptor(org.hibernate.jpa.boot.archive.spi.ArchiveDescriptor) VirtualFile(org.jboss.vfs.VirtualFile) File(java.io.File) StandardScanOptions(org.hibernate.jpa.boot.scan.internal.StandardScanOptions) Test(org.junit.Test)

Aggregations

VirtualFile (org.jboss.vfs.VirtualFile)93 ResourceRoot (org.jboss.as.server.deployment.module.ResourceRoot)36 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)29 InputStream (java.io.InputStream)28 IOException (java.io.IOException)23 DeploymentUnitProcessingException (org.jboss.as.server.deployment.DeploymentUnitProcessingException)22 Test (org.junit.Test)18 File (java.io.File)16 Closeable (java.io.Closeable)12 URI (java.net.URI)10 HashSet (java.util.HashSet)10 XMLStreamReader (javax.xml.stream.XMLStreamReader)10 Index (org.jboss.jandex.Index)10 SuffixMatchFilter (org.jboss.vfs.util.SuffixMatchFilter)10 ArrayList (java.util.ArrayList)9 XMLStreamException (javax.xml.stream.XMLStreamException)9 WarMetaData (org.jboss.as.web.common.WarMetaData)9 Indexer (org.jboss.jandex.Indexer)8 AnnotationRepository (org.jboss.jca.common.spi.annotations.repository.AnnotationRepository)8 XMLInputFactory (javax.xml.stream.XMLInputFactory)7