public String getLocation() { return agentRuntimeInfo.getLocation(); }
public String agentInfoForDisplay() { return format("Agent located at [%s, %s, %s]", getHostName(), getIpAdress(), getLocation()); }
public BuildVariables(AgentRuntimeInfo agentRuntimeInfo, Clock clock) { this.clock = clock; this.staticLookup = StrLookup.mapLookup(map( "agent.location", agentRuntimeInfo.getLocation(), "agent.hostname", agentRuntimeInfo.getHostName() )); }
private void retrieveCookieIfNecessary() { if (!getAgentRuntimeInfo().hasCookie() && sslInfrastructureService.isRegistered()) { LOG.info("About to get cookie from the server."); String cookie = server.getCookie(agentIdentifier(), getAgentRuntimeInfo().getLocation()); getAgentRuntimeInfo().setCookie(cookie); LOG.info("Got cookie: {}", cookie); } }
@Test public void shouldRetrieveCookieIfNotPresent() throws Exception { agentController = createAgentController(); agentController.init(); when(loopServer.getCookie(any(AgentIdentifier.class), eq(agentController.getAgentRuntimeInfo().getLocation()))).thenReturn("cookie"); when(sslInfrastructureService.isRegistered()).thenReturn(true); when(loopServer.getWork(agentController.getAgentRuntimeInfo())).thenReturn(work); when(agentRegistry.uuid()).thenReturn(agentUuid); when(pluginJarLocationMonitor.hasRunAtLeastOnce()).thenReturn(true); agentController.loop(); verify(work).doWork(any(EnvironmentVariableContext.class), any(AgentWorkContext.class)); }
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 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())); }
String cookie = agentCookie.get(agent); if (cookie == null) { cookie = buildRepositoryRemote.getCookie(info.getIdentifier(), info.getLocation()); agentCookie.put(agent, cookie);