Skip to content
Snippets Groups Projects
Commit 88a15533 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-6867 OZG-6903 implement sync scheduler

parent 69999843
No related branches found
No related tags found
No related merge requests found
package de.ozgcloud.admin;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
@Configuration
@EnableScheduling
public class SchedulingConfiguration {
}
package de.ozgcloud.admin.organisationseinheit;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import lombok.RequiredArgsConstructor;
@Component
@RequiredArgsConstructor
class SyncScheduler {
private final SyncService syncService;
@Scheduled(cron = "${ozgcloud.administration.sync.organisationseinheiten.cron}")
public void syncOrganisationsEinheitenFromKeycloak() {
syncService.syncOrganisationsEinheitenFromKeycloak();
}
}
......@@ -82,6 +82,10 @@ ozgcloud:
realm: ${ozgcloud.oauth2.realm}
client: ${ozgcloud.oauth2.resource}
organisations-einheit-id-key: organisationseinheitId
administration:
sync:
organisationseinheiten:
cron: "0 15 0 * * *"
grpc:
client:
......
package de.ozgcloud.admin.organisationseinheit;
import static org.mockito.Mockito.*;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
class SyncSchedulerTest {
@InjectMocks
private SyncScheduler scheduler;
@Mock
private SyncService syncService;
@Nested
class TestSyncOrganisationsEinheitenFromKeycloak {
@Test
void shouldCallService() {
scheduler.syncOrganisationsEinheitenFromKeycloak();
verify(syncService).syncOrganisationsEinheitenFromKeycloak();
}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment