This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git
commit 2ee90579dd09f2bb20ae111b1be5a91518f899ac Author: Juan Cabrerizo <[email protected]> AuthorDate: Tue Nov 29 10:41:03 2022 +0000 tidy imports + add the new test to the `integration` group --- .../org/apache/brooklyn/util/core/file/ArchiveUtilsTest.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/core/src/test/java/org/apache/brooklyn/util/core/file/ArchiveUtilsTest.java b/core/src/test/java/org/apache/brooklyn/util/core/file/ArchiveUtilsTest.java index c87e0229d7..9582f9eaa0 100644 --- a/core/src/test/java/org/apache/brooklyn/util/core/file/ArchiveUtilsTest.java +++ b/core/src/test/java/org/apache/brooklyn/util/core/file/ArchiveUtilsTest.java @@ -24,15 +24,11 @@ import static org.testng.Assert.assertTrue; import java.io.File; import java.io.InputStream; -import java.io.Reader; import java.nio.file.StandardOpenOption; import java.util.Map; import java.util.zip.ZipFile; import com.google.common.io.ByteStreams; -import org.apache.brooklyn.util.stream.InputStreamSource; -import org.apache.brooklyn.util.stream.Streams; -import org.apache.commons.io.FileUtils; import org.testng.annotations.AfterClass; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeClass; @@ -41,8 +37,6 @@ import org.testng.annotations.Test; import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport; import org.apache.brooklyn.location.ssh.SshMachineLocation; import org.apache.brooklyn.util.core.ResourceUtils; -import org.apache.brooklyn.util.core.file.ArchiveBuilder; -import org.apache.brooklyn.util.core.file.ArchiveUtils; import org.apache.brooklyn.util.os.Os; import com.google.common.base.Joiner; @@ -118,7 +112,7 @@ public class ArchiveUtilsTest extends BrooklynAppUnitTestSupport { ArchiveUtils.deploy(origJar.getAbsolutePath(), machine, destDir.getAbsolutePath(), destFile); assertFilesEqual(new File(destDir, destFile), origJar); } - @Test(expectedExceptions = IllegalStateException.class) + @Test(groups="Integration", expectedExceptions = IllegalStateException.class) public void testUnzipFileAccessingPathOutsideTargetFolderEvilWinFormat() throws Exception{ InputStream evilZip = ResourceUtils.create(this).getResourceFromUrl("classpath://brooklyn/util/file.core/evilWin.zip"); File tempZipFile = File.createTempFile("test-zip",null); @@ -126,7 +120,7 @@ public class ArchiveUtilsTest extends BrooklynAppUnitTestSupport { java.nio.file.Files.write(tempZipFile.toPath(), ByteStreams.toByteArray(evilZip), StandardOpenOption.TRUNCATE_EXISTING); ArchiveUtils.extractZip(new ZipFile(tempZipFile),destDir.getAbsolutePath()); } - @Test(expectedExceptions = IllegalStateException.class) + @Test(groups="Integration", expectedExceptions = IllegalStateException.class) public void testUnzipFileAccessingPathOutsideTargetFolderEvilLinuxFormat() throws Exception{ InputStream evilZip = ResourceUtils.create(this).getResourceFromUrl("classpath://brooklyn/util/file.core/evilLinux.zip"); File tempZipFile = File.createTempFile("test-zip",null); @@ -134,7 +128,7 @@ public class ArchiveUtilsTest extends BrooklynAppUnitTestSupport { java.nio.file.Files.write(tempZipFile.toPath(), ByteStreams.toByteArray(evilZip), StandardOpenOption.TRUNCATE_EXISTING); ArchiveUtils.extractZip(new ZipFile(tempZipFile),destDir.getAbsolutePath()); } - @Test + @Test(groups="Integration") public void testUnzipFileAccessingPathOutsideTargetFolderNoEvil() throws Exception{ InputStream noEvilZip = ResourceUtils.create(this).getResourceFromUrl("classpath://brooklyn/util/file.core/noEvil.zip"); File tempZipFile = File.createTempFile("test-zip",null);
