Search in sources :

Example 26 with PluginDescriptor

use of com.thoughtworks.go.plugin.api.info.PluginDescriptor in project gocd by gocd.

the class ElasticAgentPluginServiceTest method setUp.

@BeforeEach
void setUp() throws Exception {
    ArrayList<PluginDescriptor> plugins = new ArrayList<>();
    plugins.add(GoPluginDescriptor.builder().id("p1").isBundledPlugin(true).build());
    plugins.add(GoPluginDescriptor.builder().id("p2").isBundledPlugin(true).build());
    plugins.add(GoPluginDescriptor.builder().id("docker").isBundledPlugin(true).build());
    when(registry.getPlugins()).thenReturn(plugins);
    when(registry.has("docker")).thenReturn(true);
    when(registry.has("p1")).thenReturn(true);
    when(registry.has("p2")).thenReturn(true);
    when(registry.has("missing")).thenReturn(false);
    when(agentService.allElasticAgents()).thenReturn(new LinkedMultiValueMap<>());
    elasticAgentMetadataStore = ElasticAgentMetadataStore.instance();
    timeProvider = new TimeProvider();
    jobInstanceSqlMapDao = mock(JobInstanceSqlMapDao.class);
    service = new ElasticAgentPluginService(pluginManager, registry, agentService, environmentConfigService, createAgentQueue, serverPingQueue, goConfigService, timeProvider, serverHealthService, elasticAgentMetadataStore, clusterProfilesService, jobInstanceSqlMapDao, scheduleService, consoleService, ephemeralAutoRegisterKeyService, secretParamResolver, jobStatusTopic);
    when(goConfigService.serverConfig()).thenReturn(GoConfigMother.configWithAutoRegisterKey(autoRegisterKey).server());
}
Also used : GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) PluginDescriptor(com.thoughtworks.go.plugin.api.info.PluginDescriptor) TimeProvider(com.thoughtworks.go.util.TimeProvider) ArrayList(java.util.ArrayList) JobInstanceSqlMapDao(com.thoughtworks.go.server.dao.JobInstanceSqlMapDao) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 27 with PluginDescriptor

use of com.thoughtworks.go.plugin.api.info.PluginDescriptor in project gocd by gocd.

the class ExternalArtifactsServiceTest method setUp.

@BeforeEach
public void setUp() {
    artifactExtension = mock(ArtifactExtension.class);
    externalArtifactsService = new ExternalArtifactsService(artifactExtension);
    ArtifactPluginInfo pluginInfo = mock(ArtifactPluginInfo.class);
    PluginDescriptor pluginDescriptor = mock(PluginDescriptor.class);
    when(pluginInfo.getDescriptor()).thenReturn(pluginDescriptor);
    when(pluginDescriptor.id()).thenReturn(pluginId);
    ArtifactMetadataStore.instance().setPluginInfo(pluginInfo);
    pluggableArtifactConfig = new PluggableArtifactConfig("foo", "bar");
    pipelineConfig = PipelineConfigMother.createPipelineConfig("p1", "s1", "j1");
    pipelineConfig.getStage("s1").jobConfigByConfigName("j1").artifactTypeConfigs().add(pluggableArtifactConfig);
    fetchPluggableArtifactTask = new FetchPluggableArtifactTask(new CaseInsensitiveString("p1"), new CaseInsensitiveString("s1"), new CaseInsensitiveString("j1"), "foo");
    cruiseConfig = GoConfigMother.defaultCruiseConfig();
    cruiseConfig.addPipelineWithoutValidation("group", pipelineConfig);
    cruiseConfig.getArtifactStores().add(new ArtifactStore("bar", pluginId));
}
Also used : PluginDescriptor(com.thoughtworks.go.plugin.api.info.PluginDescriptor) ArtifactExtension(com.thoughtworks.go.plugin.access.artifact.ArtifactExtension) ArtifactPluginInfo(com.thoughtworks.go.plugin.domain.artifact.ArtifactPluginInfo) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 28 with PluginDescriptor

