diff --git a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemController.java b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemController.java index 4aeb8172..b74e7e0c 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemController.java @@ -1,11 +1,11 @@ package net.hostsharing.hsadminng.hs.booking.item; +import net.hostsharing.hsadminng.context.Context; import net.hostsharing.hsadminng.hs.booking.generated.api.v1.api.HsBookingItemsApi; import net.hostsharing.hsadminng.hs.booking.generated.api.v1.model.HsBookingItemInsertResource; import net.hostsharing.hsadminng.hs.booking.generated.api.v1.model.HsBookingItemPatchResource; import net.hostsharing.hsadminng.hs.booking.generated.api.v1.model.HsBookingItemResource; import net.hostsharing.hsadminng.mapper.Mapper; -import net.hostsharing.hsadminng.context.Context; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.transaction.annotation.Transactional; @@ -76,10 +76,10 @@ public class HsBookingItemController implements HsBookingItemsApi { context.define(currentUser, assumedRoles); final var result = bookingItemRepo.findByUuid(bookingItemUuid); - if (result.isEmpty()) { - return ResponseEntity.notFound().build(); - } - return ResponseEntity.ok(mapper.map(result.get(), HsBookingItemResource.class, ENTITY_TO_RESOURCE_POSTMAPPER)); + return result + .map(bookingItemEntity -> ResponseEntity.ok( + mapper.map(bookingItemEntity, HsBookingItemResource.class, ENTITY_TO_RESOURCE_POSTMAPPER))) + .orElseGet(() -> ResponseEntity.notFound().build()); } @Override @@ -91,11 +91,9 @@ public class HsBookingItemController implements HsBookingItemsApi { context.define(currentUser, assumedRoles); final var result = bookingItemRepo.deleteByUuid(bookingItemUuid); - if (result == 0) { - return ResponseEntity.notFound().build(); - } - - return ResponseEntity.noContent().build(); + return result == 0 + ? ResponseEntity.notFound().build() + : ResponseEntity.noContent().build(); } @Override @@ -122,7 +120,6 @@ public class HsBookingItemController implements HsBookingItemsApi { if (entity.getValidity().hasUpperBound()) { resource.setValidTo(entity.getValidity().upper().minusDays(1)); } - resource.getDebitor().setDebitorNumber(entity.getDebitor().getDebitorNumber()); }; final BiConsumer RESOURCE_TO_ENTITY_POSTMAPPER = (resource, entity) -> { diff --git a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemEntity.java b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemEntity.java index c5edf1b1..cf29c709 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemEntity.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemEntity.java @@ -118,6 +118,7 @@ public class HsBookingItemEntity implements Stringifyable, RbacObject { public static RbacView rbac() { return rbacViewFor("bookingItem", HsBookingItemEntity.class) .withIdentityView(SQL.projection("caption")) // FIXME: use memberNumber:caption + .withRestrictedViewOrderBy(SQL.expression("validity")) .withUpdatableColumns("version", "validity", "resources") .importEntityAlias("debitor", HsOfficeDebitorEntity.class, diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountController.java b/src/main/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountController.java index 764d0a4a..9f39767f 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountController.java @@ -74,11 +74,11 @@ public class HsOfficeBankAccountController implements HsOfficeBankAccountsApi { public ResponseEntity getBankAccountByUuid( final String currentUser, final String assumedRoles, - final UUID BankAccountUuid) { + final UUID bankAccountUuid) { context.define(currentUser, assumedRoles); - final var result = bankAccountRepo.findByUuid(BankAccountUuid); + final var result = bankAccountRepo.findByUuid(bankAccountUuid); if (result.isEmpty()) { return ResponseEntity.notFound().build(); } diff --git a/src/main/resources/api-definition/hs-booking/api-mappings.yaml b/src/main/resources/api-definition/hs-booking/api-mappings.yaml index 9faac586..bce81426 100644 --- a/src/main/resources/api-definition/hs-booking/api-mappings.yaml +++ b/src/main/resources/api-definition/hs-booking/api-mappings.yaml @@ -14,5 +14,5 @@ map: - type: string:format => java.lang.String paths: - /api/hs/booking/items/{itemUUID}: + /api/hs/booking/items/{bookingItemUuid}: null: org.openapitools.jackson.nullable.JsonNullable diff --git a/src/main/resources/api-definition/hs-booking/hs-booking-item-schemas.yaml b/src/main/resources/api-definition/hs-booking/hs-booking-item-schemas.yaml index 1b0fb77c..e06a5ffd 100644 --- a/src/main/resources/api-definition/hs-booking/hs-booking-item-schemas.yaml +++ b/src/main/resources/api-definition/hs-booking/hs-booking-item-schemas.yaml @@ -9,8 +9,6 @@ components: uuid: type: string format: uuid - debitor: - $ref: '../hs-office/hs-office-debitor-schemas.yaml#/components/schemas/HsOfficeDebitor' caption: type: string validFrom: @@ -44,7 +42,6 @@ components: nullable: true resources: $ref: '#/components/schemas/ArbitraryBookingResourcesJson' - additionalProperties: false HsBookingItemInsert: type: object diff --git a/src/main/resources/api-definition/hs-booking/hs-booking-items-with-uuid.yaml b/src/main/resources/api-definition/hs-booking/hs-booking-items-with-uuid.yaml index 955e45b8..99a8803a 100644 --- a/src/main/resources/api-definition/hs-booking/hs-booking-items-with-uuid.yaml +++ b/src/main/resources/api-definition/hs-booking/hs-booking-items-with-uuid.yaml @@ -6,7 +6,7 @@ get: parameters: - $ref: './auth.yaml#/components/parameters/currentUser' - $ref: './auth.yaml#/components/parameters/assumedRoles' - - name: bookingItemUUID + - name: bookingItemUuid in: path required: true schema: @@ -34,7 +34,7 @@ patch: parameters: - $ref: './auth.yaml#/components/parameters/currentUser' - $ref: './auth.yaml#/components/parameters/assumedRoles' - - name: bookingItemUUID + - name: bookingItemUuid in: path required: true schema: @@ -65,7 +65,7 @@ delete: parameters: - $ref: './auth.yaml#/components/parameters/currentUser' - $ref: './auth.yaml#/components/parameters/assumedRoles' - - name: bookingItemUUID + - name: bookingItemUuid in: path required: true schema: diff --git a/src/main/resources/api-definition/hs-booking/hs-booking-items.yaml b/src/main/resources/api-definition/hs-booking/hs-booking-items.yaml index 4fd8b650..1e6679b4 100644 --- a/src/main/resources/api-definition/hs-booking/hs-booking-items.yaml +++ b/src/main/resources/api-definition/hs-booking/hs-booking-items.yaml @@ -1,6 +1,6 @@ get: - summary: Returns a list of (optionally filtered) booking items. - description: Returns the list of (optionally filtered) booking items which are visible to the current user or any of it's assumed roles. + summary: Returns a list of all booking items for a specified debitor. + description: Returns the list of all booking items for a specified debitor which are visible to the current user or any of it's assumed roles. tags: - hs-booking-items operationId: listBookingItemsByDebitorUuid @@ -9,7 +9,7 @@ get: - $ref: './auth.yaml#/components/parameters/assumedRoles' - name: debitorUuid in: query - required: false + required: true schema: type: string format: uuid diff --git a/src/main/resources/api-definition/hs-booking/hs-booking.yaml b/src/main/resources/api-definition/hs-booking/hs-booking.yaml index e2311b85..8da21d09 100644 --- a/src/main/resources/api-definition/hs-booking/hs-booking.yaml +++ b/src/main/resources/api-definition/hs-booking/hs-booking.yaml @@ -13,5 +13,5 @@ paths: /api/hs/booking/items: $ref: "./hs-booking-items.yaml" - /api/hs/booking/items/{itemUUID}: + /api/hs/booking/items/{bookingItemUuid}: $ref: "./hs-booking-items-with-uuid.yaml" diff --git a/src/main/resources/db/changelog/6-hs-booking/601-booking-item/6018-hs-booking-item-test-data.sql b/src/main/resources/db/changelog/6-hs-booking/601-booking-item/6018-hs-booking-item-test-data.sql index 6102c2b7..7a688e42 100644 --- a/src/main/resources/db/changelog/6-hs-booking/601-booking-item/6018-hs-booking-item-test-data.sql +++ b/src/main/resources/db/changelog/6-hs-booking/601-booking-item/6018-hs-booking-item-test-data.sql @@ -10,8 +10,7 @@ */ create or replace procedure createHsBookingItemTransactionTestData( givenPartnerNumber numeric, - givenDebitorSuffix char(2), - givenCaption varchar + givenDebitorSuffix char(2) ) language plpgsql as $$ declare @@ -33,7 +32,9 @@ begin raise notice '- using debitor (%): %', relatedDebitor.uuid, relatedDebitor; insert into hs_booking_item (uuid, debitoruuid, caption, validity, resources) - values (uuid_generate_v4(), relatedDebitor.uuid, givenCaption, daterange('20221001' , null, '[]'), '{ "CPUs": 2, "HDD-storage": 512 }'::jsonb); + values (uuid_generate_v4(), relatedDebitor.uuid, 'some ManagedServer', daterange('20221001', null, '[]'), '{ "CPUs": 2, "SDD-storage": 512 }'::jsonb), + (uuid_generate_v4(), relatedDebitor.uuid, 'some CloudServer', daterange('20230115', '20240415', '[)'), '{ "CPUs": 2, "HDD-storage": 1024 }'::jsonb), + (uuid_generate_v4(), relatedDebitor.uuid, 'some Whatever', daterange('20240401', null, '[]'), '{ "CPUs": 1, "SDD-storage": 512, "HDD-storage": 2048 }'::jsonb); end; $$; --// @@ -44,8 +45,8 @@ end; $$; do language plpgsql $$ begin - call createHsBookingItemTransactionTestData(10001, '11', 'some booking 1'); - call createHsBookingItemTransactionTestData(10002, '12', 'some booking 2'); - call createHsBookingItemTransactionTestData(10003, '13', 'some booking 3'); + call createHsBookingItemTransactionTestData(10001, '11'); + call createHsBookingItemTransactionTestData(10002, '12'); + call createHsBookingItemTransactionTestData(10003, '13'); end; $$; diff --git a/src/test/java/net/hostsharing/hsadminng/arch/ArchitectureTest.java b/src/test/java/net/hostsharing/hsadminng/arch/ArchitectureTest.java index a1ee752a..1523f7cf 100644 --- a/src/test/java/net/hostsharing/hsadminng/arch/ArchitectureTest.java +++ b/src/test/java/net/hostsharing/hsadminng/arch/ArchitectureTest.java @@ -50,6 +50,7 @@ public class ArchitectureTest { "..hs.office.person", "..hs.office.relation", "..hs.office.sepamandate", + "..hs.booking.item", "..errors", "..mapper", "..ping", @@ -123,11 +124,22 @@ public class ArchitectureTest { @ArchTest @SuppressWarnings("unused") - public static final ArchRule hsAdminPackagesRule = classes() + public static final ArchRule hsOfficePackageAccessRule = classes() .that().resideInAPackage("..hs.office.(*)..") .should().onlyBeAccessed().byClassesThat() .resideInAnyPackage( "..hs.office.(*)..", + "..hs.booking.(*)..", + "..rbac.rbacgrant" // TODO.test: just because of RbacGrantsDiagramServiceIntegrationTest + ); + + @ArchTest + @SuppressWarnings("unused") + public static final ArchRule hsBookingPackageAccessRule = classes() + .that().resideInAPackage("..hs.booking.(*)..") + .should().onlyBeAccessed().byClassesThat() + .resideInAnyPackage( + "..hs.booking.(*)..", "..rbac.rbacgrant" // TODO.test: just because of RbacGrantsDiagramServiceIntegrationTest ); diff --git a/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerAcceptanceTest.java index 4376626b..a21fd863 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerAcceptanceTest.java @@ -19,8 +19,10 @@ import org.springframework.transaction.annotation.Transactional; import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; import java.time.LocalDate; +import java.util.Map; import java.util.UUID; +import static java.util.Map.entry; import static net.hostsharing.test.JsonMatcher.lenientlyEquals; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.startsWith; @@ -62,28 +64,31 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup .header("current-user", "superuser-alex@hostsharing.net") .port(port) .when() - .get("http://localhost/api/hs/booking/items?debitorUuid" + givenDebitor.getUuid()) + .get("http://localhost/api/hs/booking/items?debitorUuid=" + givenDebitor.getUuid()) .then().log().all().assertThat() .statusCode(200) .contentType("application/json") .log().all() .body("", lenientlyEquals(""" [ - { - "debitor": { "debitorNumber": 1000111 }, - "validFrom": "2022-10-01", - "validTo": "2026-12-31" - }, - { - "debitor": { "debitorNumber": 1000212 }, - "validFrom": "2022-10-01", - "validTo": "2026-12-31" - }, - { - "debitor": { "debitorNumber": 1000313 }, - "validFrom": "2022-10-01", - "validTo": "2026-12-31" - } + { + "caption": "some ManagedServer", + "validFrom": "2022-10-01", + "validTo": null, + "resources": null + }, + { + "caption": "some CloudServer", + "validFrom": "2023-01-15", + "validTo": "2024-04-14", + "resources": null + }, + { + "caption": "some Whatever", + "validFrom": "2024-04-01", + "validTo": null, + "resources": null + } ] """)); // @formatter:on @@ -97,30 +102,35 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup void globalAdmin_canAddBookingItem() { context.define("superuser-alex@hostsharing.net"); - final var givenDebitor = debitorRepo.findDebitorByOptionalNameLike("Third").get(0); + final var givenDebitor = debitorRepo.findDebitorByDebitorNumber(1000111).get(0); final var location = RestAssured // @formatter:off .given() .header("current-user", "superuser-alex@hostsharing.net") .contentType(ContentType.JSON) .body(""" - { - "debitorUuid": "%s", - "validFrom": "2022-10-13" - } + { + "debitorUuid": "%s", + "caption": "some new booking", + "resources": { + "something": 12 + }, + "validFrom": "2022-10-13" + } """.formatted(givenDebitor.getUuid())) .port(port) .when() - .post("http://localhost/api/hs/office/BookingItems") + .post("http://localhost/api/hs/booking/items") .then().log().all().assertThat() .statusCode(201) .contentType(ContentType.JSON) .body("", lenientlyEquals(""" { - "debitor": { "debitorNumber": 1000111 }, - "validFrom": "2022-10-01", - "validTo": "2026-12-31" - } + "caption": "some new booking", + "validFrom": "2022-10-13", + "validTo": null, + "resources": null + } """)) .header("Location", startsWith("http://localhost")) .extract().header("Location"); // @formatter:on @@ -139,7 +149,7 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup void globalAdmin_canGetArbitraryBookingItem() { context.define("superuser-alex@hostsharing.net"); final var givenBookingItemUuid = bookingItemRepo.findAll().stream() - .filter(bi -> bi.getDebitor().getDebitorNumber() == 1000101) + .filter(bi -> bi.getDebitor().getDebitorNumber() == 1000111) .findAny().orElseThrow().getUuid(); RestAssured // @formatter:off @@ -148,15 +158,16 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup .port(port) .when() .get("http://localhost/api/hs/booking/items/" + givenBookingItemUuid) - .then().log().body().assertThat() + .then().log().all().assertThat() .statusCode(200) .contentType("application/json") .body("", lenientlyEquals(""" { - "debitor": { "debitorNumber": 1000111 }, - "validFrom": "2022-10-01", - "validTo": "2026-12-31" - } + "caption": "some CloudServer", + "validFrom": "2023-01-15", + "validTo": "2024-04-14", + "resources": null + } """)); // @formatter:on } @@ -164,8 +175,9 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup void normalUser_canNotGetUnrelatedBookingItem() { context.define("superuser-alex@hostsharing.net"); final var givenBookingItemUuid = bookingItemRepo.findAll().stream() - .filter(bi -> bi.getDebitor().getDebitorNumber() == 1000101) - .findAny().orElseThrow().getUuid(); + .filter(bi -> bi.getDebitor().getDebitorNumber() == 1000212) + .map(HsBookingItemEntity::getUuid) + .findAny().orElseThrow(); RestAssured // @formatter:off .given() @@ -181,23 +193,25 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup void debitorAgentUser_canGetRelatedBookingItem() { context.define("superuser-alex@hostsharing.net"); final var givenBookingItemUuid = bookingItemRepo.findAll().stream() - .filter(bi -> bi.getDebitor().getDebitorNumber() == 1000101) + .filter(bi -> bi.getDebitor().getDebitorNumber() == 1000313) .findAny().orElseThrow().getUuid(); + generateRbacDiagramForObjectPermission(givenBookingItemUuid, "SELECT", "booking-item-of-debitor-1000313"); RestAssured // @formatter:off .given() - .header("current-user", "person-FirbySusan@example.com") + .header("current-user", "person-TuckerJack@example.com") .port(port) .when() .get("http://localhost/api/hs/booking/items/" + givenBookingItemUuid) - .then().log().body().assertThat() + .then().log().all().assertThat() .statusCode(200) .contentType("application/json") .body("", lenientlyEquals(""" { - "debitor": { "debitorNumber": 1000111 }, - "validFrom": "2022-10-01", - "validTo": "2026-12-31" + "caption": "some CloudServer", + "validFrom": "2023-01-15", + "validTo": "2024-04-14", + "resources": null } """)); // @formatter:on } @@ -227,16 +241,17 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup """) .port(port) .when() - .patch("http://localhost/api/hs/office/BookingItems/" + givenBookingItem.getUuid()) + .patch("http://localhost/api/hs/booking/items/" + givenBookingItem.getUuid()) .then().log().all().assertThat() .statusCode(200) .contentType(ContentType.JSON) .body("", lenientlyEquals(""" { - "debitor": { "debitorNumber": 1000111 }, - "validFrom": "2022-10-01", - "validTo": "2026-12-31" - } + "caption": "some test-booking", + "validFrom": "2020-06-05", + "validTo": "2022-12-31", + "resources": null + } """)); // @formatter:on // finally, the bookingItem is actually updated @@ -267,15 +282,16 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup """) .port(port) .when() - .patch("http://localhost/api/hs/office/BookingItems/" + givenBookingItem.getUuid()) + .patch("http://localhost/api/hs/booking/items/" + givenBookingItem.getUuid()) .then().log().all().assertThat() .statusCode(200) .contentType(ContentType.JSON) .body("", lenientlyEquals(""" { - "debitor": { "debitorNumber": 1000111 }, - "validFrom": "2022-10-01", - "validTo": "2026-12-31" + "caption": "some test-booking", + "validFrom": "2022-11-01", + "validTo": "2022-12-31", + "resources": null } """)); // @formatter:on @@ -305,7 +321,7 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup """) .port(port) .when() - .patch("http://localhost/api/hs/office/BookingItems/" + givenBookingItem.getUuid()) + .patch("http://localhost/api/hs/booking/items/" + givenBookingItem.getUuid()) .then().assertThat() // TODO.impl: I'd prefer a 400, // but OpenApi Spring Code Gen does not convert additonalProperties=false into a validation @@ -333,7 +349,7 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup .header("current-user", "superuser-alex@hostsharing.net") .port(port) .when() - .delete("http://localhost/api/hs/office/BookingItems/" + givenBookingItem.getUuid()) + .delete("http://localhost/api/hs/booking/items/" + givenBookingItem.getUuid()) .then().log().body().assertThat() .statusCode(204); // @formatter:on @@ -351,7 +367,7 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup .header("current-user", "bankaccount-admin@FirstGmbH.example.com") .port(port) .when() - .delete("http://localhost/api/hs/office/BookingItems/" + givenBookingItem.getUuid()) + .delete("http://localhost/api/hs/booking/items/" + givenBookingItem.getUuid()) .then().log().body().assertThat() .statusCode(403); // @formatter:on @@ -370,7 +386,7 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup .header("current-user", "selfregistered-user-drew@hostsharing.org") .port(port) .when() - .delete("http://localhost/api/hs/office/BookingItems/" + givenBookingItem.getUuid()) + .delete("http://localhost/api/hs/booking/items/" + givenBookingItem.getUuid()) .then().log().body().assertThat() .statusCode(404); // @formatter:on @@ -386,6 +402,8 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup final var newBookingItem = HsBookingItemEntity.builder() .uuid(UUID.randomUUID()) .debitor(givenDebitor) + .caption("some test-booking") + .resources(Map.ofEntries(entry("something", 1))) .validity(Range.closedOpen( LocalDate.parse("2022-11-01"), LocalDate.parse("2023-03-31"))) .build(); diff --git a/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemRepositoryIntegrationTest.java index fbce87ae..171535a4 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemRepositoryIntegrationTest.java @@ -148,7 +148,7 @@ class HsBookingItemRepositoryIntegrationTest extends ContextBasedTestWithCleanup public void globalAdmin_withoutAssumedRole_canViewAllBookingItemsOfArbitraryDebitor() { // given context("superuser-alex@hostsharing.net"); - final var debitorUuid = debitorRepo.findDebitorByDebitorNumber(1000111).stream().findAny().orElseThrow().getUuid(); + final var debitorUuid = debitorRepo.findDebitorByDebitorNumber(1000212).stream().findAny().orElseThrow().getUuid(); // when final var result = bookingItemRepo.findAllByDebitorUuid(debitorUuid); @@ -156,7 +156,9 @@ class HsBookingItemRepositoryIntegrationTest extends ContextBasedTestWithCleanup // then allTheseBookingItemsAreReturned( result, - "HsBookingItemEntity(D-1000111, some booking 1, [2022-10-01,), {CPUs=2, HDD-storage=512})"); + "HsBookingItemEntity(D-1000212, some CloudServer, [2023-01-15,2024-04-15), {CPUs=2, HDD-storage=1024})", + "HsBookingItemEntity(D-1000212, some ManagedServer, [2022-10-01,), {CPUs=2, SDD-storage=512})", + "HsBookingItemEntity(D-1000212, some Whatever, [2024-04-01,), {CPUs=1, HDD-storage=2048, SDD-storage=512})"); } @Test @@ -171,7 +173,9 @@ class HsBookingItemRepositoryIntegrationTest extends ContextBasedTestWithCleanup // then: exactlyTheseBookingItemsAreReturned( result, - "HsBookingItemEntity(D-1000111, some booking 1, [2022-10-01,), {CPUs=2, HDD-storage=512})"); + "HsBookingItemEntity(D-1000111, some CloudServer, [2023-01-15,2024-04-15), {CPUs=2, HDD-storage=1024})", + "HsBookingItemEntity(D-1000111, some ManagedServer, [2022-10-01,), {CPUs=2, SDD-storage=512})", + "HsBookingItemEntity(D-1000111, some Whatever, [2024-04-01,), {CPUs=1, HDD-storage=2048, SDD-storage=512})"); } } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorRepositoryIntegrationTest.java index 5224d6e9..8adaa224 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorRepositoryIntegrationTest.java @@ -181,6 +181,7 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTestWithClean .containsExactlyInAnyOrder(Array.fromFormatted( initialGrantNames, "{ grant perm:relation#FirstGmbH-with-DEBITOR-FourtheG:INSERT>sepamandate to role:relation#FirstGmbH-with-DEBITOR-FourtheG:ADMIN by system and assume }", + "{ grant perm:relation#FirstGmbH-with-DEBITOR-FourtheG:INSERT>hs_booking_item to role:relation#FirstGmbH-with-DEBITOR-FourtheG:ADMIN by system and assume }", // owner "{ grant perm:debitor#D-1000122:DELETE to role:relation#FirstGmbH-with-DEBITOR-FourtheG:OWNER by system and assume }",