Skip to content

Commit b714ad2

Browse files
committed
Innhent og sammenlign fra SP subbase
1 parent f09e968 commit b714ad2

File tree

8 files changed

+70
-6
lines changed

8 files changed

+70
-6
lines changed

domenetjenester/iay/src/main/java/no/nav/foreldrepenger/abakus/registerdata/ytelse/infotrygd/rest/felles/InfotrygdGrunnlagAggregator.java

+29-6
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,58 @@
55
import java.time.LocalDate;
66
import java.util.List;
77

8+
import org.slf4j.Logger;
9+
import org.slf4j.LoggerFactory;
10+
811
import jakarta.enterprise.context.ApplicationScoped;
9-
import jakarta.enterprise.inject.Any;
10-
import jakarta.enterprise.inject.Instance;
1112
import jakarta.inject.Inject;
12-
13+
import no.nav.foreldrepenger.abakus.registerdata.ytelse.infotrygd.rest.ps.InfotrygdPSGrunnlag;
14+
import no.nav.foreldrepenger.abakus.registerdata.ytelse.infotrygd.rest.sp.InfotrygdSPGrunnlag;
15+
import no.nav.foreldrepenger.abakus.registerdata.ytelse.infotrygd.rest.sp.TestInfotrygdSPGrunnlag;
1316
import no.nav.vedtak.felles.integrasjon.infotrygd.grunnlag.InfotrygdGrunnlag;
1417
import no.nav.vedtak.felles.integrasjon.infotrygd.grunnlag.v1.respons.Grunnlag;
1518

1619
@ApplicationScoped
1720
public class InfotrygdGrunnlagAggregator {
18-
21+
private static final Logger LOG = LoggerFactory.getLogger(InfotrygdGrunnlagAggregator.class);
1922
private List<InfotrygdGrunnlag> tjenester;
23+
private InfotrygdGrunnlag sykepenger;
24+
private InfotrygdGrunnlag testSykepenger;
2025

2126
InfotrygdGrunnlagAggregator() {
2227
}
2328

2429
@Inject
25-
public InfotrygdGrunnlagAggregator(@Any Instance<InfotrygdGrunnlag> tjenester) {
26-
this.tjenester = tjenester.stream().collect(toList());
30+
public InfotrygdGrunnlagAggregator(InfotrygdPSGrunnlag ps, InfotrygdSPGrunnlag sp, TestInfotrygdSPGrunnlag tsp) {
31+
this.tjenester = List.of(ps, sp);
32+
this.sykepenger = sp;
33+
this.testSykepenger = tsp;
2734
}
2835

2936
public List<Grunnlag> hentAggregertGrunnlag(String fnr, LocalDate fom, LocalDate tom) {
37+
sammenlignSykepenger(fnr, fom, tom);
3038
return tjenester.stream().map(t -> t.hentGrunnlag(fnr, fom, tom)).flatMap(List::stream).collect(toList());
3139
}
3240

3341
public List<Grunnlag> hentAggregertGrunnlagFailSoft(String fnr, LocalDate fom, LocalDate tom) {
42+
sammenlignSykepenger(fnr, fom, tom);
3443
return tjenester.stream().map(t -> t.hentGrunnlagFailSoft(fnr, fom, tom)).flatMap(List::stream).collect(toList());
3544
}
3645

46+
private void sammenlignSykepenger(String fnr, LocalDate fom, LocalDate tom) {
47+
try {
48+
var gs = sykepenger.hentGrunnlagFailSoft(fnr, fom, tom);
49+
var gt = testSykepenger.hentGrunnlagFailSoft(fnr, fom, tom);
50+
if (gs.size() == gt.size() && gs.containsAll(gt)) {
51+
LOG.info("ABAKUS-SYKEPENGER like svar");
52+
} else {
53+
LOG.info("ABAKUS-SYKEPENGER ulike svar gamle {} nye {}", gs, gt);
54+
}
55+
} catch (Exception e) {
56+
LOG.info("ABAKUS-SYKEPENGER fikk feil", e);
57+
}
58+
}
59+
3760
@Override
3861
public String toString() {
3962
return getClass().getSimpleName() + "[tjenester=" + tjenester + "]";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package no.nav.foreldrepenger.abakus.registerdata.ytelse.infotrygd.rest.sp;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
import jakarta.inject.Qualifier;
9+
10+
@Qualifier
11+
@Retention(RetentionPolicy.RUNTIME)
12+
@Target({ElementType.PARAMETER, ElementType.TYPE})
13+
public @interface TSP {
14+
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package no.nav.foreldrepenger.abakus.registerdata.ytelse.infotrygd.rest.sp;
2+
3+
import jakarta.enterprise.context.Dependent;
4+
import no.nav.vedtak.felles.integrasjon.infotrygd.grunnlag.AbstractInfotrygdGrunnlag;
5+
import no.nav.vedtak.felles.integrasjon.rest.RestClientConfig;
6+
import no.nav.vedtak.felles.integrasjon.rest.TokenFlow;
7+
8+
@TSP
9+
@Dependent
10+
@RestClientConfig(tokenConfig = TokenFlow.AZUREAD_CC, endpointProperty = "fpabakus.it.tsp.grunnlag.url",
11+
endpointDefault = "http://fp-infotrygd-sykepenger.teamforeldrepenger/grunnlag",
12+
scopesProperty = "fpabakus.it.tsp.scopes", scopesDefault = "api://prod-fss.teamforeldrepenger.fp-infotrygd-sykepenger/.default")
13+
public class TestInfotrygdSPGrunnlag extends AbstractInfotrygdGrunnlag {
14+
15+
public TestInfotrygdSPGrunnlag() {
16+
super();
17+
}
18+
}

web/src/main/resources/application-dev-fss.properties

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ sigrunrestberegnetskatt.scopes=api://dev-fss.team-inntekt.sigrun-q2/.default
1111

1212
fpabakus.it.ps.scopes=api://dev-fss.k9saksbehandling.k9-infotrygd-grunnlag-paaroerende-sykdom/.default
1313
fpabakus.it.sp.scopes=api://dev-fss.infotrygd.infotrygd-sykepenger-fp/.default
14+
fpabakus.it.tsp.scopes=api://dev-fss.teamforeldrepenger.fp-infotrygd-sykepenger/.default
1415

1516
# Spokelse
1617
spokelse.grunnlag.url=https://spokelse.intern.dev.nav.no/grunnlag

web/src/main/resources/application-prod-fss.properties

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ sigrunrestberegnetskatt.scopes=api://prod-fss.team-inntekt.sigrun/.default
1111

1212
fpabakus.it.ps.scopes=api://prod-fss.k9saksbehandling.k9-infotrygd-grunnlag-paaroerende-sykdom/.default
1313
fpabakus.it.sp.scopes=api://prod-fss.infotrygd.infotrygd-sykepenger-fp/.default
14+
fpabakus.it.tsp.scopes=api://prod-fss.teamforeldrepenger.fp-infotrygd-sykepenger/.default
1415

1516
# Spokelse
1617
spokelse.grunnlag.url=https://spokelse.intern.nav.no/grunnlag

web/src/main/resources/application.properties

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ kafka.fattevedtak.topic=teamforeldrepenger.familie-vedtakfattet-v1
2424
# Klienter
2525
fpabakus.it.ps.grunnlag.url=http://k9-infotrygd-grunnlag-paaroerende-sykdom.k9saksbehandling/paaroerendeSykdom/grunnlag
2626
fpabakus.it.sp.grunnlag.url=http://infotrygd-sykepenger-fp.infotrygd/grunnlag
27+
fpabakus.it.tsp.grunnlag.url=http://fp-infotrygd-sykepenger.teamforeldrepenger/grunnlag
2728

2829
# PDL
2930
pdl.base.url=http://pdl-api.pdl/graphql

web/src/test/resources/application-local.properties

+3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ hentinntektlistebolk.url=https://localhost:8063/rest/inntektskomponenten-ws/rs/a
4242
hentinntektlistebolk.scopes=testscope
4343
fpabakus.it.sp.grunnlag.url=https://localhost:8063/rest/infotrygd/grunnlag/sykepenger
4444
fpabakus.it.sp.scopes=testscope
45+
fpabakus.it.tsp.grunnlag.url=https://localhost:8063/rest/infotrygd/grunnlag/sykepenger
46+
fpabakus.it.tsp.scopes=testscope
47+
4548
fpabakus.it.ps.grunnlag.url=https://localhost:8063/rest/infotrygd/grunnlag/paaroerende-sykdom
4649
fpabakus.it.ps.scopes=testscope
4750

web/src/test/resources/application-vtp.properties

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ hentinntektlistebolk.url=http://localhost:8060/rest/inntektskomponenten-ws/rs/ap
4444
hentinntektlistebolk.scopes=testscope
4545
fpabakus.it.sp.grunnlag.url=http://localhost:8060/rest/infotrygd/grunnlag/sykepenger
4646
fpabakus.it.sp.scopes=testscope
47+
fpabakus.it.tsp.grunnlag.url=http://localhost:8060/rest/infotrygd/grunnlag/sykepenger
48+
fpabakus.it.tsp.scopes=testscope
4749
fpabakus.it.ps.grunnlag.url=http://localhost:8060/rest/infotrygd/grunnlag/paaroerende-sykdom
4850
fpabakus.it.ps.scopes=testscope
4951

0 commit comments

Comments
 (0)