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/10 17:06:00 UTC
[jackrabbit-filevault] branch JCRVLT-589 created (now 53813a1)
This is an automated email from the ASF dual-hosted git repository.
reschke pushed a change to branch JCRVLT-589
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault.git.
at 53813a1 JCRVLT-589: PackageInstallIT leaves test files in tmp folder
This branch includes the following new commits:
new 53813a1 JCRVLT-589: PackageInstallIT leaves test files in tmp folder
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[jackrabbit-filevault] 01/01: JCRVLT-589: PackageInstallIT leaves test files in tmp folder
Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
reschke pushed a commit to branch JCRVLT-589
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault.git
commit 53813a107edbce0acaf7c6e4b3b804cf85f5177c
Author: Julian Reschke <ju...@gmx.de>
AuthorDate: Mon Jan 10 18:05:42 2022 +0100
JCRVLT-589: PackageInstallIT leaves test files in tmp folder
---
.../packaging/integration/PackageInstallIT.java | 44 ++++++++++++----------
1 file changed, 25 insertions(+), 19 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..ab8b35e 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
@@ -26,6 +26,7 @@ import static org.junit.Assert.fail;
import java.io.File;
import java.io.IOException;
+import java.io.OutputStream;
import java.security.Principal;
import java.util.Collections;
@@ -39,6 +40,7 @@ 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 +57,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;
@@ -376,17 +377,17 @@ public class PackageInstallIT extends IntegrationTestBase {
assertNodeExists("/testroot");
}
- /**
- * Installs a package with no properties
- */
- @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());
+ File tmpFile = File.createTempFile("avlttest", "zip");
+ try (OutputStream os = FileUtils.openOutputStream(tmpFile)) {
+ IOUtils.copy(getStream("/test-packages/tmp_no_properties.zip"), os);
+ try (JcrPackage pack = packMgr.upload(tmpFile, true, true, "testpackage", false)) {
+ assertNotNull(pack);
+ pack.install(getDefaultOptions());
+ }
+ } finally {
+ tmpFile.delete();
+ }
}
/**
@@ -404,14 +405,19 @@ 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");
+ File tmpFile = File.createTempFile("bvlttest", "zip");
+ try (OutputStream os = FileUtils.openOutputStream(tmpFile)) {
+ IOUtils.copy(getStream("/test-packages/test-package-with-etc.zip"), os);
+ try (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");
+ }
+ } finally {
+ tmpFile.delete();
+ }
}
@Test