You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by re...@apache.org on 2022/01/11 12:06:35 UTC

[jackrabbit-filevault] branch master updated: JCRVLT-589: PackageInstallIT leaves test files in tmp folder

This is an automated email from the ASF dual-hosted git repository.

reschke pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault.git


The following commit(s) were added to refs/heads/master by this push:
     new b5ff8f2  JCRVLT-589: PackageInstallIT leaves test files in tmp folder
b5ff8f2 is described below

commit b5ff8f2b3ae7e6502f441696953d6598aa8f39ba
Author: Julian Reschke <re...@apache.org>
AuthorDate: Tue Jan 11 13:06:26 2022 +0100

    JCRVLT-589: PackageInstallIT leaves test files in tmp folder
    
    * JCRVLT-589: PackageInstallIT leaves test files in tmp folder
    
    * JCRVLT-589: PackageInstallIT leaves test files in tmp folder
    
    * JCRVLT-589: PackageInstallIT leaves test files in tmp folder
    
    * JCRVLT-589: PackageInstallIT leaves test files in tmp folder
---
 .../packaging/integration/PackageInstallIT.java    | 31 ++++++++++------------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/PackageInstallIT.java b/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/PackageInstallIT.java
index 4ae429c..676e35d 100644
--- a/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/PackageInstallIT.java
+++ b/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/PackageInstallIT.java
@@ -24,7 +24,6 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import java.io.File;
 import java.io.IOException;
 import java.security.Principal;
 import java.util.Collections;
@@ -38,7 +37,7 @@ import javax.jcr.SimpleCredentials;
 import javax.jcr.Value;
 import javax.jcr.nodetype.NodeType;
 
-import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
 import org.apache.jackrabbit.api.JackrabbitSession;
 import org.apache.jackrabbit.api.security.user.User;
 import org.apache.jackrabbit.api.security.user.UserManager;
@@ -55,7 +54,6 @@ import org.apache.jackrabbit.vault.packaging.impl.ActivityLog;
 import org.apache.jackrabbit.vault.packaging.impl.JcrPackageManagerImpl;
 import org.apache.jackrabbit.vault.packaging.registry.impl.JcrPackageRegistry;
 import org.apache.jackrabbit.vault.packaging.registry.impl.JcrRegisteredPackage;
-import org.apache.tika.io.IOUtils;
 import org.junit.Assume;
 import org.junit.Ignore;
 import org.junit.Rule;
@@ -381,12 +379,11 @@ public class PackageInstallIT extends IntegrationTestBase {
      */
     @Test
     public void testNoProperties() throws RepositoryException, IOException, PackageException {
-        File tmpFile = File.createTempFile("vlttest", "zip");
-        IOUtils.copy(getStream("/test-packages/tmp_no_properties.zip"), FileUtils.openOutputStream(tmpFile));
-        JcrPackage pack = packMgr.upload(tmpFile, true, true, "testpackage", false);
-        assertNotNull(pack);
-
-        pack.install(getDefaultOptions());
+        try (JcrPackage pack = packMgr.upload(getFile("/test-packages/tmp_no_properties.zip"), false, true, "tmp_no_properties",
+                false)) {
+            assertNotNull(pack);
+            pack.install(getDefaultOptions());
+        }
     }
 
     /**
@@ -404,14 +401,14 @@ public class PackageInstallIT extends IntegrationTestBase {
      */
     @Test
     public void testNoChildFilter() throws RepositoryException, IOException, PackageException {
-        File tmpFile = File.createTempFile("vlttest", "zip");
-        IOUtils.copy(getStream("/test-packages/test-package-with-etc.zip"), FileUtils.openOutputStream(tmpFile));
-        JcrPackage pack = packMgr.upload(tmpFile, true, true, "test-package-with-etc", false);
-        assertNodeExists("/etc");
-        admin.getNode("/etc").addNode("foo", NodeType.NT_FOLDER);
-        admin.save();
-        pack.install(getDefaultOptions());
-        assertNodeExists("/etc/foo");
+        try (JcrPackage pack = packMgr.upload(getFile("/test-packages/test-package-with-etc.zip"), false, true,
+                "test-package-with-etc", false)) {
+            assertNodeExists("/etc");
+            admin.getNode("/etc").addNode("foo", NodeType.NT_FOLDER);
+            admin.save();
+            pack.install(getDefaultOptions());
+            assertNodeExists("/etc/foo");
+        }
     }
 
     @Test