finalize PrivateCloud, Cloud- and ManagedServer and ManagedWebspace Billingtems and HostingAssets #63
@ -1,7 +1,5 @@
|
|||||||
package net.hostsharing.hsadminng.hs.booking.item.validators;
|
package net.hostsharing.hsadminng.hs.booking.item.validators;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import static net.hostsharing.hsadminng.hs.validation.BooleanProperty.booleanProperty;
|
import static net.hostsharing.hsadminng.hs.validation.BooleanProperty.booleanProperty;
|
||||||
import static net.hostsharing.hsadminng.hs.validation.EnumerationProperty.enumerationProperty;
|
import static net.hostsharing.hsadminng.hs.validation.EnumerationProperty.enumerationProperty;
|
||||||
import static net.hostsharing.hsadminng.hs.validation.IntegerProperty.integerProperty;
|
import static net.hostsharing.hsadminng.hs.validation.IntegerProperty.integerProperty;
|
||||||
@ -15,12 +13,16 @@ class HsCloudServerBookingItemValidator extends HsBookingItemEntityValidator {
|
|||||||
|
|
||||||
integerProperty("CPUs") .min( 1) .max( 32) .required(),
|
integerProperty("CPUs") .min( 1) .max( 32) .required(),
|
||||||
integerProperty("RAM").unit("GB") .min( 1) .max( 128) .required(),
|
integerProperty("RAM").unit("GB") .min( 1) .max( 128) .required(),
|
||||||
integerProperty("SSD").unit("GB") .min( 25) .max( 1000) .step(25).required(),
|
integerProperty("SSD").unit("GB") .min( 0) .max( 1000) .step(25).required(), // (1)
|
||||||
integerProperty("HDD").unit("GB") .min( 0) .max( 4000) .step(250).withDefault(0),
|
integerProperty("HDD").unit("GB") .min( 0) .max( 4000) .step(250).withDefault(0),
|
||||||
integerProperty("Traffic").unit("GB") .min(250) .max(10000) .step(250).required(),
|
integerProperty("Traffic").unit("GB") .min(250) .max(10000) .step(250).required(),
|
||||||
hsh-michaelhoennig marked this conversation as resolved
|
|||||||
|
|
||||||
enumerationProperty("SLA-Infrastructure").values("BASIC", "EXT8H", "EXT4H", "EXT2H").optional()
|
enumerationProperty("SLA-Infrastructure").values("BASIC", "EXT8H", "EXT4H", "EXT2H").optional()
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// (q) We do have pre-existing CloudServers without SSD, just HDD, thus SSD starts with min=0.
|
||||||
|
// TODO.impl: Validation that SSD+HDD is at minimum 25 GB is missing.
|
||||||
|
// e.g. validationGroup("SSD", "HDD").min(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ public class EnumerationProperty extends ValidatableProperty<String> {
|
|||||||
public void deferredInit(final ValidatableProperty<?>[] allProperties) {
|
public void deferredInit(final ValidatableProperty<?>[] allProperties) {
|
||||||
if (deferredInit != null) {
|
if (deferredInit != null) {
|
||||||
if (this.values != null) {
|
if (this.values != null) {
|
||||||
throw new IllegalStateException("property " + toString() + " already values");
|
throw new IllegalStateException("property " + toString() + " already has values");
|
||||||
}
|
}
|
||||||
this.values = deferredInit.apply(allProperties);
|
this.values = deferredInit.apply(allProperties);
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ class HsCloudServerBookingItemValidatorUnitTest {
|
|||||||
"{type=boolean, propertyName=active, required=false, defaultValue=true, isTotalsValidator=false}",
|
"{type=boolean, propertyName=active, required=false, defaultValue=true, isTotalsValidator=false}",
|
||||||
"{type=integer, propertyName=CPUs, min=1, max=32, required=true, isTotalsValidator=false}",
|
"{type=integer, propertyName=CPUs, min=1, max=32, required=true, isTotalsValidator=false}",
|
||||||
"{type=integer, propertyName=RAM, unit=GB, min=1, max=128, required=true, isTotalsValidator=false}",
|
"{type=integer, propertyName=RAM, unit=GB, min=1, max=128, required=true, isTotalsValidator=false}",
|
||||||
"{type=integer, propertyName=SSD, unit=GB, min=25, max=1000, step=25, required=true, isTotalsValidator=false}",
|
"{type=integer, propertyName=SSD, unit=GB, min=0, max=1000, step=25, required=true, isTotalsValidator=false}",
|
||||||
"{type=integer, propertyName=HDD, unit=GB, min=0, max=4000, step=250, required=false, defaultValue=0, isTotalsValidator=false}",
|
"{type=integer, propertyName=HDD, unit=GB, min=0, max=4000, step=250, required=false, defaultValue=0, isTotalsValidator=false}",
|
||||||
"{type=integer, propertyName=Traffic, unit=GB, min=250, max=10000, step=250, required=true, isTotalsValidator=false}",
|
"{type=integer, propertyName=Traffic, unit=GB, min=250, max=10000, step=250, required=true, isTotalsValidator=false}",
|
||||||
"{type=enumeration, propertyName=SLA-Infrastructure, values=[BASIC, EXT8H, EXT4H, EXT2H], required=false, isTotalsValidator=false}");
|
"{type=enumeration, propertyName=SLA-Infrastructure, values=[BASIC, EXT8H, EXT4H, EXT2H], required=false, isTotalsValidator=false}");
|
||||||
|
Loading…
Reference in New Issue
Block a user
min(0) für Bestands-Cloud-Server