Package org.apache.jackrabbit.spi

Examples of org.apache.jackrabbit.spi.Batch


        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

    }

    public void testMove() throws RepositoryException {
        NodeId nid = getNodeId(testPath);

        Batch b = rs.createBatch(si, nid);
        b.addNode(nid, resolver.getQName("anyNode"), NameConstants.NT_UNSTRUCTURED, null);
        rs.submit(b);

        NodeId id = getNodeId(testPath + "/anyNode");

        b = rs.createBatch(si, nid);
        b.move(id, nid, resolver.getQName("moved"));
        rs.submit(b);

        try {
            rs.getItemInfos(si, id);
            fail();
View Full Code Here

    }

    public void testReorder() throws RepositoryException {
        NodeId nid = getNodeId(testPath);

        Batch b = rs.createBatch(si, nid);
        b.addNode(nid, resolver.getQName("1"), NameConstants.NT_UNSTRUCTURED, null);
        b.addNode(nid, resolver.getQName("3"), NameConstants.NT_UNSTRUCTURED, null);
        b.addNode(nid, resolver.getQName("2"), NameConstants.NT_UNSTRUCTURED, null);
        rs.submit(b);

        b = rs.createBatch(si, nid);
        b.reorderNodes(nid, getNodeId(testPath + "/3"), null);
        rs.submit(b);

        Iterator<ChildInfo> it = rs.getChildInfos(si, nid);
        int i = 1;
        while (it.hasNext()) {
View Full Code Here

    }

    public void testReorder1() throws RepositoryException {
        NodeId nid = getNodeId(testPath);

        Batch b = rs.createBatch(si, nid);
        b.addNode(nid, resolver.getQName("2"), NameConstants.NT_UNSTRUCTURED, null);
        b.addNode(nid, resolver.getQName("3"), NameConstants.NT_UNSTRUCTURED, null);
        b.addNode(nid, resolver.getQName("1"), NameConstants.NT_UNSTRUCTURED, null);
        rs.submit(b);

        b = rs.createBatch(si, nid);
        b.reorderNodes(nid, getNodeId(testPath + "/1"), getNodeId(testPath + "/2"));
        rs.submit(b);

        Iterator<ChildInfo> it = rs.getChildInfos(si, nid);
        int i = 1;
        while (it.hasNext()) {
View Full Code Here

        }
    }

    public void testRemove() throws RepositoryException {
        NodeId nid = getNodeId(testPath);
        Batch b = rs.createBatch(si, nid);

        NodeId id = getNodeId(testPath + "/aTestNode");
        b.addNode(nid, resolver.getQName("aTestNode"), NameConstants.NT_UNSTRUCTURED, null);
        b.addProperty(id, resolver.getQName("aString"), rs.getQValueFactory().create("ba", PropertyType.STRING));
        rs.submit(b);

        PropertyId pid = getPropertyId(id, resolver.getQName("aString"));
        b = rs.createBatch(si, nid);
        b.remove(pid);
        rs.submit(b);

        try {
            rs.getPropertyInfo(si, pid);
            fail();
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.