diff --git a/backend/src/main/java/lan/dk/podcastserver/scheduled/HibernateSearchIndexation.java b/backend/src/main/java/lan/dk/podcastserver/scheduled/HibernateSearchIndexation.java deleted file mode 100644 index 56197a0c9..000000000 --- a/backend/src/main/java/lan/dk/podcastserver/scheduled/HibernateSearchIndexation.java +++ /dev/null @@ -1,22 +0,0 @@ -package lan.dk.podcastserver.scheduled; - -import lan.dk.podcastserver.business.ItemBusiness; -import lombok.RequiredArgsConstructor; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -/** - * Created by kevin on 22/08/2014. - */ -@Component -@RequiredArgsConstructor -public class HibernateSearchIndexation { - - private final ItemBusiness itemBusiness; - - @Scheduled(fixedDelay = 86400000) - public void refreshIndex() throws InterruptedException { - itemBusiness.reindex(); - } - -} diff --git a/backend/src/main/kotlin/com/github/davinkevin/podcastserver/scheduled/HibernateSearchIndexation.kt b/backend/src/main/kotlin/com/github/davinkevin/podcastserver/scheduled/HibernateSearchIndexation.kt new file mode 100644 index 000000000..e26607a3f --- /dev/null +++ b/backend/src/main/kotlin/com/github/davinkevin/podcastserver/scheduled/HibernateSearchIndexation.kt @@ -0,0 +1,16 @@ +package com.github.davinkevin.podcastserver.scheduled + +import lan.dk.podcastserver.business.ItemBusiness +import org.springframework.scheduling.annotation.Scheduled +import org.springframework.stereotype.Component + +/** + * Created by kevin on 22/08/2014. + */ +@Component +class HibernateSearchIndexation(private val itemBusiness: ItemBusiness) { + + @Scheduled(fixedDelay = 86400000) + fun refreshIndex() = itemBusiness.reindex() + +} diff --git a/backend/src/test/java/lan/dk/podcastserver/scheduled/HibernateSearchIndexationTest.java b/backend/src/test/java/lan/dk/podcastserver/scheduled/HibernateSearchIndexationTest.java deleted file mode 100644 index 892629c0b..000000000 --- a/backend/src/test/java/lan/dk/podcastserver/scheduled/HibernateSearchIndexationTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package lan.dk.podcastserver.scheduled; - -import lan.dk.podcastserver.business.ItemBusiness; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; - -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - -/** - * Created by kevin on 17/08/15 for Podcast Server - */ -@RunWith(MockitoJUnitRunner.class) -public class HibernateSearchIndexationTest { - - @Mock ItemBusiness itemBusiness; - @InjectMocks HibernateSearchIndexation hibernateSearchIndexation; - - @Test - public void should_refresh_index() throws InterruptedException { - /* When */ hibernateSearchIndexation.refreshIndex(); - /* Then */ verify(itemBusiness, times(1)).reindex(); - } -} diff --git a/backend/src/test/kotlin/com/github/davinkevin/podcastserver/scheduled/HibernateSearchIndexationTest.kt b/backend/src/test/kotlin/com/github/davinkevin/podcastserver/scheduled/HibernateSearchIndexationTest.kt new file mode 100644 index 000000000..6e436261b --- /dev/null +++ b/backend/src/test/kotlin/com/github/davinkevin/podcastserver/scheduled/HibernateSearchIndexationTest.kt @@ -0,0 +1,28 @@ +package com.github.davinkevin.podcastserver.scheduled + +import lan.dk.podcastserver.business.ItemBusiness +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith +import org.mockito.InjectMocks +import org.mockito.Mock +import org.mockito.Mockito.times +import org.mockito.Mockito.verify +import org.mockito.junit.jupiter.MockitoExtension + +/** + * Created by kevin on 17/08/15 for Podcast Server + */ +@ExtendWith(MockitoExtension::class) +class HibernateSearchIndexationTest { + + @Mock lateinit var itemBusiness: ItemBusiness + @InjectMocks lateinit var hibernateSearchIndexation: HibernateSearchIndexation + + @Test + fun should_refresh_index() { + /* When */ + hibernateSearchIndexation.refreshIndex() + /* Then */ + verify(itemBusiness, times(1)).reindex() + } +}