assert packet.old_inet_addr_id and packet.free

This commit is contained in:
Michael Hoennig 2024-07-19 12:37:22 +02:00
parent 7775491f6f
commit 7daf57513e
2 changed files with 11 additions and 3 deletions

View File

@ -253,7 +253,7 @@ class Record {
Integer getInteger(final String columnName) { Integer getInteger(final String columnName) {
final String value = getString(columnName); final String value = getString(columnName);
return isNotBlank(value) ? Integer.parseInt(value.trim()) : 0; return isNotBlank(value) ? Integer.parseInt(value.trim()) : null;
} }
BigDecimal getBigDecimal(final String columnName) { BigDecimal getBigDecimal(final String columnName) {

View File

@ -353,8 +353,12 @@ public class ImportHostingAssets extends ImportOfficeData {
final var created = rec.getLocalDate("created"); final var created = rec.getLocalDate("created");
final var cancelled = rec.getLocalDate("cancelled"); final var cancelled = rec.getLocalDate("cancelled");
final var cur_inet_addr_id = rec.getInteger("cur_inet_addr_id"); final var cur_inet_addr_id = rec.getInteger("cur_inet_addr_id");
final var old_inet_addr_id = rec.getInteger("old_inet_addr_id"); // FIXME: assert that null final var old_inet_addr_id = rec.getInteger("old_inet_addr_id");
final var free = rec.getBoolean("free"); // FIXME: assert that "free webspace => in customer managed server", otherwise ignore final var free = rec.getBoolean("free");
assertThat(old_inet_addr_id)
.as("packet.old_inet_addr_id not supported, but is not null for " + packet_name)
.isNull();
final var biType = determineBiType(basepacket_code); final var biType = determineBiType(basepacket_code);
final var bookingItem = HsBookingItemEntity.builder() final var bookingItem = HsBookingItemEntity.builder()
@ -366,6 +370,10 @@ public class ImportHostingAssets extends ImportOfficeData {
bookingItems.put(PACKET_ID_OFFSET + packet_id, bookingItem); bookingItems.put(PACKET_ID_OFFSET + packet_id, bookingItem);
final var haType = determineHaType(basepacket_code); final var haType = determineHaType(basepacket_code);
assertThat(!free || haType == MANAGED_WEBSPACE || bookingItem.getRelatedProject().getDebitor().getDefaultPrefix().equals("hsh"))
.as("packet.free only supported for Hostsharing-Assets and ManagedWebspace in customer-ManagedServer, but is set for " + packet_name)
.isTrue();
final var asset = HsHostingAssetEntity.builder() final var asset = HsHostingAssetEntity.builder()
.isLoaded(haType == MANAGED_WEBSPACE) // this turns off identifier validation to accept former default prefixes .isLoaded(haType == MANAGED_WEBSPACE) // this turns off identifier validation to accept former default prefixes
.type(haType) .type(haType)