@Test public void saveContributorsTest() { final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class); doReturn("ou").when(organizationalUnit).getName(); doReturn(organizationalUnit).when(organizationalUnitService).getOrganizationalUnit(anyString()); doReturn(organizationalUnit).when(organizationalUnitService).updateOrganizationalUnit(any(), any(), any()); final List<Contributor> contributors = new ArrayList<>(); contributors.add(new Contributor("owner", ContributorType.OWNER)); contributors.add(new Contributor("contributor", ContributorType.CONTRIBUTOR)); contributors.add(new Contributor("admin", ContributorType.ADMIN)); service.saveContributors(contributors, () -> {}, null); verify(organizationalUnitService).updateOrganizationalUnit("ou", null, contributors); verify(afterEditOrganizationalUnitEvent).fire(any()); }
@Override public void saveContributors(final List<Contributor> contributors, final Runnable successCallback, final ErrorCallback<Message> errorCallback) { organizationalUnitService.call((OrganizationalUnit organizationalUnit) -> { organizationalUnitService.call((OrganizationalUnit newOrganizationalUnit) -> { successCallback.run(); afterEditOrganizationalUnitEvent.fire(new AfterEditOrganizationalUnitEvent(organizationalUnit, newOrganizationalUnit)); }, errorCallback).updateOrganizationalUnit(organizationalUnit.getName(), organizationalUnit.getDefaultGroupId(), contributors); }).getOrganizationalUnit(libraryPlaces.getActiveSpace().getName()); }
SpaceContributorsListServiceImpl implements ContributorsListService { @Override public void saveContributors(final List<Contributor> contributors, final Runnable successCallback, final ErrorCallback<Message> errorCallback) { organizationalUnitService.call((OrganizationalUnit organizationalUnit) -> { organizationalUnitService.call((OrganizationalUnit newOrganizationalUnit) -> { successCallback.run(); afterEditOrganizationalUnitEvent.fire(new AfterEditOrganizationalUnitEvent(organizationalUnit, newOrganizationalUnit)); }, errorCallback).updateOrganizationalUnit(organizationalUnit.getName(), organizationalUnit.getDefaultGroupId(), contributors); }).getOrganizationalUnit(libraryPlaces.getActiveSpace().getName()); } }
SpaceContributorsListServiceImpl implements ContributorsListService { @Override public void saveContributors(final List<Contributor> contributors, final Runnable successCallback, final ErrorCallback<Message> errorCallback) { organizationalUnitService.call((OrganizationalUnit organizationalUnit) -> { organizationalUnitService.call((OrganizationalUnit newOrganizationalUnit) -> { successCallback.run(); afterEditOrganizationalUnitEvent.fire(new AfterEditOrganizationalUnitEvent(organizationalUnit, newOrganizationalUnit)); }, errorCallback).updateOrganizationalUnit(organizationalUnit.getName(), organizationalUnit.getDefaultGroupId(), contributors); }).getOrganizationalUnit(libraryPlaces.getActiveSpace().getName()); } @Inject  SpaceContributorsListServiceImpl(final LibraryPlaces libraryPlaces,
                                            final Caller<OrganizationalUnitService> organizationalUnitService,
                                            final Event<AfterEditOrganizationalUnitEvent> afterEditOrganizationalUnitEvent,
                                            final Caller<LibraryService> libraryService,
                                            final SessionInfo sessionInfo,
                                            final OrganizationalUnitController organizationalUnitController,
                                            final ContributorsSecurityUtils contributorsSecurityUtils,
                                            final Promises promises); }
SpaceContributorsListServiceImpl implements ContributorsListService { @Override public void saveContributors(final List<Contributor> contributors, final Runnable successCallback, final ErrorCallback<Message> errorCallback) { organizationalUnitService.call((OrganizationalUnit organizationalUnit) -> { organizationalUnitService.call((OrganizationalUnit newOrganizationalUnit) -> { successCallback.run(); afterEditOrganizationalUnitEvent.fire(new AfterEditOrganizationalUnitEvent(organizationalUnit, newOrganizationalUnit)); }, errorCallback).updateOrganizationalUnit(organizationalUnit.getName(), organizationalUnit.getDefaultGroupId(), contributors); }).getOrganizationalUnit(libraryPlaces.getActiveSpace().getName()); } @Inject  SpaceContributorsListServiceImpl(final LibraryPlaces libraryPlaces,
                                            final Caller<OrganizationalUnitService> organizationalUnitService,
                                            final Event<AfterEditOrganizationalUnitEvent> afterEditOrganizationalUnitEvent,
                                            final Caller<LibraryService> libraryService,
                                            final SessionInfo sessionInfo,
                                            final OrganizationalUnitController organizationalUnitController,
                                            final ContributorsSecurityUtils contributorsSecurityUtils,
                                            final Promises promises); @Override void getContributors(Consumer<List<Contributor>> contributorsConsumer); @Override void saveContributors(final List<Contributor> contributors,
                                 final Runnable successCallback,
                                 final ErrorCallback<Message> errorCallback); @Override Promise<Boolean> canEditContributors(final List<Contributor> contributors,
                                                final ContributorType type); @Override void getValidUsernames(final Consumer<List<String>> validUsernamesConsumer); @Override void onExternalChange(final Consumer<Collection<Contributor>> contributorsConsumer); @Override boolean requireValidUsername(); @Override String getInvalidNameMessageConstant(); void onSpaceContributorsUpdatedEvent(@Observes final SpaceContributorsUpdatedEvent spaceContributorsUpdatedEvent); }
SpaceContributorsListServiceImpl implements ContributorsListService { @Override public void saveContributors(final List<Contributor> contributors, final Runnable successCallback, final ErrorCallback<Message> errorCallback) { organizationalUnitService.call((OrganizationalUnit organizationalUnit) -> { organizationalUnitService.call((OrganizationalUnit newOrganizationalUnit) -> { successCallback.run(); afterEditOrganizationalUnitEvent.fire(new AfterEditOrganizationalUnitEvent(organizationalUnit, newOrganizationalUnit)); }, errorCallback).updateOrganizationalUnit(organizationalUnit.getName(), organizationalUnit.getDefaultGroupId(), contributors); }).getOrganizationalUnit(libraryPlaces.getActiveSpace().getName()); } @Inject  SpaceContributorsListServiceImpl(final LibraryPlaces libraryPlaces,
                                            final Caller<OrganizationalUnitService> organizationalUnitService,
                                            final Event<AfterEditOrganizationalUnitEvent> afterEditOrganizationalUnitEvent,
                                            final Caller<LibraryService> libraryService,
                                            final SessionInfo sessionInfo,
                                            final OrganizationalUnitController organizationalUnitController,
                                            final ContributorsSecurityUtils contributorsSecurityUtils,
                                            final Promises promises); @Override void getContributors(Consumer<List<Contributor>> contributorsConsumer); @Override void saveContributors(final List<Contributor> contributors,
                                 final Runnable successCallback,
                                 final ErrorCallback<Message> errorCallback); @Override Promise<Boolean> canEditContributors(final List<Contributor> contributors,
                                                final ContributorType type); @Override void getValidUsernames(final Consumer<List<String>> validUsernamesConsumer); @Override void onExternalChange(final Consumer<Collection<Contributor>> contributorsConsumer); @Override boolean requireValidUsername(); @Override String getInvalidNameMessageConstant(); void onSpaceContributorsUpdatedEvent(@Observes final SpaceContributorsUpdatedEvent spaceContributorsUpdatedEvent);  }