Package org.apache.jackrabbit.spi

Examples of org.apache.jackrabbit.spi.Batch


    }

    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

    }

    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 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 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

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

        Batch b = rs.createBatch(si, nid);
        b.addProperty(nid, propName, new QValue[0]);
        rs.submit(b);

        PropertyId pid = getPropertyId(nid, propName);
        PropertyInfo pi = rs.getPropertyInfo(si, pid);
        assertTrue(pi.isMultiValued());
View Full Code Here

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

        Batch b = rs.createBatch(si, nid);
        b.addProperty(nid, propName, new QValue[] { rs.getQValueFactory().create(true)});
        rs.submit(b);

        PropertyId pid = getPropertyId(nid, propName);
        b = rs.createBatch(si, pid);
        b.setValue(pid, new QValue[0]);
        rs.submit(b);

        PropertyInfo pi = rs.getPropertyInfo(si, pid);
        assertTrue(pi.isMultiValued());
        assertEquals(Arrays.asList(new QValue[0]), Arrays.asList(pi.getValues()));
View Full Code Here

    public void testMultiValuedProperty() throws RepositoryException {
        NodeId nid = getNodeId(testPath);
        Name propName = resolver.getQName("mvProperty2");
        QValue[] vs = new QValue[] {rs.getQValueFactory().create(111), rs.getQValueFactory().create(222), rs.getQValueFactory().create(333)};

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

        PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
        assertTrue(pi.isMultiValued());
        assertEquals(Arrays.asList(vs), Arrays.asList(pi.getValues()));
View Full Code Here

    public void testSetBinaryValue() throws RepositoryException, IOException {
        NodeId nid = getNodeId(testPath);
        Name propName = resolver.getQName("binProp");

        Batch b = rs.createBatch(si, nid);
        b.addProperty(nid, propName, rs.getQValueFactory().create(new byte[] {'a', 'b', 'c'}));
        rs.submit(b);

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

    public void testSetEmptyBinaryValue() throws RepositoryException, IOException {
        NodeId nid = getNodeId(testPath);
        Name propName = resolver.getQName("binProp");

        Batch b = rs.createBatch(si, nid);
        b.addProperty(nid, propName, rs.getQValueFactory().create(new byte[0]));
        rs.submit(b);

        PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
        assertFalse(pi.isMultiValued());
        InputStream in = pi.getValues()[0].getStream();
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.