Skip to content

Commit

Permalink
Merge branch 'master' into feature/ny-fullmakt-integrasjon
Browse files Browse the repository at this point in the history
  • Loading branch information
stigus committed Sep 12, 2024
2 parents 687ea84 + 0b6141d commit 72966f7
Show file tree
Hide file tree
Showing 64 changed files with 762 additions and 389 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,19 @@ Eller kjør:
```

## Virtuelt miljø
Kjør kommandoen:

Kjør kommandoen:
```aiexclude
> JWK=$(cat ./mocks/jwk.json) docker compose up --build
```
JWK=$(cat ./mocks/jwk.json) docker compose up --build
Evt. i PowerShell:
```aiexclude
> $env:JWK=(Get-Content -Path ./mocks/jwk.json -Raw) ; docker compose up --build
```

Deretter kan itegrasjonstester kjøres med kommandoen:

Deretter kan itegrasjonstester kjøres med kommandoen:
```
./gradlew iTest
> ./gradlew iTest
```

NB: Dette vil kun fungere hvis appen støtter itegrasjonstester.
NB: Dette vil kun fungere hvis appen støtter integrasjonstester.


## Kode generert av GitHub Copilot
Expand Down
2 changes: 1 addition & 1 deletion apps/app-tilgang-analyse-service/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spec:
- host: api.github.com
gcp:
sqlInstances:
- type: POSTGRES_12
- type: POSTGRES_15
tier: db-custom-1-3840
databases:
- name: testnav-app-tilgang-analyse-service-db
Expand Down
2 changes: 1 addition & 1 deletion apps/brreg-stub/src/test/resources/application-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ spring:
database:
enabled: false
datasource:
url: jdbc:tc:postgresql:12:///test_database
url: jdbc:tc:postgresql:15:///test_database
username: user
password: password
jpa:
Expand Down
2 changes: 1 addition & 1 deletion apps/bruker-service/config.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ spec:
max: 1
gcp:
sqlInstances:
- type: POSTGRES_12
- type: POSTGRES_15
tier: db-custom-1-3840
databases:
- name: testnav-bruker-service-dev-db
Expand Down
2 changes: 1 addition & 1 deletion apps/bruker-service/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ spec:
path: /internal/metrics
gcp:
sqlInstances:
- type: POSTGRES_12
- type: POSTGRES_15
tier: db-custom-1-3840
databases:
- name: testnav-bruker-service-db
Expand Down
8 changes: 6 additions & 2 deletions apps/dolly-backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,17 @@ https://dolly-backend.intern.dev.nav.no/swagger-ui.html
## Kjør lokalt

https://dolly-backend.intern.dev.nav.no/swagger-ui.html
**NB: `naisdevice` må kjøre og være grønn.**

1. `naisdevice` må kjøre og være grønn.
2. Vault token må enten hentes manuelt fra [Vault](https://vault.adeo.no/) og settes ved kjøring som VM option `-Dspring.cloud.vault.token=<TOKEN>` eller så må du være logget inn med Vault CLI slik at token kan hentes med `vault print token` før applikasjonen kjører.

Så kjør `./gradlew clean build`

Deretter kan DollyBackendApplicationStarter startes med disse VM options:

`-Dspring.profiles.active=local --add-opens java.base/java.lang=ALL-UNNAMED -Dspring.cloud.vault.token=*TOKEN*`
```
-Dspring.profiles.active=local --add-opens java.base/java.lang=ALL-UNNAMED
```

For å kjøre tester og bygge appen lokalt må Docker (Colima kan brukes på Mac) kjøre og man er nødt til å sette disse
miljøvariablene:
Expand Down
3 changes: 1 addition & 2 deletions apps/dolly-backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ dependencies {
implementation 'no.nav.testnav.libs:data-transfer-objects'
implementation 'no.nav.testnav.libs:data-transfer-search-objects'
implementation 'no.nav.testnav.libs:reactive-core'

implementation 'org.springframework.cloud:spring-cloud-vault-config-databases'
implementation 'no.nav.testnav.libs:vault'

implementation "org.springdoc:springdoc-openapi-starter-webmvc-ui:$versions.springdoc"
implementation "io.swagger.core.v3:swagger-annotations-jakarta:$versions.swagger"
Expand Down
2 changes: 1 addition & 1 deletion apps/dolly-backend/config.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ spec:
memory: 2048Mi
gcp:
sqlInstances:
- type: POSTGRES_14
- type: POSTGRES_15
tier: db-custom-1-3840
name: testnav-dolly-backend-dev
databases:
Expand Down
2 changes: 1 addition & 1 deletion apps/dolly-backend/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ spec:
memory: 8192Mi
gcp:
sqlInstances:
- type: POSTGRES_14
- type: POSTGRES_15
tier: db-custom-2-7680
name: testnav-dolly-backend
databases:
Expand Down
1 change: 1 addition & 0 deletions apps/dolly-backend/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ includeBuild '../../libs/security-core'
includeBuild '../../libs/servlet-core'
includeBuild '../../libs/servlet-insecure-security'
includeBuild '../../libs/servlet-security'
includeBuild '../../libs/vault'

develocity {
buildScan {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,43 +1,17 @@
package no.nav.dolly.config;

import lombok.RequiredArgsConstructor;
import no.nav.testnav.libs.database.config.FlywayConfiguration;
import no.nav.testnav.libs.database.config.VaultHikariConfiguration;
import no.nav.testnav.libs.vault.AbstractLocalVaultConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Profile;
import org.springframework.vault.annotation.VaultPropertySource;
import org.springframework.vault.authentication.ClientAuthentication;
import org.springframework.vault.authentication.TokenAuthentication;
import org.springframework.vault.client.VaultEndpoint;
import org.springframework.vault.config.AbstractVaultConfiguration;

import static org.apache.commons.lang3.StringUtils.isBlank;

@Configuration
@Profile("local")
@Import({ FlywayConfiguration.class,
VaultHikariConfiguration.class })
@VaultPropertySource(value = "secret/dolly/lokal", ignoreSecretNotFound = false)
@RequiredArgsConstructor
public class LocalConfig extends AbstractVaultConfiguration {

private static final String TOKEN = "spring.cloud.vault.token";

@Override
public VaultEndpoint vaultEndpoint() {
return VaultEndpoint.create("vault.adeo.no", 443);
}

@Override
public ClientAuthentication clientAuthentication() {
if (System.getenv().containsKey("VAULT_TOKEN")) {
System.setProperty(TOKEN, System.getenv("VAULT_TOKEN"));
}
var token = System.getProperty(TOKEN);
if (isBlank(token)) {
throw new IllegalArgumentException(String.format("Påkrevet property '%s' er ikke satt.", TOKEN));
}
return new TokenAuthentication(System.getProperty(TOKEN));
}
@Import({
FlywayConfiguration.class,
VaultHikariConfiguration.class
})
public class LocalConfig extends AbstractLocalVaultConfiguration {
}
4 changes: 2 additions & 2 deletions apps/dolly-backend/src/test/resources/application-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ spring:
enabled: false
datasource:
type: org.springframework.jdbc.datasource.SimpleDriverDataSource
url: jdbc:tc:postgresql:14.4:///dollyDB?TC_REUSABLE=true # 14.4 er versjon p.t. i dev-gcp.
url: jdbc:tc:postgresql:15:///dollyDB?TC_REUSABLE=true
username: user
password: pass
flyway:
enabled: true
url: jdbc:tc:postgresql:14.4:///dollyDB?TC_REUSABLE=true # 14.4 er versjon p.t. i dev-gcp.
url: jdbc:tc:postgresql:15:///dollyDB?TC_REUSABLE=true
user: user
password: pass
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export const PensjonPanel = ({ stateModifier, formValues }: any) => {
const sm = stateModifier(PensjonPanel.initialValues)
const opts = useContext(BestillingsveilederContext)

const harValgtAp = _.has(formValues, 'pensjonforvalter.alderspensjon')
const harValgtUforetrygd = _.has(formValues, 'pensjonforvalter.uforetrygd')

const harGyldigApBestilling = opts?.tidligereBestillinger?.some((bestilling) =>
Expand All @@ -36,28 +35,6 @@ export const PensjonPanel = ({ stateModifier, formValues }: any) => {
),
)

const getTitleAlderspensjon = () => {
if (harGyldigApBestilling) {
return 'Personen har allerede alderspensjon'
} else if (harGyldigUforetrygdBestilling) {
return 'Personen har allerede uføretrygd'
} else if (harValgtUforetrygd) {
return 'Person kan ikke ha alderspensjon og uføretrygd samtidig'
}
return null
}

const getTitleUforetrygd = () => {
if (harGyldigUforetrygdBestilling) {
return 'Personen har allerede uføretrygd'
} else if (harGyldigApBestilling) {
return 'Personen har allerede alderspensjon'
} else if (harValgtAp) {
return 'Person kan ikke ha uføretrygd og alderspensjon samtidig'
}
return null
}

const infoTekst =
'Pensjon: \nPensjonsgivende inntekt: \nInntektene blir lagt til i POPP-register. \n\n' +
'Tjenestepensjon: \nTjenestepensjonsforhold lagt til i TP. \n\n' +
Expand Down Expand Up @@ -100,18 +77,10 @@ export const PensjonPanel = ({ stateModifier, formValues }: any) => {
<Attributt attr={sm.attrs.tp} />
</AttributtKategori>
<AttributtKategori title="Alderspensjon" attr={sm.attrs}>
<Attributt
attr={sm.attrs.alderspensjon}
disabled={harGyldigApBestilling || harGyldigUforetrygdBestilling || harValgtUforetrygd}
title={getTitleAlderspensjon()}
/>
<Attributt attr={sm.attrs.alderspensjon} />
</AttributtKategori>
<AttributtKategori title="Uføretrygd" attr={sm.attrs}>
<Attributt
attr={sm.attrs.uforetrygd}
disabled={harGyldigUforetrygdBestilling || harGyldigApBestilling || harValgtAp}
title={getTitleUforetrygd()}
/>
<Attributt attr={sm.attrs.uforetrygd} />
</AttributtKategori>
</Panel>
)
Expand Down
2 changes: 1 addition & 1 deletion apps/generer-organisasjon-populasjon-service/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
- application: testnav-orgnummer-service
gcp:
sqlInstances:
- type: POSTGRES_12
- type: POSTGRES_15
tier: db-custom-1-3840
databases:
- name: testnav-generer-organisasjon-populasjon-db
Expand Down
2 changes: 1 addition & 1 deletion apps/inntektsmelding-service/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spec:
- host: testnav-inntektsmelding-generator-service.intern.dev.nav.no
gcp:
sqlInstances:
- type: POSTGRES_12
- type: POSTGRES_15
tier: db-custom-1-3840
databases:
- name: testnav-inntektsmelding-service-db
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion apps/organisasjon-bestilling-service/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ spec:
- host: testnorge-batch-adeo-proxy.dev-fss-pub.nais.io
gcp:
sqlInstances:
- type: POSTGRES_12
- type: POSTGRES_15
tier: db-custom-1-3840
databases:
- name: organisasjon-bestilling-db
Expand Down
2 changes: 1 addition & 1 deletion apps/organisasjon-faste-data-service/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ spec:
cluster: dev-gcp
gcp:
sqlInstances:
- type: POSTGRES_12
- type: POSTGRES_15
tier: db-custom-1-3840
databases:
- name: testnav-organisasjon-faste-data-db
Expand Down
2 changes: 1 addition & 1 deletion apps/organisasjon-forvalter/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ spec:
- application: testnav-tps-messaging-service
gcp:
sqlInstances:
- type: POSTGRES_12
- type: POSTGRES_15
tier: db-custom-1-3840
databases:
- name: organisasjon-forvalter-db
Expand Down
2 changes: 1 addition & 1 deletion apps/orgnummer-service/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ spec:
- "https://testnav-orgnummer-service.intern.dev.nav.no"
gcp:
sqlInstances:
- type: POSTGRES_14
- type: POSTGRES_15
tier: db-custom-1-3840
name: testnav-orgnummer-pool
databases:
Expand Down
2 changes: 1 addition & 1 deletion apps/pdl-forvalter/config.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ spec:
- host: testnav-pdl-proxy.dev-fss-pub.nais.io
gcp:
sqlInstances:
- type: POSTGRES_12
- type: POSTGRES_15
tier: db-custom-1-3840
databases:
- name: testnav-pdl-forvalter-dev-db
2 changes: 1 addition & 1 deletion apps/pdl-forvalter/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ spec:
- host: testnav-pdl-proxy.dev-fss-pub.nais.io
gcp:
sqlInstances:
- type: POSTGRES_12
- type: POSTGRES_15
tier: db-custom-1-3840
databases:
- name: testnav-pdl-forvalter-db
2 changes: 1 addition & 1 deletion apps/person-faste-data-service/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
cluster: dev-fss
gcp:
sqlInstances:
- type: POSTGRES_12
- type: POSTGRES_15
tier: db-custom-1-3840
databases:
- name: testnav-person-faste-data-db
Expand Down
2 changes: 1 addition & 1 deletion apps/testnav-ident-pool/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ spec:
cluster: dev-gcp
gcp:
sqlInstances:
- type: POSTGRES_14
- type: POSTGRES_15
tier: db-custom-1-3840
name: testnav-identpool
databases:
Expand Down
2 changes: 1 addition & 1 deletion apps/udi-stub/src/test/resources/application-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ spring:
token: "test"
enabled: false
datasource:
url: jdbc:tc:postgresql:14.4:///test?TC_REUSABLE=true # 14.4 er versjon p.t. i dev-gcp.
url: jdbc:tc:postgresql:15:///test?TC_REUSABLE=true
username: user
password: pass
jpa:
Expand Down
2 changes: 1 addition & 1 deletion apps/varslinger-service/config.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spec:
tenant: nav.no
gcp:
sqlInstances:
- type: POSTGRES_12
- type: POSTGRES_15
tier: db-custom-1-3840
databases:
- name: testnav-varslinger-db-dev
Expand Down
2 changes: 1 addition & 1 deletion apps/varslinger-service/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
tenant: nav.no
gcp:
sqlInstances:
- type: POSTGRES_12
- type: POSTGRES_15
tier: db-custom-1-3840
databases:
- name: testnav-varslinger-db
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3.9" # optional since v1.27.0
services:
testnav-person-organisasjon-tilgang-service:
container_name: testnav-person-organisasjon-tilgang-service
Expand Down
Loading

0 comments on commit 72966f7

Please sign in to comment.