Skip to content

Commit

Permalink
Merge branch 'master' into feature/open-search-ny-start
Browse files Browse the repository at this point in the history
  • Loading branch information
krharum committed Nov 14, 2023
2 parents e3a97c9 + 9ffa1f0 commit 2f2cc26
Show file tree
Hide file tree
Showing 461 changed files with 4,333 additions and 4,232 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package no.nav.testnav.apps.adresseservice.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}.
* <br/><br/>
* Husk at Spring Boot bruker <a href="https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.external-config.typesafe-configuration-properties.relaxed-binding">relaxed binding</a>
* mellom configuration properties og field names.
*
* @see ServerProperties
*/
@Configuration
@ConfigurationProperties(prefix = "consumers")
@NoArgsConstructor(access = PACKAGE)
@Getter
@Setter(PACKAGE)
public class Consumers {

private ServerProperties pdlServices;

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package no.nav.testnav.apps.adresseservice.consumer;

import no.nav.testnav.apps.adresseservice.config.credentials.PdlServiceProperties;
import no.nav.testnav.apps.adresseservice.config.Consumers;
import no.nav.testnav.apps.adresseservice.consumer.command.PdlAdresseSoekCommand;
import no.nav.testnav.apps.adresseservice.dto.GraphQLRequest;
import no.nav.testnav.apps.adresseservice.dto.PdlAdresseResponse;
Expand All @@ -13,19 +13,21 @@
public class PdlAdresseConsumer {
private final WebClient webClient;
private final TokenExchange tokenExchange;
private final ServerProperties properties;
private final ServerProperties serverProperties;

public PdlAdresseConsumer(TokenExchange tokenExchange, PdlServiceProperties properties) {
public PdlAdresseConsumer(
TokenExchange tokenExchange,
Consumers consumers) {
this.tokenExchange = tokenExchange;
this.properties = properties;
serverProperties = consumers.getPdlServices();
this.webClient = WebClient
.builder()
.baseUrl(properties.getUrl())
.baseUrl(serverProperties.getUrl())
.build();
}

public PdlAdresseResponse sendAdressesoek(GraphQLRequest adresseQuery) {
return tokenExchange.exchange(properties)
return tokenExchange.exchange(serverProperties)
.flatMap(token -> new PdlAdresseSoekCommand(webClient, adresseQuery, token.getTokenValue()).call())
.block();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package no.nav.registre.testnav.ameldingservice.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}.
* <br/><br/>
* Husk at Spring Boot bruker <a href="https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.external-config.typesafe-configuration-properties.relaxed-binding">relaxed binding</a>
* mellom configuration properties og field names.
*
* @see ServerProperties
*/
@Configuration
@ConfigurationProperties(prefix = "consumers")
@NoArgsConstructor(access = PACKAGE)
@Getter
@Setter(PACKAGE)
public class Consumers {

private ServerProperties oppsummeringsdokumentService;

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package no.nav.registre.testnav.ameldingservice.consumer;

import com.fasterxml.jackson.databind.ObjectMapper;
import no.nav.registre.testnav.ameldingservice.credentials.OppsummeringsdokumentServerProperties;
import no.nav.registre.testnav.ameldingservice.config.Consumers;
import no.nav.testnav.libs.commands.GetOppsummeringsdokumentByIdCommand;
import no.nav.testnav.libs.commands.GetOppsummeringsdokumentCommand;
import no.nav.testnav.libs.commands.SaveOppsummeringsdokumenterCommand;
Expand All @@ -25,23 +25,25 @@ public class OppsummeringsdokumentConsumer {
private final ApplicationProperties applicationProperties;

public OppsummeringsdokumentConsumer(
OppsummeringsdokumentServerProperties properties,
Consumers consumers,
ObjectMapper objectMapper,
ApplicationProperties applicationProperties) {

this.applicationProperties = applicationProperties;
this.webClient = WebClient
.builder()
.baseUrl(properties.getUrl())
.codecs(clientDefaultCodecsConfigurer -> {
clientDefaultCodecsConfigurer.defaultCodecs().maxInMemorySize(BYTE_COUNT);
clientDefaultCodecsConfigurer
.defaultCodecs()
.jackson2JsonEncoder(new Jackson2JsonEncoder(objectMapper, MediaType.APPLICATION_JSON));
clientDefaultCodecsConfigurer
.defaultCodecs()
.jackson2JsonDecoder(new Jackson2JsonDecoder(objectMapper, MediaType.APPLICATION_JSON));
})
.baseUrl(consumers.getOppsummeringsdokumentService().getUrl())
.codecs(
clientDefaultCodecsConfigurer -> {
clientDefaultCodecsConfigurer
.defaultCodecs()
.maxInMemorySize(BYTE_COUNT);
clientDefaultCodecsConfigurer
.defaultCodecs()
.jackson2JsonEncoder(new Jackson2JsonEncoder(objectMapper, MediaType.APPLICATION_JSON));
clientDefaultCodecsConfigurer
.defaultCodecs()
.jackson2JsonDecoder(new Jackson2JsonDecoder(objectMapper, MediaType.APPLICATION_JSON));
})
.build();
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package no.nav.registre.testnav.ameldingservice.service;

import lombok.RequiredArgsConstructor;
import no.nav.registre.testnav.ameldingservice.config.Consumers;
import no.nav.registre.testnav.ameldingservice.consumer.OppsummeringsdokumentConsumer;
import no.nav.registre.testnav.ameldingservice.credentials.OppsummeringsdokumentServerProperties;
import no.nav.registre.testnav.ameldingservice.domain.AMelding;
import no.nav.testnav.libs.reactivesecurity.exchange.TokenExchange;
import no.nav.testnav.libs.securitycore.domain.AccessToken;
Expand All @@ -13,11 +13,11 @@
@RequiredArgsConstructor
public class AMeldingService {
private final OppsummeringsdokumentConsumer oppsummeringsdokumentConsumer;
private final OppsummeringsdokumentServerProperties applicationProperties;
private final Consumers consumers;
private final TokenExchange tokenExchange;

public Mono<String> save(AMelding aMelding, String miljo) {
return tokenExchange.exchange(applicationProperties).flatMap(accessToken -> oppsummeringsdokumentConsumer
return tokenExchange.exchange(consumers.getOppsummeringsdokumentService()).flatMap(accessToken -> oppsummeringsdokumentConsumer
.get(
aMelding.getOpplysningspliktigOrganisajonsnummer(),
aMelding.getKalendermaaned(),
Expand All @@ -29,7 +29,7 @@ public Mono<String> save(AMelding aMelding, String miljo) {
}

public Mono<AMelding> get(String id) {
Mono<String> accessToken = tokenExchange.exchange(applicationProperties).map(AccessToken::getTokenValue);
Mono<String> accessToken = tokenExchange.exchange(consumers.getOppsummeringsdokumentService()).map(AccessToken::getTokenValue);
return oppsummeringsdokumentConsumer.get(id, accessToken).map(AMelding::new);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package no.nav.registre.testnorge.arbeidsforholdservice.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}.
* <br/><br/>
* Husk at Spring Boot bruker <a href="https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.external-config.typesafe-configuration-properties.relaxed-binding">relaxed binding</a>
* mellom configuration properties og field names.
*
* @see ServerProperties
*/
@Configuration
@ConfigurationProperties(prefix = "consumers")
@NoArgsConstructor(access = PACKAGE)
@Getter
@Setter(PACKAGE)
public class Consumers {

private ServerProperties testnavAaregProxy;

}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import no.nav.registre.testnorge.arbeidsforholdservice.config.credentials.AaregServiceProperties;
import no.nav.registre.testnorge.arbeidsforholdservice.config.Consumers;
import no.nav.registre.testnorge.arbeidsforholdservice.consumer.command.GetArbeidstakerArbeidsforholdCommand;
import no.nav.registre.testnorge.arbeidsforholdservice.consumer.dto.ArbeidsforholdDTO;
import no.nav.testnav.libs.securitycore.domain.ServerProperties;
Expand Down Expand Up @@ -30,21 +30,23 @@ public class AaregConsumer {
private final TokenExchange tokenExchange;

public AaregConsumer(
AaregServiceProperties serverProperties,
Consumers consumers,
TokenExchange tokenExchange,
ObjectMapper objectMapper) {

this.serverProperties = serverProperties;
serverProperties = consumers.getTestnavAaregProxy();
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();

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)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package no.nav.registre.testnorge.batchbestillingservice.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}.
* <br/><br/>
* Husk at Spring Boot bruker <a href="https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.external-config.typesafe-configuration-properties.relaxed-binding">relaxed binding</a>
* mellom configuration properties og field names.
*
* @see ServerProperties
*/
@Configuration
@ConfigurationProperties(prefix = "consumers")
@NoArgsConstructor(access = PACKAGE)
@Getter
@Setter(PACKAGE)
public class Consumers {

private ServerProperties dollyBackend;

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import lombok.extern.slf4j.Slf4j;
import no.nav.registre.testnorge.batchbestillingservice.command.GetAktiveBestillingerCommand;
import no.nav.registre.testnorge.batchbestillingservice.command.PostBestillingCommand;
import no.nav.registre.testnorge.batchbestillingservice.credentials.DollyBackendServiceProperties;
import no.nav.registre.testnorge.batchbestillingservice.config.Consumers;
import no.nav.registre.testnorge.batchbestillingservice.request.RsDollyBestillingRequest;
import no.nav.testnav.libs.securitycore.domain.ServerProperties;
import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange;
Expand All @@ -21,18 +21,17 @@ public class DollyBackendConsumer {

private final WebClient webClient;
private final TokenExchange tokenService;
private final ServerProperties serviceProperties;
private final ServerProperties serverProperties;

public DollyBackendConsumer(
DollyBackendServiceProperties properties,
Consumers consumers,
TokenExchange tokenService,
WebClient.Builder webClientBuilder
) {

this.serviceProperties = properties;
serverProperties = consumers.getDollyBackend();
this.tokenService = tokenService;
this.webClient = webClientBuilder
.baseUrl(serviceProperties.getUrl())
.baseUrl(serverProperties.getUrl())
.build();
}

Expand All @@ -41,7 +40,7 @@ public void postDollyBestilling(Long gruppeId, RsDollyBestillingRequest request,
request.setAntall(antall.intValue());

tokenService
.exchange(serviceProperties)
.exchange(serverProperties)
.map(token -> new PostBestillingCommand(webClient, token.getTokenValue(), gruppeId, request).call())
.doOnError(error -> log.error("Bestilling feilet for gruppe {}", gruppeId, error))
.doOnSuccess(response -> log.info("Bestilling med {} identer startet i backend for gruppe {}", antall, gruppeId))
Expand All @@ -53,7 +52,7 @@ public List<Object> getAktiveBestillinger(Long gruppeId) {
return Optional
.ofNullable(
tokenService
.exchange(serviceProperties)
.exchange(serverProperties)
.map(token -> new GetAktiveBestillingerCommand(webClient, token.getTokenValue(), gruppeId).call())
.doOnError(error -> log.error("Henting av aktive bestillinger feilet for gruppe {}", gruppeId, error))
.onErrorReturn(Flux.empty())
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion apps/brreg-stub/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,4 @@ spec:
cpu: 200m
memory: 1024Mi
ingresses:
- "https://brreg-stub.dev-fss.nais.io"
- "https://brreg-stub.intern.dev.nav.no" # dev-fss
Loading

0 comments on commit 2f2cc26

Please sign in to comment.