Skip to content
Snippets Groups Projects
Commit 26c8272e authored by OZGCloud's avatar OZGCloud
Browse files

OZG-6867 Move parameter syncTimestamp to the end

parent 217a39e2
No related branches found
No related tags found
No related merge requests found
......@@ -90,12 +90,12 @@ class SyncService {
public void syncAddedOrganisationsEinheiten(long syncTimestamp) {
repository.findAllWithoutSyncResult().forEach(
organisationsEinheit -> syncAddedOrganisationsEinheit(syncTimestamp, organisationsEinheit));
organisationsEinheit -> syncAddedOrganisationsEinheit(organisationsEinheit, syncTimestamp));
}
void syncAddedOrganisationsEinheit(long syncTimestamp, OrganisationsEinheit organisationsEinheit) {
void syncAddedOrganisationsEinheit(OrganisationsEinheit organisationsEinheit, long syncTimestamp) {
addAsGroupInKeycloak(organisationsEinheit).ifPresent(
addedGroupId -> updateAfterSuccessfulGroupCreation(organisationsEinheit, syncTimestamp, addedGroupId));
addedGroupId -> updateAfterSuccessfulGroupCreation(organisationsEinheit, addedGroupId, syncTimestamp));
}
Optional<String> addAsGroupInKeycloak(OrganisationsEinheit organisationsEinheit) {
......@@ -106,7 +106,7 @@ class SyncService {
return addGroupInKeycloak(addGroupData);
}
void updateAfterSuccessfulGroupCreation(OrganisationsEinheit organisationsEinheit, long syncTimestamp, String keycloakId) {
void updateAfterSuccessfulGroupCreation(OrganisationsEinheit organisationsEinheit, String keycloakId, long syncTimestamp) {
var updatedOrganisationsEinheit = organisationsEinheit.toBuilder()
.keycloakId(keycloakId)
.syncResult(SyncResult.OK)
......
......@@ -450,7 +450,7 @@ class SyncServiceTest {
@BeforeEach
void setUp() {
when(repository.findAllWithoutSyncResult()).thenReturn(Stream.of(organisationsEinheiten));
doNothing().when(service).syncAddedOrganisationsEinheit(anyLong(), any());
doNothing().when(service).syncAddedOrganisationsEinheit(any(), anyLong());
}
@Test
......@@ -464,14 +464,14 @@ class SyncServiceTest {
void shouldSynchronizeFirstOrganisationsEinheit() {
callService();
verify(service).syncAddedOrganisationsEinheit(syncTimestamp, withoutSyncResult1);
verify(service).syncAddedOrganisationsEinheit(withoutSyncResult1, syncTimestamp);
}
@Test
void shouldSynchronizeSecondOrganisationsEinheit() {
callService();
verify(service).syncAddedOrganisationsEinheit(syncTimestamp, withoutSyncResult2);
verify(service).syncAddedOrganisationsEinheit(withoutSyncResult2, syncTimestamp);
}
private void callService() {
......@@ -499,11 +499,11 @@ class SyncServiceTest {
@Test
void shouldUpdateAfterSuccessfulGroupCreation() {
doReturn(Optional.of(addedGroupId)).when(service).addAsGroupInKeycloak(organisationsEinheit);
doNothing().when(service).updateAfterSuccessfulGroupCreation(organisationsEinheit, syncTimestamp, addedGroupId);
doNothing().when(service).updateAfterSuccessfulGroupCreation(organisationsEinheit, addedGroupId, syncTimestamp);
callService();
verify(service).updateAfterSuccessfulGroupCreation(organisationsEinheit, syncTimestamp, addedGroupId);
verify(service).updateAfterSuccessfulGroupCreation(organisationsEinheit, addedGroupId, syncTimestamp);
}
@Test
......@@ -512,11 +512,11 @@ class SyncServiceTest {
callService();
verify(service, never()).updateAfterSuccessfulGroupCreation(any(), anyLong(), any());
verify(service, never()).updateAfterSuccessfulGroupCreation(any(), any(), anyLong());
}
private void callService() {
service.syncAddedOrganisationsEinheit(syncTimestamp, organisationsEinheit);
service.syncAddedOrganisationsEinheit(organisationsEinheit, syncTimestamp);
}
}
......@@ -591,7 +591,7 @@ class SyncServiceTest {
@Test
void shouldSaveUpdatedOrganisationsEinheit() {
service.updateAfterSuccessfulGroupCreation(organisationsEinheit, syncTimestamp, keycloakId);
service.updateAfterSuccessfulGroupCreation(organisationsEinheit, keycloakId, syncTimestamp);
verify(repository).save(organisationsEinheitArgumentCaptor.capture());
assertThat(organisationsEinheitArgumentCaptor.getValue())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment