use of com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor in project gocd by gocd.
the class NotificationPluginRegistrarTest method shouldRegisterPluginOnPluginLoad.
@Test
public void shouldRegisterPluginOnPluginLoad() {
NotificationPluginRegistrar notificationPluginRegistrar = new NotificationPluginRegistrar(pluginManager, notificationExtension, notificationPluginRegistry);
notificationPluginRegistrar.pluginLoaded(new GoPluginDescriptor(PLUGIN_ID_1, null, null, null, null, true));
verify(notificationPluginRegistry).registerPlugin(PLUGIN_ID_1);
}
use of com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor in project gocd by gocd.
the class NotificationPluginRegistrarTest method shouldRegisterPluginInterestsOnPluginLoad.
@Test
public void shouldRegisterPluginInterestsOnPluginLoad() {
NotificationPluginRegistrar notificationPluginRegistrar = new NotificationPluginRegistrar(pluginManager, notificationExtension, notificationPluginRegistry);
notificationPluginRegistrar.pluginLoaded(new GoPluginDescriptor(PLUGIN_ID_1, null, null, null, null, true));
verify(notificationPluginRegistry).registerPluginInterests(PLUGIN_ID_1, asList(PIPELINE_STATUS, STAGE_STATUS, JOB_STATUS));
notificationPluginRegistrar.pluginLoaded(new GoPluginDescriptor(PLUGIN_ID_2, null, null, null, null, true));
verify(notificationPluginRegistry).registerPluginInterests(PLUGIN_ID_2, asList(PIPELINE_STATUS));
notificationPluginRegistrar.pluginLoaded(new GoPluginDescriptor(PLUGIN_ID_3, null, null, null, null, true));
verify(notificationPluginRegistry).registerPluginInterests(PLUGIN_ID_3, asList(STAGE_STATUS));
}
use of com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor in project gocd by gocd.
the class SCMMetadataLoaderTest method setUp.
@Before
public void setUp() throws Exception {
pluginDescriptor = new GoPluginDescriptor("plugin-id", "1.0", null, null, null, true);
pluginManager = mock(PluginManager.class);
scmExtension = mock(SCMExtension.class);
metadataLoader = new SCMMetadataLoader(scmExtension, pluginManager);
SCMMetadataStore.getInstance().removeMetadata(pluginDescriptor.id());
}
use of com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor in project gocd by gocd.
the class DefaultPluginManagerTest method shouldAllowRegistrationOfPluginChangeListeners.
@Test
public void shouldAllowRegistrationOfPluginChangeListeners() throws Exception {
GoPlugginOSGiFrameworkStub frameworkStub = new GoPlugginOSGiFrameworkStub();
PluginManager pluginManager = new DefaultPluginManager(monitor, registry, frameworkStub, jarChangeListener, null, pluginWriter, pluginValidator, systemEnvironment);
String pluginId1 = "test-plugin-id-1";
String pluginId2 = "test-plugin-id-2";
GoPluginDescriptor descriptor1 = mock(GoPluginDescriptor.class);
when(descriptor1.id()).thenReturn(pluginId1);
GoPluginDescriptor descriptor2 = mock(GoPluginDescriptor.class);
when(descriptor2.id()).thenReturn(pluginId2);
final int[] pluginLoaded = new int[] { 0 };
final int[] pluginUnloaded = new int[] { 0 };
PluginChangeListener someInterfaceListener = new PluginChangeListener() {
@Override
public void pluginLoaded(GoPluginDescriptor pluginDescriptor) {
pluginLoaded[0]++;
}
@Override
public void pluginUnLoaded(GoPluginDescriptor pluginDescriptor) {
pluginUnloaded[0]++;
}
};
pluginManager.addPluginChangeListener(someInterfaceListener);
frameworkStub.pluginChangeListener.pluginLoaded(descriptor1);
frameworkStub.pluginChangeListener.pluginLoaded(descriptor2);
frameworkStub.pluginChangeListener.pluginUnLoaded(descriptor1);
frameworkStub.pluginChangeListener.pluginUnLoaded(descriptor2);
assertThat(pluginLoaded[0], is(2));
assertThat(pluginUnloaded[0], is(2));
}
use of com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor in project gocd by gocd.
the class FelixGoPluginOSGiFrameworkIntegrationTest method shouldNotifyListenersWhenPluginUnLoaded.
@Test
public void shouldNotifyListenersWhenPluginUnLoaded() {
PluginChangeListener pluginChangeListener = mock(PluginChangeListener.class);
pluginOSGiFramework.addPluginChangeListener(pluginChangeListener);
GoPluginDescriptor pluginDescriptor = new GoPluginDescriptor(null, null, null, null, descriptorBundleDir, true);
Bundle bundle = pluginOSGiFramework.loadPlugin(pluginDescriptor);
pluginDescriptor.setBundle(bundle);
pluginOSGiFramework.unloadPlugin(pluginDescriptor);
verify(pluginChangeListener).pluginUnLoaded(pluginDescriptor);
}
Aggregations