jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r1575067 - /jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestPackageInstall.java
Date Thu, 06 Mar 2014 22:04:11 GMT
Author: tripod
Date: Thu Mar  6 22:04:11 2014
New Revision: 1575067

URL: http://svn.apache.org/r1575067
Log:
@trivial adding additiona test for uploading installed packages

Modified:
    jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestPackageInstall.java

Modified: jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestPackageInstall.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestPackageInstall.java?rev=1575067&r1=1575066&r2=1575067&view=diff
==============================================================================
--- jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestPackageInstall.java
(original)
+++ jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestPackageInstall.java
Thu Mar  6 22:04:11 2014
@@ -26,9 +26,11 @@ import org.apache.commons.io.FileUtils;
 import org.apache.jackrabbit.vault.packaging.InstallContext;
 import org.apache.jackrabbit.vault.packaging.JcrPackage;
 import org.apache.jackrabbit.vault.packaging.PackageException;
+import org.apache.jackrabbit.vault.packaging.PackageId;
 import org.apache.tika.io.IOUtils;
 import org.junit.Test;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
@@ -55,6 +57,36 @@ public class TestPackageInstall extends 
     }
 
     /**
+     * Tests if unwrapping an already installed package preserves the status
+     */
+    @Test
+    public void testUnwrapPreserveInstall() throws RepositoryException, IOException, PackageException
{
+        JcrPackage pack = packMgr.upload(getStream("testpackages/tmp.zip"), true, true);
+        assertNotNull(pack);
+        assertTrue(pack.isValid());
+        assertNodeExists("/etc/packages/my_packages/tmp.zip");
+        pack.install(getDefaultOptions());
+        assertNodeExists("/tmp/foo");
+
+        long lastUnpacked = pack.getDefinition().getLastUnpacked().getTimeInMillis();
+        assertTrue(lastUnpacked > 0);
+
+        // now upload again, but don't install
+        pack = packMgr.upload(getStream("testpackages/tmp.zip"), true, true);
+        assertNotNull(pack);
+        PackageId pkgId = pack.getDefinition().getId();
+        assertTrue(pack.isValid());
+        assertTrue(pack.isInstalled());
+        assertEquals(lastUnpacked, pack.getDefinition().getLastUnpacked().getTimeInMillis());
+
+        // now re-acquire package and test again
+        pack = packMgr.open(pkgId);
+        assertTrue(pack.isValid());
+        assertTrue(pack.isInstalled());
+        assertEquals(lastUnpacked, pack.getDefinition().getLastUnpacked().getTimeInMillis());
+    }
+
+    /**
      * Installs a package that contains and checks if everything is correct.
      */
     @Test



Mime
View raw message