From c58bc7a82af893befc86d98baa64cf12ec207d9a Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Thu, 11 Jul 2024 10:09:10 +0200 Subject: [PATCH] require DOMAIN_DNS_SETU.assignedTo(MANAGED_WEBSPACE) --- .../hsadminng/hs/hosting/asset/HsHostingAssetType.java | 3 ++- .../hs/hosting/asset/HsHostingAssetTypeUnitTest.java | 1 + .../HsDomainDnsSetupHostingAssetValidatorUnitTest.java | 10 ++++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetType.java b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetType.java index b3d574e1..0054974b 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetType.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetType.java @@ -56,7 +56,8 @@ public enum HsHostingAssetType implements Node { DOMAIN_DNS_SETUP( // named e.g. example.org inGroup("Domain"), - requiredParent(DOMAIN_SETUP)), + requiredParent(DOMAIN_SETUP), + assignedTo(MANAGED_WEBSPACE)), DOMAIN_HTTP_SETUP( // named e.g. example.org inGroup("Domain"), diff --git a/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetTypeUnitTest.java b/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetTypeUnitTest.java index 24eea31d..870e2f8f 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetTypeUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetTypeUnitTest.java @@ -63,6 +63,7 @@ class HsHostingAssetTypeUnitTest { HA_EMAIL_ALIAS *==> HA_MANAGED_WEBSPACE HA_DOMAIN_SETUP o..> HA_DOMAIN_SETUP HA_DOMAIN_DNS_SETUP *==> HA_DOMAIN_SETUP + HA_DOMAIN_DNS_SETUP o..> HA_MANAGED_WEBSPACE HA_DOMAIN_HTTP_SETUP *==> HA_DOMAIN_SETUP HA_DOMAIN_HTTP_SETUP o..> HA_UNIX_USER HA_DOMAIN_SMTP_SETUP *==> HA_DOMAIN_SETUP diff --git a/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/validators/HsDomainDnsSetupHostingAssetValidatorUnitTest.java b/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/validators/HsDomainDnsSetupHostingAssetValidatorUnitTest.java index 715138ec..22ed60a1 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/validators/HsDomainDnsSetupHostingAssetValidatorUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/validators/HsDomainDnsSetupHostingAssetValidatorUnitTest.java @@ -12,6 +12,7 @@ import java.util.Map; import static java.util.Map.entry; import static net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAssetType.DOMAIN_DNS_SETUP; import static net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAssetType.DOMAIN_SETUP; +import static net.hostsharing.hsadminng.hs.hosting.asset.TestHsHostingAssetEntities.TEST_MANAGED_WEBSPACE_HOSTING_ASSET; import static net.hostsharing.hsadminng.hs.hosting.asset.validators.HsDomainDnsSetupHostingAssetValidator.RR_COMMENT; import static net.hostsharing.hsadminng.hs.hosting.asset.validators.HsDomainDnsSetupHostingAssetValidator.RR_RECORD_DATA; import static net.hostsharing.hsadminng.hs.hosting.asset.validators.HsDomainDnsSetupHostingAssetValidator.RR_RECORD_TYPE; @@ -23,14 +24,15 @@ import static org.assertj.core.api.Assertions.assertThat; class HsDomainDnsSetupHostingAssetValidatorUnitTest { static final HsHostingAssetEntity validDomainSetupEntity = HsHostingAssetEntity.builder() - .type(DOMAIN_SETUP) - .identifier("example.org") - .build(); + .type(DOMAIN_SETUP) + .identifier("example.org") + .build(); static HsHostingAssetEntityBuilder validEntityBuilder() { return HsHostingAssetEntity.builder() .type(DOMAIN_DNS_SETUP) .parentAsset(validDomainSetupEntity) + .assignedToAsset(TEST_MANAGED_WEBSPACE_HOSTING_ASSET) .identifier("example.org|DNS") .config(Map.ofEntries( entry("user-RR", Array.of( @@ -129,7 +131,7 @@ class HsDomainDnsSetupHostingAssetValidatorUnitTest { assertThat(result).containsExactlyInAnyOrder( "'DOMAIN_DNS_SETUP:example.org|DNS.bookingItem' must be null but is of type CLOUD_SERVER", "'DOMAIN_DNS_SETUP:example.org|DNS.parentAsset' must be of type DOMAIN_SETUP but is null", - "'DOMAIN_DNS_SETUP:example.org|DNS.assignedToAsset' must be null but is of type DOMAIN_SETUP"); + "'DOMAIN_DNS_SETUP:example.org|DNS.assignedToAsset' must be of type MANAGED_WEBSPACE but is of type DOMAIN_SETUP"); } @Test