Search in sources :

Example 16 with ElasticAgentPluginInfo

use of com.thoughtworks.go.plugin.domain.elastic.ElasticAgentPluginInfo in project gocd by gocd.

the class JobControllerIntegrationTest method jobDetailModel_shouldHaveTheElasticPluginIdAndElasticAgentIdWhenAgentIsAssigned.

@Test
public void jobDetailModel_shouldHaveTheElasticPluginIdAndElasticAgentIdWhenAgentIsAssigned() throws Exception {
    Pipeline pipeline = fixture.createPipelineWithFirstStageAssigned();
    Stage stage = pipeline.getFirstStage();
    JobInstance job = stage.getFirstJob();
    GoPluginDescriptor.About about = new GoPluginDescriptor.About("name", "0.1", "17.3.0", "desc", null, null);
    GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin_id", null, about, null, null, false);
    ElasticAgentMetadataStore.instance().setPluginInfo(new ElasticAgentPluginInfo(descriptor, null, null, null, new Capabilities(false, true)));
    fixture.addJobAgentMetadata(new JobAgentMetadata(job.getId(), new ElasticProfile("profile_id", "plugin_id", Collections.EMPTY_LIST)));
    final AgentConfig agentConfig = new AgentConfig(job.getAgentUuid());
    agentConfig.setElasticAgentId("elastic_agent_id");
    agentConfig.setElasticPluginId("plugin_id");
    goConfigService.agents().add(agentConfig);
    ModelAndView modelAndView = controller.jobDetail(pipeline.getName(), String.valueOf(pipeline.getCounter()), stage.getName(), String.valueOf(stage.getCounter()), job.getName());
    assertThat(modelAndView.getModel().get("elasticAgentPluginId"), is("plugin_id"));
    assertThat(modelAndView.getModel().get("elasticAgentId"), is("elastic_agent_id"));
}
Also used : AgentConfig(com.thoughtworks.go.config.AgentConfig) ElasticAgentPluginInfo(com.thoughtworks.go.plugin.domain.elastic.ElasticAgentPluginInfo) Capabilities(com.thoughtworks.go.plugin.domain.elastic.Capabilities) ModelAndView(org.springframework.web.servlet.ModelAndView) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) ElasticProfile(com.thoughtworks.go.config.elastic.ElasticProfile) Test(org.junit.Test)

Aggregations

ElasticAgentPluginInfo (com.thoughtworks.go.plugin.domain.elastic.ElasticAgentPluginInfo)16 Test (org.junit.Test)15 GoPluginDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)11 Capabilities (com.thoughtworks.go.plugin.domain.elastic.Capabilities)7 ConfigurationKey (com.thoughtworks.go.domain.config.ConfigurationKey)3 ConfigurationProperty (com.thoughtworks.go.domain.config.ConfigurationProperty)3 ConfigurationValue (com.thoughtworks.go.domain.config.ConfigurationValue)3 EncryptedConfigurationValue (com.thoughtworks.go.domain.config.EncryptedConfigurationValue)3 PluggableInstanceSettings (com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings)3 ElasticProfile (com.thoughtworks.go.config.elastic.ElasticProfile)2 Metadata (com.thoughtworks.go.plugin.domain.common.Metadata)2 PluginConfiguration (com.thoughtworks.go.plugin.domain.common.PluginConfiguration)2 ModelAndView (org.springframework.web.servlet.ModelAndView)2 AgentConfig (com.thoughtworks.go.config.AgentConfig)1 PluginSettingsConfiguration (com.thoughtworks.go.plugin.access.common.settings.PluginSettingsConfiguration)1 PluginSettingsProperty (com.thoughtworks.go.plugin.access.common.settings.PluginSettingsProperty)1 AnalyticsPluginInfo (com.thoughtworks.go.plugin.domain.analytics.AnalyticsPluginInfo)1 AuthorizationPluginInfo (com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo)1 ArrayList (java.util.ArrayList)1