-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a copy of the common GenererNavnCommand, for testing of new cod…
…e in app.
- Loading branch information
Showing
2 changed files
with
45 additions
and
16 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
apps/budpro-service/src/main/java/no/nav/dolly/budpro/navn/CustomGenererNavnCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package no.nav.dolly.budpro.navn; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.RequiredArgsConstructor; | ||
import no.nav.dolly.libs.command.Command; | ||
import no.nav.testnav.libs.dto.generernavnservice.v1.NavnDTO; | ||
import no.nav.testnav.libs.securitycore.domain.AccessToken; | ||
import org.springframework.web.reactive.function.client.WebClient; | ||
import reactor.core.publisher.Mono; | ||
|
||
import java.util.Optional; | ||
import java.util.concurrent.Callable; | ||
|
||
@RequiredArgsConstructor | ||
@AllArgsConstructor | ||
public class CustomGenererNavnCommand implements Callable<NavnDTO[]> { | ||
|
||
private final WebClient webClient; | ||
private final Mono<AccessToken> accessToken; | ||
private Long seed; | ||
private final Integer antall; | ||
|
||
@Override | ||
public NavnDTO[] call() { | ||
return Command.fetch( | ||
webClient, | ||
accessToken, | ||
builder -> builder | ||
.path("/api/v1/navn") | ||
.queryParamIfPresent("seed", Optional.ofNullable(seed)) | ||
.queryParam("antall", antall) | ||
.build(), | ||
NavnDTO[].class); | ||
} | ||
|
||
} |
25 changes: 9 additions & 16 deletions
25
apps/budpro-service/src/main/java/no/nav/dolly/budpro/navn/GeneratedNameService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters