mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-03-17 01:30:27 +01:00
Improve plugin center error feedback and cache invalidation (#2147)
The plugin center cache was not invalidated when the proxy configuration was changed in the global settings. This caused stale and inconsistent state to be displayed to the user while there was no feedback that something was wrong.
This commit is contained in:
committed by
GitHub
parent
ec83de3600
commit
7b933c6821
@@ -54,6 +54,7 @@ import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static java.util.Collections.emptySet;
|
||||
import static java.util.Collections.singleton;
|
||||
import static java.util.Collections.singletonList;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -133,6 +134,27 @@ class DefaultPluginManagerTest {
|
||||
ThreadContext.unbindSubject();
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldReturnSuccessfulPluginResult() {
|
||||
AvailablePlugin editor = createAvailable("scm-editor-plugin");
|
||||
AvailablePlugin jenkins = createAvailable("scm-jenkins-plugin");
|
||||
InstalledPlugin review = createInstalled("scm-review-plugin");
|
||||
InstalledPlugin git = createInstalled("scm-git-plugin");
|
||||
|
||||
when(center.getPluginResult()).thenReturn(new PluginCenterResult(
|
||||
ImmutableSet.of(editor, jenkins),
|
||||
emptySet())
|
||||
);
|
||||
|
||||
when(loader.getInstalledPlugins()).thenReturn(ImmutableList.of(review, git));
|
||||
|
||||
PluginManager.PluginResult plugins = manager.getPlugins();
|
||||
|
||||
assertThat(plugins.getAvailablePlugins()).containsOnly(editor, jenkins);
|
||||
assertThat(plugins.getInstalledPlugins()).containsOnly(review, git);
|
||||
assertThat(plugins.getPluginCenterStatus()).isEqualTo(PluginCenterStatus.OK);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldReturnInstalledPlugins() {
|
||||
InstalledPlugin review = createInstalled("scm-review-plugin");
|
||||
@@ -746,6 +768,7 @@ class DefaultPluginManagerTest {
|
||||
assertThrows(AuthorizationException.class, () -> manager.getAvailable());
|
||||
assertThrows(AuthorizationException.class, () -> manager.getAvailable("test"));
|
||||
assertThrows(AuthorizationException.class, () -> manager.getPluginSets());
|
||||
assertThrows(AuthorizationException.class, () -> manager.getPlugins());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user