Skip to content

Commit

Permalink
Fjerner feature toggle stopp_opensearch_indeksering
Browse files Browse the repository at this point in the history
  • Loading branch information
klaramargrethehelgemo committed Jan 22, 2025
1 parent d488979 commit fe224fe
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,13 @@ private FeatureToggle() {
public static final String KAFKA_AIVEN_CONSUMERS_STOP = "veilarbportefolje.kafka_aiven_consumers_stop";
public static final String KAFKA_SISTE_14A_STOP = "veilarbportefolje.kafka_siste_14a_stop";
public static final String BRUK_FILTER_FOR_BRUKERINNSYN_TILGANGER = "veilarbportefolje.bruk_filter_for_brukerinnsyn_tilganger";
public static final String STOPP_OPENSEARCH_INDEKSERING = "veilarbportefolje.stopp_opensearch_indeksering";
public static final String STOPP_KONSUMERING_FRA_PORTEFOLJE_HENDELSESFILTER_TOPIC = "veilarbportefolje.stopp_konsumering_fra_portefolje_hendelsesfilter_topic";

public static boolean brukAvAliasIndeksering(DefaultUnleash defaultUnleash) {
return defaultUnleash.isEnabled(FeatureToggle.ALIAS_INDEKSERING);
}


public static boolean brukFilterForBrukerinnsynTilganger(DefaultUnleash defaultUnleash) {
return defaultUnleash.isEnabled(FeatureToggle.BRUK_FILTER_FOR_BRUKERINNSYN_TILGANGER);
}

public static boolean stoppOpensearchIndeksering(DefaultUnleash defaultUnleash) {
return defaultUnleash.isEnabled(FeatureToggle.STOPP_OPENSEARCH_INDEKSERING);
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package no.nav.pto.veilarbportefolje.persononinfo;

import io.getunleash.DefaultUnleash;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import no.nav.common.types.identer.AktorId;
import no.nav.common.types.identer.Fnr;
import no.nav.pto.veilarbportefolje.config.FeatureToggle;
import no.nav.pto.veilarbportefolje.kafka.KafkaCommonNonKeyedConsumerService;
import no.nav.pto.veilarbportefolje.opensearch.OpensearchIndexer;
import no.nav.pto.veilarbportefolje.opensearch.OpensearchIndexerV2;
Expand Down Expand Up @@ -39,7 +37,6 @@ public class PdlBrukerdataKafkaService extends KafkaCommonNonKeyedConsumerServic
private final BarnUnder18AarService barnUnder18AarService;
private final OpensearchIndexer opensearchIndexer;
private final OpensearchIndexerV2 opensearchIndexerV2;
private final DefaultUnleash defaultUnleash;

@Override
@SneakyThrows
Expand All @@ -60,14 +57,11 @@ public void behandleKafkaMeldingLogikk(PdlDokument pdlDokument) {
if (pdlIdentRepository.harAktorIdUnderOppfolging(aktorIder)) {
AktorId aktivAktorId = hentAktivAktor(pdlIdenter);
secureLog.info("Det oppsto en PDL endring aktoer: {}", aktivAktorId);

handterIdentEndring(pdlIdenter);

handterBrukerDataEndring(pdlDokument.getHentPerson(), pdlIdenter);

if (!FeatureToggle.stoppOpensearchIndeksering(defaultUnleash)) {
oppdaterOpensearch(aktivAktorId, pdlIdenter);
}
oppdaterOpensearch(aktivAktorId, pdlIdenter);
}

if (barnUnder18AarService.erFnrBarnAvForelderUnderOppfolging(fnrs)) {
Expand All @@ -77,7 +71,6 @@ public void behandleKafkaMeldingLogikk(PdlDokument pdlDokument) {

handterBarnEndring(pdlDokument.getHentPerson(), pdlIdenter);

if (!FeatureToggle.stoppOpensearchIndeksering(defaultUnleash)) {
List<Fnr> foreldreTilBarn = barnUnder18AarService.finnForeldreTilBarn(aktivtFnr);

foreldreTilBarn.forEach(fnrForelder -> {
Expand All @@ -89,7 +82,6 @@ public void behandleKafkaMeldingLogikk(PdlDokument pdlDokument) {
}
}
);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.tomakehurst.wiremock.WireMockServer;
import io.getunleash.DefaultUnleash;
import no.nav.common.client.pdl.PdlClientImpl;
import no.nav.common.types.identer.AktorId;
import no.nav.common.types.identer.Fnr;
Expand Down Expand Up @@ -65,8 +64,6 @@ public class BarnUnder18AarKafkaTest {
private final String pdlDokumentBarn1MedDiskresjonskodeAsString = readFileAsJsonString("/PDL_Files/pdl_dokument_barn1_med_diskresjonskode.json", getClass());
private final JdbcTemplate db;

@MockBean
private DefaultUnleash defaultUnleash;
private final WireMockServer server = new WireMockServer();


Expand Down Expand Up @@ -107,8 +104,7 @@ public void setup() {
new BrukerServiceV2(this.pdlIdentRepository, this.oppfolgingsbrukerRepositoryV3, this.oppfolgingRepositoryV2),
this.barnUnder18AarService,
opensearchIndexer,
opensearchIndexerV2,
defaultUnleash
opensearchIndexerV2
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.tomakehurst.wiremock.WireMockServer;
import io.getunleash.DefaultUnleash;
import no.nav.common.client.pdl.PdlClientImpl;
import no.nav.common.types.identer.AktorId;
import no.nav.common.types.identer.Fnr;
Expand Down Expand Up @@ -65,9 +64,6 @@ public class BarnUnder18AarMisterForeldreansvarTest {
private final String pdlDokumentIngenBarn = readFileAsJsonString("/PDL_Files/pdl_dokument_ingen_barn.json", getClass());
private final JdbcTemplate db;

@MockBean
private DefaultUnleash defaultUnleash;

private final WireMockServer server = new WireMockServer();


Expand All @@ -94,7 +90,7 @@ public void setup() {

server.start();

PdlPortefoljeClient pdlPortefoljeClient = new PdlPortefoljeClient(new PdlClientImpl("http://localhost:" + server.port(), () -> "SYSTEM_TOKEN"));
PdlPortefoljeClient pdlPortefoljeClient = new PdlPortefoljeClient(new PdlClientImpl("http://localhost:" + server.port(), () -> "SYSTEM_TOKEN", "B555"));


barnUnder18AarService = new BarnUnder18AarService(barnUnder18AarRepository, pdlPortefoljeClient);
Expand All @@ -108,8 +104,7 @@ public void setup() {
new BrukerServiceV2(this.pdlIdentRepository, this.oppfolgingsbrukerRepositoryV3, this.oppfolgingRepositoryV2),
this.barnUnder18AarService,
opensearchIndexer,
opensearchIndexerV2,
defaultUnleash
opensearchIndexerV2
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.jdbc.core.JdbcTemplate;

import java.time.LocalDate;
Expand All @@ -33,7 +33,7 @@ public class PDLPersonBarnTest {
private final JdbcTemplate db;
private final PdlPersonRepository pdlPersonRepository;

@Autowired
@MockBean
private PdlPortefoljeClient mockedPdlPortefoljeClient;

private PdlService pdlService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ public PdlBrukerdataKafkaServiceTest() throws JsonProcessingException {
new BrukerServiceV2(pdlIdentRepository, oppfolgingsbrukerRepositoryV3, oppfolgingRepositoryV2),
barnUnder18AarService,
opensearchIndexer,
opensearchIndexerV2,
mockUnleash
opensearchIndexerV2
);
}

Expand Down

0 comments on commit fe224fe

Please sign in to comment.