diff --git a/.github/workflows/build-push-deploy-dev.yml b/.github/workflows/build-push-deploy-dev.yml index 0eb4d2a6..6a12edcc 100644 --- a/.github/workflows/build-push-deploy-dev.yml +++ b/.github/workflows/build-push-deploy-dev.yml @@ -48,5 +48,5 @@ jobs: uses: nais/deploy/actions/deploy@v2 env: CLUSTER: dev-fss - RESOURCE: .nais/application/application-config-dev.yaml + RESOURCE: .nais/application/gcp/application-config-dev.yaml VAR: image=${{ needs.build-and-push.outputs.image }} diff --git a/.github/workflows/deploy-unleash-apitoken.yaml b/.github/workflows/deploy-unleash-apitoken.yaml index e08f2fdd..ce7417e3 100644 --- a/.github/workflows/deploy-unleash-apitoken.yaml +++ b/.github/workflows/deploy-unleash-apitoken.yaml @@ -22,7 +22,7 @@ jobs: uses: nais/deploy/actions/deploy@v2 env: CLUSTER: dev-fss - RESOURCE: .nais/application/unleash-apitoken-dev.yaml + RESOURCE: .nais/application/gcp/unleash-apitoken-dev.yaml PRINT_PAYLOAD: true deploy-prod: @@ -39,5 +39,5 @@ jobs: if: github.ref == 'refs/heads/master' env: CLUSTER: prod-fss - RESOURCE: .nais/application/unleash-apitoken-prod.yaml + RESOURCE: .nais/application/gcp-unleash-apitoken-prod.yaml PRINT_PAYLOAD: true diff --git a/.github/workflows/gcp-codeql.yml b/.github/workflows/gcp-codeql.yml deleted file mode 100644 index 27eee750..00000000 --- a/.github/workflows/gcp-codeql.yml +++ /dev/null @@ -1,89 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [ "dev", "master" ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ "dev" ] - schedule: - - cron: '00 23 * * *' - -jobs: - analyze: - name: Analyze - # Runner size impacts CodeQL analysis time. To learn more, please see: - # - https://gh.io/recommended-hardware-resources-for-running-codeql - # - https://gh.io/supported-runners-and-hardware-resources - # - https://gh.io/using-larger-runners - # Consider using larger runners for possible analysis time improvements. - runs-on: "ubuntu-latest" - timeout-minutes: 360 - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'java-kotlin' ] - # CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ] - # Use only 'java-kotlin' to analyze code written in Java, Kotlin or both - # Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both - # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Setup Java - uses: actions/setup-java@v4 - with: - java-version: 21 - distribution: temurin - cache: maven - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality - - - # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v3 - - # ℹ️ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 - with: - category: "/language:${{matrix.language}}" diff --git a/.github/workflows/gcp-deploy-alerts-to-prod.yaml b/.github/workflows/gcp-deploy-alerts-to-prod.yaml index 32048df1..3072de44 100644 --- a/.github/workflows/gcp-deploy-alerts-to-prod.yaml +++ b/.github/workflows/gcp-deploy-alerts-to-prod.yaml @@ -5,7 +5,7 @@ on: branches: - 'master' paths: - - '.github/workflows/gcp/gcp-deploy-alerts-to-prod.yaml' + - '.github/workflows/gcp-deploy-alerts-to-prod.yaml' - '.nais/alerts/alerts-config-prod.yaml' workflow_dispatch: permissions: diff --git a/.github/workflows/gcp/build-push-deploy-dev.yml b/.github/workflows/gcp/build-push-deploy-dev.yml deleted file mode 100644 index 4b1dc191..00000000 --- a/.github/workflows/gcp/build-push-deploy-dev.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Bygg og deploy til dev-gcp -on: - workflow_dispatch: -env: - PRINT_PAYLOAD: true -permissions: - packages: write - contents: write - id-token: write -jobs: - build-and-push: - name: Build and push - runs-on: ubuntu-latest - outputs: - image: ${{ steps.docker-build-push.outputs.image }} - permissions: - id-token: write - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Java 21 - uses: actions/setup-java@v4 - with: - java-version: 21 - distribution: 'temurin' - cache: 'maven' - - - name: Build maven artifacts - run: mvn -B package -D skipTests - - - name: Build and push Docker image - uses: nais/docker-build-push@v0 - id: docker-build-push - with: - team: obo - identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} - - deploy-dev: - name: Deploy application to dev-gcp - needs: build-and-push - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Deploy application - uses: nais/deploy/actions/deploy@v2 - env: - CLUSTER: dev-gcp - RESOURCE: .nais/application/gcp/application-config-dev.yaml - VAR: image=${{ needs.build-and-push.outputs.image }} diff --git a/.github/workflows/gcp/codeql.yml b/.github/workflows/gcp/codeql.yml deleted file mode 100644 index 27eee750..00000000 --- a/.github/workflows/gcp/codeql.yml +++ /dev/null @@ -1,89 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [ "dev", "master" ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ "dev" ] - schedule: - - cron: '00 23 * * *' - -jobs: - analyze: - name: Analyze - # Runner size impacts CodeQL analysis time. To learn more, please see: - # - https://gh.io/recommended-hardware-resources-for-running-codeql - # - https://gh.io/supported-runners-and-hardware-resources - # - https://gh.io/using-larger-runners - # Consider using larger runners for possible analysis time improvements. - runs-on: "ubuntu-latest" - timeout-minutes: 360 - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'java-kotlin' ] - # CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ] - # Use only 'java-kotlin' to analyze code written in Java, Kotlin or both - # Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both - # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Setup Java - uses: actions/setup-java@v4 - with: - java-version: 21 - distribution: temurin - cache: maven - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality - - - # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v3 - - # ℹ️ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 - with: - category: "/language:${{matrix.language}}" diff --git a/.github/workflows/gcp/deploy-alerts-to-prod.yaml b/.github/workflows/gcp/deploy-alerts-to-prod.yaml deleted file mode 100644 index cbd74c26..00000000 --- a/.github/workflows/gcp/deploy-alerts-to-prod.yaml +++ /dev/null @@ -1,27 +0,0 @@ -name: Deploy alerts for veilarbvedtaksstotte to prod-fss - -on: - push: - branches: - - 'master' - paths: - - '.github/workflows/gcp/deploy-alerts-to-prod.yaml' - - '.nais/alerts/alerts-config-prod.yaml' - workflow_dispatch: -permissions: - packages: write - id-token: write - -jobs: - deploy-alerts: - name: Deploy alerts to prod-gcp - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Deploy to prod-gcp - uses: nais/deploy/actions/deploy@v2 - env: - CLUSTER: prod-gcp - RESOURCE: .nais/alerts/alerts-config-prod.yaml diff --git a/.github/workflows/gcp/deploy-unleash-apitoken.yaml b/.github/workflows/gcp/deploy-unleash-apitoken.yaml deleted file mode 100644 index 383136e2..00000000 --- a/.github/workflows/gcp/deploy-unleash-apitoken.yaml +++ /dev/null @@ -1,44 +0,0 @@ -name: Deploy unleash-apitoken -on: - push: - branches: - - dev - - master - - gcp-migration - paths: - - ".github/workflows/gcp/deploy-unleash-apitoken.yaml" - - ".nais/application/gcp/unleash-apitoken-dev.yaml" - - ".nais/application/gcp/unleash-apitoken-prod.yaml" - -jobs: - deploy-dev: - name: Deploy unleash-apitoken to dev-gcp - permissions: - id-token: write - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Deploy unleash-apitoken - uses: nais/deploy/actions/deploy@v2 - env: - CLUSTER: dev-gcp - RESOURCE: .nais/application/gcp/unleash-apitoken-dev.yaml - PRINT_PAYLOAD: true - - deploy-prod: - name: Deploy unleash-apitoken to prod - permissions: - id-token: write - runs-on: ubuntu-latest - if: github.ref == 'refs/heads/master' - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Deploy unleash-apitoken - uses: nais/deploy/actions/deploy@v2 - if: github.ref == 'refs/heads/master' - env: - CLUSTER: prod-gcp - RESOURCE: .nais/application/gcp/unleash-apitoken-prod.yaml - PRINT_PAYLOAD: true diff --git a/.github/workflows/gcp/main.yml b/.github/workflows/gcp/main.yml deleted file mode 100644 index 829af5de..00000000 --- a/.github/workflows/gcp/main.yml +++ /dev/null @@ -1,103 +0,0 @@ -name: Test, build, push and deploy -on: push -env: - IMAGE_TAG: ${{ github.sha }} - PRINT_PAYLOAD: true -permissions: - packages: write - contents: write - id-token: write -jobs: - test: - name: Run tests - runs-on: ubuntu-latest - if: github.ref != 'refs/heads/dev' && github.ref != 'refs/heads/master' - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Java - uses: actions/setup-java@v4 - with: - java-version: 21 - distribution: 'temurin' - cache: 'maven' - - - name: Run maven tests - run: mvn -B verify - - test-build-and-push: - name: Test, build and push - runs-on: ubuntu-latest - if: github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/gcp-migration' - outputs: - image: ${{ steps.docker-build-push.outputs.image }} - permissions: - id-token: write - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Java - uses: actions/setup-java@v4 - with: - java-version: 21 - distribution: 'temurin' - cache: 'maven' - - - name: Build maven artifacts - run: mvn -B package - - - name: Build and push Docker image - uses: nais/docker-build-push@v0 - id: docker-build-push - with: - team: obo - identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} - - deploy-dev: - name: Deploy application to dev-gcp - if: github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/gcp-migration' - needs: test-build-and-push - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Deploy application - uses: nais/deploy/actions/deploy@v2 - env: - CLUSTER: dev-gcp - RESOURCE: .nais/application/gcp/application-config-dev.yaml - VAR: image=${{ needs.test-build-and-push.outputs.image }} - - - name: Create release - uses: softprops/action-gh-release@v2 - with: - name: Release to dev-gcp - tag_name: release/dev@${{ env.IMAGE_TAG }} - prerelease: true - - deploy-prod: - name: Deploy application to prod-gcp - if: github.ref == 'refs/heads/master-gcp' - needs: test-build-and-push - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Deploy application - uses: nais/deploy/actions/deploy@v2 - env: - CLUSTER: prod-gcp - RESOURCE: .nais/application/gcp/application-config-prod.yaml - VAR: image=${{ needs.test-build-and-push.outputs.image }} - - - name: Create release - uses: softprops/action-gh-release@v2 - with: - name: Release to prod - tag_name: release/prod@${{ env.IMAGE_TAG }} - prerelease: false diff --git a/.nais/application/application-config-dev.yaml b/.nais/application/application-config-dev.yaml index 8d39e010..45357972 100644 --- a/.nais/application/application-config-dev.yaml +++ b/.nais/application/application-config-dev.yaml @@ -32,7 +32,6 @@ spec: cpuThresholdPercentage: 75 resources: limits: - cpu: "2" memory: 1024Mi requests: cpu: 500m diff --git a/.nais/application/application-config-prod.yaml b/.nais/application/application-config-prod.yaml index 6bece774..9ca936de 100644 --- a/.nais/application/application-config-prod.yaml +++ b/.nais/application/application-config-prod.yaml @@ -30,7 +30,6 @@ spec: cpuThresholdPercentage: 75 resources: limits: - cpu: "2" memory: 1024Mi requests: cpu: 500m diff --git a/.nais/application/gcp/application-config-dev.yaml b/.nais/application/gcp/application-config-dev.yaml index a5a4c18f..d5b08e1a 100644 --- a/.nais/application/gcp/application-config-dev.yaml +++ b/.nais/application/gcp/application-config-dev.yaml @@ -27,7 +27,6 @@ spec: cpuThresholdPercentage: 75 resources: limits: - cpu: "2" memory: 1024Mi requests: cpu: 500m @@ -44,16 +43,56 @@ spec: kafka: pool: nav-dev env: + - name: AIA_BACKEND_TOKEN_SCOPE + value: api://dev-gcp.paw.paw-arbeidssoker-besvarelse/.default + - name: AIA_BACKEND_URL + value: https://www.intern.dev.nav.no/aia-backend + - name: ARENA_VEDTAK_TOPIC + value: teamarenanais.aapen-arena-14avedtakiverksatt-v1-q2 + - name: DOKARKIV_TOKEN_SCOPE + value: api://dev-fss.teamdokumenthandtering.dokarkiv/.default + - name: DOKARKIV_URL + value: https://dokarkiv-q2.dev-fss-pub.nais.io + - name: DOKDISTFORDELING_URL # bruker saf-scope + value: https://dokdistfordeling.dev-fss-pub.nais.io - name: ENDRING_PA_OPPFOLGINGS_BRUKER_TOPIC value: pto.endring-paa-oppfolgingsbruker-v2 - - name: ARENA_VEDTAK_TOPIC - value: teamarenanais.aapen-arena-14avedtakiverksatt-v1-q1 - - name: POAO_TILGANG_URL - value: "http://poao-tilgang.poao" + - name: NORG2_URL + value: https://norg2.intern.dev.nav.no/norg2 + - name: PDL_TOKEN_SCOPE + value: api://dev-fss.pdl.pdl-api/.default + - name: PDL_URL + value: https://pdl-api.dev-fss-pub.nais.io - name: POAO_TILGANG_TOKEN_SCOPE - value: "api://dev-gcp.poao.poao-tilgang/.default" - - name: AIA_BACKEND_URL - value: https://www.intern.dev.nav.no/aia-backend + value: api://dev-gcp.poao.poao-tilgang/.default + - name: POAO_TILGANG_URL + value: http://poao-tilgang.poao + - name: PTO_PDFGEN_URL + value: http://pto-pdfgen.obo + - name: REGOPPSLAG_TOKEN_SCOPE + value: api://dev-fss.teamdokumenthandtering.regoppslag/.default + - name: REGOPPSLAG_URL + value: https://regoppslag.dev-fss-pub.nais.io + - name: SAF_TOKEN_SCOPE + value: api://dev-fss.teamdokumenthandtering.saf/.default + - name: SAF_URL + value: https://saf-q2.dev-fss-pub.nais.io + - name: VEILARBARENA_TOKEN_SCOPE + value: api://dev-fss.pto.veilarbarena/.default + - name: VEILARBARENA_URL + value: https://veilarbarena.dev-fss-pub.nais.io/veilarbarena + - name: VEILARBOPPFOLGING_TOKEN_SCOPE + value: api://dev-gcp.poao.veilarboppfolging/.default + - name: VEILARBOPPFOLGING_URL + value: http://veilarboppfolging.poao/veilarboppfolging + - name: VEILARBPERSON_TOKEN_SCOPE + value: api://dev-gcp.obo.veilarbperson/.default + - name: VEILARBPERSON_URL + value: http://veilarbperson.obo/veilarbperson + - name: VEILARBVEILEDER_TOKEN_SCOPE + value: api://dev-gcp.obo.veilarbveileder/.default + - name: VEILARBVEILEDER_URL + value: http://veilarbveileder.obo/veilarbveileder azure: application: allowAllUsers: true @@ -83,8 +122,6 @@ spec: - application: pto-admin namespace: pto cluster: dev-fss - - application: aia-backend - namespace: paw - application: azure-token-generator namespace: aura - application: amt-person-service @@ -92,10 +129,24 @@ spec: permissions: roles: - "siste-14a-vedtak" - - application: pto-pdfgen - namespace: obo outbound: + rules: + - application: paw-arbeidssoker-besvarelse + namespace: paw + - application: poao-tilgang + namespace: poao + - application: pto-pdfgen + - application: veilarboppfolging + namespace: poao + - application: veilarbperson + - application: veilarbveileder external: + - host: dokarkiv-q2.dev-fss-pub.nais.io + - host: pdl-api.dev-fss-pub.nais.io + - host: regoppslag.dev-fss-pub.nais.io + - host: saf-q2.dev-fss-pub.nais.io - host: team-obo-unleash-api.nav.cloud.nais.io + - host: veilarbarena.dev-fss-pub.nais.io + - host: www.intern.dev.nav.no envFrom: - secret: veilarbvedtaksstotte-unleash-api-token diff --git a/.nais/application/gcp/application-config-prod.yaml b/.nais/application/gcp/application-config-prod.yaml index 6f95547e..b7d04739 100644 --- a/.nais/application/gcp/application-config-prod.yaml +++ b/.nais/application/gcp/application-config-prod.yaml @@ -27,7 +27,6 @@ spec: cpuThresholdPercentage: 75 resources: limits: - cpu: "2" memory: 1024Mi requests: cpu: 500m @@ -54,6 +53,20 @@ spec: value: "api://prod-gcp.poao.poao-tilgang/.default" - name: AIA_BACKEND_URL value: https://www.nav.no/aia-backend + - name: NORG2_URL + value: https://norg2.intern.nav.no + - name: VEILARBOPPFOLGING_URL + value: "https://veilarboppfolging.prod-fss-pub.nais.io/veilarboppfolging" + - name: VEILARBOPPFOLGING_TOKEN_SCOPE + value: "api://prod-fss.pto.veilarboppfolging/.default" + - name: SAF_URL + value: "https://saf.intern.nav.no" + - name: SAF_TOKEN_SCOPE + value: "api://prod-fss.teamdokumenthandtering.saf/.default" + - name: VEILARBVEILEDER_URL + value: "https://veilarbveileder.prod-fss-pub.nais.io/veilarbveileder" + - name: VEILARBVEILEDER_TOKEN_SCOPE + value: "api://prod-fss.pto.veilarbveileder/.default" azure: application: allowAllUsers: true @@ -99,7 +112,12 @@ spec: - application: pto-pdfgen namespace: obo external: - - host: team-obo-unleash-web.nav.cloud.nais.io + - host: team-obo-unleash-api.nav.cloud.nais.io - host: www.nav.no + - host: pdl-api.prod-fss-pub.nais.io + - host: veilarboppfolging.prod-fss-pub.nais.io + - host: veilarbveileder.prod-fss-pub.nais.io + - host: veilarbarena.prod-fss-pub.nais.io + - host: saf.prod-fss-pub.nais.io envFrom: - secret: veilarbvedtaksstotte-unleash-api-token diff --git a/README.md b/README.md index 068e278d..5c122130 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Veilarbvedtaksstotte -Backend-tjeneste for fatting av 14a vedtak. +Backend-tjeneste for fatting av 14a vedtak. Funksjonalitet: @@ -13,17 +13,10 @@ Funksjonalitet: Swagger: /veilarbvedtaksstotte/internal/swagger-ui/index.html -## DB Creds +Dev-miljøet har ikke lenger noen tilknytning til q1, kun q2. -Dev: -```console -vault read postgresql/preprod-fss/creds/veilarbvedtaksstotte-fss15-q1-admin -``` +## DB Creds -Prod: -```console -vault read postgresql/prod-fss/creds/veilarbvedtaksstotte-fss13-p-readonly -``` ## Kjøre appen diff --git a/pom.xml b/pom.xml index e7e6c972..e6c69b73 100644 --- a/pom.xml +++ b/pom.xml @@ -19,10 +19,10 @@ 21 - 3.2024.04.22_13.50-7815154a2573 + 3.2024.09.16_11.09-578823a87a2f 1.9.22 - 1.20.0 - 9.2.4 + 1.20.1 + 9.2.0 navikt_veilarbvedtaksstotte @@ -31,7 +31,7 @@ - + central https://repo.maven.apache.org/maven2 @@ -158,87 +158,77 @@ org.flywaydb flyway-core - 10.15.2 + 10.17.1 compile org.flywaydb flyway-database-postgresql + + org.postgresql + postgresql + 42.7.4 + net.javacrumbs.shedlock shedlock-provider-jdbc-template - 5.12.0 - - - no.nav - vault-jdbc - 1.3.10 - - - org.slf4j - slf4j-simple - - - org.slf4j - slf4j-api - - + 5.14.0 - com.github.navikt.common-java-modules + no.nav.common job ${common.version} - com.github.navikt.common-java-modules + no.nav.common util ${common.version} - com.github.navikt.common-java-modules + no.nav.common types ${common.version} - com.github.navikt.common-java-modules + no.nav.common client ${common.version} - com.github.navikt.common-java-modules + no.nav.common token-client ${common.version} - com.github.navikt.common-java-modules + no.nav.common auth ${common.version} - com.github.navikt.common-java-modules + no.nav.common log ${common.version} - com.github.navikt.common-java-modules + no.nav.common health ${common.version} - com.github.navikt.common-java-modules + no.nav.common metrics ${common.version} - com.github.navikt.common-java-modules + no.nav.common kafka ${common.version} - com.github.navikt.common-java-modules + no.nav.common json ${common.version} @@ -272,7 +262,7 @@ - com.github.navikt.common-java-modules + no.nav.common test ${common.version} test diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/client/DownstreamAPIs.kt b/src/main/java/no/nav/veilarbvedtaksstotte/client/DownstreamAPIs.kt deleted file mode 100644 index c44d8b06..00000000 --- a/src/main/java/no/nav/veilarbvedtaksstotte/client/DownstreamAPIs.kt +++ /dev/null @@ -1,24 +0,0 @@ -package no.nav.veilarbvedtaksstotte.client - -import no.nav.veilarbvedtaksstotte.utils.DownstreamApi - -object DownstreamAPIs { - @JvmStatic - val veilarbveileder: (String) -> DownstreamApi = { DownstreamApi(it, "obo", "veilarbveileder") } - @JvmStatic - val veilarbperson: (String) -> DownstreamApi = { DownstreamApi(it, if(it == "dev-fss") "pto" else "obo", "veilarbperson") } - @JvmStatic - val veilarbarena: (String) -> DownstreamApi = { DownstreamApi(it, "pto", "veilarbarena") } - @JvmStatic - val veilarboppfolging: (String) -> DownstreamApi = { DownstreamApi(it, if(it == "dev-fss") "pto" else "poao", "veilarboppfolging") } - @JvmStatic - val dokarkiv: (String) -> DownstreamApi = { DownstreamApi(it, "teamdokumenthandtering", if(it == "dev-fss") "dokarkiv-q1" else "dokarkiv") } - @JvmStatic - val saf: (String) -> DownstreamApi = { DownstreamApi(it, "teamdokumenthandtering", if(it == "dev-fss") "saf-q1" else "saf") } - @JvmStatic - val regoppslag: (String) -> DownstreamApi = { DownstreamApi(it, "teamdokumenthandtering", if(it == "dev-fss") "regoppslag-q1" else "regoppslag") } - @JvmStatic - val pdl: (String) -> DownstreamApi = { DownstreamApi(it, "pdl", "pdl-api") } - @JvmStatic - val aiaBackend: (String) -> DownstreamApi = { DownstreamApi(it, "paw","paw-arbeidssoker-besvarelse") } -} diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/config/ApplicationConfig.kt b/src/main/java/no/nav/veilarbvedtaksstotte/config/ApplicationConfig.kt index 8cead3af..1206ff75 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/config/ApplicationConfig.kt +++ b/src/main/java/no/nav/veilarbvedtaksstotte/config/ApplicationConfig.kt @@ -7,13 +7,12 @@ import lombok.extern.slf4j.Slf4j import no.nav.common.auth.context.AuthContextHolder import no.nav.common.auth.context.AuthContextHolderThreadLocal import no.nav.common.kafka.util.KafkaEnvironmentVariables -import no.nav.common.kafka.util.KafkaPropertiesPreset.* +import no.nav.common.kafka.util.KafkaPropertiesPreset.aivenByteProducerProperties +import no.nav.common.kafka.util.KafkaPropertiesPreset.aivenDefaultConsumerProperties import no.nav.common.token_client.builder.AzureAdTokenClientBuilder import no.nav.common.token_client.client.AzureAdMachineToMachineTokenClient import no.nav.common.token_client.client.AzureAdOnBehalfOfTokenClient -import no.nav.common.utils.Credentials import no.nav.common.utils.EnvironmentUtils.getRequiredProperty -import no.nav.common.utils.NaisUtils import no.nav.veilarbvedtaksstotte.utils.JsonUtils.init import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.context.annotation.Bean @@ -26,11 +25,6 @@ import org.springframework.scheduling.annotation.EnableScheduling @EnableConfigurationProperties(EnvironmentProperties::class) class ApplicationConfig { - @Bean - fun serviceUserCredentials(): Credentials { - return NaisUtils.getCredentials("service_user") - } - @Bean fun azureAdMachineToMachineTokenClient(): AzureAdMachineToMachineTokenClient { return AzureAdTokenClientBuilder.builder() @@ -53,15 +47,8 @@ class ApplicationConfig { @Bean fun kafkaConfigEnvContext( kafkaProperties: KafkaProperties, - credentials: Credentials ): KafkaEnvironmentContext { return KafkaEnvironmentContext( - onPremConsumerClientProperties = onPremDefaultConsumerProperties( - KafkaConsumerConfig.CONSUMER_GROUP_ID, kafkaProperties.brokersUrl, credentials - ), - onPremProducerClientProperties = onPremByteProducerProperties( - KafkaProducerConfig.PRODUCER_CLIENT_ID, kafkaProperties.brokersUrl, credentials - ), aivenConsumerClientProperties = aivenDefaultConsumerProperties(KafkaConsumerConfig.CONSUMER_GROUP_ID), aivenProducerClientProperties = aivenByteProducerProperties(KafkaProducerConfig.PRODUCER_CLIENT_ID) ) diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/config/ClientConfig.kt b/src/main/java/no/nav/veilarbvedtaksstotte/config/ClientConfig.kt index 31ce1ab1..ed41d1f2 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/config/ClientConfig.kt +++ b/src/main/java/no/nav/veilarbvedtaksstotte/config/ClientConfig.kt @@ -12,20 +12,12 @@ import no.nav.common.job.leader_election.LeaderElectionHttpClient import no.nav.common.metrics.InfluxClient import no.nav.common.metrics.MetricsClient import no.nav.common.token_client.client.AzureAdMachineToMachineTokenClient +import no.nav.common.token_client.client.AzureAdOnBehalfOfTokenClient +import no.nav.common.utils.AuthUtils import no.nav.common.utils.EnvironmentUtils -import no.nav.common.utils.UrlUtils -import no.nav.common.utils.UrlUtils.joinPaths import no.nav.poao_tilgang.client.PoaoTilgangCachedClient import no.nav.poao_tilgang.client.PoaoTilgangClient import no.nav.poao_tilgang.client.PoaoTilgangHttpClient -import no.nav.veilarbvedtaksstotte.client.DownstreamAPIs.aiaBackend -import no.nav.veilarbvedtaksstotte.client.DownstreamAPIs.dokarkiv -import no.nav.veilarbvedtaksstotte.client.DownstreamAPIs.pdl -import no.nav.veilarbvedtaksstotte.client.DownstreamAPIs.regoppslag -import no.nav.veilarbvedtaksstotte.client.DownstreamAPIs.saf -import no.nav.veilarbvedtaksstotte.client.DownstreamAPIs.veilarbarena -import no.nav.veilarbvedtaksstotte.client.DownstreamAPIs.veilarbperson -import no.nav.veilarbvedtaksstotte.client.DownstreamAPIs.veilarbveileder import no.nav.veilarbvedtaksstotte.client.aiaBackend.AiaBackendClient import no.nav.veilarbvedtaksstotte.client.aiaBackend.AiaBackendClientImpl import no.nav.veilarbvedtaksstotte.client.arbeidssoekeregisteret.OppslagArbeidssoekerregisteretClientImpl @@ -52,8 +44,6 @@ import no.nav.veilarbvedtaksstotte.client.veilarboppfolging.VeilarboppfolgingCli import no.nav.veilarbvedtaksstotte.client.veilarboppfolging.VeilarboppfolgingClientImpl import no.nav.veilarbvedtaksstotte.client.veilederogenhet.VeilarbveilederClient import no.nav.veilarbvedtaksstotte.client.veilederogenhet.VeilarbveilederClientImpl -import no.nav.veilarbvedtaksstotte.service.OboContexService -import no.nav.veilarbvedtaksstotte.utils.DownstreamApi import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration @@ -61,161 +51,156 @@ import org.springframework.context.annotation.Configuration class ClientConfig { @Bean - fun arenaClient(tokenClient: AzureAdMachineToMachineTokenClient): VeilarbarenaClient { - val veilarbarena = veilarbarena.invoke(if (isProduction) "prod-fss" else "dev-fss") - - val url = - if (isProduction) UrlUtils.createProdInternalIngressUrl(veilarbarena.serviceName) else UrlUtils.createDevInternalIngressUrl( - veilarbarena.serviceName - ) - + fun arenaClient( + properties: EnvironmentProperties, machineTokenClient: AzureAdMachineToMachineTokenClient + ): VeilarbarenaClient { return VeilarbarenaClientImpl( - joinPaths(url, "veilarbarena") - ){ tokenClient.createMachineToMachineToken(tokenScope(veilarbarena)) } + properties.veilarbarenaUrl, + ) { machineTokenClient.createMachineToMachineToken(properties.veilarbarenaScope) } } @Bean - fun pdfClient(): PdfClient { - val appName = "pto-pdfgen"; - val url: String; - if (isProduction){ - url = String.format("https://%s.intern.nav.no", appName) - }else{ - url = String.format("https://%s.intern.dev.nav.no", appName) - } - return PdfClientImpl(url) + fun pdfClient(properties: EnvironmentProperties): PdfClient { + return PdfClientImpl(properties.ptoPdfgenUrl) } @Bean - fun egenvurderingClient(oboContexService: OboContexService, properties: EnvironmentProperties): AiaBackendClient { - val clientCluster = if (isProduction) "prod-gcp" else "dev-gcp" - val userTokenSupplier = oboContexService.userTokenSupplier( - aiaBackend.invoke(clientCluster) - ) - return AiaBackendClientImpl( - properties.aiaBackendUrl, - userTokenSupplier - ) + fun egenvurderingClient( + properties: EnvironmentProperties, + aadOboTokenClient: AzureAdOnBehalfOfTokenClient, + authContextHolder: AuthContextHolder + ): AiaBackendClient { + return AiaBackendClientImpl(properties.aiaBackendUrl) { + AuthUtils.bearerToken( + aadOboTokenClient.exchangeOnBehalfOfToken( + properties.aiaBackendScope, authContextHolder.requireIdTokenString() + ) + ) + } } @Bean - fun oppfolgingClient(tokenClient: AzureAdMachineToMachineTokenClient): VeilarboppfolgingClient { - val veilarboppfolging = veilarboppfolging.invoke(if (isProduction) "prod-gcp" else "dev-fss") - val url = "https://veilarboppfolging-gcp.intern.nav.no/veilarboppfolging" - //fun oppfolgingClient(tokenClient: AzureAdMachineToMachineTokenClient, properties: EnvironmentProperties): VeilarboppfolgingClient { - // val veilarboppfolgingUrl = properties.veilarboppfolgingUrl - // val veilarboppfolgingScope = properties.veilarboppfolgingScope + fun oppfolgingClient( + properties: EnvironmentProperties, machineTokenClient: AzureAdMachineToMachineTokenClient + ): VeilarboppfolgingClient { return VeilarboppfolgingClientImpl( - veilarboppfolgingUrl - ) { tokenClient.createMachineToMachineToken(veilarboppfolgingScope) } + properties.veilarboppfolgingUrl, + ) { machineTokenClient.createMachineToMachineToken(properties.veilarboppfolgingScope) } } @Bean - fun personClient(oboContexService: OboContexService, tokenClient: AzureAdMachineToMachineTokenClient): VeilarbpersonClient { - val veilarbperson = veilarbperson.invoke(if (isProduction) "prod-gcp" else "dev-fss") - val userTokenSupplier = oboContexService.userTokenSupplier(veilarbperson) - val url = - if (isProduction) "https://veilarbperson-gcp.intern.nav.no" else UrlUtils.createDevInternalIngressUrl( - veilarbperson.serviceName - ) - - return VeilarbpersonClientImpl(joinPaths(url, "veilarbperson"), userTokenSupplier){ tokenClient.createMachineToMachineToken(tokenScope(veilarbperson)) } - } - - @Bean - fun registreringClient(oboContexService: OboContexService): VeilarbregistreringClient { - val veilarbperson = veilarbperson.invoke(if (isProduction) "prod-gcp" else "dev-fss") - val userTokenSupplier = oboContexService.userTokenSupplier(veilarbperson) - val url = - if (isProduction) "https://veilarbperson-gcp.intern.nav.no" else UrlUtils.createDevInternalIngressUrl( - veilarbperson.serviceName + fun personClient( + properties: EnvironmentProperties, + aadOboTokenClient: AzureAdOnBehalfOfTokenClient, + authContextHolder: AuthContextHolder, + machineTokenClient: AzureAdMachineToMachineTokenClient + ): VeilarbpersonClient { + return VeilarbpersonClientImpl( + properties.veilarbpersonUrl, + { + AuthUtils.bearerToken( + aadOboTokenClient.exchangeOnBehalfOfToken( + properties.veilarbpersonScope, + authContextHolder.requireIdTokenString() + ) + ) + } + ) { machineTokenClient.createMachineToMachineToken(properties.veilarbpersonScope) } + } + + @Bean + fun registreringClient( + properties: EnvironmentProperties, + aadOboTokenClient: AzureAdOnBehalfOfTokenClient, + authContextHolder: AuthContextHolder + ): VeilarbregistreringClient { + return VeilarbregistreringClientImpl(properties.veilarbpersonUrl) + { + AuthUtils.bearerToken( + aadOboTokenClient.exchangeOnBehalfOfToken( + properties.veilarbpersonScope, + authContextHolder.requireIdTokenString() + ) ) - return VeilarbregistreringClientImpl(joinPaths(url, "veilarbperson"), userTokenSupplier) + } } @Bean - fun safClient(tokenClient: AzureAdMachineToMachineTokenClient): SafClient { - val safClient = saf.invoke(if (isProduction) "prod-fss" else "dev-fss") - val serviceNameForIngress = "saf" - return SafClientImpl( - naisPreprodOrNaisAdeoIngress(serviceNameForIngress, false) - ){ tokenClient.createMachineToMachineToken(tokenScope(safClient)) } + fun safClient( + properties: EnvironmentProperties, machineTokenClient: AzureAdMachineToMachineTokenClient + ): SafClient { + return SafClientImpl(properties.safUrl) { machineTokenClient.createMachineToMachineToken(properties.safScope) } } @Bean fun veilederOgEnhetClient( - authContextHolder: AuthContextHolder?, - oboContexService: OboContexService, - tokenClient: AzureAdMachineToMachineTokenClient + properties: EnvironmentProperties, + authContextHolder: AuthContextHolder, + aadOboTokenClient: AzureAdOnBehalfOfTokenClient, + machineTokenClient: AzureAdMachineToMachineTokenClient ): VeilarbveilederClient { - val veilarbveileder = veilarbveileder.invoke(if (isProduction) "prod-gcp" else "dev-gcp") - val userTokenSupplier = oboContexService.userTokenSupplier(veilarbveileder) return VeilarbveilederClientImpl( - "https://veilarbveileder-gcp.intern.nav.no/veilarbveileder", + properties.veilarbveilederUrl, authContextHolder, - userTokenSupplier, - { tokenClient.createMachineToMachineToken(tokenScope(veilarbveileder)) } - ) + { + AuthUtils.bearerToken( + aadOboTokenClient.exchangeOnBehalfOfToken( + properties.veilarbveilederScope, + authContextHolder.requireIdTokenString() + ) + ) + } + ) { machineTokenClient.createMachineToMachineToken(properties.veilarbveilederScope) } } @Bean - fun dokarkivClient(tokenClient: AzureAdMachineToMachineTokenClient): DokarkivClient { - val dokarkivClient = dokarkiv.invoke(if (isProduction) "prod-fss" else "dev-fss") - - val url = - if (isProduction) UrlUtils.createProdInternalIngressUrl(dokarkivClient.serviceName) else UrlUtils.createDevInternalIngressUrl( - dokarkivClient.serviceName - ) + fun dokarkivClient( + properties: EnvironmentProperties, machineTokenClient: AzureAdMachineToMachineTokenClient + ): DokarkivClient { return DokarkivClientImpl( - url - ){ tokenClient.createMachineToMachineToken(tokenScope(dokarkivClient)) } + properties.dokarkivUrl, + ) { machineTokenClient.createMachineToMachineToken(properties.dokarkivScope) } } @Bean - fun regoppslagClient(tokenClient: AzureAdMachineToMachineTokenClient): RegoppslagClient { - val regoppslag = regoppslag.invoke(if (isProduction) "prod-fss" else "dev-fss") - val url = - if (isProduction) UrlUtils.createProdInternalIngressUrl(regoppslag.serviceName) else UrlUtils.createDevInternalIngressUrl( - regoppslag.serviceName + fun regoppslagClient( + properties: EnvironmentProperties, machineTokenClient: AzureAdMachineToMachineTokenClient + ): RegoppslagClient { + return RegoppslagClientImpl(properties.regoppslagUrl) { + machineTokenClient.createMachineToMachineToken( + properties.regoppslagScope ) - return RegoppslagClientImpl(url) { tokenClient.createMachineToMachineToken(tokenScope(regoppslag)) } + } } @Bean - fun oppslagArbeidssoekerregisteretClient(tokenClient: AzureAdMachineToMachineTokenClient): OppslagArbeidssoekerregisteretClientImpl { - val veilarbperson = veilarbperson.invoke(if (isProduction) "prod-gcp" else "dev-fss") - val url = - if (isProduction) "https://veilarbperson-gcp.intern.nav.no" else UrlUtils.createDevInternalIngressUrl( - veilarbperson.serviceName - ) - return OppslagArbeidssoekerregisteretClientImpl(joinPaths(url, "veilarbperson")){ tokenClient.createMachineToMachineToken(tokenScope(veilarbperson)) } + fun oppslagArbeidssoekerregisteretClient( + properties: EnvironmentProperties, machineTokenClient: AzureAdMachineToMachineTokenClient + ): OppslagArbeidssoekerregisteretClientImpl { + return OppslagArbeidssoekerregisteretClientImpl( + properties.veilarbpersonUrl + ) { machineTokenClient.createMachineToMachineToken(properties.veilarbpersonScope) } } @Bean - fun dokDistribusjonClient(tokenClient: AzureAdMachineToMachineTokenClient): DokdistribusjonClient { - val appName = if (isProduction) "dokdistfordeling" else "dokdistfordeling-q1" - val url = - if (isProduction) UrlUtils.createProdInternalIngressUrl(appName) else UrlUtils.createDevInternalIngressUrl( - appName - ) - + fun dokDistribusjonClient( + properties: EnvironmentProperties, machineTokenClient: AzureAdMachineToMachineTokenClient + ): DokdistribusjonClient { // dokdistfordeling bruker saf token scope - val safTokenScope = - if (isProduction) "api://prod-fss.teamdokumenthandtering.saf/.default" else "api://dev-fss.teamdokumenthandtering.saf-q1/.default" - return DokdistribusjonClientImpl(url) { tokenClient.createMachineToMachineToken(safTokenScope) } + return DokdistribusjonClientImpl(properties.dokdistfordelingUrl) { + machineTokenClient.createMachineToMachineToken( + properties.safScope + ) + } } @Bean - fun aktorOppslagClient(tokenClient: AzureAdMachineToMachineTokenClient): AktorOppslagClient { - - val pdl = pdl.invoke(if (isProduction) "prod-fss" else "dev-fss") - val pdlUrl = - if (isProduction) UrlUtils.createProdInternalIngressUrl(pdl.serviceName) else UrlUtils.createDevInternalIngressUrl( - pdl.serviceName - ) + fun aktorOppslagClient( + properties: EnvironmentProperties, tokenClient: AzureAdMachineToMachineTokenClient + ): AktorOppslagClient { val pdlClient = PdlClientImpl( - pdlUrl, - { tokenClient.createMachineToMachineToken(tokenScope(pdl)) }, + properties.pdlUrl, + { tokenClient.createMachineToMachineToken(properties.pdlScope) }, BehandlingsNummer.VEDTAKSTOTTE.value ) return CachedAktorOppslagClient(PdlAktorOppslagClient(pdlClient)) @@ -223,13 +208,9 @@ class ClientConfig { @Bean fun unleashClient(properties: EnvironmentProperties): DefaultUnleash = DefaultUnleash( - UnleashConfig.builder() - .appName(ApplicationConfig.APPLICATION_NAME) - .instanceId(ApplicationConfig.APPLICATION_NAME) - .unleashAPI(properties.unleashUrl) - .apiKey(properties.unleashApiToken) - .environment(if (isProduction) "production" else "development") - .build() + UnleashConfig.builder().appName(ApplicationConfig.APPLICATION_NAME) + .instanceId(ApplicationConfig.APPLICATION_NAME).unleashAPI(properties.unleashUrl) + .apiKey(properties.unleashApiToken).environment(if (isProduction) "production" else "development").build() ) @Bean @@ -249,12 +230,10 @@ class ClientConfig { @Bean fun poaoTilgangClient( - properties: EnvironmentProperties, - tokenClient: AzureAdMachineToMachineTokenClient + properties: EnvironmentProperties, tokenClient: AzureAdMachineToMachineTokenClient ): PoaoTilgangClient { return PoaoTilgangCachedClient( - PoaoTilgangHttpClient( - properties.poaoTilgangUrl, + PoaoTilgangHttpClient(properties.poaoTilgangUrl, { tokenClient.createMachineToMachineToken(properties.poaoTilgangScope) }) ) } @@ -262,21 +241,5 @@ class ClientConfig { companion object { private val isProduction: Boolean get() = EnvironmentUtils.isProduction().orElseThrow() - - private fun naisPreprodOrNaisAdeoIngress(appName: String, withAppContextPath: Boolean): String { - return if (isProduction) UrlUtils.createNaisAdeoIngressUrl( - appName, - withAppContextPath - ) else UrlUtils.createNaisPreprodIngressUrl(appName, "q1", withAppContextPath) - } - - private fun tokenScope(downstreamApi: DownstreamApi): String { - return String.format( - "api://%s.%s.%s/.default", - downstreamApi.cluster, - downstreamApi.namespace, - downstreamApi.serviceName - ) - } } } diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/config/DatabaseConfig.java b/src/main/java/no/nav/veilarbvedtaksstotte/config/DatabaseConfig.java index 3e59799f..c75ebb8c 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/config/DatabaseConfig.java +++ b/src/main/java/no/nav/veilarbvedtaksstotte/config/DatabaseConfig.java @@ -1,37 +1,68 @@ package no.nav.veilarbvedtaksstotte.config; +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; +import jakarta.annotation.PostConstruct; +import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; -import no.nav.veilarbvedtaksstotte.utils.DbRole; -import no.nav.veilarbvedtaksstotte.utils.DbUtils; -import org.springframework.beans.factory.annotation.Autowired; +import org.flywaydb.core.Flyway; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.annotation.EnableTransactionManagement; -import jakarta.annotation.PostConstruct; import javax.sql.DataSource; -import static no.nav.veilarbvedtaksstotte.utils.DbUtils.createDataSource; - @Slf4j @Configuration +@EnableTransactionManagement +@RequiredArgsConstructor public class DatabaseConfig { private final EnvironmentProperties environmentProperties; - @Autowired - public DatabaseConfig(EnvironmentProperties environmentProperties) { - this.environmentProperties = environmentProperties; + @Bean + public DataSource dataSource() { + return createDataSource(environmentProperties.getDbUrl()); } - @Bean - public DataSource dataSource(EnvironmentProperties properties) { - return createDataSource(properties.getDbUrl(), DbRole.USER); + public static DataSource createDataSource(String dbUrl) { + try { + HikariConfig config = createDataSourceConfig(dbUrl, 15); + return new HikariDataSource(config); + } catch (Exception e) { + log.info("Can't connect to db, error: " + e, e); + return null; + } } + public static HikariConfig createDataSourceConfig(String dbUrl, int maximumPoolSize) { + HikariConfig config = new HikariConfig(); + config.setJdbcUrl(dbUrl); + config.setMaximumPoolSize(maximumPoolSize); + config.setConnectionTimeout(600000); // 10min + config.setMinimumIdle(1); + return config; + } + + @PostConstruct - public void migrateDb() { - log.info("Starting database migration..."); - DbUtils.migrateAndClose(DbUtils.createDataSource(environmentProperties.getDbUrl(), DbRole.ADMIN), DbRole.ADMIN); + @SneakyThrows + public void migrate() { + DataSource dataSource = createDataSource(environmentProperties.getDbUrl()); + + if (dataSource != null) { + log.info("Starting database migration..."); + Flyway.configure() + .validateMigrationNaming(true) + .dataSource(dataSource) + .locations("db/migration") + .baselineOnMigrate(true) + .load() + .migrate(); + + dataSource.getConnection().close(); + } } } diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/config/EnvironmentProperties.kt b/src/main/java/no/nav/veilarbvedtaksstotte/config/EnvironmentProperties.kt index e36a347a..f105da52 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/config/EnvironmentProperties.kt +++ b/src/main/java/no/nav/veilarbvedtaksstotte/config/EnvironmentProperties.kt @@ -4,22 +4,36 @@ import org.springframework.boot.context.properties.ConfigurationProperties @ConfigurationProperties(prefix = "app.env") data class EnvironmentProperties ( - val openAmDiscoveryUrl: String, - val veilarbloginOpenAmClientId: String, - val stsDiscoveryUrl: String, - val openAmRefreshUrl: String, + val aiaBackendScope: String, + val aiaBackendUrl: String, val dbUrl: String, - val unleashUrl: String, - val unleashApiToken: String, - val norg2Url: String, - val naisAadDiscoveryUrl: String, + val dokarkivScope: String, + val dokarkivUrl: String, + val dokdistfordelingUrl: String, val naisAadClientId: String, + val naisAadDiscoveryUrl: String, val naisAadIssuer: String, - val poaoTilgangUrl: String, + val norg2Url: String, + val pdlScope: String, + val pdlUrl: String, val poaoTilgangScope: String, - val veilarboppfolgingUrl: String, - val veilarboppfolgingScope: String, - val aiaBackendUrl: String, + val poaoTilgangUrl: String, + val ptoPdfgenUrl: String, + val regoppslagScope: String, + val regoppslagUrl: String, + val safScope: String, + val safUrl: String, + val tokenxClientId: String, val tokenxDiscoveryUrl: String, - val tokenxClientId: String + val unleashApiToken: String, + val unleashUrl: String, + val veilarbarenaScope: String, + val veilarbarenaUrl: String, + val veilarboppfolgingScope: String, + val veilarboppfolgingUrl: String, + val veilarbpersonScope: String, + val veilarbpersonUrl: String, + val veilarbveilederScope: String, + val veilarbveilederUrl: String + ) diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/config/HealthConfig.java b/src/main/java/no/nav/veilarbvedtaksstotte/config/HealthConfig.java index ffe7ff78..bbb2df46 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/config/HealthConfig.java +++ b/src/main/java/no/nav/veilarbvedtaksstotte/config/HealthConfig.java @@ -4,11 +4,11 @@ import no.nav.common.health.selftest.SelfTestCheck; import no.nav.common.health.selftest.SelfTestChecks; import no.nav.common.health.selftest.SelfTestMeterBinder; +import no.nav.veilarbvedtaksstotte.client.aiaBackend.AiaBackendClient; import no.nav.veilarbvedtaksstotte.client.arena.VeilarbarenaClient; import no.nav.veilarbvedtaksstotte.client.dokarkiv.DokarkivClient; import no.nav.veilarbvedtaksstotte.client.dokarkiv.SafClient; import no.nav.veilarbvedtaksstotte.client.dokdistfordeling.DokdistribusjonClient; -import no.nav.veilarbvedtaksstotte.client.aiaBackend.AiaBackendClient; import no.nav.veilarbvedtaksstotte.client.norg2.Norg2Client; import no.nav.veilarbvedtaksstotte.client.pdf.PdfClient; import no.nav.veilarbvedtaksstotte.client.person.VeilarbpersonClient; diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/config/KafkaConsumerConfig.kt b/src/main/java/no/nav/veilarbvedtaksstotte/config/KafkaConsumerConfig.kt index f7c91a00..ed463b5e 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/config/KafkaConsumerConfig.kt +++ b/src/main/java/no/nav/veilarbvedtaksstotte/config/KafkaConsumerConfig.kt @@ -11,12 +11,14 @@ import no.nav.common.kafka.consumer.util.ConsumerUtils import no.nav.common.kafka.consumer.util.KafkaConsumerClientBuilder import no.nav.common.kafka.consumer.util.deserializer.Deserializers import no.nav.common.kafka.spring.PostgresJdbcTemplateConsumerRepository -import no.nav.veilarbvedtaksstotte.domain.kafka.* +import no.nav.veilarbvedtaksstotte.domain.kafka.ArenaVedtakRecord +import no.nav.veilarbvedtaksstotte.domain.kafka.KafkaOppfolgingsbrukerEndringV2 +import no.nav.veilarbvedtaksstotte.domain.kafka.KafkaSisteOppfolgingsperiode +import no.nav.veilarbvedtaksstotte.domain.kafka.KafkaVedtakStatusEndring import no.nav.veilarbvedtaksstotte.service.KafkaConsumerService import no.nav.veilarbvedtaksstotte.service.KafkaVedtakStatusEndringConsumer -import no.nav.veilarbvedtaksstotte.utils.KAFKA_KONSUMERING_SKRUDD_AV +import no.nav.veilarbvedtaksstotte.utils.KAFKA_KONSUMERING_GCP_SKRUDD_AV import org.apache.kafka.clients.consumer.ConsumerRecord -import org.slf4j.LoggerFactory import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration @@ -60,7 +62,7 @@ class KafkaConsumerConfig { val aivenConsumerClient = KafkaConsumerClientBuilder.builder() .withProperties(environmentContext.aivenConsumerClientProperties) .withTopicConfigs(consumerAivenConfig.configs) - .withToggle { unleashService.isEnabled(KAFKA_KONSUMERING_SKRUDD_AV) } + .withToggle { unleashService.isEnabled(KAFKA_KONSUMERING_GCP_SKRUDD_AV) } .build() aivenConsumerClient.start() diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/config/KafkaEnvironmentContext.kt b/src/main/java/no/nav/veilarbvedtaksstotte/config/KafkaEnvironmentContext.kt index 757a084d..f8998215 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/config/KafkaEnvironmentContext.kt +++ b/src/main/java/no/nav/veilarbvedtaksstotte/config/KafkaEnvironmentContext.kt @@ -1,10 +1,8 @@ package no.nav.veilarbvedtaksstotte.config -import java.util.Properties +import java.util.* class KafkaEnvironmentContext( - val onPremConsumerClientProperties: Properties, - val onPremProducerClientProperties: Properties, val aivenConsumerClientProperties: Properties, val aivenProducerClientProperties: Properties ) diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/controller/AdminController.java b/src/main/java/no/nav/veilarbvedtaksstotte/controller/AdminController.java index 41ff0e67..c2204d5d 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/controller/AdminController.java +++ b/src/main/java/no/nav/veilarbvedtaksstotte/controller/AdminController.java @@ -8,7 +8,12 @@ import no.nav.veilarbvedtaksstotte.service.UtrullingService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import org.springframework.web.server.ResponseStatusException; import java.util.List; diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/controller/BeslutterController.java b/src/main/java/no/nav/veilarbvedtaksstotte/controller/BeslutterController.java index ed127f1d..f932ee57 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/controller/BeslutterController.java +++ b/src/main/java/no/nav/veilarbvedtaksstotte/controller/BeslutterController.java @@ -2,7 +2,11 @@ import no.nav.veilarbvedtaksstotte.service.BeslutterService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/api/beslutter") diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/controller/Frontendlogger.kt b/src/main/java/no/nav/veilarbvedtaksstotte/controller/Frontendlogger.kt index e51b1349..e299eb97 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/controller/Frontendlogger.kt +++ b/src/main/java/no/nav/veilarbvedtaksstotte/controller/Frontendlogger.kt @@ -2,9 +2,6 @@ package no.nav.veilarbvedtaksstotte.controller import no.nav.common.metrics.Event import no.nav.common.metrics.MetricsClient -import no.nav.common.utils.EnvironmentUtils -import org.slf4j.Logger -import org.slf4j.LoggerFactory import org.springframework.web.bind.annotation.PostMapping import org.springframework.web.bind.annotation.RequestBody import org.springframework.web.bind.annotation.RequestMapping @@ -13,11 +10,11 @@ import org.springframework.web.bind.annotation.RestController @RestController @RequestMapping("/api/logger") class Frontendlogger(val metricsClient: MetricsClient) { - val log: Logger = LoggerFactory.getLogger(Frontendlogger::class.java) +// val log: Logger = LoggerFactory.getLogger(Frontendlogger::class.java) @PostMapping("/event") fun skrivEventTilInflux(@RequestBody event: FrontendEvent) { - val toInflux = Event(event.name + ".event") + /* val toInflux = Event(event.name + ".event") event.tags?.forEach(toInflux::addTagToReport) event.fields?.forEach(toInflux::addFieldToReport) toInflux.tags["environment"] = if (EnvironmentUtils.isProduction().orElse(false)) "p" else "q1" @@ -25,7 +22,7 @@ class Frontendlogger(val metricsClient: MetricsClient) { if (!EnvironmentUtils.isProduction().orElse(false)) { log.info("Skriver event til influx: " + eventToString(event.name, toInflux)) } - metricsClient.report(toInflux) + metricsClient.report(toInflux) */ } class FrontendEvent { diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/controller/InternalController.java b/src/main/java/no/nav/veilarbvedtaksstotte/controller/InternalController.java index 1ae5bd5e..5f3264a6 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/controller/InternalController.java +++ b/src/main/java/no/nav/veilarbvedtaksstotte/controller/InternalController.java @@ -1,7 +1,10 @@ package no.nav.veilarbvedtaksstotte.controller; import lombok.extern.slf4j.Slf4j; -import no.nav.common.health.selftest.*; +import no.nav.common.health.selftest.SelfTestChecks; +import no.nav.common.health.selftest.SelfTestUtils; +import no.nav.common.health.selftest.SelftTestCheckResult; +import no.nav.common.health.selftest.SelftestHtmlGenerator; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/controller/MeldingController.java b/src/main/java/no/nav/veilarbvedtaksstotte/controller/MeldingController.java index ea6a511f..054ee2fc 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/controller/MeldingController.java +++ b/src/main/java/no/nav/veilarbvedtaksstotte/controller/MeldingController.java @@ -6,7 +6,12 @@ import no.nav.veilarbvedtaksstotte.service.VedtakService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; import org.springframework.web.server.ResponseStatusException; import java.util.List; diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/controller/UtkastController.java b/src/main/java/no/nav/veilarbvedtaksstotte/controller/UtkastController.java index 4daeada3..8ef7d95a 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/controller/UtkastController.java +++ b/src/main/java/no/nav/veilarbvedtaksstotte/controller/UtkastController.java @@ -10,7 +10,15 @@ import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; import org.springframework.web.server.ResponseStatusException; @RestController diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/controller/VedtakController.java b/src/main/java/no/nav/veilarbvedtaksstotte/controller/VedtakController.java index 056cd3f2..3f13bf67 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/controller/VedtakController.java +++ b/src/main/java/no/nav/veilarbvedtaksstotte/controller/VedtakController.java @@ -2,7 +2,11 @@ import no.nav.common.types.identer.Fnr; import no.nav.veilarbvedtaksstotte.domain.arkiv.ArkivertVedtak; -import no.nav.veilarbvedtaksstotte.domain.oyeblikksbilde.*; +import no.nav.veilarbvedtaksstotte.domain.oyeblikksbilde.OyeblikksbildeArbeidssokerRegistretDto; +import no.nav.veilarbvedtaksstotte.domain.oyeblikksbilde.OyeblikksbildeCvDto; +import no.nav.veilarbvedtaksstotte.domain.oyeblikksbilde.OyeblikksbildeEgenvurderingDto; +import no.nav.veilarbvedtaksstotte.domain.oyeblikksbilde.OyeblikksbildeRegistreringDto; +import no.nav.veilarbvedtaksstotte.domain.oyeblikksbilde.OyeblikksbildeType; import no.nav.veilarbvedtaksstotte.domain.vedtak.Vedtak; import no.nav.veilarbvedtaksstotte.service.ArenaVedtakService; import no.nav.veilarbvedtaksstotte.service.OyeblikksbildeService; @@ -10,7 +14,11 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; import java.util.List; diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/controller/dto/Siste14aVedtakDTO.kt b/src/main/java/no/nav/veilarbvedtaksstotte/controller/dto/Siste14aVedtakDTO.kt index aa016355..0200fb3f 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/controller/dto/Siste14aVedtakDTO.kt +++ b/src/main/java/no/nav/veilarbvedtaksstotte/controller/dto/Siste14aVedtakDTO.kt @@ -1,7 +1,7 @@ package no.nav.veilarbvedtaksstotte.controller.dto -import no.nav.veilarbvedtaksstotte.domain.vedtak.Siste14aVedtak import no.nav.veilarbvedtaksstotte.domain.vedtak.Innsatsgruppe +import no.nav.veilarbvedtaksstotte.domain.vedtak.Siste14aVedtak import java.time.ZonedDateTime data class Siste14aVedtakDTO( diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/controller/v2/Siste14aVedtakV2Controller.kt b/src/main/java/no/nav/veilarbvedtaksstotte/controller/v2/Siste14aVedtakV2Controller.kt index c59a0cff..21f1b4fc 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/controller/v2/Siste14aVedtakV2Controller.kt +++ b/src/main/java/no/nav/veilarbvedtaksstotte/controller/v2/Siste14aVedtakV2Controller.kt @@ -6,7 +6,10 @@ import no.nav.veilarbvedtaksstotte.controller.v2.dto.Siste14aVedtakRequest import no.nav.veilarbvedtaksstotte.service.AuthService import no.nav.veilarbvedtaksstotte.service.Siste14aVedtakService import org.springframework.http.HttpStatus -import org.springframework.web.bind.annotation.* +import org.springframework.web.bind.annotation.PostMapping +import org.springframework.web.bind.annotation.RequestBody +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController import org.springframework.web.server.ResponseStatusException @RestController diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/controller/v2/UtkastV2Controller.kt b/src/main/java/no/nav/veilarbvedtaksstotte/controller/v2/UtkastV2Controller.kt index 3c290d73..a5cf71f9 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/controller/v2/UtkastV2Controller.kt +++ b/src/main/java/no/nav/veilarbvedtaksstotte/controller/v2/UtkastV2Controller.kt @@ -4,9 +4,9 @@ import no.nav.veilarbvedtaksstotte.controller.v2.dto.UtkastRequest import no.nav.veilarbvedtaksstotte.domain.vedtak.Vedtak import no.nav.veilarbvedtaksstotte.service.VedtakService import org.springframework.web.bind.annotation.PostMapping -import org.springframework.web.bind.annotation.RestController import org.springframework.web.bind.annotation.RequestBody import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController @RestController @RequestMapping("/api/v2") diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/controller/v2/VedtakV2Controller.kt b/src/main/java/no/nav/veilarbvedtaksstotte/controller/v2/VedtakV2Controller.kt index a43e5801..2fcc966d 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/controller/v2/VedtakV2Controller.kt +++ b/src/main/java/no/nav/veilarbvedtaksstotte/controller/v2/VedtakV2Controller.kt @@ -6,9 +6,9 @@ import no.nav.veilarbvedtaksstotte.domain.vedtak.Vedtak import no.nav.veilarbvedtaksstotte.service.ArenaVedtakService import no.nav.veilarbvedtaksstotte.service.VedtakService import org.springframework.web.bind.annotation.PostMapping +import org.springframework.web.bind.annotation.RequestBody import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RestController -import org.springframework.web.bind.annotation.RequestBody @RestController @RequestMapping("/api/v2/vedtak") diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/domain/beslutteroversikt/BrukereMedAntall.java b/src/main/java/no/nav/veilarbvedtaksstotte/domain/beslutteroversikt/BrukereMedAntall.java index 60f6e031..6a4a0367 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/domain/beslutteroversikt/BrukereMedAntall.java +++ b/src/main/java/no/nav/veilarbvedtaksstotte/domain/beslutteroversikt/BrukereMedAntall.java @@ -1,7 +1,6 @@ package no.nav.veilarbvedtaksstotte.domain.beslutteroversikt; import lombok.Value; -import no.nav.veilarbvedtaksstotte.domain.beslutteroversikt.BeslutteroversiktBruker; import java.util.List; diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/domain/kafka/KafkaOppfolgingsbrukerEndringV2.java b/src/main/java/no/nav/veilarbvedtaksstotte/domain/kafka/KafkaOppfolgingsbrukerEndringV2.java index bc7806ed..be502fba 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/domain/kafka/KafkaOppfolgingsbrukerEndringV2.java +++ b/src/main/java/no/nav/veilarbvedtaksstotte/domain/kafka/KafkaOppfolgingsbrukerEndringV2.java @@ -1,7 +1,6 @@ package no.nav.veilarbvedtaksstotte.domain.kafka; -import com.fasterxml.jackson.annotation.JsonAlias; import lombok.Value; import no.nav.common.types.identer.Fnr; diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/repository/BeslutteroversiktRepository.java b/src/main/java/no/nav/veilarbvedtaksstotte/repository/BeslutteroversiktRepository.java index ada9e9fd..58d11cbd 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/repository/BeslutteroversiktRepository.java +++ b/src/main/java/no/nav/veilarbvedtaksstotte/repository/BeslutteroversiktRepository.java @@ -2,7 +2,11 @@ import lombok.SneakyThrows; import lombok.Value; -import no.nav.veilarbvedtaksstotte.domain.beslutteroversikt.*; +import no.nav.veilarbvedtaksstotte.domain.beslutteroversikt.BeslutteroversiktBruker; +import no.nav.veilarbvedtaksstotte.domain.beslutteroversikt.BeslutteroversiktSok; +import no.nav.veilarbvedtaksstotte.domain.beslutteroversikt.BeslutteroversiktSokFilter; +import no.nav.veilarbvedtaksstotte.domain.beslutteroversikt.BeslutteroversiktStatus; +import no.nav.veilarbvedtaksstotte.domain.beslutteroversikt.BrukereMedAntall; import no.nav.veilarbvedtaksstotte.utils.EnumUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/repository/OyeblikksbildeRepository.java b/src/main/java/no/nav/veilarbvedtaksstotte/repository/OyeblikksbildeRepository.java index bbf315f4..1addba53 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/repository/OyeblikksbildeRepository.java +++ b/src/main/java/no/nav/veilarbvedtaksstotte/repository/OyeblikksbildeRepository.java @@ -7,7 +7,13 @@ import no.nav.veilarbvedtaksstotte.client.person.dto.CvErrorStatus; import no.nav.veilarbvedtaksstotte.client.person.dto.CvInnhold; import no.nav.veilarbvedtaksstotte.client.registrering.dto.RegistreringResponseDto; -import no.nav.veilarbvedtaksstotte.domain.oyeblikksbilde.*; +import no.nav.veilarbvedtaksstotte.domain.oyeblikksbilde.EgenvurderingDto; +import no.nav.veilarbvedtaksstotte.domain.oyeblikksbilde.OyeblikksbildeArbeidssokerRegistretDto; +import no.nav.veilarbvedtaksstotte.domain.oyeblikksbilde.OyeblikksbildeCvDto; +import no.nav.veilarbvedtaksstotte.domain.oyeblikksbilde.OyeblikksbildeDto; +import no.nav.veilarbvedtaksstotte.domain.oyeblikksbilde.OyeblikksbildeEgenvurderingDto; +import no.nav.veilarbvedtaksstotte.domain.oyeblikksbilde.OyeblikksbildeRegistreringDto; +import no.nav.veilarbvedtaksstotte.domain.oyeblikksbilde.OyeblikksbildeType; import no.nav.veilarbvedtaksstotte.utils.DbUtils; import no.nav.veilarbvedtaksstotte.utils.JsonUtils; import org.springframework.beans.factory.annotation.Autowired; diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/repository/VedtaksstotteRepository.java b/src/main/java/no/nav/veilarbvedtaksstotte/repository/VedtaksstotteRepository.java index b2e088c4..2846b05b 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/repository/VedtaksstotteRepository.java +++ b/src/main/java/no/nav/veilarbvedtaksstotte/repository/VedtaksstotteRepository.java @@ -3,7 +3,11 @@ import lombok.SneakyThrows; import no.nav.common.types.identer.AktorId; import no.nav.veilarbvedtaksstotte.domain.DistribusjonBestillingId; -import no.nav.veilarbvedtaksstotte.domain.vedtak.*; +import no.nav.veilarbvedtaksstotte.domain.vedtak.BeslutterProsessStatus; +import no.nav.veilarbvedtaksstotte.domain.vedtak.Hovedmal; +import no.nav.veilarbvedtaksstotte.domain.vedtak.Innsatsgruppe; +import no.nav.veilarbvedtaksstotte.domain.vedtak.Vedtak; +import no.nav.veilarbvedtaksstotte.domain.vedtak.VedtakStatus; import no.nav.veilarbvedtaksstotte.utils.EnumUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/schedule/SlettUtkastSchedule.java b/src/main/java/no/nav/veilarbvedtaksstotte/schedule/SlettUtkastSchedule.java index 7c5a67c9..e975b0d7 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/schedule/SlettUtkastSchedule.java +++ b/src/main/java/no/nav/veilarbvedtaksstotte/schedule/SlettUtkastSchedule.java @@ -7,8 +7,8 @@ import no.nav.common.job.leader_election.LeaderElectionClient; import no.nav.common.types.identer.AktorId; import no.nav.common.types.identer.Fnr; -import no.nav.veilarbvedtaksstotte.client.veilarboppfolging.dto.OppfolgingPeriodeDTO; import no.nav.veilarbvedtaksstotte.client.veilarboppfolging.VeilarboppfolgingClient; +import no.nav.veilarbvedtaksstotte.client.veilarboppfolging.dto.OppfolgingPeriodeDTO; import no.nav.veilarbvedtaksstotte.domain.vedtak.Vedtak; import no.nav.veilarbvedtaksstotte.repository.VedtaksstotteRepository; import no.nav.veilarbvedtaksstotte.service.VedtakService; diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/service/AuthService.kt b/src/main/java/no/nav/veilarbvedtaksstotte/service/AuthService.kt index 162762c7..75c69a92 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/service/AuthService.kt +++ b/src/main/java/no/nav/veilarbvedtaksstotte/service/AuthService.kt @@ -7,7 +7,11 @@ import no.nav.common.client.aktoroppslag.AktorOppslagClient import no.nav.common.types.identer.AktorId import no.nav.common.types.identer.Fnr import no.nav.common.utils.Pair -import no.nav.poao_tilgang.client.* +import no.nav.poao_tilgang.client.EksternBrukerTilgangTilEksternBrukerPolicyInput +import no.nav.poao_tilgang.client.NavAnsattTilgangTilEksternBrukerPolicyInput +import no.nav.poao_tilgang.client.NavAnsattTilgangTilNavEnhetPolicyInput +import no.nav.poao_tilgang.client.PoaoTilgangClient +import no.nav.poao_tilgang.client.TilgangType import no.nav.veilarbvedtaksstotte.domain.AuthKontekst import no.nav.veilarbvedtaksstotte.domain.vedtak.Vedtak import org.slf4j.LoggerFactory diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/service/DistribusjonService.kt b/src/main/java/no/nav/veilarbvedtaksstotte/service/DistribusjonService.kt index 1e8327bd..4cfa7db7 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/service/DistribusjonService.kt +++ b/src/main/java/no/nav/veilarbvedtaksstotte/service/DistribusjonService.kt @@ -1,7 +1,7 @@ package no.nav.veilarbvedtaksstotte.service -import no.nav.veilarbvedtaksstotte.client.dokdistfordeling.dto.DistribuerJournalpostDTO import no.nav.veilarbvedtaksstotte.client.dokdistfordeling.DokdistribusjonClient +import no.nav.veilarbvedtaksstotte.client.dokdistfordeling.dto.DistribuerJournalpostDTO import no.nav.veilarbvedtaksstotte.domain.DistribusjonBestillingId import no.nav.veilarbvedtaksstotte.domain.vedtak.Vedtak import no.nav.veilarbvedtaksstotte.repository.VedtaksstotteRepository diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/service/MeldingService.java b/src/main/java/no/nav/veilarbvedtaksstotte/service/MeldingService.java index be80351c..3a49a517 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/service/MeldingService.java +++ b/src/main/java/no/nav/veilarbvedtaksstotte/service/MeldingService.java @@ -1,11 +1,11 @@ package no.nav.veilarbvedtaksstotte.service; import no.nav.common.types.identer.AktorId; -import no.nav.veilarbvedtaksstotte.domain.vedtak.Vedtak; import no.nav.veilarbvedtaksstotte.client.veilederogenhet.dto.Veileder; import no.nav.veilarbvedtaksstotte.controller.dto.DialogMeldingDTO; import no.nav.veilarbvedtaksstotte.controller.dto.MeldingDTO; import no.nav.veilarbvedtaksstotte.controller.dto.SystemMeldingDTO; +import no.nav.veilarbvedtaksstotte.domain.vedtak.Vedtak; import no.nav.veilarbvedtaksstotte.repository.MeldingRepository; import no.nav.veilarbvedtaksstotte.repository.VedtaksstotteRepository; import org.springframework.beans.factory.annotation.Autowired; diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/service/MetricsService.java b/src/main/java/no/nav/veilarbvedtaksstotte/service/MetricsService.java index 73dd2603..6a325393 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/service/MetricsService.java +++ b/src/main/java/no/nav/veilarbvedtaksstotte/service/MetricsService.java @@ -7,18 +7,22 @@ import no.nav.common.metrics.MetricsClient; import no.nav.common.types.identer.AktorId; import no.nav.common.types.identer.Fnr; -import no.nav.veilarbvedtaksstotte.client.arena.dto.VeilarbArenaOppfolging; import no.nav.veilarbvedtaksstotte.client.arena.VeilarbarenaClient; -import no.nav.veilarbvedtaksstotte.client.registrering.dto.RegistreringResponseDto; +import no.nav.veilarbvedtaksstotte.client.arena.dto.VeilarbArenaOppfolging; import no.nav.veilarbvedtaksstotte.client.registrering.VeilarbregistreringClient; -import no.nav.veilarbvedtaksstotte.client.veilarboppfolging.dto.OppfolgingPeriodeDTO; +import no.nav.veilarbvedtaksstotte.client.registrering.dto.RegistreringResponseDto; import no.nav.veilarbvedtaksstotte.client.veilarboppfolging.VeilarboppfolgingClient; +import no.nav.veilarbvedtaksstotte.client.veilarboppfolging.dto.OppfolgingPeriodeDTO; import no.nav.veilarbvedtaksstotte.domain.vedtak.Vedtak; import no.nav.veilarbvedtaksstotte.repository.VedtaksstotteRepository; import no.nav.veilarbvedtaksstotte.utils.OppfolgingUtils; import org.springframework.stereotype.Service; -import java.time.*; +import java.time.Duration; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.ZonedDateTime; import java.util.List; import java.util.Optional; import java.util.concurrent.TimeUnit; diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/service/OboContexService.kt b/src/main/java/no/nav/veilarbvedtaksstotte/service/OboContexService.kt deleted file mode 100644 index ffaa78f6..00000000 --- a/src/main/java/no/nav/veilarbvedtaksstotte/service/OboContexService.kt +++ /dev/null @@ -1,27 +0,0 @@ -package no.nav.veilarbvedtaksstotte.service - -import no.nav.common.auth.context.AuthContextHolder -import no.nav.common.token_client.client.AzureAdOnBehalfOfTokenClient -import no.nav.common.utils.AuthUtils -import no.nav.veilarbvedtaksstotte.utils.DownstreamApi -import org.springframework.stereotype.Service -import java.util.function.Supplier - -@Service -class OboContexService( - val aadOboTokenClient: AzureAdOnBehalfOfTokenClient, - val authContext: AuthContextHolder -) { - - fun userTokenSupplier(receivingApp: DownstreamApi): Supplier { - return Supplier { - AuthUtils.bearerToken(getAadOboTokenForTjeneste(authContext.requireIdTokenString(), receivingApp)) - } - } - - private fun getAadOboTokenForTjeneste(token: String, api: DownstreamApi): String { - val scope = "api://" + api.cluster + "." + api.namespace + "." + api.serviceName + "/.default" - return aadOboTokenClient.exchangeOnBehalfOfToken(scope, token) - } - -} \ No newline at end of file diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/service/OyeblikksbildeService.java b/src/main/java/no/nav/veilarbvedtaksstotte/service/OyeblikksbildeService.java index ca8b1e6a..157ba56f 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/service/OyeblikksbildeService.java +++ b/src/main/java/no/nav/veilarbvedtaksstotte/service/OyeblikksbildeService.java @@ -20,7 +20,13 @@ import no.nav.veilarbvedtaksstotte.client.registrering.dto.RegistreringResponseDto; import no.nav.veilarbvedtaksstotte.client.registrering.dto.RegistreringsdataDto; import no.nav.veilarbvedtaksstotte.domain.VedtakOpplysningKilder; -import no.nav.veilarbvedtaksstotte.domain.oyeblikksbilde.*; +import no.nav.veilarbvedtaksstotte.domain.oyeblikksbilde.EgenvurderingDto; +import no.nav.veilarbvedtaksstotte.domain.oyeblikksbilde.OyeblikksbildeArbeidssokerRegistretDto; +import no.nav.veilarbvedtaksstotte.domain.oyeblikksbilde.OyeblikksbildeCvDto; +import no.nav.veilarbvedtaksstotte.domain.oyeblikksbilde.OyeblikksbildeDto; +import no.nav.veilarbvedtaksstotte.domain.oyeblikksbilde.OyeblikksbildeEgenvurderingDto; +import no.nav.veilarbvedtaksstotte.domain.oyeblikksbilde.OyeblikksbildeRegistreringDto; +import no.nav.veilarbvedtaksstotte.domain.oyeblikksbilde.OyeblikksbildeType; import no.nav.veilarbvedtaksstotte.domain.vedtak.Vedtak; import no.nav.veilarbvedtaksstotte.repository.OyeblikksbildeRepository; import no.nav.veilarbvedtaksstotte.repository.VedtaksstotteRepository; diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/service/VedtakService.java b/src/main/java/no/nav/veilarbvedtaksstotte/service/VedtakService.java index 14fe26f5..0b45cbe5 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/service/VedtakService.java +++ b/src/main/java/no/nav/veilarbvedtaksstotte/service/VedtakService.java @@ -15,7 +15,11 @@ import no.nav.veilarbvedtaksstotte.domain.arkiv.BrevKode; import no.nav.veilarbvedtaksstotte.domain.dialog.SystemMeldingType; import no.nav.veilarbvedtaksstotte.domain.oyeblikksbilde.OyeblikksbildeType; -import no.nav.veilarbvedtaksstotte.domain.vedtak.*; +import no.nav.veilarbvedtaksstotte.domain.vedtak.BeslutterProsessStatus; +import no.nav.veilarbvedtaksstotte.domain.vedtak.Innsatsgruppe; +import no.nav.veilarbvedtaksstotte.domain.vedtak.Kilde; +import no.nav.veilarbvedtaksstotte.domain.vedtak.Vedtak; +import no.nav.veilarbvedtaksstotte.domain.vedtak.VedtakStatus; import no.nav.veilarbvedtaksstotte.repository.BeslutteroversiktRepository; import no.nav.veilarbvedtaksstotte.repository.KilderRepository; import no.nav.veilarbvedtaksstotte.repository.MeldingRepository; diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/service/VeilarbarenaService.java b/src/main/java/no/nav/veilarbvedtaksstotte/service/VeilarbarenaService.java index a6a099f9..719acc3a 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/service/VeilarbarenaService.java +++ b/src/main/java/no/nav/veilarbvedtaksstotte/service/VeilarbarenaService.java @@ -2,8 +2,8 @@ import no.nav.common.types.identer.EnhetId; import no.nav.common.types.identer.Fnr; -import no.nav.veilarbvedtaksstotte.client.arena.dto.VeilarbArenaOppfolging; import no.nav.veilarbvedtaksstotte.client.arena.VeilarbarenaClient; +import no.nav.veilarbvedtaksstotte.client.arena.dto.VeilarbArenaOppfolging; import org.springframework.stereotype.Service; import java.util.Optional; diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/utils/DbUtils.java b/src/main/java/no/nav/veilarbvedtaksstotte/utils/DbUtils.java index 664d9c51..6c169bae 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/utils/DbUtils.java +++ b/src/main/java/no/nav/veilarbvedtaksstotte/utils/DbUtils.java @@ -1,20 +1,13 @@ package no.nav.veilarbvedtaksstotte.utils; -import com.zaxxer.hikari.HikariConfig; -import lombok.SneakyThrows; -import no.nav.vault.jdbc.hikaricp.HikariCPVaultUtil; -import org.flywaydb.core.Flyway; +import lombok.extern.slf4j.Slf4j; import org.springframework.dao.EmptyResultDataAccessException; -import javax.sql.DataSource; import java.util.List; import java.util.function.Supplier; -import static no.nav.common.utils.EnvironmentUtils.isProduction; -import static no.nav.veilarbvedtaksstotte.config.ApplicationConfig.APPLICATION_NAME; - +@Slf4j public class DbUtils { - public static String toPostgresArray(List values) { return "{" + String.join(",", values) + "}"; } @@ -27,49 +20,4 @@ public static T queryForObjectOrNull(Supplier query) { } } - public static DataSource createDataSource(String dbUrl, DbRole dbRole) { - HikariConfig config = createDataSourceConfig(dbUrl); - return createVaultRefreshDataSource(config, dbRole); - } - - @SneakyThrows - public static void migrateAndClose(DataSource dataSource, DbRole dbRole) { - migrate(dataSource, dbRole); - dataSource.getConnection().close(); - } - - public static void migrate(DataSource dataSource, DbRole dbRole) { - Flyway.configure() - .dataSource(dataSource) - .initSql(String.format("SET ROLE \"%s\"", toDbRoleStr(dbRole))) - .baselineOnMigrate(true) - .load() - .migrate(); - } - - public static HikariConfig createDataSourceConfig(String dbUrl) { - HikariConfig config = new HikariConfig(); - config.setJdbcUrl(dbUrl); - config.setMaximumPoolSize(5); - config.setMinimumIdle(1); - return config; - } - - @SneakyThrows - private static DataSource createVaultRefreshDataSource(HikariConfig config, DbRole dbRole) { - return HikariCPVaultUtil.createHikariDataSourceWithVaultIntegration(config, getMountPath(), toDbRoleStr(dbRole)); - } - - private static String getMountPath() { - boolean isProd = isProduction().orElse(false); - return "postgresql/" + (isProd ? "prod-fss" : "preprod-fss"); - } - - public static String toDbRoleStr(DbRole dbRole) { - String environment = isProduction().orElse(false) ? "p" : "q1"; - String role = EnumUtils.getName(dbRole).toLowerCase(); - String dbName = isProduction().orElse(false) ? "veilarbvedtaksstotte-fss13" : "veilarbvedtaksstotte-fss15"; - return String.join("-", dbName, environment, role); - } - } diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/utils/JsonUtils.kt b/src/main/java/no/nav/veilarbvedtaksstotte/utils/JsonUtils.kt index 21074128..d5011136 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/utils/JsonUtils.kt +++ b/src/main/java/no/nav/veilarbvedtaksstotte/utils/JsonUtils.kt @@ -2,7 +2,6 @@ package no.nav.veilarbvedtaksstotte.utils import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.databind.node.JsonNodeFactory -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule import com.fasterxml.jackson.module.kotlin.KotlinModule import no.nav.common.rest.client.RestUtils import okhttp3.Response diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/utils/SecureLog.kt b/src/main/java/no/nav/veilarbvedtaksstotte/utils/SecureLog.kt index f9b6c6b7..aee8a249 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/utils/SecureLog.kt +++ b/src/main/java/no/nav/veilarbvedtaksstotte/utils/SecureLog.kt @@ -1,6 +1,5 @@ package no.nav.veilarbvedtaksstotte.utils -import org.slf4j.Logger import org.slf4j.LoggerFactory object SecureLog { diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/utils/TimeUtils.kt b/src/main/java/no/nav/veilarbvedtaksstotte/utils/TimeUtils.kt index 259cd49a..f40e9e7a 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/utils/TimeUtils.kt +++ b/src/main/java/no/nav/veilarbvedtaksstotte/utils/TimeUtils.kt @@ -1,6 +1,10 @@ package no.nav.veilarbvedtaksstotte.utils -import java.time.* +import java.time.Instant +import java.time.LocalDate +import java.time.LocalDateTime +import java.time.ZoneId +import java.time.ZonedDateTime import java.time.temporal.ChronoUnit object TimeUtils { diff --git a/src/main/java/no/nav/veilarbvedtaksstotte/utils/UnleashUtils.kt b/src/main/java/no/nav/veilarbvedtaksstotte/utils/UnleashUtils.kt index c821a3a3..593b3b0b 100644 --- a/src/main/java/no/nav/veilarbvedtaksstotte/utils/UnleashUtils.kt +++ b/src/main/java/no/nav/veilarbvedtaksstotte/utils/UnleashUtils.kt @@ -1,3 +1,3 @@ package no.nav.veilarbvedtaksstotte.utils -const val KAFKA_KONSUMERING_SKRUDD_AV = "veilarbvedtaksstotte.kafka-konsumering-skrudd-av" +const val KAFKA_KONSUMERING_GCP_SKRUDD_AV = "veilarbvedtaksstotte.kafka-konsumering-gcp-skrudd-av" diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 0052f7d9..8bc37807 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -11,26 +11,39 @@ management.endpoint.health.probes.enabled=true management.endpoint.health.group.liveness.include=livenessState,dataSource # Application environment -app.env.stsDiscoveryUrl=${SECURITY_TOKEN_SERVICE_DISCOVERY_URL:#{null}} -app.env.openAmRefreshUrl=${VEILARBLOGIN_OPENAM_REFRESH_URL:#{null}} -app.env.openAmDiscoveryUrl=${OPENAM_DISCOVERY_URL:#{null}} -app.env.veilarbloginOpenAmClientId=${VEILARBLOGIN_OPENAM_CLIENT_ID:#{null}} -app.env.dbUrl=${VEILARBVEDTAKSSTOTTE_DB_URL:#{null}} -app.env.unleashUrl=${UNLEASH_SERVER_API_URL}/api +app.env.aiaBackendScope=${AIA_BACKEND_TOKEN_SCOPE} +app.env.aiaBackendUrl=${AIA_BACKEND_URL} +app.env.dbUrl=${DB_JDBC_URL} +app.env.dokarkivScope=${DOKARKIV_TOKEN_SCOPE} +app.env.dokarkivUrl=${DOKARKIV_URL} +app.env.dokdistfordelingUrl=${DOKDISTFORDELING_URL} +app.env.norg2Url=${NORG2_URL} +app.env.pdlScope=${PDL_TOKEN_SCOPE} +app.env.pdlUrl=${PDL_URL} +app.env.poaoTilgangScope=${POAO_TILGANG_TOKEN_SCOPE} +app.env.poaoTilgangUrl=${POAO_TILGANG_URL} +app.env.ptoPdfgenUrl=${PTO_PDFGEN_URL} +app.env.regoppslagScope=${REGOPPSLAG_TOKEN_SCOPE} +app.env.regoppslagUrl=${REGOPPSLAG_URL} +app.env.safScope=${SAF_TOKEN_SCOPE} +app.env.safUrl=${SAF_URL} +app.env.tokenxClientId=${TOKEN_X_CLIENT_ID} +app.env.tokenxDiscoveryUrl=${TOKEN_X_WELL_KNOWN_URL} app.env.unleashApiToken=${UNLEASH_SERVER_API_TOKEN} -app.env.norg2Url=${NORG2_URL:#{null}} -app.env.poaoTilgangUrl=${POAO_TILGANG_URL:#{null}} -app.env.poaoTilgangScope=${POAO_TILGANG_SCOPE:#{null}} -app.env.veilarboppfolgingUrl=${VEILARBOPPFOLGING_URL:#{null}} -app.env.veilarboppfolgingScope=${VEILARBOPPFOLGING_AZURE_SCOPE:#{null}} -app.env.aiaBackendUrl=${AIA_BACKEND_URL:#{null}} -app.env.tokenxClientId=${TOKEN_X_CLIENT_ID:null} -app.env.tokenxDiscoveryUrl=${TOKEN_X_WELL_KNOWN_URL:null} +app.env.unleashUrl=${UNLEASH_SERVER_API_URL}/api +app.env.veilarbarenaScope=${VEILARBARENA_TOKEN_SCOPE} +app.env.veilarbarenaUrl=${VEILARBARENA_URL} +app.env.veilarboppfolgingScope=${VEILARBOPPFOLGING_TOKEN_SCOPE} +app.env.veilarboppfolgingUrl=${VEILARBOPPFOLGING_URL} +app.env.veilarbpersonScope=${VEILARBPERSON_TOKEN_SCOPE} +app.env.veilarbpersonUrl=${VEILARBPERSON_URL} +app.env.veilarbveilederScope=${VEILARBVEILEDER_TOKEN_SCOPE} +app.env.veilarbveilederUrl=${VEILARBVEILEDER_URL} -# Nais variabler -app.env.naisAadDiscoveryUrl=${AZURE_APP_WELL_KNOWN_URL:#{null}} -app.env.naisAadClientId=${AZURE_APP_CLIENT_ID:#{null}} -app.env.naisAadIssuer=${AZURE_OPENID_CONFIG_ISSUER:#{null}} +# Nais-variabler +app.env.naisAadDiscoveryUrl=${AZURE_APP_WELL_KNOWN_URL} +app.env.naisAadClientId=${AZURE_APP_CLIENT_ID} +app.env.naisAadIssuer=${AZURE_OPENID_CONFIG_ISSUER} # swagger-ui custom path springdoc.swagger-ui.path=/internal/swagger-ui.html @@ -38,10 +51,10 @@ springdoc.pathsToMatch=/api/** spring.kafka.bootstrap-servers=${KAFKA_BROKERS_URL} -app.kafka.brokersUrl=${KAFKA_BROKERS_URL:#{null}} -app.kafka.endringPaOppfolgingsBrukerTopic=${ENDRING_PA_OPPFOLGINGS_BRUKER_TOPIC:#{null}} +app.kafka.brokersUrl=${KAFKA_BROKERS_URL} +app.kafka.endringPaOppfolgingsBrukerTopic=${ENDRING_PA_OPPFOLGINGS_BRUKER_TOPIC} app.kafka.vedtakSendtTopic=pto.vedtak-sendt-v1 -app.kafka.arenaVedtakTopic=${ARENA_VEDTAK_TOPIC:#{null}} +app.kafka.arenaVedtakTopic=${ARENA_VEDTAK_TOPIC} app.kafka.vedtakStatusEndringTopic=pto.vedtak-14a-statusendring-v1 app.kafka.siste14aVedtakTopic=pto.siste-14a-vedtak-v1 app.kafka.vedtakFattetDvhTopic=pto.vedtak-14a-fattet-dvh-v1 diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/client/arena/VeilarbarenaClientImplTest.kt b/src/test/java/no/nav/veilarbvedtaksstotte/client/arena/VeilarbarenaClientImplTest.kt index 9153237b..87e10029 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/client/arena/VeilarbarenaClientImplTest.kt +++ b/src/test/java/no/nav/veilarbvedtaksstotte/client/arena/VeilarbarenaClientImplTest.kt @@ -5,7 +5,9 @@ import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo import com.github.tomakehurst.wiremock.junit5.WireMockTest import no.nav.veilarbvedtaksstotte.utils.TestData.TEST_FNR import no.nav.veilarbvedtaksstotte.utils.TestData.TEST_OPPFOLGINGSSAK -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertThrows +import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.BeforeAll import org.junit.jupiter.api.Test diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/client/dokarkiv/SafClientImplTest.java b/src/test/java/no/nav/veilarbvedtaksstotte/client/dokarkiv/SafClientImplTest.java index cdbbb56d..fed673a3 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/client/dokarkiv/SafClientImplTest.java +++ b/src/test/java/no/nav/veilarbvedtaksstotte/client/dokarkiv/SafClientImplTest.java @@ -10,8 +10,13 @@ import java.util.List; -import static com.github.tomakehurst.wiremock.client.WireMock.*; -import static org.junit.jupiter.api.Assertions.*; +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.givenThat; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; @WireMockTest public class SafClientImplTest { diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/client/veilarboppfolging/VeilarboppfolgingClientImplTest.java b/src/test/java/no/nav/veilarbvedtaksstotte/client/veilarboppfolging/VeilarboppfolgingClientImplTest.java index 46b356e7..cb996cd1 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/client/veilarboppfolging/VeilarboppfolgingClientImplTest.java +++ b/src/test/java/no/nav/veilarbvedtaksstotte/client/veilarboppfolging/VeilarboppfolgingClientImplTest.java @@ -14,7 +14,11 @@ import java.util.List; import java.util.Optional; -import static com.github.tomakehurst.wiremock.client.WireMock.*; +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; +import static com.github.tomakehurst.wiremock.client.WireMock.givenThat; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static java.time.temporal.ChronoUnit.MILLIS; import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_FNR; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/config/ApplicationTestConfig.kt b/src/test/java/no/nav/veilarbvedtaksstotte/config/ApplicationTestConfig.kt index 9ef47f0f..3f56edf6 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/config/ApplicationTestConfig.kt +++ b/src/test/java/no/nav/veilarbvedtaksstotte/config/ApplicationTestConfig.kt @@ -12,7 +12,6 @@ import no.nav.common.job.leader_election.LeaderElectionClient import no.nav.common.kafka.util.KafkaPropertiesBuilder import no.nav.common.metrics.MetricsClient import no.nav.common.token_client.client.AzureAdOnBehalfOfTokenClient -import no.nav.common.utils.Credentials import no.nav.poao_tilgang.client.PoaoTilgangClient import no.nav.veilarbvedtaksstotte.client.arbeidssoekeregisteret.ArbeidssoekerRegisteretService import no.nav.veilarbvedtaksstotte.kafka.KafkaTestProducer @@ -57,11 +56,6 @@ import javax.sql.DataSource ArbeidssoekerRegisteretService::class ) class ApplicationTestConfig { - @Bean - fun serviceUserCredentials(): Credentials { - return Credentials("username", "password") - } - @Bean fun poaoTilgangClient(): PoaoTilgangClient { return PoaoTilgangClientMock() @@ -136,9 +130,7 @@ class ApplicationTestConfig { ) .build() return KafkaEnvironmentContext( - onPremConsumerClientProperties = consumerProperties, aivenConsumerClientProperties = consumerProperties, - onPremProducerClientProperties = producerProperties, aivenProducerClientProperties = producerProperties ) } diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/config/ClientTestConfig.java b/src/test/java/no/nav/veilarbvedtaksstotte/config/ClientTestConfig.java index 89654982..23758766 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/config/ClientTestConfig.java +++ b/src/test/java/no/nav/veilarbvedtaksstotte/config/ClientTestConfig.java @@ -56,10 +56,22 @@ import org.springframework.context.annotation.Configuration; import java.time.ZonedDateTime; -import java.util.*; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; import static java.util.Collections.emptyList; -import static no.nav.veilarbvedtaksstotte.utils.TestData.*; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_AKTOR_ID; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_DOKUMENT_BESTILLING_ID; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_DOKUMENT_ID; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_FNR; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_JOURNALPOST_ID; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_OPPFOLGINGSENHET_ID; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_OPPFOLGINGSENHET_NAVN; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_OPPFOLGINGSSAK; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_VEILEDER_IDENT; @Configuration public class ClientTestConfig { diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/config/ControllerTestConfig.java b/src/test/java/no/nav/veilarbvedtaksstotte/config/ControllerTestConfig.java index d9059079..24c0e05b 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/config/ControllerTestConfig.java +++ b/src/test/java/no/nav/veilarbvedtaksstotte/config/ControllerTestConfig.java @@ -1,6 +1,16 @@ package no.nav.veilarbvedtaksstotte.config; -import no.nav.veilarbvedtaksstotte.controller.*; +import no.nav.veilarbvedtaksstotte.controller.AdminController; +import no.nav.veilarbvedtaksstotte.controller.BeslutterController; +import no.nav.veilarbvedtaksstotte.controller.BeslutteroversiktController; +import no.nav.veilarbvedtaksstotte.controller.Frontendlogger; +import no.nav.veilarbvedtaksstotte.controller.InternalController; +import no.nav.veilarbvedtaksstotte.controller.KodeverkController; +import no.nav.veilarbvedtaksstotte.controller.MeldingController; +import no.nav.veilarbvedtaksstotte.controller.Siste14aVedtakController; +import no.nav.veilarbvedtaksstotte.controller.UtkastController; +import no.nav.veilarbvedtaksstotte.controller.UtrullingController; +import no.nav.veilarbvedtaksstotte.controller.VedtakController; import no.nav.veilarbvedtaksstotte.controller.v2.Siste14aVedtakV2Controller; import no.nav.veilarbvedtaksstotte.controller.v2.UtkastV2Controller; import no.nav.veilarbvedtaksstotte.controller.v2.UtrullingV2Controller; diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/config/RepositoryTestConfig.java b/src/test/java/no/nav/veilarbvedtaksstotte/config/RepositoryTestConfig.java index 799a5165..6494e241 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/config/RepositoryTestConfig.java +++ b/src/test/java/no/nav/veilarbvedtaksstotte/config/RepositoryTestConfig.java @@ -1,6 +1,12 @@ package no.nav.veilarbvedtaksstotte.config; -import no.nav.veilarbvedtaksstotte.repository.*; +import no.nav.veilarbvedtaksstotte.repository.ArenaVedtakRepository; +import no.nav.veilarbvedtaksstotte.repository.BeslutteroversiktRepository; +import no.nav.veilarbvedtaksstotte.repository.KilderRepository; +import no.nav.veilarbvedtaksstotte.repository.MeldingRepository; +import no.nav.veilarbvedtaksstotte.repository.OyeblikksbildeRepository; +import no.nav.veilarbvedtaksstotte.repository.UtrullingRepository; +import no.nav.veilarbvedtaksstotte.repository.VedtaksstotteRepository; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/config/ServiceTestConfig.java b/src/test/java/no/nav/veilarbvedtaksstotte/config/ServiceTestConfig.java index 771673d5..7b84805b 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/config/ServiceTestConfig.java +++ b/src/test/java/no/nav/veilarbvedtaksstotte/config/ServiceTestConfig.java @@ -1,6 +1,27 @@ package no.nav.veilarbvedtaksstotte.config; -import no.nav.veilarbvedtaksstotte.service.*; +import no.nav.veilarbvedtaksstotte.service.ArenaVedtakService; +import no.nav.veilarbvedtaksstotte.service.AuthService; +import no.nav.veilarbvedtaksstotte.service.BeslutterService; +import no.nav.veilarbvedtaksstotte.service.BeslutteroversiktService; +import no.nav.veilarbvedtaksstotte.service.DistribusjonService; +import no.nav.veilarbvedtaksstotte.service.DokumentService; +import no.nav.veilarbvedtaksstotte.service.DvhRapporteringService; +import no.nav.veilarbvedtaksstotte.service.EnhetInfoService; +import no.nav.veilarbvedtaksstotte.service.KafkaConsumerService; +import no.nav.veilarbvedtaksstotte.service.KafkaProducerService; +import no.nav.veilarbvedtaksstotte.service.KafkaRepubliseringService; +import no.nav.veilarbvedtaksstotte.service.KafkaVedtakStatusEndringConsumer; +import no.nav.veilarbvedtaksstotte.service.MalTypeService; +import no.nav.veilarbvedtaksstotte.service.MeldingService; +import no.nav.veilarbvedtaksstotte.service.MetricsService; +import no.nav.veilarbvedtaksstotte.service.OyeblikksbildeService; +import no.nav.veilarbvedtaksstotte.service.Siste14aVedtakService; +import no.nav.veilarbvedtaksstotte.service.UtrullingService; +import no.nav.veilarbvedtaksstotte.service.VedtakHendelserService; +import no.nav.veilarbvedtaksstotte.service.VedtakService; +import no.nav.veilarbvedtaksstotte.service.VeilarbarenaService; +import no.nav.veilarbvedtaksstotte.service.VeilederService; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/controller/MeldingControllerTest.java b/src/test/java/no/nav/veilarbvedtaksstotte/controller/MeldingControllerTest.java index 335437e8..bab12608 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/controller/MeldingControllerTest.java +++ b/src/test/java/no/nav/veilarbvedtaksstotte/controller/MeldingControllerTest.java @@ -13,7 +13,11 @@ import org.springframework.test.web.servlet.MockMvc; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.anyString; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/kafka/Siste14aVedtakKafkaProducerTest.kt b/src/test/java/no/nav/veilarbvedtaksstotte/kafka/Siste14aVedtakKafkaProducerTest.kt index 1ad28cec..a10f0a20 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/kafka/Siste14aVedtakKafkaProducerTest.kt +++ b/src/test/java/no/nav/veilarbvedtaksstotte/kafka/Siste14aVedtakKafkaProducerTest.kt @@ -14,7 +14,9 @@ import no.nav.veilarbvedtaksstotte.utils.KafkaTestUtils import no.nav.veilarbvedtaksstotte.utils.TestUtils import no.nav.veilarbvedtaksstotte.utils.TimeUtils import org.apache.commons.lang3.RandomStringUtils.randomNumeric -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertNotNull +import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test import org.mockito.Mockito.`when` import org.springframework.beans.factory.annotation.Autowired diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/mock/PoaoTilgangClientMock.kt b/src/test/java/no/nav/veilarbvedtaksstotte/mock/PoaoTilgangClientMock.kt index 9081b874..148ded4d 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/mock/PoaoTilgangClientMock.kt +++ b/src/test/java/no/nav/veilarbvedtaksstotte/mock/PoaoTilgangClientMock.kt @@ -1,6 +1,12 @@ package no.nav.veilarbvedtaksstotte.mock -import no.nav.poao_tilgang.client.* +import no.nav.poao_tilgang.client.AdGruppe +import no.nav.poao_tilgang.client.Decision +import no.nav.poao_tilgang.client.NorskIdent +import no.nav.poao_tilgang.client.PoaoTilgangClient +import no.nav.poao_tilgang.client.PolicyInput +import no.nav.poao_tilgang.client.PolicyRequest +import no.nav.poao_tilgang.client.PolicyResult import no.nav.poao_tilgang.client.api.ApiResult import java.util.* diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/repository/ArenaVedtakRepositoryTest.kt b/src/test/java/no/nav/veilarbvedtaksstotte/repository/ArenaVedtakRepositoryTest.kt index b1ee4898..aa736579 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/repository/ArenaVedtakRepositoryTest.kt +++ b/src/test/java/no/nav/veilarbvedtaksstotte/repository/ArenaVedtakRepositoryTest.kt @@ -11,8 +11,6 @@ import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.BeforeAll import org.junit.jupiter.api.Test import java.time.LocalDate -import java.time.LocalDateTime -import java.time.temporal.ChronoUnit class ArenaVedtakRepositoryTest : DatabaseTest() { diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/repository/BeslutterRepositorySokTest.java b/src/test/java/no/nav/veilarbvedtaksstotte/repository/BeslutterRepositorySokTest.java index 0817c942..10ca4562 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/repository/BeslutterRepositorySokTest.java +++ b/src/test/java/no/nav/veilarbvedtaksstotte/repository/BeslutterRepositorySokTest.java @@ -1,6 +1,10 @@ package no.nav.veilarbvedtaksstotte.repository; -import no.nav.veilarbvedtaksstotte.domain.beslutteroversikt.*; +import no.nav.veilarbvedtaksstotte.domain.beslutteroversikt.BeslutteroversiktBruker; +import no.nav.veilarbvedtaksstotte.domain.beslutteroversikt.BeslutteroversiktSok; +import no.nav.veilarbvedtaksstotte.domain.beslutteroversikt.BeslutteroversiktSokFilter; +import no.nav.veilarbvedtaksstotte.domain.beslutteroversikt.BeslutteroversiktStatus; +import no.nav.veilarbvedtaksstotte.domain.beslutteroversikt.BrukereMedAntall; import no.nav.veilarbvedtaksstotte.utils.DatabaseTest; import no.nav.veilarbvedtaksstotte.utils.DbTestUtils; import no.nav.veilarbvedtaksstotte.utils.TestUtils; diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/repository/BeslutteroversiktRepositoryTest.java b/src/test/java/no/nav/veilarbvedtaksstotte/repository/BeslutteroversiktRepositoryTest.java index e231a5cb..c7241d16 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/repository/BeslutteroversiktRepositoryTest.java +++ b/src/test/java/no/nav/veilarbvedtaksstotte/repository/BeslutteroversiktRepositoryTest.java @@ -8,11 +8,18 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.time.LocalDateTime; - -import static no.nav.veilarbvedtaksstotte.utils.TestData.*; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_AKTOR_ID; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_BESLUTTER_IDENT; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_BESLUTTER_NAVN; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_FNR; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_OPPFOLGINGSENHET_ID; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_OPPFOLGINGSENHET_NAVN; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_VEILEDER_IDENT; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_VEILEDER_NAVN; import static no.nav.veilarbvedtaksstotte.utils.TimeUtils.now; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNull; public class BeslutteroversiktRepositoryTest extends DatabaseTest { diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/repository/KilderRepositoryTest.java b/src/test/java/no/nav/veilarbvedtaksstotte/repository/KilderRepositoryTest.java index a5b7798b..34a3ebdd 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/repository/KilderRepositoryTest.java +++ b/src/test/java/no/nav/veilarbvedtaksstotte/repository/KilderRepositoryTest.java @@ -12,8 +12,13 @@ import java.util.Arrays; import java.util.List; -import static no.nav.veilarbvedtaksstotte.utils.TestData.*; -import static org.junit.jupiter.api.Assertions.*; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_AKTOR_ID; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_OPPFOLGINGSENHET_ID; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_VEILEDER_IDENT; +import static no.nav.veilarbvedtaksstotte.utils.TestData.VEDTAK_ID_THAT_DOES_NOT_EXIST; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; public class KilderRepositoryTest extends DatabaseTest { diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/repository/MeldingRepositoryTest.java b/src/test/java/no/nav/veilarbvedtaksstotte/repository/MeldingRepositoryTest.java index 8a6f94cd..69980838 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/repository/MeldingRepositoryTest.java +++ b/src/test/java/no/nav/veilarbvedtaksstotte/repository/MeldingRepositoryTest.java @@ -11,8 +11,13 @@ import java.util.List; -import static no.nav.veilarbvedtaksstotte.utils.TestData.*; -import static org.junit.jupiter.api.Assertions.*; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_AKTOR_ID; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_DIALOG_MELDING; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_OPPFOLGINGSENHET_ID; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_VEILEDER_IDENT; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; public class MeldingRepositoryTest extends DatabaseTest { diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/repository/OyeblikksbildeRepositoryTest.java b/src/test/java/no/nav/veilarbvedtaksstotte/repository/OyeblikksbildeRepositoryTest.java index 65bafba2..125da725 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/repository/OyeblikksbildeRepositoryTest.java +++ b/src/test/java/no/nav/veilarbvedtaksstotte/repository/OyeblikksbildeRepositoryTest.java @@ -19,7 +19,10 @@ import java.util.List; -import static no.nav.veilarbvedtaksstotte.utils.TestData.*; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_AKTOR_ID; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_OPPFOLGINGSENHET_ID; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_VEILEDER_IDENT; +import static no.nav.veilarbvedtaksstotte.utils.TestData.VEDTAK_ID_THAT_DOES_NOT_EXIST; import static no.nav.veilarbvedtaksstotte.utils.TestUtils.readTestResourceFile; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrowsExactly; diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/repository/UtrullingRepositoryTest.java b/src/test/java/no/nav/veilarbvedtaksstotte/repository/UtrullingRepositoryTest.java index f14cbb5c..f6819e41 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/repository/UtrullingRepositoryTest.java +++ b/src/test/java/no/nav/veilarbvedtaksstotte/repository/UtrullingRepositoryTest.java @@ -10,7 +10,10 @@ import java.util.List; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; public class UtrullingRepositoryTest extends DatabaseTest { diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/repository/VedtaksstotteRepositoryTest.java b/src/test/java/no/nav/veilarbvedtaksstotte/repository/VedtaksstotteRepositoryTest.java index 29c418cd..b483fa6c 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/repository/VedtaksstotteRepositoryTest.java +++ b/src/test/java/no/nav/veilarbvedtaksstotte/repository/VedtaksstotteRepositoryTest.java @@ -19,8 +19,20 @@ import static no.nav.veilarbvedtaksstotte.domain.vedtak.BeslutterProsessStatus.KLAR_TIL_BESLUTTER; import static no.nav.veilarbvedtaksstotte.domain.vedtak.VedtakStatus.SENDT; import static no.nav.veilarbvedtaksstotte.domain.vedtak.VedtakStatus.UTKAST; -import static no.nav.veilarbvedtaksstotte.utils.TestData.*; -import static org.junit.Assert.*; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_AKTOR_ID; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_BEGRUNNELSE; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_BESLUTTER_IDENT; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_DOKUMENT_BESTILLING_ID; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_DOKUMENT_ID; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_JOURNALPOST_ID; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_KILDER; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_OPPFOLGINGSENHET_ID; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_VEILEDER_IDENT; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; public class VedtaksstotteRepositoryTest extends DatabaseTest { diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/schedule/DistribuerJournalforteVedtakScheduleTest.kt b/src/test/java/no/nav/veilarbvedtaksstotte/schedule/DistribuerJournalforteVedtakScheduleTest.kt index 547221e3..ad2037b4 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/schedule/DistribuerJournalforteVedtakScheduleTest.kt +++ b/src/test/java/no/nav/veilarbvedtaksstotte/schedule/DistribuerJournalforteVedtakScheduleTest.kt @@ -2,10 +2,12 @@ package no.nav.veilarbvedtaksstotte.schedule import no.nav.common.job.leader_election.LeaderElectionClient import no.nav.common.types.identer.AktorId -import no.nav.veilarbvedtaksstotte.client.dokdistfordeling.dto.DistribuerJournalpostResponsDTO import no.nav.veilarbvedtaksstotte.client.dokdistfordeling.DokdistribusjonClient +import no.nav.veilarbvedtaksstotte.client.dokdistfordeling.dto.DistribuerJournalpostResponsDTO import no.nav.veilarbvedtaksstotte.domain.DistribusjonBestillingId -import no.nav.veilarbvedtaksstotte.domain.DistribusjonBestillingId.* +import no.nav.veilarbvedtaksstotte.domain.DistribusjonBestillingId.Feilet +import no.nav.veilarbvedtaksstotte.domain.DistribusjonBestillingId.Mangler +import no.nav.veilarbvedtaksstotte.domain.DistribusjonBestillingId.Uuid import no.nav.veilarbvedtaksstotte.repository.VedtaksstotteRepository import no.nav.veilarbvedtaksstotte.service.DistribusjonService import no.nav.veilarbvedtaksstotte.utils.DatabaseTest @@ -15,7 +17,12 @@ import org.junit.jupiter.api.Assertions.assertNotNull import org.junit.jupiter.api.BeforeAll import org.junit.jupiter.api.Test import org.mockito.Mockito -import org.mockito.Mockito.* +import org.mockito.Mockito.mock +import org.mockito.Mockito.never +import org.mockito.Mockito.reset +import org.mockito.Mockito.times +import org.mockito.Mockito.verify +import org.mockito.Mockito.`when` import java.time.LocalDateTime import java.time.LocalDateTime.now diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/schedule/SlettUtkastScheduleTest.java b/src/test/java/no/nav/veilarbvedtaksstotte/schedule/SlettUtkastScheduleTest.java index d0274130..03db92ca 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/schedule/SlettUtkastScheduleTest.java +++ b/src/test/java/no/nav/veilarbvedtaksstotte/schedule/SlettUtkastScheduleTest.java @@ -4,8 +4,8 @@ import no.nav.common.job.leader_election.LeaderElectionClient; import no.nav.common.types.identer.AktorId; import no.nav.common.types.identer.Fnr; -import no.nav.veilarbvedtaksstotte.client.veilarboppfolging.dto.OppfolgingPeriodeDTO; import no.nav.veilarbvedtaksstotte.client.veilarboppfolging.VeilarboppfolgingClient; +import no.nav.veilarbvedtaksstotte.client.veilarboppfolging.dto.OppfolgingPeriodeDTO; import no.nav.veilarbvedtaksstotte.repository.VedtaksstotteRepository; import no.nav.veilarbvedtaksstotte.service.VedtakService; import no.nav.veilarbvedtaksstotte.utils.DatabaseTest; @@ -20,7 +20,13 @@ import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_OPPFOLGINGSENHET_ID; import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_VEILEDER_IDENT; import static org.apache.commons.lang3.RandomStringUtils.randomNumeric; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.argThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; public class SlettUtkastScheduleTest extends DatabaseTest { diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/service/ArenaVedtakServiceTest.java b/src/test/java/no/nav/veilarbvedtaksstotte/service/ArenaVedtakServiceTest.java index c63badeb..454a44a0 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/service/ArenaVedtakServiceTest.java +++ b/src/test/java/no/nav/veilarbvedtaksstotte/service/ArenaVedtakServiceTest.java @@ -20,7 +20,12 @@ import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_FNR; import static no.nav.veilarbvedtaksstotte.utils.TimeUtils.now; import static org.apache.commons.lang3.RandomStringUtils.randomNumeric; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/service/AuthServiceTest.kt b/src/test/java/no/nav/veilarbvedtaksstotte/service/AuthServiceTest.kt index 3e1dd4df..399224df 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/service/AuthServiceTest.kt +++ b/src/test/java/no/nav/veilarbvedtaksstotte/service/AuthServiceTest.kt @@ -7,7 +7,6 @@ import no.nav.common.client.aktoroppslag.AktorOppslagClient import no.nav.common.test.auth.AuthTestUtils.createAuthContext import no.nav.common.types.identer.AktorId import no.nav.common.types.identer.EnhetId -import no.nav.common.utils.Credentials import no.nav.common.utils.fn.UnsafeRunnable import no.nav.poao_tilgang.client.Decision import no.nav.poao_tilgang.client.NavAnsattTilgangTilNavEnhetPolicyInput @@ -15,11 +14,15 @@ import no.nav.poao_tilgang.client.PoaoTilgangClient import no.nav.poao_tilgang.client.api.ApiResult import no.nav.veilarbvedtaksstotte.utils.TestData import no.nav.veilarbvedtaksstotte.utils.TestUtils.assertThrowsWithMessage -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertFalse +import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.mockito.ArgumentMatchers.any -import org.mockito.Mockito.* +import org.mockito.Mockito.mock +import org.mockito.Mockito.times +import org.mockito.Mockito.`when` import org.mockito.kotlin.whenever import org.springframework.web.server.ResponseStatusException import java.util.* @@ -29,7 +32,6 @@ class AuthServiceTest { var aktorOppslagClient = mock(AktorOppslagClient::class.java) var veilarbarenaService = mock(VeilarbarenaService::class.java) var utrullingService = mock(UtrullingService::class.java) - var serviceUserCredentials = mock(Credentials::class.java) var poaoTilgangClient = org.mockito.kotlin.mock() var authService = AuthService(aktorOppslagClient, veilarbarenaService, authContextHolder, utrullingService, poaoTilgangClient) diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/service/BeslutterServiceTest.java b/src/test/java/no/nav/veilarbvedtaksstotte/service/BeslutterServiceTest.java index 3c876f15..9a0f571f 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/service/BeslutterServiceTest.java +++ b/src/test/java/no/nav/veilarbvedtaksstotte/service/BeslutterServiceTest.java @@ -20,10 +20,28 @@ import org.springframework.transaction.support.TransactionTemplate; import org.springframework.web.server.ResponseStatusException; -import static no.nav.veilarbvedtaksstotte.domain.vedtak.BeslutterProsessStatus.*; -import static no.nav.veilarbvedtaksstotte.utils.TestData.*; +import static no.nav.veilarbvedtaksstotte.domain.vedtak.BeslutterProsessStatus.GODKJENT_AV_BESLUTTER; +import static no.nav.veilarbvedtaksstotte.domain.vedtak.BeslutterProsessStatus.KLAR_TIL_BESLUTTER; +import static no.nav.veilarbvedtaksstotte.domain.vedtak.BeslutterProsessStatus.KLAR_TIL_VEILEDER; +import static no.nav.veilarbvedtaksstotte.utils.TestData.SOME_ID; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_AKTOR_ID; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_BESLUTTER_IDENT; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_FNR; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_IKKE_ANSVARLIG_VEILEDER_IDENT; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_OPPFOLGINGSENHET_ID; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_OPPFOLGINGSENHET_NAVN; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_VEILEDER_IDENT; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_VEILEDER_NAVN; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.anyLong; +import static org.mockito.Mockito.anyString; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; public class BeslutterServiceTest { diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/service/BeslutteroversiktServiceTest.java b/src/test/java/no/nav/veilarbvedtaksstotte/service/BeslutteroversiktServiceTest.java index a6532466..91970a3f 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/service/BeslutteroversiktServiceTest.java +++ b/src/test/java/no/nav/veilarbvedtaksstotte/service/BeslutteroversiktServiceTest.java @@ -1,8 +1,8 @@ package no.nav.veilarbvedtaksstotte.service; +import no.nav.veilarbvedtaksstotte.client.veilederogenhet.VeilarbveilederClient; import no.nav.veilarbvedtaksstotte.client.veilederogenhet.dto.PortefoljeEnhet; import no.nav.veilarbvedtaksstotte.client.veilederogenhet.dto.VeilederEnheterDTO; -import no.nav.veilarbvedtaksstotte.client.veilederogenhet.VeilarbveilederClient; import no.nav.veilarbvedtaksstotte.domain.beslutteroversikt.BeslutteroversiktBruker; import no.nav.veilarbvedtaksstotte.domain.beslutteroversikt.BeslutteroversiktSok; import no.nav.veilarbvedtaksstotte.domain.beslutteroversikt.BeslutteroversiktSokFilter; @@ -12,12 +12,23 @@ import org.mockito.ArgumentCaptor; import org.springframework.web.server.ResponseStatusException; -import java.util.*; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_VEILEDER_IDENT; import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.anyList; +import static org.mockito.Mockito.anyString; +import static org.mockito.Mockito.atLeastOnce; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; public class BeslutteroversiktServiceTest { diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/service/DistribusjonServiceTest.kt b/src/test/java/no/nav/veilarbvedtaksstotte/service/DistribusjonServiceTest.kt index 0bb48013..4b64c62a 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/service/DistribusjonServiceTest.kt +++ b/src/test/java/no/nav/veilarbvedtaksstotte/service/DistribusjonServiceTest.kt @@ -1,6 +1,12 @@ package no.nav.veilarbvedtaksstotte.service -import com.github.tomakehurst.wiremock.client.WireMock.* +import com.github.tomakehurst.wiremock.client.WireMock.aResponse +import com.github.tomakehurst.wiremock.client.WireMock.exactly +import com.github.tomakehurst.wiremock.client.WireMock.givenThat +import com.github.tomakehurst.wiremock.client.WireMock.post +import com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor +import com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo +import com.github.tomakehurst.wiremock.client.WireMock.verify import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo import com.github.tomakehurst.wiremock.junit5.WireMockTest import no.nav.common.types.identer.AktorId @@ -14,7 +20,10 @@ import no.nav.veilarbvedtaksstotte.utils.DatabaseTest import no.nav.veilarbvedtaksstotte.utils.TestUtils.assertThrowsWithMessage import no.nav.veilarbvedtaksstotte.utils.toJson import org.apache.commons.lang3.RandomStringUtils -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertFalse +import org.junit.jupiter.api.Assertions.assertNotNull +import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.BeforeAll import org.junit.jupiter.api.Test import org.springframework.http.HttpStatus diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/service/DokumentServiceTest.kt b/src/test/java/no/nav/veilarbvedtaksstotte/service/DokumentServiceTest.kt index 093b2fe4..6863efa9 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/service/DokumentServiceTest.kt +++ b/src/test/java/no/nav/veilarbvedtaksstotte/service/DokumentServiceTest.kt @@ -1,6 +1,11 @@ package no.nav.veilarbvedtaksstotte.service -import com.github.tomakehurst.wiremock.client.WireMock.* +import com.github.tomakehurst.wiremock.client.WireMock.aResponse +import com.github.tomakehurst.wiremock.client.WireMock.containing +import com.github.tomakehurst.wiremock.client.WireMock.equalToJson +import com.github.tomakehurst.wiremock.client.WireMock.givenThat +import com.github.tomakehurst.wiremock.client.WireMock.post +import com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo import com.github.tomakehurst.wiremock.junit5.WireMockTest import com.nimbusds.jose.util.Base64 @@ -22,7 +27,11 @@ import no.nav.veilarbvedtaksstotte.client.dokarkiv.DokarkivClientImpl import no.nav.veilarbvedtaksstotte.client.dokarkiv.request.OpprettetJournalpostDTO import no.nav.veilarbvedtaksstotte.client.dokument.MalType import no.nav.veilarbvedtaksstotte.client.dokument.ProduserDokumentDTO -import no.nav.veilarbvedtaksstotte.client.norg2.* +import no.nav.veilarbvedtaksstotte.client.norg2.EnhetKontaktinformasjon +import no.nav.veilarbvedtaksstotte.client.norg2.EnhetOrganiserer +import no.nav.veilarbvedtaksstotte.client.norg2.EnhetPostboksadresse +import no.nav.veilarbvedtaksstotte.client.norg2.Norg2Client +import no.nav.veilarbvedtaksstotte.client.norg2.Norg2ClientImpl import no.nav.veilarbvedtaksstotte.client.pdf.PdfClient import no.nav.veilarbvedtaksstotte.client.pdf.PdfClientImpl import no.nav.veilarbvedtaksstotte.client.person.BehandlingsNummer diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/service/EnhetInfoServiceTest.kt b/src/test/java/no/nav/veilarbvedtaksstotte/service/EnhetInfoServiceTest.kt index 894ddb84..2dcf2735 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/service/EnhetInfoServiceTest.kt +++ b/src/test/java/no/nav/veilarbvedtaksstotte/service/EnhetInfoServiceTest.kt @@ -3,7 +3,11 @@ package no.nav.veilarbvedtaksstotte.service import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo import com.github.tomakehurst.wiremock.junit5.WireMockTest import no.nav.common.types.identer.EnhetId -import no.nav.veilarbvedtaksstotte.client.norg2.* +import no.nav.veilarbvedtaksstotte.client.norg2.EnhetKontaktinformasjon +import no.nav.veilarbvedtaksstotte.client.norg2.EnhetPostboksadresse +import no.nav.veilarbvedtaksstotte.client.norg2.EnhetStedsadresse +import no.nav.veilarbvedtaksstotte.client.norg2.Norg2Client +import no.nav.veilarbvedtaksstotte.client.norg2.Norg2ClientImpl import no.nav.veilarbvedtaksstotte.utils.TestUtils.givenWiremockOkJsonResponse import no.nav.veilarbvedtaksstotte.utils.TestUtils.readTestResourceFile import org.assertj.core.api.Assertions diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/service/KafkaConsumerServiceTest.java b/src/test/java/no/nav/veilarbvedtaksstotte/service/KafkaConsumerServiceTest.java index e8fc47d7..ee9d31b2 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/service/KafkaConsumerServiceTest.java +++ b/src/test/java/no/nav/veilarbvedtaksstotte/service/KafkaConsumerServiceTest.java @@ -17,8 +17,18 @@ import java.time.ZonedDateTime; import java.util.UUID; -import static no.nav.veilarbvedtaksstotte.utils.TestData.*; -import static org.mockito.Mockito.*; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_AKTOR_ID; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_FNR; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_OPPFOLGINGSENHET_ID; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_VEILEDER_IDENT; +import static org.mockito.Mockito.anyLong; +import static org.mockito.Mockito.anyString; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; public class KafkaConsumerServiceTest { diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/service/KafkaProducerServiceTest.kt b/src/test/java/no/nav/veilarbvedtaksstotte/service/KafkaProducerServiceTest.kt index c9d48896..b2d57c54 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/service/KafkaProducerServiceTest.kt +++ b/src/test/java/no/nav/veilarbvedtaksstotte/service/KafkaProducerServiceTest.kt @@ -13,7 +13,10 @@ import no.nav.veilarbvedtaksstotte.domain.vedtak.Innsatsgruppe.STANDARD_INNSATS import no.nav.veilarbvedtaksstotte.domain.vedtak.Siste14aVedtak import no.nav.veilarbvedtaksstotte.domain.vedtak.Siste14aVedtak.HovedmalMedOkeDeltakelse.SKAFFE_ARBEID import no.nav.veilarbvedtaksstotte.utils.JsonUtils -import no.nav.veilarbvedtaksstotte.utils.TestData.* +import no.nav.veilarbvedtaksstotte.utils.TestData.TEST_AKTOR_ID +import no.nav.veilarbvedtaksstotte.utils.TestData.TEST_OPPFOLGINGSENHET_ID +import no.nav.veilarbvedtaksstotte.utils.TestData.TEST_VEILEDER_IDENT +import no.nav.veilarbvedtaksstotte.utils.TestData.TEST_VEILEDER_NAVN import org.apache.kafka.clients.producer.ProducerRecord import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/service/Siste14aVedtakServiceTest.kt b/src/test/java/no/nav/veilarbvedtaksstotte/service/Siste14aVedtakServiceTest.kt index 7bf73ff2..4504a250 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/service/Siste14aVedtakServiceTest.kt +++ b/src/test/java/no/nav/veilarbvedtaksstotte/service/Siste14aVedtakServiceTest.kt @@ -10,10 +10,16 @@ import no.nav.veilarbvedtaksstotte.domain.vedtak.Siste14aVedtak.HovedmalMedOkeDe import no.nav.veilarbvedtaksstotte.utils.AbstractVedtakIntegrationTest import no.nav.veilarbvedtaksstotte.utils.TimeUtils.now import no.nav.veilarbvedtaksstotte.utils.TimeUtils.toZonedDateTime -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertNotNull +import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.mockito.Mockito.* +import org.mockito.Mockito.any +import org.mockito.Mockito.eq +import org.mockito.Mockito.never +import org.mockito.Mockito.reset +import org.mockito.Mockito.verify import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.mock.mockito.MockBean import java.time.LocalDate diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/service/VedtakServiceTest.java b/src/test/java/no/nav/veilarbvedtaksstotte/service/VedtakServiceTest.java index bc4f46fe..63614f93 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/service/VedtakServiceTest.java +++ b/src/test/java/no/nav/veilarbvedtaksstotte/service/VedtakServiceTest.java @@ -9,7 +9,6 @@ import no.nav.common.test.auth.AuthTestUtils; import no.nav.common.types.identer.AktorId; import no.nav.common.types.identer.EnhetId; -import no.nav.common.utils.Credentials; import no.nav.common.utils.fn.UnsafeRunnable; import no.nav.poao_tilgang.client.Decision; import no.nav.poao_tilgang.client.PoaoTilgangClient; @@ -53,7 +52,11 @@ import no.nav.veilarbvedtaksstotte.domain.vedtak.Innsatsgruppe; import no.nav.veilarbvedtaksstotte.domain.vedtak.Vedtak; import no.nav.veilarbvedtaksstotte.domain.vedtak.VedtakStatus; -import no.nav.veilarbvedtaksstotte.repository.*; +import no.nav.veilarbvedtaksstotte.repository.BeslutteroversiktRepository; +import no.nav.veilarbvedtaksstotte.repository.KilderRepository; +import no.nav.veilarbvedtaksstotte.repository.MeldingRepository; +import no.nav.veilarbvedtaksstotte.repository.OyeblikksbildeRepository; +import no.nav.veilarbvedtaksstotte.repository.VedtaksstotteRepository; import no.nav.veilarbvedtaksstotte.utils.DatabaseTest; import no.nav.veilarbvedtaksstotte.utils.DbTestUtils; import no.nav.veilarbvedtaksstotte.utils.JsonUtils; @@ -63,16 +66,43 @@ import org.springframework.web.server.ResponseStatusException; import java.time.LocalDateTime; -import java.util.*; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Optional; +import java.util.UUID; import static no.nav.veilarbvedtaksstotte.client.regoppslag.RegoppslagResponseDTO.AdresseType.NORSKPOSTADRESSE; -import static no.nav.veilarbvedtaksstotte.utils.TestData.*; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_AKTOR_ID; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_DOKUMENT_ID; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_FNR; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_JOURNALPOST_ID; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_KILDER; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_OPPFOLGINGSENHET_ID; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_OPPFOLGINGSENHET_NAVN; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_OPPFOLGINGSSAK; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_VEILEDER_IDENT; +import static no.nav.veilarbvedtaksstotte.utils.TestData.TEST_VEILEDER_NAVN; import static no.nav.veilarbvedtaksstotte.utils.TestUtils.readTestResourceFile; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.Mockito.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.anyLong; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.reset; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; public class VedtakServiceTest extends DatabaseTest { @@ -105,7 +135,6 @@ public class VedtakServiceTest extends DatabaseTest { private static final SafClient safClient = mock(SafClient.class); private static final MetricsService metricsService = mock(MetricsService.class); - private static final Credentials credentials = mock(Credentials.class); private static final PoaoTilgangClient poaoTilgangClient = mock(PoaoTilgangClient.class); private static final PdfService pdfService = mock(PdfService.class); diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/service/VedtakServiceValiderVedtakForFerdigstillingOgUtsendingTest.kt b/src/test/java/no/nav/veilarbvedtaksstotte/service/VedtakServiceValiderVedtakForFerdigstillingOgUtsendingTest.kt index 58ceffd7..69e4425d 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/service/VedtakServiceValiderVedtakForFerdigstillingOgUtsendingTest.kt +++ b/src/test/java/no/nav/veilarbvedtaksstotte/service/VedtakServiceValiderVedtakForFerdigstillingOgUtsendingTest.kt @@ -1,6 +1,10 @@ package no.nav.veilarbvedtaksstotte.service -import no.nav.veilarbvedtaksstotte.domain.vedtak.* +import no.nav.veilarbvedtaksstotte.domain.vedtak.BeslutterProsessStatus +import no.nav.veilarbvedtaksstotte.domain.vedtak.Hovedmal +import no.nav.veilarbvedtaksstotte.domain.vedtak.Innsatsgruppe +import no.nav.veilarbvedtaksstotte.domain.vedtak.Vedtak +import no.nav.veilarbvedtaksstotte.domain.vedtak.VedtakStatus import no.nav.veilarbvedtaksstotte.service.VedtakService.validerVedtakForFerdigstilling import no.nav.veilarbvedtaksstotte.utils.TestData import no.nav.veilarbvedtaksstotte.utils.TestUtils.assertThrowsWithMessage diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/utils/OppfolgingUtilsTest.java b/src/test/java/no/nav/veilarbvedtaksstotte/utils/OppfolgingUtilsTest.java index cc06ea55..c06d523f 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/utils/OppfolgingUtilsTest.java +++ b/src/test/java/no/nav/veilarbvedtaksstotte/utils/OppfolgingUtilsTest.java @@ -8,7 +8,8 @@ import java.util.Optional; import static java.time.ZonedDateTime.now; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; public class OppfolgingUtilsTest { diff --git a/src/test/java/no/nav/veilarbvedtaksstotte/utils/TimeUtilsTest.kt b/src/test/java/no/nav/veilarbvedtaksstotte/utils/TimeUtilsTest.kt index f7b09a2d..74687a02 100644 --- a/src/test/java/no/nav/veilarbvedtaksstotte/utils/TimeUtilsTest.kt +++ b/src/test/java/no/nav/veilarbvedtaksstotte/utils/TimeUtilsTest.kt @@ -4,7 +4,11 @@ import no.nav.veilarbvedtaksstotte.utils.TimeUtils.toLocalDate import no.nav.veilarbvedtaksstotte.utils.TimeUtils.toLocalDateTime import org.junit.Assert.assertEquals import org.junit.jupiter.api.Test -import java.time.* +import java.time.LocalDate +import java.time.LocalDateTime +import java.time.LocalTime +import java.time.ZoneId +import java.time.ZonedDateTime class TimeUtilsTest { diff --git a/src/test/resources/application-test.properties b/src/test/resources/application-test.properties index 055ff016..f4f8879c 100644 --- a/src/test/resources/application-test.properties +++ b/src/test/resources/application-test.properties @@ -1,7 +1,3 @@ -app.env.openAmDiscoveryUrl=test -app.env.veilarbloginOpenAmClientId=test -app.env.stsDiscoveryUrl=test -app.env.openAmRefreshUrl=test app.env.dbUrl=test app.env.unleashUrl=test app.env.norg2Url=test