use of com.thoughtworks.go.domain.DiskSpace in project gocd by gocd.
the class AgentRuntimeInfo method freeDiskSpace.
public DiskSpace freeDiskSpace() {
Long space = usableSpace;
AgentRuntimeStatus status = runtimeStatus;
return (status == AgentRuntimeStatus.Missing || status == AgentRuntimeStatus.LostContact || space == null) ? DiskSpace.unknownDiskSpace() : new DiskSpace(space);
}
use of com.thoughtworks.go.domain.DiskSpace in project gocd by gocd.
the class AgentViewModelTest method isSortedByUsableSpace.
private void isSortedByUsableSpace(AgentsViewModel list) {
for (int i = 0; i < list.size() - 1; i++) {
DiskSpace first = list.get(i).freeDiskSpace();
Long firstSpace = (Long) ReflectionUtil.getField(first, "space");
DiskSpace second = list.get(i + 1).freeDiskSpace();
Long secondSpace = (Long) ReflectionUtil.getField(second, "space");
if (firstSpace > secondSpace) {
throw new RuntimeException("The list is not sorted!");
}
}
}
Aggregations