Package org.apache.jackrabbit.vault.packaging

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


     */
    @Test
    public void testACMerge2() throws RepositoryException, IOException, PackageException {
        assertNodeMissing("/testroot");

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

        // test if nodes and ACLs of first package exist
        assertNodeExists("/testroot/node_a");
        assertPermission("/testroot/secured", false, new String[]{"jcr:all"}, "everyone", null);

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

        // test if nodes and ACLs of 2nd package exist
        assertNodeExists("/testroot/node_a");
        assertNodeExists("/testroot/node_c");
        assertPermission("/testroot/secured", false, new String[]{"jcr:all"}, "everyone", null);
View Full Code Here


     */
    @Test
    public void testACMerge3() throws RepositoryException, IOException, PackageException {
        assertNodeMissing("/testroot");

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

        // test if nodes and ACLs of first package exist
        assertNodeExists("/testroot/node_a");
        assertPermission("/testroot/secured", false, new String[]{"jcr:all"}, "everyone", null);

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

        // test if nodes and ACLs of 2nd package exist
        assertNodeExists("/testroot/node_a");
        assertNodeExists("/testroot/node_d");
        assertPermission("/testroot/secured", true, new String[]{"jcr:all"}, "everyone", null);
View Full Code Here

     */
    @Test
    public void testACMergePreserve2() throws RepositoryException, IOException, PackageException {
        assertNodeMissing("/testroot");

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

        // test if nodes and ACLs of first package exist
        assertNodeExists("/testroot/node_a");
        assertPermission("/testroot/secured", false, new String[]{"jcr:all"}, "everyone", null);

        pack = packMgr.upload(getStream("testpackages/mode_ac_test_d.zip"), false);
        assertNotNull(pack);
        ImportOptions opts = getDefaultOptions();
        opts.setAccessControlHandling(AccessControlHandling.MERGE_PRESERVE);
        pack.install(opts);

        // test if nodes and ACLs of 2nd package exist
        assertNodeExists("/testroot/node_a");
        assertNodeExists("/testroot/node_d");
        assertPermission("/testroot/secured", false, new String[]{"jcr:all"}, "everyone", null);
View Full Code Here

     */
    @Test
    public void testACMergePreserve() throws RepositoryException, IOException, PackageException {
        assertNodeMissing("/testroot");

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

        // test if nodes and ACLs of first package exist
        assertNodeExists("/testroot/node_a");
        assertPermission("/testroot/secured", false, new String[]{"jcr:all"}, "everyone", null);

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

        // test if nodes and ACLs of 2nd package exist
        assertNodeExists("/testroot/node_a");
        assertNodeExists("/testroot/node_b");
        assertPermission("/testroot/secured", false, new String[]{"jcr:all"}, "everyone", null);
View Full Code Here

        doOrderTest(AccessControlHandling.OVERWRITE);
        doOrderTest(AccessControlHandling.MERGE_PRESERVE);
    }

    private void doOrderTest(AccessControlHandling ac) throws Exception {
        JcrPackage pack = packMgr.upload(getStream("testpackages/mode_ac_test_e.zip"), true);
        assertNotNull(pack);
        ImportOptions opts = getDefaultOptions();
        opts.setAccessControlHandling(ac);
        pack.install(opts);

        // test if nodes and ACLs of first package exist
        assertNodeExists("/testroot/node_e");
        int idx0 = hasPermission("/testroot/secured", false, new String[]{"jcr:all"}, "everyone", Collections.<String, String[]>emptyMap());
        int idx1 = hasPermission("/testroot/secured", true, new String[]{"jcr:all"}, "testuser", Collections.<String, String[]>emptyMap());
View Full Code Here

    @Test
    public void testOakContent() throws RepositoryException, IOException, PackageException {
        Assume.assumeTrue(isOak());
        assertNodeMissing("/testroot");

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

        // test if nodes and ACLs of first package exist
        assertNodeExists("/testroot/node_a");
        Map<String, String[]> restrictions = new HashMap<String, String[]>();
        restrictions.put("rep:glob", new String[]{"*/foo"});
 
View Full Code Here

     */
    @Test
    public void testMissingUser() throws RepositoryException, IOException, PackageException {
        assertNodeMissing("/testroot");

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

        // test if nodes and ACLs of first package exist
        assertNodeExists("/testroot/node_d");
        assertPermission("/testroot/secured", true, new String[]{"jcr:all"}, "missinguser", null);
    }
View Full Code Here

     */
    @Test
    public void testRepoACL() throws RepositoryException, IOException, PackageException {
        removeRepoACL();

        JcrPackage pack = packMgr.upload(getStream("testpackages/repo_policy.zip"), false);
        assertNotNull(pack);
        ImportOptions opts = getDefaultOptions();
        opts.setAccessControlHandling(AccessControlHandling.OVERWRITE);
        pack.install(opts);

        // test if nodes and ACLs of first package exist
        assertPermission(null, false, new String[]{"jcr:all"}, "everyone", null);
        assertPermission(null, false, new String[]{"jcr:all"}, "testuser", null);

        pack = packMgr.upload(getStream("testpackages/repo_no_policy.zip"), true);
        assertNotNull(pack);
        opts = getDefaultOptions();
        opts.setAccessControlHandling(AccessControlHandling.OVERWRITE);
        pack.install(opts);

        assertPermissionMissing(null, false, new String[]{"jcr:all"}, "everyone", null);
        assertPermissionMissing(null, false, new String[]{"jcr:all"}, "testuser", null);

    }
View Full Code Here

        addACL(null, true, new String[]{"jcr:all"}, "testuser");
        assertPermission(null, true, new String[]{"jcr:all"}, "testuser", null);
        addACL(null, true, new String[]{"jcr:all"}, "testuser1");
        assertPermission(null, true, new String[]{"jcr:all"}, "testuser1", null);

        JcrPackage pack = packMgr.upload(getStream("testpackages/repo_policy.zip"), false);
        assertNotNull(pack);
        ImportOptions opts = getDefaultOptions();
        opts.setAccessControlHandling(AccessControlHandling.MERGE);
        pack.install(opts);

        // test if nodes and ACLs of first package exist
        assertPermission(null, false, new String[]{"jcr:all"}, "everyone", null);
        assertPermission(null, false, new String[]{"jcr:all"}, "testuser", null);
        assertPermission(null, true, new String[]{"jcr:all"}, "testuser1", null);
View Full Code Here

        addACL(null, true, new String[]{"jcr:all"}, "testuser");
        assertPermission(null, true, new String[]{"jcr:all"}, "testuser", null);
        addACL(null, true, new String[]{"jcr:all"}, "testuser1");
        assertPermission(null, true, new String[]{"jcr:all"}, "testuser1", null);

        JcrPackage pack = packMgr.upload(getStream("testpackages/repo_policy.zip"), false);
        assertNotNull(pack);
        ImportOptions opts = getDefaultOptions();
        opts.setAccessControlHandling(AccessControlHandling.MERGE_PRESERVE);
        pack.install(opts);

        // test if nodes and ACLs of first package exist
        assertPermission(null, false, new String[]{"jcr:all"}, "everyone", null);
        assertPermission(null, true, new String[]{"jcr:all"}, "testuser", null);
        assertPermission(null, true, new String[]{"jcr:all"}, "testuser1", null);
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.