mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 16:35:45 +01:00
append optional dependencies to webapp dto
This commit is contained in:
@@ -53,6 +53,7 @@ public class PluginDto extends HalRepresentation {
|
||||
private Boolean core;
|
||||
private Boolean markedForUninstall;
|
||||
private Set<String> dependencies;
|
||||
private Set<String> optionalDependencies;
|
||||
|
||||
public PluginDto(Links links) {
|
||||
add(links);
|
||||
|
||||
@@ -68,6 +68,7 @@ public abstract class PluginDtoMapper {
|
||||
|
||||
private void map(PluginDto dto, Plugin plugin) {
|
||||
dto.setDependencies(plugin.getDescriptor().getDependencies());
|
||||
dto.setOptionalDependencies(plugin.getDescriptor().getOptionalDependencies());
|
||||
map(plugin.getDescriptor().getInformation(), dto);
|
||||
if (dto.getCategory() == null) {
|
||||
dto.setCategory("Miscellaneous");
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user