Skip to content

Commit

Permalink
Refactor method name
Browse files Browse the repository at this point in the history
  • Loading branch information
frank.buechel committed Jul 26, 2021
1 parent 832f3c2 commit 2a5627d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
import java.util.Objects;
Expand All @@ -19,8 +18,6 @@
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
import org.keycloak.admin.client.resource.RealmResource;
import org.keycloak.admin.client.resource.RoleMappingResource;
import org.keycloak.admin.client.resource.RolesResource;
import org.keycloak.representations.idm.ClientRepresentation;
import org.keycloak.representations.idm.ProtocolMapperRepresentation;
import org.keycloak.representations.idm.RoleRepresentation;
Expand Down Expand Up @@ -97,6 +94,7 @@ public void apply(ClientResource clientResource) {

if (clientResource.getSpec().getServiceAccountsEnabled() == Boolean.TRUE) {
manageServiceAccountRealmRoles(realmResource, clientUuid, clientResource);

}
updateStatus(clientResource, null);
} catch (RuntimeException e) {
Expand Down Expand Up @@ -368,7 +366,7 @@ void manageMapper(RealmResource realmResource, String clientUuid, ClientResource

private void manageServiceAccountRealmRoles(RealmResource realmResource, String clientUuid, ClientResource clientResource) {

this.serviceAccountRoleAssignmentSynchronizer.manageServiceAccountRealmRoles(realmResource, clientResource, clientUuid);
this.serviceAccountRoleAssignmentSynchronizer.synchronizeServiceAccountRealmRoles(realmResource, clientResource, clientUuid);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public ServiceAccountRoleAssignmentSynchronizer(ServiceAccountRoleAssignment ser
this.serviceAccountRoleAssignment = serviceAccountRoleAssignment;
}

public void manageServiceAccountRealmRoles(RealmResource realmResource, ClientResource clientResourceDefinition, String clientUuid) {
public void synchronizeServiceAccountRealmRoles(RealmResource realmResource, ClientResource clientResourceDefinition, String clientUuid) {
var keycloak = clientResourceDefinition.getSpec().getKeycloak();
var realm = clientResourceDefinition.getSpec().getRealm();
var clientId = clientResourceDefinition.getSpec().getClientId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void givenAssignedRolesAreNotUnassignedAndCreatedAndReassignedIgnoringCas
serviceAccountRoleAssignment);

// Act
synchronizer.manageServiceAccountRealmRoles(realmResource, k8sClientResourceDefinition, CLIENT_UUID);
synchronizer.synchronizeServiceAccountRealmRoles(realmResource, k8sClientResourceDefinition, CLIENT_UUID);

// Assert/Verify
verifyNoInteractions(rolesResource, roleScopeResource);
Expand Down Expand Up @@ -91,7 +91,7 @@ public void givenUnassignedRoleToAssignThatDoesNotExistInRealmIsCreatedAndAssign
var synchronizer = new ServiceAccountRoleAssignmentSynchronizer(serviceAccountRoleAssignment);

// Act
synchronizer.manageServiceAccountRealmRoles(realmResource, k8sClientResource, CLIENT_UUID);
synchronizer.synchronizeServiceAccountRealmRoles(realmResource, k8sClientResource, CLIENT_UUID);

// Assert
InOrder inOrder = Mockito.inOrder(roleScopeResource, rolesResource);
Expand Down Expand Up @@ -135,7 +135,7 @@ public void givenUnassignedRoleToAssignThatExistsInRealmIsNotCreatedButAssignedI
serviceAccountRoleAssignment);

// Act
synchronizer.manageServiceAccountRealmRoles(realmResource, k8sClientResourceDefinition, CLIENT_UUID);
synchronizer.synchronizeServiceAccountRealmRoles(realmResource, k8sClientResourceDefinition, CLIENT_UUID);

InOrder inOrder = Mockito.inOrder(roleScopeResource, rolesResource);
inOrder.verify(roleScopeResource, times(0)).remove(anyList());
Expand Down

0 comments on commit 2a5627d

Please sign in to comment.