@Test public void shouldHandleNoDrivesWithThatName() { Optional<Drive> diskInfo = provider.driveByName("/dev/sda3"); assertFalse(diskInfo.isPresent()); }
@Override public Optional<Drive> driveByName(String name) { return hal.getDiskStores().stream().filter(n -> n.getName().equalsIgnoreCase(name)).map(d -> new Drive( d.getModel(), d.getName(), getSerial(d), d.getSize(), findAssociatedFileStore(d).orElse(Empty.OS_PARTITION), d.getPartitions().stream() .map(p -> new Partition( p.getIdentification(), p.getName(), p.getType(), p.getUuid(), p.getSize(), p.getMajor(), p.getMinor(), p.getMountPoint() )).collect(Collectors.toList()) )).findAny(); }
DefaultDriveProvider implements DriveMetrics { @Override public Optional<Drive> driveByName(String name) { return hal.getDiskStores().stream().filter(n -> n.getName().equalsIgnoreCase(name)).map(d -> new Drive( d.getModel(), d.getName(), getSerial(d), d.getSize(), findAssociatedFileStore(d).orElse(Empty.OS_PARTITION), d.getPartitions().stream() .map(p -> new Partition( p.getIdentification(), p.getName(), p.getType(), p.getUuid(), p.getSize(), p.getMajor(), p.getMinor(), p.getMountPoint() )).collect(Collectors.toList()) )).findAny(); } }
DefaultDriveProvider implements DriveMetrics { @Override public Optional<Drive> driveByName(String name) { return hal.getDiskStores().stream().filter(n -> n.getName().equalsIgnoreCase(name)).map(d -> new Drive( d.getModel(), d.getName(), getSerial(d), d.getSize(), findAssociatedFileStore(d).orElse(Empty.OS_PARTITION), d.getPartitions().stream() .map(p -> new Partition( p.getIdentification(), p.getName(), p.getType(), p.getUuid(), p.getSize(), p.getMajor(), p.getMinor(), p.getMountPoint() )).collect(Collectors.toList()) )).findAny(); } protected  DefaultDriveProvider(OperatingSystem operatingSystem, HardwareAbstractionLayer hal, SpeedMeasurementManager speedMeasurementManager); }
DefaultDriveProvider implements DriveMetrics { @Override public Optional<Drive> driveByName(String name) { return hal.getDiskStores().stream().filter(n -> n.getName().equalsIgnoreCase(name)).map(d -> new Drive( d.getModel(), d.getName(), getSerial(d), d.getSize(), findAssociatedFileStore(d).orElse(Empty.OS_PARTITION), d.getPartitions().stream() .map(p -> new Partition( p.getIdentification(), p.getName(), p.getType(), p.getUuid(), p.getSize(), p.getMajor(), p.getMinor(), p.getMountPoint() )).collect(Collectors.toList()) )).findAny(); } protected  DefaultDriveProvider(OperatingSystem operatingSystem, HardwareAbstractionLayer hal, SpeedMeasurementManager speedMeasurementManager); void register(); @Override List<Drive> drives(); @Override List<DriveLoad> driveLoads(); @Override Optional<DriveLoad> driveLoadByName(String name); @Override Optional<Drive> driveByName(String name); DriveHealth diskHealth(String name); }
DefaultDriveProvider implements DriveMetrics { @Override public Optional<Drive> driveByName(String name) { return hal.getDiskStores().stream().filter(n -> n.getName().equalsIgnoreCase(name)).map(d -> new Drive( d.getModel(), d.getName(), getSerial(d), d.getSize(), findAssociatedFileStore(d).orElse(Empty.OS_PARTITION), d.getPartitions().stream() .map(p -> new Partition( p.getIdentification(), p.getName(), p.getType(), p.getUuid(), p.getSize(), p.getMajor(), p.getMinor(), p.getMountPoint() )).collect(Collectors.toList()) )).findAny(); } protected  DefaultDriveProvider(OperatingSystem operatingSystem, HardwareAbstractionLayer hal, SpeedMeasurementManager speedMeasurementManager); void register(); @Override List<Drive> drives(); @Override List<DriveLoad> driveLoads(); @Override Optional<DriveLoad> driveLoadByName(String name); @Override Optional<Drive> driveByName(String name); DriveHealth diskHealth(String name);  }