Package org.apache.jackrabbit.vault.packaging

Examples of org.apache.jackrabbit.vault.packaging.JcrPackage


    public void testHookFail() throws RepositoryException, IOException, PackageException {
        if (admin.nodeExists("/testroot")) {
            admin.getNode("/testroot").remove();
        }
        admin.save();
        JcrPackage pack = packMgr.upload(getStream("testpackages/test_hook.zip"), false);
        assertNotNull(pack);
        try {
            pack.install(getDefaultOptions());
            fail("installing failing hook should fail");
        } catch (PackageException e) {
            // ok
        }
    }
View Full Code Here


    /**
     * Installs a package with an invalid hook
     */
    @Test
    public void testInvalidHook() throws RepositoryException, IOException {
        JcrPackage pack = packMgr.upload(getStream("testpackages/invalid_hook.zip"), false);
        assertNotNull(pack);

        try {
            pack.install(getDefaultOptions());
            fail("Package install should fail.");
        } catch (PackageException e) {
            // ok
        }
    }
View Full Code Here

        if (!admin.nodeExists("/testroot")) {
            admin.getRootNode().addNode("testroot", "nt:unstructured");
            admin.save();
        }

        JcrPackage pack = packMgr.upload(getStream("testpackages/external_hook.zip"), false);
        assertNotNull(pack);

        pack.install(getDefaultOptions());

        assertProperty("/testroot/TestHook1", InstallContext.Phase.END.toString());
        assertProperty("/testroot/TestHook2", InstallContext.Phase.END.toString());
    }
View Full Code Here

     */
    @Test
    public void testNoProperties() throws RepositoryException, IOException, PackageException {
        File tmpFile = File.createTempFile("vlttest", "zip");
        IOUtils.copy(getStream("testpackages/tmp_no_properties.zip"), FileUtils.openOutputStream(tmpFile));
        JcrPackage pack = packMgr.upload(tmpFile, true, true, "testpackage", false);
        assertNotNull(pack);

        pack.install(getDefaultOptions());
    }
View Full Code Here

    /**
     * Installs a package that contains a custom privilege and then checks if it was installed.
     */
    @Test
    public void installWithPrivs() throws RepositoryException, IOException, PackageException {
        JcrPackage pack = packMgr.upload(getStream("testpackages/privileges.zip"), false);
        assertNotNull(pack);
        pack.install(getDefaultOptions());

        // check if privilege was installed
        PrivilegeManager mgr = ((JackrabbitWorkspace) admin.getWorkspace()).getPrivilegeManager();
        try {
            mgr.getPrivilege("testns:testpriv");
View Full Code Here

    public void installGroupA() throws RepositoryException, IOException, PackageException {
        UserManager mgr = ((JackrabbitSession) admin).getUserManager();
        assertNull("test-group must not exist", mgr.getAuthorizable("test-group"));
        assertNull("test-user-a must not exist", mgr.getAuthorizable("test-user-a"));

        JcrPackage pack = packMgr.upload(getStream("testpackages/group_with_a.zip"), false);
        assertNotNull(pack);
        pack.install(getDefaultOptions());

        // check if group exists
        Group grp = (Group) mgr.getAuthorizable("test-group");
        assertNotNull("test-group must exist", grp);
        User userA = (User) mgr.getAuthorizable("test-user-a");
View Full Code Here

        assertNull("test-group must not exist", mgr.getAuthorizable("test-group"));
        assertNull("test-user-a must not exist", mgr.getAuthorizable("test-user-a"));
        assertNull("test-user-b must not exist", mgr.getAuthorizable("test-user-b"));
        assertNull("test-user-c must not exist", mgr.getAuthorizable("test-user-c"));

        JcrPackage pack = packMgr.upload(getStream("testpackages/group_with_a.zip"), false);
        assertNotNull(pack);
        pack.install(getDefaultOptions());

        pack = packMgr.upload(getStream("testpackages/group_with_bc.zip"), false);
        assertNotNull(pack);
        pack.install(getDefaultOptions());

        // check if group exists
        Group grp = (Group) mgr.getAuthorizable("test-group");
        assertNotNull("test-group must exist", grp);
        User userA = (User) mgr.getAuthorizable("test-user-a");
View Full Code Here

    /**
     * Installs some packages and tests the resolve method
     */
    @Test
    public void testResolve() throws RepositoryException, IOException, PackageException {
        JcrPackage pack = packMgr.upload(getStream("testpackages/package_1.0.zip"), false);
        assertNotNull(pack);
        pack.install(getDefaultOptions());

        pack = packMgr.upload(getStream("testpackages/package_2.0.zip"), false);
        assertNotNull(pack);
        pack.install(getDefaultOptions());

        pack = packMgr.upload(getStream("testpackages/empty_tmp.zip"), false);
        assertNotNull(pack);
        pack.install(getDefaultOptions());

        PackageId id = packMgr.resolve(Dependency.fromString("my_packages:package:[1.0,2.0]"), true);
        assertEquals(PackageId.fromString("my_packages:package:2.0"), id);

        id = packMgr.resolve(Dependency.fromString("my_packages:package:[1.0,2.0)"), true);
View Full Code Here

    /**
     * uploads and installs some packages and tests the resolve method
     */
    @Test
    public void testResolvePartial() throws RepositoryException, IOException, PackageException {
        JcrPackage pack = packMgr.upload(getStream("testpackages/package_1.0.zip"), false);
        assertNotNull(pack);
        pack.install(getDefaultOptions());

        pack = packMgr.upload(getStream("testpackages/package_2.0.zip"), false);
        assertNotNull(pack);
        // do NOT install
        //pack.install(getDefaultOptions());

        pack = packMgr.upload(getStream("testpackages/empty_tmp.zip"), false);
        assertNotNull(pack);
        pack.install(getDefaultOptions());

        PackageId id = packMgr.resolve(Dependency.fromString("my_packages:package:[1.0,2.0]"), true);
        assertEquals(PackageId.fromString("my_packages:package:1.0"), id);

        id = packMgr.resolve(Dependency.fromString("my_packages:package:[1.0,2.0]"), false);
View Full Code Here

    /**
     * Installs a package that contains and checks if everything is correct.
     */
    @Test
    public void testUpload() throws RepositoryException, IOException, PackageException {
        JcrPackage pack = packMgr.upload(getStream("testpackages/tmp.zip"), false);
        assertNotNull(pack);
        assertNodeExists("/etc/packages/my_packages/tmp.zip");

        // upload already unrwapps it, so check if definition is ok
        assertNodeExists("/etc/packages/my_packages/tmp.zip/jcr:content/vlt:definition");
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.vault.packaging.JcrPackage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.