Package org.apache.jackrabbit.oak.plugins.blob.datastore

Examples of org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore$Data


     *
     * @return Contentinfo with contentType Data.
     */
    private ContentInfo makeData(SafeContents safe) throws IOException,
      ASN1Exception {
  Data data = null;
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  DEREncoder encoder = new DEREncoder(baos);
  safe.encode(encoder);
  data = new Data(baos.toByteArray());
  baos.close();
  ContentInfo cInfo = new ContentInfo(data);
  return cInfo;
    }
View Full Code Here


  // check version before any other operations
  Request request = new Request (display, major_opcode, 0, 3);
  request.write4 (CLIENT_MAJOR_VERSION);
  request.write4 (CLIENT_MINOR_VERSION);

  Data reply = display.read_reply (request);
  server_major_version = reply.read4 (8);
  server_minor_version = reply.read4 (12);
    }
View Full Code Here

     */
    public long getOverlayWindow (Window win) {
  Request request = new Request (display, major_opcode, 7, 2);
  request.write4 (win.id);

  Data reply = display.read_reply (request);
  if (reply == null) {
      return -1;
  }

  return reply.read4(8);
    }
View Full Code Here

    // check version before any other operations
    Request request = new Request (display, major_opcode, 0, 3);
    request.write4 (CLIENT_MAJOR_VERSION);
    request.write4 (CLIENT_MINOR_VERSION);
 
    Data reply = display.read_reply (request);
    server_major_version = reply.read2 (8);
    server_minor_version = reply.read2 (10);
  }
View Full Code Here

    @Test
    public void testDataStoreBlob() throws Exception {
        FileDataStore fds = new FileDataStore();
        fds.setMinRecordLength(4092);
        fds.init(getWorkDir().getAbsolutePath());
        DataStoreBlobStore dbs = new DataStoreBlobStore(fds);
        nodeStore = getNodeStore(dbs);

        //Test for Blob which get inlined
        byte[] data = new byte[fds.getMinRecordLength()-2];
        new Random().nextBytes(data);
        Blob b1 = testCreateAndRead(nodeStore.createBlob(new ByteArrayInputStream(data)));
        assertTrue(b1 instanceof SegmentBlob);
        assertNull(((SegmentBlob) b1).getBlobId());

        //Test for Blob which need to be pushed to BlobStore
        byte[] data2 = new byte[Segment.MEDIUM_LIMIT + 1];
        new Random().nextBytes(data2);
        Blob b2 = testCreateAndRead(nodeStore.createBlob(new ByteArrayInputStream(data2)));
        assertTrue(b2 instanceof SegmentBlob);
        assertNotNull(b2.getReference());
        InputStream is = dbs.getInputStream(((SegmentBlob) b2).getBlobId());
        assertNotNull(IOUtils.contentEquals(new ByteArrayInputStream(data2), is));
        is.close();
    }
View Full Code Here

    @Test
    public void testDataStoreBlob() throws Exception {
        FileDataStore fds = new FileDataStore();
        fds.setMinRecordLength(4092);
        fds.init(getWorkDir().getAbsolutePath());
        DataStoreBlobStore dbs = new DataStoreBlobStore(fds);
        nodeStore = getNodeStore(dbs);

        //Test for Blob which get inlined
        byte[] data = new byte[fds.getMinRecordLength()-2];
        new Random().nextBytes(data);
        Blob b1 = testCreateAndRead(nodeStore.createBlob(new ByteArrayInputStream(data)));
        assertTrue(b1 instanceof SegmentBlob);
        assertNull(((SegmentBlob) b1).getBlobId());

        //Test for Blob which need to be pushed to BlobStore
        byte[] data2 = new byte[Segment.MEDIUM_LIMIT + 1];
        new Random().nextBytes(data2);
        Blob b2 = testCreateAndRead(nodeStore.createBlob(new ByteArrayInputStream(data2)));
        assertTrue(b2 instanceof SegmentBlob);
        assertNotNull(b2.getReference());
        assertNotNull(dbs.getRecordIfStored(new DataIdentifier(((SegmentBlob) b2).getBlobId())));
    }
View Full Code Here

    @Test
    public void testDataStoreBlob() throws Exception {
        FileDataStore fds = new FileDataStore();
        fds.setMinRecordLength(4092);
        fds.init(getWorkDir().getAbsolutePath());
        DataStoreBlobStore dbs = new DataStoreBlobStore(fds);
        nodeStore = getNodeStore(dbs);

        //Test for Blob which get inlined
        byte[] data = new byte[fds.getMinRecordLength()-2];
        new Random().nextBytes(data);
        Blob b1 = testCreateAndRead(nodeStore.createBlob(new ByteArrayInputStream(data)));
        assertTrue(b1 instanceof SegmentBlob);
        assertNull(b1.getReference());

        //Test for Blob which need to be pushed to BlobStore
        byte[] data2 = new byte[Segment.MEDIUM_LIMIT + 1];
        new Random().nextBytes(data2);
        Blob b2 = testCreateAndRead(nodeStore.createBlob(new ByteArrayInputStream(data2)));
        assertNotNull(b2.getReference());
        assertNotNull(dbs.getRecordIfStored(new DataIdentifier(b2.getReference())));
    }
View Full Code Here

                    String className = System.getProperty("dataStore");
                    if(className != null){
                        DataStore ds = Class.forName(className).asSubclass(DataStore.class).newInstance();
                        PropertiesUtil.populate(ds, getConfig(), false);
                        ds.init(null);
                        blobStore = new DataStoreBlobStore(ds);
                    }
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
View Full Code Here

    public HashSet<String> setUp() throws Exception {
        FileDataStore fds = new FileDataStore();
        fds.setMinRecordLength(4092);
        fds.init(getWorkDir().getAbsolutePath());
        blobStore = new DataStoreBlobStore(fds);
        nodeStore = getNodeStore(blobStore);

        HashSet<String> set = new HashSet<String>();

        NodeBuilder a = nodeStore.getRoot().builder();
View Full Code Here

    }

    @Test
    public void testDataStoreBlob() throws Exception {
        FileDataStore fds = createFileDataStore();
        DataStoreBlobStore dbs = new DataStoreBlobStore(fds);
        nodeStore = getNodeStore(dbs);

        //Test for Blob which get inlined
        Blob b1 = testCreateAndRead(createBlob(fds.getMinRecordLength()-2));
        assertTrue(b1 instanceof SegmentBlob);
        assertNull(((SegmentBlob) b1).getBlobId());

        //Test for Blob which need to be pushed to BlobStore
        byte[] data2 = new byte[Segment.MEDIUM_LIMIT + 1];
        new Random().nextBytes(data2);
        Blob b2 = testCreateAndRead(nodeStore.createBlob(new ByteArrayInputStream(data2)));
        assertTrue(b2 instanceof SegmentBlob);
        assertNotNull(b2.getReference());
        InputStream is = dbs.getInputStream(((SegmentBlob) b2).getBlobId());
        assertNotNull(IOUtils.contentEquals(new ByteArrayInputStream(data2), is));
        is.close();
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore$Data

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.