Skip to content

Commit

Permalink
Feature/spring updates (#3714)
Browse files Browse the repository at this point in the history
* Spring oppdatering for alle apper, refaktorering vekk fra deprecated funksjonalitet og skrevet om noen tester
* Diverse andre oppdateringer for gradle og sonarcloud
* Mer testendringer og spring boot oppdateringer
* Fjernet disabled tester
  • Loading branch information
stigus authored Jan 14, 2025
1 parent bb6d1ec commit c9d3e26
Show file tree
Hide file tree
Showing 240 changed files with 754 additions and 1,212 deletions.
2 changes: 1 addition & 1 deletion apps/adresse-service/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "com.gradle.develocity" version "3.17.4"
id "com.gradle.develocity" version "3.19"
}

rootProject.name = 'adresse-service'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.security.oauth2.jwt.JwtDecoder;
import org.springframework.test.context.ActiveProfiles;

@SpringBootTest
@ActiveProfiles("test")
class ApplicationContextTest {

@MockBean
@MockitoBean
public JwtDecoder jwtDecoder;

@Test
Expand Down
2 changes: 1 addition & 1 deletion apps/altinn3-tilgang-service/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "com.gradle.develocity" version "3.17.4"
id "com.gradle.develocity" version "3.19"
}

rootProject.name = 'altinn3-tilgang-service'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
import com.google.cloud.secretmanager.v1.SecretManagerServiceClient;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.security.oauth2.jwt.ReactiveJwtDecoder;
import org.springframework.test.context.ActiveProfiles;

@SpringBootTest
@ActiveProfiles("test")
class ApplicationContextTest {

@MockBean
@MockitoBean
public ReactiveJwtDecoder jwtDecoder;

@MockBean
@MockitoBean
public SecretManagerServiceClient secretManagerClient;

@Test
Expand Down
2 changes: 1 addition & 1 deletion apps/amelding-service/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "com.gradle.develocity" version "3.17.4"
id "com.gradle.develocity" version "3.19"
}

rootProject.name = 'amelding-service'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.security.oauth2.jwt.ReactiveJwtDecoder;
import org.springframework.test.context.ActiveProfiles;

@SpringBootTest
@ActiveProfiles("test")
class ApplicationContextTest {

@MockBean
@MockitoBean
public ReactiveJwtDecoder reactiveJwtDecoder;

@Test
Expand Down
2 changes: 1 addition & 1 deletion apps/app-tilgang-analyse-service/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "com.gradle.develocity" version "3.17.4"
id "com.gradle.develocity" version "3.19"
}

rootProject.name = 'app-tilgang-analyse-service'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.security.oauth2.jwt.JwtDecoder;
import org.springframework.test.context.ActiveProfiles;

@SpringBootTest
@ActiveProfiles("test")
class ApplicationContextTest {

@MockBean
@MockitoBean
public JwtDecoder jwtDecoder;

@Test
Expand Down
2 changes: 1 addition & 1 deletion apps/arbeidsforhold-service/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "com.gradle.develocity" version "3.17.4"
id "com.gradle.develocity" version "3.19"
}

rootProject.name = 'arbeidsforhold-service'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.security.oauth2.jwt.JwtDecoder;
import org.springframework.test.context.ActiveProfiles;

Expand All @@ -13,7 +13,7 @@
@ActiveProfiles("test")
class ApplicationContextTest {

@MockBean
@MockitoBean
@SuppressWarnings("unused")
private JwtDecoder jwtDecoder;

Expand Down
2 changes: 1 addition & 1 deletion apps/batch-bestilling-service/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "com.gradle.develocity" version "3.17.4"
id "com.gradle.develocity" version "3.19"
}

rootProject.name = 'batch-bestilling-service'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.security.oauth2.jwt.JwtDecoder;
import org.springframework.test.context.ActiveProfiles;

@ActiveProfiles("test")
@SpringBootTest
public class ApplicationContextTest {

@MockBean
@MockitoBean
public JwtDecoder jwtDecoder;

@Test
Expand Down
2 changes: 1 addition & 1 deletion apps/brreg-stub/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "com.gradle.develocity" version "3.17.4"
id "com.gradle.develocity" version "3.19"
}

rootProject.name = 'brreg-stub'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.mockito.Mockito;
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.test.context.bean.override.mockito.MockitoBean;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
Expand All @@ -36,7 +36,7 @@ public class HentRolleoversiktControllerTest {
@Autowired
private TestRestTemplate restTemplate;

@MockBean
@MockitoBean
private RolleoversiktRepository repository;

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.mockito.Mockito;
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.test.context.bean.override.mockito.MockitoBean;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
Expand All @@ -31,7 +31,7 @@ public class HentRollerControllerTest {
@Autowired
private TestRestTemplate restTemplate;

@MockBean
@MockitoBean
private HentRolleRepository repository;

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.mockito.Mockito;
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.test.context.bean.override.mockito.MockitoBean;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
Expand All @@ -41,10 +41,10 @@ public class RolleoversiktControllerTest {
@Autowired
private TestRestTemplate restTemplate;

@MockBean
@MockitoBean
private RolleoversiktRepository rolleoversiktRepository;

@MockBean
@MockitoBean
private HentRolleRepository rolleRepository;

private RsRolleoversikt lagGyldigRsRolleoversikt(
Expand Down
2 changes: 1 addition & 1 deletion apps/bruker-service/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "com.gradle.develocity" version "3.17.4"
id "com.gradle.develocity" version "3.19"
}

rootProject.name = 'bruker-service'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package no.nav.testnav.apps.brukerservice;

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 no.nav.testnav.libs.reactivecore.config.CoreConfig;
import no.nav.testnav.libs.reactivesecurity.config.SecureOAuth2ServerToServerConfiguration;


@Import({
CoreConfig.class,
Expand All @@ -20,4 +19,4 @@ public class BrukerServiceApplicationStarter {
public static void main(String[] args) {
SpringApplication.run(BrukerServiceApplicationStarter.class, args);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.security.oauth2.jwt.JwtDecoder;
Expand All @@ -29,7 +29,7 @@ class BrukerServiceIntegrationTest {
private static final String PID = "01810048413";
private static final String ORGNUMMER = "811306312";
public static MockWebServer mockBackEnd;
@MockBean
@MockitoBean
JwtDecoder jwtDecoder;

private ObjectMapper objectMapper;
Expand Down
2 changes: 1 addition & 1 deletion apps/budpro-service/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "com.gradle.develocity" version "3.17.4"
id "com.gradle.develocity" version "3.19"
}

rootProject.name = 'budpro-service'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
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.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.http.MediaType;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.web.servlet.MockMvc;
Expand All @@ -37,7 +37,7 @@ class BudproControllerTest {
@Autowired
private ObjectMapper objectMapper;

@MockBean
@MockitoBean
private GeneratedNameService generatedNameService;

private AutoCloseable closeable;
Expand Down
1 change: 1 addition & 0 deletions apps/dolly-backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ trenger å ha noe forhold til under utfylling av bestilling. Noe data blir persi
av Dolly, bestillingskriterier, hvem som har sendt de inn og status på disse.

## Lokal kjøring

* [Generelt.](../../docs/local_general.md)
* [Secret Manager.](../../docs/local_secretmanager.md)
* [Database i GCP.](../../docs/gcp_db.md)
Expand Down
3 changes: 2 additions & 1 deletion apps/dolly-backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,14 @@ dependencies {
implementation "org.apache.poi:poi:$versions.apachePoi"
implementation "org.apache.poi:poi-ooxml:$versions.apachePoi"

testImplementation 'org.opensearch:opensearch-testcontainers:2.0.1'
testImplementation 'org.opensearch:opensearch-testcontainers:2.1.2'

testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'org.springframework.cloud:spring-cloud-contract-wiremock'
testImplementation 'com.h2database:h2'
testImplementation "io.projectreactor:reactor-test:$versions.reactorTest"
testImplementation 'org.testcontainers:junit-jupiter'
testImplementation 'org.springframework.boot:spring-boot-testcontainers'
testImplementation 'org.testcontainers:postgresql'
testImplementation 'org.bitbucket.b_c:jose4j:0.9.6'

Expand Down
2 changes: 1 addition & 1 deletion apps/dolly-backend/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "com.gradle.develocity" version "3.17.4"
id "com.gradle.develocity" version "3.19"
}

rootProject.name = 'dolly-backend'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public class Bruker implements Serializable {
private Bruker eidAv;

@Transient
@Builder.Default
private List<String> grupper = new ArrayList<>();

@OneToMany
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ private static JwtAuthenticationToken getToken() {
return Optional.ofNullable(SecurityContextHolder.getContext().getAuthentication())
.filter(JwtAuthenticationToken.class::isInstance)
.map(JwtAuthenticationToken.class::cast)
.orElseThrow(() -> new RuntimeException("Finner ikke Jwt Authentication Token"));
.orElseThrow(() -> new RuntimeException("CurrentAuth: Finner ikke Jwt Authentication Token"));
}
}

This file was deleted.

This file was deleted.

Loading

0 comments on commit c9d3e26

Please sign in to comment.