Search in sources :

Example 16 with AnalyticsPluginInfo

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

the class AnalyticsMetadataLoaderTest method onPluginUnloaded_shouldRemoveTheCorrespondingPluginInfoFromStore.

@Test
public void onPluginUnloaded_shouldRemoveTheCorrespondingPluginInfoFromStore() throws Exception {
    GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
    AnalyticsMetadataLoader metadataLoader = new AnalyticsMetadataLoader(pluginManager, metadataStore, infoBuilder, extension);
    AnalyticsPluginInfo pluginInfo = new AnalyticsPluginInfo(descriptor, null, null, null);
    metadataStore.setPluginInfo(pluginInfo);
    metadataLoader.pluginUnLoaded(descriptor);
    verify(metadataStore).remove(descriptor.id());
}
Also used : AnalyticsPluginInfo(com.thoughtworks.go.plugin.domain.analytics.AnalyticsPluginInfo) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) Test(org.junit.Test)

Example 17 with AnalyticsPluginInfo

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

the class AnalyticsPluginInfoBuilderTest method shouldContinueBuildingPluginInfoIfPluginSettingsIsNotProvidedByPlugin.

@Test
public void shouldContinueBuildingPluginInfoIfPluginSettingsIsNotProvidedByPlugin() {
    GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
    doThrow(new RuntimeException("foo")).when(extension).getPluginSettingsConfiguration("plugin1");
    AnalyticsPluginInfo pluginInfo = new AnalyticsPluginInfoBuilder(extension).pluginInfoFor(descriptor);
    assertThat(pluginInfo.getDescriptor(), is(descriptor));
    assertThat(pluginInfo.getExtensionName(), is("analytics"));
    assertNull(pluginInfo.getPluginSettings());
}
Also used : AnalyticsPluginInfo(com.thoughtworks.go.plugin.domain.analytics.AnalyticsPluginInfo) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) Test(org.junit.Test)

Example 18 with AnalyticsPluginInfo

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

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