Merge branch 'develop' into feature/verify_gpg_signatures

This commit is contained in:
Eduard Heimbuch
2020-07-28 12:36:15 +02:00
100 changed files with 2329 additions and 1247 deletions

View File

@@ -164,6 +164,15 @@ class PluginDtoMapperTest {
assertThat(dto.getDependencies()).containsOnly("one", "two");
}
@Test
void shouldAppendOptionalDependencies() {
AvailablePlugin plugin = createAvailable(createPluginInformation());
when(plugin.getDescriptor().getOptionalDependencies()).thenReturn(ImmutableSet.of("one", "two"));
PluginDto dto = mapper.mapAvailable(plugin);
assertThat(dto.getOptionalDependencies()).containsOnly("one", "two");
}
@Test
void shouldAppendUninstallLink() {
when(subject.isPermitted("plugin:write")).thenReturn(true);

View File

@@ -260,6 +260,35 @@ class DefaultPluginManagerTest {
verify(installer).install(review);
}
@Test
void shouldUpdateAlreadyInstalledOptionalDependenciesWhenNewerVersionIsAvailable() {
AvailablePlugin review = createAvailable("scm-review-plugin");
when(review.getDescriptor().getOptionalDependencies()).thenReturn(ImmutableSet.of("scm-mail-plugin"));
AvailablePlugin mail = createAvailable("scm-mail-plugin", "1.1.0");
when(center.getAvailable()).thenReturn(ImmutableSet.of(review, mail));
InstalledPlugin installedMail = createInstalled("scm-mail-plugin", "1.0.0");
when(loader.getInstalledPlugins()).thenReturn(ImmutableList.of(installedMail));
manager.install("scm-review-plugin", false);
verify(installer).install(mail);
verify(installer).install(review);
}
@Test
void shouldNotUpdateOptionalDependenciesWhenNewerVersionIsAvailableButItIsNotInstalled() {
AvailablePlugin review = createAvailable("scm-review-plugin");
when(review.getDescriptor().getOptionalDependencies()).thenReturn(ImmutableSet.of("scm-mail-plugin"));
AvailablePlugin mail = createAvailable("scm-mail-plugin", "1.1.0");
when(center.getAvailable()).thenReturn(ImmutableSet.of(review, mail));
manager.install("scm-review-plugin", false);
verify(installer, never()).install(mail);
verify(installer).install(review);
}
@Test
void shouldRollbackOnFailedInstallation() {
AvailablePlugin review = createAvailable("scm-review-plugin");

View File

@@ -67,6 +67,7 @@ class PluginCenterDtoMapperTest {
"555000444",
new Condition(Collections.singletonList("linux"), "amd64","2.0.0"),
ImmutableSet.of("scm-review-plugin"),
ImmutableSet.of(),
ImmutableMap.of("download", new Link("http://download.hitchhiker.com"))
);
@@ -101,6 +102,7 @@ class PluginCenterDtoMapperTest {
"12345678aa",
new Condition(Collections.singletonList("linux"), "amd64","2.0.0"),
ImmutableSet.of("scm-review-plugin"),
ImmutableSet.of(),
ImmutableMap.of("download", new Link("http://download.hitchhiker.com/review"))
);
@@ -115,6 +117,7 @@ class PluginCenterDtoMapperTest {
"555000444",
new Condition(Collections.singletonList("linux"), "amd64","2.0.0"),
ImmutableSet.of("scm-review-plugin"),
ImmutableSet.of(),
ImmutableMap.of("download", new Link("http://download.hitchhiker.com/hitchhiker"))
);