This commit is contained in:
Michael Hoennig 2024-06-17 19:29:43 +02:00
parent 875ff5c046
commit 75611d7092
2 changed files with 3 additions and 8 deletions

View File

@ -116,8 +116,7 @@ public class HsBookingItemEntity implements Stringifyable, RbacObject {
@JoinColumn(name="parentitemuuid", referencedColumnName="uuid")
private List<HsBookingItemEntity> subBookingItems;
@OneToOne(mappedBy="bookingItem", optional = true)
@NotFound(action = NotFoundAction.IGNORE)
@OneToOne(mappedBy="bookingItem")
private HsHostingAssetEntity relatedHostingAsset;
@Transient

View File

@ -177,15 +177,11 @@ class HsBookingItemRepositoryIntegrationTest extends ContextBasedTestWithCleanup
"HsBookingItemEntity(D-1000212:D-1000212 default project, MANAGED_WEBSPACE, [2022-10-01,), separate ManagedWebspace, { Daemons: 0, Multi: 1, SSD: 100, Traffic: 50 })",
"HsBookingItemEntity(D-1000212:D-1000212 default project, MANAGED_SERVER, [2022-10-01,), separate ManagedServer, { CPUs: 2, RAM: 8, SSD: 500, Traffic: 500 })",
"HsBookingItemEntity(D-1000212:D-1000212 default project, PRIVATE_CLOUD, [2024-04-01,), some PrivateCloud, { CPUs: 10, HDD: 10000, RAM: 32, SSD: 4000, Traffic: 2000 })");
assertThat(result.stream().filter(bi -> bi.getRelatedHostingAsset()!=null).map(bi -> x(bi)).findAny())
.as("at least one relatedProject expected, but none found => fetcing relatedProject does not work")
assertThat(result.stream().filter(bi -> bi.getRelatedHostingAsset()!=null).findAny())
.as("at least one relatedProject expected, but none found => fetching relatedProject does not work")
.isNotEmpty();
}
HsBookingItemEntity x(HsBookingItemEntity x) {
return x;
}
@Test
public void normalUser_canViewOnlyRelatedBookingItems() {
// given: