Skip to content

Commit

Permalink
integraatiotesti raportointi-apille
Browse files Browse the repository at this point in the history
  • Loading branch information
marjakari committed Dec 5, 2024
1 parent 6daad69 commit d56d2b8
Show file tree
Hide file tree
Showing 8 changed files with 432 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class BaseIntegraatioTesti {

val LOG = LoggerFactory.getLogger(this.getClass)

val localstack: LocalStackContainer = new LocalStackContainer(new DockerImageName("localstack/localstack:2.2.0"))
val localstack: LocalStackContainer = new LocalStackContainer(DockerImageName.parse("localstack/localstack:2.2.0"))
.withServices(Service.SQS, Service.SES, Service.CLOUDWATCH)
.withLogConsumer(frame => LOG.info(frame.getUtf8StringWithoutLineEnding))
.withExposedPorts(4566)
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class RealONRService() extends ONRService {
"JSESSIONID"))

def haeAsiointikieli(personOid: String): Either[Throwable, String] =
LOG.info("Haetaan tiedot oppijanumerorekisteristä")
LOG.debug(s"Haetaan tiedot oppijanumerorekisteristä oidille $personOid")
val url = s"https://virkailija.$opintopolkuDomain/oppijanumerorekisteri-service/henkilo/$personOid/asiointiKieli"
fetch(url) match
case Left(e) => Left(e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class OrganisaatioCache {

val childOidsLoader = new CacheLoader[String, Response[String]] {
def load(oid: String): Response[String] =
LOG.info(s"Ladataan lapsiorganisaatio-cache oidille $oid")
LOG.debug(s"Ladataan lapsiorganisaatio-cache oidille $oid")
val uri: Uri = uri"https://virkailija.$opintopolkuDomain/organisaatio-service/api/$oid/childoids?$queryParams"
quickRequest
.headers(headers)
Expand All @@ -34,7 +34,7 @@ class OrganisaatioCache {

val parentOidsLoader = new CacheLoader[String, Response[String]] {
def load(oid: String): Response[String] =
LOG.info(s"Ladataan parentorganisaatio-cache oidille $oid")
LOG.debug(s"Ladataan parentorganisaatio-cache oidille $oid")
val uri: Uri = uri"https://virkailija.$opintopolkuDomain/organisaatio-service/api/$oid/parentoids"
quickRequest
.headers(headers)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ class HenkiloResource {
new ApiResponse(responseCode = "200", description = "Palauttaa asiointikielen"),
))
def getAsiointikieli(request: HttpServletRequest) = {
LOG.info("Haetaan asiointikieli")
LOG.debug("Haetaan käyttäjän asiointikieli")
val session: HttpSession = request.getSession(false)
LOG.warn(s"sessio: ${session}")
val result = OnrService.haeAsiointikieli(SecurityContextHolder.getContext.getAuthentication.getName())
result match
case Left(e) =>
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class OrganisaatioResource {
new ApiResponse(responseCode = "200", description = "Palauttaa listan organisaatio-oideja"),
))
def getOrganisaatiot(request: HttpServletRequest) = {
LOG.info("Haetaan käyttöoikeuksien organisaatiot")
LOG.debug("Haetaan käyttöoikeuksien organisaatiot")
val securityOperaatiot = new SecurityOperaatiot(httpSession = request.getSession(false))
try
ResponseEntity.status(HttpStatus.OK).body(write[List[String]](securityOperaatiot.getCasOrganisaatiot().toList))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class SecurityOperaatiot(
else
Option(httpSession.getAttribute(SESSION_ATTR_KAYTTOOIKEUDET)) match {
case Some(_) =>
LOG.warn("oikat sessiosta!")
parseTypedKayttooikeusSetFromSession(httpSession, SESSION_ATTR_KAYTTOOIKEUDET).getOrElse(Set.empty)

case None =>
Expand Down Expand Up @@ -84,10 +83,8 @@ class SecurityOperaatiot(
else
if (httpSession.getAttribute(SESSION_ATTR_KAYTTOOIKEUSTUNNISTEET) != null
&& eiUusiaTunnisteitaKannassa(httpSession, kantaOperaatiot))
LOG.warn("oikkatunnisteet sessiosta!")
parseTypedTunnisteAttributeFromSession(httpSession, SESSION_ATTR_KAYTTOOIKEUSTUNNISTEET)
else
LOG.warn("oikkatunnisteet kannasta ja laitetaan sessioon!")
val (tunnisteet, uusinTunniste) = kantaOperaatiot.getKayttooikeusTunnisteet(kayttajanOikeudet.toSeq)
httpSession.setAttribute(SESSION_ATTR_KAYTTOOIKEUSTUNNISTEET, tunnisteet)
httpSession.setAttribute(SESSION_ATTR_UUSIN_KAYTTOOIKEUSTUNNISTE, uusinTunniste)
Expand Down

0 comments on commit d56d2b8

Please sign in to comment.