use of com.thoughtworks.go.config.AgentConfig in project gocd by gocd.
the class AgentsEntityConfigUpdateCommandTest method shouldUpdateConfigStateOfAgents.
@Test
public void shouldUpdateConfigStateOfAgents() throws Exception {
AgentInstance agentInstance = AgentInstanceMother.disabled();
AgentConfig agentConfig = agentInstance.agentConfig();
agentConfig.disable();
cruiseConfig.agents().add(agentConfig);
assertThat(agentConfig.isEnabled(), is(false));
triState = TriState.TRUE;
uuids.add(agentConfig.getUuid());
when(agentInstances.findAgent(agentConfig.getUuid())).thenReturn(agentInstance);
AgentsEntityConfigUpdateCommand command = new AgentsEntityConfigUpdateCommand(agentInstances, currentUser, result, uuids, environmentsToAdd, environmentsToRemove, triState, resourcesToAdd, resourcesToRemove, goConfigService);
command.update(cruiseConfig);
assertThat(agentConfig.isEnabled(), is(true));
}
use of com.thoughtworks.go.config.AgentConfig in project gocd by gocd.
the class UpdateAgentStatusTest method setUp.
@Before
public void setUp() throws Exception {
dbHelper.onSetUp();
configHelper.onSetUp();
configHelper.usingCruiseConfigDao(goConfigDao);
preCondition = new PipelineWithTwoStages(materialRepository, transactionTemplate, temporaryFolder);
preCondition.usingConfigHelper(configHelper).usingDbHelper(dbHelper).onSetUp();
agentService.clearAll();
agentService.requestRegistration(new Username("bob"), AgentRuntimeInfo.fromServer(new AgentConfig(agentId, "CCEDev01", "10.81.2.1"), false, "/var/lib", 0L, "linux", false));
agentService.approve(agentId);
}
use of com.thoughtworks.go.config.AgentConfig in project gocd by gocd.
the class JobAssignmentTest method setupRemoteAgent.
private AgentInstance setupRemoteAgent() {
AgentConfig agentConfig = AgentMother.remoteAgent();
configHelper.addAgent(agentConfig);
AgentInstance instance = AgentInstance.createFromConfig(agentConfig, systemEnvironment, agentStatusChangeListener());
instance.enable();
return instance;
}
use of com.thoughtworks.go.config.AgentConfig in project gocd by gocd.
the class AgentConfigsUpdateValidator method isValid.
@Override
public boolean isValid(CruiseConfig preprocessedConfig) {
boolean isValid = true;
for (String uuid : agentsUuids) {
AgentConfig agentConfig = preprocessedConfig.agents().getAgentByUuid(uuid);
isValid = agentConfig.validateTree(ConfigSaveValidationContext.forChain(preprocessedConfig)) && isValid;
validatedAgents.add(agentConfig);
}
return isValid;
}
use of com.thoughtworks.go.config.AgentConfig in project gocd by gocd.
the class AgentInstanceTest method shouldOrderByHostname.
@Test
public void shouldOrderByHostname() throws Exception {
AgentInstance agentA = new AgentInstance(new AgentConfig("UUID", "A", "127.0.0.1"), LOCAL, systemEnvironment, null);
AgentInstance agentB = new AgentInstance(new AgentConfig("UUID", "B", "127.0.0.2"), LOCAL, systemEnvironment, null);
assertThat(agentA.compareTo(agentA), is(0));
assertThat(agentA.compareTo(agentB), lessThan(0));
assertThat(agentB.compareTo(agentA), greaterThan(0));
}
Aggregations