Skip to content

Commit

Permalink
Merge pull request #100 from szymonpoltorak/DEV-177-usernames
Browse files Browse the repository at this point in the history
DEV-177 - Made usernames emails in placeholderdata
  • Loading branch information
igorkedzierawski authored Apr 21, 2024
2 parents b3c5ac9 + cee2547 commit 6b70ae0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@

public class PlaceholderUsers {

private static final String MAIL_SUFFIX = "@mail.pl";
private static final String DEFAULT_ROLE = "default-roles-corn";

public static List<UserRepresentation> generate() {
return Stream.of(
new SimpleUser("Jan", "Kowalski", "jan", "123"),
new SimpleUser("Andrzej", "Switch", "andrzej", "123"),
new SimpleUser("John", "Doe", "john", "123"),
new SimpleUser("Jane", "Doe", "jane", "123"),
new SimpleUser("Alice", "Smith", "alice", "123"),
new SimpleUser("Bob", "Johnson", "bob", "123")
new SimpleUser("Jan", "Kowalski", "jan@gmail.com", "123"),
new SimpleUser("Andrzej", "Switch", "andrzej@gmail.com", "123"),
new SimpleUser("John", "Doe", "john@gmail.com", "123"),
new SimpleUser("Jane", "Doe", "jane@gmail.com", "123"),
new SimpleUser("Alice", "Smith", "alice@gmail.com", "123"),
new SimpleUser("Bob", "Johnson", "bob@gmail.com", "123")
).map(SimpleUser::intoUserRepresentation).toList();
}

Expand All @@ -31,7 +30,7 @@ UserRepresentation intoUserRepresentation() {
setUsername(username());
setFirstName(name);
setLastName(surname);
setEmail(username.toLowerCase()+MAIL_SUFFIX);
setEmail(username());
setEmailVerified(true);
setEnabled(true);
setRealmRoles(List.of(DEFAULT_ROLE));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ public void run(String... args) {
ItemStatus.DONE, ItemStatus.DONE, ItemStatus.DONE
);
List<User> users = userRepository.findAllById(Stream.of(
userService.registerUser("Jan", "Kowalski", "jan"),
userService.registerUser("Andrzej", "Switch", "andrzej"),
userService.registerUser("John", "Doe", "john"),
userService.registerUser("Jane", "Doe", "jane"),
userService.registerUser("Alice", "Smith", "alice"),
userService.registerUser("Bob", "Johnson", "bob")
userService.registerUser("Jan", "Kowalski", "jan@gmail.com"),
userService.registerUser("Andrzej", "Switch", "andrzej@gmail.com"),
userService.registerUser("John", "Doe", "john@gmail.com"),
userService.registerUser("Jane", "Doe", "jane@gmail.com"),
userService.registerUser("Alice", "Smith", "alice@gmail.com"),
userService.registerUser("Bob", "Johnson", "bob@gmail.com")
).map(UserResponse::userId).toList());

User projectOwner = drawRandom(users);
Expand Down

0 comments on commit 6b70ae0

Please sign in to comment.