/** * Returns the disk store as a string. Serves calling methods for both * factory attributes and actual disk store. */ private static synchronized String diskStoreToString(String diskStoreName, DiskStore d) { StringBuffer buf = new StringBuffer(); buf.append("\n diskStoreName: " + diskStoreName); buf.append("\n allowForceCompaction: " + d.getAllowForceCompaction()); buf.append("\n autoCompact: " + d.getAutoCompact()); buf.append("\n compactionThreshold: " + d.getCompactionThreshold()); buf.append("\n diskDirSizes: " + asList(d.getDiskDirSizes())); buf.append("\n diskDirs: " + Arrays.asList(d.getDiskDirs())); buf.append("\n maxOplogSize: " + d.getMaxOplogSize()); buf.append("\n queueSize: " + d.getQueueSize()); buf.append("\n timeInterval: " + d.getTimeInterval()); buf.append("\n writeBufferSize: " + d.getWriteBufferSize()); return buf.toString(); }
public GfxdDiskStoreDescriptor(DataDictionary dd, UUID id,DiskStore ds, String dirAndSize) { super(dd); this.id = id; this.diskStoreName = ds.getName(); this.maxLogSize = ds.getMaxOplogSize(); this.autoCompact = Boolean.toString(ds.getAutoCompact()); this.allowForceCompaction = Boolean.toString(ds.getAllowForceCompaction()); this.compactionThreshold = ds.getCompactionThreshold(); this.timeInterval = ds.getTimeInterval(); this.writeBufferSize = ds.getWriteBufferSize(); this.queueSize = ds.getQueueSize(); this.dirAndSize = dirAndSize; }
public GfxdDiskStoreDescriptor(DataDictionary dd, UUID id,DiskStore ds, String dirAndSize) { super(dd); this.id = id; this.diskStoreName = ds.getName(); this.maxLogSize = ds.getMaxOplogSize(); this.autoCompact = Boolean.toString(ds.getAutoCompact()); this.allowForceCompaction = Boolean.toString(ds.getAllowForceCompaction()); this.compactionThreshold = ds.getCompactionThreshold(); this.timeInterval = ds.getTimeInterval(); this.writeBufferSize = ds.getWriteBufferSize(); this.queueSize = ds.getQueueSize(); this.dirAndSize = dirAndSize; }
public GfxdDiskStoreDescriptor(DataDictionary dd, UUID id,DiskStore ds, String dirAndSize) { super(dd); this.id = id; this.diskStoreName = ds.getName(); this.maxLogSize = ds.getMaxOplogSize(); this.autoCompact = Boolean.toString(ds.getAutoCompact()); this.allowForceCompaction = Boolean.toString(ds.getAllowForceCompaction()); this.compactionThreshold = ds.getCompactionThreshold(); this.timeInterval = ds.getTimeInterval(); this.writeBufferSize = ds.getWriteBufferSize(); this.queueSize = ds.getQueueSize(); this.dirAndSize = dirAndSize; }
if (generateDefaults() || ds.getWriteBufferSize() != DiskStoreFactory.DEFAULT_WRITE_BUFFER_SIZE) atts.addAttribute("", "", WRITE_BUFFER_SIZE, "", String.valueOf(ds.getWriteBufferSize()));
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() {
if (generateDefaults() || ds.getWriteBufferSize() != DiskStoreFactory.DEFAULT_WRITE_BUFFER_SIZE) atts.addAttribute("", "", WRITE_BUFFER_SIZE, "", String.valueOf(ds.getWriteBufferSize()));
throw new RuntimeException(LocalizedStrings.DiskStoreAttributesCreation_TIMEINTERVAL_OF_0_IS_NOT_THE_SAME_THIS_1_OTHER_2.toLocalizedString(new Object[] {name, this.timeInterval, other.getTimeInterval()})); if (this.writeBufferSize != other.getWriteBufferSize()) { throw new RuntimeException(LocalizedStrings.DiskStoreAttributesCreation_WRITEBUFFERSIZE_OF_0_IS_NOT_THE_SAME_THIS_1_OTHER_2.toLocalizedString(new Object[] {name, this.writeBufferSize, other.getWriteBufferSize()}));
throw new RuntimeException(LocalizedStrings.DiskStoreAttributesCreation_TIMEINTERVAL_OF_0_IS_NOT_THE_SAME_THIS_1_OTHER_2.toLocalizedString(new Object[] {name, this.timeInterval, other.getTimeInterval()})); if (this.writeBufferSize != other.getWriteBufferSize()) { throw new RuntimeException(LocalizedStrings.DiskStoreAttributesCreation_WRITEBUFFERSIZE_OF_0_IS_NOT_THE_SAME_THIS_1_OTHER_2.toLocalizedString(new Object[] {name, this.writeBufferSize, other.getWriteBufferSize()}));
public void testGetDefaultInstance() { DiskStoreFactory dsf = cache.createDiskStoreFactory(); String name = "testGetDefaultInstance"; assertEquals(null, cache.findDiskStore(name)); DiskStore ds = dsf.create(name); assertEquals(ds, cache.findDiskStore(name)); assertEquals(name, ds.getName()); assertEquals(DiskStoreFactory.DEFAULT_AUTO_COMPACT, ds.getAutoCompact()); assertEquals(DiskStoreFactory.DEFAULT_COMPACTION_THRESHOLD, ds.getCompactionThreshold()); assertEquals(DiskStoreFactory.DEFAULT_ALLOW_FORCE_COMPACTION, ds.getAllowForceCompaction()); assertEquals(DiskStoreFactory.DEFAULT_MAX_OPLOG_SIZE, ds.getMaxOplogSize()); assertEquals(DiskStoreFactory.DEFAULT_TIME_INTERVAL, ds.getTimeInterval()); assertEquals(DiskStoreFactory.DEFAULT_WRITE_BUFFER_SIZE, ds.getWriteBufferSize()); assertEquals(DiskStoreFactory.DEFAULT_QUEUE_SIZE, ds.getQueueSize()); if (!Arrays.equals(DiskStoreFactory.DEFAULT_DISK_DIRS, ds.getDiskDirs())) { fail("expected=" + Arrays.toString(DiskStoreFactory.DEFAULT_DISK_DIRS) + " had=" + Arrays.toString(ds.getDiskDirs())); } if (!Arrays.equals(DiskStoreFactory.DEFAULT_DISK_DIR_SIZES, ds.getDiskDirSizes())) { fail("expected=" + Arrays.toString(DiskStoreFactory.DEFAULT_DISK_DIR_SIZES) + " had=" + Arrays.toString(ds.getDiskDirSizes())); } }
da.getQueueSize() != d.getQueueSize() || da.getTimeInterval() != d.getTimeInterval() || da.getWriteBufferSize() != d.getWriteBufferSize()) { return false;
diskStoreDetails.setQueueSize(diskStore.getQueueSize()); diskStoreDetails.setTimeInterval(diskStore.getTimeInterval()); diskStoreDetails.setWriteBufferSize(diskStore.getWriteBufferSize()); diskStoreDetails.setDiskUsageWarningPercentage(diskStore.getDiskUsageWarningPercentage()); diskStoreDetails.setDiskUsageCriticalPercentage(diskStore.getDiskUsageCriticalPercentage());
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()); }
diskStoreDetails.setQueueSize(diskStore.getQueueSize()); diskStoreDetails.setTimeInterval(diskStore.getTimeInterval()); diskStoreDetails.setWriteBufferSize(diskStore.getWriteBufferSize());
oneOf(mockDiskStore).getTimeInterval(); will(returnValue(timeInterval)); oneOf(mockDiskStore).getWriteBufferSize(); will(returnValue(writeBufferSize)); allowing(mockDiskStore).getDiskDirs();