use of com.thoughtworks.go.plugin.domain.common.PluginConfiguration in project gocd by gocd.
the class PluginProfileMetadataKeysTest method shouldGetPluginConfigurationsWithMetadataDefaultedToFalseInAbsenceOfPluginMetadata.
@Test
public void shouldGetPluginConfigurationsWithMetadataDefaultedToFalseInAbsenceOfPluginMetadata() throws Exception {
PluginProfileMetadataKeys metadata = PluginProfileMetadataKeys.fromJSON("[{\n" + " \"key\": \"username\"\n" + "}, {\n" + " \"key\": \"password\",\n" + " \"metadata\": {\n" + " \"secure\": true,\n" + " \"required\": true\n" + " }\n" + "}]");
List<PluginConfiguration> pluginConfigurations = metadata.toPluginConfigurations();
assertThat(pluginConfigurations, containsInAnyOrder(new PluginConfiguration("username", new Metadata(false, false)), new PluginConfiguration("password", new Metadata(true, true))));
}
use of com.thoughtworks.go.plugin.domain.common.PluginConfiguration in project gocd by gocd.
the class SecretsExtensionV1Test method shouldTalkToPlugin_toFetchSecretsConfigMetadata.
@Test
void shouldTalkToPlugin_toFetchSecretsConfigMetadata() {
String responseBody = "[{\"key\":\"Username\",\"metadata\":{\"required\":true,\"secure\":false}},{\"key\":\"Password\",\"metadata\":{\"required\":true,\"secure\":true}}]";
when(pluginManager.submitTo(eq(PLUGIN_ID), eq(SECRETS_EXTENSION), requestArgumentCaptor.capture())).thenReturn(DefaultGoPluginApiResponse.success(responseBody));
final List<PluginConfiguration> metadata = secretsExtensionV1.getSecretsConfigMetadata(PLUGIN_ID);
assertThat(metadata).hasSize(2);
assertThat(metadata).contains(new PluginConfiguration("Username", new Metadata(true, false)), new PluginConfiguration("Password", new Metadata(true, true)));
assertExtensionRequest(REQUEST_GET_SECRETS_CONFIG_METADATA, null);
}
use of com.thoughtworks.go.plugin.domain.common.PluginConfiguration 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);
}
Aggregations