Search in sources :

Example 1 with DiskSpace

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);
}
Also used : AgentRuntimeStatus(com.thoughtworks.go.domain.AgentRuntimeStatus) DiskSpace(com.thoughtworks.go.domain.DiskSpace)

Example 2 with DiskSpace

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!");
        }
    }
}
Also used : DiskSpace(com.thoughtworks.go.domain.DiskSpace)

Aggregations

DiskSpace (com.thoughtworks.go.domain.DiskSpace)2 AgentRuntimeStatus (com.thoughtworks.go.domain.AgentRuntimeStatus)1