Search in sources :

Example 76 with GoPluginDescriptor

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"))));
}
Also used : GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) ArtifactPluginInfo(com.thoughtworks.go.plugin.domain.artifact.ArtifactPluginInfo) Test(org.junit.Test)

Example 77 with GoPluginDescriptor

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);
}
Also used : AuthorizationPluginInfo(com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) Test(org.junit.Test)

Example 78 with GoPluginDescriptor

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));
}
Also used : AuthorizationPluginInfo(com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) Test(org.junit.Test)

Example 79 with GoPluginDescriptor

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());
}
Also used : Capabilities(com.thoughtworks.go.plugin.domain.authorization.Capabilities) AuthorizationPluginInfo(com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) Test(org.junit.Test)

Example 80 with GoPluginDescriptor

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));
}
Also used : Capabilities(com.thoughtworks.go.plugin.domain.authorization.Capabilities) AuthorizationPluginInfo(com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) Test(org.junit.Test)

Aggregations

GoPluginDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)197 Test (org.junit.Test)155 File (java.io.File)17 PluginManager (com.thoughtworks.go.plugin.infra.PluginManager)16 TinyBundle (org.ops4j.pax.tinybundles.core.TinyBundle)15 PluggableInstanceSettings (com.thoughtworks.go.server.ui.plugins.PluggableInstanceSettings)14 Before (org.junit.Before)14 AnalyticsPluginInfo (com.thoughtworks.go.plugin.domain.analytics.AnalyticsPluginInfo)12 AuthorizationPluginInfo (com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo)12 ElasticAgentPluginInfo (com.thoughtworks.go.plugin.domain.elastic.ElasticAgentPluginInfo)11 PluginView (com.thoughtworks.go.server.ui.plugins.PluginView)11 GoPlugin (com.thoughtworks.go.plugin.api.GoPlugin)10 TaskView (com.thoughtworks.go.plugin.api.task.TaskView)9 PluginInfo (com.thoughtworks.go.server.ui.plugins.PluginInfo)9 InvocationOnMock (org.mockito.invocation.InvocationOnMock)9 Answer (org.mockito.stubbing.Answer)9 TaskPreference (com.thoughtworks.go.plugin.access.pluggabletask.TaskPreference)8 TaskConfig (com.thoughtworks.go.plugin.api.task.TaskConfig)8 ArrayList (java.util.ArrayList)8 PluginConfiguration (com.thoughtworks.go.domain.config.PluginConfiguration)7