Examples of VaultPackage


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

        assertNotNull(fileVaultReplicationPackage.getPaths());
    }

    @Test
    public void testCreateInputStream() throws Exception {
        VaultPackage vaultPackage = mock(VaultPackage.class);
        File file = File.createTempFile("sample","txt");
        when(vaultPackage.getFile()).thenReturn(file);
        FileVaultReplicationPackage fileVaultReplicationPackage = new FileVaultReplicationPackage(vaultPackage);
        assertNotNull(fileVaultReplicationPackage.createInputStream());
    }
View Full Code Here

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

        assertNotNull(fileVaultReplicationPackage.createInputStream());
    }

    @Test
    public void testGetLength() 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.getLength());
    }
View Full Code Here

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

        assertNotNull(fileVaultReplicationPackage.getLength());
    }

    @Test
    public void testGetType() 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.getType());
    }
View Full Code Here

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

        assertNotNull(fileVaultReplicationPackage.getType());
    }

    @Test
    public void testGetAction() 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.getAction());
    }
View Full Code Here

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

        assertNotNull(fileVaultReplicationPackage.getAction());
    }

    @Test
    public void testClose() 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.close();
    }
View Full Code Here

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

     */
    public void tryUnwrap() throws IOException, RepositoryException {
        if (isValid()) {
            return;
        }
        VaultPackage pack = getPackage();
        Node content = getContent();
        boolean ok = false;
        try {
            content.addMixin(NT_VLT_PACKAGE);
            Node defNode = content.addNode(NN_VLT_DEFINITION);
View Full Code Here

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

        opts.setMetaInf(inf);
        opts.setMountPath("/tmp/foo");
        opts.setRootPath("/content/geometrixx");
        File tmpFile = File.createTempFile("vaulttest", "zip");
        VaultPackage pkg = packMgr.assemble(admin, opts, tmpFile);

        // check if entries are present
        WorkspaceFilter newFilter = pkg.getMetaInf().getFilter();
        assertTrue(newFilter.contains("/content/geometrixx/bar/test.txt"));
        assertNotNull(pkg.getArchive().getEntry("jcr_root/content/geometrixx/bar/test.txt"));
        pkg.close();
        tmpFile.delete();
    }
View Full Code Here

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

        props.setProperty(VaultPackage.NAME_NAME, "test-package");
        inf.setProperties(props);

        opts.setMetaInf(inf);
        File tmpFile = File.createTempFile("vaulttest", ".zip");
        VaultPackage pkg = packMgr.assemble(admin, opts, tmpFile);

        Archive.Entry e = pkg.getArchive().getEntry("jcr_root/tmp/.content.xml");
        InputSource is = pkg.getArchive().getInputSource(e);
        Reader r = new InputStreamReader(is.getByteStream(), "utf-8");
        String contentXml = IOUtils.toString(r);

        assertEquals("Serialized content",
                "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                        "<jcr:root xmlns:jcr=\"http://www.jcp.org/jcr/1.0\" xmlns:nt=\"http://www.jcp.org/jcr/nt/1.0\"\n" +
                        "    jcr:primaryType=\"nt:unstructured\">\n" +
                        "    <jcr:content\n" +
                        "        jcr:primaryType=\"nt:unstructured\"\n" +
                        "        double_nan=\"{Double}NaN\"\n" +
                        "        double_neg_inf=\"{Double}-Infinity\"\n" +
                        "        double_pos_inf=\"{Double}Infinity\"/>\n" +
                        "</jcr:root>\n",
                contentXml);
        pkg.close();
        tmpFile.delete();
    }
View Full Code Here

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

     */
    public void tryUnwrap() throws IOException, RepositoryException {
        if (isValid()) {
            return;
        }
        VaultPackage pack = getPackage();
        Node content = getContent();
        boolean ok = false;
        try {
            content.addMixin(NT_VLT_PACKAGE);
            Node defNode = content.addNode(NN_VLT_DEFINITION);
View Full Code Here

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

        ExportOptions opts = new ExportOptions();
        opts.setMetaInf(def.getMetaInf());
        opts.setListener(listener);
        opts.setPostProcessor(def.getInjectProcessor());

        VaultPackage pack = assemble(packNode.getSession(), opts, (File) null);

        // update this content
        Node contentNode = packNode.getNode(JcrConstants.JCR_CONTENT);
        InputStream in;
        try {
            in = FileUtils.openInputStream(pack.getFile());
        } catch (IOException e) {
            throw new PackageException(e);
        }
        // stay jcr 1.0 compatible
        //noinspection deprecation
        contentNode.setProperty(JcrConstants.JCR_DATA, in);
        contentNode.setProperty(JcrConstants.JCR_LASTMODIFIED, now);
        contentNode.setProperty(JcrConstants.JCR_MIMETYPE, JcrPackage.MIME_TYPE);
        packNode.save();
        pack.close();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.