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));
}
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")));
}
Aggregations