Search in sources :

Example 1 with RecurringJob

use of com.enonic.xp.core.internal.concurrent.RecurringJob in project xp by enonic.

the class UdcServiceTest method testLifecycle.

@Test
void testLifecycle() {
    UdcScheduler udcSchedulerMock = mock(UdcScheduler.class);
    UdcConfig config = mock(UdcConfig.class);
    final RecurringJob recurringJob = mock(RecurringJob.class);
    when(config.url()).thenReturn("http://localhost:8080");
    when(udcSchedulerMock.scheduleWithFixedDelay(notNull())).thenReturn(recurringJob);
    UdcService service = new UdcService(udcSchedulerMock, config);
    service.activate();
    verify(udcSchedulerMock).scheduleWithFixedDelay(notNull());
    service.deactivate();
    verify(recurringJob).cancel();
}
Also used : RecurringJob(com.enonic.xp.core.internal.concurrent.RecurringJob) Test(org.junit.jupiter.api.Test)

Aggregations

RecurringJob (com.enonic.xp.core.internal.concurrent.RecurringJob)1 Test (org.junit.jupiter.api.Test)1