use of com.thoughtworks.go.plugin.access.common.PluginMetadataChangeListener 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.access.common.PluginMetadataChangeListener 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());
}
Aggregations