use of com.thoughtworks.go.server.ui.plugins.PluginView in project gocd by gocd.
the class ElasticAgentPluginInfoBuilderTest method allPluginInfos_ShouldReturnAListOfAllPluginInfos.
@Test
public void allPluginInfos_ShouldReturnAListOfAllPluginInfos() throws Exception {
GoPluginDescriptor.About about = new GoPluginDescriptor.About("Plugin Descriptor Validator", "1.0.1", "12.4", "Validates its own plugin descriptor", new GoPluginDescriptor.Vendor("ThoughtWorks Go Team", "www.thoughtworks.com"), Arrays.asList("Linux", "Windows", "Mac OS X"));
GoPluginDescriptor plugin = new GoPluginDescriptor("docker-plugin", "1.0", about, null, null, false);
PluginProfileMetadataKeys metadataKeys = new PluginProfileMetadataKeys(Arrays.asList(new PluginProfileMetadataKey("password", new PluginProfileMetadata(true, true))));
Image image = new Image("image/png", Base64.getEncoder().encodeToString("some-base64-encoded-data".getBytes(UTF_8)));
;
String view = "some html view";
ElasticPluginConfigMetadataStore store = mock(ElasticPluginConfigMetadataStore.class);
when(store.getPlugins()).thenReturn(Arrays.asList(plugin));
when(store.find("docker-plugin")).thenReturn(plugin);
when(store.getProfileMetadata(plugin)).thenReturn(metadataKeys);
when(store.getIcon(plugin)).thenReturn(image);
when(store.getProfileView(plugin)).thenReturn(view);
ElasticAgentPluginInfoBuilder builder = new ElasticAgentPluginInfoBuilder(store);
Collection<ElasticPluginInfo> pluginInfos = builder.allPluginInfos();
PluggableInstanceSettings settings = new PluggableInstanceSettings(PluginConfiguration.getPluginConfigurations(metadataKeys), new PluginView(view));
assertEquals(Arrays.asList(new ElasticPluginInfo(plugin, settings, image)), pluginInfos);
}
use of com.thoughtworks.go.server.ui.plugins.PluginView in project gocd by gocd.
the class AuthorizationPluginInfoBuilder method pluginInfoFor.
@Override
public AuthorizationPluginInfo pluginInfoFor(String pluginId) {
PluginDescriptor descriptor = store.find(pluginId);
if (descriptor == null) {
return null;
}
Image icon = store.getIcon(descriptor);
ArrayList<PluginConfiguration> pluginConfigurations = PluginConfiguration.getPluginConfigurations(store.getProfileMetadata(descriptor));
PluginView profileView = new PluginView(store.getProfileView(descriptor));
PluggableInstanceSettings profileSettings = new PluggableInstanceSettings(pluginConfigurations, profileView);
ArrayList<PluginConfiguration> roleConfigurations = PluginConfiguration.getPluginConfigurations(store.getRoleMetadata(descriptor));
PluginView roleView = new PluginView(store.getRoleView(descriptor));
PluggableInstanceSettings roleSettings = new PluggableInstanceSettings(roleConfigurations, roleView);
return new AuthorizationPluginInfo(descriptor, profileSettings, roleSettings, icon);
}
use of com.thoughtworks.go.server.ui.plugins.PluginView in project gocd by gocd.
the class AuthorizationViewModelBuilder method pluginInfoFor.
@Override
public PluginInfo pluginInfoFor(String pluginId) {
PluginDescriptor descriptor = metadataStore.find(pluginId);
if (descriptor == null) {
return null;
}
Image icon = metadataStore.getIcon(descriptor);
ArrayList<PluginConfiguration> pluginConfigurations = PluginConfiguration.getPluginConfigurations(metadataStore.getProfileMetadata(descriptor));
PluginView profileView = new PluginView(metadataStore.getProfileView(descriptor));
PluggableInstanceSettings profileSettings = new PluggableInstanceSettings(pluginConfigurations, profileView);
ArrayList<PluginConfiguration> roleConfigurations = PluginConfiguration.getPluginConfigurations(metadataStore.getRoleMetadata(descriptor));
PluginView roleView = new PluginView(metadataStore.getRoleView(descriptor));
PluggableInstanceSettings roleSettings = new PluggableInstanceSettings(roleConfigurations, roleView);
return new PluginInfo(descriptor, AuthorizationPluginConstants.EXTENSION_NAME, null, profileSettings, roleSettings, icon);
}
use of com.thoughtworks.go.server.ui.plugins.PluginView in project gocd by gocd.
the class ElasticAgentPluginInfoBuilder method pluginInfoFor.
@Override
public ElasticPluginInfo pluginInfoFor(String pluginId) {
PluginDescriptor descriptor = store.find(pluginId);
if (descriptor == null) {
return null;
}
Image icon = store.getIcon(descriptor);
ArrayList<PluginConfiguration> pluginConfigurations = PluginConfiguration.getPluginConfigurations(store.getProfileMetadata(descriptor));
PluginView pluginView = new PluginView(store.getProfileView(descriptor));
PluggableInstanceSettings settings = new PluggableInstanceSettings(pluginConfigurations, pluginView);
return new ElasticPluginInfo(descriptor, settings, icon);
}
use of com.thoughtworks.go.server.ui.plugins.PluginView in project gocd by gocd.
the class PluggableTaskViewModelBuilder method pluginInfoFor.
public PluginInfo pluginInfoFor(String pluginId) {
if (!PluggableTaskConfigStore.store().hasPreferenceFor(pluginId)) {
return null;
}
GoPluginDescriptor descriptor = pluginManager.getPluginDescriptorFor(pluginId);
TaskPreference taskPreference = PluggableTaskConfigStore.store().preferenceFor(pluginId);
List<PluginConfiguration> pluginConfigurations = configurations(taskPreference.getConfig());
PluginView pluginView = new PluginView(taskPreference.getView().template());
return new PluginInfo(descriptor, TaskExtension.TASK_EXTENSION, taskPreference.getView().displayValue(), new PluggableInstanceSettings(pluginConfigurations, pluginView));
}
Aggregations