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

OZG-5322 implement comments from code review

parent 4f161be1
No related branches found
No related tags found
No related merge requests found
...@@ -34,7 +34,6 @@ import org.springframework.context.event.EventListener; ...@@ -34,7 +34,6 @@ import org.springframework.context.event.EventListener;
import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContext;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import de.ozgcloud.apilib.common.command.OzgCloudCommandService;
import de.ozgcloud.bescheid.attacheditem.AttachedItemService; import de.ozgcloud.bescheid.attacheditem.AttachedItemService;
import de.ozgcloud.bescheid.binaryfile.BinaryFileService; import de.ozgcloud.bescheid.binaryfile.BinaryFileService;
import de.ozgcloud.bescheid.common.callcontext.CurrentUserService; import de.ozgcloud.bescheid.common.callcontext.CurrentUserService;
...@@ -84,9 +83,7 @@ class BescheidEventListener { ...@@ -84,9 +83,7 @@ class BescheidEventListener {
private final BinaryFileService fileService; private final BinaryFileService fileService;
private final NachrichtService nachrichtService; private final NachrichtService nachrichtService;
private final AttachedItemService attachedItemService; private final AttachedItemService attachedItemService;
private final BescheidFeatureProperties featureProperties;
private final DocumentService documentService; private final DocumentService documentService;
private final OzgCloudCommandService commandService;
private final ApplicationEventPublisher eventPublisher; private final ApplicationEventPublisher eventPublisher;
private final CurrentUserService userService; private final CurrentUserService userService;
......
...@@ -29,8 +29,8 @@ import java.util.HashMap; ...@@ -29,8 +29,8 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import de.ozgcloud.apilib.common.command.OzgCloudCommand; import de.ozgcloud.apilib.common.command.OzgCloudCommand;
...@@ -69,7 +69,7 @@ public class DocumentService { ...@@ -69,7 +69,7 @@ public class DocumentService {
return createBescheidDocument(command, buildItemMap(bescheid)); return createBescheidDocument(command, buildItemMap(bescheid));
} }
public String createBescheidDocument(Command command, Map<String, Object> itemMap) { String createBescheidDocument(Command command, Map<String, Object> itemMap) {
validateBescheidItem(command.getRelationId()); validateBescheidItem(command.getRelationId());
var ozgCloudCommand = buildCreateDocumentOzgCommand(command, buildAttachedItem(command, itemMap)); var ozgCloudCommand = buildCreateDocumentOzgCommand(command, buildAttachedItem(command, itemMap));
var executedCommand = commandService.createAndWaitUntilDone(ozgCloudCommand); var executedCommand = commandService.createAndWaitUntilDone(ozgCloudCommand);
...@@ -116,6 +116,7 @@ public class DocumentService { ...@@ -116,6 +116,7 @@ public class DocumentService {
FIELD_DOCUMENT_FILE, bescheid.getBescheidFileId().toString(), FIELD_DOCUMENT_FILE, bescheid.getBescheidFileId().toString(),
FIELD_NACHRICHT_TEXT, bescheid.getNachrichtText().orElse(StringUtils.EMPTY)); FIELD_NACHRICHT_TEXT, bescheid.getNachrichtText().orElse(StringUtils.EMPTY));
} }
public Document getDocument(String id) { public Document getDocument(String id) {
return documentMapper.fromAttachedItem(attachedItemService.getItem(id)); return documentMapper.fromAttachedItem(attachedItemService.getItem(id));
} }
......
package de.ozgcloud.bescheid.smartdocuments; package de.ozgcloud.bescheid.smartdocuments;
import static org.assertj.core.api.Assertions.*;
import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -33,6 +35,7 @@ class SmartDocumentsBescheidRemoteServiceITCase { ...@@ -33,6 +35,7 @@ class SmartDocumentsBescheidRemoteServiceITCase {
System.out.println(bescheid.getBescheidFileName()); System.out.println(bescheid.getBescheidFileName());
System.out.println(bescheid.getBescheidFile().getAbsolutePath()); System.out.println(bescheid.getBescheidFile().getAbsolutePath());
assertThat(bescheid.getBescheidFileName()).isNotEmpty();
} }
} }
...@@ -50,7 +50,7 @@ import de.ozgcloud.common.test.ITCase; ...@@ -50,7 +50,7 @@ import de.ozgcloud.common.test.ITCase;
import de.ozgcloud.vorgang.VorgangManagerServerApplication; import de.ozgcloud.vorgang.VorgangManagerServerApplication;
import de.ozgcloud.vorgang.command.CommandTestFactory; import de.ozgcloud.vorgang.command.CommandTestFactory;
public class BescheidDocumentITCase { class BescheidDocumentITCase {
@Nested @Nested
@SpringBootTest(classes = VorgangManagerServerApplication.class) @SpringBootTest(classes = VorgangManagerServerApplication.class)
......
...@@ -49,7 +49,6 @@ import org.springframework.test.annotation.DirtiesContext; ...@@ -49,7 +49,6 @@ import org.springframework.test.annotation.DirtiesContext;
import com.mongodb.client.gridfs.model.GridFSFile; import com.mongodb.client.gridfs.model.GridFSFile;
import de.ozgcloud.apilib.common.command.grpc.CommandMapper;
import de.ozgcloud.bescheid.attacheditem.AttachedItemService; import de.ozgcloud.bescheid.attacheditem.AttachedItemService;
import de.ozgcloud.bescheid.attacheditem.BescheidItem; import de.ozgcloud.bescheid.attacheditem.BescheidItem;
import de.ozgcloud.bescheid.common.callcontext.CallContextUser; import de.ozgcloud.bescheid.common.callcontext.CallContextUser;
...@@ -80,11 +79,7 @@ class BescheidEventListenerITCase { ...@@ -80,11 +79,7 @@ class BescheidEventListenerITCase {
@Autowired @Autowired
private ApplicationEventPublisher eventPublisher; private ApplicationEventPublisher eventPublisher;
@SpyBean @SpyBean
private BescheidEventListener eventListener;
@SpyBean
private TestEventListener bescheidDocumentCreatedEventListener; private TestEventListener bescheidDocumentCreatedEventListener;
@Autowired
private CommandMapper mapper;
@Autowired @Autowired
private MongoOperations mongoOperations; private MongoOperations mongoOperations;
...@@ -118,8 +113,7 @@ class BescheidEventListenerITCase { ...@@ -118,8 +113,7 @@ class BescheidEventListenerITCase {
Awaitility.await().atMost(60, TimeUnit.SECONDS).untilAsserted(() -> { Awaitility.await().atMost(60, TimeUnit.SECONDS).untilAsserted(() -> {
verify(bescheidDocumentCreatedEventListener).onBescheidDocumentCreated(bescheidDocumentCreatedEventCaptor.capture()); verify(bescheidDocumentCreatedEventListener).onBescheidDocumentCreated(bescheidDocumentCreatedEventCaptor.capture());
var bescheidDocument = getBescheidDocument(); assertThat(getBescheidDocument()).isNotNull();
assertThat(bescheidDocument).isNotNull();
}); });
} }
......
...@@ -28,7 +28,7 @@ import org.springframework.context.event.EventListener; ...@@ -28,7 +28,7 @@ import org.springframework.context.event.EventListener;
import de.ozgcloud.command.CommandFailedEvent; import de.ozgcloud.command.CommandFailedEvent;
import de.ozgcloud.document.BescheidDocumentCreatedEvent; import de.ozgcloud.document.BescheidDocumentCreatedEvent;
public class TestEventListener { class TestEventListener {
@EventListener @EventListener
public void onBescheidDocumentCreated(BescheidDocumentCreatedEvent event) { public void onBescheidDocumentCreated(BescheidDocumentCreatedEvent event) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment