Search in sources :

Example 1 with Capabilities

use of com.thoughtworks.go.plugin.domain.analytics.Capabilities in project gocd by gocd.

the class GoVelocityViewTest method shouldSetSupportsAnalyticsDashboardIfPluginInstalled.

@Test
public void shouldSetSupportsAnalyticsDashboardIfPluginInstalled() throws Exception {
    List<SupportedAnalytics> supportedAnalytics = Collections.singletonList(new SupportedAnalytics("dashboard", "id", "foo"));
    AnalyticsPluginInfo info = new AnalyticsPluginInfo(null, null, new Capabilities(supportedAnalytics), null);
    when(pluginInfoFinder.allPluginInfos(ANALYTICS_EXTENSION)).thenReturn(Collections.singletonList(new CombinedPluginInfo(info)));
    view.exposeHelpers(velocityContext, request);
    assertThat(velocityContext.get(GoVelocityView.SUPPORTS_ANALYTICS_DASHBOARD), is(true));
}
Also used : AnalyticsPluginInfo(com.thoughtworks.go.plugin.domain.analytics.AnalyticsPluginInfo) Capabilities(com.thoughtworks.go.plugin.domain.analytics.Capabilities) SupportedAnalytics(com.thoughtworks.go.plugin.domain.analytics.SupportedAnalytics) CombinedPluginInfo(com.thoughtworks.go.plugin.domain.common.CombinedPluginInfo) Test(org.junit.Test)

Example 2 with Capabilities

use of com.thoughtworks.go.plugin.domain.analytics.Capabilities in project gocd by gocd.

the class AnalyticsPluginInfoBuilderTest method shouldBuildPluginInfoWithCapabilities.

@Test
public void shouldBuildPluginInfoWithCapabilities() throws Exception {
    GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
    Capabilities capabilities = new Capabilities(Collections.emptyList());
    when(extension.getCapabilities(descriptor.id())).thenReturn(capabilities);
    AnalyticsPluginInfo pluginInfo = new AnalyticsPluginInfoBuilder(extension).pluginInfoFor(descriptor);
    assertThat(pluginInfo.getCapabilities(), is(capabilities));
}
Also used : AnalyticsPluginInfo(com.thoughtworks.go.plugin.domain.analytics.AnalyticsPluginInfo) Capabilities(com.thoughtworks.go.plugin.domain.analytics.Capabilities) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) Test(org.junit.Test)

Example 3 with Capabilities

use of com.thoughtworks.go.plugin.domain.analytics.Capabilities in project gocd by gocd.

the class AnalyticsPluginInfoBuilder method pluginInfoFor.

public AnalyticsPluginInfo pluginInfoFor(GoPluginDescriptor descriptor) {
    Capabilities capabilities = capabilities(descriptor.id());
    PluggableInstanceSettings pluginSettingsAndView = getPluginSettingsAndView(descriptor, extension);
    Image image = image(descriptor.id());
    return new AnalyticsPluginInfo(descriptor, image, capabilities, pluginSettingsAndView);
}
Also used : AnalyticsPluginInfo(com.thoughtworks.go.plugin.domain.analytics.AnalyticsPluginInfo) PluggableInstanceSettings(com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings) Capabilities(com.thoughtworks.go.plugin.domain.analytics.Capabilities) Image(com.thoughtworks.go.plugin.domain.common.Image)

Example 4 with Capabilities

use of com.thoughtworks.go.plugin.domain.analytics.Capabilities in project gocd by gocd.

the class AnalyticsPluginInfoBuilderTest method setUp.

@Before
public void setUp() throws Exception {
    extension = mock(AnalyticsExtension.class);
    stub(extension.getCapabilities(any(String.class))).toReturn(new Capabilities(Collections.emptyList()));
}
Also used : Capabilities(com.thoughtworks.go.plugin.domain.analytics.Capabilities) Before(org.junit.Before)

Example 5 with Capabilities

use of com.thoughtworks.go.plugin.domain.analytics.Capabilities in project gocd by gocd.

the class InitialContextProviderTest method analyticsPluginInfo.

private AnalyticsPluginInfo analyticsPluginInfo() {
    AnalyticsPluginInfo analyticsPluginInfo = mock(AnalyticsPluginInfo.class);
    Capabilities capabilities = mock(Capabilities.class);
    when(capabilities.supportsDashboardAnalytics()).thenReturn(true);
    when(analyticsPluginInfo.getCapabilities()).thenReturn(capabilities);
    when(analyticsPluginInfo.getExtensionName()).thenReturn(PluginConstants.ANALYTICS_EXTENSION);
    return analyticsPluginInfo;
}
Also used : AnalyticsPluginInfo(com.thoughtworks.go.plugin.domain.analytics.AnalyticsPluginInfo) Capabilities(com.thoughtworks.go.plugin.domain.analytics.Capabilities)

Aggregations

Capabilities (com.thoughtworks.go.plugin.domain.analytics.Capabilities)5 AnalyticsPluginInfo (com.thoughtworks.go.plugin.domain.analytics.AnalyticsPluginInfo)4 Test (org.junit.Test)2 SupportedAnalytics (com.thoughtworks.go.plugin.domain.analytics.SupportedAnalytics)1 CombinedPluginInfo (com.thoughtworks.go.plugin.domain.common.CombinedPluginInfo)1 Image (com.thoughtworks.go.plugin.domain.common.Image)1 PluggableInstanceSettings (com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings)1 GoPluginDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)1 Before (org.junit.Before)1