Search in sources :

Example 1 with AgentRuntimeStatus

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

Example 2 with AgentRuntimeStatus

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));
}
Also used : AgentRuntimeStatus(com.thoughtworks.go.domain.AgentRuntimeStatus) AgentConfig(com.thoughtworks.go.config.AgentConfig) Test(org.junit.Test)

Example 3 with AgentRuntimeStatus

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();
}
Also used : AgentInstances(com.thoughtworks.go.server.domain.AgentInstances) AgentRuntimeStatus(com.thoughtworks.go.domain.AgentRuntimeStatus) GoConfigFileHelper(com.thoughtworks.go.util.GoConfigFileHelper) Before(org.junit.Before)

Aggregations

AgentRuntimeStatus (com.thoughtworks.go.domain.AgentRuntimeStatus)3 AgentConfig (com.thoughtworks.go.config.AgentConfig)1 DiskSpace (com.thoughtworks.go.domain.DiskSpace)1 AgentInstances (com.thoughtworks.go.server.domain.AgentInstances)1 GoConfigFileHelper (com.thoughtworks.go.util.GoConfigFileHelper)1 Before (org.junit.Before)1 Test (org.junit.Test)1