Search in sources :

Example 31 with PluginInfo

use of com.thoughtworks.go.server.ui.plugins.PluginInfo in project gocd by gocd.

the class NotificationViewModelBuilderTest method shouldBeAbleToFetchAPluginInfoForAGivenId.

@Test
public void shouldBeAbleToFetchAPluginInfoForAGivenId() {
    HashSet<String> pluginIds = new HashSet<>(Arrays.asList("email.notifier", "slack.notifier"));
    when(registry.getNotificationPlugins()).thenReturn(pluginIds);
    when(manager.getPluginDescriptorFor("email.notifier")).thenReturn(emailNotifier);
    PluginInfo pluginInfo = builder.pluginInfoFor("email.notifier");
    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());
}
Also used : PluginInfo(com.thoughtworks.go.server.ui.plugins.PluginInfo) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 32 with PluginInfo

use of com.thoughtworks.go.server.ui.plugins.PluginInfo in project gocd by gocd.

the class PackageViewModelBuilderTest method shouldBeAbleToFetchAllPluginInfos.

@Test
public void shouldBeAbleToFetchAllPluginInfos() {
    when(manager.getPluginDescriptorFor("yum.poller")).thenReturn(yumPoller);
    when(manager.getPluginDescriptorFor("npm.poller")).thenReturn(npmPoller);
    List<PluginInfo> pluginInfos = builder.allPluginInfos();
    assertThat(pluginInfos.size(), is(2));
    PluginInfo pluginInfo = pluginInfos.get(0).getId() == "yum.poller" ? pluginInfos.get(0) : pluginInfos.get(1);
    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());
}
Also used : PluginInfo(com.thoughtworks.go.server.ui.plugins.PluginInfo) Test(org.junit.Test)

Aggregations

PluginInfo (com.thoughtworks.go.server.ui.plugins.PluginInfo)32 Test (org.junit.Test)20 GoPluginDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)9 PluginConfiguration (com.thoughtworks.go.server.ui.plugins.PluginConfiguration)9 ArrayList (java.util.ArrayList)9 PluginView (com.thoughtworks.go.server.ui.plugins.PluginView)7 Image (com.thoughtworks.go.plugin.access.common.models.Image)5 PluggableInstanceSettings (com.thoughtworks.go.server.ui.plugins.PluggableInstanceSettings)5 PluginDescriptor (com.thoughtworks.go.plugin.api.info.PluginDescriptor)4 HashSet (java.util.HashSet)4 HashMap (java.util.HashMap)3 TaskPreference (com.thoughtworks.go.plugin.access.pluggabletask.TaskPreference)2 SCMPreference (com.thoughtworks.go.plugin.access.scm.SCMPreference)2 PluginProfileMetadata (com.thoughtworks.go.plugin.access.common.models.PluginProfileMetadata)1 PluginProfileMetadataKey (com.thoughtworks.go.plugin.access.common.models.PluginProfileMetadataKey)1 PluginProfileMetadataKeys (com.thoughtworks.go.plugin.access.common.models.PluginProfileMetadataKeys)1