org.apache.jackrabbit.core.data.DataStore.getMinRecordLength()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(103)

本文整理了Java中org.apache.jackrabbit.core.data.DataStore.getMinRecordLength()方法的一些代码示例,展示了DataStore.getMinRecordLength()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DataStore.getMinRecordLength()方法的具体详情如下:
包路径:org.apache.jackrabbit.core.data.DataStore
类名称:DataStore
方法名:getMinRecordLength

DataStore.getMinRecordLength介绍

[英]Get the minimum size of an object that should be stored in this data store. Depending on the overhead and configuration, each store may return a different value.
[中]获取应存储在此数据存储中的对象的最小大小。根据开销和配置,每个存储可能返回不同的值。

代码示例

代码示例来源:origin: apache/jackrabbit

/**
 * Get the minimum size of an object that should be stored in the primary
 * data store.
 * 
 * @return the minimum size in bytes
 */
public int getMinRecordLength() {
  return primaryDataStore.getMinRecordLength();
}

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

/**
 * Get the minimum size of an object that should be stored in the primary
 * data store.
 * 
 * @return the minimum size in bytes
 */
public int getMinRecordLength() {
  return primaryDataStore.getMinRecordLength();
}

代码示例来源:origin: apache/jackrabbit-oak

@Override
public int getMinRecordLength() {
  return delegate.getMinRecordLength();
}

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-data

/**
 * Get the minimum size of an object that should be stored in the primary
 * data store.
 * 
 * @return the minimum size in bytes
 */
public int getMinRecordLength() {
  return primaryDataStore.getMinRecordLength();
}

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

@Override
public int getMinRecordLength() {
  return delegate.getMinRecordLength();
}

代码示例来源:origin: org.apache.jackrabbit/oak-blob-plugins

@Override
public int getMinRecordLength() {
  return delegate.getMinRecordLength();
}

代码示例来源:origin: org.apache.jackrabbit/oak-upgrade

@Override
public int getMinRecordLength() {
  return getDelegate().getMinRecordLength();
}

代码示例来源:origin: apache/jackrabbit-oak

@Override
public int getMinRecordLength() {
  return getDelegate().getMinRecordLength();
}

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

int maxMemorySize = Math.max(0, delegate.getMinRecordLength() + 1);
byte[] buffer = new byte[maxMemorySize];
int pos = 0, len = maxMemorySize;

代码示例来源:origin: org.apache.jackrabbit/oak-blob-plugins

int maxMemorySize = Math.max(0, delegate.getMinRecordLength() + 1);
byte[] buffer = new byte[maxMemorySize];
int pos = 0, len = maxMemorySize;

代码示例来源:origin: apache/jackrabbit-oak

int maxMemorySize = Math.max(0, delegate.getMinRecordLength() + 1);
byte[] buffer = new byte[maxMemorySize];
int pos = 0, len = maxMemorySize;

代码示例来源:origin: apache/jackrabbit

int maxMemorySize;
if (store != null) {
  maxMemorySize = store.getMinRecordLength() - 1;
} else {
  maxMemorySize = MIN_BLOB_FILE_SIZE;

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-core

int maxMemorySize;
if (store != null) {
  maxMemorySize = store.getMinRecordLength() - 1;
} else {
  maxMemorySize = MIN_BLOB_FILE_SIZE;

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void testPropertySetup() throws Exception {
  System.setProperty(DS_CLASS_NAME, FileDataStore.class.getName());
  System.setProperty("ds.minRecordLength", "1000");
  DataStoreBlobStore dbs = getBlobStore();
  assertEquals(1000, dbs.getDataStore().getMinRecordLength());
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void testAddOnTrackError() throws Exception {
  int maxInlineSize = 300;
  byte[] data = new byte[maxInlineSize];
  new Random().nextBytes(data);
  DataStore mockedDS = mock(DataStore.class);
  when(mockedDS.getMinRecordLength()).thenReturn(maxInlineSize);
  DataStoreBlobStore ds = new DataStoreBlobStore(mockedDS);
  BlobIdTracker mockedTracker = mock(BlobIdTracker.class);
  doThrow(new IOException("Mocking tracking error")).when(mockedTracker).add(any(String.class));
  ds.addTracker(mockedTracker);
  String id = ds.writeBlob(new ByteArrayInputStream(data));
  assertTrue(IOUtils.contentEquals(new ByteArrayInputStream(data), ds.getInputStream(id)));
}

代码示例来源:origin: apache/jackrabbit-oak

when(mockedDS.getMinRecordLength()).thenReturn(maxInlineSize);
when(mockedDS.getRecord(testDI)).thenReturn(testDR);
when(mockedDS.getRecordIfStored(testDI)).thenReturn(testDR);

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void testInlineBinary() throws DataStoreException, IOException {
  int maxInlineSize = 300;
  DataStore mockedDS = mock(DataStore.class);
  when(mockedDS.getMinRecordLength()).thenReturn(maxInlineSize);
  DataStoreBlobStore ds = new DataStoreBlobStore(mockedDS);
  byte[] data = new byte[maxInlineSize];
  new Random().nextBytes(data);
  DataRecord dr = ds.addRecord(new ByteArrayInputStream(data));
  assertTrue(InMemoryDataRecord.isInstance(dr.getIdentifier().toString()));
  assertTrue(IOUtils.contentEquals(new ByteArrayInputStream(data), dr.getStream()));
  assertTrue(IOUtils.contentEquals(new ByteArrayInputStream(data),
      new BlobStoreInputStream(ds, dr.getIdentifier().toString(), 0)));
  assertEquals(dr, ds.getRecordIfStored(dr.getIdentifier()));
  assertEquals(dr, ds.getRecord(dr.getIdentifier()));
  //Check for BlobStore methods
  assertEquals(maxInlineSize, ds.getBlobLength(dr.getIdentifier().toString()));
  assertEquals(dr.getIdentifier().toString(), BlobId.of(ds.writeBlob(new ByteArrayInputStream(data))).blobId);
}

相关文章