Search in sources :

Example 1 with SupportedAnalytics

use of com.thoughtworks.go.plugin.domain.analytics.SupportedAnalytics 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 SupportedAnalytics

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

the class AnalyticsExtensionTest method shouldTalkToPlugin_To_GetCapabilities.

@Test
public void shouldTalkToPlugin_To_GetCapabilities() throws Exception {
    String responseBody = "{\n" + "\"supported_analytics\": [\n" + "  {\"type\": \"dashboard\", \"id\": \"abc\",  \"title\": \"Title 1\"},\n" + "  {\"type\": \"pipeline\", \"id\": \"abc\",  \"title\": \"Title 1\"}\n" + "]}";
    when(pluginManager.submitTo(eq(PLUGIN_ID), eq(ANALYTICS_EXTENSION), requestArgumentCaptor.capture())).thenReturn(new DefaultGoPluginApiResponse(SUCCESS_RESPONSE_CODE, responseBody));
    com.thoughtworks.go.plugin.domain.analytics.Capabilities capabilities = analyticsExtension.getCapabilities(PLUGIN_ID);
    assertRequest(requestArgumentCaptor.getValue(), PluginConstants.ANALYTICS_EXTENSION, "1.0", REQUEST_GET_CAPABILITIES, null);
    assertThat(capabilities.supportedDashboardAnalytics(), containsInAnyOrder(new SupportedAnalytics("dashboard", "abc", "Title 1")));
    assertThat(capabilities.supportedPipelineAnalytics(), containsInAnyOrder(new SupportedAnalytics("pipeline", "abc", "Title 1")));
}
Also used : DefaultGoPluginApiResponse(com.thoughtworks.go.plugin.api.response.DefaultGoPluginApiResponse) SupportedAnalytics(com.thoughtworks.go.plugin.domain.analytics.SupportedAnalytics) Test(org.junit.Test)

Aggregations

SupportedAnalytics (com.thoughtworks.go.plugin.domain.analytics.SupportedAnalytics)2 Test (org.junit.Test)2 DefaultGoPluginApiResponse (com.thoughtworks.go.plugin.api.response.DefaultGoPluginApiResponse)1 AnalyticsPluginInfo (com.thoughtworks.go.plugin.domain.analytics.AnalyticsPluginInfo)1 Capabilities (com.thoughtworks.go.plugin.domain.analytics.Capabilities)1 CombinedPluginInfo (com.thoughtworks.go.plugin.domain.common.CombinedPluginInfo)1