Package org.apache.jackrabbit.vault.packaging

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


        fileVaultReplicationPackage.close();
    }

    @Test
    public void testDelete() throws Exception {
        VaultPackage vaultPackage = mock(VaultPackage.class);
        File file = mock(File.class);
        when(file.getAbsolutePath()).thenReturn("/path/to/file.txt");
        when(vaultPackage.getFile()).thenReturn(file);
        FileVaultReplicationPackage fileVaultReplicationPackage = new FileVaultReplicationPackage(vaultPackage);
        fileVaultReplicationPackage.delete();
    }
View Full Code Here


    @Test
    public void testCreatePackageForAdd() throws Exception {

        Packaging packaging = mock(Packaging.class);
        PackageManager packageManager = mock(PackageManager.class);
        VaultPackage vaultPackage = mock(VaultPackage.class);
        File file = mock(File.class);
        when(file.getAbsolutePath()).thenReturn("/path/to/file");
        when(vaultPackage.getFile()).thenReturn(file);
        MetaInf inf = mock(MetaInf.class);
        when(vaultPackage.getMetaInf()).thenReturn(inf);
        when(packageManager.assemble(any(Session.class), any(ExportOptions.class), any(File.class))).thenReturn(vaultPackage);
        when(packaging.getPackageManager()).thenReturn(packageManager);

        ResourceResolver resourceResolver = mock(ResourceResolver.class);
        Session session = mock(Session.class);
View Full Code Here

    @Test
    public void testInstallPackageInternal() throws Exception {
        File tempFile = File.createTempFile("testInstallPackageInternal", "txt");
        Packaging packaging = mock(Packaging.class);
        PackageManager packageManager = mock(PackageManager.class);
        VaultPackage vaultPackage = mock(VaultPackage.class);
        when(packageManager.open(tempFile)).thenReturn(vaultPackage);
        when(packaging.getPackageManager()).thenReturn(packageManager);
        ReplicationEventFactory eventFactory = mock(ReplicationEventFactory.class);

        FileVaultReplicationPackageBuilder fileVaultReplicationPackageBuilder = new FileVaultReplicationPackageBuilder(
View Full Code Here

    @Test
    public void testInstallWithCustomImportModeAndACLHandling() throws Exception {
        File tempFile = File.createTempFile("testInstallPackageInternal", "txt");
        Packaging packaging = mock(Packaging.class);
        PackageManager packageManager = mock(PackageManager.class);
        VaultPackage vaultPackage = mock(VaultPackage.class);
        when(packageManager.open(tempFile)).thenReturn(vaultPackage);
        when(packaging.getPackageManager()).thenReturn(packageManager);
        ReplicationEventFactory eventFactory = mock(ReplicationEventFactory.class);

        FileVaultReplicationPackageBuilder fileVaultReplicationPackageBuilder = new FileVaultReplicationPackageBuilder(
View Full Code Here

            log.debug("assembling package {}", packageGroup + '/' + packageName + "-" + VERSION);

            opts.setMetaInf(inf);
            opts.setRootPath("/");
            File tmpFile = File.createTempFile("rp-vlt-create-" + System.nanoTime(), ".zip");
            VaultPackage vaultPackage = packaging.getPackageManager().assemble(session, opts, tmpFile);
            return new FileVaultReplicationPackage(vaultPackage);
        } catch (Exception e) {
            throw new ReplicationPackageBuildingException(e);
        } finally {
            ungetSession(session);
View Full Code Here

            File tmpFile = File.createTempFile("rp-vlt-read-" + System.nanoTime(), ".zip");
            FileOutputStream fileStream = new FileOutputStream(tmpFile);
            IOUtils.copy(stream, fileStream);
            IOUtils.closeQuietly(fileStream);

            VaultPackage vaultPackage = packaging.getPackageManager().open(tmpFile);

            if (vaultPackage != null) {
                pkg = new FileVaultReplicationPackage(vaultPackage);
            } else {
                log.warn("stream could not be read as a vlt package");
View Full Code Here

    protected ReplicationPackage getPackageInternal(ResourceResolver resourceResolver, String id) {
        ReplicationPackage replicationPackage = null;
        try {
            File file = new File(id);
            if (file.exists()) {
                VaultPackage pkg = packaging.getPackageManager().open(file);
                replicationPackage = new FileVaultReplicationPackage(pkg);
            }
        } catch (Exception e) {
            log.warn("could not find a package with id : {}", id);
        }
View Full Code Here

        Session session = null;
        try {
            session = getSession(resourceResolver);
            File file = new File(replicationPackage.getId());
            if (file.exists()) {
                VaultPackage pkg = packaging.getPackageManager().open(file);
                ImportOptions opts = new ImportOptions();
                if (aclHandling != null) {
                    opts.setAccessControlHandling(aclHandling);
                }
                else {
                    // default to overwrite
                    opts.setAccessControlHandling(AccessControlHandling.OVERWRITE);
                }
                if (importMode != null) {
                    opts.setImportMode(importMode);
                }
                else {
                    // default to replace
                    opts.setImportMode(ImportMode.REPLACE);
                }
                pkg.extract(session, opts);
                return true;
            }
        } catch (Exception e) {
            log.error("could not read / install the package", e);
            throw new ReplicationPackageReadingException(e);
View Full Code Here

*/
public class FileVaultReplicationPackageTest {

    @Test
    public void testGetId() throws Exception {
        VaultPackage vaultPackage = mock(VaultPackage.class);
        File file = mock(File.class);
        when(file.getAbsolutePath()).thenReturn("/path/to/file.txt");
        when(vaultPackage.getFile()).thenReturn(file);
        FileVaultReplicationPackage fileVaultReplicationPackage = new FileVaultReplicationPackage(vaultPackage);
        assertNotNull(fileVaultReplicationPackage.getId());
    }
View Full Code Here

        assertNotNull(fileVaultReplicationPackage.getId());
    }

    @Test
    public void testGetPaths() throws Exception {
        VaultPackage vaultPackage = mock(VaultPackage.class);
        File file = mock(File.class);
        when(file.getAbsolutePath()).thenReturn("/path/to/file.txt");
        when(vaultPackage.getFile()).thenReturn(file);
        FileVaultReplicationPackage fileVaultReplicationPackage = new FileVaultReplicationPackage(vaultPackage);
        assertNotNull(fileVaultReplicationPackage.getPaths());
    }
View Full Code Here

TOP

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

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.