Search in sources :

Example 26 with PluginManager

use of com.thoughtworks.go.plugin.infra.PluginManager in project gocd by gocd.

the class PluggableTaskPreferenceLoaderTest method shouldRemoveConfigForTheTaskCorrespondingToGivenPluginId.

@Test
public void shouldRemoveConfigForTheTaskCorrespondingToGivenPluginId() throws Exception {
    final GoPluginDescriptor descriptor = mock(GoPluginDescriptor.class);
    String pluginId = "test-plugin-id";
    when(descriptor.id()).thenReturn(pluginId);
    final Task task = mock(Task.class);
    TaskConfig config = new TaskConfig();
    TaskView taskView = mock(TaskView.class);
    when(task.config()).thenReturn(config);
    when(task.view()).thenReturn(taskView);
    PluggableTaskConfigStore.store().setPreferenceFor(pluginId, new TaskPreference(task));
    PluginManager pluginManager = mock(PluginManager.class);
    PluggableTaskPreferenceLoader pluggableTaskPreferenceLoader = new PluggableTaskPreferenceLoader(pluginManager, taskExtension);
    assertThat(PluggableTaskConfigStore.store().hasPreferenceFor(pluginId), is(true));
    pluggableTaskPreferenceLoader.pluginUnLoaded(descriptor);
    assertThat(PluggableTaskConfigStore.store().hasPreferenceFor(pluginId), is(false));
    verify(pluginManager).addPluginChangeListener(pluggableTaskPreferenceLoader);
}
Also used : PluginManager(com.thoughtworks.go.plugin.infra.PluginManager) Task(com.thoughtworks.go.plugin.api.task.Task) TaskView(com.thoughtworks.go.plugin.api.task.TaskView) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) TaskConfig(com.thoughtworks.go.plugin.api.task.TaskConfig) Test(org.junit.jupiter.api.Test)

Example 27 with PluginManager

use of com.thoughtworks.go.plugin.infra.PluginManager in project gocd by gocd.

the class PluggableTaskPreferenceLoaderTest method shouldRegisterPluginListenerWithPluginManager.

@Test
public void shouldRegisterPluginListenerWithPluginManager() throws Exception {
    PluginManager pluginManager = mock(PluginManager.class);
    PluggableTaskPreferenceLoader pluggableTaskPreferenceLoader = new PluggableTaskPreferenceLoader(pluginManager, taskExtension);
    verify(pluginManager).addPluginChangeListener(pluggableTaskPreferenceLoader);
}
Also used : PluginManager(com.thoughtworks.go.plugin.infra.PluginManager) Test(org.junit.jupiter.api.Test)

Aggregations

PluginManager (com.thoughtworks.go.plugin.infra.PluginManager)27 Test (org.junit.Test)17 GoPluginDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)16 PluggableInstanceSettings (com.thoughtworks.go.server.ui.plugins.PluggableInstanceSettings)6 TaskConfig (com.thoughtworks.go.plugin.api.task.TaskConfig)5 TaskView (com.thoughtworks.go.plugin.api.task.TaskView)5 PluginView (com.thoughtworks.go.server.ui.plugins.PluginView)4 Test (org.junit.jupiter.api.Test)4 AuthenticationPluginRegistry (com.thoughtworks.go.plugin.access.authentication.AuthenticationPluginRegistry)3 NotificationPluginRegistry (com.thoughtworks.go.plugin.access.notification.NotificationPluginRegistry)3 PackageMetadataStore (com.thoughtworks.go.plugin.access.packagematerial.PackageMetadataStore)3 RepositoryMetadataStore (com.thoughtworks.go.plugin.access.packagematerial.RepositoryMetadataStore)3 PluggableTaskConfigStore (com.thoughtworks.go.plugin.access.pluggabletask.PluggableTaskConfigStore)3 Task (com.thoughtworks.go.plugin.api.task.Task)3 AuthenticationPluginInfo (com.thoughtworks.go.server.ui.plugins.AuthenticationPluginInfo)3 NotificationPluginInfo (com.thoughtworks.go.server.ui.plugins.NotificationPluginInfo)3 PackageRepositoryPluginInfo (com.thoughtworks.go.server.ui.plugins.PackageRepositoryPluginInfo)3 PluggableTaskPluginInfo (com.thoughtworks.go.server.ui.plugins.PluggableTaskPluginInfo)3 SCMPluginInfo (com.thoughtworks.go.server.ui.plugins.SCMPluginInfo)3 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)3