Skip to content

Commit

Permalink
Endret til nytt skjerming-api og oppdatert sonar
Browse files Browse the repository at this point in the history
#deploy-test-dolly-backend
#deploy-proxy
  • Loading branch information
stigus committed Jan 22, 2024
1 parent e092aec commit b9f2465
Show file tree
Hide file tree
Showing 107 changed files with 137 additions and 139 deletions.
2 changes: 1 addition & 1 deletion apps/adresse-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
2 changes: 1 addition & 1 deletion apps/amelding-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
2 changes: 1 addition & 1 deletion apps/app-tilgang-analyse-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
2 changes: 1 addition & 1 deletion apps/arbeidsforhold-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
2 changes: 1 addition & 1 deletion apps/batch-bestilling-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
2 changes: 1 addition & 1 deletion apps/brreg-stub/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id "uk.co.boothen.gradle.wsimport" version "0.21"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
Expand Down
2 changes: 1 addition & 1 deletion apps/bruker-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
2 changes: 1 addition & 1 deletion apps/budpro-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
id 'org.springframework.boot' version '3.2.1'
id 'io.spring.dependency-management' version '1.1.4'
id "jacoco"
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id("org.openrewrite.rewrite") version("6.6.4")
}

Expand Down
2 changes: 1 addition & 1 deletion apps/dolly-backend/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ public Flux<ClientFuture> gjenopprett(RsDollyUtvidetBestilling bestilling, Dolly
return Flux.empty();
}

@Override
public void release(List<String> identer) {

skjermingsRegisterConsumer.deleteSkjerming(identer)
.subscribe(response -> log.info("Slettet identer fra Skjermingsregisteret"));
}

private ClientFuture futurePersist(BestillingProgress progress, String status) {

return () -> {
Expand All @@ -63,13 +70,6 @@ private ClientFuture futurePersist(BestillingProgress progress, String status) {
};
}

@Override
public void release(List<String> identer) {

skjermingsRegisterConsumer.deleteSkjerming(identer)
.subscribe(response -> log.info("Slettet identer fra Skjermingsregisteret"));
}

private String getStatus(SkjermingDataResponse resultat) {

return isBlank(resultat.getError()) ? "OK" :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import reactor.core.publisher.Mono;

import java.time.Duration;
import java.time.LocalDateTime;
import java.util.List;

import static java.util.Objects.nonNull;
Expand Down Expand Up @@ -47,44 +48,47 @@ public SkjermingsRegisterConsumer(
.build();
}

@Timed(name = "providers", tags = {"operation", "skjermingsdata-slett"})
@Timed(name = "providers", tags = { "operation", "skjermingsdata-slett" })
public Mono<List<Void>> deleteSkjerming(List<String> identer) {

return tokenService.exchange(serverProperties)
.flatMapMany(token -> Flux.range(0, identer.size())
.delayElements(Duration.ofMillis(100))
.map(index -> new SkjermingsregisterDeleteCommand(webClient,
identer.get(index), token.getTokenValue()).call())
SkjermingDataRequest.builder()
.personident(identer.get(index))
.skjermetTil(LocalDateTime.now())
.build(),
token.getTokenValue()).call())
.flatMap(Flux::from))
.collectList();
}

