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

OZG-5984 replace update order by patch

parent 435216fc
Branches
Tags
No related merge requests found
...@@ -121,7 +121,7 @@ public class AttachedItemService { ...@@ -121,7 +121,7 @@ public class AttachedItemService {
String overrideAttachedItem(AttachedItem bescheidItem, Command command) { String overrideAttachedItem(AttachedItem bescheidItem, Command command) {
var attachedItem = buildAttachedItemAsMap(command, buildItemMapWithAllBescheidFields(command)); var attachedItem = buildAttachedItemAsMap(command, buildItemMapWithAllBescheidFields(command));
var finishedOzgCloudCommand = commandService.createAndWaitUntilDone(buildUpdateAttachedItemCommand(bescheidItem, attachedItem)); var finishedOzgCloudCommand = commandService.createAndWaitUntilDone(buildPatchAttachedItemCommand(bescheidItem, attachedItem));
return finishedOzgCloudCommand.getCreatedResource(); return finishedOzgCloudCommand.getCreatedResource();
} }
...@@ -146,7 +146,7 @@ public class AttachedItemService { ...@@ -146,7 +146,7 @@ public class AttachedItemService {
} }
private OzgCloudCommand buildUpdateBescheidDraftCommand(Command command, Optional<Document> document, AttachedItem bescheidItem) { private OzgCloudCommand buildUpdateBescheidDraftCommand(Command command, Optional<Document> document, AttachedItem bescheidItem) {
return buildUpdateAttachedItemCommand(bescheidItem, buildAttachedItemAsMap(command, buildBescheidItemAsMap(command, document))); return buildPatchAttachedItemCommand(bescheidItem, buildAttachedItemAsMap(command, buildBescheidItemAsMap(command, document)));
} }
Map<String, Object> buildBescheidItemAsMap(Command command, Optional<Document> newDocument) { Map<String, Object> buildBescheidItemAsMap(Command command, Optional<Document> newDocument) {
...@@ -173,12 +173,12 @@ public class AttachedItemService { ...@@ -173,12 +173,12 @@ public class AttachedItemService {
return MapUtils.getString(item.getItem(), Bescheid.FIELD_BESCHEID_DOCUMENT); return MapUtils.getString(item.getItem(), Bescheid.FIELD_BESCHEID_DOCUMENT);
} }
OzgCloudCommand buildUpdateAttachedItemCommand(AttachedItem bescheidItem, Map<String, Object> bodyObject) { OzgCloudCommand buildPatchAttachedItemCommand(AttachedItem bescheidItem, Map<String, Object> bodyObject) {
return OzgCloudCommand.builder() return OzgCloudCommand.builder()
.vorgangId(commandMapper.toOzgCloudVorgangId(bescheidItem.getVorgangId())) .vorgangId(commandMapper.toOzgCloudVorgangId(bescheidItem.getVorgangId()))
.relationId(commandMapper.mapRelationId(bescheidItem.getId())) .relationId(commandMapper.mapRelationId(bescheidItem.getId()))
.relationVersion(bescheidItem.getVersion()) .relationVersion(bescheidItem.getVersion())
.order(UPDATE_ATTACHED_ITEM_ORDER) .order(PATCH_ATTACHED_ITEM)
.bodyObject(bodyObject) .bodyObject(bodyObject)
.build(); .build();
} }
......
...@@ -451,12 +451,12 @@ class AttachedItemServiceTest { ...@@ -451,12 +451,12 @@ class AttachedItemServiceTest {
doUpdateBescheidDraft(); doUpdateBescheidDraft();
verify(service).buildUpdateAttachedItemCommand(bescheidItem, expectedBodyObject); verify(service).buildPatchAttachedItemCommand(bescheidItem, expectedBodyObject);
} }
@Test @Test
void shouldCallCommandService() { void shouldCallCommandService() {
doReturn(updateAttachedItemCommand).when(service).buildUpdateAttachedItemCommand(any(), any()); doReturn(updateAttachedItemCommand).when(service).buildPatchAttachedItemCommand(any(), any());
doUpdateBescheidDraft(); doUpdateBescheidDraft();
...@@ -672,12 +672,12 @@ class AttachedItemServiceTest { ...@@ -672,12 +672,12 @@ class AttachedItemServiceTest {
service.overrideAttachedItem(bescheidItem, command); service.overrideAttachedItem(bescheidItem, command);
verify(service).buildUpdateAttachedItemCommand(bescheidItem, bodyObject); verify(service).buildPatchAttachedItemCommand(bescheidItem, bodyObject);
} }
@Test @Test
void shouldCallCommandService() { void shouldCallCommandService() {
doReturn(updateItemCommand).when(service).buildUpdateAttachedItemCommand(any(), any()); doReturn(updateItemCommand).when(service).buildPatchAttachedItemCommand(any(), any());
service.overrideAttachedItem(AttachedItemTestFactory.createBescheid(), command); service.overrideAttachedItem(AttachedItemTestFactory.createBescheid(), command);
...@@ -853,7 +853,7 @@ class AttachedItemServiceTest { ...@@ -853,7 +853,7 @@ class AttachedItemServiceTest {
@Test @Test
void shouldCallVorgangIdMapper() { void shouldCallVorgangIdMapper() {
service.buildUpdateAttachedItemCommand(AttachedItemTestFactory.createBescheid(), Map.of()); service.buildPatchAttachedItemCommand(AttachedItemTestFactory.createBescheid(), Map.of());
verify(commandMapper).toOzgCloudVorgangId(CommandTestFactory.VORGANG_ID); verify(commandMapper).toOzgCloudVorgangId(CommandTestFactory.VORGANG_ID);
} }
...@@ -863,14 +863,14 @@ class AttachedItemServiceTest { ...@@ -863,14 +863,14 @@ class AttachedItemServiceTest {
var expectedVorgangId = OzgCloudVorgangId.from(CommandTestFactory.VORGANG_ID); var expectedVorgangId = OzgCloudVorgangId.from(CommandTestFactory.VORGANG_ID);
when(commandMapper.toOzgCloudVorgangId(any())).thenReturn(expectedVorgangId); when(commandMapper.toOzgCloudVorgangId(any())).thenReturn(expectedVorgangId);
var result = service.buildUpdateAttachedItemCommand(AttachedItemTestFactory.createBescheid(), Map.of()); var result = service.buildPatchAttachedItemCommand(AttachedItemTestFactory.createBescheid(), Map.of());
assertThat(result.getVorgangId()).isEqualTo(expectedVorgangId); assertThat(result.getVorgangId()).isEqualTo(expectedVorgangId);
} }
@Test @Test
void shouldCallRelationIdMapper() { void shouldCallRelationIdMapper() {
service.buildUpdateAttachedItemCommand(AttachedItemTestFactory.createBescheid(), Map.of()); service.buildPatchAttachedItemCommand(AttachedItemTestFactory.createBescheid(), Map.of());
verify(commandMapper).mapRelationId(AttachedItemTestFactory.ID); verify(commandMapper).mapRelationId(AttachedItemTestFactory.ID);
} }
...@@ -880,30 +880,30 @@ class AttachedItemServiceTest { ...@@ -880,30 +880,30 @@ class AttachedItemServiceTest {
var expectedId = GenericId.from("relationId"); var expectedId = GenericId.from("relationId");
when(commandMapper.mapRelationId(any())).thenReturn(expectedId); when(commandMapper.mapRelationId(any())).thenReturn(expectedId);
var result = service.buildUpdateAttachedItemCommand(AttachedItemTestFactory.createBescheid(), Map.of()); var result = service.buildPatchAttachedItemCommand(AttachedItemTestFactory.createBescheid(), Map.of());
assertThat(result.getRelationId()).isEqualTo(expectedId); assertThat(result.getRelationId()).isEqualTo(expectedId);
} }
@Test @Test
void shouldSetRelationVersion() { void shouldSetRelationVersion() {
var result = service.buildUpdateAttachedItemCommand(AttachedItemTestFactory.createBescheid(), Map.of()); var result = service.buildPatchAttachedItemCommand(AttachedItemTestFactory.createBescheid(), Map.of());
assertThat(result.getRelationVersion()).isEqualTo(AttachedItemTestFactory.VERSION); assertThat(result.getRelationVersion()).isEqualTo(AttachedItemTestFactory.VERSION);
} }
@Test @Test
void shouldSetOrder() { void shouldSetOrder() {
var result = service.buildUpdateAttachedItemCommand(AttachedItemTestFactory.createBescheid(), Map.of()); var result = service.buildPatchAttachedItemCommand(AttachedItemTestFactory.createBescheid(), Map.of());
assertThat(result.getOrder()).isEqualTo(AttachedItemService.UPDATE_ATTACHED_ITEM_ORDER); assertThat(result.getOrder()).isEqualTo(AttachedItemService.PATCH_ATTACHED_ITEM);
} }
@Test @Test
void shouldSetBodyObject() { void shouldSetBodyObject() {
var bodyObject = Map.<String, Object>of("key", "value"); var bodyObject = Map.<String, Object>of("key", "value");
var result = service.buildUpdateAttachedItemCommand(AttachedItemTestFactory.createBescheid(), bodyObject); var result = service.buildPatchAttachedItemCommand(AttachedItemTestFactory.createBescheid(), bodyObject);
assertThat(result.getBodyObject()).containsAllEntriesOf(bodyObject); assertThat(result.getBodyObject()).containsAllEntriesOf(bodyObject);
} }
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
<zufi-manager-interface.version>1.0.0-SNAPSHOT</zufi-manager-interface.version> <zufi-manager-interface.version>1.0.0-SNAPSHOT</zufi-manager-interface.version>
<user-manager-interface.version>2.1.0</user-manager-interface.version> <user-manager-interface.version>2.1.0</user-manager-interface.version>
<bescheid-manager.version>1.13.0</bescheid-manager.version> <bescheid-manager.version>1.14.0-SNAPSHOT</bescheid-manager.version>
<processor-manager.version>0.4.0</processor-manager.version> <processor-manager.version>0.4.0</processor-manager.version>
<nachrichten-manager.version>2.9.0</nachrichten-manager.version> <nachrichten-manager.version>2.9.0</nachrichten-manager.version>
<ozgcloud-starter.version>0.10.0</ozgcloud-starter.version> <ozgcloud-starter.version>0.10.0</ozgcloud-starter.version>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment