DirectoryStrategy { public void setFolders(List<String> folders) throws DiskSpaceInsufficientException { boolean hasSpace = false; for (String folder : folders) { if (CommonUtils.hasSpace(folder)) { hasSpace = true; break; } } if (!hasSpace) { IoTDBDescriptor.getInstance().getConfig().setReadOnly(true); throw new DiskSpaceInsufficientException(folders); } this.folders = folders; }  void setFolders(List<String> folders); abstract int nextFolderIndex();  }
@Test public void testAllDiskFull() { for (int i = 0; i < dataDirList.size(); i++) { PowerMockito.when(CommonUtils.hasSpace(dataDirList.get(i))).thenReturn(false); } SequenceStrategy sequenceStrategy = new SequenceStrategy(); try { sequenceStrategy.setFolders(dataDirList); fail(); } catch (DiskSpaceInsufficientException e) { } MaxDiskUsableSpaceFirstStrategy maxDiskUsableSpaceFirstStrategy = new MaxDiskUsableSpaceFirstStrategy(); try { maxDiskUsableSpaceFirstStrategy.setFolders(dataDirList); fail(); } catch (DiskSpaceInsufficientException e) { } MinFolderOccupiedSpaceFirstStrategy minFolderOccupiedSpaceFirstStrategy = new MinFolderOccupiedSpaceFirstStrategy(); try { minFolderOccupiedSpaceFirstStrategy.setFolders(dataDirList); fail(); } catch (DiskSpaceInsufficientException e) { } }