Skip to content

Commit

Permalink
fjerne ubrukt river-kode i grunnlag (EY-4942) (#6815)
Browse files Browse the repository at this point in the history
  • Loading branch information
Watercolours authored Jan 21, 2025
1 parent b43752b commit abf5989
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.module.kotlin.readValue
import no.nav.etterlatte.grunnlag.GrunnlagService
import no.nav.etterlatte.libs.common.grunnlag.Grunnlagsopplysning
import no.nav.etterlatte.libs.common.grunnlag.opplysningstyper.Opplysningstype
import no.nav.etterlatte.libs.common.objectMapper
import no.nav.etterlatte.libs.common.person.Folkeregisteridentifikator
import no.nav.etterlatte.libs.common.rapidsandrivers.BEHOV_NAME_KEY
import no.nav.etterlatte.libs.common.rapidsandrivers.EVENT_NAME_KEY
import no.nav.etterlatte.libs.common.rapidsandrivers.eventName
import no.nav.etterlatte.libs.common.sak.SakId
Expand All @@ -32,7 +30,6 @@ class GrunnlagHendelserRiver(
init {
initialiserRiverUtenEventName(rapidsConnection) {
validate { it.interestedIn(EVENT_NAME_KEY) }
validate { it.interestedIn(BEHOV_NAME_KEY) }
validate { it.interestedIn(FNR_KEY) }
validate { it.requireKey(OPPLYSNING_KEY) }
validate { it.requireKey(SAK_ID_KEY) }
Expand All @@ -48,9 +45,8 @@ class GrunnlagHendelserRiver(
context: MessageContext,
) {
val eventName = packet[EVENT_NAME_KEY].asText()
val opplysningType = packet[BEHOV_NAME_KEY].asText()

if (eventName == EventNames.NY_OPPLYSNING.eventname || opplysningType in OPPLYSNING_TYPER) {
if (eventName == EventNames.NY_OPPLYSNING.eventname) {
val sakId = packet[SAK_ID_KEY].asLong().let { SakId(it) }
val behandlingId = packet[BEHANDLING_ID_KEY].let { UUID.fromString(it.asText()) }

Expand All @@ -76,8 +72,4 @@ class GrunnlagHendelserRiver(
context.publish(packet.toJson())
}
}

companion object {
private val OPPLYSNING_TYPER = Opplysningstype.entries.map { it.name }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import no.nav.etterlatte.grunnlag.rivers.GrunnlagHendelserRiver
import no.nav.etterlatte.libs.common.grunnlag.Grunnlagsopplysning
import no.nav.etterlatte.libs.common.grunnlag.opplysningstyper.Opplysningstype
import no.nav.etterlatte.libs.common.objectMapper
import no.nav.etterlatte.libs.common.rapidsandrivers.BEHOV_NAME_KEY
import no.nav.etterlatte.libs.common.rapidsandrivers.lagParMedEventNameKey
import no.nav.etterlatte.libs.common.tidspunkt.Tidspunkt
import no.nav.etterlatte.libs.common.toJsonNode
Expand Down Expand Up @@ -87,26 +86,6 @@ internal class RapidTest(
}
}

@Nested
inner class Opplysningsbehov {
private val melding =
JsonMessage
.newMessage(
mapOf(
BEHOV_NAME_KEY to Opplysningstype.SOEKER_PDL_V1,
OPPLYSNING_KEY to listOf(nyOpplysning),
FNR_KEY to fnr,
SAK_ID_KEY to 1,
BEHANDLING_ID_KEY to UUID.randomUUID(),
),
).toJson()

@Test
fun `ny enkeltopplysning lagres i databasen med riktige verdier`() {
assertOpplysningBlirLagret(melding = melding, expectedOpplysning = nyOpplysning)
}
}

private fun assertOpplysningBlirLagret(
melding: String,
expectedOpplysning: Grunnlagsopplysning<JsonNode>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import no.nav.helse.rapids_rivers.JsonMessage
import no.nav.helse.rapids_rivers.River

const val EVENT_NAME_KEY = "@event_name"
const val BEHOV_NAME_KEY = "@behov"
const val CORRELATION_ID_KEY = "@correlation_id"
const val TEKNISK_TID_KEY = "teknisk_tid"
const val FEILENDE_STEG = "feilende_steg"
Expand Down

0 comments on commit abf5989

Please sign in to comment.