use of com.thoughtworks.go.plugin.api.info.PluginDescriptor in project gocd by gocd.
the class PluginRoleConfigTest method setAuthorizationPluginInfo.
private void setAuthorizationPluginInfo() {
PluginDescriptor pluginDescriptor = mock(PluginDescriptor.class);
PluginConfiguration k1 = new PluginConfiguration("k1", new Metadata(false, true));
PluginConfiguration k2 = new PluginConfiguration("k2", new Metadata(false, false));
PluginConfiguration k3 = new PluginConfiguration("k3", new Metadata(false, true));
PluggableInstanceSettings authConfigSettins = new PluggableInstanceSettings(asList(k1, k2, k3));
PluggableInstanceSettings roleConfigSettings = new PluggableInstanceSettings(asList(k1, k2, k3));
com.thoughtworks.go.plugin.domain.authorization.Capabilities capabilities = new com.thoughtworks.go.plugin.domain.authorization.Capabilities(SupportedAuthType.Web, true, true, true);
AuthorizationPluginInfo artifactPluginInfo = new AuthorizationPluginInfo(pluginDescriptor, authConfigSettins, roleConfigSettings, null, capabilities);
when(pluginDescriptor.id()).thenReturn("cd.go.github");
AuthorizationMetadataStore.instance().setPluginInfo(artifactPluginInfo);
}
use of com.thoughtworks.go.plugin.api.info.PluginDescriptor in project gocd by gocd.
the class BasicCruiseConfigTest method setEAPluginInfo.
private void setEAPluginInfo() {
PluginDescriptor pluginDescriptor = mock(PluginDescriptor.class);
PluginConfiguration k1 = new PluginConfiguration("k1", new Metadata(false, true));
PluginConfiguration k2 = new PluginConfiguration("k2", new Metadata(false, false));
PluginConfiguration k3 = new PluginConfiguration("k3", new Metadata(false, true));
PluggableInstanceSettings clusterProfileSettings = new PluggableInstanceSettings(asList(k1, k2, k3));
PluggableInstanceSettings profileSettings = new PluggableInstanceSettings(asList(k1, k2, k3));
com.thoughtworks.go.plugin.domain.elastic.Capabilities capabilities = new com.thoughtworks.go.plugin.domain.elastic.Capabilities(true);
ElasticAgentPluginInfo ecsPluginInfo = new ElasticAgentPluginInfo(pluginDescriptor, clusterProfileSettings, profileSettings, null, null, capabilities);
when(pluginDescriptor.id()).thenReturn("ecs");
ElasticAgentMetadataStore.instance().setPluginInfo(ecsPluginInfo);
}
use of com.thoughtworks.go.plugin.api.info.PluginDescriptor in project gocd by gocd.
the class BasicCruiseConfigTest method setAuthorizationPluginInfo.
private void setAuthorizationPluginInfo() {
PluginDescriptor pluginDescriptor = mock(PluginDescriptor.class);
PluginConfiguration k1 = new PluginConfiguration("k1", new Metadata(false, true));
PluginConfiguration k2 = new PluginConfiguration("k2", new Metadata(false, false));
PluginConfiguration k3 = new PluginConfiguration("k3", new Metadata(false, true));
PluggableInstanceSettings authConfigSettins = new PluggableInstanceSettings(asList(k1, k2, k3));
PluggableInstanceSettings roleConfigSettings = new PluggableInstanceSettings(asList(k1, k2, k3));
com.thoughtworks.go.plugin.domain.authorization.Capabilities capabilities = new com.thoughtworks.go.plugin.domain.authorization.Capabilities(SupportedAuthType.Web, true, true, true);
AuthorizationPluginInfo artifactPluginInfo = new AuthorizationPluginInfo(pluginDescriptor, authConfigSettins, roleConfigSettings, null, capabilities);
when(pluginDescriptor.id()).thenReturn("cd.go.github");
AuthorizationMetadataStore.instance().setPluginInfo(artifactPluginInfo);
}
use of com.thoughtworks.go.plugin.api.info.PluginDescriptor in project gocd by gocd.
the class FetchPluggableArtifactTaskTest method setUp.
@BeforeEach
void setUp() {
config = GoConfigMother.configWithPipelines("random_pipeline", "uppest_lookalike", "uppest_stream", "upstreams_peer", "upstream", "downstream", "dummy");
PipelineConfig randomPipeline = config.pipelineConfigByName(new CaseInsensitiveString("random_pipeline"));
randomPipeline.add(StageConfigMother.stageConfig("random-stage1", new JobConfigs(new JobConfig("random-job1"))));
PipelineConfig uppestLookalike = config.pipelineConfigByName(new CaseInsensitiveString("uppest_lookalike"));
uppestLookalike.add(StageConfigMother.stageConfig("uppest-stage1", new JobConfigs(new JobConfig("uppest-job1"))));
uppestStream = config.pipelineConfigByName(new CaseInsensitiveString("uppest_stream"));
uppestStream.add(StageConfigMother.stageConfig("uppest-stage1", new JobConfigs(new JobConfig("uppest-job1"))));
uppestStream.add(StageConfigMother.stageConfig("uppest-stage2", new JobConfigs(new JobConfig("uppest-job2"))));
uppestStream.add(StageConfigMother.stageConfig("uppest-stage3", new JobConfigs(new JobConfig("uppest-job3"))));
upstream = config.pipelineConfigByName(new CaseInsensitiveString("upstream"));
upstream.setMaterialConfigs(new MaterialConfigs(MaterialConfigsMother.dependencyMaterialConfig("uppest_stream", "uppest-stage2")));
upstream.add(StageConfigMother.stageConfig("up-stage1", new JobConfigs(new JobConfig("up-job1"))));
upstream.add(StageConfigMother.stageConfig("up-stage2", new JobConfigs(new JobConfig("up-job2"))));
downstream = config.pipelineConfigByName(new CaseInsensitiveString("downstream"));
downstream.setMaterialConfigs(new MaterialConfigs(MaterialConfigsMother.dependencyMaterialConfig("upstream", "up-stage1")));
downstream.get(0).getJobs().get(0).addTask(new FetchPluggableArtifactTask(new CaseInsensitiveString("foo"), new CaseInsensitiveString("bar"), new CaseInsensitiveString("baz"), "s3"));
artifactPluginInfo = mock(ArtifactPluginInfo.class);
PluginDescriptor pluginDescriptor = mock(PluginDescriptor.class);
when(artifactPluginInfo.getDescriptor()).thenReturn(pluginDescriptor);
when(pluginDescriptor.id()).thenReturn("cd.go.s3");
ArtifactMetadataStore.instance().setPluginInfo(artifactPluginInfo);
}
use of com.thoughtworks.go.plugin.api.info.PluginDescriptor in project gocd by gocd.
the class ArtifactTypeConfigsTest method setConfigAttributes_shouldSetExternalArtifactWithPlainTextValuesIfPluginIdIsProvided.
@Test
public void setConfigAttributes_shouldSetExternalArtifactWithPlainTextValuesIfPluginIdIsProvided() {
ArtifactPluginInfo artifactPluginInfo = mock(ArtifactPluginInfo.class);
PluginDescriptor pluginDescriptor = mock(PluginDescriptor.class);
when(artifactPluginInfo.getDescriptor()).thenReturn(pluginDescriptor);
when(pluginDescriptor.id()).thenReturn("cd.go.artifact.foo");
PluginConfiguration image = new PluginConfiguration("Image", new Metadata(true, true));
PluginConfiguration tag = new PluginConfiguration("Tag", new Metadata(true, false));
ArrayList<PluginConfiguration> pluginMetadata = new ArrayList<>();
pluginMetadata.add(image);
pluginMetadata.add(tag);
when(artifactPluginInfo.getArtifactConfigSettings()).thenReturn(new PluggableInstanceSettings(pluginMetadata));
ArtifactMetadataStore.instance().setPluginInfo(artifactPluginInfo);
HashMap<Object, Object> configurationMap1 = new HashMap<>();
configurationMap1.put("Image", "gocd/gocd-server");
configurationMap1.put("Tag", "v18.6.0");
HashMap<String, Object> artifactPlan1 = new HashMap<>();
artifactPlan1.put("artifactTypeValue", "Pluggable Artifact");
artifactPlan1.put("id", "artifactId");
artifactPlan1.put("storeId", "storeId");
artifactPlan1.put("pluginId", "cd.go.artifact.foo");
artifactPlan1.put("configuration", configurationMap1);
List<Map> artifactPlansList = new ArrayList<>();
artifactPlansList.add(artifactPlan1);
ArtifactTypeConfigs artifactTypeConfigs = new ArtifactTypeConfigs();
artifactTypeConfigs.setConfigAttributes(artifactPlansList);
assertThat(artifactTypeConfigs.size(), is(1));
PluggableArtifactConfig artifactConfig = (PluggableArtifactConfig) artifactTypeConfigs.get(0);
assertThat(artifactConfig.getArtifactType(), is(ArtifactType.external));
assertThat(artifactConfig.getId(), is("artifactId"));
assertThat(artifactConfig.getStoreId(), is("storeId"));
assertThat(artifactConfig.getConfiguration().getProperty("Image").isSecure(), is(false));
}
Aggregations