Skip to content

Commit

Permalink
Fjern litt ubrukte greier (#6551)
Browse files Browse the repository at this point in the history
* Fjern litt ubrukte greier

* mer snacks
  • Loading branch information
sebassonav authored Dec 4, 2024
1 parent 46d4bc2 commit fe9cabb
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ import no.nav.etterlatte.oppgave.OppgaveService
import java.time.LocalDate
import java.time.YearMonth
import java.util.UUID
import kotlin.collections.filter

class AktivitetspliktService(
private val aktivitetspliktDao: AktivitetspliktDao,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -658,11 +658,6 @@ class AarligInntektsjusteringJobbServiceTest {
}
}

@Test
fun `et eller annet feilhaandtering`() {
// TODO
}

companion object {
val fnrGyldigSak = "10418305857"
val gyldigSak =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package no.nav.etterlatte.avkorting

import com.fasterxml.jackson.databind.JsonNode
import no.nav.etterlatte.avkorting.AvkortetYtelseType.AARSOPPGJOER
import no.nav.etterlatte.avkorting.AvkortetYtelseType.ETTEROPPJOER
import no.nav.etterlatte.avkorting.AvkortetYtelseType.FORVENTET_INNTEKT
import no.nav.etterlatte.beregning.Beregning
import no.nav.etterlatte.libs.common.behandling.BehandlingStatus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ import no.nav.etterlatte.BehandlingService
import no.nav.etterlatte.behandling.randomSakId
import no.nav.etterlatte.funksjonsbrytere.FeatureToggleService
import no.nav.etterlatte.inntektsjustering.AarligInntektsjusteringJobbRiver
import no.nav.etterlatte.libs.common.behandling.BehandlingSammendrag
import no.nav.etterlatte.libs.common.behandling.BehandlingStatus
import no.nav.etterlatte.libs.common.behandling.Revurderingaarsak
import no.nav.etterlatte.libs.common.behandling.SakType
import no.nav.etterlatte.libs.common.behandling.Virkningstidspunkt
import no.nav.etterlatte.libs.common.rapidsandrivers.lagParMedEventNameKey
import no.nav.etterlatte.libs.common.sak.SakId
import no.nav.etterlatte.libs.common.sak.SakslisteDTO
Expand All @@ -22,7 +18,6 @@ import no.nav.etterlatte.rapidsandrivers.RapidEvents.SPESIFIKKE_SAKER
import no.nav.helse.rapids_rivers.JsonMessage
import no.nav.helse.rapids_rivers.testsupport.TestRapid
import org.junit.jupiter.api.Test
import java.time.YearMonth

class AarligInntektsjusteringJobbRiverTest {
private val kjoering = "inntektsjustering-jobb-2024"
Expand All @@ -40,7 +35,7 @@ class AarligInntektsjusteringJobbRiverTest {

val inspector =
TestRapid().apply { AarligInntektsjusteringJobbRiver(this, behandlingServiceMock, featureToggleService) }
inspector.sendTestMessage(genererMelding(loependeFom))
inspector.sendTestMessage(genererMelding())

verify(exactly = 1) {
behandlingServiceMock.hentAlleSaker(
Expand Down Expand Up @@ -68,7 +63,7 @@ class AarligInntektsjusteringJobbRiverTest {
val inspector =
TestRapid().apply { AarligInntektsjusteringJobbRiver(this, behandlingServiceMock, featureToggleService) }

inspector.sendTestMessage(genererMelding(loependeFom))
inspector.sendTestMessage(genererMelding())
verify(exactly = 0) {
behandlingServiceMock.hentAlleSaker(
kjoering,
Expand All @@ -81,7 +76,7 @@ class AarligInntektsjusteringJobbRiverTest {
}
}

private fun genererMelding(loependeFom: YearMonth) =
private fun genererMelding() =
JsonMessage
.newMessage(
mapOf(
Expand All @@ -92,18 +87,4 @@ class AarligInntektsjusteringJobbRiverTest {
EKSKLUDERTE_SAKER to listOf<SakId>(),
),
).toJson()

private fun genererBehandlingSammendrag(
status: BehandlingStatus,
aarsak: Revurderingaarsak,
virkningstidspunkt: YearMonth,
): BehandlingSammendrag {
val virkningstidspunktMock = mockk<Virkningstidspunkt>()
every { virkningstidspunktMock.dato } returns virkningstidspunkt
val behandlingSammendragMock = mockk<BehandlingSammendrag>()
every { behandlingSammendragMock.status } returns status
every { behandlingSammendragMock.aarsak } returns aarsak.name
every { behandlingSammendragMock.virkningstidspunkt } returns virkningstidspunktMock
return behandlingSammendragMock
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,12 @@ import com.github.michaelbull.result.mapBoth
import com.typesafe.config.Config
import io.ktor.client.HttpClient
import no.nav.etterlatte.libs.common.RetryResult
import no.nav.etterlatte.libs.common.behandling.PersonMedSakerOgRoller
import no.nav.etterlatte.libs.common.deserialize
import no.nav.etterlatte.libs.common.grunnlag.Grunnlag
import no.nav.etterlatte.libs.common.objectMapper
import no.nav.etterlatte.libs.common.person.Folkeregisteridentifikator
import no.nav.etterlatte.libs.common.retry
import no.nav.etterlatte.libs.common.toJson
import no.nav.etterlatte.libs.ktor.ktor.ktorobo.AzureAdClient
import no.nav.etterlatte.libs.ktor.ktor.ktorobo.DownstreamResourceClient
import no.nav.etterlatte.libs.ktor.ktor.ktorobo.Resource
import no.nav.etterlatte.libs.ktor.route.FoedselsnummerDTO
import no.nav.etterlatte.libs.ktor.token.BrukerTokenInfo
import org.slf4j.LoggerFactory
import java.util.UUID
Expand Down Expand Up @@ -68,22 +63,4 @@ class GrunnlagKlient(
}
}
}

suspend fun hentPersonSakOgRolle(
fnr: Folkeregisteridentifikator,
brukerTokenInfo: BrukerTokenInfo,
): PersonMedSakerOgRoller =
downstreamResourceClient
.post(
resource =
Resource(
clientId = clientId,
url = "$resourceUrl/grunnlag/person/roller",
),
brukerTokenInfo = brukerTokenInfo,
postBody = FoedselsnummerDTO(fnr.value).toJson(),
).mapBoth(
success = { resource -> deserialize(resource.response.toString()) },
failure = { errorResponse -> throw errorResponse },
)
}
14 changes: 0 additions & 14 deletions libs/etterlatte-ktor/src/main/kotlin/route/RouteUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import io.ktor.server.application.call
import io.ktor.server.request.receive
import io.ktor.server.response.respond
import io.ktor.util.pipeline.PipelineContext
import no.nav.etterlatte.funksjonsbrytere.FeatureToggle
import no.nav.etterlatte.funksjonsbrytere.FeatureToggleService
import no.nav.etterlatte.libs.common.feilhaandtering.ForespoerselException
import no.nav.etterlatte.libs.common.feilhaandtering.GenerellIkkeFunnetException
import no.nav.etterlatte.libs.common.feilhaandtering.UgyldigForespoerselException
Expand Down Expand Up @@ -242,18 +240,6 @@ fun ApplicationCall.dato(param: String) =
.getOrElse { throw UgyldigDatoFormatException() }
}

suspend fun PipelineContext<Unit, ApplicationCall>.hvisEnabled(
featureToggleService: FeatureToggleService,
toggle: FeatureToggle,
block: suspend PipelineContext<Unit, ApplicationCall>.() -> Unit,
) {
if (featureToggleService.isEnabled(toggle, false)) {
block()
} else {
throw FeatureIkkeStoettetException()
}
}

class FeatureIkkeStoettetException :
ForespoerselException(
code = "NOT_IMPLEMENTED",
Expand Down

0 comments on commit fe9cabb

Please sign in to comment.