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 core;
|
||||||
private Boolean markedForUninstall;
|
private Boolean markedForUninstall;
|
||||||
private Set<String> dependencies;
|
private Set<String> dependencies;
|
||||||
|
private Set<String> optionalDependencies;
|
||||||
|
|
||||||
public PluginDto(Links links) {
|
public PluginDto(Links links) {
|
||||||
add(links);
|
add(links);
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ public abstract class PluginDtoMapper {
|
|||||||
|
|
||||||
private void map(PluginDto dto, Plugin plugin) {
|
private void map(PluginDto dto, Plugin plugin) {
|
||||||
dto.setDependencies(plugin.getDescriptor().getDependencies());
|
dto.setDependencies(plugin.getDescriptor().getDependencies());
|
||||||
|
dto.setOptionalDependencies(plugin.getDescriptor().getOptionalDependencies());
|
||||||
map(plugin.getDescriptor().getInformation(), dto);
|
map(plugin.getDescriptor().getInformation(), dto);
|
||||||
if (dto.getCategory() == null) {
|
if (dto.getCategory() == null) {
|
||||||
dto.setCategory("Miscellaneous");
|
dto.setCategory("Miscellaneous");
|
||||||
|
|||||||
@@ -164,6 +164,15 @@ class PluginDtoMapperTest {
|
|||||||
assertThat(dto.getDependencies()).containsOnly("one", "two");
|
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
|
@Test
|
||||||
void shouldAppendUninstallLink() {
|
void shouldAppendUninstallLink() {
|
||||||
when(subject.isPermitted("plugin:write")).thenReturn(true);
|
when(subject.isPermitted("plugin:write")).thenReturn(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user