Search in sources :

Example 6 with AnalyticsPluginInfo

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

the class AnalyticsMetadataLoaderTest method onPluginUnLoaded_shouldNotifyPluginMetadataLoadListeners.

@Test
public void onPluginUnLoaded_shouldNotifyPluginMetadataLoadListeners() 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);
    PluginMetadataChangeListener pluginMetadataChangeListener = mock(PluginMetadataChangeListener.class);
    when(extension.canHandlePlugin(descriptor.id())).thenReturn(true);
    metadataStore.setPluginInfo(pluginInfo);
    metadataLoader.registerListeners(pluginMetadataChangeListener);
    metadataLoader.pluginUnLoaded(descriptor);
    InOrder inOrder = inOrder(metadataStore, pluginMetadataChangeListener);
    inOrder.verify(metadataStore).remove(descriptor.id());
    inOrder.verify(pluginMetadataChangeListener).onPluginMetadataRemove(descriptor.id());
}
Also used : AnalyticsPluginInfo(com.thoughtworks.go.plugin.domain.analytics.AnalyticsPluginInfo) PluginMetadataChangeListener(com.thoughtworks.go.plugin.access.common.PluginMetadataChangeListener) InOrder(org.mockito.InOrder) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) Test(org.junit.Test)

Example 7 with AnalyticsPluginInfo

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

the class AnalyticsMetadataLoaderTest method onPluginLoad_shouldNotifyPluginMetadataLoadListeners.

@Test
public void onPluginLoad_shouldNotifyPluginMetadataLoadListeners() throws Exception {
    GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
    AnalyticsMetadataLoader metadataLoader = new AnalyticsMetadataLoader(pluginManager, metadataStore, infoBuilder, extension);
    PluginMetadataChangeListener pluginMetadataChangeListener = mock(PluginMetadataChangeListener.class);
    AnalyticsPluginInfo pluginInfo = new AnalyticsPluginInfo(descriptor, null, null, null);
    when(extension.canHandlePlugin(descriptor.id())).thenReturn(true);
    when(infoBuilder.pluginInfoFor(descriptor)).thenReturn(pluginInfo);
    metadataLoader.registerListeners(pluginMetadataChangeListener);
    metadataLoader.pluginLoaded(descriptor);
    InOrder inOrder = inOrder(metadataStore, pluginMetadataChangeListener);
    inOrder.verify(metadataStore).setPluginInfo(pluginInfo);
    inOrder.verify(pluginMetadataChangeListener).onPluginMetadataCreate(descriptor.id());
}
Also used : PluginMetadataChangeListener(com.thoughtworks.go.plugin.access.common.PluginMetadataChangeListener) AnalyticsPluginInfo(com.thoughtworks.go.plugin.domain.analytics.AnalyticsPluginInfo) InOrder(org.mockito.InOrder) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) Test(org.junit.Test)

Example 8 with AnalyticsPluginInfo

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

the class AnalyticsPluginInfoBuilderTest method shouldBuildPluginInfoWithPluginSettingsConfiguration.

@Test
public void shouldBuildPluginInfoWithPluginSettingsConfiguration() throws Exception {
    GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
    PluginSettingsConfiguration value = new PluginSettingsConfiguration();
    value.add(new PluginSettingsProperty("username", null).with(Property.REQUIRED, true).with(Property.SECURE, false));
    value.add(new PluginSettingsProperty("password", null).with(Property.REQUIRED, true).with(Property.SECURE, true));
    stub(extension.getPluginSettingsConfiguration("plugin1")).toReturn(value);
    stub(extension.getPluginSettingsView("plugin1")).toReturn("some-html");
    AnalyticsPluginInfo pluginInfo = new AnalyticsPluginInfoBuilder(extension).pluginInfoFor(descriptor);
    List<PluginConfiguration> pluginConfigurations = Arrays.asList(new PluginConfiguration("username", new Metadata(true, false)), new PluginConfiguration("password", new Metadata(true, true)));
    PluginView pluginView = new PluginView("some-html");
    assertThat(pluginInfo.getDescriptor(), is(descriptor));
    assertThat(pluginInfo.getExtensionName(), is("analytics"));
    assertThat(pluginInfo.getPluginSettings(), is(new PluggableInstanceSettings(pluginConfigurations, pluginView)));
}
Also used : AnalyticsPluginInfo(com.thoughtworks.go.plugin.domain.analytics.AnalyticsPluginInfo) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) PluginSettingsConfiguration(com.thoughtworks.go.plugin.access.common.settings.PluginSettingsConfiguration) PluginSettingsProperty(com.thoughtworks.go.plugin.access.common.settings.PluginSettingsProperty) Test(org.junit.Test)

Example 9 with AnalyticsPluginInfo

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

the class AnalyticsPluginInfoBuilderTest method shouldBuildPluginInfoWithCapabilities.

@Test
public void shouldBuildPluginInfoWithCapabilities() throws Exception {
    GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
    Capabilities capabilities = new Capabilities(Collections.emptyList());
    when(extension.getCapabilities(descriptor.id())).thenReturn(capabilities);
    AnalyticsPluginInfo pluginInfo = new AnalyticsPluginInfoBuilder(extension).pluginInfoFor(descriptor);
    assertThat(pluginInfo.getCapabilities(), is(capabilities));
}
Also used : AnalyticsPluginInfo(com.thoughtworks.go.plugin.domain.analytics.AnalyticsPluginInfo) Capabilities(com.thoughtworks.go.plugin.domain.analytics.Capabilities) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) Test(org.junit.Test)

Example 10 with AnalyticsPluginInfo

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

the class AnalyticsPluginInfoBuilderTest method shouldBuildPluginInfoWithPluginDescriptor.

@Test
public void shouldBuildPluginInfoWithPluginDescriptor() throws Exception {
    GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
    AnalyticsPluginInfo pluginInfo = new AnalyticsPluginInfoBuilder(extension).pluginInfoFor(descriptor);
    assertThat(pluginInfo.getDescriptor(), is(descriptor));
}
Also used : 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