Search in sources :

Example 1 with AnalyticsPluginInfo

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);
}
Also used : AnalyticsPluginInfo(com.thoughtworks.go.plugin.domain.analytics.AnalyticsPluginInfo)

Example 2 with AnalyticsPluginInfo

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)));
}
Also used : ElasticAgentPluginInfo(com.thoughtworks.go.plugin.domain.elastic.ElasticAgentPluginInfo) AnalyticsPluginInfo(com.thoughtworks.go.plugin.domain.analytics.AnalyticsPluginInfo) AuthorizationPluginInfo(com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo) Test(org.junit.Test)

Example 3 with AnalyticsPluginInfo

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));
}
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 4 with AnalyticsPluginInfo

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);
}
Also used : AnalyticsPluginInfo(com.thoughtworks.go.plugin.domain.analytics.AnalyticsPluginInfo) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)

Example 5 with 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)));
}
Also used : Path(java.nio.file.Path) AnalyticsPluginInfo(com.thoughtworks.go.plugin.domain.analytics.AnalyticsPluginInfo) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) Test(org.junit.Test)

Aggregations

AnalyticsPluginInfo (com.thoughtworks.go.plugin.domain.analytics.AnalyticsPluginInfo)18 Test (org.junit.Test)14 GoPluginDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)12 Capabilities (com.thoughtworks.go.plugin.domain.analytics.Capabilities)4 PluginMetadataChangeListener (com.thoughtworks.go.plugin.access.common.PluginMetadataChangeListener)2 InOrder (org.mockito.InOrder)2 PluginSettingsConfiguration (com.thoughtworks.go.plugin.access.common.settings.PluginSettingsConfiguration)1 PluginSettingsProperty (com.thoughtworks.go.plugin.access.common.settings.PluginSettingsProperty)1 PluginDescriptor (com.thoughtworks.go.plugin.api.info.PluginDescriptor)1 DefaultGoPluginApiResponse (com.thoughtworks.go.plugin.api.response.DefaultGoPluginApiResponse)1 AnalyticsData (com.thoughtworks.go.plugin.domain.analytics.AnalyticsData)1 SupportedAnalytics (com.thoughtworks.go.plugin.domain.analytics.SupportedAnalytics)1 AuthorizationPluginInfo (com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo)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 ElasticAgentPluginInfo (com.thoughtworks.go.plugin.domain.elastic.ElasticAgentPluginInfo)1 Path (java.nio.file.Path)1