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

adjust itcase

parent d0887f2c
Branches
Tags
No related merge requests found
......@@ -21,15 +21,16 @@
* Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
package de.ozgcloud.document.bescheid;
package de.ozgcloud;
import org.springframework.context.event.EventListener;
import de.ozgcloud.command.CommandFailedEvent;
import de.ozgcloud.document.BescheidDocumentCreatedEvent;
import de.ozgcloud.document.bescheid.BescheidSentEvent;
import de.ozgcloud.vorgang.status.StatusChangedEvent;
class TestEventListener {
public class TestEventListener {
@EventListener
public void onBescheidDocumentCreated(BescheidDocumentCreatedEvent event) {
......
......@@ -42,6 +42,7 @@ import org.springframework.boot.test.mock.mockito.SpyBean;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.test.annotation.DirtiesContext;
import de.ozgcloud.TestEventListener;
import de.ozgcloud.command.Command;
import de.ozgcloud.command.CommandCreatedEvent;
import de.ozgcloud.command.CommandFailedEvent;
......
......@@ -55,6 +55,7 @@ import org.springframework.test.annotation.DirtiesContext;
import com.mongodb.client.gridfs.model.GridFSFile;
import de.ozgcloud.TestEventListener;
import de.ozgcloud.apilib.user.OzgCloudUserId;
import de.ozgcloud.apilib.user.OzgCloudUserProfile;
import de.ozgcloud.apilib.user.OzgCloudUserProfileService;
......
......@@ -50,6 +50,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.boot.test.mock.mockito.SpyBean;
import org.springframework.data.mongodb.core.MongoOperations;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
......@@ -60,6 +61,7 @@ import org.springframework.test.util.ReflectionTestUtils;
import com.google.protobuf.ByteString;
import com.thedeanda.lorem.LoremIpsum;
import de.ozgcloud.TestEventListener;
import de.ozgcloud.apilib.client_attribute.grpc.OzgCloudClientAttributeMapper;
import de.ozgcloud.apilib.user.OzgCloudUserId;
import de.ozgcloud.apilib.user.OzgCloudUserProfile;
......@@ -74,6 +76,7 @@ import de.ozgcloud.collaboration.request.CollaborationRequestServiceGrpc.Collabo
import de.ozgcloud.collaboration.request.GrpcFindRequestsRequest;
import de.ozgcloud.collaboration.request.GrpcGetRequestRequest;
import de.ozgcloud.command.Command;
import de.ozgcloud.command.CommandFailedEvent;
import de.ozgcloud.command.CommandStatus;
import de.ozgcloud.common.errorhandling.TechnicalException;
import de.ozgcloud.common.test.DataITCase;
......@@ -125,6 +128,8 @@ class CollaborationITCase {
@Autowired
private MongoOperations mongoOperations;
@SpyBean
private TestEventListener testEventListener;
@MockBean
@Qualifier(CollaborationManagerConfiguration.OZGCLOUD_USER_PROFILE_SERVICE_NAME)
......@@ -295,6 +300,8 @@ class CollaborationITCase {
class TestSuccessfully {
@Captor
private ArgumentCaptor<PostfachNachricht> postfachNachrichtCaptor;
@Captor
private ArgumentCaptor<CommandFailedEvent> commandFailedEventCaptor;
@BeforeEach
void init() {
......@@ -329,7 +336,10 @@ class CollaborationITCase {
doThrow(TechnicalException.class).when(postfachRemoteService).sendMessage(any());
var command = commandService.createCommand(buildCreateCollaborationVorgangCommand(vorgangId, COLLABORATION_LEVEL));
waitUntilCommandHasStatus(command.getId(), CommandStatus.ERROR);
await().atMost(60, TimeUnit.SECONDS).untilAsserted(() -> {
verify(testEventListener, atLeastOnce()).onCommandFailed(commandFailedEventCaptor.capture());
assertThat(commandFailedEventCaptor.getValue().getSource()).isEqualTo(command.getId());
});
assertThat(loadCollaborationRequest(vorgangId)).isEmpty();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment