public String getOperatingSystem() { String os = agentRuntimeInfo.getOperatingSystem(); return os == null ? "" : os; }
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(); }
private ElasticAgentRuntimeInfo(AgentRuntimeInfo runtimeInfo, String elasticAgentId, String elasticPluginId) { this(runtimeInfo.getIdentifier(), runtimeInfo.getRuntimeStatus(), runtimeInfo.getLocation(), runtimeInfo.getCookie(), elasticAgentId, elasticPluginId); this.setOperatingSystem(runtimeInfo.getOperatingSystem()); this.setUsableSpace(runtimeInfo.getUsableSpace()); }
@Test public void shouldRefreshOperatingSystemOfAgent() throws Exception { AgentIdentifier identifier = new AgentIdentifier("local.in", "127.0.0.1", "uuid-1"); AgentRuntimeInfo runtimeInfo = ElasticAgentRuntimeInfo.fromAgent(identifier, AgentRuntimeStatus.Idle, "/tmp/foo", false); String os = new SystemEnvironment().getOperatingSystemCompleteName(); assertThat(runtimeInfo.getOperatingSystem(), is(os)); }
@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())); }