add DomainSetup-HostingAssets for new BookingItem via created-event #111

Merged
hsh-michaelhoennig merged 31 commits from add-hsoting-asset-to-booking-item-resource-and-created-event into master 2024-10-08 11:48:35 +02:00
Showing only changes of commit 28c56a4fd6 - Show all commits

View File

@ -119,16 +119,8 @@ class DomainSetupHostingAssetFactoryUnitTest {
);
// then
emwFake.stream(BookingItemCreatedEventEntity.class)
.reduce(EntityManagerWrapperFake::toSingleElement)
.map(eventEntity -> {
assertThat(eventEntity.getBookingItem()).isSameAs(givenBookingItem);
assertThat(eventEntity.getAssetJson()).isEqualTo(givenAssetJson);
assertThat(eventEntity.getStatusMessage()).isEqualTo(
"[[DNS] no TXT record 'Hostsharing-domain-setup-verification-code=null' found for domain name 'example.org' (nor in its super-domain)]"
);
return true;
});
assertEventStatus(givenBookingItem, givenAssetJson,
"[[DNS] no TXT record 'Hostsharing-domain-setup-verification-code=null' found for domain name 'example.org' (nor in its super-domain)]");
}
@Test
@ -164,15 +156,8 @@ class DomainSetupHostingAssetFactoryUnitTest {
);
// then
emwFake.stream(BookingItemCreatedEventEntity.class)
.reduce(EntityManagerWrapperFake::toSingleElement)
.map(eventEntity -> {
assertThat(eventEntity.getBookingItem()).isSameAs(givenBookingItem);
assertThat(eventEntity.getAssetJson()).isEqualTo(givenAssetJson);
assertThat(eventEntity.getStatusMessage()).isEqualTo(
"domain DNS setup not allowed for legacy compatibility");
return true;
});
assertEventStatus(givenBookingItem, givenAssetJson,
"domain DNS setup not allowed for legacy compatibility");
}
@SafeVarargs
@ -182,4 +167,20 @@ class DomainSetupHostingAssetFactoryUnitTest {
.resources(Map.ofEntries(givenResources))
.build();
}
private void assertEventStatus(
final HsBookingItemRealEntity givenBookingItem,
final String givenAssetJson,
final String expected) {
emwFake.stream(BookingItemCreatedEventEntity.class)
.reduce(EntityManagerWrapperFake::toSingleElement)
.map(eventEntity -> {
assertThat(eventEntity.getBookingItem()).isSameAs(givenBookingItem);
assertThat(eventEntity.getAssetJson()).isEqualTo(givenAssetJson);
assertThat(eventEntity.getStatusMessage()).isEqualTo(
expected
);
return true;
});
}
}