use of com.thoughtworks.go.server.ui.plugins.PluginInfo in project gocd by gocd.
the class PluggableTaskViewModelBuilderTest method shouldBeAbleToFetchAPluginInfoForAGivenIdWithConfigurations.
@Test
public void shouldBeAbleToFetchAPluginInfoForAGivenIdWithConfigurations() {
when(manager.getPluginDescriptorFor("xunit.convertor")).thenReturn(xunitConvertor);
PluginInfo pluginInfo = builder.pluginInfoFor("xunit.convertor");
HashMap expectedMetadata = new HashMap<String, Object>() {
{
put("required", false);
put("secure", false);
}
};
List<PluginConfiguration> configurations = pluginInfo.getPluggableInstanceSettings().getConfigurations();
assertThat(configurations.size(), is(2));
PluginConfiguration configuration1 = configurations.get(0);
assertThat(configuration1.getKey(), is("key1"));
assertNull(configuration1.getType());
assertThat(configuration1.getMetadata(), Is.<Map<String, Object>>is(expectedMetadata));
PluginConfiguration configuration2 = configurations.get(1);
assertThat(configuration2.getKey(), is("key2"));
assertNull(configuration2.getType());
assertThat(configuration1.getMetadata(), Is.<Map<String, Object>>is(expectedMetadata));
}
use of com.thoughtworks.go.server.ui.plugins.PluginInfo in project gocd by gocd.
the class NotificationViewModelBuilderTest method shouldBeAbleToFetchAllPluginInfos.
@Test
public void shouldBeAbleToFetchAllPluginInfos() {
HashSet<String> pluginIds = new HashSet<>(Arrays.asList("email.notifier", "slack.notifier"));
when(registry.getNotificationPlugins()).thenReturn(pluginIds);
when(manager.getPluginDescriptorFor("email.notifier")).thenReturn(emailNotifier);
when(manager.getPluginDescriptorFor("slack.notifier")).thenReturn(slackNotifier);
List<PluginInfo> pluginInfos = builder.allPluginInfos();
assertThat(pluginInfos.size(), is(2));
PluginInfo pluginInfo = pluginInfos.get(0).getId().equals("email.notifier") ? pluginInfos.get(0) : pluginInfos.get(1);
assertThat(pluginInfo.getId(), is("email.notifier"));
assertThat(pluginInfo.getType(), is("notification"));
assertThat(pluginInfo.getName(), is(emailNotifier.about().name()));
assertThat(pluginInfo.getVersion(), is(emailNotifier.about().version()));
assertNull(pluginInfo.getPluggableInstanceSettings());
}
use of com.thoughtworks.go.server.ui.plugins.PluginInfo in project gocd by gocd.
the class PackageViewModelBuilderTest method shouldBeAbleToFetchAPluginInfoForAGivenIdWithConfigurations.
@Test
public void shouldBeAbleToFetchAPluginInfoForAGivenIdWithConfigurations() {
when(manager.getPluginDescriptorFor("yum.poller")).thenReturn(yumPoller);
PluginInfo pluginInfo = builder.pluginInfoFor("yum.poller");
HashMap expectedMetadata = new HashMap<String, Object>() {
{
put("required", true);
put("secure", false);
put("part_of_identity", true);
put("display_order", 0);
put("display_name", "");
}
};
List<PluginConfiguration> configurations = pluginInfo.getPluggableInstanceSettings().getConfigurations();
assertThat(configurations.size(), is(3));
PluginConfiguration configuration2 = configurations.get(0);
assertThat(configuration2.getKey(), is("key1"));
assertThat(configuration2.getType(), is("package"));
assertThat(configuration2.getMetadata(), Is.<Map<String, Object>>is(expectedMetadata));
PluginConfiguration configuration3 = configurations.get(1);
assertThat(configuration3.getKey(), is("key2"));
assertThat(configuration3.getType(), is("package"));
assertThat(configuration3.getMetadata(), Is.<Map<String, Object>>is(expectedMetadata));
PluginConfiguration configuration1 = configurations.get(2);
assertThat(configuration1.getKey(), is("key1"));
assertThat(configuration1.getType(), is("repository"));
assertThat(configuration1.getMetadata(), Is.<Map<String, Object>>is(expectedMetadata));
}
use of com.thoughtworks.go.server.ui.plugins.PluginInfo in project gocd by gocd.
the class PackageViewModelBuilderTest method shouldBeAbleToFetchAPluginInfoForAGivenId.
@Test
public void shouldBeAbleToFetchAPluginInfoForAGivenId() {
when(manager.getPluginDescriptorFor("yum.poller")).thenReturn(yumPoller);
PluginInfo pluginInfo = builder.pluginInfoFor("yum.poller");
assertThat(pluginInfo.getId(), is("yum.poller"));
assertThat(pluginInfo.getType(), is("package-repository"));
assertThat(pluginInfo.getName(), is(yumPoller.about().name()));
assertThat(pluginInfo.getVersion(), is(yumPoller.about().version()));
assertNull(pluginInfo.getPluggableInstanceSettings().getView());
}
use of com.thoughtworks.go.server.ui.plugins.PluginInfo in project gocd by gocd.
the class AuthenticationViewModelBuilder method allPluginInfos.
public List<PluginInfo> allPluginInfos() {
List<PluginInfo> pluginInfos = new ArrayList<>();
for (String pluginId : registry.getAuthenticationPlugins()) {
GoPluginDescriptor descriptor = pluginManager.getPluginDescriptorFor(pluginId);
pluginInfos.add(new PluginInfo(descriptor, AuthenticationExtension.EXTENSION_NAME, null, null, null));
}
return pluginInfos;
}
Aggregations