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"))));
}
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));
}
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"))));
}
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());
}
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());
}
Aggregations