Package org.apache.jackrabbit.core.data

Examples of org.apache.jackrabbit.core.data.RandomInputStream


    }

    @Test
    public void testReferenceBinary() throws RepositoryException {
        ValueFactory valueFactory = getAdminSession().getValueFactory();
        Binary binary = valueFactory.createBinary(new RandomInputStream(1, 256*1024));

        String reference = binary instanceof ReferenceBinary
            ? ((ReferenceBinary) binary).getReference()
            : null;

View Full Code Here


    }

    @Test
    public void testReferenceBinary() throws RepositoryException {
        ValueFactory valueFactory = getAdminSession().getValueFactory();
        Binary binary = valueFactory.createBinary(new RandomInputStream(1, 256 * 1024));

        String reference = binary instanceof ReferenceBinary
            ? ((ReferenceBinary) binary).getReference()
            : null;

View Full Code Here

    public void testReferenceBinaryExchangeWithSharedRepository() throws Exception {

        Session firstSession = superuser;

        // create a binary
        Binary b = vf.createBinary(new RandomInputStream(1, STREAM_LENGTH));

        ReferenceBinary referenceBinary = null;
        if (b instanceof ReferenceBinary) {
            referenceBinary = (ReferenceBinary) b;
        }
View Full Code Here

        LOG.info(Thread.currentThread().getName() + " started.");
        ArrayList<DataRecord> list = new ArrayList<DataRecord>();
        HashMap<DataRecord, Integer> map = new HashMap<DataRecord, Integer>();
        for (int i = 0; i < 100; i++) {
            int size = 100 + i * 10;
            RandomInputStream in = new RandomInputStream(size + offset, size);
            DataRecord rec = ds.addRecord(in);
            list.add(rec);
            map.put(rec, new Integer(size));
        }
        Random random = new Random(1);
        for (int i = 0; i < list.size(); i++) {
            int pos = random.nextInt(list.size());
            DataRecord rec = list.get(pos);
            int size = map.get(rec);
            rec = ds.getRecord(rec.getIdentifier());
            assertEquals(size, rec.getLength());
            InputStream in = rec.getStream();
            RandomInputStream expected = new RandomInputStream(size + offset,
                size);
            if (random.nextBoolean()) {
                in = readInputStreamRandomly(in, random);
            }
            assertEquals(expected, in);
View Full Code Here

     *      Indexing ignored file types creates some garbage
     */
    public void testEmptyParser() throws Exception {

        InternalValue val = InternalValue
                .create(new RandomInputStream(1, 1024));

        Metadata metadata = new Metadata();
        metadata.set(Metadata.CONTENT_TYPE, "application/java-archive");
        metadata.set(Metadata.CONTENT_ENCODING, "UTF-8");

View Full Code Here

        LOG.info(Thread.currentThread().getName() + " started.");
        ArrayList<DataRecord> list = new ArrayList<DataRecord>();
        HashMap<DataRecord, Integer> map = new HashMap<DataRecord, Integer>();
        for (int i = 0; i < 100; i++) {
            int size = 100 + i * 10;
            RandomInputStream in = new RandomInputStream(size + offset, size);
            DataRecord rec = ds.addRecord(in);
            list.add(rec);
            map.put(rec, new Integer(size));
        }
        Random random = new Random(1);
        for (int i = 0; i < list.size(); i++) {
            int pos = random.nextInt(list.size());
            DataRecord rec = list.get(pos);
            int size = map.get(rec);
            rec = ds.getRecord(rec.getIdentifier());
            assertEquals(size, rec.getLength());
            InputStream in = rec.getStream();
            RandomInputStream expected = new RandomInputStream(size + offset,
                size);
            if (random.nextBoolean()) {
                in = readInputStreamRandomly(in, random);
            }
            assertEquals(expected, in);
View Full Code Here

    }

    @Test
    public void testReferenceBinary() throws RepositoryException {
        ValueFactory valueFactory = getAdminSession().getValueFactory();
        Binary binary = valueFactory.createBinary(new RandomInputStream(1, 256 * 1024));

        String reference = binary instanceof ReferenceBinary
            ? ((ReferenceBinary) binary).getReference()
            : null;

View Full Code Here

    @Test
    public void testReferenceBinaryExchangeWithSharedRepository() throws Exception {
        Session firstSession = createAdminSession();

        // create a binary
        Binary b = firstSession.getValueFactory().createBinary(new RandomInputStream(1, STREAM_LENGTH));

        ReferenceBinary referenceBinary = null;
        if (b instanceof ReferenceBinary) {
            referenceBinary = (ReferenceBinary) b;
        }
View Full Code Here

    }

    @Test
    public void testReferenceBinary() throws RepositoryException {
        ValueFactory valueFactory = getAdminSession().getValueFactory();
        Binary binary = valueFactory.createBinary(new RandomInputStream(1, 256 * 1024));

        String reference = binary instanceof ReferenceBinary
            ? ((ReferenceBinary) binary).getReference()
            : null;

View Full Code Here

    }

    @Test
    public void testReferenceBinary() throws RepositoryException {
        ValueFactory valueFactory = getAdminSession().getValueFactory();
        Binary binary = valueFactory.createBinary(new RandomInputStream(1, 256*1024));

        String reference = binary instanceof ReferenceBinary
            ? ((ReferenceBinary) binary).getReference()
            : null;

View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.core.data.RandomInputStream

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.