use of com.thoughtworks.go.config.Agent in project gocd by gocd.
the class AgentInstanceMother method lostContact.
public static AgentInstance lostContact(String buildLocator) {
Agent agent = new Agent("1234", "localhost", "192.168.0.1");
AgentInstance instance = AgentInstance.createFromAgent(agent, new SystemEnvironment(), mock(AgentStatusChangeListener.class));
AgentRuntimeInfo newRuntimeInfo = AgentRuntimeInfo.initialState(agent);
newRuntimeInfo.setStatus(AgentStatus.LostContact);
newRuntimeInfo.setUsableSpace(1000L);
newRuntimeInfo.setBuildingInfo(new AgentBuildingInfo("buildInfo", buildLocator));
instance.update(newRuntimeInfo);
return instance;
}
use of com.thoughtworks.go.config.Agent in project gocd by gocd.
the class TriStateSelectionTest method shouldHaveActionRemoveIfNoAgentsHaveResource.
@Test
public void shouldHaveActionRemoveIfNoAgentsHaveResource() {
resourceConfigs.add(new ResourceConfig("none"));
agents.add(new Agent("uuid1", "host1", "127.0.0.1", singletonList("one")));
agents.add(new Agent("uuid2", "host2", "127.0.0.2", singletonList("two")));
List<TriStateSelection> selections = TriStateSelection.forAgentsResources(resourceConfigs, agents);
assertThat(selections, hasItem(new TriStateSelection("none", TriStateSelection.Action.remove)));
}
use of com.thoughtworks.go.config.Agent in project gocd by gocd.
the class TriStateSelectionTest method shouldBeNoChangeIfAllAgentsHaveThatResource.
@Test
public void shouldBeNoChangeIfAllAgentsHaveThatResource() {
resourceConfigs.add(new ResourceConfig("some"));
agents.add(new Agent("uuid1", "host1", "127.0.0.1", singletonList("some")));
agents.add(new Agent("uuid2", "host2", "127.0.0.2", emptyList()));
List<TriStateSelection> selections = TriStateSelection.forAgentsResources(resourceConfigs, agents);
assertThat(selections, hasItem(new TriStateSelection("some", TriStateSelection.Action.nochange)));
}
use of com.thoughtworks.go.config.Agent in project gocd by gocd.
the class AgentInstanceMother method disabled.
public static AgentInstance disabled(String ip, SystemEnvironment systemEnvironment) {
AgentInstance denied = AgentInstance.createFromAgent(new Agent("uuid5", "CCeDev04", ip), systemEnvironment, mock(AgentStatusChangeListener.class));
denied.enable();
denied.deny();
return denied;
}
use of com.thoughtworks.go.config.Agent in project gocd by gocd.
the class AgentInstanceMother method updateHostname.
public static AgentInstance updateHostname(AgentInstance agentInstance, String hostname) {
Agent original = agentInstance.getAgent();
agentInstance.syncAgentFrom(new Agent(original.getUuid(), hostname, original.getIpaddress(), original.getResourcesAsList()));
return agentInstance;
}
Aggregations