@SuppressWarnings("ResultOfMethodCallIgnored") public void testSymlinkFileSet() throws Exception { final File zipFile = getTestFile("target/output/pasymlinks-fileset.zip"); final ZipArchiver zipArchiver = getZipArchiver(zipFile); final DefaultFileSet fs = new DefaultFileSet(); fs.setPrefix("bzz/"); fs.setDirectory(new File("src/test/resources/symlinks/src")); zipArchiver.addFileSet(fs); zipArchiver.createArchive(); final File output = getTestFile("target/output/unzipped/symlFs"); output.mkdirs(); final ZipUnArchiver zipUnArchiver = getZipUnArchiver(zipFile); zipUnArchiver.setDestFile(output); zipUnArchiver.extract(); File symDir = new File(output, "bzz/symDir"); PlexusIoResourceAttributes fa = Java7FileAttributes.uncached(symDir); assertTrue(fa.isSymbolicLink()); }
public void testSymlinkZip() throws Exception { final File zipFile = getTestFile("target/output/pasymlinks.zip"); final ZipArchiver zipArchiver = getZipArchiver(zipFile); PlexusIoFileResourceCollection files = new PlexusIoFileResourceCollection(); files.setFollowingSymLinks(false); files.setBaseDir(new File("src/test/resources/symlinks")); files.setPrefix("plexus/"); zipArchiver.addResources(files); zipArchiver.createArchive(); final File output = getTestFile("target/output/unzipped"); output.mkdirs(); final ZipUnArchiver zipUnArchiver = getZipUnArchiver(zipFile); zipUnArchiver.setDestFile(output); zipUnArchiver.extract(); File symDir = new File("target/output/unzipped/plexus/src/symDir"); PlexusIoResourceAttributes fa = Java7FileAttributes.uncached(symDir); assertTrue(fa.isSymbolicLink()); }