Search in sources :

Example 11 with Agents

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());
        }
    });
}
Also used : TimeProvider(com.thoughtworks.go.util.TimeProvider) Agents(com.thoughtworks.go.config.Agents) TransactionStatus(org.springframework.transaction.TransactionStatus) TransactionCallbackWithoutResult(org.springframework.transaction.support.TransactionCallbackWithoutResult) Pipeline(com.thoughtworks.go.domain.Pipeline) DefaultSchedulingContext(com.thoughtworks.go.domain.DefaultSchedulingContext)

Example 12 with Agents

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();
}
Also used : Agents(com.thoughtworks.go.config.Agents) ResourceConfig(com.thoughtworks.go.config.ResourceConfig) Before(org.junit.Before)

Example 13 with 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)));
}
Also used : AgentConfig(com.thoughtworks.go.config.AgentConfig) Agents(com.thoughtworks.go.config.Agents) Test(org.junit.Test)

Example 14 with Agents

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()));
}
Also used : AgentConfig(com.thoughtworks.go.config.AgentConfig) Agents(com.thoughtworks.go.config.Agents) Test(org.junit.Test)

Example 15 with 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));
}
Also used : AgentConfig(com.thoughtworks.go.config.AgentConfig) Agents(com.thoughtworks.go.config.Agents) Test(org.junit.Test)

Aggregations

Agents (com.thoughtworks.go.config.Agents)21 Test (org.junit.Test)16 AgentConfig (com.thoughtworks.go.config.AgentConfig)13 EnvironmentVariablesConfig (com.thoughtworks.go.config.EnvironmentVariablesConfig)3 TimeProvider (com.thoughtworks.go.util.TimeProvider)3 EnvironmentVariableConfig (com.thoughtworks.go.config.EnvironmentVariableConfig)2 Resources (com.thoughtworks.go.config.Resources)2 StageConfig (com.thoughtworks.go.config.StageConfig)2 Before (org.junit.Before)2 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)1 ConfigSaveValidationContext (com.thoughtworks.go.config.ConfigSaveValidationContext)1 ResourceConfig (com.thoughtworks.go.config.ResourceConfig)1 ElasticProfile (com.thoughtworks.go.config.elastic.ElasticProfile)1 DefaultSchedulingContext (com.thoughtworks.go.domain.DefaultSchedulingContext)1 NullAgentInstance (com.thoughtworks.go.domain.NullAgentInstance)1 Pipeline (com.thoughtworks.go.domain.Pipeline)1 AgentStatusChangeListener (com.thoughtworks.go.listener.AgentStatusChangeListener)1 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)1 HashMap (java.util.HashMap)1 TransactionStatus (org.springframework.transaction.TransactionStatus)1