use of org.jboss.vfs.VirtualFile in project wildfly by wildfly.
the class JdrTestCase method testWildcardFilterAcceptAnything.
@Test
public void testWildcardFilterAcceptAnything() throws Exception {
VirtualFileFilter filter = Filters.wildcard("*");
VirtualFile good = VFS.getChild("/this/is/a/test.txt");
assertTrue(filter.accepts(good));
}
use of org.jboss.vfs.VirtualFile in project wildfly by wildfly.
the class JdrTestCase method testWildcardFilterMiddleGlob.
@Test
public void testWildcardFilterMiddleGlob() throws Exception {
VirtualFileFilter filter = Filters.wildcard("/this*test.txt");
VirtualFile good = VFS.getChild("/this/is/a/test.txt");
VirtualFile bad1 = VFS.getChild("/that/is/a/test.txt");
VirtualFile bad2 = VFS.getChild("/this/is/a/test.xml");
VirtualFile win = VFS.getChild("/C:/this/is/a/test.txt");
VirtualFile winbad = VFS.getChild("/C:/this/is/a/test.xml");
assertTrue(filter.accepts(good));
assertTrue(filter.accepts(win));
assertFalse(filter.accepts(bad1));
assertFalse(filter.accepts(bad2));
assertFalse(filter.accepts(winbad));
}
use of org.jboss.vfs.VirtualFile in project wildfly by wildfly.
the class HibernateAnnotationScanner method toNIS.
private Set<NamedInputStream> toNIS(Iterable<VirtualFile> files) {
Set<NamedInputStream> result = new HashSet<NamedInputStream>();
for (VirtualFile file : files) {
NamedInputStream nis = new HibernateVirtualFileNamedInputStream(file);
result.add(nis);
}
return result;
}
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;
}
}
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();
}
}
Aggregations