Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
Adding test API
Browse files Browse the repository at this point in the history
  • Loading branch information
Magnus Evensberget committed Jun 4, 2021
1 parent 19b757c commit 029e76d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class ApplicationContext {
// topic = environment.kafkaTopics.varselKvitteringOutgoing
// )

// val varselProducer = VarselEventProducer(
// env = environment.kafka,
// topic = environment.kafkaTopics.varselIncoming
// )
val varselProducer = VarselEventProducer(
env = environment.kafka,
topic = environment.kafkaTopics.varselIncoming
)


// val beskjedProducer = BrukernotifikasjonBeskjedProducer(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ fun Application.healthModule(appContext: ApplicationContext) {
application.log.debug(it.buildText())
}
healthApi(appContext.metrics)
//varselApi(appContext.varselProducer)
varselApi()
varselApi(appContext.varselProducer)
}
}
62 changes: 31 additions & 31 deletions src/main/kotlin/no/nav/fo/veilarbvarsel/varsel/VarselApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import io.ktor.request.*
import io.ktor.response.*
import io.ktor.routing.*
import org.slf4j.LoggerFactory
import java.time.LocalDateTime
import java.util.*

fun Route.varselApi(
//varselEventProducer: VarselEventProducer
varselEventProducer: VarselEventProducer
) {

val logger = LoggerFactory.getLogger(javaClass)
Expand All @@ -17,43 +19,41 @@ fun Route.varselApi(

post {
val varsel = call.receive<Varsel>()
println("Here 4")

// varselEventProducer.send(
// CreateVarselVarselEvent(
// UUID.randomUUID(),
// LocalDateTime.now(),
// varsel.system,
// varsel.id,
// varsel.type,
// varsel.fodselsnummer,
// varsel.groupId,
// varsel.message,
// varsel.link.toString(),
// varsel.sikkerhetsnivaa,
// varsel.visibleUntil,
// varsel.externalVarsling
// )
// )

varselEventProducer.send(
CreateVarselVarselEvent(
UUID.randomUUID(),
LocalDateTime.now(),
varsel.system,
varsel.id,
varsel.type,
varsel.fodselsnummer,
varsel.groupId,
varsel.message,
varsel.link.toString(),
varsel.sikkerhetsnivaa,
varsel.visibleUntil,
varsel.externalVarsling
)
)

call.respond(HttpStatusCode.Created)

}

post("/done") {
val done = call.receive<Done>()
println("Here 5")

// varselEventProducer.send(
// DoneVarselEvent(
// UUID.randomUUID(),
// LocalDateTime.now(),
// done.system,
// done.id,
// done.fodselsnummer,
// done.groupId
// )
// )

varselEventProducer.send(
DoneVarselEvent(
UUID.randomUUID(),
LocalDateTime.now(),
done.system,
done.id,
done.fodselsnummer,
done.groupId
)
)

call.respond(HttpStatusCode.Created)
}
Expand Down

0 comments on commit 029e76d

Please sign in to comment.