use of com.thoughtworks.go.plugin.api.info.PluginDescriptor in project gocd by gocd.

the class FullConfigSaveFlowTestBase method setupMetadataForPlugin.

private void setupMetadataForPlugin() {
    PluginDescriptor pluginDescriptor = GoPluginDescriptor.builder().id("cd.go.artifact.docker.registry").build();
    PluginConfiguration buildFile = new PluginConfiguration("BuildFile", new Metadata(false, false));
    PluginConfiguration image = new PluginConfiguration("Image", new Metadata(false, true));
    PluginConfiguration tag = new PluginConfiguration("Tag", new Metadata(false, false));
    PluginConfiguration fetchProperty = new PluginConfiguration("FetchProperty", new Metadata(false, true));
    PluginConfiguration fetchTag = new PluginConfiguration("Tag", new Metadata(false, false));
    PluginConfiguration registryUrl = new PluginConfiguration("RegistryURL", new Metadata(true, false));
    PluginConfiguration username = new PluginConfiguration("Username", new Metadata(false, false));
    PluginConfiguration password = new PluginConfiguration("Password", new Metadata(false, true));
    PluggableInstanceSettings storeConfigSettings = new PluggableInstanceSettings(asList(registryUrl, username, password));
    PluggableInstanceSettings publishArtifactSettings = new PluggableInstanceSettings(asList(buildFile, image, tag));
    PluggableInstanceSettings fetchArtifactSettings = new PluggableInstanceSettings(asList(fetchProperty, fetchTag));
    ArtifactPluginInfo artifactPluginInfo = new ArtifactPluginInfo(pluginDescriptor, storeConfigSettings, publishArtifactSettings, fetchArtifactSettings, null, new Capabilities());
    ArtifactMetadataStore.instance().setPluginInfo(artifactPluginInfo);
}
Also used : GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) PluginDescriptor(com.thoughtworks.go.plugin.api.info.PluginDescriptor) PluggableInstanceSettings(com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings) Capabilities(com.thoughtworks.go.plugin.domain.artifact.Capabilities) Metadata(com.thoughtworks.go.plugin.domain.common.Metadata) PluginConfiguration(com.thoughtworks.go.plugin.domain.common.PluginConfiguration) ArtifactPluginInfo(com.thoughtworks.go.plugin.domain.artifact.ArtifactPluginInfo)

Aggregations

PluginDescriptor (com.thoughtworks.go.plugin.api.info.PluginDescriptor)28 Metadata (com.thoughtworks.go.plugin.domain.common.Metadata)11 PluggableInstanceSettings (com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings)11 PluginConfiguration (com.thoughtworks.go.plugin.domain.common.PluginConfiguration)11 ArtifactPluginInfo (com.thoughtworks.go.plugin.domain.artifact.ArtifactPluginInfo)10 Capabilities (com.thoughtworks.go.plugin.domain.artifact.Capabilities)8 GoPluginDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)7 Image (com.thoughtworks.go.plugin.access.common.models.Image)6 AuthorizationPluginInfo (com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo)5 PluggableInstanceSettings (com.thoughtworks.go.server.ui.plugins.PluggableInstanceSettings)4 PluginConfiguration (com.thoughtworks.go.server.ui.plugins.PluginConfiguration)4 PluginInfo (com.thoughtworks.go.server.ui.plugins.PluginInfo)4 PluginView (com.thoughtworks.go.server.ui.plugins.PluginView)4 ArrayList (java.util.ArrayList)4 BeforeEach (org.junit.jupiter.api.BeforeEach)4 Test (org.junit.jupiter.api.Test)4 Capabilities (com.thoughtworks.go.plugin.domain.authorization.Capabilities)2 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)1 ClusterProfile (com.thoughtworks.go.config.elastic.ClusterProfile)1 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)1