use of com.thoughtworks.go.server.ui.plugins.PluginConfiguration in project gocd by gocd.
the class SCMViewModelBuilder method pluginInfoFor.
public PluginInfo pluginInfoFor(String pluginId) {
if (!SCMMetadataStore.getInstance().hasPreferenceFor(pluginId)) {
return null;
}
GoPluginDescriptor descriptor = pluginManager.getPluginDescriptorFor(pluginId);
SCMPreference scmPreference = SCMMetadataStore.getInstance().preferenceFor(pluginId);
List<PluginConfiguration> pluginConfigurations = configurations(scmPreference.getScmConfigurations());
PluginView pluginView = new PluginView(scmPreference.getScmView().template());
return new PluginInfo(descriptor, SCMExtension.EXTENSION_NAME, scmPreference.getScmView().displayValue(), new PluggableInstanceSettings(pluginConfigurations, pluginView));
}
use of com.thoughtworks.go.server.ui.plugins.PluginConfiguration in project gocd by gocd.
the class ElasticAgentViewViewModelBuilderTest method shouldBeAbleToFetchPluginInfoForSinglePlugin.
@Test
public void shouldBeAbleToFetchPluginInfoForSinglePlugin() throws Exception {
when(elasticPluginConfigMetadataStore.find(dockerPlugin.id())).thenReturn(dockerPlugin);
Image image = new Image("image/png", Base64.getEncoder().encodeToString("some-base64-encoded-data".getBytes(UTF_8)));
;
when(elasticPluginConfigMetadataStore.getIcon(dockerPlugin)).thenReturn(image);
when(elasticPluginConfigMetadataStore.getProfileView(dockerPlugin)).thenReturn("html");
PluginProfileMetadataKey pluginProfileMetadataKey = new PluginProfileMetadataKey("foo", new PluginProfileMetadata(true, true));
PluginProfileMetadataKeys pluginProfileMetadataKeys = new PluginProfileMetadataKeys(Collections.singletonList(pluginProfileMetadataKey));
when(elasticPluginConfigMetadataStore.getProfileMetadata(dockerPlugin)).thenReturn(pluginProfileMetadataKeys);
PluginInfo pluginInfo = builder.pluginInfoFor(dockerPlugin.id());
assertThat(pluginInfo.getImage(), is(image));
assertThat(pluginInfo.getPluggableInstanceSettings().getView(), is(new PluginView("html")));
Map<String, Object> metadata = new HashMap<>();
metadata.put(REQUIRED_OPTION, true);
metadata.put(SECURE_OPTION, true);
assertEquals(pluginInfo.getPluggableInstanceSettings().getConfigurations(), Arrays.asList(new PluginConfiguration("foo", metadata, null)));
}
Aggregations