use of com.thoughtworks.go.plugin.domain.analytics.AnalyticsPluginInfo in project gocd by gocd.
the class AnalyticsMetadataStore method updateAssetsPath.
public void updateAssetsPath(String pluginId, String assetPath) {
AnalyticsPluginInfo pluginInfo = getPluginInfo(pluginId);
pluginInfo.setStaticAssetsPath(assetPath);
}
use of com.thoughtworks.go.plugin.domain.analytics.AnalyticsPluginInfo in project gocd by gocd.
the class CombinedPluginInfoTest method shouldFindFirstExtensionWithImageIfPluginImplementsAtleastOneExtensionWithImage.
@Test
public void shouldFindFirstExtensionWithImageIfPluginImplementsAtleastOneExtensionWithImage() throws Exception {
Image image1 = new Image("c1", "d1", "hash1");
Image image2 = new Image("c2", "d2", "hash2");
Image image3 = new Image("c3", "d3", "hash3");
ElasticAgentPluginInfo elasticAgentPluginInfo = new ElasticAgentPluginInfo(null, null, image1, null, null);
AuthorizationPluginInfo authorizationPluginInfo = new AuthorizationPluginInfo(null, null, null, image2, null);
AnalyticsPluginInfo analyticsPluginInfo = new AnalyticsPluginInfo(null, image3, null, null);
assertThat(new CombinedPluginInfo(elasticAgentPluginInfo).getImage(), is(image1));
assertThat(new CombinedPluginInfo(authorizationPluginInfo).getImage(), is(image2));
assertThat(new CombinedPluginInfo(analyticsPluginInfo).getImage(), is(image3));
assertThat(new CombinedPluginInfo(asList(elasticAgentPluginInfo, authorizationPluginInfo)).getImage(), anyOf(is(image1), is(image2)));
assertThat(new CombinedPluginInfo(asList(analyticsPluginInfo, authorizationPluginInfo)).getImage(), anyOf(is(image2), is(image3)));
}
use of com.thoughtworks.go.plugin.domain.analytics.AnalyticsPluginInfo 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.AnalyticsPluginInfo in project gocd by gocd.
the class AnalyticsPluginAssetsServiceTest method addAnalyticsPluginInfoToStore.
private void addAnalyticsPluginInfoToStore(String pluginId) {
GoPluginDescriptor goPluginDescriptor = new GoPluginDescriptor(pluginId, null, null, null, null, false);
AnalyticsPluginInfo analyticsPluginInfo = new AnalyticsPluginInfo(goPluginDescriptor, null, null, null);
metadataStore.setPluginInfo(analyticsPluginInfo);
}
use of com.thoughtworks.go.plugin.domain.analytics.AnalyticsPluginInfo in project gocd by gocd.
the class AnalyticsPluginAssetsServiceTest method onPluginMetadataLoad_shouldUpdateThePluginInfoWithAssetsPath.
@Test
public void onPluginMetadataLoad_shouldUpdateThePluginInfoWithAssetsPath() throws Exception {
railsRoot = temporaryFolder.newFolder();
Path pluginDirPath = Paths.get(railsRoot.getAbsolutePath(), "public", "assets", "plugins", PLUGIN_ID);
GoPluginDescriptor goPluginDescriptor = new GoPluginDescriptor(PLUGIN_ID, null, null, null, null, false);
AnalyticsPluginInfo analyticsPluginInfo = new AnalyticsPluginInfo(goPluginDescriptor, null, null, null);
metadataStore.setPluginInfo(analyticsPluginInfo);
Path dirtyPath = Paths.get(pluginDirPath.toString(), "dirty.txt");
FileUtils.forceMkdirParent(dirtyPath.toFile());
Files.write(dirtyPath, "hello".getBytes());
assertTrue(pluginDirPath.toFile().exists());
assertTrue(dirtyPath.toFile().exists());
when(servletContext.getInitParameter("rails.root")).thenReturn("rails-root");
when(servletContext.getRealPath("rails-root")).thenReturn(railsRoot.getAbsolutePath());
when(extension.canHandlePlugin(PLUGIN_ID)).thenReturn(true);
when(extension.getStaticAssets(PLUGIN_ID)).thenReturn(testDataZipArchive());
assetsService.onPluginMetadataCreate(PLUGIN_ID);
assertThat(analyticsPluginInfo.getStaticAssetsPath(), is(assetsService.assetPathFor(PLUGIN_ID)));
}
Aggregations