Skip to content
Snippets Groups Projects
Commit baee1727 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-6522 fix deprecated old bayernid type

parent 3c40dffd
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,7 @@ import java.util.EnumSet;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.function.Supplier;
import java.util.stream.Stream;
import jakarta.annotation.PostConstruct;
......@@ -240,22 +241,20 @@ class PostfachService {
}
public Stream<Postfach> getPostfachs() {
return postfachRemoteServices.stream().flatMap(Collection::stream).map(this::buildPostfach);
Supplier<Stream<PostfachRemoteService>> postfachRemoteServicesStream = () -> postfachRemoteServices.stream().flatMap(Collection::stream);
var oldBayernIdPostfachStream = buildOldBayernIdPostfach(postfachRemoteServicesStream.get());
var postfachsStream = postfachRemoteServicesStream.get().map(this::buildPostfach);
return Stream.concat(postfachsStream, oldBayernIdPostfachStream);
}
// TODO wieder einbauen
private Stream<Postfach> getPostfaecher() {
var postfach = buildPostfach(postfachRemoteService);
// TODO Nach Umstellung auf BAYERN_ID entfernen
if (postfachRemoteService.getPostfachType().equals("BAYERN_ID")) {
return Stream.of(postfach, Postfach.builder()
private Stream<Postfach> buildOldBayernIdPostfach(Stream<PostfachRemoteService> postfachRemoteServicesStream) {
return postfachRemoteServicesStream.filter(remotePostfach -> "BAYERN_ID".equals(remotePostfach.getPostfachType()))
.map(remotePostfach -> Postfach.builder()
.type("BayernId")
.isReplyAllowed(postfach.isReplyAllowed())
.isReplyAllowed(isReplyAllowed(remotePostfach))
.build());
}
//
return Stream.of(postfach);
}
Postfach buildPostfach(PostfachRemoteService postfachRemoteService) {
return Postfach.builder().type(postfachRemoteService.getPostfachType()).isReplyAllowed(isReplyAllowed(postfachRemoteService)).build();
......
......@@ -860,11 +860,6 @@ class PostfachServiceTest {
private final Postfach postfach = PostfachTestFactory.create();
@BeforeEach
void init() {
doReturn(postfach).when(service).buildPostfach(any());
}
@Test
void shouldCallBuildPostfach() {
when(postfachRemoteService.getPostfachType()).thenReturn(PostfachTestFactory.POSTFACH_TYPE);
......@@ -898,7 +893,6 @@ class PostfachServiceTest {
@BeforeEach
void mock() {
doReturn(true).when(service).isPostfachConfigured();
when(postfachRemoteService.getPostfachType()).thenReturn(BAYERN_ID_POSTFACH);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment