Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/maven/com.ibm.mq-com.ibm.mq.jakar…
Browse files Browse the repository at this point in the history
…ta.client-9.3.4.1
  • Loading branch information
idaame authored Jan 31, 2024
2 parents d36fe6b + 7d7a7ba commit 3c8e4b8
Show file tree
Hide file tree
Showing 102 changed files with 1,907 additions and 1,161 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/build-and-deploy-preprod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,25 @@ jobs:
permissions:
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: 'temurin'
cache: 'maven'
- name: Bygg med maven + sonar
- name: Bygg med maven
env:
SONAR_PROJECTKEY: ${{ secrets.SONAR_PROJECTKEY }}
SONAR_LOGIN: ${{ secrets.SONAR_LOGIN }}
GITHUB_USERNAME: x-access-token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: mvn -B --no-transfer-progress package verify sonar:sonar --settings .m2/maven-settings.xml --file pom.xml
run: mvn -B --no-transfer-progress package verify --settings .m2/maven-settings.xml --file pom.xml
- name: Bygg Docker image
run: |
docker build -t $IMAGE .
- name: Login to GitHub Container Registry
if: github.triggering_actor != 'dependabot[bot]'
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand All @@ -49,9 +46,9 @@ jobs:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Deploy til dev-fss team namespace
uses: nais/deploy/actions/deploy@v1
uses: nais/deploy/actions/deploy@v2
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-fss
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/build-and-deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
permissions:
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: 'temurin'
cache: 'maven'
- name: Bygg med maven
Expand Down Expand Up @@ -49,15 +49,15 @@ jobs:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Deploy til dev-fss team namespace
uses: nais/deploy/actions/deploy@v1
uses: nais/deploy/actions/deploy@v2
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-fss
RESOURCE: app-preprod.yaml
- name: Deploy til prod-fss team namespace
uses: nais/deploy/actions/deploy@v1
uses: nais/deploy/actions/deploy@v2
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: prod-fss
Expand Down
90 changes: 90 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "main" ]

jobs:
analyze:
name: Analyze
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
# required for all workflows
security-events: write

# only required for workflows in private repositories
actions: read
contents: read

strategy:
fail-fast: false
matrix:
language: [ 'java-kotlin' ]
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Sett opp java
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'
cache: 'maven'
- name: Bygg med maven
env:
GITHUB_USERNAME: x-access-token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn -B --no-transfer-progress compile --settings .m2/maven-settings.xml


# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/navikt/baseimages/temurin:17-appdynamics
FROM ghcr.io/navikt/baseimages/temurin:21-appdynamics

ENV APPD_ENABLED=true
ENV APP_NAME=familie-oppdrag
Expand Down
4 changes: 1 addition & 3 deletions app-preprod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ spec:
external:
- host: b27apvl220.preprod.local
ports:
- name: mq
port: 1413
protocol: TCP
- port: 1413
env:
- name: SPRING_PROFILES_ACTIVE
value: preprod
Expand Down
4 changes: 1 addition & 3 deletions app-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ spec:
external:
- host: mpls02.adeo.no
ports:
- name: mq
port: 1414
protocol: TCP
- port: 1414
env:
- name: SPRING_PROFILES_ACTIVE
value: prod
Expand Down
55 changes: 13 additions & 42 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.2</version>
<version>3.2.2</version>
</parent>

<properties>
<revision>1.0</revision>
<sha1/>
<changelist>-SNAPSHOT</changelist>
<jvmTarget>17</jvmTarget>
<kotlin.version>1.9.0</kotlin.version>
<jvmTarget>21</jvmTarget>
<kotlin.version>1.9.22</kotlin.version>
<main-class>no.nav.familie.oppdrag.LauncherKt</main-class>
<felles.version>2.20230508082643_6b28bd8</felles.version>
<kontrakter.version>3.0_20230808083340_ced4750</kontrakter.version>
<token-validation-spring.version>3.1.2</token-validation-spring.version>
<felles.version>2.20240123084817_35f03aa</felles.version>
<kontrakter.version>3.0_20240122110213_5591a29</kontrakter.version>
<token-validation-spring.version>3.2.0</token-validation-spring.version>

<!--
denne må oppdateres manuellt då eks `mvn versions:update-properties` henter versjon 2023.
Expand All @@ -35,18 +35,10 @@
<cxf.version>4.0.2</cxf.version>

<mockk.version>1.13.5</mockk.version>
<!--suppress UnresolvedMavenProperty Ligger som secret i github-->
<sonar.projectKey>${SONAR_PROJECTKEY}</sonar.projectKey>
<sonar.organization>navit</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.coverage.exclusions>**/config/FlywayConfig.kt,**/OppdragServiceE2E.kt
</sonar.coverage.exclusions>
<!--suppress UnresolvedMavenProperty Ligger som secret i github-->
<sonar.login>${SONAR_LOGIN}</sonar.login>
<spring-cloud.version>2022.0.4</spring-cloud.version>
<testcontainers.version>1.18.3</testcontainers.version>
<spring-cloud.version>2023.0.0</spring-cloud.version>
<testcontainers.version>1.19.3</testcontainers.version>
<tjenestespesifikasjoner.version>1.0_20230718100517_1e1beb0</tjenestespesifikasjoner.version>
<springdoc.version>2.2.0</springdoc.version>
<springdoc.version>2.3.0</springdoc.version>

</properties>

Expand Down Expand Up @@ -155,7 +147,7 @@
<dependency>
<groupId>org.messaginghub</groupId>
<artifactId>pooled-jms</artifactId>
<version>3.1.0</version>
<version>3.1.5</version>
</dependency>


Expand Down Expand Up @@ -445,27 +437,6 @@
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
<finalName>${project.artifactId}</finalName>

<pluginManagement>
<plugins>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.9.1.2184</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.10</version>
<configuration>
<excludes>
<exclude>**/config/FlywayConfig.kt</exclude>
<exclude>**/config/OppdragMQConfig.kt</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</pluginManagement>

<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
Expand Down Expand Up @@ -540,9 +511,9 @@
</executions>
<dependencies>
<dependency>
<groupId>com.pinterest</groupId>
<artifactId>ktlint</artifactId>
<version>0.50.0</version>
<groupId>com.pinterest.ktlint</groupId>
<artifactId>ktlint-cli</artifactId>
<version>1.1.1</version>
</dependency>
<!-- additional 3rd party ruleset(s) can be specified here -->
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import java.util.Base64
import java.util.UUID

