-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
overvåking - pågående implementering
- Loading branch information
Jan Kroken
committed
Sep 25, 2023
1 parent
3a62d37
commit f27958c
Showing
4 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
.../pensjon/opptjening/omsorgsopptjening/start/innlesning/barnetrygd/domain/StatusService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package no.nav.pensjon.opptjening.omsorgsopptjening.start.innlesning.barnetrygd.domain | ||
|
||
import no.nav.pensjon.opptjening.omsorgsopptjening.start.innlesning.barnetrygd.repository.BarnetrygdInnlesingRepository | ||
import org.slf4j.LoggerFactory | ||
import org.springframework.stereotype.Service | ||
import org.springframework.transaction.support.TransactionTemplate | ||
|
||
@Service | ||
class StatusService( | ||
private val repo: BarnetrygdInnlesingRepository, | ||
private val transactionTemplate: TransactionTemplate, | ||
) { | ||
companion object { | ||
private val log = LoggerFactory.getLogger(this::class.java) | ||
} | ||
|
||
fun checkStatus(): ApplicationStatus { | ||
if (repo.finnSisteInnlesing() == null) return ApplicationStatus.IkkeKjort | ||
return ApplicationStatus.Feil(listOf("a", "b")) | ||
} | ||
} | ||
|
||
sealed class ApplicationStatus { | ||
object OK : ApplicationStatus() | ||
object IkkeKjort : ApplicationStatus() | ||
class Feil(val feil: List<String>) : ApplicationStatus() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...sjon/opptjening/omsorgsopptjening/start/innlesning/barnetrygd/domain/StatusServiceTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package no.nav.pensjon.opptjening.omsorgsopptjening.start.innlesning.barnetrygd.domain | ||
|
||
import no.nav.pensjon.opptjening.omsorgsopptjening.start.innlesning.barnetrygd.SpringContextTest | ||
import no.nav.pensjon.opptjening.omsorgsopptjening.start.innlesning.barnetrygd.repository.BarnetrygdInnlesingRepository | ||
import no.nav.pensjon.opptjening.omsorgsopptjening.start.innlesning.barnetrygd.repository.BarnetrygdmottakerRepository | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.api.Test | ||
import org.springframework.beans.factory.annotation.Autowired | ||
|
||
class StatusServiceTest: SpringContextTest.NoKafka() { | ||
|
||
@Autowired | ||
private lateinit var innlesingRepository: BarnetrygdInnlesingRepository | ||
|
||
@Autowired | ||
private lateinit var barnetrygdmottakerRepository: BarnetrygdmottakerRepository | ||
|
||
@Autowired | ||
private lateinit var statusService: StatusService | ||
|
||
@Test | ||
fun testFantIngenInnlesninger() { | ||
val status = statusService.checkStatus() | ||
assertThat(status).isEqualTo(ApplicationStatus.IkkeKjort) | ||
} | ||
} |