use of org.eclipse.che.api.user.server.event.UserRemovedEvent in project che by eclipse.
the class UserDaoTest method shouldFireUserRemovedEventOnRemoveExistedUser.
@Test
public void shouldFireUserRemovedEventOnRemoveExistedUser() throws Exception {
final UserImpl user = users[0];
final UserRemovedEvent[] firedEvent = { null };
EventSubscriber<UserRemovedEvent> userRemovedSubscriber = event -> firedEvent[0] = event;
eventService.subscribe(userRemovedSubscriber, UserRemovedEvent.class);
userDao.remove(user.getId());
assertNotNull(firedEvent[0]);
assertEquals(firedEvent[0].getUserId(), user.getId());
eventService.unsubscribe(userRemovedSubscriber, UserRemovedEvent.class);
}
use of org.eclipse.che.api.user.server.event.UserRemovedEvent in project che by eclipse.
the class JpaUserDao method remove.
@Override
public void remove(String id) throws ServerException {
requireNonNull(id, "Required non-null id");
try {
Optional<UserImpl> userOpt = doRemove(id);
userOpt.ifPresent(user -> eventService.publish(new UserRemovedEvent(user.getId())));
} catch (RuntimeException x) {
throw new ServerException(x.getLocalizedMessage(), x);
}
}
Aggregations