Package com.day.jcr.vault.packaging

Examples of com.day.jcr.vault.packaging.JcrPackageDefinition


        final String packagePath = "/etc/packages/acs-commons/test.zip";
        final Resource packageResource = mock(Resource.class);
        final Node packageNode = mock(Node.class);
        final JcrPackage jcrPackage = mock(JcrPackage.class);
        final Node jcrPackageNode = mock(Node.class);
        final JcrPackageDefinition jcrPackageDefinition = mock(JcrPackageDefinition.class);
        final Resource jcrPackageJcrContent = mock(Resource.class);

        final Resource contentResource1 = mock(Resource.class);
        final Resource contentResource2 = mock(Resource.class);
        final Node contentNode1 = mock(Node.class);
        final Node contentNode2 = mock(Node.class);

        final String[] paths = new String[] { packagePath };

        final Map<String, Object> map = new HashMap<String, Object>();
        map.put("paths", paths);

        final Event event = new Event("MOCK", map);

        when(adminResourceResolver.getResource(packagePath)).thenReturn(packageResource);
        when(packageResource.adaptTo(Node.class)).thenReturn(packageNode);
        when(packaging.open(packageNode, false)).thenReturn(jcrPackage);
        when(packageHelper.getContents(jcrPackage)).thenReturn(contentPaths);
        when(jcrPackage.getDefinition()).thenReturn(jcrPackageDefinition);
        when(jcrPackageDefinition.getId()).thenReturn(mock(PackageId.class));
        when(jcrPackage.getNode()).thenReturn(jcrPackageNode);
        when(jcrPackageNode.getPath()).thenReturn(packagePath);
        when(packageResource.getChild("jcr:content")).thenReturn(jcrPackageJcrContent);

        Map<String, Object> properties = new HashMap<String, Object>();
View Full Code Here


        } else if (ConflictResolution.IncrementVersion.equals(conflictResolution)) {
            version = this.getNextVersion(jcrPackageManager, groupName, name, version).toString();
        }

        final JcrPackage jcrPackage = jcrPackageManager.create(groupName, name, version);
        final JcrPackageDefinition jcrPackageDefinition = jcrPackage.getDefinition();
        final DefaultWorkspaceFilter workspaceFilter = new DefaultWorkspaceFilter();

        for (final PathFilterSet pathFilterSet : pathFilterSets) {
            workspaceFilter.add(pathFilterSet);
        }

        jcrPackageDefinition.setFilter(workspaceFilter, true);

        for (final Map.Entry<String, String> entry : packageDefinitionProperties.entrySet()) {
            jcrPackageDefinition.set(entry.getKey(), entry.getValue(), false);
        }

        session.save();

        return jcrPackage;
View Full Code Here

TOP

Related Classes of com.day.jcr.vault.packaging.JcrPackageDefinition

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.