diff --git a/.github/workflows/app.arbeidsforhold-export-api.yml b/.github/workflows/app.arbeidsforhold-export-api.yml deleted file mode 100644 index 3ba91ed7377..00000000000 --- a/.github/workflows/app.arbeidsforhold-export-api.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: arbeidsforhold-export-api - -on: - push: - paths: - - libs/csv-converter - - libs/servlet-core - - libs/servlet-security - - xsd/arbeidsforhold-xsd - - apps/arbeidsforhold-export-api/** - - .github/workflows/app.arbeidsforhold-export-api.yml - -jobs: - workflow: - uses: ./.github/workflows/common.workflow.backend.yml - with: - cluster: "dev-fss" - working-directory: "apps/arbeidsforhold-export-api" - deploy-tag: "#deploy-arbeidsforhold-export-api" - permissions: - contents: read - id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/app.testnorge-tp.yml b/.github/workflows/app.testnorge-tp.yml deleted file mode 100644 index a71a62ccd39..00000000000 --- a/.github/workflows/app.testnorge-tp.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: testnorge-tp - -on: - push: - paths: - - libs/security-core - - libs/servlet-core - - libs/servlet-security - - apps/testnorge-tp/** - - .github/workflows/app.testnorge-tp.yml - -jobs: - workflow: - uses: ./.github/workflows/common.workflow.backend.yml - with: - cluster: "dev-fss" - working-directory: "apps/testnorge-tp" - deploy-tag: "#deploy-testnorge-tp" - permissions: - contents: read - id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/proxy.statisk-data-forvalter-proxy.yml b/.github/workflows/proxy.statisk-data-forvalter-proxy.yml deleted file mode 100644 index 8e3de7516dd..00000000000 --- a/.github/workflows/proxy.statisk-data-forvalter-proxy.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: statisk-data-forvalter-proxy - -on: - push: - paths: - - libs/reactive-core - - libs/reactive-proxy - - libs/reactive-security - - libs/security-core - - proxies/statisk-data-forvalter-proxy/** - - .github/workflows/proxy.statisk-data-forvalter-proxy.yml - -jobs: - workflow: - uses: ./.github/workflows/common.workflow.backend.yml - with: - cluster: "dev-fss" - working-directory: "proxies/statisk-data-forvalter-proxy" - deploy-tag: "#deploy-proxy" - permissions: - contents: read - id-token: write - secrets: - NAIS_DOLLY_DEPLOY_API_KEY: ${{ secrets.NAIS_DOLLY_DEPLOY_API_KEY }} - NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} - NAV_TOKEN: ${{ secrets.NAV_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/apps/app-tilgang-analyse-service/src/main/java/no/nav/testnav/apps/apptilganganalyseservice/AppTilgangAnalyseServiceApplicationStarter.java b/apps/app-tilgang-analyse-service/src/main/java/no/nav/testnav/apps/apptilganganalyseservice/AppTilgangAnalyseServiceApplicationStarter.java index 293c2c8931f..9c51de93593 100644 --- a/apps/app-tilgang-analyse-service/src/main/java/no/nav/testnav/apps/apptilganganalyseservice/AppTilgangAnalyseServiceApplicationStarter.java +++ b/apps/app-tilgang-analyse-service/src/main/java/no/nav/testnav/apps/apptilganganalyseservice/AppTilgangAnalyseServiceApplicationStarter.java @@ -18,4 +18,4 @@ public class AppTilgangAnalyseServiceApplicationStarter { public static void main(String[] args) { SpringApplication.run(AppTilgangAnalyseServiceApplicationStarter.class, args); } -} \ No newline at end of file +} diff --git a/apps/arbeidsforhold-export-api/Dockerfile b/apps/arbeidsforhold-export-api/Dockerfile deleted file mode 100644 index 68d3c407ce4..00000000000 --- a/apps/arbeidsforhold-export-api/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM ghcr.io/navikt/baseimages/temurin:21 -LABEL maintainer="Team Dolly" - -ENV JAVA_OPTS="-Dspring.profiles.active=prod -Xmx2g -Xms1g" - -ADD /build/libs/app.jar /app/app.jar - -EXPOSE 8080 diff --git a/apps/arbeidsforhold-export-api/README.md b/apps/arbeidsforhold-export-api/README.md deleted file mode 100644 index c12e2ddab90..00000000000 --- a/apps/arbeidsforhold-export-api/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# Arbeidsforhold-export-api -Api for å eksportere arbeidsforhold fra database. - -!!! Trenger oppdatering. - -## Swagger -Swagger finnes under [/swagger](https://testnorge-arbeidsforhold-export-api.dev.intern.nav.no/swagger) -endepunktet til applikasjonen. - -## Lokal kjøring -Ha naisdevice kjørende og kjør ArbeidsforholdExportApiApplicationStarter med følgende argumenter: -``` --Dspring.cloud.vault.token=[vault-token] --Dspring.profiles.active=dev -``` - -### Utviklerimage -I utviklerimage brukes ikke naisdevice og du må legge til følgende ekstra argumenter: -``` --Djavax.net.ssl.trustStore=[path til lokal truststore] --Djavax.net.ssl.trustStorePassword=[passord til lokal truststore] -``` - diff --git a/apps/arbeidsforhold-export-api/build.gradle b/apps/arbeidsforhold-export-api/build.gradle deleted file mode 100644 index 67cc0c78714..00000000000 --- a/apps/arbeidsforhold-export-api/build.gradle +++ /dev/null @@ -1,92 +0,0 @@ -plugins { - id 'java' - id "org.sonarqube" version "4.0.0.2929" - id 'org.springframework.boot' version "3.1.4" - id 'io.spring.dependency-management' version "1.1.3" - id "jacoco" -} - -test { - useJUnitPlatform() -} - -jacocoTestReport { - reports { - xml.required = true - } -} - -sonarqube { - properties { - property "sonar.coverage.jacoco.xmlReportPaths", "${project.buildDir}/reports/jacoco/test/jacocoTestReport.xml" - property "sonar.dynamicAnalysis", "reuseReports" - property "sonar.host.url", "https://sonarcloud.io" - property "sonar.java.coveragePlugin", "jacoco" - property "sonar.language", "java" - property "sonar.login", System.getenv("SONAR_TOKEN") - property "sonar.organization", "navikt" - property "sonar.project.monorepo.enabled", true - property "sonar.projectKey", "testnav-arbeidsforhold-export-api" - property "sonar.projectName", "testnav-arbeidsforhold-export-api" - property "sonar.sourceEncoding", "UTF-8" - } -} - - -bootJar { - archiveFileName = "app.jar" -} - -dependencyManagement { - applyMavenExclusions = false - imports { - mavenBom 'org.springframework.cloud:spring-cloud-dependencies:2022.0.4' - } -} - -repositories { - mavenCentral() - mavenLocal() -} - -dependencies { - - implementation 'no.nav.testnav.xsd:arbeidsforhold-xsd' - implementation 'no.nav.testnav.libs:servlet-core' - implementation 'no.nav.testnav.libs:csv-converter' - implementation 'no.nav.testnav.libs:servlet-security' - - implementation 'org.springframework.boot:spring-boot-starter-web' - implementation 'org.springframework.boot:spring-boot-starter-webflux' - implementation 'org.springframework.boot:spring-boot-starter-oauth2-client' - implementation 'org.springframework.boot:spring-boot-starter-security' - implementation 'org.springframework.boot:spring-boot-starter-jdbc' - - implementation 'org.springframework.cloud:spring-cloud-starter-vault-config' - - implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap' // TODO remove legacy bootstrap config - implementation 'org.springframework.boot:spring-boot-starter-actuator' - - implementation 'io.micrometer:micrometer-registry-prometheus' - implementation 'org.apache.commons:commons-csv:1.10.0' - implementation 'jakarta.annotation:jakarta.annotation-api:2.1.1' - implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0' - implementation 'io.swagger.core.v3:swagger-annotations-jakarta:2.2.16' - - implementation 'org.hibernate.validator:hibernate-validator' - - implementation 'net.logstash.logback:logstash-logback-encoder:7.4' - runtimeOnly 'com.oracle.database.jdbc:ojdbc8' - - testImplementation 'org.springframework.boot:spring-boot-starter-test' - testImplementation 'org.springframework.cloud:spring-cloud-contract-wiremock' - - implementation 'org.projectlombok:lombok' - annotationProcessor 'org.projectlombok:lombok' - testAnnotationProcessor 'org.projectlombok:lombok' -} -java { - toolchain { - languageVersion = JavaLanguageVersion.of(21) - } -} diff --git a/apps/arbeidsforhold-export-api/config.yml b/apps/arbeidsforhold-export-api/config.yml deleted file mode 100644 index 6e8ed0fd6f1..00000000000 --- a/apps/arbeidsforhold-export-api/config.yml +++ /dev/null @@ -1,52 +0,0 @@ -apiVersion: "nais.io/v1alpha1" -kind: "Application" -metadata: - name: testnorge-arbeidsforhold-export-api - namespace: dolly - labels: - team: dolly -spec: - image: {{ image }} - port: 8080 - webproxy: true - accessPolicy: - inbound: - rules: - - application: team-dolly-lokal-app - cluster: dev-gcp - - application: testnav-oversikt-frontend - cluster: dev-gcp - tokenx: - enabled: true - azure: - application: - allowAllUsers: true - enabled: true - tenant: nav.no - liveness: - path: /internal/isAlive - initialDelay: 4 - periodSeconds: 5 - failureThreshold: 500 - readiness: - path: /internal/isReady - initialDelay: 4 - periodSeconds: 5 - failureThreshold: 500 - prometheus: - enabled: true - path: /internal/metrics - replicas: - min: 1 - max: 1 - vault: - enabled: true - resources: - requests: - cpu: 200m - memory: 1024Mi - limits: - memory: 4096Mi - ingresses: - - "https://testnorge-arbeidsforhold-export-api.dev.intern.nav.no" # dev-fss - diff --git a/apps/arbeidsforhold-export-api/gradle/wrapper/gradle-wrapper.jar b/apps/arbeidsforhold-export-api/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 7454180f2ae..00000000000 Binary files a/apps/arbeidsforhold-export-api/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/apps/arbeidsforhold-export-api/gradle/wrapper/gradle-wrapper.properties b/apps/arbeidsforhold-export-api/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index e411586a54a..00000000000 --- a/apps/arbeidsforhold-export-api/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/apps/arbeidsforhold-export-api/gradlew b/apps/arbeidsforhold-export-api/gradlew deleted file mode 100755 index 3da45c161b0..00000000000 --- a/apps/arbeidsforhold-export-api/gradlew +++ /dev/null @@ -1,234 +0,0 @@ -#!/bin/sh - -# -# Copyright ? 2015-2021 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions ?$var?, ?${var}?, ?${var:-default}?, ?${var+SET}?, -# ?${var#prefix}?, ?${var%suffix}?, and ?$( cmd )?; -# * compound commands having a testable exit status, especially ?case?; -# * various built-in commands including ?command?, ?set?, and ?ulimit?. -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" -APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/apps/arbeidsforhold-export-api/gradlew.bat b/apps/arbeidsforhold-export-api/gradlew.bat deleted file mode 100644 index ac1b06f9382..00000000000 --- a/apps/arbeidsforhold-export-api/gradlew.bat +++ /dev/null @@ -1,89 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/apps/arbeidsforhold-export-api/gradlewUpdate.sh b/apps/arbeidsforhold-export-api/gradlewUpdate.sh deleted file mode 100755 index e5ee6361152..00000000000 --- a/apps/arbeidsforhold-export-api/gradlewUpdate.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -gradle wrapper \ No newline at end of file diff --git a/apps/arbeidsforhold-export-api/settings.gradle b/apps/arbeidsforhold-export-api/settings.gradle deleted file mode 100644 index dddd1167cdf..00000000000 --- a/apps/arbeidsforhold-export-api/settings.gradle +++ /dev/null @@ -1,18 +0,0 @@ -plugins { - id "com.gradle.enterprise" version "3.12.3" -} - -rootProject.name = 'arbeidsforhold-export-api' - -includeBuild '../../libs/servlet-core' -includeBuild '../../libs/servlet-security' -includeBuild '../../libs/csv-converter' - -includeBuild '../../xsd/arbeidsforhold-xsd' - -gradleEnterprise { - buildScan { - termsOfServiceUrl = "https://gradle.com/terms-of-service" - termsOfServiceAgree = "yes" - } -} \ No newline at end of file diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/ArbeidsforholdExportApiApplicationStarter.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/ArbeidsforholdExportApiApplicationStarter.java deleted file mode 100644 index 04e603aa454..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/ArbeidsforholdExportApiApplicationStarter.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class ArbeidsforholdExportApiApplicationStarter { - public static void main(String[] args) { - SpringApplication.run(ArbeidsforholdExportApiApplicationStarter.class, args); - } -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/config/AppConfig.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/config/AppConfig.java deleted file mode 100644 index 88a2b5123f9..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/config/AppConfig.java +++ /dev/null @@ -1,15 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.config; - -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; - -import no.nav.testnav.libs.servletcore.config.ApplicationCoreConfig; -import no.nav.testnav.libs.servletsecurity.config.SecureOAuth2ServerToServerConfiguration; - -@Configuration -@Import({ - ApplicationCoreConfig.class, - SecureOAuth2ServerToServerConfiguration.class -}) -public class AppConfig { -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/config/DevVaultConfig.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/config/DevVaultConfig.java deleted file mode 100644 index fb6de4d57d6..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/config/DevVaultConfig.java +++ /dev/null @@ -1,36 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.config; - -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; -import org.springframework.vault.annotation.VaultPropertySource; -import org.springframework.vault.authentication.ClientAuthentication; -import org.springframework.vault.authentication.TokenAuthentication; -import org.springframework.vault.client.VaultEndpoint; -import org.springframework.vault.config.AbstractVaultConfiguration; - -import static io.micrometer.common.util.StringUtils.isBlank; -@Configuration -@Profile("dev") -@VaultPropertySource(value = "secret/dolly/lokal", ignoreSecretNotFound = false) -@VaultPropertySource(value = "kv/preprod/fss/testnorge-arbeidsforhold-export-api/dev", ignoreSecretNotFound = false) -public class DevVaultConfig extends AbstractVaultConfiguration { - - private static final String VAULT_TOKEN = "spring.cloud.vault.token"; - - @Override - public VaultEndpoint vaultEndpoint() { - return VaultEndpoint.create("vault.adeo.no", 443); - } - - @Override - public ClientAuthentication clientAuthentication() { - if (System.getenv().containsKey("VAULT_TOKEN")) { - System.setProperty(VAULT_TOKEN, System.getenv("VAULT_TOKEN")); - } - var token = System.getProperty(VAULT_TOKEN); - if (isBlank(token)) { - throw new IllegalArgumentException("Påkrevet property 'spring.cloud.vault.token' er ikke satt."); - } - return new TokenAuthentication(System.getProperty(VAULT_TOKEN)); - } -} \ No newline at end of file diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/config/JDBCConfig.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/config/JDBCConfig.java deleted file mode 100644 index 7704f1b584a..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/config/JDBCConfig.java +++ /dev/null @@ -1,35 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.config; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.jdbc.datasource.DriverManagerDataSource; - -import javax.sql.DataSource; - -@Configuration -public class JDBCConfig { - private final String username; - private final String password; - private final String url; - - public JDBCConfig( - @Value("${database.aareg.username}") String username, - @Value("${database.aareg.password}") String password, - @Value("${database.aareg.url}") String url - ) { - this.username = username; - this.password = password; - this.url = url; - } - - @Bean - public DataSource dataSource() { - DriverManagerDataSource dataSource = new DriverManagerDataSource(); - dataSource.setDriverClassName("oracle.jdbc.driver.OracleDriver"); - dataSource.setUrl(url); - dataSource.setUsername(username); - dataSource.setPassword(password); - return dataSource; - } -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/config/OpenApiConfig.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/config/OpenApiConfig.java deleted file mode 100644 index 37021931563..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/config/OpenApiConfig.java +++ /dev/null @@ -1,55 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.config; - -import io.swagger.v3.oas.models.Components; -import io.swagger.v3.oas.models.OpenAPI; -import io.swagger.v3.oas.models.info.Contact; -import io.swagger.v3.oas.models.info.Info; -import io.swagger.v3.oas.models.info.License; -import io.swagger.v3.oas.models.security.SecurityRequirement; -import io.swagger.v3.oas.models.security.SecurityScheme; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -import java.util.Arrays; - -import no.nav.testnav.libs.servletcore.config.ApplicationProperties; - -@Configuration -public class OpenApiConfig implements WebMvcConfigurer { - - @Bean - public OpenAPI openApi(ApplicationProperties applicationProperties) { - return new OpenAPI() - .components(new Components().addSecuritySchemes("bearer-jwt", new SecurityScheme() - .type(SecurityScheme.Type.HTTP) - .scheme("bearer") - .bearerFormat("JWT") - .in(SecurityScheme.In.HEADER) - .name("Authorization") - )) - .addSecurityItem( - new SecurityRequirement().addList("bearer-jwt", Arrays.asList("read", "write"))) - .info(new Info() - .title(applicationProperties.getName()) - .version(applicationProperties.getVersion()) - .description(applicationProperties.getDescription()) - .termsOfService("https://nav.no") - .contact(new Contact() - .url("https://nav-it.slack.com/archives/CA3P9NGA2") - .email("dolly@nav.no") - .name("Team Dolly") - ) - .license(new License() - .name("MIT License") - .url("https://opensource.org/licenses/MIT") - ) - ); - } - - @Override - public void addViewControllers(ViewControllerRegistry registry) { - registry.addViewController("/swagger").setViewName("redirect:/swagger-ui.html"); - } -} \ No newline at end of file diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/config/SecurityConfig.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/config/SecurityConfig.java deleted file mode 100644 index 1557cf6b9df..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/config/SecurityConfig.java +++ /dev/null @@ -1,38 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; -import org.springframework.security.config.Customizer; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; -import org.springframework.security.config.http.SessionCreationPolicy; -import org.springframework.security.web.SecurityFilterChain; - -@EnableWebSecurity -@Configuration -@Profile({ "prod", "dev" }) -public class SecurityConfig { - - @Bean - public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception { - - httpSecurity.sessionManagement(sessionConfig -> sessionConfig.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) - .csrf(AbstractHttpConfigurer::disable) - .authorizeHttpRequests(authorizeConfig -> authorizeConfig.requestMatchers( - "/internal/**", - "/webjars/**", - "/swagger-resources/**", - "/v3/api-docs/**", - "/swagger-ui/**", - "/swagger", - "/error", - "/swagger-ui.html" - ).permitAll().requestMatchers("/api/**").fullyAuthenticated()) - .oauth2ResourceServer(oauth2RSConfig -> oauth2RSConfig.jwt(Customizer.withDefaults())); - - return httpSecurity.build(); - } -} - diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/converter/csv/ArbeidsforholdSyntetiseringCsvPrinterConverter.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/converter/csv/ArbeidsforholdSyntetiseringCsvPrinterConverter.java deleted file mode 100644 index 17d641a691b..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/converter/csv/ArbeidsforholdSyntetiseringCsvPrinterConverter.java +++ /dev/null @@ -1,100 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.converter.csv; - -import java.io.PrintWriter; -import java.util.HashMap; -import java.util.Map; - -import no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.Arbeidsforhold; -import no.nav.testnav.libs.csvconverter.CsvHeader; -import no.nav.testnav.libs.csvconverter.ObjectConverter; -import no.nav.testnav.libs.csvconverter.CsvPrinterConverter; - -public class ArbeidsforholdSyntetiseringCsvPrinterConverter extends CsvPrinterConverter { - - public ArbeidsforholdSyntetiseringCsvPrinterConverter(PrintWriter writer) { - super(writer); - } - - private enum Headers implements CsvHeader { - RAPPORTERINGSMAANED("RAPPORTERINGSMAANED"), - IDENT("IDENT"), - OPPLYSNINGSPLIKTIG("OPPLYSNINGSPLIKTIG"), - VIRKSOMHET("VIRKSOMHET"), - ARBEIDSFORHOLD_ID("ARBEIDSFORHOLD_ID"), - ARBEIDSFORHOLD_TYPE("ARBEIDSFORHOLD_TYPE"), - STARTDATO("STARTDATO"), - SLUTTDATO("SLUTTDATO"), - ANTALL_TIMER_PER_UKE_SOM_EN_FULL_STILLING_TILSVARER("ANTALL_TIMER_PER_UKE_SOM_EN_FULL_STILLING_TILSVARER"), - AVLOENNINGSTYPE("AVLOENNINGSTYPE"), - YRKE("YRKE"), - ARBEIDSTIDSORDNING("ARBEIDSTIDSORDNING"), - STILLINGSPROSENT("STILLINGSPROSENT"), - SISTE_LOENNSENDRINGSDATO("SISTE_LOENNSENDRINGSDATO"), - SISTE_DATO_FOR_STILLINGSPROSENTENDRING("SISTE_DATO_FOR_STILLINGSPROSENTENDRING"), - PERMISJON_MED_FORELDREPENGER("PERMISJON_MED_FORELDREPENGER"), - PERMITTERING("PERMITTERING"), - PERMISJON("PERMISJON"), - PERMISJON_VED_MILITAERTJENESTE("PERMISJON_VED_MILITAERTJENESTE"), - VELFERDSPERMISJON("VELFERDSPERMISJON"), - SKIPSREGISTER("SKIPSREGISTER"), - SKIPSTYPE("SKIPSTYPE"), - FARTSOMRAADE("FARTSOMRAADE"), - KILDEREFERANSE("KILDEREFERANSE"), - UTDANNINGSPERMISJON("UTDANNINGSPERMISJON"), - AARSAK_TIL_SLUTTDATO("AARSAK_TIL_SLUTTDATO"), - FORM_FOR_ANSETTELSE("FORM_FOR_ANSETTELSE"), - ANTALL_INNTEKTER("ANTALL_INNTEKTER"); - - private final String header; - - Headers(String header) { - this.header = header; - } - - @Override - public String getValue() { - return header; - } - } - - @Override - protected ObjectConverter getObjectConverter() { - return arbeidsforhold -> { - Map map = new HashMap<>(); - map.put(Headers.RAPPORTERINGSMAANED.getValue(), arbeidsforhold.getKalendermaaned()); - map.put(Headers.IDENT.getValue(), arbeidsforhold.getIdent()); - map.put(Headers.OPPLYSNINGSPLIKTIG.getValue(), arbeidsforhold.getOpplysningspliktigOrgnummer()); - map.put(Headers.VIRKSOMHET.getValue(), arbeidsforhold.getVirksomhetOrgnummer()); - map.put(Headers.ARBEIDSFORHOLD_ID.getValue(), arbeidsforhold.getArbeidsforholdId()); - map.put(Headers.ARBEIDSFORHOLD_TYPE.getValue(), arbeidsforhold.getArbeidsforholdType()); - map.put(Headers.STARTDATO.getValue(), arbeidsforhold.getStartdato()); - map.put(Headers.SLUTTDATO.getValue(), arbeidsforhold.getSluttdato()); - map.put(Headers.ANTALL_TIMER_PER_UKE_SOM_EN_FULL_STILLING_TILSVARER.getValue(), arbeidsforhold.getAntallTimerPerUkeSomEnFullStillingTilsvarer()); - map.put(Headers.AVLOENNINGSTYPE.getValue(), arbeidsforhold.getAvloenningstype()); - map.put(Headers.YRKE.getValue(), arbeidsforhold.getYrke()); - map.put(Headers.ARBEIDSTIDSORDNING.getValue(), arbeidsforhold.getArbeidstidsordning()); - map.put(Headers.STILLINGSPROSENT.getValue(), arbeidsforhold.getStillingsprosent()); - map.put(Headers.SISTE_LOENNSENDRINGSDATO.getValue(), arbeidsforhold.getSisteLoennsendringsdato()); - map.put(Headers.SISTE_DATO_FOR_STILLINGSPROSENTENDRING.getValue(), arbeidsforhold.getSisteDatoForStillingsprosentendring()); - map.put(Headers.PERMISJON_MED_FORELDREPENGER.getValue(), arbeidsforhold.getAntallPermisjonMedForeldrepenger()); - map.put(Headers.PERMITTERING.getValue(), arbeidsforhold.getAntallPermittering()); - map.put(Headers.PERMISJON.getValue(), arbeidsforhold.getAntallPermisjon()); - map.put(Headers.PERMISJON_VED_MILITAERTJENESTE.getValue(), arbeidsforhold.getAntallPermisjonVedMilitaertjeneste()); - map.put(Headers.VELFERDSPERMISJON.getValue(), arbeidsforhold.getAntallVelferdspermisjon()); - map.put(Headers.UTDANNINGSPERMISJON.getValue(), arbeidsforhold.getAntallUtdanningspermisjon()); - map.put(Headers.SKIPSREGISTER.getValue(), arbeidsforhold.getSkipsregister()); - map.put(Headers.SKIPSTYPE.getValue(), arbeidsforhold.getSkipstype()); - map.put(Headers.FARTSOMRAADE.getValue(), arbeidsforhold.getFartsomraade()); - map.put(Headers.ANTALL_INNTEKTER.getValue(), arbeidsforhold.getAntallInntekter()); - map.put(Headers.AARSAK_TIL_SLUTTDATO.getValue(), arbeidsforhold.getAarsakTilSluttdato()); - map.put(Headers.FORM_FOR_ANSETTELSE.getValue(), arbeidsforhold.getFormForAnsettelse()); - map.put(Headers.KILDEREFERANSE.getValue(), arbeidsforhold.getKildereferanse()); - return map; - }; - } - - @Override - protected CsvHeader[] getHeaders() { - return Headers.values(); - } -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/converter/csv/AvvikSyntetiseringCsvPrinterConverter.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/converter/csv/AvvikSyntetiseringCsvPrinterConverter.java deleted file mode 100644 index 50adc2d8416..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/converter/csv/AvvikSyntetiseringCsvPrinterConverter.java +++ /dev/null @@ -1,56 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.converter.csv; - -import java.io.PrintWriter; -import java.util.HashMap; -import java.util.Map; - -import no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.Avvik; -import no.nav.testnav.libs.csvconverter.CsvHeader; -import no.nav.testnav.libs.csvconverter.CsvPrinterConverter; -import no.nav.testnav.libs.csvconverter.ObjectConverter; - -public class AvvikSyntetiseringCsvPrinterConverter extends CsvPrinterConverter { - - public AvvikSyntetiseringCsvPrinterConverter(PrintWriter writer) { - super(writer); - } - - private enum Headers implements CsvHeader { - TYPE("TYPE"), - ARBEIDSFORHOLD_TYPE("ARBEIDSFORHOLD_TYPE"), - ID("ID"), - NAVN("NAVN"), - DETALJER("DETALJER"), - ALVORLIGHETSGRAD("ALVORLIGHETSGRAD"); - - private final String header; - - Headers(String header) { - this.header = header; - } - - @Override - public String getValue() { - return header; - } - } - - @Override - protected ObjectConverter getObjectConverter() { - return avvik -> { - Map map = new HashMap<>(); - map.put(Headers.TYPE.getValue(), avvik.getType()); - map.put(Headers.ARBEIDSFORHOLD_TYPE.getValue(), avvik.getArbeidsforholdType()); - map.put(Headers.ID.getValue(), avvik.getId()); - map.put(Headers.NAVN.getValue(), avvik.getNavn()); - map.put(Headers.DETALJER.getValue(), avvik.getDetaljer()); - map.put(Headers.ALVORLIGHETSGRAD.getValue(), avvik.getAlvorlighetsgrad()); - return map; - }; - } - - @Override - protected CsvHeader[] getHeaders() { - return Headers.values(); - } -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/converter/csv/InntektSyntetiseringCsvPrinterConverter.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/converter/csv/InntektSyntetiseringCsvPrinterConverter.java deleted file mode 100644 index 3e2c034e790..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/converter/csv/InntektSyntetiseringCsvPrinterConverter.java +++ /dev/null @@ -1,56 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.converter.csv; - -import java.io.PrintWriter; -import java.util.HashMap; -import java.util.Map; - -import no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.Inntekt; -import no.nav.testnav.libs.csvconverter.CsvHeader; -import no.nav.testnav.libs.csvconverter.CsvPrinterConverter; -import no.nav.testnav.libs.csvconverter.ObjectConverter; - -public class InntektSyntetiseringCsvPrinterConverter extends CsvPrinterConverter { - - public InntektSyntetiseringCsvPrinterConverter(PrintWriter writer) { - super(writer); - } - - private enum Headers implements CsvHeader { - RAPPORTERINGSMAANED("RAPPORTERINGSMAANED"), - ARBEIDSFORHOLD_TYPE("ARBEIDSFORHOLD_TYPE"), - STARTDATO_OPPTJENINGSPERIODE("STARTDATO_OPPTJENINGSPERIODE"), - SLUTTDATO_OPPTJENINGSPERIODE("SLUTTDATO_OPPTJENINGSPERIODE"), - ANTALL("ANTALL"), - OPPTJENINGSLAND("OPPTJENINGSLAND"); - - private final String header; - - Headers(String header) { - this.header = header; - } - - @Override - public String getValue() { - return header; - } - } - - @Override - protected ObjectConverter getObjectConverter() { - return inntekt -> { - Map map = new HashMap<>(); - map.put(Headers.RAPPORTERINGSMAANED.getValue(), inntekt.getKalendermaaned()); - map.put(Headers.ARBEIDSFORHOLD_TYPE.getValue(), inntekt.getTypeArbeidsforhold()); - map.put(Headers.STARTDATO_OPPTJENINGSPERIODE.getValue(), inntekt.getStartdatoOpptjeningsperiode()); - map.put(Headers.SLUTTDATO_OPPTJENINGSPERIODE.getValue(), inntekt.getSluttdatoOpptjeningsperiode()); - map.put(Headers.ANTALL.getValue(), inntekt.getAntall()); - map.put(Headers.OPPTJENINGSLAND.getValue(), inntekt.getOpptjeningsland()); - return map; - }; - } - - @Override - protected CsvHeader[] getHeaders() { - return Headers.values(); - } -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/converter/csv/PermisjonSyntetiseringCsvPrinterConverter.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/converter/csv/PermisjonSyntetiseringCsvPrinterConverter.java deleted file mode 100644 index 028edf2f52f..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/converter/csv/PermisjonSyntetiseringCsvPrinterConverter.java +++ /dev/null @@ -1,58 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.converter.csv; - -import java.io.PrintWriter; -import java.util.HashMap; -import java.util.Map; - -import no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.Permisjon; -import no.nav.testnav.libs.csvconverter.CsvHeader; -import no.nav.testnav.libs.csvconverter.CsvPrinterConverter; -import no.nav.testnav.libs.csvconverter.ObjectConverter; - -public class PermisjonSyntetiseringCsvPrinterConverter extends CsvPrinterConverter { - - public PermisjonSyntetiseringCsvPrinterConverter(PrintWriter writer) { - super(writer); - } - - private enum Headers implements CsvHeader { - KALENDERMAANED("KALENDERMAANED"), - IDENT("IDENT"), - STARTDATO("STARTDATO"), - SLUTTDATO("SLUTTDATO"), - PERMISJONSPROSENT("PERMISJONSPROSENT"), - BESKRIVELSE("BESKRIVELSE"), - KILDEREFERANSE("KILDEREFERANSE"); - - private final String header; - - Headers(String header) { - this.header = header; - } - - @Override - public String getValue() { - return header; - } - } - - @Override - protected ObjectConverter getObjectConverter() { - return permisjon -> { - Map map = new HashMap<>(); - map.put(Headers.KALENDERMAANED.getValue(), permisjon.getKalendermaaned()); - map.put(Headers.IDENT.getValue(), permisjon.getIdent()); - map.put(Headers.STARTDATO.getValue(), permisjon.getStartdato()); - map.put(Headers.SLUTTDATO.getValue(), permisjon.getSluttdato()); - map.put(Headers.PERMISJONSPROSENT.getValue(), permisjon.getPermisjonsprosent()); - map.put(Headers.BESKRIVELSE.getValue(), permisjon.getBeskrivelse()); - map.put(Headers.KILDEREFERANSE.getValue(), permisjon.getKildereferanse()); - return map; - }; - } - - @Override - protected CsvHeader[] getHeaders() { - return Headers.values(); - } -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/Arbeidsforhold.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/Arbeidsforhold.java deleted file mode 100644 index 76c22ede73e..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/Arbeidsforhold.java +++ /dev/null @@ -1,69 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain; - -import java.time.LocalDate; -import java.util.List; - -public interface Arbeidsforhold { - boolean hasAvvik(); - - String getArbeidsforholdId(); - - String getArbeidsforholdType(); - - String getYrke(); - - Float getAntallTimerPerUkeSomEnFullStillingTilsvarer(); - - LocalDate getSisteLoennsendringsdato(); - - LocalDate getSisteDatoForStillingsprosentendring(); - - String getAvloenningstype(); - - String getArbeidstidsordning(); - - Float getStillingsprosent(); - - LocalDate getStartdato(); - - LocalDate getSluttdato(); - - String getSkipsregister(); - - String getSkipstype(); - - String getFartsomraade(); - - String getKalendermaaned(); - - String getOpplysningspliktigOrgnummer(); - - String getVirksomhetOrgnummer(); - - String getIdent(); - - String getKildereferanse(); - - int getAntallVelferdspermisjon(); - - int getAntallPermisjonMedForeldrepenger(); - - int getAntallPermittering(); - - int getAntallPermisjon(); - - int getAntallPermisjonVedMilitaertjeneste(); - - int getAntallUtdanningspermisjon(); - - List getPermisjoner(); - - Integer getAntallInntekter(); - - - List getAvvikList(); - - String getAarsakTilSluttdato(); - - String getFormForAnsettelse(); -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/Avvik.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/Avvik.java deleted file mode 100644 index 3ea7a5a9e3a..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/Avvik.java +++ /dev/null @@ -1,15 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain; - -public interface Avvik { - String getId(); - - String getNavn(); - - String getAlvorlighetsgrad(); - - String getDetaljer(); - - String getType(); - - String getArbeidsforholdType(); -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/Inntekt.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/Inntekt.java deleted file mode 100644 index 184e6a86fda..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/Inntekt.java +++ /dev/null @@ -1,24 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain; - -import java.time.LocalDate; -import java.util.List; - - -public interface Inntekt { - - LocalDate getStartdatoOpptjeningsperiode(); - - LocalDate getSluttdatoOpptjeningsperiode(); - - Float getAntall(); - - String getOpptjeningsland(); - - String getKalendermaaned(); - - String getTypeArbeidsforhold(); - - List getAvvikList(); - - boolean hasAvvik(); -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/Permisjon.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/Permisjon.java deleted file mode 100644 index 942adba5062..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/Permisjon.java +++ /dev/null @@ -1,26 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain; - -import java.time.LocalDate; -import java.util.List; - -public interface Permisjon { - String getBeskrivelse(); - - Float getPermisjonsprosent(); - - LocalDate getStartdato(); - - LocalDate getSluttdato(); - - String getKildereferanse(); - - String getIdent(); - - String getKalendermaaned(); - - String getTypeArbeidsforhold(); - - boolean hasAvvik(); - - List getAvvikList(); -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_0/Arbeidsforhold.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_0/Arbeidsforhold.java deleted file mode 100644 index 75a1353ed8a..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_0/Arbeidsforhold.java +++ /dev/null @@ -1,204 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.v2_0; - -import javax.xml.datatype.XMLGregorianCalendar; -import java.time.LocalDate; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; - -import no.nav.registre.testnorge.xsd.arbeidsforhold.v2_0.Inntektsmottaker; -import no.nav.registre.testnorge.xsd.arbeidsforhold.v2_0.Leveranse; -import no.nav.registre.testnorge.xsd.arbeidsforhold.v2_0.Virksomhet; - - -public class Arbeidsforhold implements no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.Arbeidsforhold { - private final String kalendermaaned; - private final String opplysningspliktigOrgnummer; - private final String virksomhetOrgnummer; - private final String ident; - private final String arbeidsforholdId; - private final String arbeidsforholdType; - private final String yrke; - private final Float antallTimerPerUkeSomEnFullStillingTilsvarer; - private final LocalDate sisteLoennsendringsdato; - private final LocalDate sisteDatoForStillingsprosentendring; - private final String avloenningstype; - private final String arbeidstidsordning; - private final Float stillingsprosent; - private final LocalDate startdato; - private final LocalDate sluttdato; - private final String skipsregister; - private final String skipstype; - private final String fartsomraade; - private final Permisjoner permisjoner; - private final String kildereferanse; - private final Integer antallInntekter; - private final List avvikList; - - public Arbeidsforhold( - Leveranse leveranse, - Virksomhet virksomhet, - Inntektsmottaker inntektsmottaker, - Integer antallInntekter, - no.nav.registre.testnorge.xsd.arbeidsforhold.v2_0.Arbeidsforhold arbeidsforhold - ) { - this.antallInntekter = antallInntekter; - this.virksomhetOrgnummer = virksomhet.getNorskIdentifikator(); - this.kalendermaaned = leveranse.getKalendermaaned().toString(); - this.opplysningspliktigOrgnummer = leveranse.getOpplysningspliktig().getNorskIdentifikator(); - this.kildereferanse = inntektsmottaker.getKilde().getKildereferanse(); - this.ident = inntektsmottaker.getNorskIdentifikator(); - this.permisjoner = Permisjoner.from(arbeidsforhold.getPermisjon(), getKalendermaaned(), getIdent(), getKildereferanse(), arbeidsforhold.getTypeArbeidsforhold()); - this.arbeidsforholdId = arbeidsforhold.getArbeidsforholdId(); - this.arbeidsforholdType = arbeidsforhold.getTypeArbeidsforhold(); - this.yrke = arbeidsforhold.getYrke(); - this.antallTimerPerUkeSomEnFullStillingTilsvarer = arbeidsforhold.getAntallTimerPerUkeSomEnFullStillingTilsvarer() != null - ? arbeidsforhold.getAntallTimerPerUkeSomEnFullStillingTilsvarer().floatValue() : null; - this.sisteLoennsendringsdato = toLocalDate(arbeidsforhold.getSisteLoennsendringsdato()); - this.sisteDatoForStillingsprosentendring = toLocalDate(arbeidsforhold.getSisteDatoForStillingsprosentendring()); - this.avloenningstype = arbeidsforhold.getAvloenningstype(); - this.arbeidstidsordning = arbeidsforhold.getArbeidstidsordning(); - this.stillingsprosent = arbeidsforhold.getStillingsprosent() != null - ? arbeidsforhold.getStillingsprosent().floatValue() : null; - this.startdato = toLocalDate(arbeidsforhold.getStartdato()); - this.sluttdato = toLocalDate(arbeidsforhold.getSluttdato()); - this.skipsregister = arbeidsforhold.getFartoey() != null ? arbeidsforhold.getFartoey().getSkipsregister() : null; - this.skipstype = arbeidsforhold.getFartoey() != null ? arbeidsforhold.getFartoey().getSkipstype() : null; - this.fartsomraade = arbeidsforhold.getFartoey() != null ? arbeidsforhold.getFartoey().getFartsomraade() : null; - this.avvikList = arbeidsforhold.getAvvik() != null - ? arbeidsforhold.getAvvik().stream().map(value -> new Avvik(value, "ARBEIDSFORHOLD", arbeidsforhold.getTypeArbeidsforhold())).collect(Collectors.toList()) - : Collections.emptyList(); - } - - public boolean hasAvvik() { - return !avvikList.isEmpty(); - } - - public String getArbeidsforholdId() { - return arbeidsforholdId; - } - - public String getArbeidsforholdType() { - return arbeidsforholdType; - } - - public String getYrke() { - return yrke; - } - - public Float getAntallTimerPerUkeSomEnFullStillingTilsvarer() { - return antallTimerPerUkeSomEnFullStillingTilsvarer; - } - - public LocalDate getSisteLoennsendringsdato() { - return sisteLoennsendringsdato; - } - - public LocalDate getSisteDatoForStillingsprosentendring() { - return sisteDatoForStillingsprosentendring; - } - - public String getAvloenningstype() { - return avloenningstype; - } - - public String getArbeidstidsordning() { - return arbeidstidsordning; - } - - public Float getStillingsprosent() { - return stillingsprosent; - } - - public LocalDate getStartdato() { - return startdato; - } - - public LocalDate getSluttdato() { - return sluttdato; - } - - public String getSkipsregister() { - return skipsregister; - } - - public String getSkipstype() { - return skipstype; - } - - public String getFartsomraade() { - return fartsomraade; - } - - public String getKalendermaaned() { - return kalendermaaned; - } - - public String getOpplysningspliktigOrgnummer() { - return opplysningspliktigOrgnummer; - } - - public String getVirksomhetOrgnummer() { - return virksomhetOrgnummer; - } - - public String getIdent() { - return ident; - } - public String getKildereferanse() { - return kildereferanse; - } - - public int getAntallVelferdspermisjon() { - return permisjoner.getAntallVelferdspermisjon(); - } - - public int getAntallPermisjonMedForeldrepenger() { - return permisjoner.getAntallPermisjonMedForeldrepenger(); - } - - public int getAntallPermittering() { - return permisjoner.getAntallPermittering(); - } - - public int getAntallPermisjon() { - return permisjoner.getAntallPermisjon(); - } - - public int getAntallPermisjonVedMilitaertjeneste() { - return permisjoner.getAntallPermisjonVedMilitaertjeneste(); - } - - public int getAntallUtdanningspermisjon() { - return permisjoner.getAntallUtdanningspermisjon(); - } - - public List getPermisjoner() { - return permisjoner.getList(); - } - - public Integer getAntallInntekter() { - return antallInntekter; - } - - private static LocalDate toLocalDate(XMLGregorianCalendar calendar) { - if (calendar == null) { - return null; - } - return LocalDate.of(calendar.getYear(), calendar.getMonth(), calendar.getDay()); - } - - public List getAvvikList() { - return avvikList; - } - - @Override - public String getAarsakTilSluttdato() { - return null; - } - - @Override - public String getFormForAnsettelse() { - return null; - } -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_0/Avvik.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_0/Avvik.java deleted file mode 100644 index c7fd49a8fbe..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_0/Avvik.java +++ /dev/null @@ -1,22 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.v2_0; - -import lombok.Getter; - -@Getter -public class Avvik implements no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.Avvik { - private final String id; - private final String navn; - private final String alvorlighetsgrad; - private final String detaljer; - private final String type; - private final String arbeidsforholdType; - - public Avvik(no.nav.registre.testnorge.xsd.arbeidsforhold.v2_0.Avvik avvik, String type, String arbeidsforholdType) { - this.id = avvik.getId(); - this.navn = avvik.getNavn(); - this.alvorlighetsgrad = avvik.getAlvorlighetsgrad() != null ? avvik.getAlvorlighetsgrad().value() : null; - this.detaljer = avvik.getDetaljer(); - this.type = type; - this.arbeidsforholdType = arbeidsforholdType; - } -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_0/Inntekt.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_0/Inntekt.java deleted file mode 100644 index 82267f3e6d7..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_0/Inntekt.java +++ /dev/null @@ -1,61 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.v2_0; - -import lombok.RequiredArgsConstructor; - -import javax.xml.datatype.XMLGregorianCalendar; -import java.time.LocalDate; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; - -@RequiredArgsConstructor -public class Inntekt implements no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.Inntekt { - private final no.nav.registre.testnorge.xsd.arbeidsforhold.v2_0.Inntekt inntekt; - private final String typeArbeidsforhold; - private final String kalendermaaned; - - public LocalDate getStartdatoOpptjeningsperiode() { - return toLocalDate(inntekt.getStartdatoOpptjeningsperiode()); - } - - public LocalDate getSluttdatoOpptjeningsperiode() { - return toLocalDate(inntekt.getSluttdatoOpptjeningsperiode()); - } - - public Float getAntall() { - return inntekt.getLoennsinntekt() != null && inntekt.getLoennsinntekt().getAntall() != null - ? inntekt.getLoennsinntekt().getAntall().floatValue() - : null; - } - - public String getOpptjeningsland() { - return inntekt.getLoennsinntekt() != null && inntekt.getLoennsinntekt().getSpesifikasjon() != null - ? inntekt.getLoennsinntekt().getSpesifikasjon().getOpptjeningsland() - : null; - } - - public String getKalendermaaned() { - return kalendermaaned; - } - - public String getTypeArbeidsforhold() { - return typeArbeidsforhold; - } - - private static LocalDate toLocalDate(XMLGregorianCalendar calendar) { - if (calendar == null) { - return null; - } - return LocalDate.of(calendar.getYear(), calendar.getMonth(), calendar.getDay()); - } - - public List getAvvikList(){ - return inntekt.getAvvik() != null - ? inntekt.getAvvik().stream().map(value -> new Avvik(value, "INNTEKT", typeArbeidsforhold)).collect(Collectors.toList()) - : Collections.emptyList(); - } - - public boolean hasAvvik() { - return !getAvvikList().isEmpty(); - } -} \ No newline at end of file diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_0/Inntektsmottaker.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_0/Inntektsmottaker.java deleted file mode 100644 index 557e1dce8b3..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_0/Inntektsmottaker.java +++ /dev/null @@ -1,101 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.v2_0; - -import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; - -import no.nav.registre.testnorge.xsd.arbeidsforhold.v2_0.Leveranse; -import no.nav.registre.testnorge.xsd.arbeidsforhold.v2_0.Virksomhet; - - -public class Inntektsmottaker { - private final List arbeidsforholdList; - private final List inntektList; - - public Inntektsmottaker( - Leveranse leveranse, - Virksomhet virksomhet, - no.nav.registre.testnorge.xsd.arbeidsforhold.v2_0.Inntektsmottaker inntektsmottaker - ) { - var counter = new AtomicInteger(); - this.arbeidsforholdList = inntektsmottaker.getArbeidsforhold() - .stream() - .map(value -> { - var index = counter.getAndIncrement(); - int antallInntekter; - if (index == 0) { - antallInntekter = getAntallInntekter(value.getArbeidsforholdId(), inntektsmottaker.getInntekt()) - + getAntallUtenArbeidsforholdMatch(inntektsmottaker.getArbeidsforhold(), inntektsmottaker.getInntekt()); - } else { - antallInntekter = getAntallInntekter(value.getArbeidsforholdId(), inntektsmottaker.getInntekt()); - } - return new Arbeidsforhold(leveranse, virksomhet, inntektsmottaker, antallInntekter, value); - }).collect(Collectors.toList()); - - this.inntektList = inntektsmottaker.getInntekt() - .stream() - .map(value -> new Inntekt( - value, - getTypeArbeidsforholdFraIntekt(value, inntektsmottaker.getArbeidsforhold()), - leveranse.getKalendermaaned().toString() - )) - .collect(Collectors.toList()); - } - - private static int getAntallUtenArbeidsforholdMatch( - List arbeidsforholdList, - List inntektList - ) { - if (inntektList == null) { - return 0; - } - var ids = inntektList.stream().map(no.nav.registre.testnorge.xsd.arbeidsforhold.v2_0.Inntekt::getArbeidsforholdId).collect(Collectors.toList()); - return (int) ids.stream().filter(id -> !contains(id, arbeidsforholdList)).count(); - } - - private static boolean contains(String arbeidsforholdId, List arbeidsforholdList) { - if (arbeidsforholdId == null) { - return false; - } - return arbeidsforholdList - .stream() - .anyMatch(value -> value.getArbeidsforholdId() != null && value.getArbeidsforholdId().equals(arbeidsforholdId)); - } - - private static int getAntallInntekter(String arbeidsforholdId, List inntektList) { - if (inntektList == null) { - return 0; - } - - return (int) inntektList - .stream() - .filter(value -> value.getArbeidsforholdId() != null && value.getArbeidsforholdId().equals(arbeidsforholdId)) - .count(); - } - - private static String getTypeArbeidsforholdFraIntekt( - no.nav.registre.testnorge.xsd.arbeidsforhold.v2_0.Inntekt inntekt, - List arbeidsforholdList - ) { - if (arbeidsforholdList.isEmpty()) { - return null; - } - if (inntekt.getArbeidsforholdId() == null) { - return arbeidsforholdList.get(0).getTypeArbeidsforhold(); - } - return arbeidsforholdList - .stream() - .filter(value -> value.getArbeidsforholdId().equals(inntekt.getArbeidsforholdId())) - .findFirst() - .orElse(arbeidsforholdList.get(0)) - .getTypeArbeidsforhold(); - } - - public List getArbeidsforholdList() { - return arbeidsforholdList; - } - - public List getInntektList() { - return inntektList; - } -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_0/Opplysningspliktig.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_0/Opplysningspliktig.java deleted file mode 100644 index 81359f42367..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_0/Opplysningspliktig.java +++ /dev/null @@ -1,127 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.v2_0; - -import jakarta.xml.bind.JAXBContext; -import jakarta.xml.bind.JAXBElement; -import jakarta.xml.bind.JAXBException; -import jakarta.xml.bind.Unmarshaller; -import lombok.RequiredArgsConstructor; -import lombok.SneakyThrows; -import lombok.extern.slf4j.Slf4j; -import no.nav.registre.testnorge.xsd.arbeidsforhold.v2_0.EDAGM; - -import java.io.StringReader; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -@Slf4j -@RequiredArgsConstructor -public class Opplysningspliktig { - private static Unmarshaller unmarshaller; - - static { - try { - var jaxbContext = JAXBContext.newInstance(EDAGM.class); - unmarshaller = jaxbContext.createUnmarshaller(); - } catch (JAXBException e) { - log.error("Feil ved opprettelse av unmarshaller for EDAGM", e); - } - } - - private final EDAGM edagm; - - public List toAvvik() { - var avviks = new ArrayList(); - avviks.addAll( - getArbeidsforhold() - .stream() - .filter(Arbeidsforhold::hasAvvik) - .map(Arbeidsforhold::getAvvikList) - .flatMap(Collection::stream) - .toList() - ); - avviks.addAll( - getPermisjoner() - .stream() - .filter(Permisjon::hasAvvik) - .map(Permisjon::getAvvikList) - .flatMap(Collection::stream) - .toList() - ); - - avviks.addAll( - getInntekter() - .stream() - .filter(Inntekt::hasAvvik) - .map(Inntekt::getAvvikList) - .flatMap(Collection::stream) - .toList() - ); - return avviks; - } - - public List toPermisjoner() { - return getPermisjoner() - .stream() - .filter(value -> !value.hasAvvik()) - .toList(); - } - - public List toArbeidsforhold() { - return getArbeidsforhold() - .stream() - .filter(value -> !value.hasAvvik()) - .toList(); - } - - public List toInntekt() { - return getInntekter() - .stream() - .filter(value -> !value.hasAvvik()) - .toList(); - } - - @SneakyThrows - public static Opplysningspliktig from(String xml) { - return new Opplysningspliktig(from(xml, unmarshaller)); - } - - private List getPermisjoner() { - return getArbeidsforhold() - .stream() - .map(Arbeidsforhold::getPermisjoner) - .flatMap(Collection::stream) - .toList(); - } - - private List getArbeidsforhold() { - List arbeidsforholds = new ArrayList<>(); - var leveranse = this.edagm.getLeveranse(); - leveranse.getOppgave().getVirksomhet().forEach(virksomhet -> - virksomhet.getInntektsmottaker().forEach(inntektsmottaker -> { - var value = new Inntektsmottaker(leveranse, virksomhet, inntektsmottaker); - arbeidsforholds.addAll(value.getArbeidsforholdList()); - }) - ); - return arbeidsforholds; - } - - private List getInntekter() { - List inntekts = new ArrayList<>(); - var leveranse = this.edagm.getLeveranse(); - leveranse.getOppgave().getVirksomhet().forEach(virksomhet -> - virksomhet.getInntektsmottaker().forEach(inntektsmottaker -> { - var value = new Inntektsmottaker(leveranse, virksomhet, inntektsmottaker); - inntekts.addAll(value.getInntektList()); - }) - ); - return inntekts; - } - - @SuppressWarnings("unchecked") - private static EDAGM from(String xml, Unmarshaller unmarshaller) throws JAXBException { - try (var reader = new StringReader(xml)) { - return ((JAXBElement) unmarshaller.unmarshal(reader)).getValue(); - } - } -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_0/Permisjon.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_0/Permisjon.java deleted file mode 100644 index 5eea5556f9c..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_0/Permisjon.java +++ /dev/null @@ -1,86 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.v2_0; - -import javax.xml.datatype.XMLGregorianCalendar; -import java.time.LocalDate; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; - -public class Permisjon implements no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.Permisjon { - private final String ident; - private final String kalendermaaned; - private final String kildereferanse; - private final String beskrivelse; - private final Float permisjonsprosent; - private final LocalDate startdato; - private final LocalDate sluttdato; - private final String typeArbeidsforhold; - private final List avvikList; - - public Permisjon( - no.nav.registre.testnorge.xsd.arbeidsforhold.v2_0.Permisjon permisjon, - String kalendermaaned, - String ident, - String kildereferans, - String typeArbeidsforhold - ) { - this.kalendermaaned = kalendermaaned; - this.ident = ident; - this.beskrivelse = permisjon.getBeskrivelse(); - this.permisjonsprosent = permisjon.getPermisjonsprosent() != null ? permisjon.getPermisjonsprosent().floatValue() : null; - this.startdato = toLocalDate(permisjon.getStartdato()); - this.sluttdato = toLocalDate(permisjon.getSluttdato()); - this.kildereferanse = kildereferans; - this.avvikList = permisjon.getAvvik() != null - ? permisjon.getAvvik().stream().map(value -> new Avvik(value, "PERMISJON", typeArbeidsforhold)).collect(Collectors.toList()) - : Collections.emptyList(); - this.typeArbeidsforhold = typeArbeidsforhold; - } - - public String getBeskrivelse() { - return beskrivelse; - } - - public Float getPermisjonsprosent() { - return permisjonsprosent; - } - - public LocalDate getStartdato() { - return startdato; - } - - public LocalDate getSluttdato() { - return sluttdato; - } - - public String getKildereferanse() { - return kildereferanse; - } - - public String getIdent() { - return ident; - } - - public String getKalendermaaned() { - return kalendermaaned; - } - - public String getTypeArbeidsforhold() { - return typeArbeidsforhold; - } - - private static LocalDate toLocalDate(XMLGregorianCalendar calendar) { - if (calendar == null) { - return null; - } - return LocalDate.of(calendar.getYear(), calendar.getMonth(), calendar.getDay()); - } - - public boolean hasAvvik() { - return !avvikList.isEmpty(); - } - - public List getAvvikList() { - return avvikList; - } -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_0/Permisjoner.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_0/Permisjoner.java deleted file mode 100644 index c846f2315a2..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_0/Permisjoner.java +++ /dev/null @@ -1,68 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.v2_0; - -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; - -public class Permisjoner { - private final List list; - - public Permisjoner(List list) { - this.list = list != null ? list : Collections.emptyList(); - } - - static Permisjoner from( - List list, - String kalendermaaned, - String ident, - String kildereferanse, - String typeArbeidsforhold - ) { - return new Permisjoner(list != null ? - list.stream().map(value -> new Permisjon( - value, - kalendermaaned, - ident, - kildereferanse, - typeArbeidsforhold - )).collect(Collectors.toList()) : null - ); - } - - private int antall(String beskrivelse) { - return list - .stream() - .filter(value -> value.getBeskrivelse().equals(beskrivelse)) - .toArray() - .length; - } - - public int getAntallVelferdspermisjon() { - return antall("velferdspermisjon"); - } - - public int getAntallPermisjonMedForeldrepenger() { - return antall("permisjonMedForeldrepenger"); - } - - public int getAntallPermittering() { - return antall("permittering"); - } - - public int getAntallPermisjon() { - return antall("permisjon"); - } - - public int getAntallPermisjonVedMilitaertjeneste() { - return antall("permisjonVedMilitaertjeneste"); - } - - public int getAntallUtdanningspermisjon() { - return antall("utdanningspermisjon"); - } - - public List getList() { - return list; - } - -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_1/Arbeidsforhold.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_1/Arbeidsforhold.java deleted file mode 100644 index 5d364dd4475..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_1/Arbeidsforhold.java +++ /dev/null @@ -1,206 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.v2_1; - -import javax.xml.datatype.XMLGregorianCalendar; -import java.time.LocalDate; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; - -import no.nav.registre.testnorge.xsd.arbeidsforhold.v2_1.Inntektsmottaker; -import no.nav.registre.testnorge.xsd.arbeidsforhold.v2_1.Leveranse; -import no.nav.registre.testnorge.xsd.arbeidsforhold.v2_1.Virksomhet; - - -public class Arbeidsforhold implements no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.Arbeidsforhold { - private final String kalendermaaned; - private final String opplysningspliktigOrgnummer; - private final String virksomhetOrgnummer; - private final String ident; - private final String arbeidsforholdId; - private final String arbeidsforholdType; - private final String yrke; - private final Float antallTimerPerUkeSomEnFullStillingTilsvarer; - private final LocalDate sisteLoennsendringsdato; - private final LocalDate sisteDatoForStillingsprosentendring; - private final String avloenningstype; - private final String arbeidstidsordning; - private final Float stillingsprosent; - private final LocalDate startdato; - private final LocalDate sluttdato; - private final String skipsregister; - private final String skipstype; - private final String fartsomraade; - private final Permisjoner permisjoner; - private final String kildereferanse; - private final Integer antallInntekter; - private final List avvikList; - private final String aarsakTilSluttdato; - private final String formForAnsettelse; - - public Arbeidsforhold( - Leveranse leveranse, - Virksomhet virksomhet, - Inntektsmottaker inntektsmottaker, - Integer antallInntekter, - no.nav.registre.testnorge.xsd.arbeidsforhold.v2_1.Arbeidsforhold arbeidsforhold - ) { - this.antallInntekter = antallInntekter; - this.virksomhetOrgnummer = virksomhet.getNorskIdentifikator(); - this.kalendermaaned = leveranse.getKalendermaaned().toString(); - this.opplysningspliktigOrgnummer = leveranse.getOpplysningspliktig().getNorskIdentifikator(); - this.kildereferanse = inntektsmottaker.getKilde().getKildereferanse(); - this.ident = inntektsmottaker.getNorskIdentifikator(); - this.permisjoner = Permisjoner.from(arbeidsforhold.getPermisjon(), getKalendermaaned(), getIdent(), getKildereferanse(), arbeidsforhold.getTypeArbeidsforhold()); - this.arbeidsforholdId = arbeidsforhold.getArbeidsforholdId(); - this.arbeidsforholdType = arbeidsforhold.getTypeArbeidsforhold(); - this.yrke = arbeidsforhold.getYrke(); - this.antallTimerPerUkeSomEnFullStillingTilsvarer = arbeidsforhold.getAntallTimerPerUkeSomEnFullStillingTilsvarer() != null - ? arbeidsforhold.getAntallTimerPerUkeSomEnFullStillingTilsvarer().floatValue() : null; - this.sisteLoennsendringsdato = toLocalDate(arbeidsforhold.getSisteLoennsendringsdato()); - this.sisteDatoForStillingsprosentendring = toLocalDate(arbeidsforhold.getSisteDatoForStillingsprosentendring()); - this.avloenningstype = arbeidsforhold.getAvloenningstype(); - this.arbeidstidsordning = arbeidsforhold.getArbeidstidsordning(); - this.stillingsprosent = arbeidsforhold.getStillingsprosent() != null - ? arbeidsforhold.getStillingsprosent().floatValue() : null; - this.startdato = toLocalDate(arbeidsforhold.getStartdato()); - this.sluttdato = toLocalDate(arbeidsforhold.getSluttdato()); - this.skipsregister = arbeidsforhold.getFartoey() != null ? arbeidsforhold.getFartoey().getSkipsregister() : null; - this.skipstype = arbeidsforhold.getFartoey() != null ? arbeidsforhold.getFartoey().getSkipstype() : null; - this.fartsomraade = arbeidsforhold.getFartoey() != null ? arbeidsforhold.getFartoey().getFartsomraade() : null; - this.avvikList = arbeidsforhold.getAvvik() != null - ? arbeidsforhold.getAvvik().stream().map(value -> new Avvik(value, "ARBEIDSFORHOLD", arbeidsforhold.getTypeArbeidsforhold())).collect(Collectors.toList()) - : Collections.emptyList(); - this.aarsakTilSluttdato = arbeidsforhold.getAarsakTilSluttdato(); - this.formForAnsettelse = arbeidsforhold.getFormForAnsettelse(); - } - - public boolean hasAvvik() { - return !avvikList.isEmpty(); - } - - public String getArbeidsforholdId() { - return arbeidsforholdId; - } - - public String getArbeidsforholdType() { - return arbeidsforholdType; - } - - public String getYrke() { - return yrke; - } - - public Float getAntallTimerPerUkeSomEnFullStillingTilsvarer() { - return antallTimerPerUkeSomEnFullStillingTilsvarer; - } - - public LocalDate getSisteLoennsendringsdato() { - return sisteLoennsendringsdato; - } - - public LocalDate getSisteDatoForStillingsprosentendring() { - return sisteDatoForStillingsprosentendring; - } - - public String getAvloenningstype() { - return avloenningstype; - } - - public String getArbeidstidsordning() { - return arbeidstidsordning; - } - - public Float getStillingsprosent() { - return stillingsprosent; - } - - public LocalDate getStartdato() { - return startdato; - } - - public LocalDate getSluttdato() { - return sluttdato; - } - - public String getSkipsregister() { - return skipsregister; - } - - public String getSkipstype() { - return skipstype; - } - - public String getFartsomraade() { - return fartsomraade; - } - - public String getKalendermaaned() { - return kalendermaaned; - } - - public String getOpplysningspliktigOrgnummer() { - return opplysningspliktigOrgnummer; - } - - public String getVirksomhetOrgnummer() { - return virksomhetOrgnummer; - } - - public String getIdent() { - return ident; - } - public String getKildereferanse() { - return kildereferanse; - } - - public int getAntallVelferdspermisjon() { - return permisjoner.getAntallVelferdspermisjon(); - } - - public int getAntallPermisjonMedForeldrepenger() { - return permisjoner.getAntallPermisjonMedForeldrepenger(); - } - - public int getAntallPermittering() { - return permisjoner.getAntallPermittering(); - } - - public int getAntallPermisjon() { - return permisjoner.getAntallPermisjon(); - } - - public int getAntallPermisjonVedMilitaertjeneste() { - return permisjoner.getAntallPermisjonVedMilitaertjeneste(); - } - - public int getAntallUtdanningspermisjon() { - return permisjoner.getAntallUtdanningspermisjon(); - } - - public List getPermisjoner() { - return permisjoner.getList(); - } - - public Integer getAntallInntekter() { - return antallInntekter; - } - - private static LocalDate toLocalDate(XMLGregorianCalendar calendar) { - if (calendar == null) { - return null; - } - return LocalDate.of(calendar.getYear(), calendar.getMonth(), calendar.getDay()); - } - - public List getAvvikList() { - return avvikList; - } - - public String getAarsakTilSluttdato() { - return aarsakTilSluttdato; - } - - public String getFormForAnsettelse() { - return formForAnsettelse; - } -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_1/Avvik.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_1/Avvik.java deleted file mode 100644 index c637a66cacd..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_1/Avvik.java +++ /dev/null @@ -1,25 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.v2_1; - -import lombok.Getter; - -@Getter -public class Avvik implements no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.Avvik { - private final String id; - private final String navn; - private final String alvorlighetsgrad; - private final String type; - private final String arbeidsforholdType; - - public Avvik(no.nav.registre.testnorge.xsd.arbeidsforhold.v2_1.Avvik avvik, String type, String arbeidsforholdType) { - this.id = avvik.getId(); - this.navn = avvik.getNavn(); - this.alvorlighetsgrad = avvik.getAlvorlighetsgrad() != null ? avvik.getAlvorlighetsgrad().value() : null; - this.type = type; - this.arbeidsforholdType = arbeidsforholdType; - } - - @Override - public String getDetaljer() { - return null; - } -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_1/Inntekt.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_1/Inntekt.java deleted file mode 100644 index c1cc060ec6f..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_1/Inntekt.java +++ /dev/null @@ -1,61 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.v2_1; - -import lombok.RequiredArgsConstructor; - -import javax.xml.datatype.XMLGregorianCalendar; -import java.time.LocalDate; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; - -@RequiredArgsConstructor -public class Inntekt implements no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.Inntekt { - private final no.nav.registre.testnorge.xsd.arbeidsforhold.v2_1.Inntekt inntekt; - private final String typeArbeidsforhold; - private final String kalendermaaned; - - public LocalDate getStartdatoOpptjeningsperiode() { - return toLocalDate(inntekt.getStartdatoOpptjeningsperiode()); - } - - public LocalDate getSluttdatoOpptjeningsperiode() { - return toLocalDate(inntekt.getSluttdatoOpptjeningsperiode()); - } - - public Float getAntall() { - return inntekt.getLoennsinntekt() != null && inntekt.getLoennsinntekt().getAntall() != null - ? inntekt.getLoennsinntekt().getAntall().floatValue() - : null; - } - - public String getOpptjeningsland() { - return inntekt.getLoennsinntekt() != null && inntekt.getLoennsinntekt().getSpesifikasjon() != null - ? inntekt.getLoennsinntekt().getSpesifikasjon().getOpptjeningsland() - : null; - } - - public String getKalendermaaned() { - return kalendermaaned; - } - - public String getTypeArbeidsforhold() { - return typeArbeidsforhold; - } - - private static LocalDate toLocalDate(XMLGregorianCalendar calendar) { - if (calendar == null) { - return null; - } - return LocalDate.of(calendar.getYear(), calendar.getMonth(), calendar.getDay()); - } - - public List getAvvikList(){ - return inntekt.getAvvik() != null - ? inntekt.getAvvik().stream().map(value -> new Avvik(value, "INNTEKT", typeArbeidsforhold)).collect(Collectors.toList()) - : Collections.emptyList(); - } - - public boolean hasAvvik() { - return !getAvvikList().isEmpty(); - } -} \ No newline at end of file diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_1/Inntektsmottaker.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_1/Inntektsmottaker.java deleted file mode 100644 index 96b91a3e597..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_1/Inntektsmottaker.java +++ /dev/null @@ -1,101 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.v2_1; - -import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; - -import no.nav.registre.testnorge.xsd.arbeidsforhold.v2_1.Leveranse; -import no.nav.registre.testnorge.xsd.arbeidsforhold.v2_1.Virksomhet; - - -public class Inntektsmottaker { - private final List arbeidsforholdList; - private final List inntektList; - - public Inntektsmottaker( - Leveranse leveranse, - Virksomhet virksomhet, - no.nav.registre.testnorge.xsd.arbeidsforhold.v2_1.Inntektsmottaker inntektsmottaker - ) { - var counter = new AtomicInteger(); - this.arbeidsforholdList = inntektsmottaker.getArbeidsforhold() - .stream() - .map(value -> { - var index = counter.getAndIncrement(); - int antallInntekter; - if (index == 0) { - antallInntekter = getAntallInntekter(value.getArbeidsforholdId(), inntektsmottaker.getInntekt()) - + getAntallUtenArbeidsforholdMatch(inntektsmottaker.getArbeidsforhold(), inntektsmottaker.getInntekt()); - } else { - antallInntekter = getAntallInntekter(value.getArbeidsforholdId(), inntektsmottaker.getInntekt()); - } - return new Arbeidsforhold(leveranse, virksomhet, inntektsmottaker, antallInntekter, value); - }).collect(Collectors.toList()); - - this.inntektList = inntektsmottaker.getInntekt() - .stream() - .map(value -> new Inntekt( - value, - getTypeArbeidsforholdFraIntekt(value, inntektsmottaker.getArbeidsforhold()), - leveranse.getKalendermaaned().toString() - )) - .collect(Collectors.toList()); - } - - private static int getAntallUtenArbeidsforholdMatch( - List arbeidsforholdList, - List inntektList - ) { - if (inntektList == null) { - return 0; - } - var ids = inntektList.stream().map(no.nav.registre.testnorge.xsd.arbeidsforhold.v2_1.Inntekt::getArbeidsforholdId).collect(Collectors.toList()); - return (int) ids.stream().filter(id -> !contains(id, arbeidsforholdList)).count(); - } - - private static boolean contains(String arbeidsforholdId, List arbeidsforholdList) { - if (arbeidsforholdId == null) { - return false; - } - return arbeidsforholdList - .stream() - .anyMatch(value -> value.getArbeidsforholdId() != null && value.getArbeidsforholdId().equals(arbeidsforholdId)); - } - - private static int getAntallInntekter(String arbeidsforholdId, List inntektList) { - if (inntektList == null) { - return 0; - } - - return (int) inntektList - .stream() - .filter(value -> value.getArbeidsforholdId() != null && value.getArbeidsforholdId().equals(arbeidsforholdId)) - .count(); - } - - private static String getTypeArbeidsforholdFraIntekt( - no.nav.registre.testnorge.xsd.arbeidsforhold.v2_1.Inntekt inntekt, - List arbeidsforholdList - ) { - if (arbeidsforholdList.isEmpty()) { - return null; - } - if (inntekt.getArbeidsforholdId() == null) { - return arbeidsforholdList.get(0).getTypeArbeidsforhold(); - } - return arbeidsforholdList - .stream() - .filter(value -> value.getArbeidsforholdId().equals(inntekt.getArbeidsforholdId())) - .findFirst() - .orElse(arbeidsforholdList.get(0)) - .getTypeArbeidsforhold(); - } - - public List getArbeidsforholdList() { - return arbeidsforholdList; - } - - public List getInntektList() { - return inntektList; - } -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_1/Opplysningspliktig.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_1/Opplysningspliktig.java deleted file mode 100644 index 3e58a9c0a5a..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_1/Opplysningspliktig.java +++ /dev/null @@ -1,129 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.v2_1; - -import jakarta.xml.bind.JAXBContext; -import jakarta.xml.bind.JAXBElement; -import jakarta.xml.bind.JAXBException; -import jakarta.xml.bind.Unmarshaller; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import no.nav.registre.testnorge.xsd.arbeidsforhold.v2_1.EDAGM; - -import java.io.StringReader; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -@Slf4j -@RequiredArgsConstructor -public class Opplysningspliktig { - private static Unmarshaller unmarshaller; - - static { - try { - var jaxbContext = JAXBContext.newInstance(EDAGM.class); - unmarshaller = jaxbContext.createUnmarshaller(); - } catch (JAXBException e) { - log.error("Feil ved opprettelse av unmarshaller for EDAGM", e); - } - } - - private final EDAGM edagm; - - public List toAvvik() { - var avviks = new ArrayList(); - avviks.addAll( - getArbeidsforhold() - .stream() - .filter(Arbeidsforhold::hasAvvik) - .map(Arbeidsforhold::getAvvikList) - .flatMap(Collection::stream) - .toList() - ); - avviks.addAll( - getPermisjoner() - .stream() - .filter(Permisjon::hasAvvik) - .map(Permisjon::getAvvikList) - .flatMap(Collection::stream) - .toList() - ); - - avviks.addAll( - getInntekter() - .stream() - .filter(Inntekt::hasAvvik) - .map(Inntekt::getAvvikList) - .flatMap(Collection::stream) - .toList() - ); - return avviks; - } - - public List toPermisjoner() { - return getPermisjoner() - .stream() - .filter(value -> !value.hasAvvik()) - .toList(); - } - - public List toArbeidsforhold() { - return getArbeidsforhold() - .stream() - .filter(value -> !value.hasAvvik()) - .toList(); - } - - public List toInntekt() { - return getInntekter() - .stream() - .filter(value -> !value.hasAvvik()) - .toList(); - } - - public static Opplysningspliktig from(String xml) { - try { - return new Opplysningspliktig(from(xml, unmarshaller)); - } catch (Exception e) { - throw new RuntimeException("Klarer ikke a konvertere xmlene til EDAGM", e); - } - } - - private List getPermisjoner() { - return getArbeidsforhold() - .stream() - .map(Arbeidsforhold::getPermisjoner) - .flatMap(Collection::stream) - .toList(); - } - - private List getArbeidsforhold() { - List arbeidsforholds = new ArrayList<>(); - var leveranse = this.edagm.getLeveranse(); - leveranse.getOppgave().getVirksomhet().forEach(virksomhet -> - virksomhet.getInntektsmottaker().forEach(inntektsmottaker -> { - var value = new Inntektsmottaker(leveranse, virksomhet, inntektsmottaker); - arbeidsforholds.addAll(value.getArbeidsforholdList()); - }) - ); - return arbeidsforholds; - } - - private List getInntekter() { - List inntekts = new ArrayList<>(); - var leveranse = this.edagm.getLeveranse(); - leveranse.getOppgave().getVirksomhet().forEach(virksomhet -> - virksomhet.getInntektsmottaker().forEach(inntektsmottaker -> { - var value = new Inntektsmottaker(leveranse, virksomhet, inntektsmottaker); - inntekts.addAll(value.getInntektList()); - }) - ); - return inntekts; - } - - @SuppressWarnings("unchecked") - private static EDAGM from(String xml, Unmarshaller unmarshaller) throws JAXBException { - try (var reader = new StringReader(xml)) { - return ((JAXBElement) unmarshaller.unmarshal(reader)).getValue(); - } - } -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_1/Permisjon.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_1/Permisjon.java deleted file mode 100644 index 1842a77cb74..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_1/Permisjon.java +++ /dev/null @@ -1,86 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.v2_1; - -import javax.xml.datatype.XMLGregorianCalendar; -import java.time.LocalDate; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; - -public class Permisjon implements no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.Permisjon { - private final String ident; - private final String kalendermaaned; - private final String kildereferanse; - private final String beskrivelse; - private final Float permisjonsprosent; - private final LocalDate startdato; - private final LocalDate sluttdato; - private final String typeArbeidsforhold; - private final List avvikList; - - public Permisjon( - no.nav.registre.testnorge.xsd.arbeidsforhold.v2_1.Permisjon permisjon, - String kalendermaaned, - String ident, - String kildereferans, - String typeArbeidsforhold - ) { - this.kalendermaaned = kalendermaaned; - this.ident = ident; - this.beskrivelse = permisjon.getBeskrivelse(); - this.permisjonsprosent = permisjon.getPermisjonsprosent() != null ? permisjon.getPermisjonsprosent().floatValue() : null; - this.startdato = toLocalDate(permisjon.getStartdato()); - this.sluttdato = toLocalDate(permisjon.getSluttdato()); - this.kildereferanse = kildereferans; - this.avvikList = permisjon.getAvvik() != null - ? permisjon.getAvvik().stream().map(value -> new Avvik(value, "PERMISJON", typeArbeidsforhold)).collect(Collectors.toList()) - : Collections.emptyList(); - this.typeArbeidsforhold = typeArbeidsforhold; - } - - public String getBeskrivelse() { - return beskrivelse; - } - - public Float getPermisjonsprosent() { - return permisjonsprosent; - } - - public LocalDate getStartdato() { - return startdato; - } - - public LocalDate getSluttdato() { - return sluttdato; - } - - public String getKildereferanse() { - return kildereferanse; - } - - public String getIdent() { - return ident; - } - - public String getKalendermaaned() { - return kalendermaaned; - } - - public String getTypeArbeidsforhold() { - return typeArbeidsforhold; - } - - private static LocalDate toLocalDate(XMLGregorianCalendar calendar) { - if (calendar == null) { - return null; - } - return LocalDate.of(calendar.getYear(), calendar.getMonth(), calendar.getDay()); - } - - public boolean hasAvvik() { - return !avvikList.isEmpty(); - } - - public List getAvvikList() { - return avvikList; - } -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_1/Permisjoner.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_1/Permisjoner.java deleted file mode 100644 index e0308f5699f..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/domain/v2_1/Permisjoner.java +++ /dev/null @@ -1,68 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.v2_1; - -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; - -public class Permisjoner { - private final List list; - - public Permisjoner(List list) { - this.list = list != null ? list : Collections.emptyList(); - } - - static Permisjoner from( - List list, - String kalendermaaned, - String ident, - String kildereferanse, - String typeArbeidsforhold - ) { - return new Permisjoner(list != null ? - list.stream().map(value -> new Permisjon( - value, - kalendermaaned, - ident, - kildereferanse, - typeArbeidsforhold - )).collect(Collectors.toList()) : null - ); - } - - private int antall(String beskrivelse) { - return list - .stream() - .filter(value -> value.getBeskrivelse().equals(beskrivelse)) - .toArray() - .length; - } - - public int getAntallVelferdspermisjon() { - return antall("velferdspermisjon"); - } - - public int getAntallPermisjonMedForeldrepenger() { - return antall("permisjonMedForeldrepenger"); - } - - public int getAntallPermittering() { - return antall("permittering"); - } - - public int getAntallPermisjon() { - return antall("permisjon"); - } - - public int getAntallPermisjonVedMilitaertjeneste() { - return antall("permisjonVedMilitaertjeneste"); - } - - public int getAntallUtdanningspermisjon() { - return antall("utdanningspermisjon"); - } - - public List getList() { - return list; - } - -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/provider/ArbeidsforholdExportController.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/provider/ArbeidsforholdExportController.java deleted file mode 100644 index 27ec23ac24a..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/provider/ArbeidsforholdExportController.java +++ /dev/null @@ -1,45 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.provider; - -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import no.nav.no.registere.testnorge.arbeidsforholdexportapi.service.ArbeidsforholdExportService; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.io.IOException; -import java.net.URI; - -@Slf4j -@RestController -@RequestMapping("/api/v1/arbeidsforhold") -@RequiredArgsConstructor -public class ArbeidsforholdExportController { - private final ArbeidsforholdExportService service; - - @GetMapping - public ResponseEntity getArbeidsforhold() throws IOException { - var path = service.writeArbeidsforhold(); - return ResponseEntity.created(URI.create("/api/v1/files/tmp/" + path.getFileName().toString())).build(); - } - - @GetMapping("/permisjoner") - public ResponseEntity getPermisjoner() throws IOException { - var path = service.writePermisjoner(); - return ResponseEntity.created(URI.create("/api/v1/files/tmp/" + path.getFileName().toString())).build(); - } - - @GetMapping("/inntekter") - public ResponseEntity getInntekter() throws IOException { - var path = service.writeInntekter(); - return ResponseEntity.created(URI.create("/api/v1/files/tmp/" + path.getFileName().toString())).build(); - } - - @GetMapping("/avvik") - public ResponseEntity getAvvik() throws IOException { - var path = service.writeAvvik(); - return ResponseEntity.created(URI.create("/api/v1/files/tmp/" + path.getFileName().toString())).build(); - } -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/provider/FileController.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/provider/FileController.java deleted file mode 100644 index ea7f0113b74..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/provider/FileController.java +++ /dev/null @@ -1,57 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.provider; - -import lombok.extern.slf4j.Slf4j; -import org.springframework.core.io.UrlResource; -import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -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.RestController; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.time.LocalDateTime; -import java.util.List; -import java.util.stream.Stream; - -@Slf4j -@RestController -@RequestMapping("/api/v1/files/tmp") -public class FileController { - - @GetMapping - public ResponseEntity> getFiles() throws IOException { - try (Stream paths = Files.walk(Paths.get("/tmp"))) { - return ResponseEntity.ok(paths - .filter(Files::isRegularFile) - .map(value -> value.getFileName().toString()) - .filter(value -> value.endsWith(".csv")) - .toList() - ); - } - } - - @GetMapping("/{filename}") - public ResponseEntity getFile(@PathVariable("filename") String filename) throws IOException { - try (Stream paths = Files.walk(Paths.get("/tmp"))) { - var path = paths.filter(Files::isRegularFile).filter(value -> value.getFileName().toString().equals(filename)).findFirst(); - - if (path.isEmpty()) { - return ResponseEntity.notFound().build(); - } - var resource = new UrlResource(path.get().toUri()); - - log.info("Laster ned fil: {}", filename); - - return ResponseEntity - .ok() - .contentType(MediaType.parseMediaType("text/csv")) - .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=export-" + LocalDateTime.now() + ".csv") - .body(resource); - } - } -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/repository/InntektsmottakerHendelseRepository.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/repository/InntektsmottakerHendelseRepository.java deleted file mode 100644 index b99406dbd09..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/repository/InntektsmottakerHendelseRepository.java +++ /dev/null @@ -1,77 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.repository; - -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.Arbeidsforhold; -import no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.Avvik; -import no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.Inntekt; -import no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.Permisjon; -import no.nav.no.registere.testnorge.arbeidsforholdexportapi.repository.mapper.InntektsmottakerXmlArbeidsforholdRowMapper; -import no.nav.no.registere.testnorge.arbeidsforholdexportapi.repository.mapper.InntektsmottakerXmlAvvikRowMapper; -import no.nav.no.registere.testnorge.arbeidsforholdexportapi.repository.mapper.InntektsmottakerXmlInntekterRowMapper; -import no.nav.no.registere.testnorge.arbeidsforholdexportapi.repository.mapper.InntektsmottakerXmlPermisjonerRowMapper; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Repository; - -import java.util.Collection; -import java.util.List; -import java.util.stream.Collectors; - -@Slf4j -@Repository -@RequiredArgsConstructor -public class InntektsmottakerHendelseRepository { - private final JdbcTemplate jdbcTemplate; - - public Integer count() { - return jdbcTemplate.queryForObject( - "SELECT COUNT(*) FROM temp_uttrekk_inhe", - Integer.class - ); - } - - public List getArbeidsforhold(int page, int size) { - log.info("Henter {} INNTEKTSMOTTAKER_XML fra DB...", size); - List list = jdbcTemplate.query( - "SELECT INNTEKTSMOTTAKER_XML FROM temp_uttrekk_inhe ORDER BY EFF_OPPLYSNINGSPLIKTIG_ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY", - new Object[]{ page * size, size }, - new InntektsmottakerXmlArbeidsforholdRowMapper(page * size, count()) - ).stream().flatMap(Collection::stream).collect(Collectors.toList()); - log.info("Hentet {} INNTEKTSMOTTAKER_XML med {} arbeidsforhold fra DB.", size, list.size()); - return list; - } - - public List getPermisjoner(int page, int size) { - log.info("Henter {} INNTEKTSMOTTAKER_XML fra DB...", size); - List list = jdbcTemplate.query( - "SELECT INNTEKTSMOTTAKER_XML FROM temp_uttrekk_inhe ORDER BY EFF_OPPLYSNINGSPLIKTIG_ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY", - new Object[]{ page * size, size }, - new InntektsmottakerXmlPermisjonerRowMapper(page * size, count()) - ).stream().flatMap(Collection::stream).collect(Collectors.toList()); - log.info("Hentet {} INNTEKTSMOTTAKER_XML med {} permisjoner fra DB.", size, list.size()); - return list; - } - - public List getInntekter(int page, int size) { - log.info("Henter {} INNTEKTSMOTTAKER_XML fra DB...", size); - List list = jdbcTemplate.query( - "SELECT INNTEKTSMOTTAKER_XML FROM temp_uttrekk_inhe ORDER BY EFF_OPPLYSNINGSPLIKTIG_ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY", - new Object[]{ page * size, size }, - new InntektsmottakerXmlInntekterRowMapper(page * size, count()) - ).stream().flatMap(Collection::stream).collect(Collectors.toList()); - log.info("Hentet {} INNTEKTSMOTTAKER_XML med {} inntekter fra DB.", size, list.size()); - return list; - } - - public List getAvvik(int page, int size) { - log.info("Henter {} INNTEKTSMOTTAKER_XML fra DB...", size); - List list = jdbcTemplate.query( - "SELECT INNTEKTSMOTTAKER_XML FROM temp_uttrekk_inhe ORDER BY EFF_OPPLYSNINGSPLIKTIG_ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY", - new Object[]{ page * size, size }, - new InntektsmottakerXmlAvvikRowMapper(page * size, count()) - ).stream().flatMap(Collection::stream) - .collect(Collectors.toList()); - log.info("Hentet {} INNTEKTSMOTTAKER_XML med {} inntekter fra DB.", size, list.size()); - return list; - } -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/repository/mapper/InntektsmottakerXmlArbeidsforholdRowMapper.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/repository/mapper/InntektsmottakerXmlArbeidsforholdRowMapper.java deleted file mode 100644 index 7ca515b672e..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/repository/mapper/InntektsmottakerXmlArbeidsforholdRowMapper.java +++ /dev/null @@ -1,38 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.repository.mapper; - -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.jdbc.core.RowMapper; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.List; - -import no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.Arbeidsforhold; - -@Slf4j -@RequiredArgsConstructor -public class InntektsmottakerXmlArbeidsforholdRowMapper implements RowMapper> { - private final Integer page; - private final Integer total; - - private boolean isV2_1(String xml) { - return xml.contains("urn:nav:a-arbeidsforhold:v2_1"); - } - - @Override - public List mapRow(ResultSet rs, int rowNum) throws SQLException { - if ((rowNum + 1 + page) % 10000 == 0 || (rowNum + 1 + page) == total) { - log.info("Antall rader behandlet {}/{}.", rowNum + 1 + page, total); - } - String xml = rs.getString("INNTEKTSMOTTAKER_XML"); - if (isV2_1(xml)) { - var opplysningspliktig = no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.v2_1.Opplysningspliktig.from(xml); - return opplysningspliktig.toArbeidsforhold(); - } else { - var opplysningspliktig = no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.v2_0.Opplysningspliktig.from(xml); - return opplysningspliktig.toArbeidsforhold(); - } - - } -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/repository/mapper/InntektsmottakerXmlAvvikRowMapper.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/repository/mapper/InntektsmottakerXmlAvvikRowMapper.java deleted file mode 100644 index 87a51f777b6..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/repository/mapper/InntektsmottakerXmlAvvikRowMapper.java +++ /dev/null @@ -1,38 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.repository.mapper; - -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.jdbc.core.RowMapper; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.List; - -import no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.Avvik; - -@Slf4j -@RequiredArgsConstructor -public class InntektsmottakerXmlAvvikRowMapper implements RowMapper> { - private final Integer page; - private final Integer total; - - private boolean isV2_1(String xml) { - return xml.contains("urn:nav:a-arbeidsforhold:v2_1"); - } - - @Override - public List mapRow(ResultSet rs, int rowNum) throws SQLException { - if ((rowNum + 1 + page) % 10000 == 0 || (rowNum + 1 + page) == total) { - log.info("Antall rader behandlet {}/{}.", rowNum + 1 + page, total); - } - - String xml = rs.getString("INNTEKTSMOTTAKER_XML"); - if (isV2_1(xml)) { - var opplysningspliktig = no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.v2_1.Opplysningspliktig.from(xml); - return opplysningspliktig.toAvvik(); - } else { - var opplysningspliktig = no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.v2_0.Opplysningspliktig.from(xml); - return opplysningspliktig.toAvvik(); - } - } -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/repository/mapper/InntektsmottakerXmlInntekterRowMapper.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/repository/mapper/InntektsmottakerXmlInntekterRowMapper.java deleted file mode 100644 index 2581f60107f..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/repository/mapper/InntektsmottakerXmlInntekterRowMapper.java +++ /dev/null @@ -1,38 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.repository.mapper; - -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.jdbc.core.RowMapper; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.List; - -import no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.Inntekt; - -@Slf4j -@RequiredArgsConstructor -public class InntektsmottakerXmlInntekterRowMapper implements RowMapper> { - private final Integer page; - private final Integer total; - - private boolean isV2_1(String xml) { - return xml.contains("urn:nav:a-arbeidsforhold:v2_1"); - } - - @Override - public List mapRow(ResultSet rs, int rowNum) throws SQLException { - if ((rowNum + 1 + page) % 10000 == 0 || (rowNum + 1 + page) == total) { - log.info("Antall rader behandlet {}/{}.", rowNum + 1 + page, total); - } - - String xml = rs.getString("INNTEKTSMOTTAKER_XML"); - if (isV2_1(xml)) { - var opplysningspliktig = no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.v2_1.Opplysningspliktig.from(xml); - return opplysningspliktig.toInntekt(); - } else { - var opplysningspliktig = no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.v2_0.Opplysningspliktig.from(xml); - return opplysningspliktig.toInntekt(); - } - } -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/repository/mapper/InntektsmottakerXmlPermisjonerRowMapper.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/repository/mapper/InntektsmottakerXmlPermisjonerRowMapper.java deleted file mode 100644 index 896b2226938..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/repository/mapper/InntektsmottakerXmlPermisjonerRowMapper.java +++ /dev/null @@ -1,38 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.repository.mapper; - -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.jdbc.core.RowMapper; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.List; - -import no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.Permisjon; - -@Slf4j -@RequiredArgsConstructor -public class InntektsmottakerXmlPermisjonerRowMapper implements RowMapper> { - private final Integer page; - private final Integer total; - - private boolean isV2_1(String xml) { - return xml.contains("urn:nav:a-arbeidsforhold:v2_1"); - } - - @Override - public List mapRow(ResultSet rs, int rowNum) throws SQLException { - if ((rowNum + 1 + page) % 10000 == 0 || (rowNum + 1 + page) == total) { - log.info("Antall rader behandlet {}/{}.", rowNum + 1 + page, total); - } - - String xml = rs.getString("INNTEKTSMOTTAKER_XML"); - if (isV2_1(xml)) { - var opplysningspliktig = no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.v2_1.Opplysningspliktig.from(xml); - return opplysningspliktig.toPermisjoner(); - } else { - var opplysningspliktig = no.nav.no.registere.testnorge.arbeidsforholdexportapi.domain.v2_0.Opplysningspliktig.from(xml); - return opplysningspliktig.toPermisjoner(); - } - } -} diff --git a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/service/ArbeidsforholdExportService.java b/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/service/ArbeidsforholdExportService.java deleted file mode 100644 index 77a90f8c9fb..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/service/ArbeidsforholdExportService.java +++ /dev/null @@ -1,125 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi.service; - -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.io.IOException; -import java.io.PrintWriter; -import java.nio.file.Files; -import java.nio.file.Path; - -import no.nav.no.registere.testnorge.arbeidsforholdexportapi.converter.csv.ArbeidsforholdSyntetiseringCsvPrinterConverter; -import no.nav.no.registere.testnorge.arbeidsforholdexportapi.converter.csv.AvvikSyntetiseringCsvPrinterConverter; -import no.nav.no.registere.testnorge.arbeidsforholdexportapi.converter.csv.InntektSyntetiseringCsvPrinterConverter; -import no.nav.no.registere.testnorge.arbeidsforholdexportapi.converter.csv.PermisjonSyntetiseringCsvPrinterConverter; -import no.nav.no.registere.testnorge.arbeidsforholdexportapi.repository.InntektsmottakerHendelseRepository; - -@Slf4j -@Service -@RequiredArgsConstructor -public class ArbeidsforholdExportService { - public static final int PAGE_SIZE = 500_000; - private final InntektsmottakerHendelseRepository inntektsmottakerHendelseRepository; - - public Path writeArbeidsforhold() throws IOException { - var count = inntektsmottakerHendelseRepository.count(); - int numberOfPages = (int) Math.ceil(count / (float) PAGE_SIZE); - - if (numberOfPages > 1) { - log.warn("Deler opp operasjonen i {} deler for å unngå minne problemer.", numberOfPages); - } - var path = Files.createTempFile("arb-" + System.currentTimeMillis() + "-", ".csv"); - - var file = path.toFile(); - log.info("Fil opprettet: {}.", path); - file.deleteOnExit(); - var printWriter = new PrintWriter(file); - - var printer = new ArbeidsforholdSyntetiseringCsvPrinterConverter(printWriter); - for (int page = 0; page < numberOfPages; page++) { - log.info("Henter for side {}/{} med opp til {} per side.", page + 1, numberOfPages, PAGE_SIZE); - printer.write(inntektsmottakerHendelseRepository.getArbeidsforhold(page, PAGE_SIZE)); - printWriter.flush(); - } - log.info("Lukker printeren til fil {}.", path.toAbsolutePath()); - printer.close(); - return path; - } - - - public Path writePermisjoner() throws IOException { - var count = inntektsmottakerHendelseRepository.count(); - int numberOfPages = (int) Math.ceil(count / (float) PAGE_SIZE); - - if (numberOfPages > 1) { - log.warn("Deler opp operasjonen i {} deler for å unngå minne problemer.", numberOfPages); - } - var path = Files.createTempFile("prm-" + System.currentTimeMillis() + "-", ".csv"); - - var file = path.toFile(); - log.info("Fil opprettet: {}.", path); - file.deleteOnExit(); - var printWriter = new PrintWriter(file); - - var printer = new PermisjonSyntetiseringCsvPrinterConverter(printWriter); - for (int page = 0; page < numberOfPages; page++) { - log.info("Henter for side {}/{} med opp til {} per side.", page + 1, numberOfPages, PAGE_SIZE); - printer.write(inntektsmottakerHendelseRepository.getPermisjoner(page, PAGE_SIZE)); - printWriter.flush(); - } - log.info("Lukker printeren til fil {}.", path); - printer.close(); - return path; - } - - public Path writeInntekter() throws IOException { - var count = inntektsmottakerHendelseRepository.count(); - int numberOfPages = (int) Math.ceil(count / (float) PAGE_SIZE); - - if (numberOfPages > 1) { - log.warn("Deler opp operasjonen i {} deler for å unngå minne problemer.", numberOfPages); - } - var path = Files.createTempFile("ink-" + System.currentTimeMillis() + "-", ".csv"); - - var file = path.toFile(); - log.info("Fil opprettet: {}.", path); - file.deleteOnExit(); - var printWriter = new PrintWriter(file); - - var printer = new InntektSyntetiseringCsvPrinterConverter(printWriter); - for (int page = 0; page < numberOfPages; page++) { - log.info("Henter for side {}/{} med opp til {} per side.", page + 1, numberOfPages, PAGE_SIZE); - printer.write(inntektsmottakerHendelseRepository.getInntekter(page, PAGE_SIZE)); - printWriter.flush(); - } - log.info("Lukker printeren til fil {}.", path); - printer.close(); - return path; - } - - public Path writeAvvik() throws IOException { - var count = inntektsmottakerHendelseRepository.count(); - int numberOfPages = (int) Math.ceil(count / (float) PAGE_SIZE); - - if (numberOfPages > 1) { - log.warn("Deler opp operasjonen i {} deler for å unngå minne problemer.", numberOfPages); - } - var path = Files.createTempFile("avk-" + System.currentTimeMillis() + "-", ".csv"); - - var file = path.toFile(); - log.info("Fil opprettet: {}.", path); - file.deleteOnExit(); - var printWriter = new PrintWriter(file); - - var printer = new AvvikSyntetiseringCsvPrinterConverter(printWriter); - for (int page = 0; page < numberOfPages; page++) { - log.info("Henter for side {}/{} med opp til {} per side.", page + 1, numberOfPages, PAGE_SIZE); - printer.write(inntektsmottakerHendelseRepository.getAvvik(page, PAGE_SIZE)); - printWriter.flush(); - } - log.info("Lukker printeren til fil {}.", path); - printer.close(); - return path; - } -} diff --git a/apps/arbeidsforhold-export-api/src/main/resources/application-dev.yml b/apps/arbeidsforhold-export-api/src/main/resources/application-dev.yml deleted file mode 100644 index a1cf247e4df..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/resources/application-dev.yml +++ /dev/null @@ -1,2 +0,0 @@ -azure.app.client.id: ${client_id} -azure.app.client.secret: ${client_secret} \ No newline at end of file diff --git a/apps/arbeidsforhold-export-api/src/main/resources/application.yml b/apps/arbeidsforhold-export-api/src/main/resources/application.yml deleted file mode 100644 index dd90ba4f402..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/resources/application.yml +++ /dev/null @@ -1,49 +0,0 @@ -AAD_ISSUER_URI: https://login.microsoftonline.com/62366534-1ec3-4962-8869-9b5535279d0b - -database: - aareg: - username: ${AAREG_DB_USERNAME} - password: ${AAREG_DB_PASSWORD} - url: ${AAREG_DB_URL} - -spring: - security: - oauth2: - resourceserver: - aad: - issuer-uri: ${AAD_ISSUER_URI}/v2.0 - jwk-set-uri: ${AAD_ISSUER_URI}/discovery/v2.0/keys - accepted-audience: ${azure.app.client.id}, api://${azure.app.client.id} - tokenx: - issuer-uri: https://tokenx.dev-gcp.nav.cloud.nais.io - jwk-set-uri: https://tokenx.dev-gcp.nav.cloud.nais.io/jwks - accepted-audience: dev-fss:dolly:testnorge-arbeidsforhold-export-api - application: - version: application.version.todo #TODO Finn ut hvordan denne kan settes fra gradle - name: testnorge-arbeidsforhold-export-api - description: Api for å eksportere arbeidsforhold. - -springdoc: - swagger-ui: - disable-swagger-default-url: true - url: /v3/api-docs - -management: - endpoints: - enabled-by-default: true - web: - base-path: /internal - exposure.include: prometheus,heapdump,health - path-mapping: - prometheus: metrics - endpoint: - prometheus.enabled: true - heapdump.enabled: true - prometheus: - metrics: - export: - enabled: true -server: - servlet: - encoding: - charset: UTF-8 \ No newline at end of file diff --git a/apps/arbeidsforhold-export-api/src/main/resources/bootstrap.yml b/apps/arbeidsforhold-export-api/src/main/resources/bootstrap.yml deleted file mode 100644 index 0451449ca23..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/resources/bootstrap.yml +++ /dev/null @@ -1,4 +0,0 @@ -spring: - cloud: - vault: - enabled: false \ No newline at end of file diff --git a/apps/arbeidsforhold-export-api/src/main/resources/logback-spring.xml b/apps/arbeidsforhold-export-api/src/main/resources/logback-spring.xml deleted file mode 100644 index 3d872283bfc..00000000000 --- a/apps/arbeidsforhold-export-api/src/main/resources/logback-spring.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - true - 256 - 10280 - 20 - ^sun\.reflect\..*\.invoke - ^net\.sf\.cglib\.proxy\.MethodProxy\.invoke - java\.util\.concurrent\..* - org\.apache\.catalina\..* - org\.apache\.coyote\..* - org\.apache\.tomcat\..* - - - - - - - - - - - - - %d{HH:mm:ss.SSS} | %5p | %logger{25} | %m%n - - utf8 - - - - - - - - \ No newline at end of file diff --git a/apps/arbeidsforhold-export-api/src/test/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/ApplicationContextTest.java b/apps/arbeidsforhold-export-api/src/test/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/ApplicationContextTest.java deleted file mode 100644 index 7e4a1ba217e..00000000000 --- a/apps/arbeidsforhold-export-api/src/test/java/no/nav/no/registere/testnorge/arbeidsforholdexportapi/ApplicationContextTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package no.nav.no.registere.testnorge.arbeidsforholdexportapi; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.security.oauth2.jwt.JwtDecoder; -import org.springframework.test.context.ActiveProfiles; - -@SpringBootTest -@ActiveProfiles("test") -class ApplicationContextTest { - - @MockBean - public JwtDecoder jwtDecoder; - - @Test - @SuppressWarnings("java:S2699") - void load_app_context() { - } -} diff --git a/apps/arbeidsforhold-export-api/src/test/resources/application-test.properties b/apps/arbeidsforhold-export-api/src/test/resources/application-test.properties deleted file mode 100644 index bfbfa2a1453..00000000000 --- a/apps/arbeidsforhold-export-api/src/test/resources/application-test.properties +++ /dev/null @@ -1,4 +0,0 @@ -spring.cloud.vault.token=dummy -AAREG_DB_USERNAME=dummy -AAREG_DB_PASSWORD=dummy -AAREG_DB_URL=dummy \ No newline at end of file diff --git a/apps/hodejegeren/config.yml b/apps/hodejegeren/config.yml index 57c290a711a..f987eab4b81 100644 --- a/apps/hodejegeren/config.yml +++ b/apps/hodejegeren/config.yml @@ -33,10 +33,6 @@ spec: rules: - application: team-dolly-lokal-app cluster: dev-gcp - - application: testnorge-tp - cluster: dev-fss - - application: testnorge-statisk-data-forvalter - cluster: dev-fss - application: testnav-hodejegeren-proxy cluster: dev-fss - application: mn-synt-arbeidsforhold-service diff --git a/apps/import-person-service/Dockerfile b/apps/import-person-service/Dockerfile deleted file mode 100644 index 4a36f93546f..00000000000 --- a/apps/import-person-service/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM ghcr.io/navikt/baseimages/temurin:21 -LABEL maintainer="Team Dolly" - -ENV JAVA_OPTS="-Dspring.profiles.active=prod" - -ADD /build/libs/app.jar /app/app.jar - -EXPOSE 8080 diff --git a/apps/import-person-service/README.md b/apps/import-person-service/README.md deleted file mode 100644 index ad28f176741..00000000000 --- a/apps/import-person-service/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# Testnav-generer-organisasjon-populasjon-service - -Service for å opprette liste med identer i pdl forvalter. - -## Swagger - -Swagger finnes under [/swagger](https://testnav-import-person-service.intern.dev.nav.no/swagger) -endepunktet til -applikasjonen. - -## Lokal kjøring - -Ha naisdevice kjørende og kjør ImportPersonServiceServiceApplicationStarter med følgende argumenter: - -``` --Dspring.cloud.vault.token=[Copy token fra Vault] --Dspring.profiles.active=dev -``` diff --git a/apps/import-person-service/build.gradle b/apps/import-person-service/build.gradle deleted file mode 100644 index 551675dd947..00000000000 --- a/apps/import-person-service/build.gradle +++ /dev/null @@ -1,89 +0,0 @@ -plugins { - id 'java' - id "org.sonarqube" version "4.0.0.2929" - id 'org.springframework.boot' version "3.1.4" - id 'io.spring.dependency-management' version "1.1.3" - id "jacoco" -} - -test { - useJUnitPlatform() -} - -jacocoTestReport { - reports { - xml.required = true - } -} - -sonarqube { - properties { - property "sonar.coverage.jacoco.xmlReportPaths", "${project.buildDir}/reports/jacoco/test/jacocoTestReport.xml" - property "sonar.dynamicAnalysis", "reuseReports" - property "sonar.host.url", "https://sonarcloud.io" - property "sonar.java.coveragePlugin", "jacoco" - property "sonar.language", "java" - property "sonar.login", System.getenv("SONAR_TOKEN") - property "sonar.organization", "navikt" - property "sonar.project.monorepo.enabled", true - property "sonar.projectKey", "testnav-import-person-service" - property "sonar.projectName", "testnav-import-person-service" - property "sonar.sourceEncoding", "UTF-8" - } -} - -bootJar { - archiveFileName = "app.jar" -} -dependencyManagement { - applyMavenExclusions = false - imports { - mavenBom 'org.springframework.cloud:spring-cloud-dependencies:2022.0.4' - } -} - -repositories { - mavenCentral() - mavenLocal() -} - -configurations { - configureEach { - exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging' - exclude group: 'ch.qos.logback', module: 'logback-classic' - } -} - -dependencies { - implementation 'no.nav.testnav.libs:security-core' - implementation 'no.nav.testnav.libs:reactive-core' - implementation 'no.nav.testnav.libs:reactive-security' - implementation 'no.nav.testnav.libs:data-transfer-search-objects' - - implementation 'org.springframework.boot:spring-boot-starter-webflux' - implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server' - - implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap' // TODO remove legacy bootstrap config - - implementation 'org.springframework.cloud:spring-cloud-starter-vault-config' - implementation 'org.springframework.boot:spring-boot-starter-actuator' - - implementation 'io.micrometer:micrometer-registry-prometheus' - - implementation 'org.hibernate.validator:hibernate-validator' - implementation 'org.springdoc:springdoc-openapi-starter-webflux-ui:2.0.4' - implementation 'io.swagger.core.v3:swagger-annotations-jakarta:2.2.16' - implementation 'net.logstash.logback:logstash-logback-encoder:7.4' - - testImplementation 'org.springframework.boot:spring-boot-starter-test' - testImplementation 'org.springframework.cloud:spring-cloud-contract-wiremock' - - implementation 'org.projectlombok:lombok' - annotationProcessor 'org.projectlombok:lombok' - testAnnotationProcessor 'org.projectlombok:lombok' -} -java { - toolchain { - languageVersion = JavaLanguageVersion.of(21) - } -} diff --git a/apps/import-person-service/config.yml b/apps/import-person-service/config.yml deleted file mode 100644 index 604dc608641..00000000000 --- a/apps/import-person-service/config.yml +++ /dev/null @@ -1,54 +0,0 @@ -apiVersion: "nais.io/v1alpha1" -kind: "Application" -metadata: - name: testnav-import-person-service - namespace: dolly - labels: - team: dolly -spec: - image: {{image}} - port: 8080 - webproxy: true - tokenx: - enabled: true - azure: - application: - allowAllUsers: true - enabled: true - tenant: nav.no - accessPolicy: - inbound: - rules: - - application: team-dolly-lokal-app - cluster: dev-gcp - - application: testnav-oversikt-frontend - cluster: dev-gcp - - application: testnav-pdl-forvalter - cluster: dev-gcp - outbound: - rules: - - application: testnav-pdl-forvalter - liveness: - path: /internal/isAlive - initialDelay: 4 - periodSeconds: 5 - failureThreshold: 500 - readiness: - path: /internal/isReady - initialDelay: 4 - periodSeconds: 5 - failureThreshold: 500 - prometheus: - enabled: true - path: /internal/metrics - replicas: - min: 1 - max: 1 - resources: - requests: - cpu: 200m - memory: 1024Mi - limits: - memory: 2048Mi - ingresses: - - "https://testnav-import-person-service.intern.dev.nav.no" \ No newline at end of file diff --git a/apps/import-person-service/gradle/wrapper/gradle-wrapper.jar b/apps/import-person-service/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 7454180f2ae..00000000000 Binary files a/apps/import-person-service/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/apps/import-person-service/gradle/wrapper/gradle-wrapper.properties b/apps/import-person-service/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index e411586a54a..00000000000 --- a/apps/import-person-service/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/apps/import-person-service/gradlew b/apps/import-person-service/gradlew deleted file mode 100755 index 3da45c161b0..00000000000 --- a/apps/import-person-service/gradlew +++ /dev/null @@ -1,234 +0,0 @@ -#!/bin/sh - -# -# Copyright ? 2015-2021 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions ?$var?, ?${var}?, ?${var:-default}?, ?${var+SET}?, -# ?${var#prefix}?, ?${var%suffix}?, and ?$( cmd )?; -# * compound commands having a testable exit status, especially ?case?; -# * various built-in commands including ?command?, ?set?, and ?ulimit?. -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" -APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/apps/import-person-service/gradlew.bat b/apps/import-person-service/gradlew.bat deleted file mode 100644 index ac1b06f9382..00000000000 --- a/apps/import-person-service/gradlew.bat +++ /dev/null @@ -1,89 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/apps/import-person-service/gradlewUpdate.sh b/apps/import-person-service/gradlewUpdate.sh deleted file mode 100755 index e5ee6361152..00000000000 --- a/apps/import-person-service/gradlewUpdate.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -gradle wrapper \ No newline at end of file diff --git a/apps/import-person-service/settings.gradle b/apps/import-person-service/settings.gradle deleted file mode 100644 index 8b741eaa1c5..00000000000 --- a/apps/import-person-service/settings.gradle +++ /dev/null @@ -1,17 +0,0 @@ -plugins { - id "com.gradle.enterprise" version "3.12.3" -} - -rootProject.name = 'import-person-service' - -includeBuild '../../libs/security-core' -includeBuild '../../libs/reactive-core' -includeBuild '../../libs/reactive-security' -includeBuild '../../libs/data-transfer-search-objects' - -gradleEnterprise { - buildScan { - termsOfServiceUrl = "https://gradle.com/terms-of-service" - termsOfServiceAgree = "yes" - } -} \ No newline at end of file diff --git a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/ImportPersonServiceServiceApplicationStarter.java b/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/ImportPersonServiceServiceApplicationStarter.java deleted file mode 100644 index 754e44c2697..00000000000 --- a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/ImportPersonServiceServiceApplicationStarter.java +++ /dev/null @@ -1,20 +0,0 @@ -package no.nav.testnav.apps.importpersonservice; - -import no.nav.testnav.libs.reactivecore.config.CoreConfig; -import no.nav.testnav.libs.reactivesecurity.config.SecureOAuth2ServerToServerConfiguration; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Import; -import org.springframework.web.reactive.config.EnableWebFlux; - -@Import({ - CoreConfig.class, - SecureOAuth2ServerToServerConfiguration.class -}) -@EnableWebFlux -@SpringBootApplication -public class ImportPersonServiceServiceApplicationStarter { - public static void main(String[] args) { - SpringApplication.run(ImportPersonServiceServiceApplicationStarter.class, args); - } -} \ No newline at end of file diff --git a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/config/Consumers.java b/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/config/Consumers.java deleted file mode 100644 index 5b3b1edac09..00000000000 --- a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/config/Consumers.java +++ /dev/null @@ -1,29 +0,0 @@ -package no.nav.testnav.apps.importpersonservice.config; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import static lombok.AccessLevel.PACKAGE; - -/** - * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. - *

- * Husk at Spring Boot bruker relaxed binding - * mellom configuration properties og field names. - * - * @see ServerProperties - */ -@Configuration -@ConfigurationProperties(prefix = "consumers") -@NoArgsConstructor(access = PACKAGE) -@Getter -@Setter(PACKAGE) -public class Consumers { - - private ServerProperties testnavPdlForvalter; - -} diff --git a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/config/DevConfig.java b/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/config/DevConfig.java deleted file mode 100644 index 14efd3b1eeb..00000000000 --- a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/config/DevConfig.java +++ /dev/null @@ -1,36 +0,0 @@ -package no.nav.testnav.apps.importpersonservice.config; - -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; -import org.springframework.vault.annotation.VaultPropertySource; -import org.springframework.vault.authentication.ClientAuthentication; -import org.springframework.vault.authentication.TokenAuthentication; -import org.springframework.vault.client.VaultEndpoint; -import org.springframework.vault.config.AbstractVaultConfiguration; - -import static io.micrometer.common.util.StringUtils.isBlank; - -@Configuration -@Profile("dev") -@VaultPropertySource(value = "secret/dolly/lokal", ignoreSecretNotFound = false) -public class DevConfig extends AbstractVaultConfiguration { - - private static final String VAULT_TOKEN = "spring.cloud.vault.token"; - - @Override - public VaultEndpoint vaultEndpoint() { - return VaultEndpoint.create("vault.adeo.no", 443); - } - - @Override - public ClientAuthentication clientAuthentication() { - if (System.getenv().containsKey("VAULT_TOKEN")) { - System.setProperty(VAULT_TOKEN, System.getenv("VAULT_TOKEN")); - } - var token = System.getProperty(VAULT_TOKEN); - if (isBlank(token)) { - throw new IllegalArgumentException("Påkrevet property 'spring.cloud.vault.token' er ikke satt."); - } - return new TokenAuthentication(System.getProperty(VAULT_TOKEN)); - } -} diff --git a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/config/OpenApiConfig.java b/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/config/OpenApiConfig.java deleted file mode 100644 index 2fdbb99a03d..00000000000 --- a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/config/OpenApiConfig.java +++ /dev/null @@ -1,49 +0,0 @@ -package no.nav.testnav.apps.importpersonservice.config; - -import io.swagger.v3.oas.models.Components; -import io.swagger.v3.oas.models.OpenAPI; -import io.swagger.v3.oas.models.info.Contact; -import io.swagger.v3.oas.models.info.Info; -import io.swagger.v3.oas.models.info.License; -import io.swagger.v3.oas.models.security.SecurityRequirement; -import io.swagger.v3.oas.models.security.SecurityScheme; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import java.util.Arrays; - -import no.nav.testnav.libs.reactivecore.config.ApplicationProperties; - - -@Configuration -public class OpenApiConfig { - - @Bean - public OpenAPI openApi(ApplicationProperties applicationProperties) { - return new OpenAPI() - .components(new Components().addSecuritySchemes("bearer-jwt", new SecurityScheme() - .type(SecurityScheme.Type.HTTP) - .scheme("bearer") - .bearerFormat("JWT") - .in(SecurityScheme.In.HEADER) - .name("Authorization") - )) - .addSecurityItem( - new SecurityRequirement().addList("bearer-jwt", Arrays.asList("read", "write"))) - .info(new Info() - .title(applicationProperties.getName()) - .version(applicationProperties.getVersion()) - .description(applicationProperties.getDescription()) - .termsOfService("https://nav.no") - .contact(new Contact() - .url("https://nav-it.slack.com/archives/CA3P9NGA2") - .email("dolly@nav.no") - .name("Team Dolly") - ) - .license(new License() - .name("MIT License") - .url("https://opensource.org/licenses/MIT") - ) - ); - } -} \ No newline at end of file diff --git a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/config/SecurityConfig.java b/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/config/SecurityConfig.java deleted file mode 100644 index c2ce826076a..00000000000 --- a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/config/SecurityConfig.java +++ /dev/null @@ -1,42 +0,0 @@ -package no.nav.testnav.apps.importpersonservice.config; - -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.config.annotation.method.configuration.EnableReactiveMethodSecurity; -import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity; -import org.springframework.security.config.web.server.ServerHttpSecurity; -import org.springframework.security.web.server.SecurityWebFilterChain; - -import no.nav.testnav.libs.reactivesecurity.manager.JwtReactiveAuthenticationManager; - - -@Slf4j -@Configuration -@EnableWebFluxSecurity -@EnableReactiveMethodSecurity -@RequiredArgsConstructor -public class SecurityConfig { - - private final JwtReactiveAuthenticationManager jwtReactiveAuthenticationManager; - - @Bean - public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity httpSecurity) { - return httpSecurity - .csrf(ServerHttpSecurity.CsrfSpec::disable) - .authorizeExchange(authorizeConfig -> authorizeConfig.pathMatchers( - "/internal/**", - "/webjars/**", - "/swagger-resources/**", - "/v3/api-docs/**", - "/swagger-ui/**", - "/swagger", - "/error", - "/swagger-ui.html" - ).permitAll().anyExchange().authenticated()) - .oauth2ResourceServer(oauth2RSConfig -> oauth2RSConfig.jwt(jwtSpec -> jwtSpec.authenticationManager(jwtReactiveAuthenticationManager))) - .build(); - } -} - diff --git a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/consumer/PdlForvalterConsumer.java b/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/consumer/PdlForvalterConsumer.java deleted file mode 100644 index f5a99c7c700..00000000000 --- a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/consumer/PdlForvalterConsumer.java +++ /dev/null @@ -1,48 +0,0 @@ -package no.nav.testnav.apps.importpersonservice.consumer; - -import no.nav.testnav.apps.importpersonservice.config.Consumers; -import no.nav.testnav.apps.importpersonservice.consumer.command.OppdaterPersonCommand; -import no.nav.testnav.apps.importpersonservice.consumer.command.SendPersonTilPdlCommand; -import no.nav.testnav.apps.importpersonservice.consumer.request.OppdaterPersonRequest; -import no.nav.testnav.apps.importpersonservice.domain.PersonList; -import no.nav.testnav.libs.data.pdlforvalter.v1.OrdreResponseDTO; -import no.nav.testnav.libs.reactivesecurity.exchange.TokenExchange; -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.stereotype.Component; -import org.springframework.web.reactive.function.client.WebClient; -import reactor.core.publisher.Flux; - -import java.util.stream.Collectors; - -@Component -public class PdlForvalterConsumer { - private final WebClient webClient; - private final ServerProperties serverProperties; - private final TokenExchange tokenExchange; - - public PdlForvalterConsumer( - Consumers consumers, - TokenExchange tokenExchange) { - serverProperties = consumers.getTestnavPdlForvalter(); - this.tokenExchange = tokenExchange; - this.webClient = WebClient - .builder() - .baseUrl(serverProperties.getUrl()) - .build(); - } - - public Flux opprett(PersonList list) { - Flux ordreResponseDTOFlux = tokenExchange - .exchange(serverProperties) - .flatMapMany(accessToken -> Flux.concat(list - .getList() - .stream() - .map(OppdaterPersonRequest::new) - .map(request -> new OppdaterPersonCommand(webClient, request, accessToken.getTokenValue()).call()) - .collect(Collectors.toList())) - .flatMap(value -> new SendPersonTilPdlCommand(webClient, value, accessToken.getTokenValue()).call().flux()) - ); - return ordreResponseDTOFlux - .map(ordre -> ordre.getHovedperson().getIdent()); - } -} diff --git a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/consumer/command/OppdaterPersonCommand.java b/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/consumer/command/OppdaterPersonCommand.java deleted file mode 100644 index 3cf723c504b..00000000000 --- a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/consumer/command/OppdaterPersonCommand.java +++ /dev/null @@ -1,36 +0,0 @@ -package no.nav.testnav.apps.importpersonservice.consumer.command; - -import lombok.RequiredArgsConstructor; -import no.nav.testnav.apps.importpersonservice.consumer.request.OppdaterPersonRequest; -import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; -import org.springframework.http.HttpHeaders; -import org.springframework.web.reactive.function.BodyInserters; -import org.springframework.web.reactive.function.client.WebClient; -import reactor.core.publisher.Mono; -import reactor.util.retry.Retry; - -import java.time.Duration; -import java.util.concurrent.Callable; - -@RequiredArgsConstructor -public class OppdaterPersonCommand implements Callable> { - private final WebClient webClient; - private final OppdaterPersonRequest dto; - private final String token; - - @Override - public Mono call() { - return webClient - .put() - .uri(builder -> builder - .path("/api/v1/personer/{ident}") - .build(dto.getPerson().getIdent()) - ) - .header(HttpHeaders.AUTHORIZATION, "Bearer " + token) - .body(BodyInserters.fromPublisher(Mono.just(dto), OppdaterPersonRequest.class)) - .retrieve() - .bodyToMono(String.class) - .retryWhen(Retry.backoff(3, Duration.ofSeconds(5)) - .filter(WebClientFilter::is5xxException)); - } -} diff --git a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/consumer/command/SendPersonTilPdlCommand.java b/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/consumer/command/SendPersonTilPdlCommand.java deleted file mode 100644 index fe18c72cd70..00000000000 --- a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/consumer/command/SendPersonTilPdlCommand.java +++ /dev/null @@ -1,37 +0,0 @@ -package no.nav.testnav.apps.importpersonservice.consumer.command; - -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import no.nav.testnav.libs.data.pdlforvalter.v1.OrdreResponseDTO; -import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; -import org.springframework.http.HttpHeaders; -import org.springframework.web.reactive.function.client.WebClient; -import reactor.core.publisher.Mono; -import reactor.util.retry.Retry; - -import java.time.Duration; -import java.util.concurrent.Callable; - -@Slf4j -@RequiredArgsConstructor -public class SendPersonTilPdlCommand implements Callable> { - private final WebClient webClient; - private final String ident; - private final String token; - - @Override - public Mono call() { - log.info("Sender person {} til PDL.", ident); - return webClient - .post() - .uri(builder -> builder - .path("/api/v1/personer/{ident}/ordre") - .build(ident) - ) - .header(HttpHeaders.AUTHORIZATION, "Bearer " + token) - .retrieve() - .bodyToMono(OrdreResponseDTO.class) - .retryWhen(Retry.backoff(3, Duration.ofSeconds(5)) - .filter(WebClientFilter::is5xxException)); - } -} diff --git a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/consumer/dto/NavnDTO.java b/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/consumer/dto/NavnDTO.java deleted file mode 100644 index 8f31e215e4a..00000000000 --- a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/consumer/dto/NavnDTO.java +++ /dev/null @@ -1,15 +0,0 @@ -package no.nav.testnav.apps.importpersonservice.consumer.dto; - - -import lombok.AllArgsConstructor; -import lombok.NoArgsConstructor; -import lombok.Value; - -import no.nav.testnav.libs.data.pdlforvalter.v1.DbVersjonDTO; - -@Value -@AllArgsConstructor -@NoArgsConstructor(force = true) -public class NavnDTO { - DbVersjonDTO.Master master; -} diff --git a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/consumer/dto/PersonDTO.java b/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/consumer/dto/PersonDTO.java deleted file mode 100644 index b02f59b69e9..00000000000 --- a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/consumer/dto/PersonDTO.java +++ /dev/null @@ -1,23 +0,0 @@ -package no.nav.testnav.apps.importpersonservice.consumer.dto; - -import lombok.AllArgsConstructor; -import lombok.NoArgsConstructor; -import lombok.Value; -import no.nav.testnav.apps.importpersonservice.domain.Person; -import no.nav.testnav.libs.data.pdlforvalter.v1.DbVersjonDTO; - -import java.util.Collections; -import java.util.List; - -@Value -@AllArgsConstructor -@NoArgsConstructor(force = true) -public class PersonDTO { - String ident; - List navn; - - public PersonDTO(Person person) { - this.ident = person.getIdent(); - this.navn = Collections.singletonList(new NavnDTO(DbVersjonDTO.Master.FREG)); // TODO: Remove hack when pdl-forvalter is ready - } -} diff --git a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/consumer/request/OppdaterPersonRequest.java b/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/consumer/request/OppdaterPersonRequest.java deleted file mode 100644 index e5d828956e2..00000000000 --- a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/consumer/request/OppdaterPersonRequest.java +++ /dev/null @@ -1,19 +0,0 @@ -package no.nav.testnav.apps.importpersonservice.consumer.request; - -import lombok.AllArgsConstructor; -import lombok.NoArgsConstructor; -import lombok.Value; - -import no.nav.testnav.apps.importpersonservice.consumer.dto.PersonDTO; -import no.nav.testnav.apps.importpersonservice.domain.Person; - -@Value -@AllArgsConstructor -@NoArgsConstructor(force = true) -public class OppdaterPersonRequest { - PersonDTO person; - - public OppdaterPersonRequest(Person person){ - this.person = new PersonDTO(person); - } -} diff --git a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/controller/ImportPersonController.java b/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/controller/ImportPersonController.java deleted file mode 100644 index 5d9440a08cd..00000000000 --- a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/controller/ImportPersonController.java +++ /dev/null @@ -1,33 +0,0 @@ -package no.nav.testnav.apps.importpersonservice.controller; - -import lombok.RequiredArgsConstructor; -import org.springframework.http.MediaType; -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 reactor.core.publisher.Flux; - -import java.util.List; - -import no.nav.testnav.apps.importpersonservice.consumer.PdlForvalterConsumer; -import no.nav.testnav.apps.importpersonservice.controller.dto.PersonListDTO; -import no.nav.testnav.apps.importpersonservice.domain.PersonList; - -@RestController -@RequestMapping("/api/v1/personer") -@RequiredArgsConstructor -public class ImportPersonController { - private final PdlForvalterConsumer pdlForvalterConsumer; - - @PostMapping(produces = MediaType.TEXT_EVENT_STREAM_VALUE) - public Flux opprett(@RequestBody PersonListDTO dto) { - return pdlForvalterConsumer.opprett(new PersonList(dto)); - } - - @PostMapping(value = "/identer", produces = MediaType.TEXT_EVENT_STREAM_VALUE) - public Flux opprettIdenter(@RequestBody List identer) { - return pdlForvalterConsumer.opprett(new PersonList(identer)); - } - -} diff --git a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/controller/dto/PersonDTO.java b/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/controller/dto/PersonDTO.java deleted file mode 100644 index bf77a2929f4..00000000000 --- a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/controller/dto/PersonDTO.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.testnav.apps.importpersonservice.controller.dto; - -import lombok.AllArgsConstructor; -import lombok.NoArgsConstructor; -import lombok.Value; - -@Value -@AllArgsConstructor -@NoArgsConstructor(force = true) -public class PersonDTO { - String ident; -} diff --git a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/controller/dto/PersonListDTO.java b/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/controller/dto/PersonListDTO.java deleted file mode 100644 index 37810c779ee..00000000000 --- a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/controller/dto/PersonListDTO.java +++ /dev/null @@ -1,14 +0,0 @@ -package no.nav.testnav.apps.importpersonservice.controller.dto; - -import lombok.AllArgsConstructor; -import lombok.NoArgsConstructor; -import lombok.Value; - -import java.util.List; - -@Value -@AllArgsConstructor -@NoArgsConstructor(force = true) -public class PersonListDTO { - List personList; -} diff --git a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/domain/Person.java b/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/domain/Person.java deleted file mode 100644 index e27abcbbad3..00000000000 --- a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/domain/Person.java +++ /dev/null @@ -1,19 +0,0 @@ -package no.nav.testnav.apps.importpersonservice.domain; - -import no.nav.testnav.apps.importpersonservice.controller.dto.PersonDTO; - -public class Person { - private final String ident; - - public Person(String ident){ - this.ident = ident; - } - - public Person(PersonDTO dto) { - this.ident = dto.getIdent(); - } - - public String getIdent() { - return ident; - } -} diff --git a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/domain/PersonList.java b/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/domain/PersonList.java deleted file mode 100644 index b105e6e1201..00000000000 --- a/apps/import-person-service/src/main/java/no/nav/testnav/apps/importpersonservice/domain/PersonList.java +++ /dev/null @@ -1,24 +0,0 @@ -package no.nav.testnav.apps.importpersonservice.domain; - -import no.nav.testnav.apps.importpersonservice.controller.dto.PersonListDTO; - -import java.util.List; - -public class PersonList { - - private final List list; - - public PersonList(PersonListDTO dto) { - this.list = dto.getPersonList().stream().map(Person::new) - .toList(); - } - - public PersonList(List identer) { - this.list = identer.stream().map(Person::new) - .toList(); - } - - public List getList() { - return list; - } -} diff --git a/apps/import-person-service/src/main/resources/application-dev.yml b/apps/import-person-service/src/main/resources/application-dev.yml deleted file mode 100644 index 44d6b6dc9e7..00000000000 --- a/apps/import-person-service/src/main/resources/application-dev.yml +++ /dev/null @@ -1,4 +0,0 @@ - -consumers.testnav-pdl-forvalter: - url: https://testnav-pdl-forvalter-dev.intern.dev.nav.no - name: testnav-pdl-forvalter-dev \ No newline at end of file diff --git a/apps/import-person-service/src/main/resources/application.yml b/apps/import-person-service/src/main/resources/application.yml deleted file mode 100644 index bb93cdbb296..00000000000 --- a/apps/import-person-service/src/main/resources/application.yml +++ /dev/null @@ -1,53 +0,0 @@ -AAD_ISSUER_URI: https://login.microsoftonline.com/62366534-1ec3-4962-8869-9b5535279d0b - -spring: - application: - version: application.version.todo #TODO Finn ut hvordan denne kan settes fra gradle - name: testnav-import-person-service - desciption: Tjeneste for å sende inn personer til PDL - security: - oauth2: - resourceserver: - aad: - issuer-uri: ${AAD_ISSUER_URI}/v2.0 - jwk-set-uri: ${AAD_ISSUER_URI}/discovery/v2.0/keys - accepted-audience: ${azure.app.client.id}, api://${azure.app.client.id} - tokenx: - issuer-uri: https://tokenx.dev-gcp.nav.cloud.nais.io - jwk-set-uri: https://tokenx.dev-gcp.nav.cloud.nais.io/jwks - accepted-audience: dev-gcp:dolly:testnav-import-person-service - -springdoc: - swagger-ui: - disable-swagger-default-url: true - url: /v3/api-docs - -consumers: - testnav-pdl-forvalter: - url: http://testnav-pdl-forvalter.dolly.svc.cluster.local - cluster: dev-gcp - namespace: dolly - name: testnav-pdl-forvalter - -management: - endpoints: - enabled-by-default: true - web: - base-path: /internal - exposure.include: prometheus,heapdump,health - path-mapping: - prometheus: metrics - endpoint: - prometheus.enabled: true - heapdump.enabled: true - health: - elasticsearch: - enabled: false - prometheus: - metrics: - export: - enabled: true -server: - servlet: - encoding: - charset: UTF-8 \ No newline at end of file diff --git a/apps/import-person-service/src/main/resources/bootstrap.yml b/apps/import-person-service/src/main/resources/bootstrap.yml deleted file mode 100644 index 0451449ca23..00000000000 --- a/apps/import-person-service/src/main/resources/bootstrap.yml +++ /dev/null @@ -1,4 +0,0 @@ -spring: - cloud: - vault: - enabled: false \ No newline at end of file diff --git a/apps/import-person-service/src/main/resources/logback-spring.xml b/apps/import-person-service/src/main/resources/logback-spring.xml deleted file mode 100644 index 52c15597b3c..00000000000 --- a/apps/import-person-service/src/main/resources/logback-spring.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - true - 256 - 10280 - 20 - ^sun\.reflect\..*\.invoke - ^net\.sf\.cglib\.proxy\.MethodProxy\.invoke - java\.util\.concurrent\..* - org\.apache\.catalina\..* - org\.apache\.coyote\..* - org\.apache\.tomcat\..* - - - - - - - - - - - - - %d{HH:mm:ss.SSS} | %5p | %logger{25} | %m%n - - utf8 - - - - - - - - - \ No newline at end of file diff --git a/apps/import-person-service/src/test/java/no/nav/testnav/apps/importpersonservice/ApplicationContextTest.java b/apps/import-person-service/src/test/java/no/nav/testnav/apps/importpersonservice/ApplicationContextTest.java deleted file mode 100644 index 72bd24c2a7b..00000000000 --- a/apps/import-person-service/src/test/java/no/nav/testnav/apps/importpersonservice/ApplicationContextTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package no.nav.testnav.apps.importpersonservice; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.security.oauth2.jwt.ReactiveJwtDecoder; - -@SpringBootTest -public class ApplicationContextTest { - - @MockBean - public ReactiveJwtDecoder jwtDecoder; - - @Test - @SuppressWarnings("java:S2699") - void load_app_context() { - } -} diff --git a/apps/import-person-service/src/test/resources/application-test.properties b/apps/import-person-service/src/test/resources/application-test.properties deleted file mode 100644 index f44e7773252..00000000000 --- a/apps/import-person-service/src/test/resources/application-test.properties +++ /dev/null @@ -1,3 +0,0 @@ -spring.cloud.vault.token=dummy -azure.app.client.id=dummy -azure.app.client.secret=dummy \ No newline at end of file diff --git a/apps/jenkins-batch-status-service/src/main/java/no/nav/registre/testnorge/jenkinsbatchstatusservice/consumer/OrganisasjonBestillingConsumer.java b/apps/jenkins-batch-status-service/src/main/java/no/nav/registre/testnorge/jenkinsbatchstatusservice/consumer/OrganisasjonBestillingConsumer.java index 1fa23bc274e..9a5dd53e756 100644 --- a/apps/jenkins-batch-status-service/src/main/java/no/nav/registre/testnorge/jenkinsbatchstatusservice/consumer/OrganisasjonBestillingConsumer.java +++ b/apps/jenkins-batch-status-service/src/main/java/no/nav/registre/testnorge/jenkinsbatchstatusservice/consumer/OrganisasjonBestillingConsumer.java @@ -7,7 +7,7 @@ import no.nav.registre.testnorge.jenkinsbatchstatusservice.config.Consumers; import no.nav.registre.testnorge.jenkinsbatchstatusservice.consumer.command.SaveOrganisasjonBestillingCommand; import no.nav.registre.testnorge.jenkinsbatchstatusservice.consumer.command.UpdateOrganisasjonBestillingCommand; -import no.nav.testnav.libs.dto.organiasjonbestilling.v1.OrderDTO; +import no.nav.testnav.libs.dto.organisajonbestilling.v1.OrderDTO; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.http.client.reactive.ReactorClientHttpConnector; diff --git a/apps/jenkins-batch-status-service/src/main/java/no/nav/registre/testnorge/jenkinsbatchstatusservice/consumer/command/UpdateOrganisasjonBestillingCommand.java b/apps/jenkins-batch-status-service/src/main/java/no/nav/registre/testnorge/jenkinsbatchstatusservice/consumer/command/UpdateOrganisasjonBestillingCommand.java index ca9c3a09806..07321e794c4 100644 --- a/apps/jenkins-batch-status-service/src/main/java/no/nav/registre/testnorge/jenkinsbatchstatusservice/consumer/command/UpdateOrganisasjonBestillingCommand.java +++ b/apps/jenkins-batch-status-service/src/main/java/no/nav/registre/testnorge/jenkinsbatchstatusservice/consumer/command/UpdateOrganisasjonBestillingCommand.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import no.nav.testnav.libs.commands.utils.WebClientFilter; -import no.nav.testnav.libs.dto.organiasjonbestilling.v1.OrderDTO; +import no.nav.testnav.libs.dto.organisajonbestilling.v1.OrderDTO; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.BodyInserters; import org.springframework.web.reactive.function.client.WebClient; diff --git a/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/controller/v1/OrderController.java b/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/controller/v1/OrderController.java index 71b936d9939..042981526b7 100644 --- a/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/controller/v1/OrderController.java +++ b/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/controller/v1/OrderController.java @@ -17,8 +17,8 @@ import java.util.List; import java.util.Set; -import no.nav.testnav.libs.dto.organiasjonbestilling.v1.ItemDTO; -import no.nav.testnav.libs.dto.organiasjonbestilling.v1.OrderDTO; +import no.nav.testnav.libs.dto.organisajonbestilling.v1.ItemDTO; +import no.nav.testnav.libs.dto.organisajonbestilling.v1.OrderDTO; import no.nav.testnav.apps.organisasjonbestillingservice.domain.v1.Order; import no.nav.testnav.apps.organisasjonbestillingservice.service.v1.OrderService; diff --git a/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/controller/v2/OrderControllerV2.java b/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/controller/v2/OrderControllerV2.java index e9371bb563c..b411b54684f 100644 --- a/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/controller/v2/OrderControllerV2.java +++ b/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/controller/v2/OrderControllerV2.java @@ -4,8 +4,8 @@ import lombok.extern.slf4j.Slf4j; import no.nav.testnav.apps.organisasjonbestillingservice.domain.v2.Order; import no.nav.testnav.apps.organisasjonbestillingservice.service.v2.OrderServiceV2; -import no.nav.testnav.libs.dto.organiasjonbestilling.v2.OrderDTO; -import no.nav.testnav.libs.dto.organiasjonbestilling.v2.StatusDTO; +import no.nav.testnav.libs.dto.organisajonbestilling.v2.OrderDTO; +import no.nav.testnav.libs.dto.organisajonbestilling.v2.StatusDTO; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; diff --git a/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/domain/v1/Order.java b/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/domain/v1/Order.java index 560dadeafa8..84d8dc62ecd 100644 --- a/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/domain/v1/Order.java +++ b/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/domain/v1/Order.java @@ -1,7 +1,7 @@ package no.nav.testnav.apps.organisasjonbestillingservice.domain.v1; import no.nav.testnav.apps.organisasjonbestillingservice.repository.v1.model.OrderModel; -import no.nav.testnav.libs.dto.organiasjonbestilling.v1.OrderDTO; +import no.nav.testnav.libs.dto.organisajonbestilling.v1.OrderDTO; public class Order { private final Long batchId; diff --git a/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/domain/v2/Order.java b/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/domain/v2/Order.java index 476bf231521..69e54e564b4 100644 --- a/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/domain/v2/Order.java +++ b/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/domain/v2/Order.java @@ -3,7 +3,7 @@ import lombok.Value; -import no.nav.testnav.libs.dto.organiasjonbestilling.v2.OrderDTO; +import no.nav.testnav.libs.dto.organisajonbestilling.v2.OrderDTO; import no.nav.testnav.apps.organisasjonbestillingservice.repository.v2.entity.OrderEntity; @Value diff --git a/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/service/v1/OrderService.java b/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/service/v1/OrderService.java index d41a5908c0d..9e3122b222e 100644 --- a/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/service/v1/OrderService.java +++ b/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/service/v1/OrderService.java @@ -12,8 +12,8 @@ import no.nav.testnav.apps.organisasjonbestillingservice.consumer.EregBatchStatusConsumer; import no.nav.testnav.apps.organisasjonbestillingservice.repository.v1.OrderRepository; import no.nav.testnav.apps.organisasjonbestillingservice.repository.v1.model.OrderModel; -import no.nav.testnav.libs.dto.organiasjonbestilling.v1.ItemDTO; -import no.nav.testnav.libs.dto.organiasjonbestilling.v1.Status; +import no.nav.testnav.libs.dto.organisajonbestilling.v1.ItemDTO; +import no.nav.testnav.libs.dto.organisajonbestilling.v1.Status; import no.nav.testnav.apps.organisasjonbestillingservice.domain.v1.Order; @Slf4j diff --git a/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/service/v2/OrderServiceV2.java b/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/service/v2/OrderServiceV2.java index aaf777687fd..d05f99f986f 100644 --- a/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/service/v2/OrderServiceV2.java +++ b/apps/organisasjon-bestilling-service/src/main/java/no/nav/testnav/apps/organisasjonbestillingservice/service/v2/OrderServiceV2.java @@ -9,7 +9,7 @@ import no.nav.testnav.apps.organisasjonbestillingservice.repository.v2.entity.OrderEntity; import no.nav.testnav.apps.organisasjonbestillingservice.retry.RetryConfig; import no.nav.testnav.apps.organisasjonbestillingservice.service.RetryService; -import no.nav.testnav.libs.dto.organiasjonbestilling.v2.Status; +import no.nav.testnav.libs.dto.organisajonbestilling.v2.Status; import org.springframework.stereotype.Service; import org.springframework.web.reactive.function.client.WebClientResponseException; diff --git a/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/consumer/OrganisasjonBestillingConsumer.java b/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/consumer/OrganisasjonBestillingConsumer.java index 89d98e35e9c..440f5fd21f3 100644 --- a/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/consumer/OrganisasjonBestillingConsumer.java +++ b/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/consumer/OrganisasjonBestillingConsumer.java @@ -2,7 +2,7 @@ import no.nav.registre.testnorge.organisasjonfastedataservice.config.Consumers; import no.nav.registre.testnorge.organisasjonfastedataservice.consumer.command.GetOrdreCommand; -import no.nav.testnav.libs.dto.organiasjonbestilling.v1.ItemDTO; +import no.nav.testnav.libs.dto.organisajonbestilling.v1.ItemDTO; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; import org.springframework.stereotype.Component; diff --git a/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/consumer/command/GetOrdreCommand.java b/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/consumer/command/GetOrdreCommand.java index 033a15bf0e8..9bbe078682b 100644 --- a/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/consumer/command/GetOrdreCommand.java +++ b/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/consumer/command/GetOrdreCommand.java @@ -3,7 +3,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import no.nav.testnav.libs.commands.utils.WebClientFilter; -import no.nav.testnav.libs.dto.organiasjonbestilling.v1.ItemDTO; +import no.nav.testnav.libs.dto.organisajonbestilling.v1.ItemDTO; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.client.WebClient; import org.springframework.web.reactive.function.client.WebClientResponseException; diff --git a/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/controller/OrganisasjonOrdreController.java b/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/controller/OrganisasjonOrdreController.java index d52e9b59c6a..3ce0fcaadd9 100644 --- a/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/controller/OrganisasjonOrdreController.java +++ b/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/controller/OrganisasjonOrdreController.java @@ -4,7 +4,7 @@ import lombok.extern.slf4j.Slf4j; import no.nav.registre.testnorge.organisasjonfastedataservice.service.OrganisasjonOrdreService; import no.nav.registre.testnorge.organisasjonfastedataservice.service.OrganisasjonService; -import no.nav.testnav.libs.dto.organiasjonbestilling.v1.ItemDTO; +import no.nav.testnav.libs.dto.organisajonbestilling.v1.ItemDTO; import no.nav.testnav.libs.dto.organisasjonfastedataservice.v1.Gruppe; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/service/OrganisasjonOrdreService.java b/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/service/OrganisasjonOrdreService.java index 9227481aab3..4ad157b363c 100644 --- a/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/service/OrganisasjonOrdreService.java +++ b/apps/organisasjon-faste-data-service/src/main/java/no/nav/registre/testnorge/organisasjonfastedataservice/service/OrganisasjonOrdreService.java @@ -6,7 +6,7 @@ import java.util.List; import java.util.UUID; -import no.nav.testnav.libs.dto.organiasjonbestilling.v1.ItemDTO; +import no.nav.testnav.libs.dto.organisajonbestilling.v1.ItemDTO; import no.nav.testnav.libs.dto.organisasjonfastedataservice.v1.Gruppe; import no.nav.registre.testnorge.organisasjonfastedataservice.consumer.OrganisasjonBestillingConsumer; import no.nav.registre.testnorge.organisasjonfastedataservice.consumer.OrganisasjonMottakConsumer; diff --git a/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/consumer/OrganisasjonBestillingConsumer.java b/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/consumer/OrganisasjonBestillingConsumer.java index 3963338dcb5..89190fa8aad 100644 --- a/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/consumer/OrganisasjonBestillingConsumer.java +++ b/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/consumer/OrganisasjonBestillingConsumer.java @@ -3,7 +3,7 @@ import lombok.extern.slf4j.Slf4j; import no.nav.registre.testnorge.organisasjonmottak.config.Consumers; import no.nav.registre.testnorge.organisasjonmottak.consumer.command.RegisterBestillingCommand; -import no.nav.testnav.libs.dto.organiasjonbestilling.v2.OrderDTO; +import no.nav.testnav.libs.dto.organisajonbestilling.v2.OrderDTO; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; import org.springframework.stereotype.Component; diff --git a/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/consumer/command/RegisterBestillingCommand.java b/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/consumer/command/RegisterBestillingCommand.java index 460e86aa0e6..0ca9277f8da 100644 --- a/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/consumer/command/RegisterBestillingCommand.java +++ b/apps/organisasjon-mottak-service/src/main/java/no/nav/registre/testnorge/organisasjonmottak/consumer/command/RegisterBestillingCommand.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import no.nav.testnav.libs.commands.utils.WebClientFilter; -import no.nav.testnav.libs.dto.organiasjonbestilling.v2.OrderDTO; +import no.nav.testnav.libs.dto.organisajonbestilling.v2.OrderDTO; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.BodyInserters; import org.springframework.web.reactive.function.client.WebClient; diff --git a/apps/person-export-api/Dockerfile b/apps/person-export-api/Dockerfile deleted file mode 100644 index 4a36f93546f..00000000000 --- a/apps/person-export-api/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM ghcr.io/navikt/baseimages/temurin:21 -LABEL maintainer="Team Dolly" - -ENV JAVA_OPTS="-Dspring.profiles.active=prod" - -ADD /build/libs/app.jar /app/app.jar - -EXPOSE 8080 diff --git a/apps/person-export-api/README.md b/apps/person-export-api/README.md deleted file mode 100644 index 5294584c4c3..00000000000 --- a/apps/person-export-api/README.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -layout: default -title: Person Export API -parent: Applikasjoner ---- - -# testnav-person-export-api -Api for å eksportere personer. - -## Swagger -Swagger finnes under [/swagger](https://testnav-person-export-api.intern.dev.nav.no/swagger) -endepunktet til applikasjonen. - -## Lokal kjøring -Ha naisdevice kjørende og kjør PersonExportApiApplicationStarter med følgende argumenter: -``` --Dspring.cloud.vault.token=[vault-token] --Dspring.profiles.active=dev -``` - -### Utviklerimage -I utviklerimage brukes ikke naisdevice og du må legge til følgende ekstra argumenter: -``` --Djavax.net.ssl.trustStore=[path til lokal truststore] --Djavax.net.ssl.trustStorePassword=[passord til lokal truststore] -``` diff --git a/apps/person-export-api/build.gradle b/apps/person-export-api/build.gradle deleted file mode 100644 index 16aba6a935e..00000000000 --- a/apps/person-export-api/build.gradle +++ /dev/null @@ -1,88 +0,0 @@ -plugins { - id 'java' - id "org.sonarqube" version "4.0.0.2929" - id 'org.springframework.boot' version "3.1.4" - id 'io.spring.dependency-management' version "1.1.3" - id "jacoco" -} - -test { - useJUnitPlatform() -} - -jacocoTestReport { - reports { - xml.required = true - } -} - -sonarqube { - properties { - property "sonar.coverage.jacoco.xmlReportPaths", "${project.buildDir}/reports/jacoco/test/jacocoTestReport.xml" - property "sonar.dynamicAnalysis", "reuseReports" - property "sonar.host.url", "https://sonarcloud.io" - property "sonar.java.coveragePlugin", "jacoco" - property "sonar.language", "java" - property "sonar.login", System.getenv("SONAR_TOKEN") - property "sonar.organization", "navikt" - property "sonar.project.monorepo.enabled", true - property "sonar.projectKey", "testnorge-person-export-api" - property "sonar.projectName", "testnorge-person-export-api" - property "sonar.sourceEncoding", "UTF-8" - } -} -bootJar { - archiveFileName = "app.jar" -} - -dependencyManagement { - applyMavenExclusions = false - imports { - mavenBom 'org.springframework.cloud:spring-cloud-dependencies:2022.0.4' - } -} - -repositories { - mavenCentral() - mavenLocal() -} - -dependencies { - - implementation 'no.nav.testnav.libs:csv-converter' - implementation 'no.nav.testnav.libs:reactive-core' - implementation 'no.nav.testnav.libs:security-core' - implementation 'no.nav.testnav.libs:servlet-core' - implementation 'no.nav.testnav.libs:servlet-security' - implementation 'no.nav.testnav.libs:slack' - - implementation 'org.springframework.boot:spring-boot-starter-webflux' - implementation 'org.springframework.boot:spring-boot-starter-oauth2-client' - implementation 'org.springframework.boot:spring-boot-starter-web' - implementation 'org.springframework.boot:spring-boot-starter-security' - implementation 'org.springframework.boot:spring-boot-starter-cache' - - - implementation 'org.springframework.cloud:spring-cloud-starter-vault-config' - implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap' // TODO remove legacy bootstrap config - implementation 'org.springframework.boot:spring-boot-starter-actuator' - - implementation 'io.micrometer:micrometer-registry-prometheus' - - implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0' - implementation 'io.swagger.core.v3:swagger-annotations-jakarta:2.2.16' - implementation 'net.logstash.logback:logstash-logback-encoder:7.4' - implementation 'org.hibernate.validator:hibernate-validator' - - testImplementation 'org.springframework.boot:spring-boot-starter-test' - testImplementation 'org.springframework.cloud:spring-cloud-contract-wiremock' - - implementation 'org.projectlombok:lombok' - annotationProcessor 'org.projectlombok:lombok' - testAnnotationProcessor 'org.projectlombok:lombok' -} -java { - toolchain { - languageVersion = JavaLanguageVersion.of(21) - } -} diff --git a/apps/person-export-api/config.yml b/apps/person-export-api/config.yml deleted file mode 100644 index aa431f6a4ab..00000000000 --- a/apps/person-export-api/config.yml +++ /dev/null @@ -1,58 +0,0 @@ -apiVersion: "nais.io/v1alpha1" -kind: "Application" -metadata: - name: testnav-person-export-api - namespace: dolly - labels: - team: dolly -spec: - image: {{ image }} - port: 8080 - webproxy: true - tokenx: - enabled: true - azure: - application: - allowAllUsers: true - enabled: true - tenant: nav.no - liveness: - path: /internal/isAlive - initialDelay: 4 - periodSeconds: 5 - failureThreshold: 500 - readiness: - path: /internal/isReady - initialDelay: 4 - periodSeconds: 5 - failureThreshold: 500 - prometheus: - enabled: true - path: /internal/metrics - replicas: - min: 1 - max: 1 - vault: - enabled: true - resources: - requests: - cpu: 1000m - memory: 4000Mi - limits: - memory: 5000Mi - accessPolicy: - inbound: - rules: - - application: team-dolly-lokal-app - cluster: dev-gcp - - application: testnav-oversikt-frontend - cluster: dev-gcp - outbound: - external: - - host: tps-forvalteren-proxy.dev-fss-pub.nais.io - - host: testnav-kodeverk-proxy.dev-fss-pub.nais.io - - host: slack.com - envFrom: - - secret: testnav-person-export-api-slack-secret - ingresses: - - "https://testnav-person-export-api.intern.dev.nav.no" \ No newline at end of file diff --git a/apps/person-export-api/gradle/wrapper/gradle-wrapper.jar b/apps/person-export-api/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 7454180f2ae..00000000000 Binary files a/apps/person-export-api/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/apps/person-export-api/gradle/wrapper/gradle-wrapper.properties b/apps/person-export-api/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index e411586a54a..00000000000 --- a/apps/person-export-api/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/apps/person-export-api/gradlew b/apps/person-export-api/gradlew deleted file mode 100755 index 3da45c161b0..00000000000 --- a/apps/person-export-api/gradlew +++ /dev/null @@ -1,234 +0,0 @@ -#!/bin/sh - -# -# Copyright ? 2015-2021 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions ?$var?, ?${var}?, ?${var:-default}?, ?${var+SET}?, -# ?${var#prefix}?, ?${var%suffix}?, and ?$( cmd )?; -# * compound commands having a testable exit status, especially ?case?; -# * various built-in commands including ?command?, ?set?, and ?ulimit?. -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" -APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/apps/person-export-api/gradlew.bat b/apps/person-export-api/gradlew.bat deleted file mode 100644 index ac1b06f9382..00000000000 --- a/apps/person-export-api/gradlew.bat +++ /dev/null @@ -1,89 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/apps/person-export-api/gradlewUpdate.sh b/apps/person-export-api/gradlewUpdate.sh deleted file mode 100755 index e5ee6361152..00000000000 --- a/apps/person-export-api/gradlewUpdate.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -gradle wrapper \ No newline at end of file diff --git a/apps/person-export-api/settings.gradle b/apps/person-export-api/settings.gradle deleted file mode 100644 index 741e0db2afc..00000000000 --- a/apps/person-export-api/settings.gradle +++ /dev/null @@ -1,18 +0,0 @@ -plugins { - id "com.gradle.enterprise" version "3.12.3" -} - -rootProject.name = 'person-export-api' - -includeBuild '../../libs/csv-converter' -includeBuild '../../libs/reactive-core' -includeBuild '../../libs/servlet-core' -includeBuild '../../libs/servlet-security' -includeBuild '../../libs/slack' - -gradleEnterprise { - buildScan { - termsOfServiceUrl = "https://gradle.com/terms-of-service" - termsOfServiceAgree = "yes" - } -} \ No newline at end of file diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/PersonExportApiApplicationStarter.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/PersonExportApiApplicationStarter.java deleted file mode 100644 index 871e1b629c1..00000000000 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/PersonExportApiApplicationStarter.java +++ /dev/null @@ -1,11 +0,0 @@ -package no.nav.testnav.apps.personexportapi; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class PersonExportApiApplicationStarter { - public static void main(String[] args) { - SpringApplication.run(PersonExportApiApplicationStarter.class, args); - } -} diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/adapter/SlackAdapter.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/adapter/SlackAdapter.java deleted file mode 100644 index 9cc3b85dfcf..00000000000 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/adapter/SlackAdapter.java +++ /dev/null @@ -1,21 +0,0 @@ -package no.nav.testnav.apps.personexportapi.adapter; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -import no.nav.testnav.libs.slack.consumer.SlackConsumer; - -@Component -public class SlackAdapter { - private final SlackConsumer slackConsumer; - private final String channel; - - public SlackAdapter(SlackConsumer slackConsumer, @Value("${consumers.slack.channel}") String channel) { - this.slackConsumer = slackConsumer; - this.channel = channel; - } - - public void uploadFile(byte[] file, String fileName) { - slackConsumer.uploadFile(file, fileName, channel); - } -} diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/config/AppConfig.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/config/AppConfig.java deleted file mode 100644 index 84736fe9478..00000000000 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/config/AppConfig.java +++ /dev/null @@ -1,28 +0,0 @@ -package no.nav.testnav.apps.personexportapi.config; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; - -import no.nav.testnav.libs.servletcore.config.ApplicationCoreConfig; -import no.nav.testnav.libs.servletcore.config.ApplicationProperties; -import no.nav.testnav.libs.servletsecurity.config.SecureOAuth2ServerToServerConfiguration; -import no.nav.testnav.libs.slack.consumer.SlackConsumer; - -@Configuration -@Import({ - ApplicationCoreConfig.class, - SecureOAuth2ServerToServerConfiguration.class -}) -public class AppConfig { - @Bean - public SlackConsumer slackConsumer( - @Value("${consumers.slack.token}") String token, - @Value("${consumers.slack.baseUrl}") String baseUrl, - @Value("${http.proxy:#{null}}") String proxyHost, - ApplicationProperties properties - ) { - return new SlackConsumer(token, baseUrl, proxyHost, properties.getName()); - } -} diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/config/Consumers.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/config/Consumers.java deleted file mode 100644 index e9b4af4af4f..00000000000 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/config/Consumers.java +++ /dev/null @@ -1,30 +0,0 @@ -package no.nav.testnav.apps.personexportapi.config; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import static lombok.AccessLevel.PACKAGE; - -/** - * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. - *

- * Husk at Spring Boot bruker relaxed binding - * mellom configuration properties og field names. - * - * @see ServerProperties - */ -@Configuration -@ConfigurationProperties(prefix = "consumers") -@NoArgsConstructor(access = PACKAGE) -@Getter -@Setter(PACKAGE) -public class Consumers { - - private ServerProperties kodeverk; - private ServerProperties tpsForvalter; - -} diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/config/OpenApiConfig.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/config/OpenApiConfig.java deleted file mode 100644 index c702184af7d..00000000000 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/config/OpenApiConfig.java +++ /dev/null @@ -1,55 +0,0 @@ -package no.nav.testnav.apps.personexportapi.config; - -import io.swagger.v3.oas.models.Components; -import io.swagger.v3.oas.models.OpenAPI; -import io.swagger.v3.oas.models.info.Contact; -import io.swagger.v3.oas.models.info.Info; -import io.swagger.v3.oas.models.info.License; -import io.swagger.v3.oas.models.security.SecurityRequirement; -import io.swagger.v3.oas.models.security.SecurityScheme; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -import java.util.Arrays; - -import no.nav.testnav.libs.servletcore.config.ApplicationProperties; - -@Configuration -public class OpenApiConfig implements WebMvcConfigurer { - - @Bean - public OpenAPI openApi(ApplicationProperties applicationProperties) { - return new OpenAPI() - .components(new Components().addSecuritySchemes("bearer-jwt", new SecurityScheme() - .type(SecurityScheme.Type.HTTP) - .scheme("bearer") - .bearerFormat("JWT") - .in(SecurityScheme.In.HEADER) - .name("Authorization") - )) - .addSecurityItem( - new SecurityRequirement().addList("bearer-jwt", Arrays.asList("read", "write"))) - .info(new Info() - .title(applicationProperties.getName()) - .version(applicationProperties.getVersion()) - .description(applicationProperties.getDescription()) - .termsOfService("https://nav.no") - .contact(new Contact() - .url("https://nav-it.slack.com/archives/CA3P9NGA2") - .email("dolly@nav.no") - .name("Team Dolly") - ) - .license(new License() - .name("MIT License") - .url("https://opensource.org/licenses/MIT") - ) - ); - } - - @Override - public void addViewControllers(ViewControllerRegistry registry) { - registry.addViewController("/swagger").setViewName("redirect:/swagger-ui.html"); - } -} \ No newline at end of file diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/config/SecurityConfig.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/config/SecurityConfig.java deleted file mode 100644 index 0bd507f64e4..00000000000 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/config/SecurityConfig.java +++ /dev/null @@ -1,38 +0,0 @@ -package no.nav.testnav.apps.personexportapi.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; -import org.springframework.security.config.Customizer; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; -import org.springframework.security.config.http.SessionCreationPolicy; -import org.springframework.security.web.SecurityFilterChain; - - -@EnableWebSecurity -@Configuration -@Profile({ "prod", "dev" }) -public class SecurityConfig { - - @Bean - public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception { - - httpSecurity.sessionManagement(sessionConfig -> sessionConfig.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) - .csrf(AbstractHttpConfigurer::disable) - .authorizeHttpRequests(authorizeConfig -> authorizeConfig.requestMatchers( - "/internal/**", - "/webjars/**", - "/swagger-resources/**", - "/v3/api-docs/**", - "/swagger-ui/**", - "/swagger", - "/error", - "/swagger-ui.html" - ).permitAll().requestMatchers("/api/**").fullyAuthenticated()) - .oauth2ResourceServer(oauth2RSConfig -> oauth2RSConfig.jwt(Customizer.withDefaults())); - - return httpSecurity.build(); - } -} \ No newline at end of file diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/config/VaultConfig.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/config/VaultConfig.java deleted file mode 100644 index bb32e83529f..00000000000 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/config/VaultConfig.java +++ /dev/null @@ -1,37 +0,0 @@ -package no.nav.testnav.apps.personexportapi.config; - -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; -import org.springframework.vault.annotation.VaultPropertySource; -import org.springframework.vault.authentication.ClientAuthentication; -import org.springframework.vault.authentication.TokenAuthentication; -import org.springframework.vault.client.VaultEndpoint; -import org.springframework.vault.config.AbstractVaultConfiguration; - -import static io.micrometer.common.util.StringUtils.isBlank; - -@Configuration -@Profile("dev") -@VaultPropertySource(value = "secret/dolly/lokal", ignoreSecretNotFound = false) -@VaultPropertySource(value = "kv/preprod/fss/testnorge-person-export-api/dev", ignoreSecretNotFound = false) -public class VaultConfig extends AbstractVaultConfiguration { - - private static final String VAULT_TOKEN = "spring.cloud.vault.token"; - - @Override - public VaultEndpoint vaultEndpoint() { - return VaultEndpoint.create("vault.adeo.no", 443); - } - - @Override - public ClientAuthentication clientAuthentication() { - if (System.getenv().containsKey("VAULT_TOKEN")) { - System.setProperty(VAULT_TOKEN, System.getenv("VAULT_TOKEN")); - } - var token = System.getProperty(VAULT_TOKEN); - if (isBlank(token)) { - throw new IllegalArgumentException("Påkrevet property 'spring.cloud.vault.token' er ikke satt."); - } - return new TokenAuthentication(System.getProperty(VAULT_TOKEN)); - } -} \ No newline at end of file diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/KodeverkConsumer.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/KodeverkConsumer.java deleted file mode 100644 index e426ddacbaa..00000000000 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/KodeverkConsumer.java +++ /dev/null @@ -1,64 +0,0 @@ -package no.nav.testnav.apps.personexportapi.consumer; - -import static org.apache.logging.log4j.util.Strings.isNotBlank; - -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import no.nav.testnav.apps.personexportapi.config.Consumers; -import no.nav.testnav.apps.personexportapi.consumer.command.GetKodeverkCommand; -import no.nav.testnav.apps.personexportapi.consumer.response.KodeverkBetydningerResponse; -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; -import org.springframework.cache.annotation.CacheConfig; -import org.springframework.cache.annotation.Cacheable; -import org.springframework.cache.annotation.EnableCaching; -import org.springframework.stereotype.Component; - -import org.springframework.web.reactive.function.client.WebClient; - -@Component -@EnableCaching -@CacheConfig(cacheNames = "Kodeverk") -public class KodeverkConsumer { - - private final WebClient webClient; - private final TokenExchange tokenExchange; - private final ServerProperties serverProperties; - - public KodeverkConsumer( - TokenExchange tokenExchange, - Consumers consumers) { - this.tokenExchange = tokenExchange; - serverProperties = consumers.getKodeverk(); - this.webClient = WebClient - .builder() - .baseUrl(serverProperties.getUrl()) - .codecs(configurer -> configurer - .defaultCodecs() - .maxInMemorySize(16 * 1024 * 1024)) - .build(); - } - - public String getKodeverkOppslag(String kodeverk, String verdi) { - try { - return isNotBlank(verdi) ? getKodeverkByName(kodeverk).get(verdi).stream().findFirst() - .map(betydning -> betydning.getBeskrivelser().get("nb").getTekst()) - .orElse(null) : null; - - } catch (RuntimeException e) { - return null; - } - } - - @Cacheable(sync = true) - public Map> getKodeverkByName(String kodeverk) { - - var kodeverkResponse = tokenExchange.exchange(serverProperties) - .flatMap(accessToken -> new GetKodeverkCommand(webClient, accessToken.getTokenValue(), kodeverk).call()) - .block(); - - return kodeverkResponse != null ? kodeverkResponse.getBetydninger() : Collections.emptyMap(); - } -} diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/TpsfConsumer.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/TpsfConsumer.java deleted file mode 100644 index e7d9d485d13..00000000000 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/TpsfConsumer.java +++ /dev/null @@ -1,113 +0,0 @@ -package no.nav.testnav.apps.personexportapi.consumer; - -import lombok.extern.slf4j.Slf4j; -import no.nav.testnav.apps.personexportapi.config.Consumers; -import no.nav.testnav.apps.personexportapi.consumer.command.GetTpsfGrupperCommand; -import no.nav.testnav.apps.personexportapi.consumer.command.GetTpsfMeldingerFromPageCommand; -import no.nav.testnav.apps.personexportapi.consumer.dto.GruppeDTO; -import no.nav.testnav.apps.personexportapi.domain.Person; -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; -import org.springframework.http.HttpStatus; -import org.springframework.stereotype.Component; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.reactive.function.client.WebClient; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; -import java.util.stream.Collectors; - -import static java.lang.String.format; - -@Slf4j -@Component -public class TpsfConsumer { - private final WebClient webClient; - private final TokenExchange tokenExchange; - private final ServerProperties serverProperties; - private final ExecutorService executorService; - - public TpsfConsumer( - TokenExchange tokenExchange, - Consumers consumers) { - this.tokenExchange = tokenExchange; - serverProperties = consumers.getTpsForvalter(); - this.webClient = WebClient - .builder() - .baseUrl(serverProperties.getUrl()) - .build(); - this.executorService = Executors.newFixedThreadPool(serverProperties.getThreads()); - } - - private GruppeDTO getGruppe(String avspillingsgruppe) { - log.info("Henter avspillingsgruppe med id {}...", avspillingsgruppe); - - var list = tokenExchange.exchange(serverProperties) - .flatMap(accessToken -> new GetTpsfGrupperCommand(webClient, accessToken.getTokenValue()).call()) - .block(); - - var gruppeDTO = list.stream() - .filter(value -> value.getId().equals(avspillingsgruppe)) - .findFirst() - .orElseThrow(() -> new HttpClientErrorException(HttpStatus.NOT_FOUND, "Finner ikke gruppe med avspillergruppeId " + avspillingsgruppe)); - log.info("Avspillingsgruppe med id {} og navn {} hentet.", gruppeDTO.getId(), gruppeDTO.getNavn()); - return gruppeDTO; - } - - private int getNumberOfPages(String avspillingsgruppe) { - int antallSider = getGruppe(avspillingsgruppe).getAntallSider(); - log.info("Gruppe med avspillingsgruppe id {} har {} antall sider.", avspillingsgruppe, antallSider); - return antallSider; - } - - private CompletableFuture> getPersonFromPage(String avspillingsgruppe, int page, int numberOfPages) { - return CompletableFuture.supplyAsync( - () -> tokenExchange.exchange(serverProperties) - .flatMap(accessToken -> new GetTpsfMeldingerFromPageCommand( - webClient, accessToken.getTokenValue(), avspillingsgruppe, page).call()) - .block(), - executorService - ).thenApply(meldinger -> { - log.info("Har hentet {}/{} sider fra avspillingsgruppeID {}", page + 1, numberOfPages, avspillingsgruppe); - return meldinger - .stream() - .filter(value -> value.isFoedsel() || value.isInnvandring()) - .map(endringsmelding -> new Person(endringsmelding, format("%d/%d", page + 1, numberOfPages))) - .collect(Collectors.toList()); - }); - } - - public List getPersoner(String avspillingsgruppe) { - int numberOfPages = getNumberOfPages(avspillingsgruppe); - log.info("Henter alle personer fra avspillingsgruppeID {} med {} antall sider.", avspillingsgruppe, numberOfPages); - - List>> futures = new ArrayList<>(); - for (int page = 0; page < numberOfPages; page++) { - futures.add(getPersonFromPage(avspillingsgruppe, page, numberOfPages)); - } - List personer = new ArrayList<>(); - for (CompletableFuture> future : futures) { - try { - log.info(format("Active threads: %d, Waiting to start: %d", - ((ThreadPoolExecutor) executorService).getActiveCount(), - ((ThreadPoolExecutor) executorService).getQueue().size())); - personer.addAll(future.get(1, TimeUnit.MINUTES)); - - } catch (TimeoutException e) { - log.error("Future task timeout exception {}", future, e); - } catch (ExecutionException e) { - log.error("Execution exception", e); - } catch (InterruptedException e) { - log.error("Interrupted exception", e); - } - } - return personer; - } -} diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/command/GetKodeverkCommand.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/command/GetKodeverkCommand.java deleted file mode 100644 index a9e1ab6a0a6..00000000000 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/command/GetKodeverkCommand.java +++ /dev/null @@ -1,49 +0,0 @@ -package no.nav.testnav.apps.personexportapi.consumer.command; - -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import no.nav.testnav.apps.personexportapi.consumer.response.KodeverkBetydningerResponse; -import org.springframework.web.reactive.function.client.WebClient; -import org.springframework.web.reactive.function.client.WebClientResponseException; -import reactor.core.publisher.Mono; - -import java.util.Collections; -import java.util.UUID; -import java.util.concurrent.Callable; - -@Slf4j -@RequiredArgsConstructor -public class GetKodeverkCommand implements Callable> { - private final WebClient webClient; - private final String token; - private final String kodeverksnavn; - - protected static String getMessage(Throwable error) { - return error instanceof WebClientResponseException webClientResponseException ? - webClientResponseException.getResponseBodyAsString() : - error.getMessage(); - } - - @Override - public Mono call() { - return webClient - .get() - .uri(builder -> builder - .path("/api/v1/kodeverk/{kodeverksnavn}/koder/betydninger") - .queryParam("ekskluderUgyldige", "true") - .queryParam("spraak", "nb") - .build(kodeverksnavn) - ) - .header("Authorization", "Bearer " + token) - .header("Nav-Consumer-Id", "testnav-person-export-api") - .header("Nav-Call-Id", UUID.randomUUID().toString()) - .retrieve() - .bodyToMono(KodeverkBetydningerResponse.class) - .onErrorResume(throwable -> { - log.error("Feil i henting av kodeverk: " + getMessage(throwable)); - return Mono.just(KodeverkBetydningerResponse.builder() - .betydninger(Collections.emptyMap()) - .build()); - }); - } -} diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/command/GetTpsfGrupperCommand.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/command/GetTpsfGrupperCommand.java deleted file mode 100644 index 45c1c6a8554..00000000000 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/command/GetTpsfGrupperCommand.java +++ /dev/null @@ -1,40 +0,0 @@ -package no.nav.testnav.apps.personexportapi.consumer.command; - -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import no.nav.testnav.apps.personexportapi.consumer.dto.GruppeDTO; -import org.springframework.core.ParameterizedTypeReference; -import org.springframework.web.reactive.function.client.WebClient; -import reactor.core.publisher.Mono; - -import java.util.Collections; -import java.util.List; -import java.util.concurrent.Callable; - -import static no.nav.testnav.apps.personexportapi.consumer.command.GetKodeverkCommand.getMessage; - -@Slf4j -@RequiredArgsConstructor -public class GetTpsfGrupperCommand implements Callable>> { - private static final ParameterizedTypeReference> RESPONSE_TYPE = new ParameterizedTypeReference<>() { - }; - private final WebClient webClient; - private final String token; - - @Override - public Mono> call() { - return webClient - .get() - .uri(builder -> builder - .path("/api/v1/endringsmelding/skd/grupper") - .build() - ) - .header("Authorization", "Bearer " + token) - .retrieve() - .bodyToMono(RESPONSE_TYPE) - .onErrorResume(throwable -> { - log.error("Feil i henting av tpsf grupper: " + getMessage(throwable)); - return Mono.just(Collections.emptyList()); - }); - } -} diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/command/GetTpsfMeldingerFromPageCommand.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/command/GetTpsfMeldingerFromPageCommand.java deleted file mode 100644 index 7a05226ab7a..00000000000 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/command/GetTpsfMeldingerFromPageCommand.java +++ /dev/null @@ -1,43 +0,0 @@ -package no.nav.testnav.apps.personexportapi.consumer.command; - -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import no.nav.testnav.apps.personexportapi.consumer.dto.EndringsmeldingDTO; -import org.springframework.core.ParameterizedTypeReference; -import org.springframework.web.reactive.function.client.WebClient; -import reactor.core.publisher.Mono; - -import java.util.Collections; -import java.util.List; -import java.util.concurrent.Callable; - -import static no.nav.testnav.apps.personexportapi.consumer.command.GetKodeverkCommand.getMessage; - -@Slf4j -@RequiredArgsConstructor -public class GetTpsfMeldingerFromPageCommand implements Callable>> { - - private static final ParameterizedTypeReference> RESPONSE_TYPE = new ParameterizedTypeReference<>() { - }; - private final WebClient webClient; - private final String token; - private final String avspillingsgruppe; - private final int pageNumber; - - @Override - public Mono> call() { - return webClient - .get() - .uri(builder -> builder - .path("/api/v1/endringsmelding/skd/gruppe/meldinger/{avspillingsgruppe}/{pageNumber}") - .build(avspillingsgruppe, pageNumber) - ) - .header("Authorization", "Bearer " + token) - .retrieve() - .bodyToMono(RESPONSE_TYPE) - .onErrorResume(throwable -> { - log.error("Feil i henting av tpsf mledinger: " + getMessage(throwable)); - return Mono.just(Collections.emptyList()); - }); - } -} diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/DiskresjonskoderType.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/DiskresjonskoderType.java deleted file mode 100644 index 85c3c8b1c46..00000000000 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/DiskresjonskoderType.java +++ /dev/null @@ -1,30 +0,0 @@ -package no.nav.testnav.apps.personexportapi.consumer.dto; - -public enum DiskresjonskoderType { - - VABO("0", "Vanlig bosatt"), - URIK("1", "I utenrikstjeneste"), - MILI("2", "Militær"), - SVAL("3", "Svalbard"), - KLIE("4", "Klientadresse"), - UFB("5", "Uten fast bobel"), - SPSF("6", "Sperret adresse, strengt fortrolig"), //kode 6 - SPFO("7", "Sperret adresse, fortrolig"), //kode 7 - PEND("8", "Pendler"); - - private String navn; - private String kodeverdi; - - DiskresjonskoderType(final String kode, final String diskresjonskodeNavn){ - kodeverdi = kode; - navn = diskresjonskodeNavn; - } - - public String getName() { - return navn; - } - - public String getKodeverdi() { - return kodeverdi; - } -} \ No newline at end of file diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/EndringsmeldingDTO.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/EndringsmeldingDTO.java deleted file mode 100644 index 32769df7856..00000000000 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/EndringsmeldingDTO.java +++ /dev/null @@ -1,69 +0,0 @@ -package no.nav.testnav.apps.personexportapi.consumer.dto; - -import com.fasterxml.jackson.annotation.JsonIgnore; - -import lombok.AllArgsConstructor; -import lombok.NoArgsConstructor; -import lombok.Value; - -@Value -@NoArgsConstructor(force = true) -@AllArgsConstructor -public class EndringsmeldingDTO { - - private static final String AARSAKSKODE_FOEDSEL = "01"; - private static final String AARSAKSKODE_INNVANDRING = "02"; - - String fodselsdato; - String personnummer; - String fornavn; - String mellomnavn; - String slektsnavn; - String statuskode; - String aarsakskode; - String personkode; - String kommunenummer; - String postnummer; - String flyttedatoAdr; // flyttedato - String adressetype; // O = Offisiell, dvs gateadresse, M = matrikkeladresse - String gateGaard; // gatekode (O) eller gårdsnummer (M) - String adressenavn; // gatenavn (O) eller gårdsnavn (M) - String husBruk; // husnummer (O) eller bruksnummer (M) - String bokstavFestenr; // husbokstav (O) eller festenummer (M) - String bolignr; // eks H0101 - String tilleggsadresse; - String adresse1; - String adresse2; - String adresse3; - String postadrLand; - String sivilstand; - String regdatoSivilstand; - String statsborgerskap; - String regdatoStatsb; - String innvandretFraLand; - String fraLandFlyttedato; - String utvandretTilLand; - String tilLandFlyttedato; - String spesRegType; - String datoSpesRegType; - - @JsonIgnore - public boolean isFoedsel() { - return AARSAKSKODE_FOEDSEL.equals(aarsakskode); - } - - @JsonIgnore - public boolean isInnvandring() { - return AARSAKSKODE_INNVANDRING.equals(aarsakskode); - } - - @JsonIgnore - public boolean isMatrikkeladresse() { - return "M".equals(getAdressetype()); - } - - @JsonIgnore - public boolean isGateadresse() { - return "O".equals(getAdressetype()); - } -} \ No newline at end of file diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/FoedselsdatoFraIdent.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/FoedselsdatoFraIdent.java deleted file mode 100644 index 55acb5dd3b3..00000000000 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/FoedselsdatoFraIdent.java +++ /dev/null @@ -1,52 +0,0 @@ -package no.nav.testnav.apps.personexportapi.consumer.dto; - -import static java.lang.Integer.parseInt; - -import java.time.LocalDate; -import java.time.LocalDateTime; - -import lombok.experimental.UtilityClass; - -/** - * INDIVID(POS 7-9) 500-749 OG ÅR > 54 => ÅRHUNDRE = 1800 - * INDIVID(POS 7-9) 000-499 => ÅRHUNDRE = 1900 - * INDIVID(POS 7-9) 900-999 OG ÅR > 39 => ÅRHUNDRE = 1900 - * INDIVID(POS 7-9) 500-999 OG ÅR < 40 => ÅRHUNDRE = 2000 - */ -@UtilityClass -public class FoedselsdatoFraIdent { - - public LocalDateTime getFoedselsdato(String ident) { - - int year = parseInt(ident.substring(4, 6)); - int individ = parseInt(ident.substring(6, 9)); - - // Find century - int century; - if (parseInt(ident.substring(6, 10)) == 0) { - century = year <= LocalDate.now().getYear() % 100 ? 2000 : 1900; - } else if (individ < 500 || (individ >= 900 && year > 39)) { - century = 1900; - } else if (individ >= 500 && year < 40) { - century = 2000; - } else if (individ >= 500 && individ < 750 && year > 54) { - century = 1800; - } else { - century = 2000; - } - - return LocalDateTime.of(century + year, getMonth(ident), getDay(ident), 0, 0); - } - - private int getDay(String ident) { - // Fix D-number - return ident.charAt(0) >= '4' ? parseInt(ident.substring(0, 2)) - 40 : - parseInt(ident.substring(0, 2)); - } - - private int getMonth(String ident) { - // Fix B-number - return ident.charAt(2) >= '2' ? parseInt(ident.substring(2, 4)) - 20 : - parseInt(ident.substring(2, 4)); - } -} \ No newline at end of file diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/GruppeDTO.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/GruppeDTO.java deleted file mode 100644 index 136890d4e83..00000000000 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/GruppeDTO.java +++ /dev/null @@ -1,17 +0,0 @@ -package no.nav.testnav.apps.personexportapi.consumer.dto; - -import java.util.List; - -import lombok.AllArgsConstructor; -import lombok.NoArgsConstructor; -import lombok.Value; - -@Value -@NoArgsConstructor(force = true) -@AllArgsConstructor -public class GruppeDTO { - String id; - String navn; - List meldinger; - Integer antallSider; -} diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/HusbokstavEncoder.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/HusbokstavEncoder.java deleted file mode 100644 index 23d9bd2b0b7..00000000000 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/HusbokstavEncoder.java +++ /dev/null @@ -1,55 +0,0 @@ -package no.nav.testnav.apps.personexportapi.consumer.dto; - -import static java.util.Objects.nonNull; - -import org.bouncycastle.asn1.eac.BidirectionalMap; - -import lombok.experimental.UtilityClass; - -@UtilityClass -public class HusbokstavEncoder { - - private static BidirectionalMap encodingMap; - - static { - encodingMap = new BidirectionalMap(); - encodingMap.put("A", "9901"); - encodingMap.put("B", "9902"); - encodingMap.put("C", "9903"); - encodingMap.put("D", "9904"); - encodingMap.put("E", "9905"); - encodingMap.put("F", "9906"); - encodingMap.put("G", "9907"); - encodingMap.put("H", "9908"); - encodingMap.put("I", "9909"); - encodingMap.put("J", "9910"); - encodingMap.put("K", "9911"); - encodingMap.put("L", "9912"); - encodingMap.put("M", "9913"); - encodingMap.put("N", "9914"); - encodingMap.put("O", "9915"); - encodingMap.put("P", "9916"); - encodingMap.put("Q", "9917"); - encodingMap.put("R", "9918"); - encodingMap.put("S", "9919"); - encodingMap.put("T", "9920"); - encodingMap.put("U", "9921"); - encodingMap.put("V", "9922"); - encodingMap.put("W", "9923"); - encodingMap.put("X", "9924"); - encodingMap.put("Y", "9925"); - encodingMap.put("Z", "9926"); - encodingMap.put("Æ", "9927"); - encodingMap.put("Ø", "9928"); - encodingMap.put("Å", "9929"); - encodingMap.put("Á", "9930"); - } - - public static String encode(String husbokstav) { - return (String) encodingMap.get(husbokstav); - } - - public static String decode(String skdHusnummerCode) { - return nonNull(skdHusnummerCode) ? (String) encodingMap.getReverse(skdHusnummerCode) : null; - } -} diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/KjoennFraIdent.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/KjoennFraIdent.java deleted file mode 100644 index acacf301959..00000000000 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/KjoennFraIdent.java +++ /dev/null @@ -1,15 +0,0 @@ -package no.nav.testnav.apps.personexportapi.consumer.dto; - -import static java.lang.Integer.parseInt; - -import lombok.experimental.UtilityClass; - -@UtilityClass -public class KjoennFraIdent { - - public KjoennType getKjoenn(String ident){ - - int kjoennNummer = parseInt(ident.substring(8,9)); - return kjoennNummer % 2 == 0 ? KjoennType.K : KjoennType.M; - } -} \ No newline at end of file diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/KjoennType.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/KjoennType.java deleted file mode 100644 index 3c6a9a41085..00000000000 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/KjoennType.java +++ /dev/null @@ -1,19 +0,0 @@ -package no.nav.testnav.apps.personexportapi.consumer.dto; - -import lombok.Getter; - -@Getter -public enum KjoennType { - - K(0,"Kvinne"), - M(1, "Mann"), - U(2, "Ukjent"); - - private String beskrivelse; - private Integer hdirType; - - KjoennType(Integer hdirType, String beskrivelse) { - this.hdirType = hdirType; - this.beskrivelse = beskrivelse; - } -} diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/LandkodeEncoder.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/LandkodeEncoder.java deleted file mode 100644 index a889015b0e3..00000000000 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/LandkodeEncoder.java +++ /dev/null @@ -1,288 +0,0 @@ -package no.nav.testnav.apps.personexportapi.consumer.dto; - -import lombok.experimental.UtilityClass; -import org.bouncycastle.asn1.eac.BidirectionalMap; - -import static java.util.Objects.nonNull; - -@UtilityClass -public class LandkodeEncoder { - - private static final BidirectionalMap landkoderMap = new BidirectionalMap(); - - private static final String DEFAULT = "990"; - - static { //NOSONAR - landkoderMap.put("???", DEFAULT); - landkoderMap.put("ABW", "657"); - landkoderMap.put("AFG", "404"); - landkoderMap.put("AGO", "204"); - landkoderMap.put("AIA", "660"); - landkoderMap.put("ALA", "860"); - landkoderMap.put("ALB", "111"); - landkoderMap.put("AND", "114"); - landkoderMap.put("ANT", "656"); - landkoderMap.put("ARE", "426"); - landkoderMap.put("ARG", "705"); - landkoderMap.put("ARM", "406"); - landkoderMap.put("ASM", "802"); - landkoderMap.put("ATF", "628"); - landkoderMap.put("ATG", "603"); - landkoderMap.put("AUS", "805"); - landkoderMap.put("AUT", "153"); - landkoderMap.put("AZE", "407"); - landkoderMap.put("BDI", "216"); - landkoderMap.put("BEL", "112"); - landkoderMap.put("BEN", "229"); - landkoderMap.put("BES", "659"); - landkoderMap.put("BFA", "393"); - landkoderMap.put("BGD", "410"); - landkoderMap.put("BGR", "113"); - landkoderMap.put("BHR", "409"); - landkoderMap.put("BHS", "605"); - landkoderMap.put("BIH", "155"); - landkoderMap.put("BLM", "687"); - landkoderMap.put("BLR", "120"); - landkoderMap.put("BLZ", "604"); - landkoderMap.put("BMU", "606"); - landkoderMap.put("BOL", "710"); - landkoderMap.put("BRA", "715"); - landkoderMap.put("BRB", "602"); - landkoderMap.put("BRN", "416"); - landkoderMap.put("BTN", "412"); - landkoderMap.put("BVT", "875"); - landkoderMap.put("BWA", "205"); - landkoderMap.put("CAF", "337"); - landkoderMap.put("CAN", "612"); - landkoderMap.put("CCK", "808"); - landkoderMap.put("CHE", "141"); - landkoderMap.put("CHL", "725"); - landkoderMap.put("CHN", "484"); - landkoderMap.put("CIV", "239"); - landkoderMap.put("CMR", "270"); - landkoderMap.put("COD", "279"); - landkoderMap.put("COG", "278"); - landkoderMap.put("COK", "809"); - landkoderMap.put("COL", "730"); - landkoderMap.put("COM", "220"); - landkoderMap.put("CPV", "273"); - landkoderMap.put("CRI", "616"); - landkoderMap.put("CSK", "142"); - landkoderMap.put("CUB", "620"); - landkoderMap.put("CUW", "661"); - landkoderMap.put("CXR", "807"); - landkoderMap.put("CYM", "613"); - landkoderMap.put("CYP", "500"); - landkoderMap.put("CZE", "158"); - landkoderMap.put("DDR", "151"); - landkoderMap.put("DEU", "144"); - landkoderMap.put("DJI", "250"); - landkoderMap.put("DMA", "622"); - landkoderMap.put("DNK", "101"); - landkoderMap.put("DOM", "624"); - landkoderMap.put("DZA", "203"); - landkoderMap.put("ECU", "735"); - landkoderMap.put("EGY", "249"); - landkoderMap.put("ERI", "241"); - landkoderMap.put("ESH", "304"); - landkoderMap.put("ESP", "137"); - landkoderMap.put("EST", "115"); - landkoderMap.put("ETH", "246"); - landkoderMap.put("FIN", "103"); - landkoderMap.put("FJI", "811"); - landkoderMap.put("FLK", "740"); - landkoderMap.put("FRA", "117"); - landkoderMap.put("FRO", "104"); - landkoderMap.put("FSM", "826"); - landkoderMap.put("GAB", "254"); - landkoderMap.put("GBR", "139"); - landkoderMap.put("GEO", "430"); - landkoderMap.put("GGY", "162"); - landkoderMap.put("GHA", "260"); - landkoderMap.put("GIB", "118"); - landkoderMap.put("GIN", "264"); - landkoderMap.put("GLP", "631"); - landkoderMap.put("GMB", "256"); - landkoderMap.put("GNB", "266"); - landkoderMap.put("GNQ", "235"); - landkoderMap.put("GRC", "119"); - landkoderMap.put("GRD", "629"); - landkoderMap.put("GRL", "102"); - landkoderMap.put("GTM", "632"); - landkoderMap.put("GUF", "745"); - landkoderMap.put("GUM", "817"); - landkoderMap.put("GUY", "720"); - landkoderMap.put("HKG", "436"); - landkoderMap.put("HMD", "870"); - landkoderMap.put("HND", "644"); - landkoderMap.put("HRV", "122"); - landkoderMap.put("HTI", "636"); - landkoderMap.put("HUN", "152"); - landkoderMap.put("IDN", "448"); - landkoderMap.put("IMN", "164"); - landkoderMap.put("IND", "444"); - landkoderMap.put("IOT", "213"); - landkoderMap.put("IRL", "121"); - landkoderMap.put("IRN", "456"); - landkoderMap.put("IRQ", "452"); - landkoderMap.put("ISL", "105"); - landkoderMap.put("ISR", "460"); - landkoderMap.put("ITA", "123"); - landkoderMap.put("JAM", "648"); - landkoderMap.put("JEY", "163"); - landkoderMap.put("JOR", "476"); - landkoderMap.put("JPN", "464"); - landkoderMap.put("KAZ", "480"); - landkoderMap.put("KEN", "276"); - landkoderMap.put("KGZ", "502"); - landkoderMap.put("KHM", "478"); - landkoderMap.put("KIR", "815"); - landkoderMap.put("KNA", "677"); - landkoderMap.put("KOR", "492"); - landkoderMap.put("KWT", "496"); - landkoderMap.put("LAO", "504"); - landkoderMap.put("LBN", "508"); - landkoderMap.put("LBR", "283"); - landkoderMap.put("LBY", "286"); - landkoderMap.put("LCA", "678"); - landkoderMap.put("LIE", "128"); - landkoderMap.put("LKA", "424"); - landkoderMap.put("LSO", "281"); - landkoderMap.put("LTU", "136"); - landkoderMap.put("LUX", "129"); - landkoderMap.put("LVA", "124"); - landkoderMap.put("MAC", "510"); - landkoderMap.put("MAF", "686"); - landkoderMap.put("MAR", "303"); - landkoderMap.put("MCO", "130"); - landkoderMap.put("MDA", "138"); - landkoderMap.put("MDG", "289"); - landkoderMap.put("MDV", "513"); - landkoderMap.put("MEX", "652"); - landkoderMap.put("MHL", "835"); - landkoderMap.put("MKD", "156"); - landkoderMap.put("MLI", "299"); - landkoderMap.put("MLT", "126"); - landkoderMap.put("MMR", "420"); - landkoderMap.put("MNE", "160"); - landkoderMap.put("MNG", "516"); - landkoderMap.put("MNP", "840"); - landkoderMap.put("MOZ", "319"); - landkoderMap.put("MRT", "306"); - landkoderMap.put("MSR", "654"); - landkoderMap.put("MTQ", "650"); - landkoderMap.put("MUS", "307"); - landkoderMap.put("MWI", "296"); - landkoderMap.put("MYS", "512"); - landkoderMap.put("MYT", "322"); - landkoderMap.put("NAM", "308"); - landkoderMap.put("NCL", "833"); - landkoderMap.put("NER", "309"); - landkoderMap.put("NFK", "822"); - landkoderMap.put("NGA", "313"); - landkoderMap.put("NIC", "664"); - landkoderMap.put("NIU", "821"); - landkoderMap.put("NLD", "127"); - landkoderMap.put("NOR", "000"); - landkoderMap.put("NPL", "528"); - landkoderMap.put("NRU", "818"); - landkoderMap.put("NZL", "820"); - landkoderMap.put("OMN", "520"); - landkoderMap.put("PAK", "534"); - landkoderMap.put("PAN", "668"); - landkoderMap.put("PCN", "828"); - landkoderMap.put("PER", "760"); - landkoderMap.put("PHL", "428"); - landkoderMap.put("PLW", "839"); - landkoderMap.put("PNG", "827"); - landkoderMap.put("POL", "131"); - landkoderMap.put("PRI", "685"); - landkoderMap.put("PRK", "488"); - landkoderMap.put("PRT", "132"); - landkoderMap.put("PRY", "755"); - landkoderMap.put("PSE", "524"); - landkoderMap.put("PYF", "814"); - landkoderMap.put("QAT", "540"); - landkoderMap.put("REU", "323"); - landkoderMap.put("ROU", "133"); - landkoderMap.put("RUS", "140"); - landkoderMap.put("RWA", "329"); - landkoderMap.put("SAU", "544"); - landkoderMap.put("SCG", "125"); - landkoderMap.put("SDN", "356"); - landkoderMap.put("SEN", "336"); - landkoderMap.put("SGP", "548"); - landkoderMap.put("SGS", "865"); - landkoderMap.put("SHN", "209"); - landkoderMap.put("SJM", "744"); - landkoderMap.put("SLB", "806"); - landkoderMap.put("SLE", "339"); - landkoderMap.put("SLV", "672"); - landkoderMap.put("SMR", "134"); - landkoderMap.put("SOM", "346"); - landkoderMap.put("SPM", "676"); - landkoderMap.put("SRB", "159"); - landkoderMap.put("SSD", "355"); - landkoderMap.put("STP", "333"); - landkoderMap.put("SUN", "135"); - landkoderMap.put("SUR", "765"); - landkoderMap.put("SVK", "157"); - landkoderMap.put("SVN", "146"); - landkoderMap.put("SWE", "106"); - landkoderMap.put("SWZ", "357"); - landkoderMap.put("SXM", "658"); - landkoderMap.put("SYC", "338"); - landkoderMap.put("SYR", "564"); - landkoderMap.put("TCA", "681"); - landkoderMap.put("TCD", "373"); - landkoderMap.put("TGO", "376"); - landkoderMap.put("THA", "568"); - landkoderMap.put("TJK", "550"); - landkoderMap.put("TKL", "829"); - landkoderMap.put("TKM", "552"); - landkoderMap.put("TLS", "537"); - landkoderMap.put("TON", "813"); - landkoderMap.put("TTO", "680"); - landkoderMap.put("TUN", "379"); - landkoderMap.put("TUR", "143"); - landkoderMap.put("TUV", "816"); - landkoderMap.put("TWN", "432"); - landkoderMap.put("TZA", "369"); - landkoderMap.put("UGA", "386"); - landkoderMap.put("UKR", "148"); - landkoderMap.put("UMI", "819"); - landkoderMap.put("URY", "770"); - landkoderMap.put("USA", "684"); - landkoderMap.put("UZB", "554"); - landkoderMap.put("VAT", "154"); - landkoderMap.put("VCT", "679"); - landkoderMap.put("VEN", "775"); - landkoderMap.put("VGB", "608"); - landkoderMap.put("VIR", "601"); - landkoderMap.put("VNM", "575"); - landkoderMap.put("VUT", "812"); - landkoderMap.put("WAK", "831"); - landkoderMap.put("WLF", "832"); - landkoderMap.put("WSM", "830"); - landkoderMap.put("XXK", "161"); - landkoderMap.put("XXX", "980"); - landkoderMap.put("YEM", "578"); - landkoderMap.put("YUG", "925"); - landkoderMap.put("ZAF", "359"); - landkoderMap.put("ZMB", "389"); - landkoderMap.put("ZWE", "326"); - landkoderMap.put("349", "349"); - landkoderMap.put("546", "546"); - landkoderMap.put("556", "556"); - landkoderMap.put("669", "669"); - } - - public static String encode(String statsborgerskap) { - return (String) landkoderMap.getOrDefault(statsborgerskap, DEFAULT); - } - - public static String decode(String statsborgerskap) { - return nonNull(landkoderMap.getReverse(statsborgerskap)) ? - (String) landkoderMap.getReverse(statsborgerskap) : "???"; - } -} diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/PersonStatusMapper.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/PersonStatusMapper.java deleted file mode 100644 index 33c38b71841..00000000000 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/PersonStatusMapper.java +++ /dev/null @@ -1,54 +0,0 @@ -package no.nav.testnav.apps.personexportapi.consumer.dto; - -import lombok.experimental.UtilityClass; -import no.nav.testnav.apps.personexportapi.domain.Person; - -@UtilityClass -public class PersonStatusMapper { - - public static String getPersonstatus(Person person) { - - if (person.isFnr()) { - switch (person.getPersonstatus()) { - - case "1": - return "Bosatt"; - case "2": - return "Utflyttet (ikke i bruk)"; - case "3": - return "Utvandret"; - case "4": - return "Forsvunnet"; - case "5": - return "Død"; - case "6": - return "Utgått fødselsnummer"; - case "7": - return "Fødselsregistrert"; - case "8": - return "Annullert tilgang"; - case "9": - return "Uregistrert person"; - default: - return null; - } - - } else { - switch (person.getPersonstatus()) { - - case "2": - return "I bruk"; - case "5": - return "Utgått, link til fødselsnummer"; - case "6": - return "Utgått, dublett"; - case "7": - return "Utgått, avgang"; - case "9": - return "Utgått, korrigert til nytt D-nummer"; - default: - return null; - } - } - } -} \ No newline at end of file diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/Sivilstatus.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/Sivilstatus.java deleted file mode 100644 index 51a7f5d4d91..00000000000 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/dto/Sivilstatus.java +++ /dev/null @@ -1,44 +0,0 @@ -package no.nav.testnav.apps.personexportapi.consumer.dto; - -import java.util.HashMap; -import java.util.Map; - -import lombok.Getter; - -@Getter -public enum Sivilstatus { - - UGIFT("1", "UGIF"), - GIFT("2", "GIFT"), - ENKE_ELLER_ENKEMANN("3", "ENKE"), - SKILT("4", "SKIL"), - SEPARERT("5", "SEPR"), - REGISTRERT_PARTNER("6", "REPA"), - SEPARERT_PARTNER("7", "SEPA"), - SKILT_PARTNER("8", "SKPA"), - GJENLEVENDE_PARTNER("9", "GJPA"); - - private static Map map = new HashMap<>(); - - static { - for (Sivilstatus sivilstatus : Sivilstatus.values()) { - map.put(sivilstatus.sivilstandKode, sivilstatus); - } - } - - private final String sivilstandKode; - private final String kodeverkskode; - - Sivilstatus(final String sivilstandKode, String kodeverkkode) { - this.sivilstandKode = sivilstandKode; - this.kodeverkskode = kodeverkkode; - } - - public static Sivilstatus lookup(String sivilstatusKode) { - return map.getOrDefault(sivilstatusKode, UGIFT); - } - - public static boolean exists(String kodeverkkode) { - return map.containsKey(kodeverkkode); - } -} diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/response/KodeverkBetydningerResponse.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/response/KodeverkBetydningerResponse.java deleted file mode 100644 index 45641b68282..00000000000 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/consumer/response/KodeverkBetydningerResponse.java +++ /dev/null @@ -1,57 +0,0 @@ -package no.nav.testnav.apps.personexportapi.consumer.response; - -import static java.util.Objects.isNull; - -import java.time.LocalDate; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class KodeverkBetydningerResponse { - - private Map> betydninger; - - public Map> getBetydninger() { - if (isNull(betydninger)) { - betydninger = new HashMap<>(); - } - return this.betydninger; - } - - @Data - @Builder - @NoArgsConstructor - @AllArgsConstructor - public static class Betydning { - - private LocalDate gyldigFra; - private LocalDate gyldigTil; - private Map beskrivelser; - - public Map getBeskrivelser() { - if (isNull(beskrivelser)) { - beskrivelser = new HashMap<>(); - } - return beskrivelser; - } - } - - @Data - @Builder - @NoArgsConstructor - @AllArgsConstructor - public static class Beskrivelse { - - private String term; - private String tekst; - } -} diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/converter/csv/HelsenettCsvConverter.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/converter/csv/HelsenettCsvConverter.java deleted file mode 100644 index ac5ea3e1086..00000000000 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/converter/csv/HelsenettCsvConverter.java +++ /dev/null @@ -1,145 +0,0 @@ -package no.nav.testnav.apps.personexportapi.converter.csv; - -import java.util.HashMap; -import java.util.Map; - -import no.nav.testnav.apps.personexportapi.consumer.dto.PersonStatusMapper; -import no.nav.testnav.apps.personexportapi.consumer.KodeverkConsumer; -import no.nav.testnav.apps.personexportapi.domain.Person; -import org.springframework.stereotype.Service; - -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import no.nav.testnav.libs.csvconverter.CsvConverter; -import no.nav.testnav.libs.csvconverter.CsvHeader; -import no.nav.testnav.libs.csvconverter.ObjectConverter; -import no.nav.testnav.libs.csvconverter.RowConverter; - -@Slf4j -@Service -@RequiredArgsConstructor -public class HelsenettCsvConverter extends CsvConverter { - - private static final String LANDKODER = "Landkoder"; - - private final KodeverkConsumer kodeverkConsumer; - - private enum Headers implements CsvHeader { - FNR("FNR"), - KORTNAVN("KORTNAVN"), - FORNAVN("FORNAVN"), - MELLOMNAVN("MELLOMNAVN"), - ETTERNAVN("ETTERNAVN"), - PIKENAVN("PIKENAVN"), - KJONN("KJONN"), - BESKR_KJONN("BESKR_KJONN"), - FODT_DATO("FODT_DATO"), - DOD_DATO("DOD_DATO"), - PERSONSTATUS("PERSONSTATUS"), - BESKR_PERSONSTATUS("BESKR_PERSONSTATUS"), - PERSONSTATUS_DATO("PERSONSTATUS_DATO"), - SIVILSTAND("SIVILSTAND"), - BESKR_SIVILSTAND("BESKR_SIVILSTAND"), - SIVILSTAND_DATO("SIVILSTAND_DATO"), - STATSBORGERLAND("STATSBORGERLAND"), - STATSBORGER_DATO("STATSBORGER_DATO"), - GATENAVN("GATENAVN"), - CO_ADRESSE("CO_ADRESSE"), - HUSNR("HUSNR"), - HUSBOKSTAV("HUSBOKSTAV"), - BOLIGNR("BOLIGNR"), - GATENR("GATENR"), - GARDSNR("GARDSNR"), - BRUKSNR("BRUKSNR"), - STEDSNAVN("STEDSNAVN"), - KOMMUNENR("KOMMUNENR"), - KOMMUNE("KOMMUNE"), - DATO_ADR_FRA("DATO_ADR_FRA"), - ADRESSEKODE("ADRESSEKODE"), - REG_DATO_ADR_KD("REG_DATO_ADR_KD"), - POSTADR_1("POSTADR_1"), - POSTADR_2("POSTADR_2"), - POSTADR_3("POSTADR_3"), - POSTNR("POSTNR"), - POSTSTED("POSTSTED"), - POSTADR_REG_DATO("POSTADR_REG_DATO"), - POSTADR_LAND("POSTADR_LAND"), - BYDEL("BYDEL"), - BYDELS_NAVN("BYDELS_NAVN"), - INNVANDRET_FRA_LAND("INNVANDRET_FRA_LAND"), - INNVANDRET_DATO("INNVANDRET_DATO"), - UTVANDRET_TIL_LAND("UTVANDRET_TIL_LAND"), - UTVANDRET_DATO("UTVANDRET_DATO"), - SKOLEKRETS("SKOLEKRETS"), - VALGKRETS("VALGKRETS"), - GRUNNKRETS("GRUNNKRETS"); - - private final String header; - - Headers(String header) { - this.header = header; - } - - @Override - public String getValue() { - return header; - } - } - - @Override - protected RowConverter getRowConverter() { - throw new UnsupportedOperationException("Import av person ikke stottet"); - } - - @Override - protected ObjectConverter getObjectConverter() { - return person -> { - Map map = new HashMap<>(); - map.put(Headers.FNR.getValue(), person.getIdent()); - map.put(Headers.FORNAVN.getValue(), person.getFornavn()); - map.put(Headers.MELLOMNAVN.getValue(), person.getMellomnavn()); - map.put(Headers.ETTERNAVN.getValue(), person.getEtternavn()); - map.put(Headers.PERSONSTATUS.getValue(), person.getPersonstatus()); - map.put(Headers.BESKR_PERSONSTATUS.getValue(), PersonStatusMapper.getPersonstatus(person)); - map.put(Headers.ADRESSEKODE.getValue(), person.getAdressetype()); - map.put(Headers.GATENAVN.getValue(), person.getGatenavn()); - map.put(Headers.GATENR.getValue(), person.getGatenr()); - map.put(Headers.HUSNR.getValue(), person.getHusnr()); - map.put(Headers.HUSBOKSTAV.getValue(), person.getHusbokstav()); - map.put(Headers.STEDSNAVN.getValue(), person.getGaardsnavn()); - map.put(Headers.GARDSNR.getValue(), person.getGaardsnr()); - map.put(Headers.BRUKSNR.getValue(), person.getBruksnr()); - map.put(Headers.BOLIGNR.getValue(), person.getBolignr()); - map.put(Headers.CO_ADRESSE.getValue(), person.getTilleggsadresse()); - map.put(Headers.POSTNR.getValue(), person.getPostnummer()); - map.put(Headers.POSTSTED.getValue(), kodeverkConsumer.getKodeverkOppslag("Postnummer", person.getPostnummer())); - map.put(Headers.KOMMUNENR.getValue(), person.getKommunenr()); - map.put(Headers.KOMMUNE.getValue(), kodeverkConsumer.getKodeverkOppslag("Kommuner", person.getKommunenr())); - map.put(Headers.DATO_ADR_FRA.getValue(), person.getFlyttedato()); - map.put(Headers.POSTADR_1.getValue(), person.getAdresse1()); - map.put(Headers.POSTADR_2.getValue(), person.getAdresse2()); - map.put(Headers.POSTADR_3.getValue(), person.getAdresse3()); - map.put(Headers.POSTADR_LAND.getValue(), kodeverkConsumer.getKodeverkOppslag(LANDKODER, person.getPostadrLand())); - map.put(Headers.FODT_DATO.getValue(), person.getFoedselsdato()); - map.put(Headers.KJONN.getValue(), person.getKjoenn()); - map.put(Headers.BESKR_KJONN.getValue(), person.getKjoennBeskrivelse()); - map.put(Headers.SIVILSTAND.getValue(), person.getSivilstand()); - map.put(Headers.BESKR_SIVILSTAND.getValue(), kodeverkConsumer.getKodeverkOppslag("Sivilstander", person.getSivilstandBeskrivelse())); - map.put(Headers.SIVILSTAND_DATO.getValue(), person.getSivilstandRegdato()); - map.put(Headers.STATSBORGERLAND.getValue(), kodeverkConsumer.getKodeverkOppslag(LANDKODER, person.getStatsborgerskap())); - map.put(Headers.STATSBORGER_DATO.getValue(), person.getStatsborgerskapRegdato()); - map.put(Headers.INNVANDRET_FRA_LAND.getValue(), kodeverkConsumer.getKodeverkOppslag(LANDKODER, person.getInnvandretFraLand())); - map.put(Headers.INNVANDRET_DATO.getValue(), person.getInvandretFraLandFlyttedato()); - map.put(Headers.UTVANDRET_TIL_LAND.getValue(), kodeverkConsumer.getKodeverkOppslag(LANDKODER, person.getUtvandretTilLand())); - map.put(Headers.UTVANDRET_DATO.getValue(), person.getUtvandretTilLandFlyttedato()); - - log.info(person.toString()); - return map; - }; - } - - @Override - protected CsvHeader[] getHeaders() { - return Headers.values(); - } -} diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/domain/Person.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/domain/Person.java deleted file mode 100644 index 1d56430e90e..00000000000 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/domain/Person.java +++ /dev/null @@ -1,205 +0,0 @@ -package no.nav.testnav.apps.personexportapi.domain; - -import static java.lang.Integer.parseInt; -import static java.lang.String.format; -import static java.util.Objects.nonNull; -import static org.apache.logging.log4j.util.Strings.isNotBlank; - -import java.time.LocalDate; -import java.time.format.DateTimeFormatter; -import java.time.format.DateTimeParseException; -import java.time.temporal.ChronoUnit; -import com.fasterxml.jackson.annotation.JsonIgnore; - -import no.nav.testnav.apps.personexportapi.consumer.dto.EndringsmeldingDTO; -import no.nav.testnav.apps.personexportapi.consumer.dto.FoedselsdatoFraIdent; -import no.nav.testnav.apps.personexportapi.consumer.dto.HusbokstavEncoder; -import no.nav.testnav.apps.personexportapi.consumer.dto.KjoennFraIdent; -import no.nav.testnav.apps.personexportapi.consumer.dto.LandkodeEncoder; -import no.nav.testnav.apps.personexportapi.consumer.dto.Sivilstatus; - -public class Person { - - private static final DateTimeFormatter TPS_DATE_FMT = DateTimeFormatter.ofPattern("yyyyMMdd"); - private static final int MYNDIGHET_ALDER = 18; - - private final EndringsmeldingDTO endringsmeldingDTO; - private final String page; - - public Person(EndringsmeldingDTO endringsmeldingDTO, String page) { - this.endringsmeldingDTO = endringsmeldingDTO; - this.page = page; - } - - public String getPage() { - return page; - } - - public String getIdent() { - return endringsmeldingDTO.getFodselsdato() + endringsmeldingDTO.getPersonnummer(); - } - - public String getFornavn() { - return endringsmeldingDTO.getFornavn(); - } - - public String getMellomnavn() { - return isNotBlank(endringsmeldingDTO.getMellomnavn()) ? endringsmeldingDTO.getMellomnavn() : null; - } - - public String getEtternavn() { - return endringsmeldingDTO.getSlektsnavn(); - } - - public String getAdressetype() { - return endringsmeldingDTO.getSpesRegType(); - } - - public String getGatenavn() { - return endringsmeldingDTO.isGateadresse() ? endringsmeldingDTO.getAdressenavn() : null; - } - - public String getGaardsnavn() { - return endringsmeldingDTO.isMatrikkeladresse() ? endringsmeldingDTO.getAdressenavn() : null; - } - - public String getHusnr() { - return endringsmeldingDTO.isGateadresse() ? endringsmeldingDTO.getHusBruk() : null; - } - - public String getHusbokstav() { - return endringsmeldingDTO.isGateadresse() ? HusbokstavEncoder.decode(endringsmeldingDTO.getBokstavFestenr()) : null; - } - - public String getGatenr() { - return endringsmeldingDTO.isGateadresse() ? endringsmeldingDTO.getGateGaard() : null; - } - - public String getGaardsnr() { - return endringsmeldingDTO.isMatrikkeladresse() ? endringsmeldingDTO.getGateGaard() : null; - } - - public String getBruksnr() { - return endringsmeldingDTO.isMatrikkeladresse() ? endringsmeldingDTO.getHusBruk() : null; - } - - public String getBolignr() { - return isNotBlank(endringsmeldingDTO.getBolignr()) ? endringsmeldingDTO.getBolignr() : null; - } - - public Object getTilleggsadresse() { - return isNotBlank(endringsmeldingDTO.getTilleggsadresse()) ? endringsmeldingDTO.getTilleggsadresse() : null; - } - - public String getPostnummer() { - return isNotBlank(endringsmeldingDTO.getPostnummer()) ? endringsmeldingDTO.getPostnummer() : null; - } - - public String getKommunenr() { - return isNotBlank(endringsmeldingDTO.getKommunenummer()) ? endringsmeldingDTO.getKommunenummer() : null; - } - - public String getFlyttedato() { - return formatDate(endringsmeldingDTO.getFlyttedatoAdr()); - } - - public String getAdresse1() { - return isNotBlank(endringsmeldingDTO.getAdresse1()) ? endringsmeldingDTO.getAdresse1() : null; - } - - public String getAdresse2() { - return isNotBlank(endringsmeldingDTO.getAdresse2()) ? endringsmeldingDTO.getAdresse2() : null; - } - - public String getAdresse3() { - return isNotBlank(endringsmeldingDTO.getAdresse3()) ? endringsmeldingDTO.getAdresse3() : null; - } - - public String getPostadrLand() { - return isNotBlank(endringsmeldingDTO.getPostadrLand()) ? LandkodeEncoder.decode(endringsmeldingDTO.getPostadrLand()) : null; - } - - public String getPersonstatus() { - return isNotBlank(endringsmeldingDTO.getStatuskode()) ? endringsmeldingDTO.getStatuskode() : null; - } - - public String getFoedselsdato() { - return FoedselsdatoFraIdent.getFoedselsdato(getIdent()).format(DateTimeFormatter.ISO_DATE); - } - - public Integer getKjoenn() { - return KjoennFraIdent.getKjoenn(getIdent()).getHdirType(); - } - - public String getKjoennBeskrivelse() { - return KjoennFraIdent.getKjoenn(getIdent()).getBeskrivelse(); - } - - public String getSivilstand() { - if (!isMyndig()) { - return null; - } else { - return isNotBlank(endringsmeldingDTO.getSivilstand()) ? - endringsmeldingDTO.getSivilstand() : "0"; - } - } - - public String getSivilstandBeskrivelse() { - return nonNull(getSivilstand()) ? Sivilstatus.lookup(getSivilstand()).getKodeverkskode() : null; - } - - public String getSivilstandRegdato() { - return formatDate(endringsmeldingDTO.getRegdatoSivilstand()); - } - - public String getStatsborgerskap() { - return isNotBlank(endringsmeldingDTO.getStatsborgerskap()) ? LandkodeEncoder.decode(endringsmeldingDTO.getStatsborgerskap()) : null; - } - - public String getStatsborgerskapRegdato() { - return formatDate(endringsmeldingDTO.getRegdatoStatsb()); - } - - public String getInnvandretFraLand() { - return isNotBlank(endringsmeldingDTO.getInnvandretFraLand()) ? LandkodeEncoder.decode(endringsmeldingDTO.getInnvandretFraLand()) : null; - } - - public String getInvandretFraLandFlyttedato() { - return formatDate(endringsmeldingDTO.getFraLandFlyttedato()); - } - - public String getUtvandretTilLand() { - return isNotBlank(endringsmeldingDTO.getUtvandretTilLand()) ? LandkodeEncoder.decode(endringsmeldingDTO.getUtvandretTilLand()) : null; - } - - public String getUtvandretTilLandFlyttedato() { - return formatDate(endringsmeldingDTO.getTilLandFlyttedato()); - } - - @JsonIgnore - public boolean isFnr() { - return parseInt(Character.toString(endringsmeldingDTO.getFodselsdato().charAt(0))) < 4; - } - - @Override - public String toString() { - return format("Page: %s fnr: %s", getPage(), getIdent()); - } - - private static String formatDate(String tpsDato) { - - try { - return isNotBlank(tpsDato) ? - LocalDate.parse(tpsDato, TPS_DATE_FMT) - .format(DateTimeFormatter.ISO_DATE) : null; - } catch (DateTimeParseException e){ - return null; - } - } - - private boolean isMyndig() { - return ChronoUnit.YEARS.between( - FoedselsdatoFraIdent.getFoedselsdato(getIdent()).toLocalDate(), - LocalDate.now()) > MYNDIGHET_ALDER; - } -} \ No newline at end of file diff --git a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/provider/PersonExportController.java b/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/provider/PersonExportController.java deleted file mode 100644 index 15f57615923..00000000000 --- a/apps/person-export-api/src/main/java/no/nav/testnav/apps/personexportapi/provider/PersonExportController.java +++ /dev/null @@ -1,72 +0,0 @@ -package no.nav.testnav.apps.personexportapi.provider; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintWriter; -import java.time.LocalDateTime; -import java.util.List; -import jakarta.servlet.http.HttpServletResponse; - -import no.nav.testnav.apps.personexportapi.adapter.SlackAdapter; -import no.nav.testnav.apps.personexportapi.consumer.TpsfConsumer; -import no.nav.testnav.apps.personexportapi.converter.csv.HelsenettCsvConverter; -import no.nav.testnav.apps.personexportapi.domain.Person; -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.RestController; - -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@RestController -@RequiredArgsConstructor -@RequestMapping("/api/v1/personer") -public class PersonExportController { - - private final TpsfConsumer consumer; - private final SlackAdapter slackAdapter; - private final HttpServletResponse response; - private final HelsenettCsvConverter helsenettCsvConverter; - - @GetMapping(value = "/nhn/{avspillingsgruppe}") - public void exportHelsenettFormat(@PathVariable("avspillingsgruppe") String avspillingsgruppe) throws IOException { - - long startTime = System.nanoTime(); - - List personer = consumer.getPersoner(avspillingsgruppe); - log.info("Eksporterer {} personer til csv til Slack", personer.size()); - - ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); - PrintWriter pw = new PrintWriter(byteStream); - - helsenettCsvConverter.write(pw, personer); - slackAdapter.uploadFile( - byteStream.toByteArray(), - "testnorge-personer-nhn-" + LocalDateTime.now().toString() + ".csv" - ); - -// log.info("Eksporterer {} personer til http response", personer.size()); -// response.setContentType("text/csv"); -// response.setCharacterEncoding(StandardCharsets.UTF_8.toString()); -// response.setHeader( -// "Content-Disposition", -// "attachment; filename=testnorge-personer-nhn-" + LocalDateTime.now().toString() + ".csv" -// ); -// helsenettCsvConverter.write(response.getWriter(), personer); - - log.info("Medgaatt tid til uttrekk {} ", getReadableTime(System.nanoTime() - startTime)); - } - - private static String getReadableTime(Long nanos) { - - long tempSec = nanos / (1000 * 1000 * 1000); - long sec = tempSec % 60; - long min = (tempSec / 60) % 60; - long hour = (tempSec / (60 * 60)) % 24; - long day = (tempSec / (24 * 60 * 60)) % 24; - - return String.format("%dd %dh %dm %ds", day, hour, min, sec); - } -} diff --git a/apps/person-export-api/src/main/resources/application.yml b/apps/person-export-api/src/main/resources/application.yml deleted file mode 100644 index 13443ecdb4b..00000000000 --- a/apps/person-export-api/src/main/resources/application.yml +++ /dev/null @@ -1,60 +0,0 @@ -AAD_ISSUER_URI: https://login.microsoftonline.com/62366534-1ec3-4962-8869-9b5535279d0b - -consumers: - tps-forvalter: - url: https://tps-forvalteren-proxy.dev-fss-pub.nais.io - cluster: dev-fss - namespace: dolly - name: tps-forvalteren-proxy - threads: 5 - slack: - token: ${SLACK_TOKEN} - channel: ${SLACK_CHANNEL} - baseUrl: https://slack.com - kodeverk: - url: https://testnav-kodeverk-proxy.dev-fss-pub.nais.io - cluster: dev-fss - namespace: dolly - name: testnav-kodeverk-proxy - -spring: - application: - version: application.version.todo //TODO Finn ut hvordan denne kan settes fra gradle - name: testnav-person-export-api - description: Api for å eksportere personer. - security: - oauth2: - resourceserver: - aad: - issuer-uri: ${AAD_ISSUER_URI}/v2.0 - jwk-set-uri: ${AAD_ISSUER_URI}/discovery/v2.0/keys - accepted-audience: ${azure.app.client.id}, api://${azure.app.client.id} - tokenx: - issuer-uri: https://tokenx.dev-gcp.nav.cloud.nais.io - jwk-set-uri: https://tokenx.dev-gcp.nav.cloud.nais.io/jwks - accepted-audience: dev-gcp:dolly:testnav-person-export-api - -springdoc: - swagger-ui: - disable-swagger-default-url: true - url: /v3/api-docs - -management: - endpoints: - enabled-by-default: true - web: - base-path: /internal - exposure.include: prometheus,heapdump,health - path-mapping: - prometheus: metrics - endpoint: - prometheus.enabled: true - heapdump.enabled: true - prometheus: - metrics: - export: - enabled: true -server: - servlet: - encoding: - charset: UTF-8 \ No newline at end of file diff --git a/apps/person-export-api/src/main/resources/bootstrap.yml b/apps/person-export-api/src/main/resources/bootstrap.yml deleted file mode 100644 index 0451449ca23..00000000000 --- a/apps/person-export-api/src/main/resources/bootstrap.yml +++ /dev/null @@ -1,4 +0,0 @@ -spring: - cloud: - vault: - enabled: false \ No newline at end of file diff --git a/apps/person-export-api/src/main/resources/logback-spring.xml b/apps/person-export-api/src/main/resources/logback-spring.xml deleted file mode 100644 index 1a9ce7a5e5c..00000000000 --- a/apps/person-export-api/src/main/resources/logback-spring.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - true - 256 - 10280 - 20 - ^sun\.reflect\..*\.invoke - ^net\.sf\.cglib\.proxy\.MethodProxy\.invoke - java\.util\.concurrent\..* - org\.apache\.catalina\..* - org\.apache\.coyote\..* - org\.apache\.tomcat\..* - - - - - - - - - - - - - %d{HH:mm:ss.SSS} | %5p | %logger{25} | %m%n - - utf8 - - - - - - - - - \ No newline at end of file diff --git a/apps/person-export-api/src/test/java/no/nav/testnav/apps/personexportapi/ApplicationContextTest.java b/apps/person-export-api/src/test/java/no/nav/testnav/apps/personexportapi/ApplicationContextTest.java deleted file mode 100644 index 6c91d039476..00000000000 --- a/apps/person-export-api/src/test/java/no/nav/testnav/apps/personexportapi/ApplicationContextTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package no.nav.testnav.apps.personexportapi; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.security.oauth2.jwt.JwtDecoder; -import org.springframework.test.context.ActiveProfiles; - -@SpringBootTest -@ActiveProfiles("test") -class ApplicationContextTest { - - @MockBean - public JwtDecoder jwtDecoder; - - @Test - @SuppressWarnings("java:S2699") - void load_app_context() { - } -} diff --git a/apps/person-export-api/src/test/resources/application-test.yml b/apps/person-export-api/src/test/resources/application-test.yml deleted file mode 100644 index 1ecf6903fdd..00000000000 --- a/apps/person-export-api/src/test/resources/application-test.yml +++ /dev/null @@ -1,27 +0,0 @@ -spring: - cloud: - vault: - enabled: false - -azure: - app: - client: - id: dummy - secret: dummy - -consumers: - tps-forvalter: - url: http://localhost:${wiremock.server.port:0}/tpsf - cluster: dev-fss - namespace: dolly - name: tps-forvalteren-proxy - threads: 5 - slack: - token: dummy - channel: dummy - baseUrl: dummy - kodeverk: - url: http://localhost:${wiremock.server.port:0}/kodeverk - cluster: dev-fss - namespace: dolly - name: testnav-kodeverk-proxy \ No newline at end of file diff --git a/apps/testnorge-statisk-data-forvalter/README.md b/apps/testnorge-statisk-data-forvalter/README.md index 56e5fdbe6bf..095836cca16 100644 --- a/apps/testnorge-statisk-data-forvalter/README.md +++ b/apps/testnorge-statisk-data-forvalter/README.md @@ -10,7 +10,7 @@ Statisk data forvalter er en applikasjon som har som ansvar å forvalte faste te Denne applikasjonen belager seg på flere andre applikasjoner for å kunne legge inn data. ## Statiske data - +Integrasjonen mot TPSF og TPS er fjernet men ikke oppdatert i figur: ![Faste data flowchart](./doc/images/Faste%20data%20flowchart.png "Faste data flowchart") @@ -53,11 +53,5 @@ Ha naisdevice kjørende og kjør StatiskDataForvalterApplicationStarter med føl -Dspring.cloud.vault.token=[kopier token fra vault] -Dspring.profiles.active=local ``` -NB! Applikasjonen starter på port 4390. Swagger på [http://localhost:4390/swagger](http://localhost:4390/swagger). +Swagger på [http://localhost:8080/swagger](http://localhost:4390/swagger). -### Utviklerimage -I utviklerimage brukes ikke naisdevice og du må legge til følgende ekstra argumenter: -``` --Djavax.net.ssl.trustStore=[path til lokal truststore] --Djavax.net.ssl.trustStorePassword=[passord til lokal truststore] -``` diff --git a/apps/testnorge-statisk-data-forvalter/config.yml b/apps/testnorge-statisk-data-forvalter/config.yml index 208224c162d..5b0c22890ba 100644 --- a/apps/testnorge-statisk-data-forvalter/config.yml +++ b/apps/testnorge-statisk-data-forvalter/config.yml @@ -53,12 +53,6 @@ spec: cluster: dev-gcp outbound: rules: - - application: testnorge-hodejegeren - cluster: dev-fss - - application: testnorge-tp - cluster: dev-fss - - application: testnav-person-service - cluster: dev-gcp - application: generer-navn-service cluster: dev-gcp - application: testnav-organisasjon-service @@ -67,8 +61,6 @@ spec: cluster: dev-gcp - application: testnav-person-faste-data-service cluster: dev-gcp - - application: tps-forvalteren-proxy - cluster: dev-fss - application: krr-stub - application: synthdata-aareg cluster: dev-fss diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/StatiskDataForvalterApplicationStarter.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/StatiskDataForvalterApplicationStarter.java index ec18571f48a..1caf883368d 100644 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/StatiskDataForvalterApplicationStarter.java +++ b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/StatiskDataForvalterApplicationStarter.java @@ -1,11 +1,10 @@ package no.nav.registre.sdforvalter; import lombok.extern.slf4j.Slf4j; +import no.nav.registre.sdforvalter.util.VaultUtil; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import no.nav.registre.sdforvalter.util.VaultUtil; - @Slf4j @SpringBootApplication public class StatiskDataForvalterApplicationStarter { @@ -17,4 +16,4 @@ public static void main(String[] args) { SpringApplication.run(StatiskDataForvalterApplicationStarter.class, args); } -} +} \ No newline at end of file diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/adapter/TpsIdentTagAdapter.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/adapter/TpsIdentTagAdapter.java deleted file mode 100644 index 194423b8668..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/adapter/TpsIdentTagAdapter.java +++ /dev/null @@ -1,30 +0,0 @@ -package no.nav.registre.sdforvalter.adapter; - -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Component; - -import java.util.List; - -import no.nav.registre.sdforvalter.database.model.TagModel; -import no.nav.registre.sdforvalter.database.model.TpsIdentTagModel; -import no.nav.registre.sdforvalter.database.repository.TpsIdentTagRepository; - -@Component -@RequiredArgsConstructor -public class TpsIdentTagAdapter { - private final TpsIdentTagRepository identTagRepository; - - public TpsIdentTagModel save(TpsIdentTagModel model) { - return identTagRepository - .findBy(model.getIdent().getFnr(), model.getTag().getTag()) - .orElseGet(() -> identTagRepository.save(model)); - } - - public List findAllTagsByIdent(String ident) { - return identTagRepository - .findAllByIdent(ident) - .stream() - .map(TpsIdentTagModel::getTag) - .toList(); - } -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/adapter/TpsIdenterAdapter.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/adapter/TpsIdenterAdapter.java deleted file mode 100644 index 4f7e44f0b98..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/adapter/TpsIdenterAdapter.java +++ /dev/null @@ -1,101 +0,0 @@ -package no.nav.registre.sdforvalter.adapter; - -import lombok.extern.slf4j.Slf4j; -import no.nav.registre.sdforvalter.database.model.TagModel; -import no.nav.registre.sdforvalter.database.model.TpsIdentModel; -import no.nav.registre.sdforvalter.database.model.TpsIdentTagModel; -import no.nav.registre.sdforvalter.database.repository.TpsIdenterRepository; -import no.nav.registre.sdforvalter.domain.TpsIdent; -import no.nav.registre.sdforvalter.domain.TpsIdentListe; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.stream.StreamSupport; - -@Slf4j -@Component -public class TpsIdenterAdapter extends FasteDataAdapter { - private final TpsIdenterRepository tpsIdenterRepository; - private final TpsIdentTagAdapter tpsIdentTagAdapter; - private final TagsAdapter tagsAdapter; - - public TpsIdenterAdapter( - OpprinnelseAdapter opprinnelseAdapter, - GruppeAdapter gruppeAdapter, - TpsIdenterRepository tpsIdenterRepository, - TpsIdentTagAdapter tpsIdentTagAdapter, - TagsAdapter tagsAdapter - ) { - super(opprinnelseAdapter, gruppeAdapter); - this.tpsIdenterRepository = tpsIdenterRepository; - this.tpsIdentTagAdapter = tpsIdentTagAdapter; - this.tagsAdapter = tagsAdapter; - } - - private TpsIdentListe fetch() { - List list = StreamSupport - .stream(tpsIdenterRepository.findAll().spliterator(), false) - .map(value -> new TpsIdent( - value, - tpsIdentTagAdapter.findAllTagsByIdent(value.getFnr()) - )).toList(); - return new TpsIdentListe(list); - } - - - public TpsIdentListe fetchAll() { - var tpsIdentModels = StreamSupport.stream(tpsIdenterRepository.findAll().spliterator(), false); - List liste = tpsIdentModels.map(tpsIdentModel -> { - List tagModels = fetchTagsByIdent(tpsIdentModel.getFnr()); - return new TpsIdent(tpsIdentModel, tagModels); - }).toList(); - return new TpsIdentListe(liste); - } - - public TpsIdentListe fetchBy(String gruppe) { - log.info("Henter tps identer med gruppe {}", gruppe); - - List tpsIdentModels = tpsIdenterRepository.findByGruppeModel(getGruppe(gruppe)); - List liste = tpsIdentModels.stream().map(tpsIdentModel -> { - List tagModels = fetchTagsByIdent(tpsIdentModel.getFnr()); - return new TpsIdent(tpsIdentModel, tagModels); - }).toList(); - - log.info("Fant {} personer fra gruppe {}", liste.size(), gruppe); - return new TpsIdentListe(liste); - } - - public TpsIdent fetchByIdent(String ident) { - log.info("Henter tps-ident {}", ident); - var tpsIdent = tpsIdenterRepository.findByFnr(ident); - var tags = fetchTagsByIdent(ident); - return tpsIdent != null ? new TpsIdent(tpsIdent, tags) : null; - } - - public List fetchTagsByIdent(String ident) { - return tpsIdentTagAdapter.findAllTagsByIdent(ident); - } - - public TpsIdentListe save(TpsIdentListe liste) { - List list = liste.itemsNotIn(fetch()); - if (list.isEmpty()) { - return new TpsIdentListe(); - } - - List tpsIdents = new ArrayList<>(); - - for (TpsIdent tpsIdent : list) { - var opprinnelse = getOpprinnelse(tpsIdent); - var gruppe = getGruppe(tpsIdent); - TpsIdentModel tpsIdentModel = tpsIdenterRepository.save(new TpsIdentModel(tpsIdent, opprinnelse, gruppe)); - List tagModels = tpsIdent.getTags() == null ? Collections.emptyList() : tpsIdent.getTags().stream().map(tagsAdapter::save).toList(); - tagModels.forEach(tagModel -> tpsIdentTagAdapter.save( - new TpsIdentTagModel(null, tpsIdentModel, tagModel) - )); - tpsIdents.add(new TpsIdent(tpsIdentModel, tagModels)); - } - return new TpsIdentListe(tpsIdents); - } -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/Consumers.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/Consumers.java index e7fe0e1b255..5e896dde510 100644 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/Consumers.java +++ b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/config/Consumers.java @@ -26,13 +26,8 @@ public class Consumers { private ServerProperties testnavAaregProxy; private ServerProperties genererNavnService; - private ServerProperties testnorgeHodejegeren; private ServerProperties kodeverk; private ServerProperties testnavOrganisasjonFasteDataService; private ServerProperties testnavOrganisasjonService; private ServerProperties testnavPersonFasteDataService; - private ServerProperties person; - private ServerProperties testnorgeTp; - private ServerProperties tpsForvalterenProxy; - } diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/hodejegeren/HodejegerenConsumer.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/hodejegeren/HodejegerenConsumer.java deleted file mode 100644 index d37b86bcca5..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/hodejegeren/HodejegerenConsumer.java +++ /dev/null @@ -1,50 +0,0 @@ -package no.nav.registre.sdforvalter.consumer.rs.hodejegeren; - -import lombok.extern.slf4j.Slf4j; -import no.nav.registre.sdforvalter.config.Consumers; -import no.nav.registre.sdforvalter.consumer.rs.hodejegeren.command.GetAlleIdenterCommand; -import no.nav.registre.sdforvalter.consumer.rs.hodejegeren.command.GetLevendeIdenterCommand; -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; -import org.springframework.stereotype.Component; -import org.springframework.web.reactive.function.client.WebClient; - -import java.util.List; - -@Slf4j -@Component -public class HodejegerenConsumer { - - private final WebClient webClient; - private final TokenExchange tokenExchange; - private final ServerProperties serverProperties; - - public HodejegerenConsumer( - Consumers consumers, - TokenExchange tokenExchange - ) { - serverProperties = consumers.getTestnorgeHodejegeren(); - this.tokenExchange = tokenExchange; - this.webClient = WebClient - .builder() - .baseUrl(serverProperties.getUrl()) - .build(); - } - - /** - * @param playgroupId AvspillergruppeId som man ønsker å hente fnr fra - * @return En liste med fnr som eksisterer i gruppen - */ - public List getPlaygroupFnrs(Long playgroupId) { - return tokenExchange.exchange(serverProperties) - .flatMap(accessToken -> new GetAlleIdenterCommand(playgroupId, webClient, accessToken.getTokenValue()).call()) - .block(); - } - - public List getLivingFnrs(Long playgroupId, String environment) { - return tokenExchange.exchange(serverProperties) - .flatMap(accessToken -> new GetLevendeIdenterCommand(playgroupId, environment, webClient, accessToken.getTokenValue()).call()) - .block(); - } - -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/hodejegeren/command/GetAlleIdenterCommand.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/hodejegeren/command/GetAlleIdenterCommand.java deleted file mode 100644 index c113efec926..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/hodejegeren/command/GetAlleIdenterCommand.java +++ /dev/null @@ -1,33 +0,0 @@ -package no.nav.registre.sdforvalter.consumer.rs.hodejegeren.command; - -import lombok.RequiredArgsConstructor; -import no.nav.registre.sdforvalter.util.WebClientFilter; -import org.springframework.core.ParameterizedTypeReference; -import org.springframework.web.reactive.function.client.WebClient; -import reactor.core.publisher.Mono; - -import java.util.List; -import java.util.concurrent.Callable; - -@RequiredArgsConstructor -public class GetAlleIdenterCommand implements Callable>> { - - private static final ParameterizedTypeReference> RESPONSE_TYPE = new ParameterizedTypeReference<>() { - }; - private final Long avspillergruppeId; - private final WebClient webClient; - private final String token; - - @Override - public Mono> call() { - return webClient.get() - .uri(builder -> - builder.path("/api/v1/alle-identer/{avspillergruppeId}") - .build(avspillergruppeId) - ) - .header("Authorization", "Bearer " + token) - .retrieve() - .bodyToMono(RESPONSE_TYPE) - .doOnError(WebClientFilter::logErrorMessage); - } -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/hodejegeren/command/GetLevendeIdenterCommand.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/hodejegeren/command/GetLevendeIdenterCommand.java deleted file mode 100644 index 8df3d8117b8..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/hodejegeren/command/GetLevendeIdenterCommand.java +++ /dev/null @@ -1,35 +0,0 @@ -package no.nav.registre.sdforvalter.consumer.rs.hodejegeren.command; - -import lombok.RequiredArgsConstructor; -import no.nav.registre.sdforvalter.util.WebClientFilter; -import org.springframework.core.ParameterizedTypeReference; -import org.springframework.web.reactive.function.client.WebClient; -import reactor.core.publisher.Mono; - -import java.util.List; -import java.util.concurrent.Callable; - -@RequiredArgsConstructor -public class GetLevendeIdenterCommand implements Callable>> { - - private static final ParameterizedTypeReference> RESPONSE_TYPE = new ParameterizedTypeReference<>() { - }; - private final Long avspillergruppeId; - private final String miljoe; - private final WebClient webClient; - private final String token; - - @Override - public Mono> call() { - return webClient.get() - .uri(builder -> - builder.path("/api/v1/levende-identer/{avspillergruppeId}") - .queryParam("miljoe", miljoe) - .build(avspillergruppeId) - ) - .header("Authorization", "Bearer " + token) - .retrieve() - .bodyToMono(RESPONSE_TYPE) - .doOnError(WebClientFilter::logErrorMessage); - } -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/person/PersonConsumer.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/person/PersonConsumer.java deleted file mode 100644 index 33a3cc9dff6..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/person/PersonConsumer.java +++ /dev/null @@ -1,118 +0,0 @@ -package no.nav.registre.sdforvalter.consumer.rs.person; - -import com.fasterxml.jackson.databind.ObjectMapper; -import lombok.extern.slf4j.Slf4j; -import no.nav.registre.sdforvalter.config.Consumers; -import no.nav.registre.sdforvalter.domain.TpsIdent; -import no.nav.registre.sdforvalter.domain.TpsIdentListe; -import no.nav.registre.sdforvalter.domain.person.Person; -import no.nav.registre.sdforvalter.exception.UgyldigIdentException; -import no.nav.testnav.libs.commands.CreatePersonCommand; -import no.nav.testnav.libs.commands.GetPersonCommand; -import no.nav.testnav.libs.dto.person.v1.Persondatasystem; -import no.nav.testnav.libs.securitycore.domain.AccessToken; -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; -import org.springframework.http.MediaType; -import org.springframework.http.codec.json.Jackson2JsonDecoder; -import org.springframework.http.codec.json.Jackson2JsonEncoder; -import org.springframework.stereotype.Component; -import org.springframework.web.reactive.function.client.ExchangeStrategies; -import org.springframework.web.reactive.function.client.WebClient; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; - -@Slf4j -@Component -public class PersonConsumer { - - private final WebClient webClient; - private final TokenExchange tokenExchange; - private final ServerProperties serverProperties; - private final Executor executor; - - public PersonConsumer( - ObjectMapper objectMapper, - Consumers consumers, - TokenExchange tokenExchange) { - serverProperties = consumers.getPerson(); - this.tokenExchange = tokenExchange; - ExchangeStrategies jacksonStrategy = ExchangeStrategies - .builder() - .codecs( - config -> { - config - .defaultCodecs() - .jackson2JsonEncoder(new Jackson2JsonEncoder(objectMapper, MediaType.APPLICATION_JSON)); - config - .defaultCodecs() - .jackson2JsonDecoder(new Jackson2JsonDecoder(objectMapper, MediaType.APPLICATION_JSON)); - }) - .build(); - this.webClient = WebClient - .builder() - .exchangeStrategies(jacksonStrategy) - .baseUrl(serverProperties.getUrl()) - .build(); - this.executor = Executors.newFixedThreadPool(serverProperties.getThreads()); - } - - private CompletableFuture hentPerson(String ident, AccessToken accessToken) { - var command = new GetPersonCommand(webClient, ident, accessToken.getTokenValue(), Persondatasystem.PDL, null); - return CompletableFuture.supplyAsync( - command::call, - executor - ).thenApply(Person::new); - } - - public List hentPersoner(Set identer) { - AccessToken accessToken = tokenExchange.exchange(serverProperties).block(); - List personer = new ArrayList<>(); - var futures = identer.stream().map(ident -> hentPerson(ident, accessToken)).toList(); - for (CompletableFuture future : futures) { - try { - Person person = future.get(); - personer.add(person != null && person.getFnr() != null ? person : null); - } catch (Exception e) { - log.error("Klarte ikke å hente ut person", e); - Thread.currentThread().interrupt(); - } - } - return personer; - } - - public void opprettPersoner(TpsIdentListe identer) { - AccessToken accessToken = tokenExchange.exchange(serverProperties).block(); - List> futures = identer.stream().map(ident -> CompletableFuture.supplyAsync(() -> { - try { - new CreatePersonCommand(webClient, ident.toDTO(), accessToken.getTokenValue(), ident.getOpprinnelse()).call().block(); - return ident; - } catch (Exception e) { - log.error("Kunne ikke opprette ident {}", ident.getFnr(), e); - return null; - } - }, executor) - ).toList(); - - List opprettedeIdenter = futures.stream().map(future -> { - try { - return future.get(); - } catch (InterruptedException | ExecutionException e) { - log.error("Noe gikk galt ved henting av resultat fra tråd", e); - Thread.currentThread().interrupt(); - return null; - } - }).toList(); - - if (opprettedeIdenter.stream().anyMatch(Objects::isNull)) { - throw new UgyldigIdentException("Klarte ikke å opprette alle identer"); - } - } -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/person/PersonFasteDataConsumer.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/person/PersonFasteDataConsumer.java deleted file mode 100644 index 8a901395312..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/person/PersonFasteDataConsumer.java +++ /dev/null @@ -1,54 +0,0 @@ -package no.nav.registre.sdforvalter.consumer.rs.person; - -import lombok.extern.slf4j.Slf4j; -import no.nav.registre.sdforvalter.config.Consumers; -import no.nav.registre.sdforvalter.consumer.rs.person.command.SavePersonFasteDataCommand; -import no.nav.registre.sdforvalter.domain.TpsIdent; -import no.nav.registre.sdforvalter.domain.TpsIdentListe; -import no.nav.testnav.libs.dto.personservice.v1.Gruppe; -import no.nav.testnav.libs.securitycore.domain.AccessToken; -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; -import org.springframework.stereotype.Component; -import org.springframework.web.reactive.function.client.WebClient; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - - -@Slf4j -@Component -public class PersonFasteDataConsumer { - private final WebClient webClient; - private final ServerProperties serverProperties; - private final TokenExchange tokenExchange; - - public PersonFasteDataConsumer( - Consumers consumers, - TokenExchange tokenExchange) { - serverProperties = consumers.getTestnavPersonFasteDataService(); - this.tokenExchange = tokenExchange; - this.webClient = WebClient - .builder() - .baseUrl(serverProperties.getUrl()) - .build(); - } - - public void opprett(TpsIdentListe tpsIdentListe) { - tokenExchange.exchange(serverProperties) - .flatMapMany(token -> Flux.concat( - tpsIdentListe.getListe().stream().map(value -> opprett(value, token)).toList() - )) - .collectList() - .block(); - } - - public Mono opprett(TpsIdent tpsIdent, AccessToken accessToken) { - var gruppe = tpsIdent.getGruppe() == null ? Gruppe.ANDRE : Gruppe.valueOf(tpsIdent.getGruppe()); - return new SavePersonFasteDataCommand( - webClient, - accessToken.getTokenValue(), - tpsIdent.toDTOV2(), - gruppe - ).call(); - } -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/person/command/SavePersonFasteDataCommand.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/person/command/SavePersonFasteDataCommand.java deleted file mode 100644 index f5bc7e8b1cf..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/person/command/SavePersonFasteDataCommand.java +++ /dev/null @@ -1,41 +0,0 @@ -package no.nav.registre.sdforvalter.consumer.rs.person.command; - -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; - -import no.nav.registre.sdforvalter.util.WebClientFilter; -import no.nav.testnav.libs.dto.personservice.v1.Gruppe; -import no.nav.testnav.libs.dto.personservice.v1.PersonDTO; -import org.springframework.http.HttpHeaders; -import org.springframework.web.reactive.function.BodyInserters; -import org.springframework.web.reactive.function.client.WebClient; -import reactor.core.publisher.Mono; -import reactor.util.retry.Retry; - -import java.time.Duration; -import java.util.concurrent.Callable; - -@Slf4j -@RequiredArgsConstructor -public class SavePersonFasteDataCommand implements Callable> { - private final WebClient webClient; - private final String token; - private final PersonDTO dto; - private final Gruppe gruppe; - - - @Override - public Mono call() { - return webClient - .put() - .uri("/api/v1/personer") - .header(HttpHeaders.AUTHORIZATION, "Bearer " + token) - .header("gruppe", gruppe.name()) - .body(BodyInserters.fromPublisher(Mono.just(dto), PersonDTO.class)) - .retrieve() - .bodyToMono(Void.class) - .doOnError(WebClientFilter::logErrorMessage) - .retryWhen(Retry.backoff(3, Duration.ofSeconds(5)) - .filter(WebClientFilter::is5xxException)); - } -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tp/TpConsumer.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tp/TpConsumer.java deleted file mode 100644 index 3748743c1a6..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tp/TpConsumer.java +++ /dev/null @@ -1,50 +0,0 @@ -package no.nav.registre.sdforvalter.consumer.rs.tp; - -import lombok.extern.slf4j.Slf4j; -import no.nav.registre.sdforvalter.config.Consumers; -import no.nav.registre.sdforvalter.consumer.rs.tp.command.OpprettPersonerTpCommand; -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; -import org.springframework.stereotype.Component; -import org.springframework.web.reactive.function.client.WebClient; - -import java.util.List; - -import static java.util.Objects.isNull; - -@Slf4j -@Component -public class TpConsumer { - - private final WebClient webClient; - private final TokenExchange tokenExchange; - private final ServerProperties serverProperties; - - public TpConsumer( - TokenExchange tokenExchange, - Consumers consumers) { - serverProperties = consumers.getTestnorgeTp(); - this.tokenExchange = tokenExchange; - this.webClient = WebClient - .builder() - .baseUrl(serverProperties.getUrl()) - .build(); - } - - /** - * @param data Fnr som skal legges til i tp - * @param environment Miljøet de skal legges til i - * @return true hvis den ble lagret i tp, false hvis de ikke ble lagret - */ - public boolean send(List data, String environment) { - var response = tokenExchange.exchange(serverProperties) - .flatMap(accessToken -> new OpprettPersonerTpCommand(webClient, data, environment, accessToken.getTokenValue()).call()) - .block(); - - if (isNull(response)){ - log.warn("Noe skjedde med initialisering av TP i gitt miljø. Det kan være at databasen ikke er koblet opp til miljø {}", environment); - return false; - } - return true; - } -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tp/command/OpprettPersonerTpCommand.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tp/command/OpprettPersonerTpCommand.java deleted file mode 100644 index 9e3a58a8be7..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tp/command/OpprettPersonerTpCommand.java +++ /dev/null @@ -1,40 +0,0 @@ -package no.nav.registre.sdforvalter.consumer.rs.tp.command; - -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import no.nav.registre.sdforvalter.util.WebClientFilter; -import org.springframework.core.ParameterizedTypeReference; -import org.springframework.web.reactive.function.BodyInserters; -import org.springframework.web.reactive.function.client.WebClient; -import reactor.core.publisher.Mono; - -import java.util.List; -import java.util.concurrent.Callable; - -@Slf4j -@RequiredArgsConstructor -public class OpprettPersonerTpCommand implements Callable>> { - - private static final ParameterizedTypeReference> RESPONSE_TYPE = new ParameterizedTypeReference<>() { - }; - - private final WebClient webClient; - private final List fnrs; - private final String miljoe; - private final String token; - - @Override - public Mono> call() { - return webClient.post() - .uri(builder -> - builder.path("/api/v1/orkestrering/opprettPersoner/{miljoe}") - .build(miljoe) - ) - .header("Authorization", "Bearer " + token) - .body(BodyInserters.fromValue(fnrs)) - .retrieve() - .bodyToMono(RESPONSE_TYPE) - .doOnError(WebClientFilter::logErrorMessage) - .onErrorResume(throwable -> Mono.empty()); - } -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/TpsfConsumer.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/TpsfConsumer.java deleted file mode 100644 index 649fd3ad0f0..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/TpsfConsumer.java +++ /dev/null @@ -1,53 +0,0 @@ -package no.nav.registre.sdforvalter.consumer.rs.tpsf; - -import lombok.extern.slf4j.Slf4j; -import no.nav.registre.sdforvalter.config.Consumers; -import no.nav.registre.sdforvalter.consumer.rs.tpsf.command.GetMeldingsIdsCommand; -import no.nav.registre.sdforvalter.consumer.rs.tpsf.command.PostSendSkdMeldingerTpsCommand; -import no.nav.registre.sdforvalter.consumer.rs.tpsf.request.SendToTpsRequest; -import no.nav.registre.sdforvalter.consumer.rs.tpsf.response.SkdMeldingerTilTpsRespons; -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; -import org.springframework.stereotype.Component; -import org.springframework.web.reactive.function.client.WebClient; -import reactor.core.publisher.Mono; - -import java.util.List; - -@Component -@Slf4j -public class TpsfConsumer { - private final WebClient webClient; - private final TokenExchange tokenExchange; - private final ServerProperties serverProperties; - - public TpsfConsumer( - Consumers consumers, - TokenExchange tokenExchange) { - serverProperties = consumers.getTpsForvalterenProxy(); - this.webClient = WebClient - .builder() - .baseUrl(serverProperties.getUrl()) - .build(); - this.tokenExchange = tokenExchange; - } - - private Mono sendSkdmeldingerToTps( - Long gruppeId, - SendToTpsRequest sendToTpsRequest) { - - log.info("Sender skd-meldinger med avspillergruppe {} til tps", gruppeId); - return tokenExchange.exchange(serverProperties).flatMap(accessToken -> - new PostSendSkdMeldingerTpsCommand(gruppeId, sendToTpsRequest, webClient, accessToken.getTokenValue()).call()); - } - - private Mono> getMeldingIdsFromAvspillergruppe(Long gruppeId) { - return tokenExchange.exchange(serverProperties) - .flatMap(accessToken -> new GetMeldingsIdsCommand(gruppeId, webClient, accessToken.getTokenValue()).call()); - } - - public Mono sendTilTps(Long gruppeId, String miljoe) { - return getMeldingIdsFromAvspillergruppe(gruppeId) - .flatMap(meldingIds -> sendSkdmeldingerToTps(gruppeId, new SendToTpsRequest(miljoe, meldingIds))); - } -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/command/GetMeldingsIdsCommand.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/command/GetMeldingsIdsCommand.java deleted file mode 100644 index f8c900d48d9..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/command/GetMeldingsIdsCommand.java +++ /dev/null @@ -1,37 +0,0 @@ -package no.nav.registre.sdforvalter.consumer.rs.tpsf.command; - -import lombok.AllArgsConstructor; -import no.nav.registre.sdforvalter.util.WebClientFilter; -import org.springframework.core.ParameterizedTypeReference; -import org.springframework.web.reactive.function.client.WebClient; -import reactor.core.publisher.Mono; -import reactor.util.retry.Retry; - -import java.time.Duration; -import java.util.List; -import java.util.concurrent.Callable; - -@AllArgsConstructor -public class GetMeldingsIdsCommand implements Callable>> { - - private static final ParameterizedTypeReference> RESPONSE_TYPE = new ParameterizedTypeReference<>() { - }; - private final Long gruppeId; - private final WebClient webClient; - private final String token; - - @Override - public Mono> call() { - return webClient.get() - .uri(builder -> - builder.path("/api/v1/endringsmelding/skd/meldinger/{gruppeId}") - .build(gruppeId) - ) - .header("Authorization", "Bearer " + token) - .retrieve() - .bodyToMono(RESPONSE_TYPE) - .doOnError(WebClientFilter::logErrorMessage) - .retryWhen(Retry.backoff(3, Duration.ofSeconds(5)) - .filter(WebClientFilter::is5xxException)); - } -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/command/PostSendSkdMeldingerTpsCommand.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/command/PostSendSkdMeldingerTpsCommand.java deleted file mode 100644 index 544ba529a1f..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/command/PostSendSkdMeldingerTpsCommand.java +++ /dev/null @@ -1,38 +0,0 @@ -package no.nav.registre.sdforvalter.consumer.rs.tpsf.command; - -import lombok.AllArgsConstructor; -import no.nav.registre.sdforvalter.consumer.rs.tpsf.request.SendToTpsRequest; -import no.nav.registre.sdforvalter.consumer.rs.tpsf.response.SkdMeldingerTilTpsRespons; -import no.nav.registre.sdforvalter.util.WebClientFilter; -import org.springframework.web.reactive.function.BodyInserters; -import org.springframework.web.reactive.function.client.WebClient; -import reactor.core.publisher.Mono; -import reactor.util.retry.Retry; - -import java.time.Duration; -import java.util.concurrent.Callable; - -@AllArgsConstructor -public class PostSendSkdMeldingerTpsCommand implements Callable> { - - private final Long gruppeId; - private final SendToTpsRequest sendToTpsRequest; - private final WebClient webClient; - private final String token; - - @Override - public Mono call() { - return webClient.post() - .uri(builder -> - builder.path("/api/v1/endringsmelding/skd/send/{gruppeId}") - .build(gruppeId) - ) - .header("Authorization", "Bearer " + token) - .body(BodyInserters.fromPublisher(Mono.just(sendToTpsRequest), SendToTpsRequest.class)) - .retrieve() - .bodyToMono(SkdMeldingerTilTpsRespons.class) - .doOnError(WebClientFilter::logErrorMessage) - .retryWhen(Retry.backoff(3, Duration.ofSeconds(5)) - .filter(WebClientFilter::is5xxException)); - } -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/request/SendToTpsRequest.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/request/SendToTpsRequest.java deleted file mode 100644 index bf5f3be7ea2..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/request/SendToTpsRequest.java +++ /dev/null @@ -1,18 +0,0 @@ -package no.nav.registre.sdforvalter.consumer.rs.tpsf.request; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -import java.util.List; - -@Getter -@Setter -@NoArgsConstructor -@AllArgsConstructor -public class SendToTpsRequest { - - private String environment; - private List ids; -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/response/SkdMeldingerTilTpsRespons.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/response/SkdMeldingerTilTpsRespons.java deleted file mode 100644 index 06985b618bd..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/response/SkdMeldingerTilTpsRespons.java +++ /dev/null @@ -1,33 +0,0 @@ -package no.nav.registre.sdforvalter.consumer.rs.tpsf.response; - -import lombok.*; - -import java.util.ArrayList; -import java.util.List; - -import static java.util.Objects.isNull; - -@Getter -@Setter -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class SkdMeldingerTilTpsRespons { - - private int antallSendte; - private int antallFeilet; - private List statusFraFeilendeMeldinger; - - - public List getStatusFraFeilendeMeldinger() { - if (isNull(statusFraFeilendeMeldinger)){ - statusFraFeilendeMeldinger = new ArrayList<>(); - } - return statusFraFeilendeMeldinger; - } - - public List getFailedStatus() { - return getStatusFraFeilendeMeldinger().parallelStream().map(StatusPaaAvspiltSkdMelding::toString).toList(); - } - -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/response/StatusPaaAvspiltSkdMelding.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/response/StatusPaaAvspiltSkdMelding.java deleted file mode 100644 index 27ca009c305..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/response/StatusPaaAvspiltSkdMelding.java +++ /dev/null @@ -1,17 +0,0 @@ -package no.nav.registre.sdforvalter.consumer.rs.tpsf.response; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@NoArgsConstructor -@AllArgsConstructor -public class StatusPaaAvspiltSkdMelding { - - private String foedselsnummer; - private Long sekvensnummer; - private String status; -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/converter/csv/TpsIdentCsvConverter.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/converter/csv/TpsIdentCsvConverter.java deleted file mode 100644 index fad843b1214..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/converter/csv/TpsIdentCsvConverter.java +++ /dev/null @@ -1,92 +0,0 @@ -package no.nav.registre.sdforvalter.converter.csv; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import no.nav.registre.sdforvalter.domain.TpsIdent; -import no.nav.testnav.libs.csvconverter.CsvConverter; -import no.nav.testnav.libs.csvconverter.CsvHeader; -import no.nav.testnav.libs.csvconverter.ObjectConverter; -import no.nav.testnav.libs.csvconverter.RowConverter; - -public class TpsIdentCsvConverter extends CsvConverter { - - private static final String LIST_SPLITT_CHARACTER = ","; - static TpsIdentCsvConverter inst; - - private TpsIdentCsvConverter() { - - } - - public static TpsIdentCsvConverter inst() { - if (inst == null) { - inst = new TpsIdentCsvConverter(); - } - return inst; - } - - private enum Headers implements CsvHeader { - FNR("FNR*"), - FIRST_NAME("Fornavn"), - LAST_NAME("Etternavn"), - ADDRESS("Adresse"), - POST_NR("Postnummer"), - CITY("Poststed"), - GRUPPE("Gruppe"), - OPPRINNELSE("Opprinnelse"), - TAGS("Tags"); - - private final String header; - - Headers(String header) { - this.header = header; - } - - @Override - public String getValue() { - return header; - } - } - - @Override - protected RowConverter getRowConverter() { - return map -> TpsIdent - .builder() - .fnr(getString(map, Headers.FNR)) - .firstName(getString(map, Headers.FIRST_NAME)) - .lastName(getString(map, Headers.LAST_NAME)) - .address(getString(map, Headers.ADDRESS)) - .postNr(getString(map, Headers.POST_NR)) - .city(getString(map, Headers.CITY)) - .gruppe(getString(map, Headers.GRUPPE)) - .opprinnelse(getString(map, Headers.OPPRINNELSE)) - .tags(getString(map, Headers.TAGS) == null - ? Collections.emptySet() - : Set.of(getString(map, Headers.TAGS).split(LIST_SPLITT_CHARACTER)) - ).build(); - } - - @Override - protected ObjectConverter getObjectConverter() { - return item -> { - Map map = new HashMap<>(); - map.put(Headers.FNR.getValue(), item.getFnr()); - map.put(Headers.FIRST_NAME.getValue(), item.getFirstName()); - map.put(Headers.LAST_NAME.getValue(), item.getLastName()); - map.put(Headers.ADDRESS.getValue(), item.getAddress()); - map.put(Headers.POST_NR.getValue(), item.getPostNr()); - map.put(Headers.CITY.getValue(), item.getCity()); - map.put(Headers.GRUPPE.getValue(), item.getGruppe()); - map.put(Headers.OPPRINNELSE.getValue(), item.getOpprinnelse()); - map.put(Headers.TAGS.getValue(), String.join(LIST_SPLITT_CHARACTER, item.getTags())); - return map; - }; - } - - @Override - protected CsvHeader[] getHeaders() { - return Headers.values(); - } -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/database/model/TpsIdentModel.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/database/model/TpsIdentModel.java deleted file mode 100644 index 2c93c052a7f..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/database/model/TpsIdentModel.java +++ /dev/null @@ -1,55 +0,0 @@ -package no.nav.registre.sdforvalter.database.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; -import lombok.extern.slf4j.Slf4j; - -import jakarta.persistence.Entity; -import jakarta.persistence.Id; -import jakarta.persistence.Table; - -import no.nav.registre.sdforvalter.domain.TpsIdent; - -@Entity -@ToString(callSuper = true) -@Getter -@Setter -@Slf4j -@Table(name = "tps_identer") -@NoArgsConstructor -@EqualsAndHashCode(callSuper = true) -public class TpsIdentModel extends FasteDataModel { - - @Id - @JsonProperty - private String fnr; - @JsonProperty("fornavn") - private String firstName; - @JsonProperty("etternavn") - private String lastName; - @JsonProperty("adresse") - private String address; - @JsonProperty("postnr") - private String postNr; - @JsonProperty("by") - private String city; - - public TpsIdentModel(TpsIdent tpsIdent, OpprinnelseModel opprinnelseModel, GruppeModel gruppeModel) { - super(gruppeModel, opprinnelseModel); - fnr = tpsIdent.getFnr(); - firstName = tpsIdent.getFirstName(); - lastName = tpsIdent.getLastName(); - address = tpsIdent.getAddress(); - postNr = tpsIdent.getPostNr(); - city = tpsIdent.getCity(); - } - - @Override - public TpsIdent toDomain() { - throw new UnsupportedOperationException("Ikke mulig å convertere til model"); - } -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/database/model/TpsIdentTagModel.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/database/model/TpsIdentTagModel.java deleted file mode 100644 index 75e8199a616..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/database/model/TpsIdentTagModel.java +++ /dev/null @@ -1,41 +0,0 @@ -package no.nav.registre.sdforvalter.database.model; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import org.springframework.data.jpa.domain.support.AuditingEntityListener; - -import jakarta.persistence.Column; -import jakarta.persistence.Entity; -import jakarta.persistence.EntityListeners; -import jakarta.persistence.FetchType; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.ManyToOne; -import jakarta.persistence.Table; - -@Entity -@Table(name = "TPS_IDENTER_TAGS") -@Builder -@Getter -@EntityListeners(AuditingEntityListener.class) -@AllArgsConstructor -@NoArgsConstructor -public class TpsIdentTagModel extends AuditModel { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "ID") - private Long id; - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "IDENT") - private TpsIdentModel ident; - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "TAG") - private TagModel tag; -} \ No newline at end of file diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/database/repository/TpsIdentTagRepository.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/database/repository/TpsIdentTagRepository.java deleted file mode 100644 index 8c29d89ccfa..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/database/repository/TpsIdentTagRepository.java +++ /dev/null @@ -1,17 +0,0 @@ -package no.nav.registre.sdforvalter.database.repository; - -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.CrudRepository; - -import java.util.List; -import java.util.Optional; - -import no.nav.registre.sdforvalter.database.model.TpsIdentTagModel; - -public interface TpsIdentTagRepository extends CrudRepository { - @Query(value = "from TpsIdentTagModel m where m.ident.fnr = ?1 and m.tag.tag = ?2") - Optional findBy(String ident, String tag); - - @Query(value = "from TpsIdentTagModel m where m.ident.fnr = ?1") - List findAllByIdent(String ident); -} \ No newline at end of file diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/database/repository/TpsIdenterRepository.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/database/repository/TpsIdenterRepository.java deleted file mode 100644 index 72f41a1464b..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/database/repository/TpsIdenterRepository.java +++ /dev/null @@ -1,16 +0,0 @@ -package no.nav.registre.sdforvalter.database.repository; - -import org.springframework.data.repository.CrudRepository; -import org.springframework.stereotype.Repository; - -import java.util.List; - -import no.nav.registre.sdforvalter.database.model.GruppeModel; -import no.nav.registre.sdforvalter.database.model.TpsIdentModel; - -@Repository -public interface TpsIdenterRepository extends CrudRepository { - List findByGruppeModel(GruppeModel gruppeModel); - - TpsIdentModel findByFnr(String fnr); -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/domain/TpsIdent.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/domain/TpsIdent.java deleted file mode 100644 index aa2d5bcb93c..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/domain/TpsIdent.java +++ /dev/null @@ -1,96 +0,0 @@ -package no.nav.registre.sdforvalter.domain; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.Value; - -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - -import no.nav.registre.sdforvalter.database.model.TagModel; -import no.nav.registre.sdforvalter.database.model.TpsIdentModel; -import no.nav.testnav.libs.dto.person.v1.AdresseDTO; -import no.nav.testnav.libs.dto.person.v1.PersonDTO; - -@Value -@NoArgsConstructor(force = true) -@AllArgsConstructor -@JsonIgnoreProperties(ignoreUnknown = true) -@EqualsAndHashCode(callSuper = true) -public class TpsIdent extends FasteData { - - @JsonProperty - private final String fnr; - @JsonProperty("fornavn") - private final String firstName; - @JsonProperty("etternavn") - private final String lastName; - @JsonProperty("adresse") - private final String address; - @JsonProperty("postnr") - private final String postNr; - @JsonProperty("by") - private final String city; - @JsonProperty - private final Set tags; - - public TpsIdent(TpsIdentModel model, List tagModels) { - super(model); - fnr = model.getFnr(); - firstName = model.getFirstName(); - lastName = model.getLastName(); - address = model.getAddress(); - postNr = model.getPostNr(); - city = model.getCity(); - tags = tagModels.stream().map(TagModel::getTag).collect(Collectors.toSet()); - } - - @Builder - public TpsIdent(String fnr, String firstName, String lastName, String address, String postNr, String city, String gruppe, String opprinnelse, Set tags) { - super(gruppe, opprinnelse); - this.fnr = fnr; - this.firstName = firstName; - this.lastName = lastName; - this.address = address; - this.postNr = postNr; - this.city = city; - this.tags = tags; - } - - public PersonDTO toDTO() { - return PersonDTO.builder() - .ident(fnr) - .fornavn(firstName) - .etternavn(lastName) - .adresse(address != null ? new AdresseDTO(address, postNr, city, null) : null) - .build(); - } - - - public no.nav.testnav.libs.dto.personservice.v1.AdresseDTO toAdresseDTO(){ - return no.nav.testnav.libs.dto.personservice.v1.AdresseDTO - .builder() - .gatenavn(address) - .postnummer(postNr) - .poststed(city) - .build(); - } - - public no.nav.testnav.libs.dto.personservice.v1.PersonDTO toDTOV2(){ - return no.nav.testnav.libs.dto.personservice.v1.PersonDTO - .builder() - .ident(fnr) - .fornavn(firstName) - .etternavn(lastName) - .opprinnelse(getOpprinnelse()) - .tags(tags) - .adresse(toAdresseDTO()) - .build(); - } - -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/domain/TpsIdentListe.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/domain/TpsIdentListe.java deleted file mode 100644 index 0ccca801681..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/domain/TpsIdentListe.java +++ /dev/null @@ -1,14 +0,0 @@ -package no.nav.registre.sdforvalter.domain; - -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -import java.util.List; - -@NoArgsConstructor -@EqualsAndHashCode(callSuper = true) -public final class TpsIdentListe extends FasteDataListe { - public TpsIdentListe(List liste) { - super(liste); - } -} \ No newline at end of file diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/domain/person/Person.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/domain/person/Person.java index 49b15bbe17c..61173660e74 100644 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/domain/person/Person.java +++ b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/domain/person/Person.java @@ -3,9 +3,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import lombok.NoArgsConstructor; import lombok.Value; - -import no.nav.registre.sdforvalter.domain.TpsIdent; -import no.nav.testnav.libs.dto.person.v1.AdresseDTO; import no.nav.testnav.libs.dto.person.v1.PersonDTO; @@ -25,15 +22,6 @@ public class Person { @JsonProperty("by") String city; - public Person(TpsIdent ident) { - fnr = ident.getFnr(); - firstName = ident.getFirstName(); - lastName = ident.getLastName(); - address = ident.getAddress(); - postNr = ident.getPostNr(); - city = ident.getCity(); - } - public Person(PersonDTO dto) { fnr = dto.getIdent(); firstName = dto.getFornavn(); @@ -42,13 +30,4 @@ public Person(PersonDTO dto) { postNr = dto.getAdresse() != null ? dto.getAdresse().getPostnummer() : null; city = dto.getAdresse() != null ? dto.getAdresse().getPoststed() : null; } - - public PersonDTO toDTO () { - return PersonDTO.builder() - .ident(fnr) - .fornavn(firstName) - .etternavn(lastName) - .adresse(address != null ? new AdresseDTO(address, postNr, city, null) : null) - .build(); - } } diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/provider/rs/FileController.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/provider/rs/FileController.java index 5de4ee765e5..d7575067833 100644 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/provider/rs/FileController.java +++ b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/provider/rs/FileController.java @@ -1,18 +1,13 @@ package no.nav.registre.sdforvalter.provider.rs; import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; import no.nav.registre.sdforvalter.adapter.EregAdapter; -import no.nav.registre.sdforvalter.adapter.TpsIdenterAdapter; import no.nav.registre.sdforvalter.converter.csv.EregCsvConverter; -import no.nav.registre.sdforvalter.converter.csv.TpsIdentCsvConverter; import no.nav.registre.sdforvalter.domain.Ereg; import no.nav.registre.sdforvalter.domain.EregListe; -import no.nav.registre.sdforvalter.domain.TpsIdent; -import no.nav.registre.sdforvalter.domain.TpsIdentListe; -import no.nav.registre.sdforvalter.service.IdentService; import no.nav.testnav.libs.dto.organisasjonfastedataservice.v1.Gruppe; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; @@ -24,17 +19,11 @@ import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; -import jakarta.servlet.http.HttpServletResponse; -import java.io.BufferedReader; import java.io.IOException; -import java.io.InputStream; import java.io.InputStreamReader; -import java.io.Reader; -import java.io.StringReader; import java.nio.charset.StandardCharsets; import java.time.LocalDateTime; import java.util.List; -import java.util.stream.Collectors; @RestController @RequestMapping("/api/v1/faste-data/file") @@ -46,15 +35,13 @@ public class FileController { private final EregAdapter eregAdapter; - private final TpsIdenterAdapter tpsIdenterAdapter; - private final IdentService identService; @Operation(summary = "Hent organisasjoner fra Team Dollys database") @GetMapping("/ereg") public void exportEreg(@RequestParam(name = "gruppe", required = false) Gruppe gruppe, HttpServletResponse response) throws IOException { response.setContentType("text/csv"); response.setCharacterEncoding(StandardCharsets.UTF_8.toString()); - response.setHeader("Content-Disposition", "attachment; filename=ereg-" + LocalDateTime.now().toString() + ".csv"); + response.setHeader("Content-Disposition", "attachment; filename=ereg-" + LocalDateTime.now() + ".csv"); EregListe eregListe = eregAdapter.fetchBy(gruppe != null ? gruppe.name() : null); EregCsvConverter.inst().write(response.getWriter(), eregListe.getListe()); @@ -67,36 +54,4 @@ public ResponseEntity importEreg(@RequestParam("file") MultipartFile eregAdapter.save(new EregListe(list)); return ResponseEntity.ok().build(); } - - @Operation(summary = "Hent personer fra Team Dollys database") - @GetMapping("/tpsIdenter") - public void exportTpsIdenter(@RequestParam(name = "gruppe", required = false) Gruppe gruppe, HttpServletResponse response) throws IOException { - response.setContentType("text/csv"); - response.setCharacterEncoding(StandardCharsets.UTF_8.toString()); - response.setHeader("Content-Disposition", "attachment; filename=tpsIdent-" + LocalDateTime.now().toString() + ".csv"); - - TpsIdentListe tpsIdentListe = tpsIdenterAdapter.fetchBy(gruppe.name()); - TpsIdentCsvConverter.inst().write(response.getWriter(), tpsIdentListe.getListe()); - } - - @Operation(summary = "Legg til personer i Team Dollys database") - @PostMapping(path = "/tpsIdenter", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) - public ResponseEntity importTpsIdenter(@RequestParam("file") MultipartFile file, - @Parameter(description = "Hvis true settes tilfeldig navn på personer uten fornavn og etternavn") - @RequestParam(name = "Generer manglende navn", defaultValue = "false") Boolean genererManglendeNavn) throws IOException { - List list = TpsIdentCsvConverter.inst().read(cleanInput(file.getInputStream())); - - identService.save(new TpsIdentListe(list), genererManglendeNavn); - return ResponseEntity.ok().build(); - } - - private Reader cleanInput(InputStream inputStream) { - String character = "\uFEFF"; - return new StringReader( - new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)) - .lines() - .collect(Collectors.joining("\n")).replace(character, "") - ); - } - } \ No newline at end of file diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/provider/rs/OrkestreringsController.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/provider/rs/OrkestreringController.java similarity index 72% rename from apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/provider/rs/OrkestreringsController.java rename to apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/provider/rs/OrkestreringController.java index e518ff7bba1..09176202cc0 100644 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/provider/rs/OrkestreringsController.java +++ b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/provider/rs/OrkestreringController.java @@ -4,53 +4,36 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import no.nav.registre.sdforvalter.adapter.TpsIdenterAdapter; -import no.nav.registre.sdforvalter.consumer.rs.person.PersonConsumer; -import no.nav.registre.sdforvalter.domain.TpsIdentListe; import no.nav.registre.sdforvalter.provider.rs.dto.Orgnummer; import no.nav.registre.sdforvalter.service.EnvironmentInitializationService; import no.nav.testnav.libs.dto.organisasjonfastedataservice.v1.Gruppe; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PathVariable; +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; @Slf4j @RestController @RequiredArgsConstructor @RequestMapping("/api/v1/orkestrering") @Tag( - name = "OrkestreingController", + name = "OrkestreringController", description = "Initialiserer ulike miljøer med statiske data." ) -public class OrkestreringsController { +public class OrkestreringController { private final EnvironmentInitializationService environmentInitializationService; - private final TpsIdenterAdapter tpsIdenterAdapter; - private final PersonConsumer personConsumer; @PostMapping(value = "/{miljoe}") @Operation( - description = "Orkestrerer testdata i TPS/PDL, testnorge-tp, KRR, AAREG, EREG." + description = "Orkestrerer testdata i KRR, AAREG, EREG." ) public void initializeInEnvironment(@PathVariable String miljoe, @RequestParam(name = "gruppe", required = false) Gruppe gruppe) { environmentInitializationService.initializeEnvironmentWithStaticData(miljoe, gruppe != null ? gruppe.name() : null); } - @PostMapping(value = "/tps/{miljoe}") - @Operation( - description = "Identisk med POST /{miljoe}." - ) - public void initializeTps(@PathVariable String miljoe, @RequestParam(name = "gruppe", required = false) Gruppe gruppe) { - environmentInitializationService.initializeIdent(miljoe, gruppe != null ? gruppe.name() : null); - } - - @PostMapping(value = "/pdl") - @Operation( - description = "Oppretter personer i TPS basert på angitt gruppe." - ) - public void initializePdlGruppe(@RequestParam(name = "gruppe") Gruppe gruppe) { - TpsIdentListe liste = tpsIdenterAdapter.fetchBy(gruppe.name()); - personConsumer.opprettPersoner(liste); - } - @PostMapping(value = "/aareg/{miljoe}") @Operation( description = "Oppretter arbeidsforhold i AAREG basert på angitt gruppe." diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/provider/rs/PersonController.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/provider/rs/PersonController.java deleted file mode 100644 index 19fdbc97dd8..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/provider/rs/PersonController.java +++ /dev/null @@ -1,60 +0,0 @@ -package no.nav.registre.sdforvalter.provider.rs; - -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import no.nav.registre.sdforvalter.domain.person.Person; -import no.nav.registre.sdforvalter.domain.person.PersonStatusMap; -import no.nav.registre.sdforvalter.service.PersonService; -import no.nav.testnav.libs.dto.organisasjonfastedataservice.v1.Gruppe; -import no.nav.testnav.libs.dto.person.v1.PersonDTO; -import org.springframework.http.HttpStatus; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.server.ResponseStatusException; - -import java.util.List; - -@Slf4j -@RestController -@RequiredArgsConstructor -@RequestMapping("/api/v1/person") -@Tag( - name = "PersonController", - description = "Henter ulik personinformasjon basert på identer i database." -) -public class PersonController { - - private final PersonService personService; - - @GetMapping - @Operation( - description = "Hent liste over personer fra tabell TPS_IDENTER basert på angitt gruppe." - ) - public List getPersonByGruppe( - @RequestParam(value = "gruppe") Gruppe gruppe - ) { - return personService.getPerson(gruppe.name()); - } - - @GetMapping("/pdl/status") - @Operation( - description = "Hent liste over status per fødselsnummer basert på angitt gruppe. Personer hentes fra tabell TPS_IDENTER, status på disse fra tjeneste testnav-person-service." - ) - public PersonStatusMap statusByGruppe( - @RequestParam(value = "equal", required = false) Boolean equal, - @RequestParam(value = "gruppe") Gruppe gruppe - ) { - return personService.getStatusMap(gruppe.name(), equal); - } - - @Operation(summary = "Hent person fra Team Dollys database (faste data)") - @GetMapping("/{ident}") - public PersonDTO getPersonByIdent(@PathVariable String ident) { - var person = personService.getPersonByIdent(ident); - if (person == null) { - throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Fant ikke person med ident " + ident); - } - return person.toDTO(); - } -} \ No newline at end of file diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/provider/rs/PersonMigreringController.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/provider/rs/PersonMigreringController.java deleted file mode 100644 index cffbc896744..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/provider/rs/PersonMigreringController.java +++ /dev/null @@ -1,33 +0,0 @@ -package no.nav.registre.sdforvalter.provider.rs; - -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; -import no.nav.registre.sdforvalter.adapter.TpsIdenterAdapter; -import no.nav.registre.sdforvalter.consumer.rs.person.PersonFasteDataConsumer; -import no.nav.testnav.libs.dto.organisasjonfastedataservice.v1.Gruppe; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@RequestMapping("/api/v1/person/migrering") -@RequiredArgsConstructor -@Tag( - name = "PersonMigreringController", - description = "Oppretter personer i testnav-person-faste-data-service." -) -public class PersonMigreringController { - private final TpsIdenterAdapter tpsIdenterAdapter; - private final PersonFasteDataConsumer fasteDataConsumer; - - @PostMapping - @Operation( - description = "Oppretter personer i tjenesten testnav-person-faste-data-service basert på identer fra tabell TPS_IDENTER for angitt gruppe." - ) - public void opprett(@RequestParam(required = false) Gruppe gruppe) { - var eregListe = gruppe == null ? tpsIdenterAdapter.fetchAll() : tpsIdenterAdapter.fetchBy(gruppe.name()); - fasteDataConsumer.opprett(eregListe); - } -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/provider/rs/v1/StaticDataControllerV1.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/provider/rs/v1/StaticDataControllerV1.java index 2fd361af13d..b835b43768e 100644 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/provider/rs/v1/StaticDataControllerV1.java +++ b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/provider/rs/v1/StaticDataControllerV1.java @@ -1,22 +1,23 @@ package no.nav.registre.sdforvalter.provider.rs.v1; import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import no.nav.registre.sdforvalter.adapter.AaregAdapter; import no.nav.registre.sdforvalter.adapter.EregAdapter; import no.nav.registre.sdforvalter.adapter.KrrAdapter; -import no.nav.registre.sdforvalter.adapter.TpsIdenterAdapter; import no.nav.registre.sdforvalter.domain.AaregListe; import no.nav.registre.sdforvalter.domain.EregListe; import no.nav.registre.sdforvalter.domain.KrrListe; -import no.nav.registre.sdforvalter.domain.TpsIdentListe; -import no.nav.registre.sdforvalter.service.IdentService; import org.springframework.http.CacheControl; import org.springframework.http.ResponseEntity; -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 java.util.concurrent.TimeUnit; @@ -26,32 +27,16 @@ @RequestMapping("/api/v1/faste-data") @Tag( name = "StaticDataControllerV1", - description = "Operasjoner på statiske TPS-/AAREG-/KRR- og EREG-data lagret i database." + description = "Operasjoner på statiske AAREG-/KRR- og EREG-data lagret i database." ) public class StaticDataControllerV1 { private static final int CACHE_HOURS = 24; - private final IdentService identService; - private final TpsIdenterAdapter tpsIdenterAdapter; private final AaregAdapter aaregAdapter; private final KrrAdapter krrAdapter; private final EregAdapter eregAdapter; - @GetMapping("/tps") - @Operation(description = "Henter TPS-identer fra tabell TPS_IDENTER.") - public TpsIdentListe getTps(@RequestParam(name = "gruppe", required = false) String gruppe) { - return tpsIdenterAdapter.fetchBy(gruppe); - } - - @PostMapping("/tps") - @Operation(description = "Lagrer TPS-identer i tabell TPS_IDENTER.") - public TpsIdentListe createTps(@RequestBody TpsIdentListe liste, - @Parameter(description = "Hvis true settes tilfeldig navn på personer uten fornavn og etternavn") - @RequestParam(name = "genererManglendeNavn", required = false, defaultValue = "false") Boolean genererManglendeNavn) { - return identService.save(liste, genererManglendeNavn); - } - @GetMapping("/aareg") @Operation(description = "Henter AAREG-data fra tabell AAREG.") public AaregListe getAareg(@RequestParam(name = "gruppe", required = false) String gruppe) { diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/service/EnvironmentInitializationService.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/service/EnvironmentInitializationService.java index 84aab5ff62e..9d106b8b33e 100644 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/service/EnvironmentInitializationService.java +++ b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/service/EnvironmentInitializationService.java @@ -2,17 +2,16 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.util.List; - import no.nav.registre.sdforvalter.adapter.AaregAdapter; import no.nav.registre.sdforvalter.adapter.EregAdapter; import no.nav.registre.sdforvalter.adapter.KrrAdapter; -import no.nav.registre.sdforvalter.consumer.rs.organisasjon.OrganisasjonMottakServiceConsumer; import no.nav.registre.sdforvalter.consumer.rs.krr.KrrConsumer; +import no.nav.registre.sdforvalter.consumer.rs.organisasjon.OrganisasjonMottakServiceConsumer; import no.nav.registre.sdforvalter.domain.EregListe; import no.nav.registre.sdforvalter.domain.status.ereg.OrganisasjonStatusMap; +import org.springframework.stereotype.Service; + +import java.util.List; @Slf4j @Service @@ -27,25 +26,15 @@ public class EnvironmentInitializationService { private final EregAdapter eregAdapter; private final KrrAdapter krrAdapter; private final AaregAdapter aaregAdapter; - private final IdentService identService; - public void initializeEnvironmentWithStaticData(String environment, String gruppe) { log.info("Start init of all static data sets..."); - initializeIdent(environment, gruppe); initializeKrr(gruppe); initializeAareg(environment, gruppe); initializeEreg(environment, gruppe); log.info("Completed init of all static data sets."); } - - public void initializeIdent(String environment, String gruppe) { - log.info("Start init av identer..."); - identService.send(environment, gruppe); - log.info("Init av identer er ferdig."); - } - public void initializeAareg(String environment, String gruppe) { log.info("Start init av Aareg..."); aaregService.sendArbeidsforhold(aaregAdapter.fetchBy(gruppe), environment); diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/service/IdentService.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/service/IdentService.java deleted file mode 100644 index 66121a51a38..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/service/IdentService.java +++ /dev/null @@ -1,113 +0,0 @@ -package no.nav.registre.sdforvalter.service; - -import lombok.extern.slf4j.Slf4j; -import no.nav.registre.sdforvalter.adapter.TpsIdenterAdapter; -import no.nav.registre.sdforvalter.consumer.rs.navn.GenererNavnConsumer; -import no.nav.registre.sdforvalter.consumer.rs.hodejegeren.HodejegerenConsumer; -import no.nav.registre.sdforvalter.consumer.rs.person.PersonConsumer; -import no.nav.registre.sdforvalter.consumer.rs.tp.TpConsumer; -import no.nav.registre.sdforvalter.consumer.rs.tpsf.TpsfConsumer; -import no.nav.registre.sdforvalter.domain.TpsIdent; -import no.nav.registre.sdforvalter.domain.TpsIdentListe; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - -@Service -@Slf4j -public class IdentService { - private final TpsIdenterAdapter tpsIdenterAdapter; - private final HodejegerenConsumer hodejegerenConsumer; - private final TpConsumer tpConsumer; - private final GenererNavnConsumer genererNavnConsumer; - private final PersonConsumer personConsumer; - private final TpsfConsumer tpsfConsumer; - private final Long staticDataPlaygroup; - - public IdentService( - TpsIdenterAdapter tpsIdenterAdapter, - HodejegerenConsumer hodejegerenConsumer, - GenererNavnConsumer genererNavnConsumer, - PersonConsumer personConsumer, - TpConsumer tpConsumer, - TpsfConsumer tpsfConsumer, - @Value("${tps.statisk.avspillergruppeId}") Long staticDataPlaygroup - ) { - this.tpsIdenterAdapter = tpsIdenterAdapter; - this.hodejegerenConsumer = hodejegerenConsumer; - this.tpConsumer = tpConsumer; - this.genererNavnConsumer = genererNavnConsumer; - this.personConsumer = personConsumer; - this.tpsfConsumer = tpsfConsumer; - this.staticDataPlaygroup = staticDataPlaygroup; - } - - public void send(String environment, String gruppe) { - TpsIdentListe liste = tpsIdenterAdapter.fetchBy(gruppe); - var exisistingFnrs = hodejegerenConsumer.getPlaygroupFnrs(staticDataPlaygroup); - var identer = new TpsIdentListe(liste.stream() - .filter(item -> !exisistingFnrs.contains(item.getFnr())) - .toList() - ); - sendTilTps(staticDataPlaygroup, environment); - - //Person får ikke aktør-id automatisk ved opprettelse i TPS lenger. Må opprettes i PDL også for å få aktør-id - opprettPersonerIPdl(identer); - - /* - Order of method calls are important to ensure that the values exist in the databases. - Some methods may fail if at the very least TPS-ident (SKD) have not been created. - TP and SAM are also critical databases for the fag applications - */ - var livingFnrs = hodejegerenConsumer.getLivingFnrs(staticDataPlaygroup, environment); - tpConsumer.send(livingFnrs, environment); - } - - private void sendTilTps(Long playgroup, String environment) { - tpsfConsumer.sendTilTps(playgroup, environment).subscribe(response -> { - if (isNull(response) || response.getAntallFeilet() != 0) { - log.warn("Fikk ikke opprettet alle identene i TPS, burde bli manuelt sjekket for overlapp. " + - "Kan også være mulig at man prøver å initialisere et miljø som er allerede initialisert"); - } - if (nonNull(response)) { - response.getFailedStatus().forEach(s -> log.error("Status på feilende melding: {}", s)); - } - }); - } - - public void opprettPersonerIPdl(TpsIdentListe tpsIdentListe) { - try { - personConsumer.opprettPersoner(tpsIdentListe); - } catch (Exception e) { - log.info("En eller flere personer ble ikke opprettet i PDL, og fikk dermed ikke aktør-id"); - } - } - - public TpsIdentListe save(TpsIdentListe liste, Boolean genererManglendeNavn) { - var tpsIdentListe = genererManglendeNavn ? leggTilNavn(liste) : liste; - - return tpsIdenterAdapter.save(tpsIdentListe); - } - - private TpsIdentListe leggTilNavn(TpsIdentListe liste) { - var tpsIdentListe = liste.stream().map(ident -> { - if (ident.getLastName() == null || ident.getFirstName() == null) { - var navn = genererNavnConsumer.genereNavn(); - return new TpsIdent(ident.getFnr(), - navn.getAdjektiv(), - navn.getSubstantiv(), - ident.getAddress(), - ident.getPostNr(), - ident.getCity(), - ident.getGruppe(), - ident.getOpprinnelse(), - ident.getTags()); - } else { - return ident; - } - }).toList(); - return new TpsIdentListe(tpsIdentListe); - } -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/service/PersonService.java b/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/service/PersonService.java deleted file mode 100644 index 0dc3848a3f7..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/main/java/no/nav/registre/sdforvalter/service/PersonService.java +++ /dev/null @@ -1,52 +0,0 @@ -package no.nav.registre.sdforvalter.service; - -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.stream.Collectors; - -import no.nav.registre.sdforvalter.adapter.TpsIdenterAdapter; -import no.nav.registre.sdforvalter.consumer.rs.person.PersonConsumer; -import no.nav.registre.sdforvalter.domain.TpsIdent; -import no.nav.registre.sdforvalter.domain.TpsIdentListe; -import no.nav.registre.sdforvalter.domain.person.Person; -import no.nav.registre.sdforvalter.domain.person.PersonStatus; -import no.nav.registre.sdforvalter.domain.person.PersonStatusMap; - -@Service -@RequiredArgsConstructor -public class PersonService { - private final PersonConsumer personConsumer; - private final TpsIdenterAdapter tpsIdenterAdapter; - - public PersonStatusMap getStatusMap(String gruppe, Boolean equal) { - TpsIdentListe tpsIdentListe = tpsIdenterAdapter.fetchBy(gruppe); - Set identer = tpsIdentListe.stream().map(TpsIdent::getFnr).collect(Collectors.toSet()); - Map personMap = personConsumer - .hentPersoner(identer) - .stream() - .filter(Objects::nonNull) - .collect(Collectors.toMap(Person::getFnr, person -> person)); - - return new PersonStatusMap( - tpsIdentListe - .stream() - .map(ident -> new PersonStatus(new Person(ident), personMap.get(ident.getFnr()))) - .filter(personStatus -> equal == null || personStatus.isEqual() == equal) - .toList() - ); - } - - public List getPerson(String gruppe) { - TpsIdentListe tpsIdentListe = tpsIdenterAdapter.fetchBy(gruppe); - return tpsIdentListe.stream().map(Person::new).toList(); - } - - public TpsIdent getPersonByIdent(String ident) { - return tpsIdenterAdapter.fetchByIdent(ident); - } -} diff --git a/apps/testnorge-statisk-data-forvalter/src/main/resources/application-local.yml b/apps/testnorge-statisk-data-forvalter/src/main/resources/application-local.yml index 48233b76ecf..4e356d4f598 100644 --- a/apps/testnorge-statisk-data-forvalter/src/main/resources/application-local.yml +++ b/apps/testnorge-statisk-data-forvalter/src/main/resources/application-local.yml @@ -18,24 +18,11 @@ spring: ereg.api: dummy -tps: - statisk: - avspillergruppeId: 1 - VAULT_URL: dummy -server: - port: 4390 - consumers: testnav-bruker-service: name: testnav-bruker-service-dev url: https://testnav-bruker-service-dev.intern.dev.nav.no - tps-forvalteren-proxy: - url: https://tps-forvalteren-proxy.dev-fss-pub.nais.io - testnorge-hodejegeren: - url: https://testnorge-hodejegeren.intern.dev.nav.no - testnorge-tp: - url: https://testnorge-tp.intern.dev.nav.no synthdata-aareg: url: https://nais-synthdata-aareg.dev.intern.nav.no \ No newline at end of file diff --git a/apps/testnorge-statisk-data-forvalter/src/main/resources/application.yml b/apps/testnorge-statisk-data-forvalter/src/main/resources/application.yml index da286bffcbd..c5394d92d07 100644 --- a/apps/testnorge-statisk-data-forvalter/src/main/resources/application.yml +++ b/apps/testnorge-statisk-data-forvalter/src/main/resources/application.yml @@ -38,12 +38,6 @@ kafka: groupid: organisasjon-forvalter-v1 consumers: - person: - url: https://testnav-person-service.intern.dev.nav.no - threads: 5 - cluster: dev-gcp - namespace: dolly - name: testnav-person-service generer-navn-service: url: https://generer-navn-service.intern.dev.nav.no cluster: dev-gcp @@ -65,21 +59,6 @@ consumers: name: testnav-person-faste-data-service cluster: dev-gcp namespace: dolly - tps-forvalteren-proxy: - url: http://tps-forvalteren-proxy.dolly.svc.nais.local - cluster: dev-fss - namespace: dolly - name: tps-forvalteren-proxy - testnorge-hodejegeren: - url: http://testnorge-hodejegeren.dolly.svc.nais.local - name: testnorge-hodejegeren - cluster: dev-fss - namespace: dolly - testnorge-tp: - url: http://testnorge-tp.dolly.svc.nais.local - name: testnorge-tp - cluster: dev-fss - namespace: dolly krr-stub: url: https://krr-stub-%s.dev.intern.nav.no/api synthdata-aareg: diff --git a/apps/testnorge-statisk-data-forvalter/src/test/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/TpsfConsumerTest.java b/apps/testnorge-statisk-data-forvalter/src/test/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/TpsfConsumerTest.java deleted file mode 100644 index 3b197209171..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/test/java/no/nav/registre/sdforvalter/consumer/rs/tpsf/TpsfConsumerTest.java +++ /dev/null @@ -1,106 +0,0 @@ -package no.nav.registre.sdforvalter.consumer.rs.tpsf; - -import no.nav.testnav.libs.securitycore.domain.AccessToken; -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentMatchers; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringRunner; -import reactor.core.publisher.Mono; - -import java.util.ArrayList; -import java.util.List; - -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; -import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson; -import static com.github.tomakehurst.wiremock.client.WireMock.ok; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.when; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@AutoConfigureWireMock(port = 0) -@TestPropertySource(locations = "classpath:application-test.yml") -@ActiveProfiles("test") -public class TpsfConsumerTest { - - @MockBean - private TokenExchange tokenService; - - @Autowired - private TpsfConsumer tpsfConsumer; - - private final long avspillergruppeId = 10L; - private final String environment = "t9"; - private List ids; - private int expectedAntallSendte; - private int expectedAntallFeilet; - private String expectedFoedselnummer; - private Long expectedSekvensnummer; - private String expectedStatus; - - @Before - public void before() { - when(tokenService.exchange(ArgumentMatchers.any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); - } - - @Test - public void shouldSendSkdMeldingTilTpsf() { - ids = new ArrayList<>(); - ids.add(123L); - ids.add(321L); - - expectedAntallSendte = 1; - expectedAntallFeilet = 0; - expectedFoedselnummer = "01010101010"; - expectedSekvensnummer = 10L; - expectedStatus = "ok"; - - stubTpsfConsumerSendSkdMelding(); - stubTpsfGetMeldingsIder(); - - var response = tpsfConsumer.sendTilTps(avspillergruppeId, environment).block(); - - assertThat(response).isNotNull(); - assertThat(expectedAntallSendte).isEqualTo(response.getAntallSendte()); - assertThat(expectedAntallFeilet).isEqualTo(response.getAntallFeilet()); - - assertThat(expectedFoedselnummer).isEqualTo(response.getStatusFraFeilendeMeldinger().get(0).getFoedselsnummer()); - assertThat(expectedSekvensnummer).isEqualTo(response.getStatusFraFeilendeMeldinger().get(0).getSekvensnummer()); - assertThat(expectedStatus).isEqualTo(response.getStatusFraFeilendeMeldinger().get(0).getStatus()); - } - - - private void stubTpsfConsumerSendSkdMelding() { - stubFor(post(urlPathEqualTo("/tpsf/api/v1/endringsmelding/skd/send/" + avspillergruppeId)) - .withRequestBody(equalToJson( - "{\"environment\":\"" + environment - + "\",\"ids\":[" + ids.get(0) + ", " + ids.get(1) + "]}")) - .willReturn(ok() - .withHeader("content-type", "application/json") - .withBody("{\"antallSendte\": \"" + expectedAntallSendte - + "\", \"antallFeilet\": \"" + expectedAntallFeilet - + "\", \"statusFraFeilendeMeldinger\": [{\"foedselsnummer\": \"" + expectedFoedselnummer - + "\", \"sekvensnummer\": " + expectedSekvensnummer - + ", \"status\": \"" + expectedStatus + "\"}]}"))); - } - - private void stubTpsfGetMeldingsIder() { - stubFor(get(urlPathEqualTo("/tpsf/api/v1/endringsmelding/skd/meldinger/" + avspillergruppeId)) - .willReturn(ok() - .withHeader("content-type", "application/json") - .withBody("[" + ids.get(0) + ", " + ids.get(1) + "]"))); - } - -} diff --git a/apps/testnorge-statisk-data-forvalter/src/test/java/no/nav/registre/sdforvalter/provider/rs/FileControllerIntegrationTest.java b/apps/testnorge-statisk-data-forvalter/src/test/java/no/nav/registre/sdforvalter/provider/rs/FileControllerIntegrationTest.java deleted file mode 100644 index c352d42c142..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/test/java/no/nav/registre/sdforvalter/provider/rs/FileControllerIntegrationTest.java +++ /dev/null @@ -1,147 +0,0 @@ -package no.nav.registre.sdforvalter.provider.rs; - -import no.nav.registre.sdforvalter.database.model.GruppeModel; -import no.nav.registre.sdforvalter.database.model.OpprinnelseModel; -import no.nav.registre.sdforvalter.database.model.TpsIdentModel; -import no.nav.registre.sdforvalter.database.repository.*; -import no.nav.registre.sdforvalter.domain.TpsIdent; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.junit.jupiter.MockitoExtension; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; -import org.springframework.test.context.TestPropertySource; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; -import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; - -import java.util.List; -import java.util.Set; - -import static com.github.tomakehurst.wiremock.client.WireMock.reset; -import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.jwt; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -@ExtendWith(MockitoExtension.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@AutoConfigureWireMock(port = 0) -@AutoConfigureMockMvc -@TestPropertySource( - locations = "classpath:application-test.yml" -) -class FileControllerIntegrationTest { - - @Autowired - private MockMvc mvc; - - @Autowired - private TpsIdenterRepository tpsIdenterRepository; - @Autowired - private GruppeRepository gruppeRepository; - @Autowired - private OpprinnelseRepository opprinnelseRepository; - @Autowired - private TagRepository tagRepository; - @Autowired - private EregTagRepository eregTagRepository; - @Autowired - private TpsIdentTagRepository tpsIdentTagRepository; - - @BeforeEach - public void setup() { - GruppeModel gruppeModel = new GruppeModel(null, "Gruppen", "Gruppenbeskrivelse"); - gruppeRepository.save(gruppeModel); - - OpprinnelseModel opprinnelseModel = new OpprinnelseModel(null, "Test"); - opprinnelseRepository.save(opprinnelseModel); - } - - public void assertListOfPersonsFromCsvIsSavedInDatabase(List expectedTpsIdenterListe, String csvInnhold) throws Exception { - - MockHttpServletRequestBuilder builder = MockMvcRequestBuilders - .multipart("/api/v1/faste-data/file/tpsIdenter") - .file("file", csvInnhold.getBytes()) - .with(jwt()) - .characterEncoding("UTF_8"); - - mvc.perform(builder).andExpect(status().isOk()); - - assertThat(tpsIdenterRepository.findAll()) - .containsAll(expectedTpsIdenterListe); - - } - - @AfterEach - public void cleanUp() { - reset(); - eregTagRepository.deleteAll(); - tpsIdentTagRepository.deleteAll(); - tagRepository.deleteAll(); - tpsIdenterRepository.deleteAll(); - opprinnelseRepository.deleteAll(); - gruppeRepository.deleteAll(); - } - - @Test - void should_save_one_ident_from_csv_to_tps_ident_database() throws Exception { - String csvInnhold = "FNR*;Fornavn;Etternavn;Adresse;Postnummer;Poststed;Gruppe;Opprinnelse;Tags\n" + - "12345678912;Dolly;Dollesen;Dollygata 2;9999;Dollyville;Gruppen;Test;OTP"; - - TpsIdent expectedTpsPerson = TpsIdent.builder() - .fnr("12345678912") - .firstName("Dolly") - .lastName("Dollesen") - .address("Dollygata 2") - .postNr("9999") - .city("Dollyville") - .tags(Set.of("OTP")) - .build(); - List expectedTpsIdenterListe = List.of(new TpsIdentModel( - expectedTpsPerson, - new OpprinnelseModel(null, "Test"), - new GruppeModel(null, "Gruppen", "Gruppenbeskrivelse") - ) - ); - - assertListOfPersonsFromCsvIsSavedInDatabase(expectedTpsIdenterListe, csvInnhold); - } - - @Test - void should_save_two_idents_from_csv_to_tps_ident_database() throws Exception { - String csvInnhold = """ - FNR*;Fornavn;Etternavn;Adresse;Postnummer;Poststed;Gruppe;Opprinnelse;Tags - 12345678910;Dolly;Dollesen;Dollygata 2;9999;Dollyville;Gruppen;Test;OTP - 12345678911;Donald;Dollesen;Dollygata 3;2222;Dollyby;Gruppen;Test;"""; - - TpsIdent expectedTpsPerson1 = TpsIdent.builder() - .fnr("12345678910") - .firstName("Dolly") - .lastName("Dollesen") - .address("Dollygata 2") - .postNr("9999") - .city("Dollyville") - .tags(Set.of("OTP")) - .build(); - TpsIdent expectedTpsPerson2 = TpsIdent.builder() - .fnr("12345678911") - .firstName("Donald") - .lastName("Dollesen") - .address("Dollygata 3") - .postNr("2222") - .city("Dollyby") - .build(); - var opprinnelse = new OpprinnelseModel(null, "Test"); - var gruppe = new GruppeModel(null, "Gruppen", "Gruppenbeskrivelse"); - List expectedTpsIdenterListe = List.of( - new TpsIdentModel(expectedTpsPerson1, opprinnelse, gruppe), - new TpsIdentModel(expectedTpsPerson2, opprinnelse, gruppe) - ); - - assertListOfPersonsFromCsvIsSavedInDatabase(expectedTpsIdenterListe, csvInnhold); - } -} diff --git a/apps/testnorge-statisk-data-forvalter/src/test/java/no/nav/registre/sdforvalter/provider/rs/OrkestreringsControllerAaregIntegrationTest.java b/apps/testnorge-statisk-data-forvalter/src/test/java/no/nav/registre/sdforvalter/provider/rs/OrkestreringControllerAaregIntegrationTest.java similarity index 98% rename from apps/testnorge-statisk-data-forvalter/src/test/java/no/nav/registre/sdforvalter/provider/rs/OrkestreringsControllerAaregIntegrationTest.java rename to apps/testnorge-statisk-data-forvalter/src/test/java/no/nav/registre/sdforvalter/provider/rs/OrkestreringControllerAaregIntegrationTest.java index dd7e900ab3c..e402a493d0a 100644 --- a/apps/testnorge-statisk-data-forvalter/src/test/java/no/nav/registre/sdforvalter/provider/rs/OrkestreringsControllerAaregIntegrationTest.java +++ b/apps/testnorge-statisk-data-forvalter/src/test/java/no/nav/registre/sdforvalter/provider/rs/OrkestreringControllerAaregIntegrationTest.java @@ -1,22 +1,19 @@ package no.nav.registre.sdforvalter.provider.rs; -import static com.github.tomakehurst.wiremock.client.WireMock.reset; -import static no.nav.registre.sdforvalter.ResourceUtils.getResourceFileContent; -import static org.mockito.Mockito.when; -import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.jwt; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - +import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import no.nav.registre.sdforvalter.consumer.rs.aareg.request.RsAaregSyntetiseringsRequest; import no.nav.registre.sdforvalter.consumer.rs.kodeverk.response.KodeverkResponse; +import no.nav.registre.sdforvalter.database.model.AaregModel; +import no.nav.registre.sdforvalter.database.repository.AaregRepository; import no.nav.testnav.libs.dto.aareg.v1.Arbeidsforhold; import no.nav.testnav.libs.securitycore.domain.AccessToken; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; +import no.nav.testnav.libs.testing.JsonWiremockHelper; import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.beans.factory.annotation.Autowired; @@ -29,18 +26,18 @@ import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.TestPropertySource; import org.springframework.test.web.servlet.MockMvc; -import com.fasterxml.jackson.core.type.TypeReference; - +import reactor.core.publisher.Mono; import java.util.Collections; import java.util.List; -import no.nav.registre.sdforvalter.database.model.AaregModel; -import no.nav.registre.sdforvalter.database.repository.AaregRepository; -import no.nav.testnav.libs.testing.JsonWiremockHelper; -import reactor.core.publisher.Mono; - +import static com.github.tomakehurst.wiremock.client.WireMock.reset; +import static no.nav.registre.sdforvalter.ResourceUtils.getResourceFileContent; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; +import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.jwt; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @ExtendWith(MockitoExtension.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @@ -48,7 +45,7 @@ @AutoConfigureMockMvc @TestPropertySource(locations = "classpath:application-test.yml") @ActiveProfiles("test") -class OrkestreringsControllerAaregIntegrationTest { +class OrkestreringControllerAaregIntegrationTest { @Autowired private MockMvc mvc; @@ -69,7 +66,7 @@ class OrkestreringsControllerAaregIntegrationTest { private final String tokenResponse = "{\"access_token\": \"dummy\"}"; private final KodeverkResponse kodeverkResponse = new KodeverkResponse(Collections.singletonList("yrke")); private static String syntString; - private TypeReference> SYNT_RESPONSE = new TypeReference<>() { + private final TypeReference> SYNT_RESPONSE = new TypeReference<>() { }; @BeforeAll diff --git a/apps/testnorge-statisk-data-forvalter/src/test/java/no/nav/registre/sdforvalter/provider/rs/OrkestreringsControllerKrrIntegrationTest.java b/apps/testnorge-statisk-data-forvalter/src/test/java/no/nav/registre/sdforvalter/provider/rs/OrkestreringControllerKrrIntegrationTest.java similarity index 89% rename from apps/testnorge-statisk-data-forvalter/src/test/java/no/nav/registre/sdforvalter/provider/rs/OrkestreringsControllerKrrIntegrationTest.java rename to apps/testnorge-statisk-data-forvalter/src/test/java/no/nav/registre/sdforvalter/provider/rs/OrkestreringControllerKrrIntegrationTest.java index 6f1b6f6d8a5..72594780743 100644 --- a/apps/testnorge-statisk-data-forvalter/src/test/java/no/nav/registre/sdforvalter/provider/rs/OrkestreringsControllerKrrIntegrationTest.java +++ b/apps/testnorge-statisk-data-forvalter/src/test/java/no/nav/registre/sdforvalter/provider/rs/OrkestreringControllerKrrIntegrationTest.java @@ -29,7 +29,7 @@ @AutoConfigureWireMock(port = 0) @AutoConfigureMockMvc(addFilters = false) @DirtiesContext -class OrkestreringsControllerKrrIntegrationTest { +class OrkestreringControllerKrrIntegrationTest { @Autowired private MockMvc mockMvc; @@ -46,16 +46,6 @@ public void cleanUp() { repository.deleteAll(); } - private KrrModel createKrr(String fnr) { - KrrModel model = new KrrModel(); - model.setFnr(fnr); - return model; - } - - private KrrRequest createKrrRequest(KrrModel model) { - return new KrrRequest(new Krr(model)); - } - @Test void shouldInitiateKrrFromDatabase() throws Exception { diff --git a/apps/testnorge-statisk-data-forvalter/src/test/java/no/nav/registre/sdforvalter/provider/rs/OrkestreringsControllerIdentIntegrationTest.java b/apps/testnorge-statisk-data-forvalter/src/test/java/no/nav/registre/sdforvalter/provider/rs/OrkestreringsControllerIdentIntegrationTest.java deleted file mode 100644 index df43218bc2a..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/test/java/no/nav/registre/sdforvalter/provider/rs/OrkestreringsControllerIdentIntegrationTest.java +++ /dev/null @@ -1,185 +0,0 @@ -package no.nav.registre.sdforvalter.provider.rs; - -import static com.github.tomakehurst.wiremock.client.WireMock.reset; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.when; -import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.jwt; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import com.fasterxml.jackson.databind.ObjectMapper; -import no.nav.registre.sdforvalter.consumer.rs.tpsf.request.SendToTpsRequest; -import no.nav.registre.sdforvalter.consumer.rs.tpsf.response.SkdMeldingerTilTpsRespons; -import no.nav.testnav.libs.securitycore.domain.AccessToken; -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.junit.jupiter.MockitoExtension; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.TestPropertySource; -import org.springframework.test.web.servlet.MockMvc; - -import java.util.Collections; -import java.util.List; - -import no.nav.registre.sdforvalter.database.model.TpsIdentModel; -import no.nav.registre.sdforvalter.database.repository.TpsIdenterRepository; -import no.nav.testnav.libs.testing.JsonWiremockHelper; -import reactor.core.publisher.Mono; - -@ExtendWith(MockitoExtension.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@AutoConfigureWireMock(port = 0) -@AutoConfigureMockMvc -@TestPropertySource(locations = "classpath:application-test.yml") -@ActiveProfiles("test") -class OrkestreringsControllerIdentIntegrationTest { - - @Value("${tps.statisk.avspillergruppeId}") - private Long staticDataPlaygroup; - - private static final String ENVIRONMENT = "t1"; - private static final String FNR = "01010101011"; - - @Autowired - private MockMvc mvc; - - @MockBean - private TokenExchange tokenExchange; - - @Autowired - private ObjectMapper objectMapper; - - @Autowired - private TpsIdenterRepository tpsIdenterRepository; - - private String hodejegerenUrlPattern; - private String levendeIdenterUrlPattern; - private String tpsfGetMeldingerUrlPattern; - private String tpsfSendSkdmeldingerUrlPattern; - private String tpOpprettPersonerUrlPattern; - private List identer = Collections.singletonList(FNR); - private List skdMeldinger = Collections.singletonList(1234567L); - private final String tokenResponse = "{\"access_token\": \"dummy\"}"; - - @BeforeEach - public void setup() { - hodejegerenUrlPattern = "(.*)/hodejegeren/api/v1/alle-identer/" + staticDataPlaygroup; - levendeIdenterUrlPattern = "(.*)/hodejegeren/api/v1/levende-identer/" + staticDataPlaygroup; - tpsfGetMeldingerUrlPattern = "(.*)/tpsf/api/v1/endringsmelding/skd/meldinger/" + staticDataPlaygroup; - tpsfSendSkdmeldingerUrlPattern = "(.*)/tpsf/api/v1/endringsmelding/skd/send/" + staticDataPlaygroup; - tpOpprettPersonerUrlPattern = "(.*)/testnorge-tp/api/v1/orkestrering/opprettPersoner/" + ENVIRONMENT; - - JsonWiremockHelper.builder(objectMapper).withUrlPathMatching("(.*)/v1/orkestrering/opprettPersoner/(.*)").stubPost(HttpStatus.OK); - } - - - @Test - void shouldInitiateIdent() throws Exception { - final TpsIdentModel tpsIdent = create(FNR, "Test", "Testen"); - tpsIdenterRepository.save(tpsIdent); - - var sendToTpsfRequest = new SendToTpsRequest(ENVIRONMENT, skdMeldinger); - var skdResponse = SkdMeldingerTilTpsRespons.builder() - .antallSendte(1) - .antallFeilet(0) - .build(); - - when(tokenExchange.exchange(any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("dummy"))); - - JsonWiremockHelper - .builder(objectMapper) - .withUrlPathMatching(hodejegerenUrlPattern) - .withResponseBody(Collections.EMPTY_SET) - .stubGet(); - - JsonWiremockHelper - .builder(objectMapper) - .withUrlPathMatching(tpsfGetMeldingerUrlPattern) - .withResponseBody(Collections.singletonList((1234567))) - .stubGet(); - - JsonWiremockHelper - .builder(objectMapper) - .withUrlPathMatching(tpsfSendSkdmeldingerUrlPattern) - .withRequestBody(sendToTpsfRequest) - .withResponseBody(skdResponse) - .stubPost(HttpStatus.OK); - - JsonWiremockHelper - .builder(objectMapper) - .withUrlPathMatching(levendeIdenterUrlPattern) - .withResponseBody(identer) - .stubGet(); - - JsonWiremockHelper - .builder(objectMapper) - .withUrlPathMatching(tpOpprettPersonerUrlPattern) - .withRequestBody(identer) - .withResponseBody(identer) - .stubPost(HttpStatus.OK); - - mvc.perform(post("/api/v1/orkestrering/tps/" + ENVIRONMENT) - .contentType(MediaType.APPLICATION_JSON).with(jwt())) - .andExpect(status().isOk()); - - JsonWiremockHelper - .builder(objectMapper) - .withUrlPathMatching(hodejegerenUrlPattern) - .withResponseBody(Collections.EMPTY_SET) - .verifyGet(); - - JsonWiremockHelper - .builder(objectMapper) - .withUrlPathMatching(tpsfGetMeldingerUrlPattern) - .withResponseBody(Collections.singletonList((1234567))) - .verifyGet(); - - JsonWiremockHelper - .builder(objectMapper) - .withUrlPathMatching(tpsfSendSkdmeldingerUrlPattern) - .withRequestBody(sendToTpsfRequest) - .withResponseBody(skdResponse) - .verifyPost(); - - JsonWiremockHelper - .builder(objectMapper) - .withUrlPathMatching(levendeIdenterUrlPattern) - .withResponseBody(identer) - .verifyGet(); - - JsonWiremockHelper - .builder(objectMapper) - .withUrlPathMatching(tpOpprettPersonerUrlPattern) - .withRequestBody(identer) - .withResponseBody(identer) - .verifyPost(); - } - - private TpsIdentModel create(String fnr, String firstName, String lastName) { - TpsIdentModel model = new TpsIdentModel(); - model.setFnr(fnr); - model.setFirstName(firstName); - model.setLastName(lastName); - return model; - } - - @AfterEach - public void cleanUp() { - reset(); - tpsIdenterRepository.deleteAll(); - } - - -} diff --git a/apps/testnorge-statisk-data-forvalter/src/test/java/no/nav/registre/sdforvalter/provider/rs/v1/StaticDataControllerV1TpsIntegrationTest.java b/apps/testnorge-statisk-data-forvalter/src/test/java/no/nav/registre/sdforvalter/provider/rs/v1/StaticDataControllerV1TpsIntegrationTest.java deleted file mode 100644 index 23ebb9a3398..00000000000 --- a/apps/testnorge-statisk-data-forvalter/src/test/java/no/nav/registre/sdforvalter/provider/rs/v1/StaticDataControllerV1TpsIntegrationTest.java +++ /dev/null @@ -1,145 +0,0 @@ -package no.nav.registre.sdforvalter.provider.rs.v1; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.common.collect.Lists; - -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.junit.jupiter.MockitoExtension; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.http.MediaType; -import org.springframework.test.context.TestPropertySource; -import org.springframework.test.web.servlet.MockMvc; - -import java.util.ArrayList; -import java.util.Arrays; - -import no.nav.registre.sdforvalter.database.model.OpprinnelseModel; -import no.nav.registre.sdforvalter.database.model.TpsIdentModel; -import no.nav.registre.sdforvalter.database.repository.OpprinnelseRepository; -import no.nav.registre.sdforvalter.database.repository.TpsIdenterRepository; -import no.nav.registre.sdforvalter.domain.Opprinnelse; -import no.nav.registre.sdforvalter.domain.TpsIdent; -import no.nav.registre.sdforvalter.domain.TpsIdentListe; - -import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.jwt; - - -@ExtendWith(MockitoExtension.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@AutoConfigureMockMvc -@TestPropertySource( - locations = "classpath:application-test.yml" -) -class StaticDataControllerV1TpsIntegrationTest { - @Autowired - private MockMvc mvc; - - @Autowired - private ObjectMapper objectMapper; - - @Autowired - private TpsIdenterRepository tpsIdenterRepository; - - @Autowired - private OpprinnelseRepository opprinnelseRepository; - - @Test - void shouldGiveUnauthorizedWithoutJwt() throws Exception { - - TpsIdent tpsIdent = createIdent("01010101011", "Petter", "Petterson"); - mvc.perform(post("/api/v1/faste-data/tps?genererManglendeNavn=false") - .content(objectMapper.writeValueAsString(createTpsIdenter(tpsIdent))) - .contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isUnauthorized()); - } - - @Test - void shouldGetTpsIdentSetWithOpprinnelse() throws Exception { - OpprinnelseModel altinn = opprinnelseRepository.save(new OpprinnelseModel("Altinn")); - TpsIdentModel tpsIdentModel = createIdentModel("01010101011", "Petter", "Petterson", altinn); - tpsIdenterRepository.save(tpsIdentModel); - - String json = mvc.perform(get("/api/v1/faste-data/tps?genererManglendeNavn=false") - .contentType(MediaType.APPLICATION_JSON).with(jwt())) - .andExpect(status().isOk()) - .andReturn() - .getResponse() - .getContentAsString(); - - TpsIdentListe response = objectMapper.readValue(json, TpsIdentListe.class); - assertThat(response.getListe()).containsOnly(new TpsIdent(tpsIdentModel, new ArrayList<>())); - } - - @Test - void shouldAddTpsIdentSetToDatabase() throws Exception { - - TpsIdent tpsIdent = createIdent("01010101011", "Petter", "Petterson"); - mvc.perform(post("/api/v1/faste-data/tps?genererManglendeNavn=false") - .content(objectMapper.writeValueAsString(createTpsIdenter(tpsIdent))) - .contentType(MediaType.APPLICATION_JSON).with(jwt())) - .andExpect(status().isOk()); - - assertThat(tpsIdenterRepository.findAll()).containsOnly(new TpsIdentModel(tpsIdent, null, null)); - } - - @Test - void shouldAddOpprinnelseToDatabase() throws Exception { - Opprinnelse altinn = new Opprinnelse("Altinn"); - final TpsIdent hans = createIdent("01010101011", "Hans", "Hansen"); - final TpsIdent petter = createIdent("01010101021", "Petter", "Petterson", altinn); - - mvc.perform(post("/api/v1/faste-data/tps?genererManglendeNavn=false") - .content(objectMapper.writeValueAsString(createTpsIdenter(hans, petter))) - .contentType(MediaType.APPLICATION_JSON).with(jwt())) - .andExpect(status().isOk()); - - assertThat(Lists.newArrayList(opprinnelseRepository.findAll())) - .hasSize(1) - .first() - .isEqualToComparingOnlyGivenFields( - new OpprinnelseModel(altinn), - "navn" - ); - } - - @AfterEach - public void cleanUp() { - tpsIdenterRepository.deleteAll(); - opprinnelseRepository.deleteAll(); - } - - - private TpsIdentModel createIdentModel(String fnr, String firstName, String lastName, OpprinnelseModel opprinnelseModel) { - TpsIdentModel model = new TpsIdentModel(); - model.setFnr(fnr); - model.setFirstName(firstName); - model.setLastName(lastName); - model.setOpprinnelseModel(opprinnelseModel); - return model; - } - - private TpsIdentModel createIdentModel(String fnr, String firstName, String lastName) { - return createIdentModel(fnr, firstName, lastName, null); - } - - private TpsIdent createIdent(String fnr, String firstName, String lastName) { - return new TpsIdent(createIdentModel(fnr, firstName, lastName), new ArrayList<>()); - } - - private TpsIdent createIdent(String fnr, String firstName, String lastName, Opprinnelse opprinnelse) { - return new TpsIdent(createIdentModel(fnr, firstName, lastName, new OpprinnelseModel(opprinnelse)), new ArrayList<>()); - } - - private TpsIdentListe createTpsIdenter(TpsIdent... tpsIdenter) { - return new TpsIdentListe(Arrays.asList(tpsIdenter)); - } -} diff --git a/apps/testnorge-statisk-data-forvalter/src/test/resources/application-test.yml b/apps/testnorge-statisk-data-forvalter/src/test/resources/application-test.yml index 1987a95c5e4..796bbf785f2 100644 --- a/apps/testnorge-statisk-data-forvalter/src/test/resources/application-test.yml +++ b/apps/testnorge-statisk-data-forvalter/src/test/resources/application-test.yml @@ -18,12 +18,6 @@ spring: AAD_ISSUER_URI: http://localhost:${wiremock.server.port:0}/token consumers: - person: - url: http://localhost:${wiremock.server.port:0}/person - cluster: dummy - namespace: dummy - name: testnav-person-service-test - threads: 5 generer-navn-service: url: http://localhost:${wiremock.server.port:0}/generer-navn cluster: dummy @@ -45,15 +39,6 @@ consumers: name: testnav-person-faste-data-service cluster: dummy namespace: dolly - tps-forvalteren-proxy: - url: http://localhost:${wiremock.server.port:0}/tpsf - cluster: dev-fss - namespace: dummy - name: tps-forvalteren-proxy - testnorge-hodejegeren: - url: http://localhost:${wiremock.server.port:0}/hodejegeren - testnorge-tp: - url: http://localhost:${wiremock.server.port:0}/testnorge-tp krr-stub: url: http://localhost:${wiremock.server.port:0}/krr-stub/api synthdata-aareg: @@ -69,8 +54,6 @@ consumers: aareg: pageSize: 2 -tps.statisk.avspillergruppeId: 1 - controller.staticdata.cache.hours: 24 azure.app.client.id: dummy diff --git a/apps/testnorge-tp/Dockerfile b/apps/testnorge-tp/Dockerfile deleted file mode 100644 index 44c2cf1c827..00000000000 --- a/apps/testnorge-tp/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM ghcr.io/navikt/baseimages/temurin:21 -LABEL maintainer="Team Registre" - -ADD /build/libs/app.jar /app/app.jar - -ENV JAVA_OPTS="-Dspring.profiles.active=prod" - -EXPOSE 8080 \ No newline at end of file diff --git a/apps/testnorge-tp/README.md b/apps/testnorge-tp/README.md deleted file mode 100644 index 677f3d12383..00000000000 --- a/apps/testnorge-tp/README.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -layout: default -title: Testnorge TP -parent: Applikasjoner ---- - -# Testnorge-TP -Testnorge-TP (Tjeneste Pensjon) er integrasjonen mellom Orkestratoren og TJPEN databasen. Testnorge-TP går mot TJPEN i gitte miljøer. - -## Swagger -Swagger finnes under [/api](https://testnorge-tp.dev.intern.nav.no/api) -endepunktet til applikasjonen. - -## Lokal kjøring -Ha naisdevice kjørende og kjør TestnorgeTpApplicationStarter med følgende argumenter: -``` --Dspring.cloud.vault.token=[kopier token fra vault] --Dspring.profiles.active=local -``` - -### Utviklerimage -I utviklerimage brukes ikke naisdevice og du må legge til følgende ekstra argumenter: -``` --Djavax.net.ssl.trustStore=[path til lokal truststore] --Djavax.net.ssl.trustStorePassword=[passord til lokal truststore] -``` \ No newline at end of file diff --git a/apps/testnorge-tp/build.gradle b/apps/testnorge-tp/build.gradle deleted file mode 100644 index 362799e7848..00000000000 --- a/apps/testnorge-tp/build.gradle +++ /dev/null @@ -1,84 +0,0 @@ -plugins { - id 'java' - id "org.sonarqube" version "4.0.0.2929" - id 'org.springframework.boot' version "3.1.4" - id 'io.spring.dependency-management' version "1.1.3" - id "jacoco" -} - -test { - useJUnitPlatform() -} - -jacocoTestReport { - reports { - xml.required = true - } -} - -sonarqube { - properties { - property "sonar.coverage.jacoco.xmlReportPaths", "${project.buildDir}/reports/jacoco/test/jacocoTestReport.xml" - property "sonar.dynamicAnalysis", "reuseReports" - property "sonar.host.url", "https://sonarcloud.io" - property "sonar.java.coveragePlugin", "jacoco" - property "sonar.language", "java" - property "sonar.login", System.getenv("SONAR_TOKEN") - property "sonar.organization", "navikt" - property "sonar.project.monorepo.enabled", true - property "sonar.projectKey", "testnorge-tp" - property "sonar.projectName", "testnorge-tp" - property "sonar.sourceEncoding", "UTF-8" - } -} - -bootJar { - archiveFileName = "app.jar" -} - -dependencyManagement { - applyMavenExclusions = false - imports { - mavenBom 'org.springframework.cloud:spring-cloud-dependencies:2022.0.4' - } -} - -repositories { - mavenCentral() - mavenLocal() -} - -dependencies { - implementation 'no.nav.testnav.libs:security-core' - implementation 'no.nav.testnav.libs:servlet-core' - implementation 'no.nav.testnav.libs:servlet-security' - - - implementation 'org.springframework.cloud:spring-cloud-starter-vault-config' - - implementation 'org.springframework.boot:spring-boot-starter-web' - implementation 'org.springframework.boot:spring-boot-starter-webflux' - implementation 'org.springframework.boot:spring-boot-starter-oauth2-client' - implementation 'org.springframework.boot:spring-boot-configuration-processor' - - implementation 'jakarta.validation:jakarta.validation-api:3.0.2' - - implementation 'net.logstash.logback:logstash-logback-encoder:7.4' - - implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0' - - implementation 'org.projectlombok:lombok' - annotationProcessor 'org.projectlombok:lombok' - testAnnotationProcessor 'org.projectlombok:lombok' - - testImplementation 'junit:junit:4.13.2' //TODO upgrade to JUnit5 - testImplementation 'org.springframework.boot:spring-boot-starter-test' - testImplementation 'org.springframework.cloud:spring-cloud-contract-wiremock' -} - -description = 'testnorge-tp' -java { - toolchain { - languageVersion = JavaLanguageVersion.of(21) - } -} diff --git a/apps/testnorge-tp/config.yml b/apps/testnorge-tp/config.yml deleted file mode 100644 index 63a0c2c3c80..00000000000 --- a/apps/testnorge-tp/config.yml +++ /dev/null @@ -1,52 +0,0 @@ -apiVersion: "nais.io/v1alpha1" -kind: "Application" -metadata: - name: testnorge-tp - namespace: dolly - labels: - team: dolly -spec: - port: 8080 - liveness: - path: /internal/isAlive - periodSeconds: 30 - initialDelay: 30 - readiness: - path: /internal/isReady - initialDelay: 30 - prometheus: - enabled: true - path: /internal/metrics - replicas: - min: 1 - max: 1 - resources: - limits: - memory: 2048Mi - requests: - cpu: 500m - memory: 1024Mi - image: {{ image }} - ingresses: - - "https://testnorge-tp.dev.intern.nav.no" # dev-fss - webproxy: true - azure: - application: - allowAllUsers: true - enabled: true - tenant: nav.no - accessPolicy: - inbound: - rules: - - application: testnorge-statisk-data-forvalter - - application: testnav-oversikt-frontend - cluster: dev-gcp - - application: team-dolly-lokal-app - cluster: dev-gcp - outbound: - rules: - - application: testnorge-hodejegeren - - application: pensjon-testdata-server-q1 - namespace: pensjontestdata - - application: pensjon-testdata-server-q2 - namespace: pensjontestdata diff --git a/apps/testnorge-tp/gradle/wrapper/gradle-wrapper.jar b/apps/testnorge-tp/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 7454180f2ae..00000000000 Binary files a/apps/testnorge-tp/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/apps/testnorge-tp/gradle/wrapper/gradle-wrapper.properties b/apps/testnorge-tp/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index e411586a54a..00000000000 --- a/apps/testnorge-tp/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/apps/testnorge-tp/gradlew b/apps/testnorge-tp/gradlew deleted file mode 100755 index 3da45c161b0..00000000000 --- a/apps/testnorge-tp/gradlew +++ /dev/null @@ -1,234 +0,0 @@ -#!/bin/sh - -# -# Copyright ? 2015-2021 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions ?$var?, ?${var}?, ?${var:-default}?, ?${var+SET}?, -# ?${var#prefix}?, ?${var%suffix}?, and ?$( cmd )?; -# * compound commands having a testable exit status, especially ?case?; -# * various built-in commands including ?command?, ?set?, and ?ulimit?. -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" -APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/apps/testnorge-tp/gradlew.bat b/apps/testnorge-tp/gradlew.bat deleted file mode 100644 index ac1b06f9382..00000000000 --- a/apps/testnorge-tp/gradlew.bat +++ /dev/null @@ -1,89 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/apps/testnorge-tp/gradlewUpdate.sh b/apps/testnorge-tp/gradlewUpdate.sh deleted file mode 100755 index e5ee6361152..00000000000 --- a/apps/testnorge-tp/gradlewUpdate.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -gradle wrapper \ No newline at end of file diff --git a/apps/testnorge-tp/settings.gradle b/apps/testnorge-tp/settings.gradle deleted file mode 100644 index 8d15f15864d..00000000000 --- a/apps/testnorge-tp/settings.gradle +++ /dev/null @@ -1,16 +0,0 @@ -plugins { - id "com.gradle.enterprise" version "3.12.3" -} - -rootProject.name = 'testnorge-tp' - -includeBuild '../../libs/security-core' -includeBuild '../../libs/servlet-core' -includeBuild '../../libs/servlet-security' - -gradleEnterprise { - buildScan { - termsOfServiceUrl = "https://gradle.com/terms-of-service" - termsOfServiceAgree = "yes" - } -} diff --git a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/TestnorgeTpApplicationStarter.java b/apps/testnorge-tp/src/main/java/no/nav/registre/tp/TestnorgeTpApplicationStarter.java deleted file mode 100644 index 466001438e5..00000000000 --- a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/TestnorgeTpApplicationStarter.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.registre.tp; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class TestnorgeTpApplicationStarter { - - public static void main(String[] args) { - SpringApplication.run(TestnorgeTpApplicationStarter.class, args); - } -} diff --git a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/config/AppConfig.java b/apps/testnorge-tp/src/main/java/no/nav/registre/tp/config/AppConfig.java deleted file mode 100644 index 3c6cf8017ab..00000000000 --- a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/config/AppConfig.java +++ /dev/null @@ -1,14 +0,0 @@ -package no.nav.registre.tp.config; - -import no.nav.testnav.libs.servletcore.config.ApplicationCoreConfig; -import no.nav.testnav.libs.servletsecurity.config.SecureOAuth2ServerToServerConfiguration; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; - -@Configuration -@Import(value = { - ApplicationCoreConfig.class, - SecureOAuth2ServerToServerConfiguration.class -}) -public class AppConfig { -} diff --git a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/config/Consumers.java b/apps/testnorge-tp/src/main/java/no/nav/registre/tp/config/Consumers.java deleted file mode 100644 index dbf7fe25e30..00000000000 --- a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/config/Consumers.java +++ /dev/null @@ -1,29 +0,0 @@ -package no.nav.registre.tp.config; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import static lombok.AccessLevel.PACKAGE; - -/** - * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. - *

- * Husk at Spring Boot bruker relaxed binding - * mellom configuration properties og field names. - * - * @see ServerProperties - */ -@Configuration -@ConfigurationProperties(prefix = "consumers") -@NoArgsConstructor(access = PACKAGE) -@Getter -@Setter(PACKAGE) -public class Consumers { - - private ServerProperties hodejegeren; - -} diff --git a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/config/OpenApiConfig.java b/apps/testnorge-tp/src/main/java/no/nav/registre/tp/config/OpenApiConfig.java deleted file mode 100644 index 211de2a53ea..00000000000 --- a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/config/OpenApiConfig.java +++ /dev/null @@ -1,68 +0,0 @@ -package no.nav.registre.tp.config; - -import io.swagger.v3.oas.models.Components; -import io.swagger.v3.oas.models.OpenAPI; -import io.swagger.v3.oas.models.info.Contact; -import io.swagger.v3.oas.models.info.Info; -import io.swagger.v3.oas.models.info.License; -import io.swagger.v3.oas.models.security.SecurityRequirement; -import io.swagger.v3.oas.models.security.SecurityScheme; -import no.nav.testnav.libs.securitycore.config.UserConstant; -import no.nav.testnav.libs.servletcore.config.ApplicationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -import java.util.Arrays; - - -@Configuration -public class OpenApiConfig implements WebMvcConfigurer { - - @Bean - public OpenAPI openApi(ApplicationProperties applicationProperties) { - return new OpenAPI() - .components(new Components() - .addSecuritySchemes("bearer-jwt", new SecurityScheme() - .type(SecurityScheme.Type.HTTP) - .scheme("bearer") - .bearerFormat("JWT") - .in(SecurityScheme.In.HEADER) - .name("Authorization") - .description("Trenger ikke \"Bearer \" foran") - ) - .addSecuritySchemes("user-jwt", new SecurityScheme() - .type(SecurityScheme.Type.APIKEY) - .scheme("bearer") - .bearerFormat("JWT") - .in(SecurityScheme.In.HEADER) - .name(UserConstant.USER_HEADER_JWT) - )) - .addSecurityItem( - new SecurityRequirement() - .addList("bearer-jwt", Arrays.asList("read", "write")) - .addList("user-jwt", Arrays.asList("read", "write")) - ) - .info(new Info() - .title(applicationProperties.getName()) - .version(applicationProperties.getVersion()) - .description(applicationProperties.getDescription()) - .termsOfService("https://nav.no") - .contact(new Contact() - .url("https://nav-it.slack.com/archives/CA3P9NGA2") - .email("dolly@nav.no") - .name("Team Dolly") - ) - .license(new License() - .name("MIT License") - .url("https://opensource.org/licenses/MIT") - ) - ); - } - - @Override - public void addViewControllers(ViewControllerRegistry registry) { - registry.addViewController("/swagger").setViewName("redirect:/swagger-ui.html"); - } -} diff --git a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/config/SecurityConfig.java b/apps/testnorge-tp/src/main/java/no/nav/registre/tp/config/SecurityConfig.java deleted file mode 100644 index 2876f548482..00000000000 --- a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/config/SecurityConfig.java +++ /dev/null @@ -1,37 +0,0 @@ -package no.nav.registre.tp.config; - -import lombok.extern.slf4j.Slf4j; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.annotation.Order; -import org.springframework.security.config.Customizer; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; -import org.springframework.security.config.http.SessionCreationPolicy; -import org.springframework.security.web.SecurityFilterChain; - -@Slf4j -@Configuration -@Order(1) -public class SecurityConfig { - - @Bean - public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception { - - httpSecurity.sessionManagement(sessionConfig -> sessionConfig.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) - .csrf(AbstractHttpConfigurer::disable) - .authorizeHttpRequests(authorizeConfig -> authorizeConfig.requestMatchers( - "/internal/**", - "/webjars/**", - "/swagger-resources/**", - "/v3/api-docs/**", - "/swagger-ui/**", - "/swagger", - "/error", - "/swagger-ui.html" - ).permitAll().requestMatchers("/api/**").fullyAuthenticated()) - .oauth2ResourceServer(oauth2RSConfig -> oauth2RSConfig.jwt(Customizer.withDefaults())); - - return httpSecurity.build(); - } -} diff --git a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/config/dev/VaultConfig.java b/apps/testnorge-tp/src/main/java/no/nav/registre/tp/config/dev/VaultConfig.java deleted file mode 100644 index c26a619ad80..00000000000 --- a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/config/dev/VaultConfig.java +++ /dev/null @@ -1,37 +0,0 @@ -package no.nav.registre.tp.config.dev; - -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; -import org.springframework.vault.annotation.VaultPropertySource; -import org.springframework.vault.authentication.ClientAuthentication; -import org.springframework.vault.authentication.TokenAuthentication; -import org.springframework.vault.client.VaultEndpoint; -import org.springframework.vault.config.AbstractVaultConfiguration; - -import static io.micrometer.common.util.StringUtils.isBlank; - -@Configuration -@Profile("local") -@VaultPropertySource(value = "kv/preprod/fss/testnorge-tp/local", ignoreSecretNotFound = false) -@VaultPropertySource(value = "secret/dolly/lokal", ignoreSecretNotFound = false) -public class VaultConfig extends AbstractVaultConfiguration { - - private static final String VAULT_TOKEN = "spring.cloud.vault.token"; - - @Override - public VaultEndpoint vaultEndpoint() { - return VaultEndpoint.create("vault.adeo.no", 443); - } - - @Override - public ClientAuthentication clientAuthentication() { - if (System.getenv().containsKey("VAULT_TOKEN")) { - System.setProperty(VAULT_TOKEN, System.getenv("VAULT_TOKEN")); - } - var token = System.getProperty(VAULT_TOKEN); - if (isBlank(token)) { - throw new IllegalArgumentException("Påkrevet property 'spring.cloud.vault.token' er ikke satt."); - } - return new TokenAuthentication(System.getProperty(VAULT_TOKEN)); - } -} \ No newline at end of file diff --git a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/HodejegerenConsumer.java b/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/HodejegerenConsumer.java deleted file mode 100644 index 6a2a334ff3a..00000000000 --- a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/HodejegerenConsumer.java +++ /dev/null @@ -1,42 +0,0 @@ -package no.nav.registre.tp.consumer; - -import lombok.extern.slf4j.Slf4j; -import no.nav.registre.tp.config.Consumers; -import no.nav.registre.tp.consumer.command.GetLevendeIdenterCommand; -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange; -import org.springframework.stereotype.Component; -import org.springframework.web.reactive.function.client.WebClient; - -import java.util.List; - - -@Component -@Slf4j -public class HodejegerenConsumer { - - private final WebClient webClient; - private final TokenExchange tokenExchange; - private final ServerProperties serverProperties; - - public HodejegerenConsumer( - Consumers consumers, - TokenExchange tokenExchange - ) { - serverProperties = consumers.getHodejegeren(); - this.tokenExchange = tokenExchange; - this.webClient = WebClient - .builder() - .baseUrl(serverProperties.getUrl()) - .build(); - } - - public List getLevende( - Long avspillergruppeId - ) { - return tokenExchange.exchange(serverProperties) - .flatMap(accessToken -> new GetLevendeIdenterCommand(avspillergruppeId, accessToken.getTokenValue(), webClient).call()) - .block(); - } - -} diff --git a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/TpConsumer.java b/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/TpConsumer.java deleted file mode 100644 index ae486b77901..00000000000 --- a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/TpConsumer.java +++ /dev/null @@ -1,38 +0,0 @@ -package no.nav.registre.tp.consumer; - -import lombok.extern.slf4j.Slf4j; -import no.nav.registre.tp.consumer.command.CreateMissingPersonsCommand; -import no.nav.registre.tp.consumer.command.FindExistingPersonsCommand; -import no.nav.registre.tp.consumer.command.RemovePersonsCommand; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; -import org.springframework.web.reactive.function.client.WebClient; - -import java.util.Arrays; -import java.util.List; - -@Component -@Slf4j -public class TpConsumer { - - private final WebClient webClient; - - public TpConsumer(@Value("${pensjon-testdata-server-q2.url}") String serverUrl) { - - this.webClient = WebClient.builder() - .baseUrl(serverUrl) - .build(); - } - - public List createMissingPersons(List fnrs) { - return Arrays.asList(new CreateMissingPersonsCommand(fnrs, webClient).call().block()); - } - - public List findExistingPersons(List fnrs) { - return Arrays.asList(new FindExistingPersonsCommand(fnrs, webClient).call().block()); - } - - public List removePersons(List fnrs) { - return Arrays.asList(new RemovePersonsCommand(fnrs, webClient).call().block()); - } -} diff --git a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/command/CreateMissingPersonsCommand.java b/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/command/CreateMissingPersonsCommand.java deleted file mode 100644 index 52ee6836978..00000000000 --- a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/command/CreateMissingPersonsCommand.java +++ /dev/null @@ -1,13 +0,0 @@ -package no.nav.registre.tp.consumer.command; - -import org.springframework.web.reactive.function.client.WebClient; - -import java.util.List; - -public class CreateMissingPersonsCommand extends TpPostStringListCommand { - - public CreateMissingPersonsCommand(List fnrs, WebClient webClient) { - super("/api/tp/missing-persons", fnrs, webClient); - } - -} diff --git a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/command/FindExistingPersonsCommand.java b/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/command/FindExistingPersonsCommand.java deleted file mode 100644 index 03eed593b9a..00000000000 --- a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/command/FindExistingPersonsCommand.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.registre.tp.consumer.command; - -import org.springframework.web.reactive.function.client.WebClient; - -import java.util.List; - -public class FindExistingPersonsCommand extends TpPostStringListCommand { - - public FindExistingPersonsCommand(List fnrs, WebClient webClient) { - super("/api/tp/find-persons", fnrs, webClient); - } -} diff --git a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/command/GetLevendeIdenterCommand.java b/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/command/GetLevendeIdenterCommand.java deleted file mode 100644 index bdfa091f3f3..00000000000 --- a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/command/GetLevendeIdenterCommand.java +++ /dev/null @@ -1,30 +0,0 @@ -package no.nav.registre.tp.consumer.command; - -import lombok.RequiredArgsConstructor; -import org.springframework.core.ParameterizedTypeReference; -import org.springframework.web.reactive.function.client.WebClient; -import reactor.core.publisher.Mono; - -import java.util.List; -import java.util.concurrent.Callable; - -@RequiredArgsConstructor -public class GetLevendeIdenterCommand implements Callable>> { - private static final ParameterizedTypeReference> RESPONSE_TYPE = new ParameterizedTypeReference<>() { - }; - private final Long avspillergruppeId; - private final String token; - private final WebClient webClient; - - @Override - public Mono> call() { - return webClient.get() - .uri(builder -> - builder.path("/api/v1/alle-levende-identer/{avspillergruppeId}") - .build(avspillergruppeId) - ) - .header("Authorization", "Bearer " + token) - .retrieve() - .bodyToMono(RESPONSE_TYPE); - } -} diff --git a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/command/RemovePersonsCommand.java b/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/command/RemovePersonsCommand.java deleted file mode 100644 index fadae698337..00000000000 --- a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/command/RemovePersonsCommand.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.registre.tp.consumer.command; - -import org.springframework.web.reactive.function.client.WebClient; - -import java.util.List; - -public class RemovePersonsCommand extends TpPostStringListCommand { - - public RemovePersonsCommand(List fnrs, WebClient webClient) { - super("/api/tp/remove-persons", fnrs, webClient); - } -} diff --git a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/command/TpPostListCommand.java b/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/command/TpPostListCommand.java deleted file mode 100644 index d2e532c10f9..00000000000 --- a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/command/TpPostListCommand.java +++ /dev/null @@ -1,34 +0,0 @@ -package no.nav.registre.tp.consumer.command; - -import lombok.RequiredArgsConstructor; -import no.nav.registre.tp.util.WebClientFilter; -import org.springframework.web.reactive.function.client.WebClient; -import reactor.core.publisher.Mono; -import reactor.util.retry.Retry; - -import java.time.Duration; -import java.util.List; -import java.util.concurrent.Callable; - -@RequiredArgsConstructor -public class TpPostListCommand implements Callable> { - - private final String url; - private final Class bodyType; - private final T emptyValue; - private final List fnrs; - private final WebClient webClient; - - public Mono call() { - return webClient.post() - .uri(builder -> builder.path(url).build()) - .bodyValue(fnrs) - .retrieve() - - .bodyToMono(bodyType) - .defaultIfEmpty(emptyValue) - .retryWhen(Retry.backoff(3, Duration.ofSeconds(10)) - .filter(WebClientFilter::is5xxException)); - } - -} diff --git a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/command/TpPostStringListCommand.java b/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/command/TpPostStringListCommand.java deleted file mode 100644 index c1d1f6d2e06..00000000000 --- a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/consumer/command/TpPostStringListCommand.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.registre.tp.consumer.command; - -import org.springframework.web.reactive.function.client.WebClient; - -import java.util.List; - -public class TpPostStringListCommand extends TpPostListCommand { - - public TpPostStringListCommand(String url, List fnrs, WebClient webClient) { - super(url, String[].class, new String[0], fnrs, webClient); - } -} diff --git a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/provider/OrkestreringController.java b/apps/testnorge-tp/src/main/java/no/nav/registre/tp/provider/OrkestreringController.java deleted file mode 100644 index 26abbac9a97..00000000000 --- a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/provider/OrkestreringController.java +++ /dev/null @@ -1,63 +0,0 @@ -package no.nav.registre.tp.provider; - -import io.swagger.v3.oas.annotations.Operation; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import no.nav.registre.tp.provider.request.OrkestreringRequest; -import no.nav.registre.tp.service.TpService; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -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 java.util.List; - -@Slf4j -@RestController -@RequiredArgsConstructor -@RequestMapping("api/v1/orkestrering") -public class OrkestreringController { - - private final TpService tpService; - - @Operation(description = "Dette endepunktet kan benyttes for å initialisere en database i et gitt miljø. Identer som ikke finnes i TJPEN databasen, men i avspillergruppen på det gitte miljøet vil bli " - + "opprettet uten noen tilhørende ytelser.") - @PostMapping("/init") - public ResponseEntity initializeDatabase( - @RequestBody OrkestreringRequest request - ) { - var count = tpService.initializeTpDbForEnvironment(request.getAvspillergruppeId()); - return ResponseEntity.ok(count); - } - - @Operation(description = "Dette endepunktet kan benyttes for å opprette gitte personer. De vil bli opprettet i TJPEN. Det er ikke noen verifikasjon av FNR mot TPS eller om det er et gyldig FNR.") - @PostMapping("/opprettPersoner/{miljoe}") - public ResponseEntity> addPeople( - @PathVariable String miljoe, - @RequestBody List fnrs - ) { - var people = tpService.createPeople(fnrs); - var feilet = fnrs.parallelStream().filter(fnr -> !people.contains(fnr)) - .toList(); - return ResponseEntity.ok(feilet); - } - - @Operation(description = "Dette endepunktet kan benyttes for å hente personer fra en gitt liste som finnes i TP.") - @PostMapping("/hentPersonerITp/{miljoe}") - public List getPeopleInTp( - @PathVariable String miljoe, - @RequestBody List fnrs - ) { - return tpService.filterTpOnFnrs(fnrs); - } - - @Operation(description = "Enkel implementasjon for å fjerne personer i en gitt liste fra TP. Personene fjernes kun hvis de ikke" - + "har tilhørende forhold. Returnerer en liste med de personene som ble slettet.") - @DeleteMapping("/fjernPersoner/{miljoe}") - public List removeIdentsFromTp(@PathVariable String miljoe, @RequestBody List fnrs) { - return tpService.removeFnrsFromTp(fnrs); - } -} diff --git a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/provider/request/OrkestreringRequest.java b/apps/testnorge-tp/src/main/java/no/nav/registre/tp/provider/request/OrkestreringRequest.java deleted file mode 100644 index ff89e8e67b0..00000000000 --- a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/provider/request/OrkestreringRequest.java +++ /dev/null @@ -1,24 +0,0 @@ -package no.nav.registre.tp.provider.request; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -import jakarta.validation.constraints.NotNull; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -public class OrkestreringRequest { - - @NotNull - @JsonProperty("avspillergruppeId") - private Long avspillergruppeId; - @NotNull - @JsonProperty("miljoe") - private String miljoe; - -} diff --git a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/service/TpService.java b/apps/testnorge-tp/src/main/java/no/nav/registre/tp/service/TpService.java deleted file mode 100644 index 78a770f30d2..00000000000 --- a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/service/TpService.java +++ /dev/null @@ -1,49 +0,0 @@ -package no.nav.registre.tp.service; - -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import no.nav.registre.tp.consumer.HodejegerenConsumer; -import no.nav.registre.tp.consumer.TpConsumer; -import org.springframework.stereotype.Service; - -import java.util.List; - -@Slf4j -@Service -@RequiredArgsConstructor -public class TpService { - - private static final String EIER = "synt"; - - private final HodejegerenConsumer hodejegerenConsumer; - - private final TpConsumer tpConsumer; - - public int initializeTpDbForEnvironment( - Long id - ) { - var allIdentities = getLivingIdentities(id); - var created = tpConsumer.createMissingPersons(allIdentities); - - log.info("Opprettet {} personer i tp", created.size()); - return created.size(); - } - - public List createPeople(List fnrs) { - return tpConsumer.createMissingPersons(fnrs); - } - - public List filterTpOnFnrs(List fnrs) { - return tpConsumer.findExistingPersons(fnrs); - } - - public List removeFnrsFromTp(List fnrs) { - return tpConsumer.removePersons(fnrs); - } - - private List getLivingIdentities( - Long id - ) { - return hodejegerenConsumer.getLevende(id); - } -} diff --git a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/util/WebClientFilter.java b/apps/testnorge-tp/src/main/java/no/nav/registre/tp/util/WebClientFilter.java deleted file mode 100644 index 87306e9ec9b..00000000000 --- a/apps/testnorge-tp/src/main/java/no/nav/registre/tp/util/WebClientFilter.java +++ /dev/null @@ -1,14 +0,0 @@ -package no.nav.registre.tp.util; - -import lombok.experimental.UtilityClass; -import org.springframework.web.reactive.function.client.WebClientResponseException; - -@UtilityClass -public class WebClientFilter { - - public static boolean is5xxException(Throwable throwable) { - - return throwable instanceof WebClientResponseException wce && - wce.getStatusCode().is5xxServerError(); - } -} diff --git a/apps/testnorge-tp/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/apps/testnorge-tp/src/main/resources/META-INF/additional-spring-configuration-metadata.json deleted file mode 100644 index 5e12ba366d6..00000000000 --- a/apps/testnorge-tp/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "properties": [ - { - "name": "syntrest.rest.api.url", - "type": "java.lang.String", - "description": "Description for syntrest.rest.api.url." - }, - { - "name": "testnorge.inntektstub.rest.api.url", - "type": "java.lang.String", - "description": "Description for testnorge.inntektstub.rest.api.url." - }, - { - "name": "tpDataSource.url", - "type": "java.lang.String", - "description": "Description for tpDataSource.url." - }, - { - "name": "tpDataSource.username", - "type": "java.lang.String", - "description": "Description for tpDataSource.username." - }, - { - "name": "tpDataSource.password", - "type": "java.lang.String", - "description": "Description for tpDataSource.password." - } - ] -} diff --git a/apps/testnorge-tp/src/main/resources/application-local.properties b/apps/testnorge-tp/src/main/resources/application-local.properties deleted file mode 100644 index 906d52777f1..00000000000 --- a/apps/testnorge-tp/src/main/resources/application-local.properties +++ /dev/null @@ -1 +0,0 @@ -environments=q2 \ No newline at end of file diff --git a/apps/testnorge-tp/src/main/resources/application-prod.properties b/apps/testnorge-tp/src/main/resources/application-prod.properties deleted file mode 100644 index e427483cb13..00000000000 --- a/apps/testnorge-tp/src/main/resources/application-prod.properties +++ /dev/null @@ -1,3 +0,0 @@ -environments=q2 - -spring.main.banner-mode=off diff --git a/apps/testnorge-tp/src/main/resources/application.properties b/apps/testnorge-tp/src/main/resources/application.properties deleted file mode 100644 index 719c45a1fb6..00000000000 --- a/apps/testnorge-tp/src/main/resources/application.properties +++ /dev/null @@ -1,31 +0,0 @@ -application.version=application.version.todo -application.name=testnorge-tp - -springdoc.swagger-ui.disable-swagger-default-url=true -springdoc.swagger-ui.url=/v3/api-docs - -AAD_ISSUER_URI=https://login.microsoftonline.com/62366534-1ec3-4962-8869-9b5535279d0b - -spring.cloud.vault.enabled=false - -spring.security.oauth2.resourceserver.aad.issuer-uri=${AAD_ISSUER_URI}/v2.0 -spring.security.oauth2.resourceserver.aad.jwk-set-uri=${AAD_ISSUER_URI}/discovery/v2.0/keys -spring.security.oauth2.resourceserver.aad.accepted-audience=${azure.app.client.id}, api://${azure.app.client.id} - -pensjon-testdata-server-q1.url=https://pensjon-testdata-server-q1.dev.intern.nav.no -pensjon-testdata-server-q2.url=https://pensjon-testdata-server-q2.dev.intern.nav.no - -management.endpoints.enabled-by-default=true -management.endpoints.web.base-path=/internal -management.endpoints.web.exposure.include=prometheus,heapdump,health -management.endpoints.web.path-mapping.prometheus=metrics -management.endpoint.prometheus.enabled=true -management.endpoint.heapdump.enabled=true -management.prometheus.metrics.export.enabled=true - -consumers.hodejegeren.url=https://testnorge-hodejegeren.dev.intern.nav.no -consumers.hodejegeren.cluster=dev-fss -consumers.hodejegeren.namespace=dolly -consumers.hodejegeren.name=testnorge-hodejegeren - -server.servlet.encoding.charset=UTF-8 diff --git a/apps/testnorge-tp/src/main/resources/logback-spring.xml b/apps/testnorge-tp/src/main/resources/logback-spring.xml deleted file mode 100644 index 887bc4b4b5a..00000000000 --- a/apps/testnorge-tp/src/main/resources/logback-spring.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - true - 256 - 10280 - 20 - ^sun\.reflect\..*\.invoke - ^net\.sf\.cglib\.proxy\.MethodProxy\.invoke - java\.util\.concurrent\..* - org\.apache\.catalina\..* - org\.apache\.coyote\..* - org\.apache\.tomcat\..* - - bestillingId - - - - - - - - - - - UTF-8 - - %d{HH:mm:ss.SSS} %highlight(%p) | %yellow(%logger{0}): %m%n - - - - - - - - - - - diff --git a/apps/testnorge-tp/src/test/java/no/nav/registre/tp/ApplicationContextTest.java b/apps/testnorge-tp/src/test/java/no/nav/registre/tp/ApplicationContextTest.java deleted file mode 100644 index df377120cbe..00000000000 --- a/apps/testnorge-tp/src/test/java/no/nav/registre/tp/ApplicationContextTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package no.nav.registre.tp; - - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.security.oauth2.jwt.JwtDecoder; -import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringRunner; - - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@TestPropertySource(locations = "classpath:application-test.properties") -public class ApplicationContextTest { - - @MockBean - public JwtDecoder jwtDecoder; - - /** - * Used to test app runtime dependency and properties - */ - @Test - @SuppressWarnings("java:S2699") - public void load_app_context() { - } -} diff --git a/apps/testnorge-tp/src/test/java/no/nav/registre/tp/provider/OrkestreringControllerTest.java b/apps/testnorge-tp/src/test/java/no/nav/registre/tp/provider/OrkestreringControllerTest.java deleted file mode 100644 index e5af127d3ce..00000000000 --- a/apps/testnorge-tp/src/test/java/no/nav/registre/tp/provider/OrkestreringControllerTest.java +++ /dev/null @@ -1,52 +0,0 @@ -package no.nav.registre.tp.provider; - -import static org.junit.Assert.assertEquals; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.Mockito.when; - -import no.nav.registre.tp.provider.request.OrkestreringRequest; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.springframework.http.ResponseEntity; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -import no.nav.registre.tp.service.TpService; - -@RunWith(SpringJUnit4ClassRunner.class) -public class OrkestreringControllerTest { - - @Mock - private TpService tpService; - - @InjectMocks - private OrkestreringController orkestreringController; - - @Test - public void initializeDatabase() { - when(tpService.initializeTpDbForEnvironment(anyLong())).thenReturn(1); - ResponseEntity entity = orkestreringController.initializeDatabase(new OrkestreringRequest(1L, "q2")); - assertEquals(1, entity.getBody()); - } - - @Test - public void addPeople() { - List fnrs = new ArrayList<>(); - fnrs.add("123"); - fnrs.add("132"); - fnrs.add("321"); - - List feiletPersoner = new ArrayList<>(1); - feiletPersoner.add("123"); - when(tpService.createPeople(any())).thenReturn(feiletPersoner); - var entity = orkestreringController.addPeople("q", fnrs); - assertEquals(2, Objects.requireNonNull(entity.getBody()).size()); - - } -} \ No newline at end of file diff --git a/apps/testnorge-tp/src/test/resources/application-test.properties b/apps/testnorge-tp/src/test/resources/application-test.properties deleted file mode 100644 index ad119321bfa..00000000000 --- a/apps/testnorge-tp/src/test/resources/application-test.properties +++ /dev/null @@ -1,9 +0,0 @@ -consumers.hodejegeren.url = http://localhost:${wiremock.server.port:0}/hodejegeren - -environments=q11, q2 - -spring.cloud.vault.enabled=false - -AAD_ISSUER_URI=http://localhost:${wiremock.server.port:0}/aad -azure.app.client.id: dummy -azure.app.client.secret: dummy diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/applikasjonsanalyseservice/v1/ApplicationInfoDTO.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/applikasjonsanalyseservice/v1/ApplicationInfoDTO.java deleted file mode 100644 index e8f5da336ef..00000000000 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/applikasjonsanalyseservice/v1/ApplicationInfoDTO.java +++ /dev/null @@ -1,19 +0,0 @@ -package no.nav.testnav.libs.dto.applikasjonsanalyseservice.v1; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.NoArgsConstructor; -import lombok.Value; - -import java.util.Set; - -@Value -@Builder -@AllArgsConstructor -@NoArgsConstructor(force = true) -public class ApplicationInfoDTO { - String name; - String cluster; - String namespace; - Set dependencies; -} diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/applikasjonsanalyseservice/v1/DependencyDTO.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/applikasjonsanalyseservice/v1/DependencyDTO.java deleted file mode 100644 index 46e925dda9e..00000000000 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/applikasjonsanalyseservice/v1/DependencyDTO.java +++ /dev/null @@ -1,16 +0,0 @@ -package no.nav.testnav.libs.dto.applikasjonsanalyseservice.v1; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.NoArgsConstructor; -import lombok.Value; - -@Value -@Builder -@AllArgsConstructor -@NoArgsConstructor(force = true) -public class DependencyDTO { - String name; - String cluster; - String namespace; -} diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/bridge/v1/ContentDTO.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/bridge/v1/ContentDTO.java deleted file mode 100644 index a1fd00727cd..00000000000 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/bridge/v1/ContentDTO.java +++ /dev/null @@ -1,15 +0,0 @@ -package no.nav.testnav.libs.dto.bridge.v1; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.NoArgsConstructor; -import lombok.Value; - -@Value -@Builder -@AllArgsConstructor -@NoArgsConstructor(force = true) -public class ContentDTO { - String key; - byte[] content; -} \ No newline at end of file diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/dependencyanalysis/v1/ApplicationDependenciesDTO.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/dependencyanalysis/v1/ApplicationDependenciesDTO.java deleted file mode 100644 index 3510677fed7..00000000000 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/dependencyanalysis/v1/ApplicationDependenciesDTO.java +++ /dev/null @@ -1,22 +0,0 @@ -package no.nav.testnav.libs.dto.dependencyanalysis.v1; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.Value; - -import java.util.Set; - -@Value -@Builder -@AllArgsConstructor -@NoArgsConstructor(force = true) -@EqualsAndHashCode -public class ApplicationDependenciesDTO { - @JsonProperty(required = true) - String applicationName; - @JsonProperty(required = true) - Set dependencies; -} diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/dependencyanalysis/v1/DependencyDTO.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/dependencyanalysis/v1/DependencyDTO.java deleted file mode 100644 index 48397e84023..00000000000 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/dependencyanalysis/v1/DependencyDTO.java +++ /dev/null @@ -1,19 +0,0 @@ -package no.nav.testnav.libs.dto.dependencyanalysis.v1; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.NoArgsConstructor; -import lombok.Value; - -@Value -@Builder -@AllArgsConstructor -@NoArgsConstructor(force = true) -public class DependencyDTO { - - @JsonProperty(required = true) - String name; - @JsonProperty(required = true) - Boolean external; -} diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/hendelse/v1/HendelseDTO.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/hendelse/v1/HendelseDTO.java deleted file mode 100644 index c97c7066027..00000000000 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/hendelse/v1/HendelseDTO.java +++ /dev/null @@ -1,24 +0,0 @@ -package no.nav.testnav.libs.dto.hendelse.v1; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.NoArgsConstructor; -import lombok.Value; - -import java.time.LocalDate; - -@Value -@Builder -@AllArgsConstructor -@NoArgsConstructor(force = true) -public class HendelseDTO { - @JsonProperty(required = true) - String ident; - @JsonProperty(required = true) - LocalDate fom; - @JsonProperty - LocalDate tom; - @JsonProperty(required = true) - HendelseType type; -} diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/hendelse/v1/HendelseType.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/hendelse/v1/HendelseType.java deleted file mode 100644 index a5201198291..00000000000 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/hendelse/v1/HendelseType.java +++ /dev/null @@ -1,6 +0,0 @@ -package no.nav.testnav.libs.dto.hendelse.v1; - -public enum HendelseType { - SYKEMELDING_OPPRETTET, - ARBEIDSFORHOLD_OPPRETTET -} \ No newline at end of file diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/identpool/v1/FiktiveNavnDTO.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/identpool/v1/FiktiveNavnDTO.java deleted file mode 100644 index c4048ac2004..00000000000 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/identpool/v1/FiktiveNavnDTO.java +++ /dev/null @@ -1,18 +0,0 @@ -package no.nav.testnav.libs.dto.identpool.v1; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.NoArgsConstructor; -import lombok.Value; - -@Value -@Builder -@AllArgsConstructor -@NoArgsConstructor(force = true) -public class FiktiveNavnDTO { - @JsonProperty - String fornavn; - @JsonProperty - String etternavn; -} diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organiasjonbestilling/v1/ItemDTO.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organisajonbestilling/v1/ItemDTO.java similarity index 80% rename from libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organiasjonbestilling/v1/ItemDTO.java rename to libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organisajonbestilling/v1/ItemDTO.java index 67426c36c2e..b5abdea12a1 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organiasjonbestilling/v1/ItemDTO.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organisajonbestilling/v1/ItemDTO.java @@ -1,4 +1,4 @@ -package no.nav.testnav.libs.dto.organiasjonbestilling.v1; +package no.nav.testnav.libs.dto.organisajonbestilling.v1; import lombok.AllArgsConstructor; diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organiasjonbestilling/v1/OrderDTO.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organisajonbestilling/v1/OrderDTO.java similarity index 80% rename from libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organiasjonbestilling/v1/OrderDTO.java rename to libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organisajonbestilling/v1/OrderDTO.java index 52670e1b395..a557e89f9dd 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organiasjonbestilling/v1/OrderDTO.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organisajonbestilling/v1/OrderDTO.java @@ -1,4 +1,4 @@ -package no.nav.testnav.libs.dto.organiasjonbestilling.v1; +package no.nav.testnav.libs.dto.organisajonbestilling.v1; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organiasjonbestilling/v1/Status.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organisajonbestilling/v1/Status.java similarity index 61% rename from libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organiasjonbestilling/v1/Status.java rename to libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organisajonbestilling/v1/Status.java index e2fa1476287..34cf934e588 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organiasjonbestilling/v1/Status.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organisajonbestilling/v1/Status.java @@ -1,4 +1,4 @@ -package no.nav.testnav.libs.dto.organiasjonbestilling.v1; +package no.nav.testnav.libs.dto.organisajonbestilling.v1; public enum Status { NOT_STARTED, diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organiasjonbestilling/v2/OrderDTO.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organisajonbestilling/v2/OrderDTO.java similarity index 89% rename from libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organiasjonbestilling/v2/OrderDTO.java rename to libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organisajonbestilling/v2/OrderDTO.java index d111af26dcb..45666c91ba3 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organiasjonbestilling/v2/OrderDTO.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organisajonbestilling/v2/OrderDTO.java @@ -1,4 +1,4 @@ -package no.nav.testnav.libs.dto.organiasjonbestilling.v2; +package no.nav.testnav.libs.dto.organisajonbestilling.v2; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.AllArgsConstructor; diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organiasjonbestilling/v2/Status.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organisajonbestilling/v2/Status.java similarity index 87% rename from libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organiasjonbestilling/v2/Status.java rename to libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organisajonbestilling/v2/Status.java index 3afab0c6fe8..c22e2b03845 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organiasjonbestilling/v2/Status.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organisajonbestilling/v2/Status.java @@ -1,4 +1,4 @@ -package no.nav.testnav.libs.dto.organiasjonbestilling.v2; +package no.nav.testnav.libs.dto.organisajonbestilling.v2; public enum Status { diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organiasjonbestilling/v2/StatusDTO.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organisajonbestilling/v2/StatusDTO.java similarity index 94% rename from libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organiasjonbestilling/v2/StatusDTO.java rename to libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organisajonbestilling/v2/StatusDTO.java index d56d4e14ed5..53f2eab4b61 100644 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organiasjonbestilling/v2/StatusDTO.java +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/organisajonbestilling/v2/StatusDTO.java @@ -1,4 +1,4 @@ -package no.nav.testnav.libs.dto.organiasjonbestilling.v2; +package no.nav.testnav.libs.dto.organisajonbestilling.v2; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/rapprtering/v1/EntryStatus.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/rapprtering/v1/EntryStatus.java deleted file mode 100644 index 731f65a4c08..00000000000 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/rapprtering/v1/EntryStatus.java +++ /dev/null @@ -1,7 +0,0 @@ -package no.nav.testnav.libs.dto.rapprtering.v1; - -public enum EntryStatus { - INFO, - WARNING, - ERROR -} diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/samhandlerregisteret/v1/IdentDTO.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/samhandlerregisteret/v1/IdentDTO.java deleted file mode 100644 index e1a4aa0730d..00000000000 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/samhandlerregisteret/v1/IdentDTO.java +++ /dev/null @@ -1,18 +0,0 @@ -package no.nav.testnav.libs.dto.samhandlerregisteret.v1; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.NoArgsConstructor; -import lombok.Value; - -@Value -@Builder -@AllArgsConstructor -@NoArgsConstructor(force = true) -public class IdentDTO { - @JsonProperty("ident") - private final String ident; - @JsonProperty("ident_type_kode") - private final String identTypeKode; -} diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/samhandlerregisteret/v1/SamhandlerDTO.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/samhandlerregisteret/v1/SamhandlerDTO.java deleted file mode 100644 index d19a7a57528..00000000000 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/samhandlerregisteret/v1/SamhandlerDTO.java +++ /dev/null @@ -1,22 +0,0 @@ -package no.nav.testnav.libs.dto.samhandlerregisteret.v1; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.NoArgsConstructor; -import lombok.Value; - -import java.util.List; - -@Value -@Builder -@AllArgsConstructor -@NoArgsConstructor(force = true) -public class SamhandlerDTO { - - @JsonProperty("samh_ident") - private final List identer; - - @JsonProperty("samh_type_kode") - private final String kode; -} \ No newline at end of file diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/statistikkservice/v1/StatistikkDTO.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/statistikkservice/v1/StatistikkDTO.java deleted file mode 100644 index fa40033cea0..00000000000 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/statistikkservice/v1/StatistikkDTO.java +++ /dev/null @@ -1,22 +0,0 @@ -package no.nav.testnav.libs.dto.statistikkservice.v1; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.NoArgsConstructor; -import lombok.Value; - -@Value -@Builder -@AllArgsConstructor -@NoArgsConstructor(force = true) -public class StatistikkDTO { - @JsonProperty(required = true) - StatistikkType type; - @JsonProperty - String description; - @JsonProperty(required = true) - Double value; - @JsonProperty(required = true) - StatistikkValueType valueType; -} diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/statistikkservice/v1/StatistikkType.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/statistikkservice/v1/StatistikkType.java deleted file mode 100644 index 1b67ab1fea5..00000000000 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/statistikkservice/v1/StatistikkType.java +++ /dev/null @@ -1,9 +0,0 @@ -package no.nav.testnav.libs.dto.statistikkservice.v1; - -public enum StatistikkType { - ANTALL_ARBEIDSTAKERE_SYKEMELDT, - ANTALL_ARBEIDSTAKERE_SOM_ER_I_ARBEIDSSTYRKEN, - ANDEL_PERSONER_ALDER_0_19, - ANDEL_PERSONER_ALDER_20_64, - ANDEL_PERSONER_ALDER_OVER_65 -} diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/statistikkservice/v1/StatistikkValueType.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/statistikkservice/v1/StatistikkValueType.java deleted file mode 100644 index f25624d7787..00000000000 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/statistikkservice/v1/StatistikkValueType.java +++ /dev/null @@ -1,6 +0,0 @@ -package no.nav.testnav.libs.dto.statistikkservice.v1; - -public enum StatistikkValueType { - PERCENTAGE, - COUNT -} diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/v1/AdresseDTO.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/v1/AdresseDTO.java deleted file mode 100644 index 015842c0e26..00000000000 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/v1/AdresseDTO.java +++ /dev/null @@ -1,18 +0,0 @@ -package no.nav.testnav.libs.dto.v1; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.NoArgsConstructor; -import lombok.Value; - -@Value -@Builder -@AllArgsConstructor -@NoArgsConstructor(force = true) -public class AdresseDTO { - - String gatenavn; - String postnummer; - String poststed; - String kommunenummer; -} diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/v1/PersonDTO.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/v1/PersonDTO.java deleted file mode 100644 index f6635b6ba98..00000000000 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/v1/PersonDTO.java +++ /dev/null @@ -1,23 +0,0 @@ -package no.nav.testnav.libs.dto.v1; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.NoArgsConstructor; -import lombok.Value; - -import java.util.Set; - -@Value -@Builder -@AllArgsConstructor -@NoArgsConstructor(force = true) -public class PersonDTO { - String ident; - String fornavn; - String etternavn; - String adresse; - String postnr; - String by; - String opprinnelse; - Set tags; -} diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/v1/Persondatasystem.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/v1/Persondatasystem.java deleted file mode 100644 index 586aaa9bf71..00000000000 --- a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/v1/Persondatasystem.java +++ /dev/null @@ -1,6 +0,0 @@ -package no.nav.testnav.libs.dto.v1; - -public enum Persondatasystem { - TPS, - PDL -} diff --git a/proxies/kodeverk-proxy/config.yml b/proxies/kodeverk-proxy/config.yml index f7d53901b76..68586f77a9c 100644 --- a/proxies/kodeverk-proxy/config.yml +++ b/proxies/kodeverk-proxy/config.yml @@ -33,8 +33,6 @@ spec: cluster: dev-gcp - application: testnav-oversikt-frontend cluster: dev-gcp - - application: testnav-person-export-api - cluster: dev-gcp - application: app-1 namespace: plattformsikkerhet cluster: dev-gcp diff --git a/proxies/statisk-data-forvalter-proxy/Dockerfile b/proxies/statisk-data-forvalter-proxy/Dockerfile deleted file mode 100644 index 4a36f93546f..00000000000 --- a/proxies/statisk-data-forvalter-proxy/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM ghcr.io/navikt/baseimages/temurin:21 -LABEL maintainer="Team Dolly" - -ENV JAVA_OPTS="-Dspring.profiles.active=prod" - -ADD /build/libs/app.jar /app/app.jar - -EXPOSE 8080 diff --git a/proxies/statisk-data-forvalter-proxy/build.gradle b/proxies/statisk-data-forvalter-proxy/build.gradle deleted file mode 100644 index 9b560f4f315..00000000000 --- a/proxies/statisk-data-forvalter-proxy/build.gradle +++ /dev/null @@ -1,80 +0,0 @@ -plugins { - id 'java' - id "org.sonarqube" version "4.0.0.2929" - id 'org.springframework.boot' version "3.1.4" - id 'io.spring.dependency-management' version "1.1.3" - id "jacoco" -} - -test { - useJUnitPlatform() -} - -jacocoTestReport { - reports { - xml.required = true - } -} - -sonarqube { - properties { - property "sonar.coverage.jacoco.xmlReportPaths", "${project.buildDir}/reports/jacoco/test/jacocoTestReport.xml" - property "sonar.dynamicAnalysis", "reuseReports" - property "sonar.host.url", "https://sonarcloud.io" - property "sonar.java.coveragePlugin", "jacoco" - property "sonar.language", "java" - property "sonar.login", System.getenv("SONAR_TOKEN") - property "sonar.organization", "navikt" - property "sonar.project.monorepo.enabled", true - property "sonar.projectKey", "testnav-statisk-data-forvalter-proxy" - property "sonar.projectName", "testnav-statisk-data-forvalter-proxy" - property "sonar.sourceEncoding", "UTF-8" - } -} - -bootJar { - archiveFileName = "app.jar" -} - -dependencyManagement { - applyMavenExclusions = false - imports { - mavenBom 'org.springframework.cloud:spring-cloud-dependencies:2022.0.4' - } -} - -repositories { - mavenCentral() - mavenLocal() -} - -dependencies { - - implementation 'no.nav.testnav.libs:security-core' - implementation 'no.nav.testnav.libs:reactive-core' - implementation 'no.nav.testnav.libs:reactive-proxy' - implementation 'no.nav.testnav.libs:reactive-security' - implementation 'no.nav.testnav.libs:data-transfer-objects' - - implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server' - implementation 'org.springframework.boot:spring-boot-starter-webflux' - implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap' // TODO remove legacy bootstrap config - implementation 'org.springframework.cloud:spring-cloud-starter-vault-config' - implementation 'org.springframework.cloud:spring-cloud-starter-gateway' - - - implementation 'net.logstash.logback:logstash-logback-encoder:7.4' - implementation 'org.hibernate.validator:hibernate-validator' - - testImplementation 'org.springframework.boot:spring-boot-starter-test' - testImplementation 'org.springframework.cloud:spring-cloud-contract-wiremock' - - annotationProcessor 'org.projectlombok:lombok' - implementation 'org.projectlombok:lombok' - testAnnotationProcessor 'org.projectlombok:lombok' -} -java { - toolchain { - languageVersion = JavaLanguageVersion.of(21) - } -} diff --git a/proxies/statisk-data-forvalter-proxy/config.yml b/proxies/statisk-data-forvalter-proxy/config.yml deleted file mode 100644 index 290dcac8cc9..00000000000 --- a/proxies/statisk-data-forvalter-proxy/config.yml +++ /dev/null @@ -1,57 +0,0 @@ -apiVersion: "nais.io/v1alpha1" -kind: "Application" -metadata: - name: testnav-statisk-data-forvalter-proxy - namespace: dolly - labels: - team: dolly -spec: - image: {{image}} - port: 8080 - webproxy: true - azure: - application: - allowAllUsers: true - enabled: true - tenant: nav.no - accessPolicy: - inbound: - rules: - - application: team-dolly-lokal-app - cluster: dev-gcp - - application: dolly-frontend - cluster: dev-gcp - - application: dolly-idporten - cluster: dev-gcp - - application: dolly-frontend-dev - cluster: dev-gcp - - application: testnav-oversikt-frontend - cluster: dev-gcp - - application: app-1 - namespace: plattformsikkerhet - cluster: dev-gcp - outbound: - rules: - - application: testnorge-statisk-data-forvalter - cluster: dev-fss - liveness: - path: /internal/isAlive - initialDelay: 4 - periodSeconds: 5 - failureThreshold: 500 - readiness: - path: /internal/isReady - initialDelay: 4 - periodSeconds: 5 - failureThreshold: 500 - replicas: - min: 1 - max: 1 - resources: - requests: - cpu: 200m - memory: 1024Mi - limits: - memory: 2048Mi - ingresses: - - "https://testnav-statisk-data-forvalter-proxy.dev-fss-pub.nais.io" diff --git a/proxies/statisk-data-forvalter-proxy/gradle/wrapper/gradle-wrapper.jar b/proxies/statisk-data-forvalter-proxy/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index e708b1c023e..00000000000 Binary files a/proxies/statisk-data-forvalter-proxy/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/proxies/statisk-data-forvalter-proxy/gradle/wrapper/gradle-wrapper.properties b/proxies/statisk-data-forvalter-proxy/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index e411586a54a..00000000000 --- a/proxies/statisk-data-forvalter-proxy/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/proxies/statisk-data-forvalter-proxy/gradlew b/proxies/statisk-data-forvalter-proxy/gradlew deleted file mode 100755 index 4f906e0c811..00000000000 --- a/proxies/statisk-data-forvalter-proxy/gradlew +++ /dev/null @@ -1,185 +0,0 @@ -#!/usr/bin/env sh - -# -# Copyright 2015 the original author or authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -exec "$JAVACMD" "$@" diff --git a/proxies/statisk-data-forvalter-proxy/gradlew.bat b/proxies/statisk-data-forvalter-proxy/gradlew.bat deleted file mode 100644 index 107acd32c4e..00000000000 --- a/proxies/statisk-data-forvalter-proxy/gradlew.bat +++ /dev/null @@ -1,89 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/proxies/statisk-data-forvalter-proxy/settings.gradle b/proxies/statisk-data-forvalter-proxy/settings.gradle deleted file mode 100644 index 05588c69ea3..00000000000 --- a/proxies/statisk-data-forvalter-proxy/settings.gradle +++ /dev/null @@ -1,19 +0,0 @@ -plugins { - id "com.gradle.enterprise" version "3.12.3" -} - -rootProject.name = 'statisk-data-forvalter-proxy' - - -includeBuild '../../libs/security-core' -includeBuild '../../libs/reactive-core' -includeBuild '../../libs/reactive-proxy' -includeBuild '../../libs/reactive-security' -includeBuild '../../libs/data-transfer-objects' - -gradleEnterprise { - buildScan { - termsOfServiceUrl = "https://gradle.com/terms-of-service" - termsOfServiceAgree = "yes" - } -} diff --git a/proxies/statisk-data-forvalter-proxy/src/main/java/no/nav/testnav/proxies/statiskdataforvalterproxy/Consumers.java b/proxies/statisk-data-forvalter-proxy/src/main/java/no/nav/testnav/proxies/statiskdataforvalterproxy/Consumers.java deleted file mode 100644 index 04809bcf12a..00000000000 --- a/proxies/statisk-data-forvalter-proxy/src/main/java/no/nav/testnav/proxies/statiskdataforvalterproxy/Consumers.java +++ /dev/null @@ -1,29 +0,0 @@ -package no.nav.testnav.proxies.statiskdataforvalterproxy; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import static lombok.AccessLevel.PACKAGE; - -/** - * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. - *

- * Husk at Spring Boot bruker relaxed binding - * mellom configuration properties og field names. - * - * @see ServerProperties - */ -@Configuration -@ConfigurationProperties(prefix = "consumers") -@NoArgsConstructor(access = PACKAGE) -@Getter -@Setter(PACKAGE) -public class Consumers { - - private ServerProperties statiskdataforvalter; - -} diff --git a/proxies/statisk-data-forvalter-proxy/src/main/java/no/nav/testnav/proxies/statiskdataforvalterproxy/StatiskDataForvalterProxyApplicationStarter.java b/proxies/statisk-data-forvalter-proxy/src/main/java/no/nav/testnav/proxies/statiskdataforvalterproxy/StatiskDataForvalterProxyApplicationStarter.java deleted file mode 100644 index 634d061bcee..00000000000 --- a/proxies/statisk-data-forvalter-proxy/src/main/java/no/nav/testnav/proxies/statiskdataforvalterproxy/StatiskDataForvalterProxyApplicationStarter.java +++ /dev/null @@ -1,51 +0,0 @@ -package no.nav.testnav.proxies.statiskdataforvalterproxy; - -import no.nav.testnav.libs.reactivecore.config.CoreConfig; -import no.nav.testnav.libs.reactiveproxy.config.DevConfig; -import no.nav.testnav.libs.reactiveproxy.config.SecurityConfig; -import no.nav.testnav.libs.reactiveproxy.filter.AddAuthenticationRequestGatewayFilterFactory; -import no.nav.testnav.libs.reactivesecurity.config.SecureOAuth2ServerToServerConfiguration; -import no.nav.testnav.libs.reactivesecurity.exchange.azuread.NavAzureAdTokenService; -import no.nav.testnav.libs.securitycore.domain.AccessToken; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.gateway.route.RouteLocator; -import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Import; - -@Import({ - CoreConfig.class, - DevConfig.class, - SecurityConfig.class, - SecureOAuth2ServerToServerConfiguration.class -}) -@SpringBootApplication -public class StatiskDataForvalterProxyApplicationStarter { - - public static void main(String[] args) { - SpringApplication.run(StatiskDataForvalterProxyApplicationStarter.class, args); - } - - @Bean - public RouteLocator customRouteLocator( - RouteLocatorBuilder builder, - NavAzureAdTokenService tokenService, - Consumers consumers - ) { - var addAuthenticationHeaderDevFilter = AddAuthenticationRequestGatewayFilterFactory - .bearerAuthenticationHeaderFilter( - () -> tokenService - .exchange(consumers.getStatiskdataforvalter()) - .map(AccessToken::getTokenValue)); - return builder - .routes() - .route( - spec -> spec - .path("/**") - .filters(filterSpec -> filterSpec.filter(addAuthenticationHeaderDevFilter)) - .uri(consumers.getStatiskdataforvalter().getUrl())) - .build(); - } - -} diff --git a/proxies/statisk-data-forvalter-proxy/src/main/java/no/nav/testnav/proxies/statiskdataforvalterproxy/StatusController.java b/proxies/statisk-data-forvalter-proxy/src/main/java/no/nav/testnav/proxies/statiskdataforvalterproxy/StatusController.java deleted file mode 100644 index e73d70ea184..00000000000 --- a/proxies/statisk-data-forvalter-proxy/src/main/java/no/nav/testnav/proxies/statiskdataforvalterproxy/StatusController.java +++ /dev/null @@ -1,64 +0,0 @@ -package no.nav.testnav.proxies.statiskdataforvalterproxy; - -import no.nav.testnav.libs.dto.status.v1.TestnavStatusResponse; -import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.reactive.function.client.WebClient; -import reactor.core.publisher.Mono; - -import java.util.Map; - -@RestController -public class StatusController { - private static final String TEAM = "Team Dolly"; - - @GetMapping(value = "/internal/status", produces = MediaType.APPLICATION_JSON_VALUE) - public Map getStatus() { - var statusWebClient = WebClient.builder().build(); - - var status = checkConsumerStatus( - "http://testnorge-statisk-data-forvalter.dolly.svc.nais.local" + "/internal/isAlive", - "http://testnorge-statisk-data-forvalter.dolly.svc.nais.local" + "/internal/isReady", - statusWebClient); - - return Map.of( - "testnorge-statisk-data-forvalter", status - ); - } - - public TestnavStatusResponse checkConsumerStatus(String aliveUrl, String readyUrl, WebClient webClient) { - TestnavStatusResponse status = TestnavStatusResponse.builder().team(TEAM).build(); - - Thread blockingThread = new Thread(() -> { - status.setAlive( - checkStatus(webClient, aliveUrl) - .blockOptional() - .orElse("Error: Empty response") - ); - status.setReady( - checkStatus(webClient, readyUrl) - .blockOptional() - .orElse("Error: Empty response") - ); - }); - blockingThread.start(); - try { - blockingThread.join(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } - - return status; - } - - private Mono checkStatus(WebClient webClient, String url) { - return webClient.get().uri(url) - .retrieve() - .bodyToMono(String.class) - .defaultIfEmpty("OK") - .onErrorResume(Exception.class, error -> Mono.just("Error: " + error.getMessage())) - .doOnSuccess(result -> Mono.just("OK")) - .map(result -> result.startsWith("Error:") ? result : "OK"); - } -} diff --git a/proxies/statisk-data-forvalter-proxy/src/main/resources/application.yml b/proxies/statisk-data-forvalter-proxy/src/main/resources/application.yml deleted file mode 100644 index fd8fefcd209..00000000000 --- a/proxies/statisk-data-forvalter-proxy/src/main/resources/application.yml +++ /dev/null @@ -1,28 +0,0 @@ -AAD_ISSUER_URI: https://login.microsoftonline.com/62366534-1ec3-4962-8869-9b5535279d0b - -spring: - application: - name: testnav-statisk-data-forvalter-proxy - description: Proxy for statisk data forvalter som legger på sikkerhet. - security: - oauth2: - resourceserver: - aad: - issuer-uri: ${AAD_ISSUER_URI}/v2.0 - jwk-set-uri: ${AAD_ISSUER_URI}/discovery/v2.0/keys - accepted-audience: ${azure.app.client.id}, api://${azure.app.client.id} - tokenx: - issuer-uri: https://tokenx.dev-gcp.nav.cloud.nais.io - jwk-set-uri: https://tokenx.dev-gcp.nav.cloud.nais.io/jwks - accepted-audience: ${TOKEN_X_CLIENT_ID} - cloud: - gateway: - httpclient: - response-timeout: 30s - -consumers: - statiskdataforvalter: - name: testnorge-statisk-data-forvalter - namespace: dolly - url: http://testnorge-statisk-data-forvalter.dolly.svc.nais.local - cluster: dev-fss diff --git a/proxies/statisk-data-forvalter-proxy/src/main/resources/bootstrap.yml b/proxies/statisk-data-forvalter-proxy/src/main/resources/bootstrap.yml deleted file mode 100644 index 0451449ca23..00000000000 --- a/proxies/statisk-data-forvalter-proxy/src/main/resources/bootstrap.yml +++ /dev/null @@ -1,4 +0,0 @@ -spring: - cloud: - vault: - enabled: false \ No newline at end of file diff --git a/proxies/statisk-data-forvalter-proxy/src/main/resources/logback-spring.xml b/proxies/statisk-data-forvalter-proxy/src/main/resources/logback-spring.xml deleted file mode 100644 index 52c15597b3c..00000000000 --- a/proxies/statisk-data-forvalter-proxy/src/main/resources/logback-spring.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - true - 256 - 10280 - 20 - ^sun\.reflect\..*\.invoke - ^net\.sf\.cglib\.proxy\.MethodProxy\.invoke - java\.util\.concurrent\..* - org\.apache\.catalina\..* - org\.apache\.coyote\..* - org\.apache\.tomcat\..* - - - - - - - - - - - - - %d{HH:mm:ss.SSS} | %5p | %logger{25} | %m%n - - utf8 - - - - - - - - - \ No newline at end of file diff --git a/proxies/statisk-data-forvalter-proxy/src/test/java/no/nav/testnav/proxies/statiskdataforvalterproxy/ApplicationContextTest.java b/proxies/statisk-data-forvalter-proxy/src/test/java/no/nav/testnav/proxies/statiskdataforvalterproxy/ApplicationContextTest.java deleted file mode 100644 index a5a3818f74a..00000000000 --- a/proxies/statisk-data-forvalter-proxy/src/test/java/no/nav/testnav/proxies/statiskdataforvalterproxy/ApplicationContextTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package no.nav.testnav.proxies.statiskdataforvalterproxy; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.security.oauth2.jwt.ReactiveJwtDecoder; -import org.springframework.test.context.ActiveProfiles; - -@SpringBootTest -@ActiveProfiles("test") -class ApplicationContextTest { - - @MockBean - public ReactiveJwtDecoder reactiveJwtDecoder; - - @Test - @SuppressWarnings("java:S2699") - void load_app_context() { - } -} diff --git a/proxies/statisk-data-forvalter-proxy/src/test/resources/application-test.properties b/proxies/statisk-data-forvalter-proxy/src/test/resources/application-test.properties deleted file mode 100644 index 18ea64dc24a..00000000000 --- a/proxies/statisk-data-forvalter-proxy/src/test/resources/application-test.properties +++ /dev/null @@ -1,4 +0,0 @@ -spring.cloud.vault.token=dummy -azure.app.client.id=dummy -azure.app.client.secret=dummy -proxy.url=http://localhost \ No newline at end of file diff --git a/proxies/tps-forvalteren-proxy/config.yml b/proxies/tps-forvalteren-proxy/config.yml index cb513b61997..fe5c16c953e 100644 --- a/proxies/tps-forvalteren-proxy/config.yml +++ b/proxies/tps-forvalteren-proxy/config.yml @@ -36,12 +36,8 @@ spec: cluster: dev-gcp - application: dolly-backend cluster: dev-gcp - - application: testnav-person-export-api - cluster: dev-gcp - application: testnorge-hodejegeren cluster: dev-fss - - application: testnorge-statisk-data-forvalter - cluster: dev-fss liveness: path: /internal/isAlive initialDelay: 4 diff --git a/settings.gradle b/settings.gradle index 2bcf524ddf1..4c0e59d4e0f 100644 --- a/settings.gradle +++ b/settings.gradle @@ -22,7 +22,6 @@ gradleEnterprise { } includeBuild './proxies/kodeverk-proxy' -includeBuild './proxies/statisk-data-forvalter-proxy' includeBuild './proxies/udistub-proxy' includeBuild './proxies/skjermingsregister-proxy' includeBuild './proxies/batch-adeo-proxy' @@ -80,14 +79,12 @@ includeBuild './apps/endringsmelding-service' includeBuild './apps/adresse-service' includeBuild './apps/pdl-forvalter' includeBuild './apps/amelding-service' -includeBuild './apps/arbeidsforhold-export-api' includeBuild './apps/arbeidsforhold-service' includeBuild './apps/varslinger-service' includeBuild './apps/dolly-frontend' includeBuild './apps/budpro-service' includeBuild './apps/dolly-backend' includeBuild './apps/synt-sykemelding-api' -includeBuild './apps/import-person-service' includeBuild './apps/jenkins-batch-status-service' includeBuild './apps/organisasjon-bestilling-service' includeBuild './apps/geografiske-kodeverk-service' @@ -97,7 +94,6 @@ includeBuild './apps/organisasjon-forvalter' includeBuild './apps/organisasjon-tilgang-service' includeBuild './apps/person-organisasjon-tilgang-service' includeBuild './apps/bruker-service' -includeBuild './apps/testnorge-tp' includeBuild './apps/testnorge-statisk-data-forvalter' includeBuild './apps/generer-arbeidsforhold-populasjon-service' includeBuild './apps/mn-synt-arbeidsforhold-service' @@ -119,7 +115,6 @@ includeBuild './apps/oppsummeringsdokument-service' includeBuild './apps/sykemelding-api' includeBuild './apps/person-search-service' includeBuild './apps/person-faste-data-service' -includeBuild './apps/person-export-api' includeBuild './apps/organisasjon-service' includeBuild './apps/hodejegeren' includeBuild './apps/tilbakemelding-api'