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

Merge pull request 'OZG-4191 OZG-4627 rename client name in history' (#342)...

Merge pull request 'OZG-4191 OZG-4627 rename client name in history' (#342) from OZG-4191-client-name-for-history into master

Reviewed-on: https://git.ozg-sh.de/ozgcloud-app/alfa/pulls/342


Reviewed-by: default avatarOZGCloud <ozgcloud@mgm-tp.com>
parents c332ef41 0f108154
No related branches found
No related tags found
No related merge requests found
...@@ -122,7 +122,7 @@ describe.skip('Historie', () => { ...@@ -122,7 +122,7 @@ describe.skip('Historie', () => {
subject: 'AW: Send Postfach Nachricht', subject: 'AW: Send Postfach Nachricht',
direction: DirectionE2E.IN direction: DirectionE2E.IN
}, },
client: 'MailService', client: 'OzgCloud_NachrichtenManager',
vorgangId: vorgang._id.$oid vorgangId: vorgang._id.$oid
}, },
createdBy: null, createdBy: null,
......
...@@ -59,7 +59,7 @@ describe('PostfachMail', () => { ...@@ -59,7 +59,7 @@ describe('PostfachMail', () => {
const postfachMailPage: PostfachMailPage = new PostfachMailPage(); const postfachMailPage: PostfachMailPage = new PostfachMailPage();
const clientAttributes: ClientAttributesE2E = { const clientAttributes: ClientAttributesE2E = {
[VorgangAttachedItemClientE2E.KOP_NACHRICHTEN_MANAGER]: { [VorgangAttachedItemClientE2E.OZGCLOUD_NACHRICHTEN_MANAGER]: {
[ClientAttributeNameE2E.HAS_NEW_POSTFACH_NACHRICHT]: createHasNewPostfachNachrichtClientAttribute(true), [ClientAttributeNameE2E.HAS_NEW_POSTFACH_NACHRICHT]: createHasNewPostfachNachrichtClientAttribute(true),
[ClientAttributeNameE2E.HAS_POSTFACH_NACHRICHT]: createHasPostfachNachrichtClientAttribute(true) [ClientAttributeNameE2E.HAS_POSTFACH_NACHRICHT]: createHasPostfachNachrichtClientAttribute(true)
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"$oid": "602566a807bb665df9a86111" "$oid": "602566a807bb665df9a86111"
}, },
"version": 0, "version": 0,
"client": "MailService", "client": "OzgCloud_NachrichtenManager",
"vorgangId": "602566a807bb665df9a86111", "vorgangId": "602566a807bb665df9a86111",
"itemName": "PostfachMail", "itemName": "PostfachMail",
"item": { "item": {
......
...@@ -27,8 +27,7 @@ import { WiedervorlageE2E } from './wiedervorlage'; ...@@ -27,8 +27,7 @@ import { WiedervorlageE2E } from './wiedervorlage';
export enum VorgangAttachedItemClientE2E { export enum VorgangAttachedItemClientE2E {
ALFA = 'Alfa', ALFA = 'Alfa',
MAIL_SERVICE = 'MailService', OZGCLOUD_NACHRICHTEN_MANAGER = 'OzgCloud_NachrichtenManager'
KOP_NACHRICHTEN_MANAGER = 'KopNachrichtenManager'
} }
export enum VorgangAttachedItemNameE2E { export enum VorgangAttachedItemNameE2E {
......
...@@ -68,7 +68,7 @@ export function createPostfachNachrichtAttachedItem(_id: string, vorgangId: stri ...@@ -68,7 +68,7 @@ export function createPostfachNachrichtAttachedItem(_id: string, vorgangId: stri
_id: { $oid: _id }, _id: { $oid: _id },
version: 0, version: 0,
vorgangId, vorgangId,
client: VorgangAttachedItemClientE2E.MAIL_SERVICE, client: VorgangAttachedItemClientE2E.OZGCLOUD_NACHRICHTEN_MANAGER,
itemName: VorgangAttachedItemNameE2E.POSTFACH_NACHRICHT, itemName: VorgangAttachedItemNameE2E.POSTFACH_NACHRICHT,
item: { item: {
...createPostfachNachrichtReplyItem(), ...createPostfachNachrichtReplyItem(),
......
...@@ -34,7 +34,7 @@ import de.ozgcloud.vorgang.grpc.clientAttribute.GrpcUpdateClientAttributeRequest ...@@ -34,7 +34,7 @@ import de.ozgcloud.vorgang.grpc.clientAttribute.GrpcUpdateClientAttributeRequest
public class ClientAttributeService { public class ClientAttributeService {
public static final String HAS_NEW_POSTFACH_NACHRICHT_ATTRIBUTE_NAME = "hasNewPostfachNachricht"; public static final String HAS_NEW_POSTFACH_NACHRICHT_ATTRIBUTE_NAME = "hasNewPostfachNachricht";
static final String ORIGINAL_CLIENT_NAME = "KopNachrichtenManager"; static final String ORIGINAL_CLIENT_NAME = "OzgCloud_NachrichtenManager";
@Autowired @Autowired
private ClientAttributeRemoteService remoteService; private ClientAttributeRemoteService remoteService;
......
...@@ -49,7 +49,7 @@ class HistorieCommandHandler { ...@@ -49,7 +49,7 @@ class HistorieCommandHandler {
static final String DIRECTION_INCOMMING = "IN"; static final String DIRECTION_INCOMMING = "IN";
static final String DIRECTION_OUTGOING = "OUT"; static final String DIRECTION_OUTGOING = "OUT";
static final String DIRECTION = "direction"; static final String DIRECTION = "direction";
static final String MAIL_SERVICE = "MailService"; static final String OZGCLOUD_NACHRICHTEN_MANAGER = "OzgCloud_NachrichtenManager";
static final String CLIENT = "client"; static final String CLIENT = "client";
private static final Predicate<Command> IS_CREATE_ATTACHED_ITEM = command -> command.getOrder() == CommandOrder.CREATE_ATTACHED_ITEM; private static final Predicate<Command> IS_CREATE_ATTACHED_ITEM = command -> command.getOrder() == CommandOrder.CREATE_ATTACHED_ITEM;
...@@ -61,7 +61,7 @@ class HistorieCommandHandler { ...@@ -61,7 +61,7 @@ class HistorieCommandHandler {
private CommandService commandService; private CommandService commandService;
public boolean isHistorieCommand(Command command) { public boolean isHistorieCommand(Command command) {
return !isOutgoingPostfachNachrichtByMailService(command) return !isOutgoingPostfachNachrichtByOzgCloudNachrichtenManager(command)
&& !isCreateLoeschAnforderungVorgangAttachedItem(command) && !isCreateLoeschAnforderungVorgangAttachedItem(command)
&& !isLoeschAnforderungZuruecknehmenRevoked(command) && !isLoeschAnforderungZuruecknehmenRevoked(command)
&& !isDeleteVorgangAttachedItem(command); && !isDeleteVorgangAttachedItem(command);
...@@ -71,12 +71,12 @@ class HistorieCommandHandler { ...@@ -71,12 +71,12 @@ class HistorieCommandHandler {
return command.getOrder() == CommandOrder.DELETE_ATTACHED_ITEM; return command.getOrder() == CommandOrder.DELETE_ATTACHED_ITEM;
} }
boolean isOutgoingPostfachNachrichtByMailService(Command command) { boolean isOutgoingPostfachNachrichtByOzgCloudNachrichtenManager(Command command) {
return command.getOrder().equals(CommandOrder.CREATE_ATTACHED_ITEM) && isMailService(command) && isOutgoing(command); return command.getOrder().equals(CommandOrder.CREATE_ATTACHED_ITEM) && isOzgCloudNachrichtenManager(command) && isOutgoing(command);
} }
private boolean isMailService(Command command) { private boolean isOzgCloudNachrichtenManager(Command command) {
return StringUtils.equals(MapUtils.getString(command.getBody(), CLIENT), MAIL_SERVICE); return StringUtils.equals(MapUtils.getString(command.getBody(), CLIENT), OZGCLOUD_NACHRICHTEN_MANAGER);
} }
private boolean isOutgoing(Command command) { private boolean isOutgoing(Command command) {
...@@ -129,7 +129,7 @@ class HistorieCommandHandler { ...@@ -129,7 +129,7 @@ class HistorieCommandHandler {
resultBuilder.order(CommandOrder.CREATE_KOMMENTAR).build(); resultBuilder.order(CommandOrder.CREATE_KOMMENTAR).build();
} else if (name.equals(Wiedervorlage.class.getSimpleName())) { } else if (name.equals(Wiedervorlage.class.getSimpleName())) {
resultBuilder.order(CommandOrder.CREATE_WIEDERVORLAGE).build(); resultBuilder.order(CommandOrder.CREATE_WIEDERVORLAGE).build();
} else if (isMailService(command) && isIncomming(command)) { } else if (isOzgCloudNachrichtenManager(command) && isIncomming(command)) {
resultBuilder.order(CommandOrder.RECEIVE_POSTFACH_NACHRICHT).build(); resultBuilder.order(CommandOrder.RECEIVE_POSTFACH_NACHRICHT).build();
} }
}); });
......
...@@ -111,18 +111,18 @@ class HistorieCommandHandlerTest { ...@@ -111,18 +111,18 @@ class HistorieCommandHandlerTest {
@DisplayName("postfach nachricht verification") @DisplayName("postfach nachricht verification")
@Nested @Nested
class TestIsOutgoingPostfachNachrichtenByMailService { class TestIsOutgoingPostfachNachrichtenByOzgCloudNachrichtenManager {
private final Command matchingCommand = CommandTestFactory.createBuilder() private final Command matchingCommand = CommandTestFactory.createBuilder()
.order(CommandOrder.CREATE_ATTACHED_ITEM) .order(CommandOrder.CREATE_ATTACHED_ITEM)
.body(Map.of("item", Map.of(HistorieCommandHandler.DIRECTION, HistorieCommandHandler.DIRECTION_OUTGOING), .body(Map.of("item", Map.of(HistorieCommandHandler.DIRECTION, HistorieCommandHandler.DIRECTION_OUTGOING),
HistorieCommandHandler.CLIENT, HistorieCommandHandler.MAIL_SERVICE)) HistorieCommandHandler.CLIENT, HistorieCommandHandler.OZGCLOUD_NACHRICHTEN_MANAGER))
.build(); .build();
@DisplayName("should return true if the command is CREATED_ATTACHED_ITEM order outgoing by mailserice") @DisplayName("should return true if the command is CREATED_ATTACHED_ITEM order outgoing by mailserice")
@Test @Test
void shouldReturnTrue() { void shouldReturnTrue() {
var result = handler.isOutgoingPostfachNachrichtByMailService(matchingCommand); var result = handler.isOutgoingPostfachNachrichtByOzgCloudNachrichtenManager(matchingCommand);
assertThat(result).isTrue(); assertThat(result).isTrue();
} }
...@@ -131,10 +131,10 @@ class HistorieCommandHandlerTest { ...@@ -131,10 +131,10 @@ class HistorieCommandHandlerTest {
void shouldReturnFalseOnIncoming() { void shouldReturnFalseOnIncoming() {
var nonMatchingCommand = matchingCommand.toBuilder() var nonMatchingCommand = matchingCommand.toBuilder()
.body(Map.of("item", Map.of(HistorieCommandHandler.DIRECTION, HistorieCommandHandler.DIRECTION_INCOMMING), .body(Map.of("item", Map.of(HistorieCommandHandler.DIRECTION, HistorieCommandHandler.DIRECTION_INCOMMING),
HistorieCommandHandler.CLIENT, HistorieCommandHandler.MAIL_SERVICE)) HistorieCommandHandler.CLIENT, HistorieCommandHandler.OZGCLOUD_NACHRICHTEN_MANAGER))
.build(); .build();
var result = handler.isOutgoingPostfachNachrichtByMailService(nonMatchingCommand); var result = handler.isOutgoingPostfachNachrichtByOzgCloudNachrichtenManager(nonMatchingCommand);
assertThat(result).isFalse(); assertThat(result).isFalse();
} }
...@@ -146,7 +146,7 @@ class HistorieCommandHandlerTest { ...@@ -146,7 +146,7 @@ class HistorieCommandHandlerTest {
HistorieCommandHandler.CLIENT, "Goofy")) HistorieCommandHandler.CLIENT, "Goofy"))
.build(); .build();
var result = handler.isOutgoingPostfachNachrichtByMailService(nonMatchingCommand); var result = handler.isOutgoingPostfachNachrichtByOzgCloudNachrichtenManager(nonMatchingCommand);
assertThat(result).isFalse(); assertThat(result).isFalse();
} }
...@@ -262,7 +262,7 @@ class HistorieCommandHandlerTest { ...@@ -262,7 +262,7 @@ class HistorieCommandHandlerTest {
@CsvSource(value = { "RECEIVE_POSTFACH_NACHRICHT;IN" }, delimiter = ';') @CsvSource(value = { "RECEIVE_POSTFACH_NACHRICHT;IN" }, delimiter = ';')
void shouldTranslateToReveivedIncomminNachricht(String target, String direction) { void shouldTranslateToReveivedIncomminNachricht(String target, String direction) {
var command = handler.translateOrder( var command = handler.translateOrder(
createCommand("MailService", CommandOrder.CREATE_ATTACHED_ITEM, direction)); createCommand("OzgCloud_NachrichtenManager", CommandOrder.CREATE_ATTACHED_ITEM, direction));
assertThat(command.getOrder().name()).isEqualTo(target); assertThat(command.getOrder().name()).isEqualTo(target);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment