Package org.apache.jackrabbit.spi

Examples of org.apache.jackrabbit.spi.Batch


            super.tearDown();
        }
    }

    private void createTestNode(String testPath) throws RepositoryException {
        Batch b = rs.createBatch(si, getNodeId("/"));
        String name = Text.getName(testPath);
        b.addNode(getNodeId("/"), resolver.getQName(name), NameConstants.NT_UNSTRUCTURED, null);
        rs.submit(b);
    }
View Full Code Here


        b.addNode(getNodeId("/"), resolver.getQName(name), NameConstants.NT_UNSTRUCTURED, null);
        rs.submit(b);
    }

    private void removeTestNode(String path) throws RepositoryException {
        Batch b = rs.createBatch(si, getNodeId("/"));
        b.remove(getNodeId(path));
        rs.submit(b);
    }
View Full Code Here

        resolver = new DefaultNamePathResolver(nsResolver);

        try {
            rs.getNodeInfo(si, getNodeId(testPath));
        } catch (RepositoryException e) {
            Batch b = rs.createBatch(si, getNodeId("/"));
            b.addNode(getNodeId("/"), resolver.getQName("test"), NameConstants.NT_UNSTRUCTURED, null);
            QValueFactory qvf = rs.getQValueFactory();
            b.addProperty(getNodeId("/test"), resolver.getQName("prop"), qvf.create("value", PropertyType.STRING));
            b.addProperty(getNodeId("/test"), resolver.getQName("propMV"), new QValue[] {qvf.create(1), qvf.create(2)});
            rs.submit(b);
        }
    }
View Full Code Here

    }

    @Override
    protected void tearDown() throws Exception {
        try {
            Batch b = rs.createBatch(si, getNodeId("/"));
            b.remove(getNodeId(testPath));
            rs.submit(b);
        } finally {
            rs.dispose(si);
            super.tearDown();
        }
View Full Code Here

        assertPropertyNames(props, result);
    }

    public void testReferenceableNode() throws Exception {
        NodeId nid = getNodeId("/test");
        Batch b = rs.createBatch(si, nid);
        b.setMixins(nid, new Name[] {NameConstants.MIX_REFERENCEABLE});
        rs.submit(b);

        String uri = rs.getItemUri(nid, si);
       
        DavPropertyNameSet set = doPropFindNames(uri);
View Full Code Here

    public void testNodeWithPrimaryItem() throws Exception {
        // create file node
        NodeId nid = getNodeId("/test");
        Name fileName = resolver.getQName("test.txt");
        Batch b = rs.createBatch(si, nid);
        b.addNode(nid, fileName, NameConstants.NT_FILE, null);

        String filePath = testPath + "/" + fileName.getLocalName();
        NodeId fileID = getNodeId(filePath);
        b.addNode(fileID, NameConstants.JCR_CONTENT, NameConstants.NT_RESOURCE, null);

        NodeId content = getNodeId(filePath + "/" + NameConstants.JCR_CONTENT);

        QValue lastModified = rs.getQValueFactory().create(Calendar.getInstance());
        QValue mimeType = rs.getQValueFactory().create("text/plain", PropertyType.STRING);
        QValue enc = rs.getQValueFactory().create("utf-8", PropertyType.STRING);
        b.addProperty(content, resolver.getQName(JcrConstants.JCR_LASTMODIFIED), lastModified);
        b.addProperty(content, resolver.getQName(JcrConstants.JCR_MIMETYPE), mimeType);
        b.addProperty(content, resolver.getQName(JcrConstants.JCR_ENCODING), enc);

        InputStream data = new ByteArrayInputStream("\u0633\u0634".getBytes("UTF-8"));
        b.addProperty(content, resolver.getQName(JcrConstants.JCR_DATA), rs.getQValueFactory().create(data));

        rs.submit(b);

        // test properties of the file node
        String uri = rs.getItemUri(fileID, si);
View Full Code Here

        assertPropertyNames(props, result);
    }

    public void testCheckedOutVersionableNode() throws Exception {
        NodeId nid = getNodeId("/test");
        Batch b = rs.createBatch(si, nid);
        b.setMixins(nid, new Name[] {NameConstants.MIX_VERSIONABLE});
        rs.submit(b);

        String uri = rs.getItemUri(nid, si);

        DavPropertyNameSet set = doPropFindNames(uri);
View Full Code Here

        assertPropertyNames(props, result);
    }

    public void testCheckedInVersionableNode() throws Exception {
        NodeId nid = getNodeId("/test");
        Batch b = rs.createBatch(si, nid);
        b.setMixins(nid, new Name[] {NameConstants.MIX_VERSIONABLE});
        rs.submit(b);
        rs.checkin(si, nid);

        String uri = rs.getItemUri(nid, si);
       
View Full Code Here

        assertPropertyNames(props, result);
    }

    public void testVersion() throws Exception {
        NodeId nid = getNodeId("/test");
        Batch b = rs.createBatch(si, nid);
        b.setMixins(nid, new Name[] {NameConstants.MIX_VERSIONABLE});
        rs.submit(b);
        NodeId vID = rs.checkin(si, nid);

        String uri = rs.getItemUri(vID, si);
View Full Code Here

        assertPropertyNames(props, result);
    }

    public void testVersionHistory() throws Exception {
        NodeId nid = getNodeId("/test");
        Batch b = rs.createBatch(si, nid);
        b.setMixins(nid, new Name[] {NameConstants.MIX_VERSIONABLE});
        rs.submit(b);
        NodeId vID = rs.checkin(si, nid);

        String uri = Text.getRelativeParent(rs.getItemUri(vID, si), 1);
        DavPropertyNameSet set = doPropFindNames(uri);
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.spi.Batch

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.