public AgentBuildingInfo getBuildingInfo() { return agentRuntimeInfo.getBuildingInfo(); }
public String getBuildLocator() { return agentRuntimeInfo.getBuildingInfo().getBuildLocator(); }
public void updateSelf(AgentRuntimeInfo newRuntimeInfo) { this.buildingInfo = newRuntimeInfo.getBuildingInfo(); if (newRuntimeInfo.isCancelled()) { this.setRuntimeStatus(AgentRuntimeStatus.Cancelled); } this.location = newRuntimeInfo.getLocation(); this.usableSpace = newRuntimeInfo.getUsableSpace(); this.operatingSystemName = newRuntimeInfo.getOperatingSystem(); this.supportsBuildCommandProtocol = newRuntimeInfo.getSupportsBuildCommandProtocol(); }
@Test public void shouldBeAbleToDenyAgentWhenItIsBuilding() throws Exception { AgentInstance original = AgentInstance.createFromConfig(agentConfig, systemEnvironment, mock(AgentStatusChangeListener.class)); AgentRuntimeInfo runtimeInfo = buildingRuntimeInfo(); original.update(runtimeInfo); assertThat(original.canDisable(), is(true)); original.deny(); assertThat(agentConfig.isDisabled(), is(true)); assertThat(original.getStatus(), is(AgentStatus.Disabled)); assertThat(original.getBuildingInfo(), is(runtimeInfo.getBuildingInfo())); }
@Test public void shouldUpdateSelfForAnIdleAgent() { AgentRuntimeInfo agentRuntimeInfo = new AgentRuntimeInfo(new AgentIdentifier("localhost", "127.0.0.1", "uuid"), AgentRuntimeStatus.Idle, currentWorkingDirectory(), null, false); AgentRuntimeInfo newRuntimeInfo = new AgentRuntimeInfo(new AgentIdentifier("go02", "10.10.10.1", "uuid"), AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false); newRuntimeInfo.setBuildingInfo(new AgentBuildingInfo("Idle", "")); newRuntimeInfo.setLocation("home"); newRuntimeInfo.setUsableSpace(10L); newRuntimeInfo.setOperatingSystem("Linux"); agentRuntimeInfo.updateSelf(newRuntimeInfo); assertThat(agentRuntimeInfo.getBuildingInfo(), is(newRuntimeInfo.getBuildingInfo())); assertThat(agentRuntimeInfo.getLocation(), is(newRuntimeInfo.getLocation())); assertThat(agentRuntimeInfo.getUsableSpace(), is(newRuntimeInfo.getUsableSpace())); assertThat(agentRuntimeInfo.getOperatingSystem(), is(newRuntimeInfo.getOperatingSystem())); }