Search in sources :

Example 1 with PluggableTaskPluginInfo

use of com.thoughtworks.go.plugin.domain.pluggabletask.PluggableTaskPluginInfo in project gocd by gocd.

the class PluggableTaskPluginInfoBuilderTest method shouldBuildPluginInfo.

@Test
public void shouldBuildPluginInfo() throws Exception {
    GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
    PluggableTaskPluginInfo pluginInfo = new PluggableTaskPluginInfoBuilder(extension).pluginInfoFor(descriptor);
    List<PluginConfiguration> pluginConfigurations = Arrays.asList(new PluginConfiguration("username", new Metadata(true, false)), new PluginConfiguration("password", new Metadata(true, true)));
    PluginView pluginView = new PluginView("some html");
    assertThat(pluginInfo.getDescriptor(), is(descriptor));
    assertThat(pluginInfo.getExtensionName(), is("task"));
    assertThat(pluginInfo.getDisplayName(), is("my task plugin"));
    assertThat(pluginInfo.getTaskSettings(), is(new PluggableInstanceSettings(pluginConfigurations, pluginView)));
    assertNull(pluginInfo.getPluginSettings());
}
Also used : PluggableInstanceSettings(com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings) Metadata(com.thoughtworks.go.plugin.domain.common.Metadata) PluggableTaskPluginInfo(com.thoughtworks.go.plugin.domain.pluggabletask.PluggableTaskPluginInfo) PluginConfiguration(com.thoughtworks.go.plugin.domain.common.PluginConfiguration) PluginView(com.thoughtworks.go.plugin.domain.common.PluginView) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) Test(org.junit.Test)

Example 2 with PluggableTaskPluginInfo

use of com.thoughtworks.go.plugin.domain.pluggabletask.PluggableTaskPluginInfo 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 3 with PluggableTaskPluginInfo

use of com.thoughtworks.go.plugin.domain.pluggabletask.PluggableTaskPluginInfo 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 4 with PluggableTaskPluginInfo

use of com.thoughtworks.go.plugin.domain.pluggabletask.PluggableTaskPluginInfo 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)

Example 5 with PluggableTaskPluginInfo

use of com.thoughtworks.go.plugin.domain.pluggabletask.PluggableTaskPluginInfo in project gocd by gocd.

the class CombinedPluginInfoTest method shouldGetAllIndividualExtensionInfos.

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

Aggregations

PluggableTaskPluginInfo (com.thoughtworks.go.plugin.domain.pluggabletask.PluggableTaskPluginInfo)6 Test (org.junit.Test)5 NotificationPluginInfo (com.thoughtworks.go.plugin.domain.notification.NotificationPluginInfo)4 PluggableInstanceSettings (com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings)2 PluginView (com.thoughtworks.go.plugin.domain.common.PluginView)2 GoPluginDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)2 PluginDescriptor (com.thoughtworks.go.plugin.api.info.PluginDescriptor)1 Task (com.thoughtworks.go.plugin.api.task.Task)1 TaskConfig (com.thoughtworks.go.plugin.api.task.TaskConfig)1 TaskView (com.thoughtworks.go.plugin.api.task.TaskView)1 Metadata (com.thoughtworks.go.plugin.domain.common.Metadata)1 PluginConfiguration (com.thoughtworks.go.plugin.domain.common.PluginConfiguration)1