@Timed(name = "providers", tags = {"operation", "skjermingsdata-oppdater"})
@Timed(name = "providers", tags = { "operation", "skjermingsdata-oppdater" })
public Mono<SkjermingDataResponse> oppdaterPerson(SkjermingDataRequest skjerming) {

return tokenService.exchange(serverProperties)
.flatMap(token -> new SkjermingsregisterGetCommand(webClient, skjerming.getPersonident(), token.getTokenValue()).call()
.flatMap(response -> {
if (isBlank(response.getError())) {
if (response.isEksistererIkke()) {
return new SkjermingsregisterPostCommand(webClient, List.of(skjerming),
return new SkjermingsregisterPostCommand(webClient, skjerming,
token.getTokenValue()).call()
.collectList()
.map(status -> {
log.info("Opprettet skjerming på ident {} fraDato {} tilDato {}",
status.get(0).getPersonident(), status.get(0).getSkjermetFra(), status.get(0).getSkjermetTil());
return status.get(0);
status.getFirst().getPersonident(), status.getFirst().getSkjermetFra(), status.getFirst().getSkjermetTil());
return status.getFirst();
});
} else {
return nonNull(skjerming.getSkjermetTil()) ?

new SkjermingsregisterPutCommand(webClient, skjerming.getPersonident(),
skjerming.getSkjermetTil(), token.getTokenValue()).call()
new SkjermingsregisterPutCommand(webClient, skjerming, token.getTokenValue())
.call()
.map(status -> {
log.info("Oppdatert skjerming for ident {}, ny tilDato {}", skjerming.getPersonident(), skjerming.getSkjermetTil());
return status;
}) :

Mono.just(new SkjermingDataResponse());
}
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package no.nav.dolly.bestilling.skjermingsregister.command;

import lombok.RequiredArgsConstructor;
import no.nav.dolly.bestilling.skjermingsregister.domain.SkjermingDataRequest;
import no.nav.dolly.util.CallIdUtil;
import no.nav.testnav.libs.reactivecore.utils.WebClientFilter;
import no.nav.testnav.libs.securitycore.config.UserConstant;
Expand All @@ -20,22 +21,22 @@
@RequiredArgsConstructor
public class SkjermingsregisterDeleteCommand implements Callable<Flux<Void>> {

private static final String SKJERMINGSREGISTER_URL = "/api/v1/skjermingdata";
private static final String SKJERMINGSREGISTER_URL = "/api/v1/skjerming/dolly";

private final WebClient webClient;
private final String ident;
private final SkjermingDataRequest skjermingDataRequest;
private final String token;

public Flux<Void> call() {

return webClient.delete().uri(uriBuilder -> uriBuilder
return webClient.put().uri(uriBuilder -> uriBuilder
.path(SKJERMINGSREGISTER_URL)
.pathSegment(ident)
.build())
.header(AUTHORIZATION, "Bearer " + token)
.header(UserConstant.USER_HEADER_JWT, getUserJwt())
.header(HEADER_NAV_CALL_ID, CallIdUtil.generateCallId())
.header(HEADER_NAV_CONSUMER_ID, CONSUMER)
.bodyValue(skjermingDataRequest)
.retrieve()
.bodyToFlux(Void.class)
.doOnError(WebClientFilter::logErrorMessage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
@RequiredArgsConstructor
public class SkjermingsregisterGetCommand implements Callable<Mono<SkjermingDataResponse>> {

private static final String SKJERMINGSREGISTER_URL = "/api/v1/skjermingdata";
private static final String SKJERMINGSREGISTER_URL = "/api/v1/skjerming/dolly";
private static final String PERSONIDENT_HEADER = "personident";

private final WebClient webClient;
private final String ident;
Expand All @@ -26,9 +27,9 @@ public class SkjermingsregisterGetCommand implements Callable<Mono<SkjermingData
public Mono<SkjermingDataResponse> call() {
return webClient.get().uri(uriBuilder -> uriBuilder
.path(SKJERMINGSREGISTER_URL)
.pathSegment(ident)
.build())
.header(AUTHORIZATION, "Bearer " + token)
.header(PERSONIDENT_HEADER, ident)
.retrieve()
.bodyToMono(SkjermingDataResponse.class)
.onErrorResume(WebClientResponseException.NotFound.class::isInstance,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
@RequiredArgsConstructor
public class SkjermingsregisterPostCommand implements Callable<Flux<SkjermingDataResponse>> {

private static final String SKJERMINGSREGISTER_URL = "/api/v1/skjermingdata";
private static final String SKJERMINGSREGISTER_URL = "/api/v1/skjerming/dolly";

private final WebClient webClient;
private final List<SkjermingDataRequest> skjermingsDataRequest;
private final SkjermingDataRequest skjermingsDataRequest;
private final String token;

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,34 @@
package no.nav.dolly.bestilling.skjermingsregister.command;

import lombok.RequiredArgsConstructor;
import no.nav.dolly.bestilling.skjermingsregister.domain.SkjermingDataRequest;
import no.nav.dolly.bestilling.skjermingsregister.domain.SkjermingDataResponse;
import no.nav.testnav.libs.reactivecore.utils.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.time.LocalDateTime;
import java.util.concurrent.Callable;

import static java.util.Objects.nonNull;
import static org.springframework.http.HttpHeaders.AUTHORIZATION;

@RequiredArgsConstructor
public class SkjermingsregisterPutCommand implements Callable<Mono<SkjermingDataResponse>> {

private static final String SKJERMINGSREGISTER_URL = "/api/v1/skjermingdata";
private static final String SKJERMINGOPPHOER_URL = SKJERMINGSREGISTER_URL + "/opphor";
private static final String SKJERMING_TOM = "skjermetTil";
private static final String SKJERMINGSREGISTER_URL = "/api/v1/skjerming/dolly";

private final WebClient webClient;
private final String ident;
private final LocalDateTime tilDato;
private final SkjermingDataRequest skjermingsDataRequest;
private final String token;

@Override
public Mono<SkjermingDataResponse> call() {
return webClient.put().uri(uriBuilder -> uriBuilder
.path(SKJERMINGOPPHOER_URL)
.pathSegment(ident)
.queryParam(SKJERMING_TOM, nonNull(tilDato) ? tilDato.toLocalDate() : null)
.path(SKJERMINGSREGISTER_URL)
.build())
.header(AUTHORIZATION, "Bearer " + token)
.bodyValue(skjermingsDataRequest)
.retrieve()
.toBodilessEntity()
.map(result -> SkjermingDataResponse.builder().build())
Expand Down
2 changes: 1 addition & 1 deletion apps/dolly-frontend/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'java'
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
Expand Down
2 changes: 1 addition & 1 deletion apps/dollystatus/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
2 changes: 1 addition & 1 deletion apps/endringsmelding-frontend/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
2 changes: 1 addition & 1 deletion apps/endringsmelding-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
2 changes: 1 addition & 1 deletion apps/ereg-batch-status-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
2 changes: 1 addition & 1 deletion apps/faste-data-frontend/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
2 changes: 1 addition & 1 deletion apps/generer-navn-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
2 changes: 1 addition & 1 deletion apps/generer-organisasjon-populasjon-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
2 changes: 1 addition & 1 deletion apps/generer-synt-amelding-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
2 changes: 1 addition & 1 deletion apps/geografiske-kodeverk-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
2 changes: 1 addition & 1 deletion apps/helsepersonell-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
2 changes: 1 addition & 1 deletion apps/inntektsmelding-generator-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
2 changes: 1 addition & 1 deletion apps/inntektsmelding-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
2 changes: 1 addition & 1 deletion apps/jenkins-batch-status-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "org.sonarqube" version "4.0.0.2929"
id "org.sonarqube" version "4.4.1.3373"
id 'org.springframework.boot' version "3.2.1"
id 'io.spring.dependency-management' version "1.1.4"
id "jacoco"
Expand Down
Loading

0 comments on commit b9f2465

Please sign in to comment.