Skip to content

Commit

Permalink
WIP: fiks url'er
Browse files Browse the repository at this point in the history
  • Loading branch information
johatr committed Jul 15, 2024
1 parent 8ba7f43 commit cf34417
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class KvpV2ClientImpl implements KvpV2Client {
private final OkHttpClient veilarboppfolgingHttpClient;

public Optional<KvpV2DTO> get(Person.AktorId aktorId) {
String uri = String.format("%s/v2/kvp?aktorId=%s", baseUrl, aktorId.get());
String uri = String.format("%s/veilarboppfolging/api/v2/kvp?aktorId=%s", baseUrl, aktorId.get());
Request request = new Request.Builder()
.url(uri)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class ManuellStatusV2ClientImpl implements ManuellStatusV2Client {
public Optional<ManuellStatusV2DTO> get(Person.AktorId aktorId) {
Person.Fnr fnr = personService.getFnrForAktorId(aktorId);

String uri = String.format("%s/v2/manuell/status?fnr=%s", baseUrl, fnr.get());
String uri = String.format("%s/veilarboppfolging/api/v2/manuell/status?fnr=%s", baseUrl, fnr.get());
Request request = new Request.Builder()
.url(uri)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class OppfolgingClientImpl implements OppfolgingClient {
public Optional<OppfolgingV2UnderOppfolgingDTO> fetchUnderoppfolging(Person.AktorId aktorId) {
Person.Fnr fnr = personService.getFnrForAktorId(aktorId);

String uri = String.format("%s/v2/oppfolging?fnr=%s", baseUrl, fnr.get());
String uri = String.format("%s/veilarboppfolging/api/v2/oppfolging?fnr=%s", baseUrl, fnr.get());
Request request = new Request.Builder()
.url(uri)
.build();
Expand All @@ -49,7 +49,7 @@ public Optional<OppfolgingV2UnderOppfolgingDTO> fetchUnderoppfolging(Person.Akto
public Optional<OppfolgingPeriodeMinimalDTO> fetchGjeldendePeriode(Person.AktorId aktorId) {
Person.Fnr fnr = personService.getFnrForAktorId(aktorId);

String uri = String.format("%s/v2/oppfolging/periode/gjeldende?fnr=%s", baseUrl, fnr.get());
String uri = String.format("%s/veilarboppfolging/api/v2/oppfolging/periode/gjeldende?fnr=%s", baseUrl, fnr.get());
Request request = new Request.Builder()
.url(uri)
.build();
Expand All @@ -70,7 +70,7 @@ public Optional<OppfolgingPeriodeMinimalDTO> fetchGjeldendePeriode(Person.AktorI
@Override
public List<OppfolgingPeriodeMinimalDTO> hentOppfolgingsperioder(Person.AktorId aktorId) {

String uri = String.format("%s/v2/oppfolging/perioder?aktorId=%s", baseUrl, aktorId.get());
String uri = String.format("%s/veilarboppfolging/api/v2/oppfolging/perioder?aktorId=%s", baseUrl, aktorId.get());
Request request = new Request.Builder()
.url(uri)
.build();
Expand All @@ -84,7 +84,7 @@ public List<OppfolgingPeriodeMinimalDTO> hentOppfolgingsperioder(Person.AktorId

@Override
public Optional<SakDTO> hentSak(UUID oppfolgingsperiodeId) {
String uri = String.format("%s/v3/sak/%s", baseUrl, oppfolgingsperiodeId );
String uri = String.format("%s/veilarboppfolging/api/v3/sak/%s", baseUrl, oppfolgingsperiodeId );
Request request = new Request.Builder()
.url(uri)
.post(RequestBody.create("", null))
Expand All @@ -102,7 +102,7 @@ public Optional<SakDTO> hentSak(UUID oppfolgingsperiodeId) {

@Override
public Optional<MålDTO> hentMål(Person.Fnr fnr) {
String uri = String.format("%s/oppfolging/mal?fnr=%s", baseUrl, fnr.get());
String uri = String.format("%s/veilarboppfolging/api/oppfolging/mal?fnr=%s", baseUrl, fnr.get());
Request request = new Request.Builder()
.url(uri)
.get()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@ import org.springframework.stereotype.Service
import java.time.LocalDateTime

@Service
class OrkivarClient(private val orkivarHttpClient: OkHttpClient) {
class OrkivarClient(private val orkivarHttpClient: OkHttpClient, @Value("\${orkivar.url}") val orkivarBaseUrl: String) {

@Value("\${orkivar.url}")
lateinit var orkivarUrl: String
private val orkivarUrl = "$orkivarBaseUrl/orkivar"

fun hentPdfForForhaandsvisning(forhåndsvisningPayload: ForhåndsvisningPayload): ForhaandsvisningResult {
val request: Request = Request.Builder()
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.post(JsonUtils.toJson(forhåndsvisningPayload).toRequestBody("application/json".toMediaTypeOrNull()))
.url(String.format("%s/forhaandsvisning", orkivarUrl))
.url("$orkivarUrl/forhaandsvisning")
.build()

val response = orkivarHttpClient.newCall(request).execute()
Expand All @@ -35,7 +34,7 @@ class OrkivarClient(private val orkivarHttpClient: OkHttpClient) {
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.post(JsonUtils.toJson(arkivPayload).toRequestBody("application/json".toMediaTypeOrNull()))
.url(String.format("%s/arkiver", orkivarUrl))
.url("$orkivarUrl/arkiver")
.build()

val response = orkivarHttpClient.newCall(request).execute()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class KvpV2ClientTest {
void setup() {
OkHttpClient okHttpClient = new OkHttpClient();
kvpV2Client = new KvpV2ClientImpl(okHttpClient);
kvpV2Client.setBaseUrl( wireMock.baseUrl() + "/veilarboppfolging/api");
kvpV2Client.setBaseUrl( wireMock.baseUrl());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void setup() {
PersonService authService = Mockito.mock(PersonService.class);
when(authService.getFnrForAktorId(AKTORID)).thenReturn(FNR);
manuellStatusV2Client = new ManuellStatusV2ClientImpl(okHttpClient, authService);
manuellStatusV2Client.setBaseUrl(wireMock.baseUrl() + "/veilarboppfolging/api");
manuellStatusV2Client.setBaseUrl(wireMock.baseUrl());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void setup() {
GjeldendePeriodeMetrikk gjeldendePeriodeMetrikk = Mockito.mock(GjeldendePeriodeMetrikk.class);
when(personService.getFnrForAktorId(AKTORID)).thenReturn(FNR);
oppfolgingClient = new OppfolgingClientImpl(okHttpClient, okHttpClient, personService, gjeldendePeriodeMetrikk);
oppfolgingClient.setBaseUrl(wireMock.baseUrl() + "/veilarboppfolging/api");
oppfolgingClient.setBaseUrl(wireMock.baseUrl());
}

@Test
Expand Down
4 changes: 2 additions & 2 deletions src/test/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ spring.kafka.producer.properties.enable.idempotence=true
spring.graphql.graphiql.enabled=true

######### Eksterne tjenester #############
VEILARBOPPFOLGINGAPI_URL=http://localhost:${wiremock.server.port}/veilarboppfolging/api
VEILARBOPPFOLGINGAPI_URL=http://localhost:${wiremock.server.port}
VEILARBPERSONAPI_URL=http://localhost:${wiremock.server.port}/veilarbperson/api
app.env.veilarena.serviceurl=http://localhost:${wiremock.server.port}
wiremock.server.httpsPort=-1
orkivar.url=http://localhost:${wiremock.server.port}/orkivar
orkivar.url=http://localhost:${wiremock.server.port}
veilarbdialog.url=http://localhost:${wiremock.server.port}
pdl.url=http://localhost:${wiremock.server.port}/pdl
pdl.scope=api://dev-fss.pdl.pdl-api/.default
Expand Down

0 comments on commit cf34417

Please sign in to comment.