Search in sources :

Example 1 with NotificationPluginInfo

use of com.thoughtworks.go.plugin.domain.notification.NotificationPluginInfo in project gocd by gocd.

the class NotificationPluginInfoBuilderTest method shouldContinueWithBuildingPluginInfoWhenPluginViewIsNotProvidedByPlugin.

@Test
public void shouldContinueWithBuildingPluginInfoWhenPluginViewIsNotProvidedByPlugin() throws Exception {
    GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
    stub(extension.getPluginSettingsView("plugin1")).toReturn(null);
    NotificationPluginInfo pluginInfo = new NotificationPluginInfoBuilder(extension).pluginInfoFor(descriptor);
    assertThat(pluginInfo.getDescriptor(), is(descriptor));
    assertThat(pluginInfo.getExtensionName(), is("notification"));
    assertNull(pluginInfo.getPluginSettings());
}
Also used : NotificationPluginInfo(com.thoughtworks.go.plugin.domain.notification.NotificationPluginInfo) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) Test(org.junit.Test)

Example 2 with NotificationPluginInfo

use of com.thoughtworks.go.plugin.domain.notification.NotificationPluginInfo in project gocd by gocd.

the class NotificationPluginInfoBuilderTest method shouldContinueWithBuildingPluginInfoWhenPluginSettingsIsNotProvidedByPlugin.

@Test
public void shouldContinueWithBuildingPluginInfoWhenPluginSettingsIsNotProvidedByPlugin() throws Exception {
    GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
    stub(extension.getPluginSettingsConfiguration("plugin1")).toReturn(null);
    NotificationPluginInfo pluginInfo = new NotificationPluginInfoBuilder(extension).pluginInfoFor(descriptor);
    assertThat(pluginInfo.getDescriptor(), is(descriptor));
    assertThat(pluginInfo.getExtensionName(), is("notification"));
    assertNull(pluginInfo.getPluginSettings());
}
Also used : NotificationPluginInfo(com.thoughtworks.go.plugin.domain.notification.NotificationPluginInfo) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) Test(org.junit.Test)

Example 3 with NotificationPluginInfo

use of com.thoughtworks.go.plugin.domain.notification.NotificationPluginInfo in project gocd by gocd.

the class CombinedPluginInfoTest method shouldNotFindImageIfPluginDoesNotImplementAnExtensionWhichHasImages.

@Test
public void shouldNotFindImageIfPluginDoesNotImplementAnExtensionWhichHasImages() throws Exception {
    NotificationPluginInfo notificationPluginInfo = new NotificationPluginInfo(null, null);
    PluggableTaskPluginInfo pluggableTaskPluginInfo = new PluggableTaskPluginInfo(null, null, null);
    assertThat(new CombinedPluginInfo(notificationPluginInfo).getImage(), is(nullValue()));
    assertThat(new CombinedPluginInfo(pluggableTaskPluginInfo).getImage(), is(nullValue()));
    assertThat(new CombinedPluginInfo(asList(pluggableTaskPluginInfo, notificationPluginInfo)).getImage(), is(nullValue()));
}
Also used : NotificationPluginInfo(com.thoughtworks.go.plugin.domain.notification.NotificationPluginInfo) PluggableTaskPluginInfo(com.thoughtworks.go.plugin.domain.pluggabletask.PluggableTaskPluginInfo) Test(org.junit.Test)

Example 4 with NotificationPluginInfo

use of com.thoughtworks.go.plugin.domain.notification.NotificationPluginInfo in project gocd by gocd.

the class CombinedPluginInfoTest method shouldFindAnExtensionOfAGivenTypeIfItExists.

@Test
public void shouldFindAnExtensionOfAGivenTypeIfItExists() throws Exception {
    NotificationPluginInfo notificationPluginInfo = new NotificationPluginInfo(null, null);
    PluggableTaskPluginInfo pluggableTaskPluginInfo = new PluggableTaskPluginInfo(null, null, null);
    CombinedPluginInfo pluginInfo = new CombinedPluginInfo(asList(pluggableTaskPluginInfo, notificationPluginInfo));
    assertThat(pluginInfo.extensionFor(NOTIFICATION_EXTENSION), is(notificationPluginInfo));
    assertThat(pluginInfo.extensionFor(PLUGGABLE_TASK_EXTENSION), is(pluggableTaskPluginInfo));
    assertThat(pluginInfo.extensionFor(ANALYTICS_EXTENSION), is(nullValue()));
}
Also used : NotificationPluginInfo(com.thoughtworks.go.plugin.domain.notification.NotificationPluginInfo) PluggableTaskPluginInfo(com.thoughtworks.go.plugin.domain.pluggabletask.PluggableTaskPluginInfo) Test(org.junit.Test)

Example 5 with NotificationPluginInfo

use of com.thoughtworks.go.plugin.domain.notification.NotificationPluginInfo in project gocd by gocd.

the class CombinedPluginInfoTest method shouldGetDescriptorOfPluginUsingAnyPluginInfo.

@Test
public void shouldGetDescriptorOfPluginUsingAnyPluginInfo() throws Exception {
    PluginDescriptor descriptor = mock(PluginDescriptor.class);
    NotificationPluginInfo notificationPluginInfo = new NotificationPluginInfo(descriptor, null);
    PluggableTaskPluginInfo pluggableTaskPluginInfo = new PluggableTaskPluginInfo(descriptor, null, null);
    CombinedPluginInfo pluginInfo = new CombinedPluginInfo(asList(pluggableTaskPluginInfo, notificationPluginInfo));
    assertThat(pluginInfo.getDescriptor(), is(descriptor));
}
Also used : PluginDescriptor(com.thoughtworks.go.plugin.api.info.PluginDescriptor) NotificationPluginInfo(com.thoughtworks.go.plugin.domain.notification.NotificationPluginInfo) PluggableTaskPluginInfo(com.thoughtworks.go.plugin.domain.pluggabletask.PluggableTaskPluginInfo) Test(org.junit.Test)

Aggregations

NotificationPluginInfo (com.thoughtworks.go.plugin.domain.notification.NotificationPluginInfo)9 Test (org.junit.Test)9 GoPluginDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)5 PluggableTaskPluginInfo (com.thoughtworks.go.plugin.domain.pluggabletask.PluggableTaskPluginInfo)4 SCMPluginInfo (com.thoughtworks.go.plugin.domain.scm.SCMPluginInfo)2 File (java.io.File)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)2 PluginSettingsConfiguration (com.thoughtworks.go.plugin.access.common.settings.PluginSettingsConfiguration)1 PluginDescriptor (com.thoughtworks.go.plugin.api.info.PluginDescriptor)1 Metadata (com.thoughtworks.go.plugin.domain.common.Metadata)1 PluggableInstanceSettings (com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings)1 PluginConfiguration (com.thoughtworks.go.plugin.domain.common.PluginConfiguration)1 PluginView (com.thoughtworks.go.plugin.domain.common.PluginView)1