use of com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor in project gocd by gocd.
the class ArtifactPluginInfoBuilderTest method shouldBuildPluginInfoWithStoreSettings.
@Test
public void shouldBuildPluginInfoWithStoreSettings() {
GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
List<PluginConfiguration> pluginConfigurations = Arrays.asList(new PluginConfiguration("S3_BUCKET", new Metadata(true, false)), new PluginConfiguration("AWS_ACCESS_KEY_ID", new Metadata(true, true)));
when(extension.getArtifactStoreMetadata(descriptor.id())).thenReturn(pluginConfigurations);
when(extension.getArtifactStoreView(descriptor.id())).thenReturn("store_config");
ArtifactPluginInfo pluginInfo = new ArtifactPluginInfoBuilder(extension).pluginInfoFor(descriptor);
assertThat(pluginInfo.getStoreConfigSettings(), Is.is(new PluggableInstanceSettings(pluginConfigurations, new PluginView("store_config"))));
}
use of com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor in project gocd by gocd.
the class AuthorizationMetadataLoaderTest method onPluginLoaded_shouldAddPluginInfoToMetadataStore.
@Test
public void onPluginLoaded_shouldAddPluginInfoToMetadataStore() throws Exception {
GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
AuthorizationMetadataLoader metadataLoader = new AuthorizationMetadataLoader(pluginManager, metadataStore, infoBuilder, extension);
AuthorizationPluginInfo pluginInfo = new AuthorizationPluginInfo(descriptor, null, null, null, null);
when(extension.canHandlePlugin(descriptor.id())).thenReturn(true);
when(infoBuilder.pluginInfoFor(descriptor)).thenReturn(pluginInfo);
metadataLoader.pluginLoaded(descriptor);
verify(metadataStore).setPluginInfo(pluginInfo);
}
use of com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor in project gocd by gocd.
the class AuthorizationPluginInfoBuilderTest method shouldBuildPluginInfoWithImage.
@Test
public void shouldBuildPluginInfoWithImage() throws Exception {
GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
Image icon = new Image("content_type", "data", "hash");
when(extension.getIcon(descriptor.id())).thenReturn(icon);
AuthorizationPluginInfo pluginInfo = new AuthorizationPluginInfoBuilder(extension).pluginInfoFor(descriptor);
assertThat(pluginInfo.getImage(), is(icon));
}
use of com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor in project gocd by gocd.
the class AuthorizationPluginInfoBuilderTest method shouldNotHaveRoleSettingsInPluginInfoIfPluginCannotAuthorize.
@Test
public void shouldNotHaveRoleSettingsInPluginInfoIfPluginCannotAuthorize() throws Exception {
GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
Capabilities capabilities = new Capabilities(SupportedAuthType.Password, true, false);
when(extension.getCapabilities(descriptor.id())).thenReturn(capabilities);
AuthorizationPluginInfo pluginInfo = new AuthorizationPluginInfoBuilder(extension).pluginInfoFor(descriptor);
assertNull(pluginInfo.getRoleSettings());
}
use of com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor in project gocd by gocd.
the class AuthorizationPluginInfoBuilderTest method shouldBuildPluginInfoWithCapablities.
@Test
public void shouldBuildPluginInfoWithCapablities() throws Exception {
GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
Capabilities capabilities = new Capabilities(SupportedAuthType.Password, true, true);
when(extension.getCapabilities(descriptor.id())).thenReturn(capabilities);
AuthorizationPluginInfo pluginInfo = new AuthorizationPluginInfoBuilder(extension).pluginInfoFor(descriptor);
assertThat(pluginInfo.getCapabilities(), is(capabilities));
}
Aggregations