use of com.thoughtworks.go.domain.AgentRuntimeStatus 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.AgentRuntimeStatus in project gocd by gocd.
the class AgentRuntimeInfoTest method shouldNotifyStatusChangeListenerOnStatusUpdate.
@Test
public void shouldNotifyStatusChangeListenerOnStatusUpdate() {
final AgentRuntimeStatus[] oldAndNewStatus = new AgentRuntimeStatus[2];
AgentRuntimeInfo agentRuntimeInfo = AgentRuntimeInfo.fromServer(new AgentConfig("uuid", "localhost", "176.19.4.1"), true, "/var/lib", 0L, "linux", false);
assertThat(agentRuntimeInfo.getRuntimeStatus(), is(AgentRuntimeStatus.Idle));
assertThat(oldAndNewStatus[OLD_IDX], is(nullValue()));
agentRuntimeInfo.setRuntimeStatus(AgentRuntimeStatus.Building, new AgentRuntimeStatus.ChangeListener() {
public void statusUpdateRequested(AgentRuntimeInfo runtimeInfo, AgentRuntimeStatus newStatus) {
oldAndNewStatus[OLD_IDX] = runtimeInfo.getRuntimeStatus();
oldAndNewStatus[NEW_IDX] = newStatus;
}
});
assertThat(oldAndNewStatus[OLD_IDX], is(AgentRuntimeStatus.Idle));
assertThat(oldAndNewStatus[NEW_IDX], is(AgentRuntimeStatus.Building));
assertThat(agentRuntimeInfo.getRuntimeStatus(), is(AgentRuntimeStatus.Building));
}
use of com.thoughtworks.go.domain.AgentRuntimeStatus in project gocd by gocd.
the class AgentConfigServiceIntegrationTest method setup.
@Before
public void setup() throws Exception {
agentInstances = new AgentInstances(new AgentRuntimeStatus.ChangeListener() {
@Override
public void statusUpdateRequested(AgentRuntimeInfo runtimeInfo, AgentRuntimeStatus newStatus) {
}
});
configHelper = new GoConfigFileHelper();
configHelper.usingCruiseConfigDao(goConfigDao).initializeConfigFile();
configHelper.onSetUp();
goConfigService.forceNotifyListeners();
}
Aggregations