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 2024/01/10 10:54:25 UTC

(jackrabbit-filevault) branch JCRVLT-739 created (now 5bbc4589)

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

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


      at 5bbc4589 JCRVLT-739: some ImportIT tests do not close resources

This branch includes the following new commits:

     new 5bbc4589 JCRVLT-739: some ImportIT tests do not close resources

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-739: some ImportIT tests do not close resources

Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 5bbc458975166a3b6d4d69d7a5a04ce530f54a3b
Author: Julian Reschke <re...@apache.org>
AuthorDate: Wed Jan 10 11:54:02 2024 +0100

    JCRVLT-739: some ImportIT tests do not close resources
---
 .../vault/packaging/integration/ImportIT.java      | 34 ++++++++++++----------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/vault-core-it/vault-core-integration-tests/src/main/java/org/apache/jackrabbit/vault/packaging/integration/ImportIT.java b/vault-core-it/vault-core-integration-tests/src/main/java/org/apache/jackrabbit/vault/packaging/integration/ImportIT.java
index 3ca7b36b..0cfef3f3 100644
--- a/vault-core-it/vault-core-integration-tests/src/main/java/org/apache/jackrabbit/vault/packaging/integration/ImportIT.java
+++ b/vault-core-it/vault-core-integration-tests/src/main/java/org/apache/jackrabbit/vault/packaging/integration/ImportIT.java
@@ -316,15 +316,16 @@ public class ImportIT extends IntegrationTestBase {
 
         // Import with a session associated to the test user
         Session session = repository.login(new SimpleCredentials(userId, userPwd.toCharArray()));
-        ZipArchive archive = new ZipArchive(getFile("/test-packages/tmp.zip"));
-        archive.open(true);
-        ImportOptions opts = getDefaultOptions();
-        opts.setStrict(false);
-        Importer importer = new Importer(opts);
-        importer.run(archive, session, "/");
-        session.logout();
+        try (ZipArchive archive = new ZipArchive(getFile("/test-packages/tmp.zip"))) {
+            archive.open(true);
+            ImportOptions opts = getDefaultOptions();
+            opts.setStrict(false);
+            Importer importer = new Importer(opts);
+            importer.run(archive, session, "/");
+            session.logout();
 
-        assertNodeExists("/tmp/foo/bar/tobi");
+            assertNodeExists("/tmp/foo/bar/tobi");
+        }
     }
 
     @Test
@@ -351,15 +352,16 @@ public class ImportIT extends IntegrationTestBase {
 
         // Import with a session associated to the test user
         Session session = repository.login(new SimpleCredentials(userId, userPwd.toCharArray()));
-        ZipArchive archive = new ZipArchive(getFile("/test-packages/tmp_foo.zip"));
-        archive.open(true);
-        ImportOptions opts = getDefaultOptions();
-        opts.setStrict(false);
-        Importer importer = new Importer(opts);
-        importer.run(archive, session, "/");
-        session.logout();
+        try (ZipArchive archive = new ZipArchive(getFile("/test-packages/tmp_foo.zip"))) {
+            archive.open(true);
+            ImportOptions opts = getDefaultOptions();
+            opts.setStrict(false);
+            Importer importer = new Importer(opts);
+            importer.run(archive, session, "/");
+            session.logout();
 
-        assertNodeExists("/tmp/foo/bar/tobi");
+            assertNodeExists("/tmp/foo/bar/tobi");
+        }
     }
 
     @Test