diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index 5f8e664..60ed2b6 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -226,7 +226,6 @@ - completePublicGroups(int count, int membercount) { return IntStream.range(0, count) - .parallel() - .mapToObj(i -> completePublicGroup(membercount)) - .flatMap(Collection::stream) - .collect(Collectors.toList()); + .parallel() + .mapToObj(i -> completePublicGroup(membercount)) + .flatMap(Collection::stream) + .collect(Collectors.toList()); } public static List completePrivateGroups(int count, int membercount) { return IntStream.range(0, count) - .parallel() - .mapToObj(i -> completePrivateGroup(membercount)) - .flatMap(Collection::stream) - .collect(Collectors.toList()); + .parallel() + .mapToObj(i -> completePrivateGroup(membercount)) + .flatMap(Collection::stream) + .collect(Collectors.toList()); } public static List completePublicGroup(int membercount) { @@ -123,25 +123,25 @@ public class TestBuilder { */ public static List createPublicGroupEvents(int count) { return IntStream.range(0, count) - .parallel() - .mapToObj(i -> createPublicGroupEvent()) - .collect(Collectors.toList()); + .parallel() + .mapToObj(i -> createPublicGroupEvent()) + .collect(Collectors.toList()); } public static List createPrivateGroupEvents(int count) { return IntStream.range(0, count) - .parallel() - .mapToObj(i -> createPublicGroupEvent()) - .collect(Collectors.toList()); + .parallel() + .mapToObj(i -> createPublicGroupEvent()) + .collect(Collectors.toList()); } public static List createMixedGroupEvents(int count) { return IntStream.range(0, count) - .parallel() - .mapToObj(i -> faker.random().nextInt(0, 1) > 0.5 - ? createPublicGroupEvent() - : createPrivateGroupEvent()) - .collect(Collectors.toList()); + .parallel() + .mapToObj(i -> faker.random().nextInt(0, 1) > 0.5 + ? createPublicGroupEvent() + : createPrivateGroupEvent()) + .collect(Collectors.toList()); } public static Event createPrivateGroupEvent(UUID groupId) { @@ -195,9 +195,9 @@ public class TestBuilder { */ public static List addUserEvents(int count, UUID groupId) { return IntStream.range(0, count) - .parallel() - .mapToObj(i -> addUserEvent(groupId, String.valueOf(i))) - .collect(Collectors.toList()); + .parallel() + .mapToObj(i -> addUserEvent(groupId, String.valueOf(i))) + .collect(Collectors.toList()); } public static Event addUserEvent(UUID groupId, String userId) { @@ -221,8 +221,8 @@ public class TestBuilder { public static List deleteUserEvents(int count, List eventList) { List removeEvents = new ArrayList<>(); List shuffle = eventList.parallelStream() - .filter(event -> event instanceof AddUserEvent) - .collect(Collectors.toList()); + .filter(event -> event instanceof AddUserEvent) + .collect(Collectors.toList()); Collections.shuffle(shuffle); @@ -245,8 +245,8 @@ public class TestBuilder { */ public static List deleteUserEvents(Group group) { return group.getMembers().parallelStream() - .map(user -> deleteUserEvent(group.getId(), user.getId())) - .collect(Collectors.toList()); + .map(user -> deleteUserEvent(group.getId(), user.getId())) + .collect(Collectors.toList()); } public static Event deleteUserEvent(UUID groupId, String userId) { diff --git a/src/test/java/mops/gruppen2/service/GroupServiceTest.java b/src/test/java/mops/gruppen2/service/GroupServiceTest.java index 30a8749..e4f3a7e 100644 --- a/src/test/java/mops/gruppen2/service/GroupServiceTest.java +++ b/src/test/java/mops/gruppen2/service/GroupServiceTest.java @@ -87,12 +87,12 @@ class GroupServiceTest { @Test void getGroupEvents() { -// CreateGroupEvent test1 = new CreateGroupEvent(uuidFromInt(0), "test1", null, GroupType.SIMPLE, Visibility.PUBLIC, 20L); -// CreateGroupEvent test2 = new CreateGroupEvent(uuidFromInt(1), "test2", null, GroupType.SIMPLE, Visibility.PUBLIC, 10L); + //CreateGroupEvent test1 = new CreateGroupEvent(uuidFromInt(0), "test1", null, GroupType.SIMPLE, Visibility.PUBLIC, 20L); + //CreateGroupEvent test2 = new CreateGroupEvent(uuidFromInt(1), "test2", null, GroupType.SIMPLE, Visibility.PUBLIC, 10L); eventService.saveAll(createPublicGroupEvent(uuidFromInt(0)), - createPublicGroupEvent(uuidFromInt(1)), - createPrivateGroupEvent(uuidFromInt(2))); + createPublicGroupEvent(uuidFromInt(1)), + createPrivateGroupEvent(uuidFromInt(2))); List groupIds = Arrays.asList(uuidFromInt(0), uuidFromInt(1)); @@ -121,47 +121,47 @@ class GroupServiceTest { @Test void getAllGroupWithVisibilityPublicTestGroupPublic() { -// eventService.saveEvent(new CreateGroupEvent(uuidFromInt(0), "test1", null, GroupType.SIMPLE, Visibility.PUBLIC, 20L)); -// eventService.saveEvent(new DeleteGroupEvent(uuidFromInt(0), "test1")); -// eventService.saveEvent(new CreateGroupEvent(uuidFromInt(1), "test2", null, GroupType.LECTURE, Visibility.PUBLIC, 10L)); -// eventService.saveEvent(new UpdateRoleEvent(uuidFromInt(1), "test2", Role.MEMBER)); //Wofür ist das + //eventService.saveEvent(new CreateGroupEvent(uuidFromInt(0), "test1", null, GroupType.SIMPLE, Visibility.PUBLIC, 20L)); + //eventService.saveEvent(new DeleteGroupEvent(uuidFromInt(0), "test1")); + //eventService.saveEvent(new CreateGroupEvent(uuidFromInt(1), "test2", null, GroupType.LECTURE, Visibility.PUBLIC, 10L)); + //eventService.saveEvent(new UpdateRoleEvent(uuidFromInt(1), "test2", Role.MEMBER)); //Wofür ist das eventService.saveAll(createPublicGroupEvent(uuidFromInt(0)), - deleteGroupEvent(uuidFromInt(0)), - createPublicGroupEvent()); + deleteGroupEvent(uuidFromInt(0)), + createPublicGroupEvent()); assertThat(groupService.getAllGroupWithVisibilityPublic("test1").size()).isEqualTo(1); } @Test void getAllGroupWithVisibilityPublicTestAddSomeEvents() { -// eventService.saveEvent(new CreateGroupEvent(uuidFromInt(0), "test1", null, GroupType.SIMPLE, Visibility.PUBLIC, 20L)); -// eventService.saveEvent(new DeleteGroupEvent(uuidFromInt(0), "test1")); -// eventService.saveEvent(new CreateGroupEvent(uuidFromInt(1), "test2", null, GroupType.LECTURE, Visibility.PUBLIC, 10L)); -// eventService.saveEvent(new UpdateRoleEvent(uuidFromInt(1), "test2", Role.MEMBER)); // Wofür? -// eventService.saveEvent(new CreateGroupEvent(uuidFromInt(2), "test3", null, GroupType.LECTURE, Visibility.PUBLIC, 10L)); -// eventService.saveEvent(new CreateGroupEvent(uuidFromInt(3), "test4", null, GroupType.LECTURE, Visibility.PUBLIC, 10L)); -// eventService.saveEvent(new CreateGroupEvent(uuidFromInt(4), "test5", null, GroupType.LECTURE, Visibility.PUBLIC, 10L)); + //eventService.saveEvent(new CreateGroupEvent(uuidFromInt(0), "test1", null, GroupType.SIMPLE, Visibility.PUBLIC, 20L)); + //eventService.saveEvent(new DeleteGroupEvent(uuidFromInt(0), "test1")); + //eventService.saveEvent(new CreateGroupEvent(uuidFromInt(1), "test2", null, GroupType.LECTURE, Visibility.PUBLIC, 10L)); + //eventService.saveEvent(new UpdateRoleEvent(uuidFromInt(1), "test2", Role.MEMBER)); // Wofür? + //eventService.saveEvent(new CreateGroupEvent(uuidFromInt(2), "test3", null, GroupType.LECTURE, Visibility.PUBLIC, 10L)); + //eventService.saveEvent(new CreateGroupEvent(uuidFromInt(3), "test4", null, GroupType.LECTURE, Visibility.PUBLIC, 10L)); + //eventService.saveEvent(new CreateGroupEvent(uuidFromInt(4), "test5", null, GroupType.LECTURE, Visibility.PUBLIC, 10L)); eventService.saveAll(createPublicGroupEvent(uuidFromInt(0)), - deleteGroupEvent(uuidFromInt(0)), - createPublicGroupEvent(), - createPublicGroupEvent(), - createPublicGroupEvent(), - createPrivateGroupEvent()); + deleteGroupEvent(uuidFromInt(0)), + createPublicGroupEvent(), + createPublicGroupEvent(), + createPublicGroupEvent(), + createPrivateGroupEvent()); assertThat(groupService.getAllGroupWithVisibilityPublic("test1").size()).isEqualTo(3); } @Test void getAllGroupWithVisibilityPublic_UserInGroup() { -// eventService.saveEvent(new CreateGroupEvent(uuidFromInt(0), "test1", null, GroupType.SIMPLE, Visibility.PUBLIC, 20L)); -// eventService.saveEvent(new AddUserEvent(uuidFromInt(0), "test1", "test", "test", "test@test")); + //eventService.saveEvent(new CreateGroupEvent(uuidFromInt(0), "test1", null, GroupType.SIMPLE, Visibility.PUBLIC, 20L)); + //eventService.saveEvent(new AddUserEvent(uuidFromInt(0), "test1", "test", "test", "test@test")); eventService.saveAll(createPublicGroupEvent(uuidFromInt(0)), - addUserEvent(uuidFromInt(0), "kobold"), - createPrivateGroupEvent(), - createPublicGroupEvent()); + addUserEvent(uuidFromInt(0), "kobold"), + createPrivateGroupEvent(), + createPublicGroupEvent()); //Das kommt glaube ich eher in einen Test für die Projektion //assertThat(groupService.getAllGroupWithVisibilityPublic("test2").get(0).getMembers().size()).isEqualTo(1); @@ -172,34 +172,34 @@ class GroupServiceTest { @Test void getAllLecturesWithVisibilityPublic() { -// eventService.saveEvent(new CreateGroupEvent(uuidFromInt(0), "test1", null, GroupType.SIMPLE, Visibility.PUBLIC, 20L)); -// eventService.saveEvent(new CreateGroupEvent(uuidFromInt(1), "test2", null, GroupType.LECTURE, Visibility.PUBLIC, 10L)); -// eventService.saveEvent(new UpdateRoleEvent(uuidFromInt(1), "test2", Role.MEMBER)); // Hä -// eventService.saveEvent(new CreateGroupEvent(uuidFromInt(2), "test3", null, GroupType.LECTURE, Visibility.PUBLIC, 10L)); -// eventService.saveEvent(new CreateGroupEvent(uuidFromInt(3), "test4", null, GroupType.LECTURE, Visibility.PUBLIC, 10L)); -// eventService.saveEvent(new CreateGroupEvent(uuidFromInt(4), "test5", null, GroupType.LECTURE, Visibility.PUBLIC, 10L)); + //eventService.saveEvent(new CreateGroupEvent(uuidFromInt(0), "test1", null, GroupType.SIMPLE, Visibility.PUBLIC, 20L)); + //eventService.saveEvent(new CreateGroupEvent(uuidFromInt(1), "test2", null, GroupType.LECTURE, Visibility.PUBLIC, 10L)); + //eventService.saveEvent(new UpdateRoleEvent(uuidFromInt(1), "test2", Role.MEMBER)); // Hä + //eventService.saveEvent(new CreateGroupEvent(uuidFromInt(2), "test3", null, GroupType.LECTURE, Visibility.PUBLIC, 10L)); + //eventService.saveEvent(new CreateGroupEvent(uuidFromInt(3), "test4", null, GroupType.LECTURE, Visibility.PUBLIC, 10L)); + //eventService.saveEvent(new CreateGroupEvent(uuidFromInt(4), "test5", null, GroupType.LECTURE, Visibility.PUBLIC, 10L)); eventService.saveAll(createLectureEvent(), - createPublicGroupEvent(), - createLectureEvent(), - createLectureEvent(), - createLectureEvent()); + createPublicGroupEvent(), + createLectureEvent(), + createLectureEvent(), + createLectureEvent()); assertThat(groupService.getAllLecturesWithVisibilityPublic().size()).isEqualTo(4); } @Test void findGroupWith_UserMember_AllGroups() { -// eventService.saveEvent(new CreateGroupEvent(uuidFromInt(0), "test1", null, GroupType.SIMPLE, Visibility.PUBLIC, 20L)); -// eventService.saveEvent(new AddUserEvent(uuidFromInt(0), "test1", "test", "test", "test@test")); -// eventService.saveEvent(new UpdateGroupTitleEvent(uuidFromInt(0), "test1", "TestGroup")); -// eventService.saveEvent(new UpdateGroupDescriptionEvent(uuidFromInt(0), "test1", "TestDescription")); -// eventService.saveEvent(new UpdateRoleEvent(uuidFromInt(0), "test1", Role.MEMBER)); + //eventService.saveEvent(new CreateGroupEvent(uuidFromInt(0), "test1", null, GroupType.SIMPLE, Visibility.PUBLIC, 20L)); + //eventService.saveEvent(new AddUserEvent(uuidFromInt(0), "test1", "test", "test", "test@test")); + //eventService.saveEvent(new UpdateGroupTitleEvent(uuidFromInt(0), "test1", "TestGroup")); + //eventService.saveEvent(new UpdateGroupDescriptionEvent(uuidFromInt(0), "test1", "TestDescription")); + //eventService.saveEvent(new UpdateRoleEvent(uuidFromInt(0), "test1", Role.MEMBER)); eventService.saveAll(createPublicGroupEvent(uuidFromInt(0)), - addUserEvent(uuidFromInt(0), "jens"), - updateGroupTitleEvent(uuidFromInt(0)), - updateGroupDescriptionEvent(uuidFromInt(0))); + addUserEvent(uuidFromInt(0), "jens"), + updateGroupTitleEvent(uuidFromInt(0)), + updateGroupDescriptionEvent(uuidFromInt(0))); //assertThat(groupService.findGroupWith("T", new Account("jens", "a@A", "test", "peter", "mueller", null)).size()).isEqualTo(1); assertThat(groupService.findGroupWith("", account("jens"))).isEmpty(); @@ -208,7 +208,7 @@ class GroupServiceTest { @Test void findGroupWith_UserNoMember_AllGroups() { eventService.saveAll(completePublicGroups(10, 0), - completePrivateGroups(10, 0)); + completePrivateGroups(10, 0)); assertThat(groupService.findGroupWith("", account("jens"))).hasSize(10); } @@ -216,12 +216,12 @@ class GroupServiceTest { @Test void findGroupWith_FilterGroups() { eventService.saveAll(createPublicGroupEvent(uuidFromInt(0)), - updateGroupTitleEvent(uuidFromInt(0), "KK"), - updateGroupDescriptionEvent(uuidFromInt(0), "ABCDE"), - createPublicGroupEvent(uuidFromInt(1)), - updateGroupTitleEvent(uuidFromInt(1), "ABCDEFG"), - updateGroupDescriptionEvent(uuidFromInt(1), "KK"), - createPrivateGroupEvent()); + updateGroupTitleEvent(uuidFromInt(0), "KK"), + updateGroupDescriptionEvent(uuidFromInt(0), "ABCDE"), + createPublicGroupEvent(uuidFromInt(1)), + updateGroupTitleEvent(uuidFromInt(1), "ABCDEFG"), + updateGroupDescriptionEvent(uuidFromInt(1), "KK"), + createPrivateGroupEvent()); assertThat(groupService.findGroupWith("A", account("jesus"))).hasSize(2); assertThat(groupService.findGroupWith("F", account("jesus"))).hasSize(1);