object AvstemmingMapper {

fun encodeUUIDBase64(uuid: UUID): String {
val bb = ByteBuffer.wrap(ByteArray(16))
bb.putLong(uuid.mostSignificantBits)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ import no.nav.virksomhet.tjenester.avstemming.meldinger.v1.Avstemmingsdata

interface AvstemmingSender {
fun sendGrensesnittAvstemming(avstemmingsdata: Avstemmingsdata)

fun sendKonsistensAvstemming(avstemmingsdata: Konsistensavstemmingsdata)
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ class AvstemmingSenderMQ(
val jmsTemplateAvstemming: JmsTemplate,
@Value("\${oppdrag.mq.enabled}") val erEnabled: String,
) : AvstemmingSender {

override fun sendGrensesnittAvstemming(avstemmingsdata: Avstemmingsdata) {
val avstemmingXml = JaxbGrensesnittAvstemmingsdata.tilXml(avstemmingsdata)
leggPåKø(avstemmingXml)
}

override fun sendKonsistensAvstemming(avstemmingsdata: Konsistensavstemmingsdata) {
val konsistensavstemmingRequest = SendAsynkronKonsistensavstemmingsdata().apply {
request = SendAsynkronKonsistensavstemmingsdataRequest().apply { konsistensavstemmingsdata = avstemmingsdata }
}
val konsistensavstemmingRequest =
SendAsynkronKonsistensavstemmingsdata().apply {
request = SendAsynkronKonsistensavstemmingsdataRequest().apply { konsistensavstemmingsdata = avstemmingsdata }
}

val requestXml = JaxbKonsistensavstemming.tilXml(konsistensavstemmingRequest)
leggPåKø(requestXml)
Expand Down
33 changes: 19 additions & 14 deletions src/main/kotlin/no/nav/familie/oppdrag/common/RessursUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,37 @@ import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity

object RessursUtils {

private val LOG = LoggerFactory.getLogger(this::class.java)
private val secureLogger = LoggerFactory.getLogger("secureLogger")

fun <T> unauthorized(errorMessage: String): ResponseEntity<Ressurs<T>> =
ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(Ressurs.failure(errorMessage))

fun <T> notFound(errorMessage: String): ResponseEntity<Ressurs<T>> =
errorResponse(HttpStatus.NOT_FOUND, errorMessage, null)
fun <T> notFound(errorMessage: String): ResponseEntity<Ressurs<T>> = errorResponse(HttpStatus.NOT_FOUND, errorMessage, null)

fun <T> badRequest(errorMessage: String, throwable: Throwable?): ResponseEntity<Ressurs<T>> =
errorResponse(HttpStatus.BAD_REQUEST, errorMessage, throwable)
fun <T> badRequest(
errorMessage: String,
throwable: Throwable?,
): ResponseEntity<Ressurs<T>> = errorResponse(HttpStatus.BAD_REQUEST, errorMessage, throwable)

fun <T> forbidden(errorMessage: String): ResponseEntity<Ressurs<T>> =
errorResponse(HttpStatus.FORBIDDEN, errorMessage, null)
fun <T> forbidden(errorMessage: String): ResponseEntity<Ressurs<T>> = errorResponse(HttpStatus.FORBIDDEN, errorMessage, null)

fun <T> conflict(errorMessage: String): ResponseEntity<Ressurs<T>> =
errorResponse(HttpStatus.CONFLICT, errorMessage, null, true)
fun <T> conflict(errorMessage: String): ResponseEntity<Ressurs<T>> = errorResponse(HttpStatus.CONFLICT, errorMessage, null, true)

fun <T> illegalState(errorMessage: String, throwable: Throwable? = null): ResponseEntity<Ressurs<T>> =
errorResponse(HttpStatus.INTERNAL_SERVER_ERROR, errorMessage, throwable)
fun <T> illegalState(
errorMessage: String,
throwable: Throwable? = null,
): ResponseEntity<Ressurs<T>> = errorResponse(HttpStatus.INTERNAL_SERVER_ERROR, errorMessage, throwable)

fun <T> serviceUnavailable(errorMessage: String, throwable: Throwable? = null): ResponseEntity<Ressurs<T>> =
errorResponse(HttpStatus.INTERNAL_SERVER_ERROR, errorMessage, throwable)
fun <T> serviceUnavailable(
errorMessage: String,
throwable: Throwable? = null,
): ResponseEntity<Ressurs<T>> = errorResponse(HttpStatus.INTERNAL_SERVER_ERROR, errorMessage, throwable)

fun <T> ok(data: T, melding: String? = null): ResponseEntity<Ressurs<T>> = ResponseEntity.ok(Ressurs.success(data, melding))
fun <T> ok(
data: T,
melding: String? = null,
): ResponseEntity<Ressurs<T>> = ResponseEntity.ok(Ressurs.success(data, melding))

fun <T> noContent(): ResponseEntity<Ressurs<T>> = ResponseEntity.noContent().build()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ private val secureLogger = LoggerFactory.getLogger("secureLogger")

fun logSoapFaultException(e: Exception) {
if (e is SOAPFaultException) {
val details = e.fault.detail?.let { detail ->
detail.detailEntries.asSequence().mapNotNull { it.textContent }.joinToString(",")
}
val details =
e.fault.detail?.let { detail ->
detail.detailEntries.asSequence().mapNotNull { it.textContent }.joinToString(",")
}
secureLogger.error(
"SOAPFaultException -" +
" faultCode=${e.fault.faultCode}" +
Expand Down
Loading

0 comments on commit 3c8e4b8

Please sign in to comment.