use of com.thoughtworks.go.config.Agents in project gocd by gocd.
the class BuildCauseProducerServiceWithFlipModificationTest method consume.
private void consume(final BuildCause buildCause) throws SQLException {
dbHelper.saveRevs(buildCause.getMaterialRevisions());
transactionTemplate.execute(new TransactionCallbackWithoutResult() {
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) {
Pipeline latestPipeline = pipelineScheduleQueue.createPipeline(buildCause, mingleConfig, new DefaultSchedulingContext(buildCause.getApprover(), new Agents()), "md5", new TimeProvider());
// Pipeline latestPipeline = PipelineMother.schedule(mingleConfig, buildCause);
pipelineDao.saveWithStages(latestPipeline);
dbHelper.passStage(latestPipeline.getStages().first());
}
});
}
use of com.thoughtworks.go.config.Agents in project gocd by gocd.
the class TriStateSelectionTest method before.
@Before
public void before() {
resourceConfigs = new HashSet<>();
resourceConfigs.add(new ResourceConfig("one"));
resourceConfigs.add(new ResourceConfig("two"));
agents = new Agents();
}
use of com.thoughtworks.go.config.Agents in project gocd by gocd.
the class DefaultSchedulingContextTest method shouldOnlyFindAgentsThatMatchResourcesSpecified.
@Test
public void shouldOnlyFindAgentsThatMatchResourcesSpecified() throws Exception {
AgentConfig linux = agent("uuid1", "linux");
AgentConfig windows = agent("uuid2", "windows");
Agents matchingAgents = new Agents(linux, windows);
DefaultSchedulingContext context = new DefaultSchedulingContext("approved", matchingAgents);
assertThat(context.findAgentsMatching(resources("linux")), is(new Agents(linux)));
}
use of com.thoughtworks.go.config.Agents in project gocd by gocd.
the class DefaultSchedulingContextTest method shouldFindNoAgentsIfNoneMatch.
@Test
public void shouldFindNoAgentsIfNoneMatch() throws Exception {
AgentConfig linux = agent("uuid1", "linux");
AgentConfig windows = agent("uuid2", "windows");
Agents matchingAgents = new Agents(linux, windows);
DefaultSchedulingContext context = new DefaultSchedulingContext("approved", matchingAgents);
assertThat(context.findAgentsMatching(resources("macosx")), is(new Agents()));
}
use of com.thoughtworks.go.config.Agents in project gocd by gocd.
the class AgentInstancesTest method shouldSyncAgent.
@Test
public void shouldSyncAgent() throws Exception {
AgentInstances agentInstances = new AgentInstances(systemEnvironment, agentStatusChangeListener, AgentInstanceMother.building(), idle);
AgentConfig agentConfig = new AgentConfig("uuid2", "CCeDev01", "10.18.5.1");
agentConfig.setDisabled(true);
Agents oneAgentIsRemoved = new Agents(agentConfig);
agentInstances.sync(oneAgentIsRemoved);
assertThat(agentInstances.findAgentAndRefreshStatus("uuid2").getStatus(), is(AgentStatus.Disabled));
}
Aggregations