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