@Test void createNewUser_WillSendCommandAndWaitForCompletion() { when(passwordEncoder.encode("raw-password")).thenReturn("encoded-password"); when(randomFieldsGenerator.genRandomUUID()).thenReturn(USER_ID); defaultUsersService.createUser(ADMIN_ID, ORGANIZATION_ID, NEW_USER_EMAIL, NEW_USER_DISPLAY_NAME, "raw-password"); verify(commandGateway).sendAndWait(new CreateUserCommand(USER_ID, ORGANIZATION_ID, ADMIN_ID, NEW_USER_EMAIL, "encoded-password", NEW_USER_DISPLAY_NAME)); }
@Override public UUID createUser(UUID requestingUserId, UUID organizationId, String username, String displayName, String rawPassword) { return commandGateway.sendAndWait(new CreateUserCommand(randomFieldsGenerator.genRandomUUID(), organizationId, requestingUserId, username, encodePasswordIfNotBlank(rawPassword), displayName)); }
DefaultUsersService implements UsersService { @Override public UUID createUser(UUID requestingUserId, UUID organizationId, String username, String displayName, String rawPassword) { return commandGateway.sendAndWait(new CreateUserCommand(randomFieldsGenerator.genRandomUUID(), organizationId, requestingUserId, username, encodePasswordIfNotBlank(rawPassword), displayName)); } }
DefaultUsersService implements UsersService { @Override public UUID createUser(UUID requestingUserId, UUID organizationId, String username, String displayName, String rawPassword) { return commandGateway.sendAndWait(new CreateUserCommand(randomFieldsGenerator.genRandomUUID(), organizationId, requestingUserId, username, encodePasswordIfNotBlank(rawPassword), displayName)); } DefaultUsersService(HazelcastCommandGateway commandGateway,
                               RandomFieldsGenerator randomFieldsGenerator,
                               PasswordEncoder passwordEncoder); }
DefaultUsersService implements UsersService { @Override public UUID createUser(UUID requestingUserId, UUID organizationId, String username, String displayName, String rawPassword) { return commandGateway.sendAndWait(new CreateUserCommand(randomFieldsGenerator.genRandomUUID(), organizationId, requestingUserId, username, encodePasswordIfNotBlank(rawPassword), displayName)); } DefaultUsersService(HazelcastCommandGateway commandGateway,
                               RandomFieldsGenerator randomFieldsGenerator,
                               PasswordEncoder passwordEncoder); @Override void updateUser(UUID requestingUserId, UUID userId, String emailChange,
                           String displayNameChange, String passwordChange); @Override UUID createUser(UUID requestingUserId, UUID organizationId, String username, String displayName, String rawPassword); @Override void storeProfilePhoto(UUID requestingUserId, UUID profilePhotoFileId); }
DefaultUsersService implements UsersService { @Override public UUID createUser(UUID requestingUserId, UUID organizationId, String username, String displayName, String rawPassword) { return commandGateway.sendAndWait(new CreateUserCommand(randomFieldsGenerator.genRandomUUID(), organizationId, requestingUserId, username, encodePasswordIfNotBlank(rawPassword), displayName)); } DefaultUsersService(HazelcastCommandGateway commandGateway,
                               RandomFieldsGenerator randomFieldsGenerator,
                               PasswordEncoder passwordEncoder); @Override void updateUser(UUID requestingUserId, UUID userId, String emailChange,
                           String displayNameChange, String passwordChange); @Override UUID createUser(UUID requestingUserId, UUID organizationId, String username, String displayName, String rawPassword); @Override void storeProfilePhoto(UUID requestingUserId, UUID profilePhotoFileId);  }