use of com.thoughtworks.go.remote.AgentIdentifier in project gocd by gocd.
the class AgentRuntimeInfoTest method dataMapEncodingAndDecoding.
@Test
public void dataMapEncodingAndDecoding() {
AgentRuntimeInfo info = new AgentRuntimeInfo(new AgentIdentifier("go02", "10.10.10.1", "uuid"), AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", true);
AgentRuntimeInfo clonedInfo = MessageEncoding.decodeData(MessageEncoding.encodeData(info), AgentRuntimeInfo.class);
assertThat(clonedInfo, is(info));
}
use of com.thoughtworks.go.remote.AgentIdentifier in project gocd by gocd.
the class AgentRuntimeInfoTest method shouldInitializeTheFreeSpaceAtAgentSide.
@Test
public void shouldInitializeTheFreeSpaceAtAgentSide() {
AgentIdentifier id = new AgentConfig("uuid", "localhost", "176.19.4.1").getAgentIdentifier();
AgentRuntimeInfo agentRuntimeInfo = new AgentRuntimeInfo(id, AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false);
assertThat(agentRuntimeInfo.getUsableSpace(), is(not(0L)));
}
use of com.thoughtworks.go.remote.AgentIdentifier in project gocd by gocd.
the class ElasticAgentRuntimeInfoTest method shouldRefreshOperatingSystemOfAgent.
@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));
}
use of com.thoughtworks.go.remote.AgentIdentifier in project gocd by gocd.
the class ElasticAgentRuntimeInfoTest method dataMapEncodingAndDecoding.
@Test
public void dataMapEncodingAndDecoding() {
AgentRuntimeInfo info = new ElasticAgentRuntimeInfo(new AgentIdentifier("localhost", "127.0.0.1", "uuid"), AgentRuntimeStatus.Idle, "/foo/one", null, "42", "go.cd.elastic-agent-plugin.docker");
AgentRuntimeInfo clonedInfo = MessageEncoding.decodeData(MessageEncoding.encodeData(info), AgentRuntimeInfo.class);
assertThat(clonedInfo, is(info));
}
use of com.thoughtworks.go.remote.AgentIdentifier in project gocd by gocd.
the class WorkFinder method onMessage.
public void onMessage(IdleAgentMessage idleAgentMessage) {
AgentIdentifier agent = idleAgentMessage.getAgentIdentifier();
Work work = null;
long startTime = System.currentTimeMillis();
try {
work = buildAssignmentService.assignWorkToAgent(agent);
} finally {
if (work == null) {
work = NO_WORK;
}
workAssignmentPerformanceLogger.assignedWorkToAgent(work, agent, startTime, System.currentTimeMillis());
try {
assignedWorkTopic.post(new WorkAssignedMessage(agent, work));
} catch (Throwable e) {
LOGGER.error(FATAL, null, e);
}
}
}
Aggregations