booking-item-to-related-hosting-asset-just-1-to-1 #61
@ -284,7 +284,7 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup
|
||||
@Test
|
||||
void globalAdmin_canPatchAllUpdatablePropertiesOfBookingItem() {
|
||||
|
||||
final var givenBookingItem = givenSomeNewBookingItem(1000111, MANAGED_WEBSPACE,
|
||||
final var givenBookingItem = givenSomeNewBookingItem("D-1000111 default project", MANAGED_WEBSPACE,
|
||||
resource("HDD", 100), resource("SSD", 50), resource("Traffic", 250));
|
||||
|
||||
RestAssured // @formatter:off
|
||||
@ -339,7 +339,7 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup
|
||||
@Test
|
||||
void globalAdmin_canDeleteArbitraryBookingItem() {
|
||||
context.define("superuser-alex@hostsharing.net");
|
||||
final var givenBookingItem = givenSomeNewBookingItem(1000111, MANAGED_WEBSPACE,
|
||||
final var givenBookingItem = givenSomeNewBookingItem("D-1000111 default project", MANAGED_WEBSPACE,
|
||||
resource("HDD", 100), resource("SSD", 50), resource("Traffic", 250));
|
||||
|
||||
RestAssured // @formatter:off
|
||||
@ -358,7 +358,7 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup
|
||||
@Test
|
||||
void normalUser_canNotDeleteUnrelatedBookingItem() {
|
||||
context.define("superuser-alex@hostsharing.net");
|
||||
final var givenBookingItem = givenSomeNewBookingItem(1000111, MANAGED_WEBSPACE,
|
||||
final var givenBookingItem = givenSomeNewBookingItem("D-1000111 default project", MANAGED_WEBSPACE,
|
||||
resource("HDD", 100), resource("SSD", 50), resource("Traffic", 250));
|
||||
|
||||
RestAssured // @formatter:off
|
||||
@ -376,14 +376,11 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
private HsBookingItemEntity givenSomeNewBookingItem(final int debitorNumber,
|
||||
private HsBookingItemEntity givenSomeNewBookingItem(final String projectCaption,
|
||||
final HsBookingItemType hsBookingItemType, final Map.Entry<String, Object>... resources) {
|
||||
return jpaAttempt.transacted(() -> {
|
||||
context.define("superuser-alex@hostsharing.net");
|
||||
// FIXME: use projectRepo directly
|
||||
final var givenProject = debitorRepo.findDebitorByDebitorNumber(debitorNumber).stream()
|
||||
.map(d -> projectRepo.findAllByDebitorUuid(d.getUuid()))
|
||||
.flatMap(java.util.List::stream)
|
||||
final var givenProject = projectRepo.findByCaption(projectCaption).stream()
|
||||
.findAny().orElseThrow();
|
||||
final var newBookingItem = HsBookingItemEntity.builder()
|
||||
.uuid(UUID.randomUUID())
|
||||
|
@ -63,7 +63,6 @@ public abstract class ContextBasedTestWithCleanup extends ContextBasedTest {
|
||||
return merged;
|
||||
}
|
||||
|
||||
// FIXME: remove HsOfficeCoopAssetsTransactionRawEntity, which is not needed anymore after this change
|
||||
public UUID toCleanup(final Class<? extends RbacObject> entityClass, final UUID uuidToCleanup) {
|
||||
out.println("toCleanup(" + entityClass.getSimpleName() + ", " + uuidToCleanup + ")");
|
||||
entitiesToCleanup.put(uuidToCleanup, entityClass);
|
||||
|
Loading…
Reference in New Issue
Block a user