Search in sources :

Example 1 with ArtifactPluginInfo

use of com.thoughtworks.go.plugin.domain.artifact.ArtifactPluginInfo in project gocd by gocd.

the class ArtifactPluginInfoBuilderTest method shouldBuildPluginInfoWithFetchArtifactConfigSettings.

@Test
public void shouldBuildPluginInfoWithFetchArtifactConfigSettings() {
    GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
    List<PluginConfiguration> pluginConfigurations = Arrays.asList(new PluginConfiguration("FILENAME", new Metadata(true, false)));
    when(extension.getFetchArtifactMetadata(descriptor.id())).thenReturn(pluginConfigurations);
    when(extension.getFetchArtifactView(descriptor.id())).thenReturn("fetch_artifact_view");
    ArtifactPluginInfo pluginInfo = new ArtifactPluginInfoBuilder(extension).pluginInfoFor(descriptor);
    assertThat(pluginInfo.getFetchArtifactSettings(), Is.is(new PluggableInstanceSettings(pluginConfigurations, new PluginView("fetch_artifact_view"))));
}
Also used : GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) ArtifactPluginInfo(com.thoughtworks.go.plugin.domain.artifact.ArtifactPluginInfo) Test(org.junit.Test)

Example 2 with ArtifactPluginInfo

use of com.thoughtworks.go.plugin.domain.artifact.ArtifactPluginInfo in project gocd by gocd.

the class ArtifactPluginInfoBuilderTest method shouldContinueWithBuildingPluginInfoIfPluginSettingsIsNotProvidedByPlugin.

@Test
public void shouldContinueWithBuildingPluginInfoIfPluginSettingsIsNotProvidedByPlugin() {
    GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
    doThrow(new RuntimeException("foo")).when(extension).getPluginSettingsConfiguration("plugin1");
    ArtifactPluginInfo artifactPluginInfo = new ArtifactPluginInfoBuilder(extension).pluginInfoFor(descriptor);
    assertThat(artifactPluginInfo.getDescriptor(), is(descriptor));
    assertThat(artifactPluginInfo.getExtensionName(), is(PluginConstants.ARTIFACT_EXTENSION));
}
Also used : GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) ArtifactPluginInfo(com.thoughtworks.go.plugin.domain.artifact.ArtifactPluginInfo) Test(org.junit.Test)

Example 3 with ArtifactPluginInfo

use of com.thoughtworks.go.plugin.domain.artifact.ArtifactPluginInfo 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 4 with ArtifactPluginInfo

use of com.thoughtworks.go.plugin.domain.artifact.ArtifactPluginInfo in project gocd by gocd.

the class ArtifactStoreTest method postConstruct_shouldEncryptSecureConfigurations.

@Test
public void postConstruct_shouldEncryptSecureConfigurations() {
    final PluggableInstanceSettings storeConfig = new PluggableInstanceSettings(Arrays.asList(new PluginConfiguration("password", new Metadata(true, true))));
    final ArtifactPluginInfo pluginInfo = new ArtifactPluginInfo(pluginDescriptor("plugin_id"), storeConfig, null, null, null, null);
    store.setPluginInfo(pluginInfo);
    ArtifactStore artifactStore = new ArtifactStore("id", "plugin_id", new ConfigurationProperty(new ConfigurationKey("password"), new ConfigurationValue("pass")));
    artifactStore.encryptSecureConfigurations();
    assertThat(artifactStore.size(), is(1));
    assertTrue(artifactStore.first().isSecure());
}
Also used : ConfigurationProperty(com.thoughtworks.go.domain.config.ConfigurationProperty) ConfigurationValue(com.thoughtworks.go.domain.config.ConfigurationValue) PluggableInstanceSettings(com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings) ConfigurationKey(com.thoughtworks.go.domain.config.ConfigurationKey) Metadata(com.thoughtworks.go.plugin.domain.common.Metadata) PluginConfiguration(com.thoughtworks.go.plugin.domain.common.PluginConfiguration) ArtifactPluginInfo(com.thoughtworks.go.plugin.domain.artifact.ArtifactPluginInfo) Test(org.junit.Test)

Example 5 with ArtifactPluginInfo

use of com.thoughtworks.go.plugin.domain.artifact.ArtifactPluginInfo in project gocd by gocd.

the class ArtifactStoreTest method shouldReturnTrueIfPluginInfoIsDefined.

@Test
public void shouldReturnTrueIfPluginInfoIsDefined() {
    final ArtifactPluginInfo pluginInfo = new ArtifactPluginInfo(pluginDescriptor("plugin_id"), null, null, null, null, null);
    store.setPluginInfo(pluginInfo);
    final ArtifactStore artifactStore = new ArtifactStore("id", "plugin_id");
    assertTrue(artifactStore.hasPluginInfo());
}
Also used : ArtifactPluginInfo(com.thoughtworks.go.plugin.domain.artifact.ArtifactPluginInfo) Test(org.junit.Test)

Aggregations

ArtifactPluginInfo (com.thoughtworks.go.plugin.domain.artifact.ArtifactPluginInfo)7 Test (org.junit.Test)7 GoPluginDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)5 ConfigurationKey (com.thoughtworks.go.domain.config.ConfigurationKey)1 ConfigurationProperty (com.thoughtworks.go.domain.config.ConfigurationProperty)1 ConfigurationValue (com.thoughtworks.go.domain.config.ConfigurationValue)1 Capabilities (com.thoughtworks.go.plugin.domain.artifact.Capabilities)1 Metadata (com.thoughtworks.go.plugin.domain.common.Metadata)1 PluggableInstanceSettings (com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings)1 PluginConfiguration (com.thoughtworks.go.plugin.domain.common.PluginConfiguration)1