Package org.apache.jackrabbit.mongomk.command

Examples of org.apache.jackrabbit.mongomk.command.ReadBlobCommandMongo


        return commandExecutor.execute(command);
    }

    @Override
    public int readBlob(String blobId, long blobOffset, byte[] buffer, int bufferOffset, int length) throws Exception {
        Command<Integer> command = new ReadBlobCommandMongo(mongoConnection, blobId, blobOffset, buffer, bufferOffset, length);
        return commandExecutor.execute(command);
    }
View Full Code Here


    }

    @Test
    public void testReadBlobComplete() throws Exception {
        byte[] buffer = new byte[blob.length];
        ReadBlobCommandMongo command = new ReadBlobCommandMongo(mongoConnection, blobId, 0, buffer, 0, blob.length);
        int totalBytes = command.execute();

        Assert.assertEquals(blob.length, totalBytes);
        Assert.assertTrue(Arrays.equals(blob, buffer));
    }
View Full Code Here

    }

    @Test
    public void testReadBlobRangeFromEnd() throws Exception {
        byte[] buffer = new byte[blob.length / 2];
        ReadBlobCommandMongo command = new ReadBlobCommandMongo(mongoConnection, blobId, (blob.length / 2) - 1,
                buffer, 0, blob.length / 2);
        int totalBytes = command.execute();

        Assert.assertEquals(blob.length / 2, totalBytes);
        for (int i = 0; i < buffer.length; i++) {
            Assert.assertEquals(blob[((blob.length / 2) - 1) + i], buffer[i]);
        }
View Full Code Here

    }

    @Test
    public void testReadBlobRangeFromStart() throws Exception {
        byte[] buffer = new byte[blob.length / 2];
        ReadBlobCommandMongo command = new ReadBlobCommandMongo(mongoConnection, blobId, 0, buffer, 0,
                blob.length / 2);
        int totalBytes = command.execute();

        Assert.assertEquals(blob.length / 2, totalBytes);
        for (int i = 0; i < buffer.length; i++) {
            Assert.assertEquals(blob[i], buffer[i]);
        }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.mongomk.command.ReadBlobCommandMongo

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.