@Override default User getUser(String identifier) { return get(identifier); } }
@Test public void testInitCache() { tested.initCache(); verify(userManagerService, times(1)).getSettings(); verify(groupsManagerService, times(1)).getSettings(); }
@Test public void testOnSaveUserButNoContext() throws Exception { final SaveUserEvent saveUserEvent = mock(SaveUserEvent.class); presenter.context = null; presenter.onUserSaved(saveUserEvent); verify(userManagerService, never()).search(any(AbstractEntityManager.SearchRequest.class)); }
/** * Loads the user management provider's settings into cache. * @param callback Load finished callback. */ private void loadUserSettings(final Command callback, final ErrorCallback<Message> errorCallback) { if (null == userManagerSettings) { usersManagerService.call(new RemoteCallback<UserManagerSettings>() { @Override public void callback(final UserManagerSettings userManagerSettings) { ClientUserSystemManager.this.userManagerSettings = userManagerSettings; if (null != callback) { callback.execute(); } } }, errorCallback).getSettings(); } else { callback.execute(); } }
/** * Loads the group management provider's settings into cache. * @param callback Load finished callback. */ private void loadGroupSettings(final Command callback, final ErrorCallback<Message> errorCallback) { if (null == groupManagerSettings) { groupsManagerService.call(new RemoteCallback<GroupManagerSettings>() { @Override public void callback(final GroupManagerSettings groupManagerSettings) { ClientUserSystemManager.this.groupManagerSettings = groupManagerSettings; if (null != callback) { callback.execute(); } } }, errorCallback).getSettings(); } else { callback.execute(); } }
@Test public void testOnCreateGroup() throws Exception { final CreateGroupEvent createGroupEvent = mock(CreateGroupEvent.class); presenter.context = mock(ExplorerViewContext.class); presenter.onGroupCreated(createGroupEvent); verify(groupsManagerService, times(1)).search(any(AbstractEntityManager.SearchRequest.class)); }
@Test public void testInitCache() { tested.initCache(); verify(userManagerService, times(1)).getSettings(); verify(groupsManagerService, times(1)).getSettings(); }
@Test public void testOnSaveUser() throws Exception { final SaveUserEvent saveUserEvent = mock(SaveUserEvent.class); presenter.context = mock(ExplorerViewContext.class); presenter.onUserSaved(saveUserEvent); verify(userManagerService, times(1)).search(any(AbstractEntityManager.SearchRequest.class)); }
/** * Loads the user management provider's settings into cache. * @param callback Load finished callback. */ private void loadUserSettings(final Command callback, final ErrorCallback<Message> errorCallback) { if (null == userManagerSettings) { usersManagerService.call(new RemoteCallback<UserManagerSettings>() { @Override public void callback(final UserManagerSettings userManagerSettings) { ClientUserSystemManager.this.userManagerSettings = userManagerSettings; if (null != callback) { callback.execute(); } } }, errorCallback).getSettings(); } else { callback.execute(); } }
/** * Loads the group management provider's settings into cache. * @param callback Load finished callback. */ private void loadGroupSettings(final Command callback, final ErrorCallback<Message> errorCallback) { if (null == groupManagerSettings) { groupsManagerService.call(new RemoteCallback<GroupManagerSettings>() { @Override public void callback(final GroupManagerSettings groupManagerSettings) { ClientUserSystemManager.this.groupManagerSettings = groupManagerSettings; if (null != callback) { callback.execute(); } } }, errorCallback).getSettings(); } else { callback.execute(); } }
@Test public void testOnAddUsersToGroupEvent() throws Exception { final AddUsersToGroupEvent addUsersToGroupEvent = mock(AddUsersToGroupEvent.class); presenter.context = mock(ExplorerViewContext.class); presenter.onAddUsersToGroup(addUsersToGroupEvent); verify(groupsManagerService, times(1)).search(any(AbstractEntityManager.SearchRequest.class)); }
@Before public void setup() { MockitoAnnotations.initMocks(this); final UserManagerSettings userManagerSettings = getUserSettings(); when(userManagerService.getSettings()).thenReturn(userManagerSettings); final GroupManagerSettings groupManagerSettings = getGroupSettings(); when(groupsManagerService.getSettings()).thenReturn(groupManagerSettings); usersManagerServiceCaller = new CallerMock<UserManagerService>(userManagerService); groupsManagerServiceCaller = new CallerMock<GroupManagerService>(groupsManagerService); rolesManagerServiceCaller = new CallerMock<RoleManagerService>(rolesManagerService); tested = spy(new ClientUserSystemManager(usersManagerServiceCaller, groupsManagerServiceCaller, rolesManagerServiceCaller, new ClientSecurityExceptionMessageResolver(), errorPopupPresenter)); }
@Test public void testOnUserDeleted() throws Exception { final DeleteUserEvent deleteUserEvent = mock(DeleteUserEvent.class); presenter.context = mock(ExplorerViewContext.class); presenter.onUserDeleted(deleteUserEvent); verify(userManagerService, times(1)).search(any(AbstractEntityManager.SearchRequest.class)); }
@Test public void testOnDeleteGroup() throws Exception { final DeleteGroupEvent deleteGroupEvent = mock(DeleteGroupEvent.class); presenter.context = mock(ExplorerViewContext.class); presenter.onGroupDeleted(deleteGroupEvent); verify(groupsManagerService, times(1)).search(any(AbstractEntityManager.SearchRequest.class)); }
@Test public void testOnCreateUser() throws Exception { final CreateUserEvent createUserEvent = mock(CreateUserEvent.class); presenter.context = mock(ExplorerViewContext.class); presenter.onUserCreated(createUserEvent); verify(userManagerService, times(1)).search(any(AbstractEntityManager.SearchRequest.class)); }
@Test public void testOnAddUsersToGroupEventButNoContext() throws Exception { final AddUsersToGroupEvent addUsersToGroupEvent = mock(AddUsersToGroupEvent.class); presenter.context = null; presenter.onAddUsersToGroup(addUsersToGroupEvent); verify(groupsManagerService, never()).search(any(AbstractEntityManager.SearchRequest.class)); }
@Test public void testOnCreateUserButNoContext() throws Exception { final CreateUserEvent createUserEvent = mock(CreateUserEvent.class); presenter.context = null; presenter.onUserCreated(createUserEvent); verify(userManagerService, never()).search(any(AbstractEntityManager.SearchRequest.class)); }
@Test public void testOnDeleteGroupButNoContext() throws Exception { final DeleteGroupEvent deleteGroupEvent = mock(DeleteGroupEvent.class); presenter.context = null; presenter.onGroupDeleted(deleteGroupEvent); verify(groupsManagerService, never()).search(any(AbstractEntityManager.SearchRequest.class)); }
@Test public void testOnUserDeletedButNoContext() throws Exception { final DeleteUserEvent deleteUserEvent = mock(DeleteUserEvent.class); presenter.context = null; presenter.onUserDeleted(deleteUserEvent); verify(userManagerService, never()).search(any(AbstractEntityManager.SearchRequest.class)); }
@Test public void testOnCreateGroupButNoContext() throws Exception { final CreateGroupEvent createGroupEvent = mock(CreateGroupEvent.class); presenter.context = null; presenter.onGroupCreated(createGroupEvent); verify(groupsManagerService, never()).search(any(AbstractEntityManager.SearchRequest.class)); }