Search in sources :

Example 1 with PluginMetadataChangeListener

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());
}
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 2 with PluginMetadataChangeListener

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

Aggregations

PluginMetadataChangeListener (com.thoughtworks.go.plugin.access.common.PluginMetadataChangeListener)2 AnalyticsPluginInfo (com.thoughtworks.go.plugin.domain.analytics.AnalyticsPluginInfo)2 GoPluginDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)2 Test (org.junit.Test)2 InOrder (org.mockito.InOrder)2