Skip to content

Commit

Permalink
Update depenencies
Browse files Browse the repository at this point in the history
  • Loading branch information
SailReal committed Oct 28, 2024
1 parent 0724be6 commit 5078b24
Show file tree
Hide file tree
Showing 6 changed files with 1,881 additions and 1,045 deletions.
12 changes: 6 additions & 6 deletions backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.container-image.group>cryptomator</quarkus.container-image.group>
<quarkus.container-image.name>hub</quarkus.container-image.name>
<quarkus.platform.version>3.8.6</quarkus.platform.version>
<quarkus.platform.version>3.15.1</quarkus.platform.version>
<quarkus.jib.base-jvm-image>eclipse-temurin:21-jre</quarkus.jib.base-jvm-image> <!-- irrelevant for -Pnative -->
<jwt.version>4.4.0</jwt.version>
<compiler-plugin.version>3.13.0</compiler-plugin.version>
Expand Down Expand Up @@ -57,11 +57,11 @@
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive</artifactId>
<artifactId>quarkus-rest</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-jackson</artifactId>
<artifactId>quarkus-rest-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
Expand All @@ -81,15 +81,15 @@
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client-reactive-jackson</artifactId>
<artifactId>quarkus-rest-client-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client-reactive</artifactId>
<artifactId>quarkus-rest-client</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-keycloak-admin-client-reactive</artifactId>
<artifactId>quarkus-keycloak-admin-rest-client</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void sync(Map<String, Group> keycloakGroups, Map<String, User> keycloakUsers, Ma
<T extends Authority> void syncAddedAuthorities(Map<String, T> keycloakAuthorities, Map<String, T> databaseAuthorities) {
var addedAuthority = diff(keycloakAuthorities.keySet(), databaseAuthorities.keySet());
for (var id : addedAuthority) {
authorityRepo.persist(keycloakAuthorities.get(id));
authorityRepo.persistAndFlush(keycloakAuthorities.get(id));
}
}

Expand All @@ -76,7 +76,7 @@ void syncUpdatedUsers(Map<String, User> keycloakUsers, Map<String, User> databas
dbUser.setPictureUrl(kcUser.getPictureUrl());
dbUser.setName(kcUser.getName());
dbUser.setEmail(kcUser.getEmail());
userRepo.persist(dbUser);
userRepo.persistAndFlush(dbUser);
}
}

Expand All @@ -91,7 +91,7 @@ void syncUpdatedGroups(Map<String, Group> keycloakGroups, Map<String, Group> dat

dbGroup.getMembers().addAll(diff(kcGroup.getMembers(), dbGroup.getMembers()));
dbGroup.getMembers().removeAll(diff(dbGroup.getMembers(), kcGroup.getMembers()));
// TODO why don't we run dbGroup.persist()?
groupRepo.persistAndFlush(dbGroup);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.persistence.CascadeType;
import jakarta.persistence.DiscriminatorValue;
import jakarta.persistence.Entity;
import jakarta.persistence.JoinColumn;
Expand All @@ -17,7 +18,7 @@
@DiscriminatorValue("GROUP")
public class Group extends Authority {

@ManyToMany
@ManyToMany(cascade = {CascadeType.MERGE, CascadeType.REFRESH})
@JoinTable(name = "group_membership",
joinColumns = @JoinColumn(name = "group_id", referencedColumnName = "id"),
inverseJoinColumns = @JoinColumn(name = "member_id", referencedColumnName = "id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class RemoteUserPullerTest {
private final User user = Mockito.mock(User.class);
private final Authority.Repository authorityRepo = Mockito.mock(Authority.Repository.class);
private final User.Repository userRepo = Mockito.mock(User.Repository.class);
private final Group.Repository groupRepo = Mockito.mock(Group.Repository.class);

private RemoteUserPuller remoteUserPuller;

Expand All @@ -37,8 +38,10 @@ void setUp() {
remoteUserPuller.remoteUserProvider = remoteUserProvider;
remoteUserPuller.authorityRepo = authorityRepo;
remoteUserPuller.userRepo = userRepo;
Mockito.doNothing().when(authorityRepo).persist((Authority) Mockito.any());
Mockito.doNothing().when(userRepo).persist((User) Mockito.any());
remoteUserPuller.groupRepo = groupRepo;
Mockito.doNothing().when(authorityRepo).persistAndFlush(Mockito.any());
Mockito.doNothing().when(userRepo).persistAndFlush(Mockito.any());
Mockito.doNothing().when(groupRepo).persistAndFlush(Mockito.any());
}

@Nested
Expand Down Expand Up @@ -75,7 +78,7 @@ public void testAddAuthorities(@ConvertWith(StringArrayConverter.class) String[]
remoteUserPuller.syncAddedAuthorities(keycloakAuthorities, databaseAuthorities);

for (String authorityId : addedAuthorityIds) {
Mockito.verify(authorityRepo).persist(keycloakAuthorities.get(authorityId));
Mockito.verify(authorityRepo).persistAndFlush(keycloakAuthorities.get(authorityId));
}
}

Expand Down Expand Up @@ -153,7 +156,7 @@ public void testUpdateUsers(@ConvertWith(StringArrayConverter.class) String[] ke

for (String userId : updatedUserIds) {
var dbUser = databaseUsers.get(userId);
Mockito.verify(userRepo).persist(dbUser);
Mockito.verify(userRepo).persistAndFlush(dbUser);
Mockito.verify(dbUser).setPictureUrl(String.format("picture %s", userId));
Mockito.verify(dbUser).setName(String.format("name %s", userId));
Mockito.verify(dbUser).setEmail(String.format("email %s", userId));
Expand Down Expand Up @@ -202,6 +205,7 @@ public void testUpdateGroups(@ConvertWith(StringArrayConverter.class) String[] k
var dbGroup = databaseGroups.get(groupId);
Mockito.verify(dbGroup).setName(String.format("name %s", groupId));
MatcherAssert.assertThat(dbGroupMembers, Matchers.containsInAnyOrder(user, otherKCUser));
Mockito.verify(groupRepo).persistAndFlush(dbGroup);
}
}
}
Expand Down
Loading

0 comments on commit 5078b24

Please sign in to comment.