Package org.apache.jackrabbit.spi

Examples of org.apache.jackrabbit.spi.Batch


    public void testSetBooleanValue() throws RepositoryException {
        NodeId nid = getNodeId(testPath);
        Name propName = resolver.getQName("booleanProp");

        QValue v = rs.getQValueFactory().create(false);
        Batch b = rs.createBatch(si, nid);
        b.addProperty(nid, propName, v);
        rs.submit(b);

        PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
        assertFalse(pi.isMultiValued());
        assertFalse(pi.getValues()[0].getBoolean());
View Full Code Here


    public void testSetReferenceValue() throws RepositoryException {
        NodeId nid = getNodeId(testPath);
        NodeInfo nInfo = rs.getNodeInfo(si, nid);
        if (!Arrays.asList(nInfo.getMixins()).contains(NameConstants.MIX_REFERENCEABLE)) {
            Batch b = rs.createBatch(si, nid);
            b.setMixins(nid, new Name[] {NameConstants.MIX_REFERENCEABLE});
            rs.submit(b);
        }

        String ref = rs.getNodeInfo(si, nid).getId().getUniqueID();
        Name propName = resolver.getQName("refProp");
        QValue v = rs.getQValueFactory().create(ref, PropertyType.REFERENCE);

        Batch b = rs.createBatch(si, nid);
        b.addProperty(nid, propName, v);
        rs.submit(b);

        PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
        assertFalse(pi.isMultiValued());
        assertEquals(v, pi.getValues()[0]);
View Full Code Here

        QValue v = rs.getQValueFactory().create(NameConstants.JCR_AUTOCREATED);
        QValue v2 = rs.getQValueFactory().create(NameConstants.JCR_BASEVERSION);
        QValue v3 = rs.getQValueFactory().create(NameConstants.JCR_CONTENT);

        Batch b = rs.createBatch(si, nid);
        b.addProperty(nid, propName, v);
        b.setValue(pid, v2);
        b.setValue(pid, v3);
        rs.submit(b);

        PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
        assertFalse(pi.isMultiValued());
        assertEquals(1, pi.getValues().length);
View Full Code Here

        assertEquals(PropertyType.NAME, pi.getType());
    }

    public void testUseConsumedBatch() throws RepositoryException {
        NodeId nid = getNodeId(testPath);
        Batch b = rs.createBatch(si, nid);
        b.addProperty(nid, resolver.getQName("any"), rs.getQValueFactory().create(1.34));
        rs.submit(b);

        try {
            b.remove(nid);
            rs.submit(b);
            fail();
        } catch (IllegalStateException e) {
            // success
        }
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);
            rs.submit(b);
        }

        // todo: retrieve second wsp-name from config
        sInfo = rs.obtain(si, "test");
View Full Code Here

    }

    protected void tearDown() throws Exception {
        try {
            if (si != null) {
                Batch b = rs.createBatch(si, getNodeId("/"));
                b.remove(getNodeId(testPath));
                rs.submit(b);
            }
            if (sInfo != null && clonedId != null) {
                Batch b = rs.createBatch(sInfo, getNodeId("/"));
                b.remove(clonedId);
                rs.submit(b);
            }
        } catch (RepositoryException e) {
            // cleanup failed... ignore.
        } finally {
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);
            rs.submit(b);
        }
    }
View Full Code Here

        }
    }

    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

    }

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

        Batch b = rs.createBatch(si, nid);
        b.addNode(nid, resolver.getQName("anyNode"), NameConstants.NT_UNSTRUCTURED, null);
        NodeId id = getNodeId(testPath + "/anyNode");
        b.setMixins(id, new Name[] {NameConstants.MIX_LOCKABLE});
        rs.submit(b);

        b = rs.createBatch(si, id);
        b.setMixins(id, new Name[0]);
        rs.submit(b);

        NodeInfo nInfo = rs.getNodeInfo(si, id);
        assertEquals(0, nInfo.getMixins().length);
    }
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

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.