Search in sources :

Example 6 with ArchiveDescriptor

use of org.hibernate.jpa.boot.archive.spi.ArchiveDescriptor 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

ArchiveDescriptor (org.hibernate.jpa.boot.archive.spi.ArchiveDescriptor)6 StandardScanOptions (org.hibernate.jpa.boot.scan.internal.StandardScanOptions)6 AbstractScannerImpl (org.hibernate.jpa.boot.scan.spi.AbstractScannerImpl)6 Test (org.junit.Test)6 File (java.io.File)5 VirtualFile (org.jboss.vfs.VirtualFile)5 Closeable (java.io.Closeable)4 BufferedInputStream (java.io.BufferedInputStream)1 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 URL (java.net.URL)1 URLConnection (java.net.URLConnection)1 ClassDescriptorImpl (org.hibernate.jpa.boot.internal.ClassDescriptorImpl)1 MappingFileDescriptor (org.hibernate.jpa.boot.spi.MappingFileDescriptor)1 Carpet (org.hibernate.jpa.test.pack.explodedpar.Carpet)1