use of com.thoughtworks.go.config.Agent in project gocd by gocd.
the class JobInstanceModelTest method shouldReturnFalseForLiveAgentIfAgentInfoIsConstructedFromDb.
@Test
public void shouldReturnFalseForLiveAgentIfAgentInfoIsConstructedFromDb() {
JobInstanceModel instance = new JobInstanceModel(JobInstanceMother.building("cruise"), JobDurationStrategy.ALWAYS_ZERO, new Agent("uuid", "hostname", "ip", "cookie"));
assertThat(instance.hasLiveAgent(), is(false));
}
use of com.thoughtworks.go.config.Agent in project gocd by gocd.
the class AgentInstanceMother method updateElasticPluginId.
public static AgentInstance updateElasticPluginId(AgentInstance agentInstance, String elasticPluginId) {
Agent agent = agentInstance.getAgent();
agent.setElasticPluginId(elasticPluginId);
agentInstance.syncAgentFrom(agent);
return agentInstance;
}
use of com.thoughtworks.go.config.Agent in project gocd by gocd.
the class AgentInstanceMother method updateLocation.
public static AgentInstance updateLocation(AgentInstance agentInstance, String location) {
Agent agent = agentInstance.getAgent();
agentInstance.update(fromServer(agent, true, location, agentInstance.getUsableSpace(), "linux"));
return agentInstance;
}
use of com.thoughtworks.go.config.Agent in project gocd by gocd.
the class AgentInstanceMother method disabledWith.
public static AgentInstance disabledWith(String uuid) {
final AgentInstance disabled = disabled();
disabled.syncAgentFrom(new Agent(uuid, disabled.getHostname(), disabled.getIpAddress()));
return disabled;
}
use of com.thoughtworks.go.config.Agent in project gocd by gocd.
the class AgentInstanceMother method idle.
public static AgentInstance idle(final Date lastHeardAt, final String hostname, SystemEnvironment systemEnvironment) {
Agent idleAgentConfig = new Agent("uuid2", hostname, "10.18.5.1");
AgentRuntimeInfo agentRuntimeInfo = new AgentRuntimeInfo(idleAgentConfig.getAgentIdentifier(), AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie");
agentRuntimeInfo.setLocation("/var/lib/foo");
agentRuntimeInfo.idle();
agentRuntimeInfo.setUsableSpace(10 * 1024l);
AgentInstance agentInstance = createFromLiveAgent(agentRuntimeInfo, systemEnvironment, mock(AgentStatusChangeListener.class));
agentInstance.idle();
agentInstance.update(agentRuntimeInfo);
ReflectionUtil.setField(agentInstance, "lastHeardTime", lastHeardAt);
return agentInstance;
}
Aggregations