public void testWriteBufferSize() { DiskStoreFactory dsf = cache.createDiskStoreFactory(); String name = "testWriteBufferSize"; DiskStore ds = dsf .setWriteBufferSize(0) .create(name); assertEquals(0, ds.getWriteBufferSize()); name = "testWriteBufferSize2"; ds = dsf .setWriteBufferSize(Integer.MAX_VALUE) .create(name); assertEquals(Integer.MAX_VALUE, ds.getWriteBufferSize()); // check illegal stuff try { dsf.setWriteBufferSize(-1); fail("expected IllegalArgumentException"); } catch (IllegalArgumentException expected) { } } public void testTimeInterval() {
/** * Configures the disk store factory using this disk store description. */ public void configure(DiskStoreFactory f) { f.setAllowForceCompaction(this.getAllowForceCompaction().booleanValue()); f.setAutoCompact(this.getAutoCompact().booleanValue()); f.setCompactionThreshold(this.getCompactionThreshold().intValue()); f.setDiskDirsAndSizes(this.getDiskDirs(), this.getDiskDirSizes()); f.setMaxOplogSize(this.getMaxOplogSize().longValue()); f.setQueueSize(this.getQueueSize().intValue()); f.setTimeInterval(this.getTimeInterval().longValue()); f.setWriteBufferSize(this.getWriteBufferSize().intValue()); }
dsf.setWriteBufferSize(ncn.getValue().getInt());
dsf.setWriteBufferSize(ncn.getValue().getInt());
dsf.setWriteBufferSize(ncn.getValue().getInt());
.setMaxOplogSize(2) .setTimeInterval(10) .setWriteBufferSize(15) .setQueueSize(12) .setDiskDirsAndSizes(dirs1, new int[] {1024*20}) .setMaxOplogSize(1) .setTimeInterval(9) .setWriteBufferSize(14) .setQueueSize(11) .setDiskDirsAndSizes(dirs2, new int[] {1024*40})
public void testNonDefaults() { DiskStoreFactory dsf = cache.createDiskStoreFactory(); String name = "testNonDefaults"; DiskStore ds = dsf .setAutoCompact(!DiskStoreFactory.DEFAULT_AUTO_COMPACT) .setCompactionThreshold(DiskStoreFactory.DEFAULT_COMPACTION_THRESHOLD/2) .setAllowForceCompaction(!DiskStoreFactory.DEFAULT_ALLOW_FORCE_COMPACTION) .setMaxOplogSize(DiskStoreFactory.DEFAULT_MAX_OPLOG_SIZE+1) .setTimeInterval(DiskStoreFactory.DEFAULT_TIME_INTERVAL+1) .setWriteBufferSize(DiskStoreFactory.DEFAULT_WRITE_BUFFER_SIZE+1) .setQueueSize(DiskStoreFactory.DEFAULT_QUEUE_SIZE+1) .create(name); assertEquals(!DiskStoreFactory.DEFAULT_AUTO_COMPACT, ds.getAutoCompact()); assertEquals(DiskStoreFactory.DEFAULT_COMPACTION_THRESHOLD/2, ds.getCompactionThreshold()); assertEquals(!DiskStoreFactory.DEFAULT_ALLOW_FORCE_COMPACTION, ds.getAllowForceCompaction()); assertEquals(DiskStoreFactory.DEFAULT_MAX_OPLOG_SIZE+1, ds.getMaxOplogSize()); assertEquals(DiskStoreFactory.DEFAULT_TIME_INTERVAL+1, ds.getTimeInterval()); assertEquals(DiskStoreFactory.DEFAULT_WRITE_BUFFER_SIZE+1, ds.getWriteBufferSize()); assertEquals(DiskStoreFactory.DEFAULT_QUEUE_SIZE+1, ds.getQueueSize()); }