[config] Enable missing validations (#2720)

* enable validation for multipleLimit
* remove unused validation messages

Signed-off-by: Jan N. Klug <github@klug.nrw>
pull/2729/head
J-N-K 2022-02-01 16:41:56 +01:00 committed by GitHub
parent dec2d7c296
commit 8c16cb6e93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 38 additions and 67 deletions

View File

@ -108,8 +108,18 @@ public final class ConfigDescriptionValidatorImpl implements ConfigDescriptionVa
if (configDescriptionParameter != null) { if (configDescriptionParameter != null) {
// If the parameter supports multiple selection, then it may be provided as an array // If the parameter supports multiple selection, then it may be provided as an array
if (configDescriptionParameter.isMultiple() && configurationParameters.get(key) instanceof List) { if (configDescriptionParameter.isMultiple() && configurationParameters.get(key) instanceof List) {
List<Object> values = (List<Object>) configurationParameters.get(key);
// check if multipleLimit is obeyed
Integer multipleLimit = configDescriptionParameter.getMultipleLimit();
if (multipleLimit != null && values.size() > multipleLimit) {
MessageKey messageKey = MessageKey.MULTIPLE_LIMIT_VIOLATED;
ConfigValidationMessage message = new ConfigValidationMessage(
configDescriptionParameter.getName(), messageKey.defaultMessage, messageKey.key,
multipleLimit, values.size());
configDescriptionValidationMessages.add(message);
}
// Perform validation on each value in the list separately // Perform validation on each value in the list separately
for (Object value : (List<Object>) configurationParameters.get(key)) { for (Object value : values) {
ConfigValidationMessage message = validateParameter(configDescriptionParameter, value); ConfigValidationMessage message = validateParameter(configDescriptionParameter, value);
if (message != null) { if (message != null) {
configDescriptionValidationMessages.add(message); configDescriptionValidationMessages.add(message);

View File

@ -29,19 +29,17 @@ final class MessageKey {
"The value must not consist of more than {0} characters."); "The value must not consist of more than {0} characters.");
static final MessageKey MAX_VALUE_NUMERIC_VIOLATED = new MessageKey("max_value_numeric_violated", static final MessageKey MAX_VALUE_NUMERIC_VIOLATED = new MessageKey("max_value_numeric_violated",
"The value must not be greater than {0}."); "The value must not be greater than {0}.");
static final MessageKey MAX_VALUE_OPTIONS_VIOLATED = new MessageKey("max_value_options_violated",
"There are not more than {0} options allowed.");
static final MessageKey MIN_VALUE_TXT_VIOLATED = new MessageKey("min_value_txt_violated", static final MessageKey MIN_VALUE_TXT_VIOLATED = new MessageKey("min_value_txt_violated",
"The value must not consist of less than {0} characters."); "The value must not consist of less than {0} characters.");
static final MessageKey MIN_VALUE_NUMERIC_VIOLATED = new MessageKey("min_value_numeric_violated", static final MessageKey MIN_VALUE_NUMERIC_VIOLATED = new MessageKey("min_value_numeric_violated",
"The value must not be less than {0}."); "The value must not be less than {0}.");
static final MessageKey MIN_VALUE_OPTIONS_VIOLATED = new MessageKey("min_value_options_violated",
"There are at least {0} options required.");
static final MessageKey PATTERN_VIOLATED = new MessageKey("pattern_violated", static final MessageKey PATTERN_VIOLATED = new MessageKey("pattern_violated",
"The value {0} does not match the pattern {1}."); "The value {0} does not match the pattern {1}.");
static final MessageKey MULTIPLE_LIMIT_VIOLATED = new MessageKey("multiple_limit_violated",
"Only {0} elements are allowed but {1} are provided.");
/** The key to be used for internationalization. */ /** The key to be used for internationalization. */
final String key; final String key;

View File

@ -4,10 +4,9 @@ data_type_violated=The data type of the value ({0}) does not match with the type
max_value_txt_violated=The value must not consist of more than {0} characters. max_value_txt_violated=The value must not consist of more than {0} characters.
max_value_numeric_violated=The value must not be greater than {0}. max_value_numeric_violated=The value must not be greater than {0}.
max_value_options_violated=There are not more than {0} options allowed.
min_value_txt_violated=The value must not consist of less than {0} characters. min_value_txt_violated=The value must not consist of less than {0} characters.
min_value_numeric_violated=The value must not be less than {0}. min_value_numeric_violated=The value must not be less than {0}.
min_value_options_violated=There are at least {0} options required.
pattern_violated=The value {0} does not match the pattern {1}. pattern_violated=The value {0} does not match the pattern {1}.
multiple_limit_violated=Only {0} elements are allowed but {1} are provided.

View File

@ -4,10 +4,8 @@ data_type_violated=نوع القيمة لا تتوافق مع النوع الم
max_value_txt_violated=يجب ألا تتكون القيمة أكثر من {0} حرف. max_value_txt_violated=يجب ألا تتكون القيمة أكثر من {0} حرف.
max_value_numeric_violated=يجب ألا تكون القيمة أكبر من {0}. max_value_numeric_violated=يجب ألا تكون القيمة أكبر من {0}.
max_value_options_violated=لا يوجد أكثر من {0} من الخيارات المسموح بها.
min_value_txt_violated=يجب ألا تتكون القيمة أقل من {0} حرف. min_value_txt_violated=يجب ألا تتكون القيمة أقل من {0} حرف.
min_value_numeric_violated=يجب ألا تكون القيمة أقل من {0}. min_value_numeric_violated=يجب ألا تكون القيمة أقل من {0}.
min_value_options_violated=هناك على الأقل {0} خيارات مطلوبة.
pattern_violated=القيمة {0} لا تتطابق مع النمط {1}. pattern_violated=القيمة {0} لا تتطابق مع النمط {1}.

View File

@ -4,10 +4,8 @@ data_type_violated=Типа на информацията на стойност
max_value_txt_violated=Стойността не трябва да съдържа повече от {0} знака. max_value_txt_violated=Стойността не трябва да съдържа повече от {0} знака.
max_value_numeric_violated=Стойността не трябва да е по голяма от {0}. max_value_numeric_violated=Стойността не трябва да е по голяма от {0}.
max_value_options_violated=Няма повече от {0} позволени опции.
min_value_txt_violated=Стойността не трябва да съдържа по малко от {0} знака. min_value_txt_violated=Стойността не трябва да съдържа по малко от {0} знака.
min_value_numeric_violated=Стойността не трябва да е по-малка от {0}. min_value_numeric_violated=Стойността не трябва да е по-малка от {0}.
min_value_options_violated=Изискват се поне {0} опции.
pattern_violated=Стойността {0} не съвпада с модела {1}. pattern_violated=Стойността {0} не съвпада с модела {1}.

View File

@ -4,10 +4,8 @@ data_type_violated=Datový typ hodnoty se neshoduje s deklarací typu ({0}) v po
max_value_txt_violated=Hodnota nesmí obsahovat více než {0} znaků. max_value_txt_violated=Hodnota nesmí obsahovat více než {0} znaků.
max_value_numeric_violated=Hodnota nesmí být větší než {0}. max_value_numeric_violated=Hodnota nesmí být větší než {0}.
max_value_options_violated=Není povoleno více než {0} možností.
min_value_txt_violated=Hodnota nesmí obsahovat méně než {0} znaků. min_value_txt_violated=Hodnota nesmí obsahovat méně než {0} znaků.
min_value_numeric_violated=Hodnota nesmí být menší než {0}. min_value_numeric_violated=Hodnota nesmí být menší než {0}.
min_value_options_violated=Je vyžadováno alespoň {0} možností.
pattern_violated=Hodnota {0} neodpovídá vzoru {1}. pattern_violated=Hodnota {0} neodpovídá vzoru {1}.

View File

@ -4,10 +4,8 @@ data_type_violated=Der Datentyp des Wertes ({0}) stimmt nicht mit der Typen-Dekl
max_value_txt_violated=Der Wert darf maximal {0} Zeichen enthalten. max_value_txt_violated=Der Wert darf maximal {0} Zeichen enthalten.
max_value_numeric_violated=Der Wert darf nicht größer als {0} sein. max_value_numeric_violated=Der Wert darf nicht größer als {0} sein.
max_value_options_violated=Es sind maximal {0} Optionen erlaubt.
min_value_txt_violated=Der Wert muss mindestens {0} Zeichen enthalten. min_value_txt_violated=Der Wert muss mindestens {0} Zeichen enthalten.
min_value_numeric_violated=Der Wert muss mindestens {0} sein. min_value_numeric_violated=Der Wert muss mindestens {0} sein.
min_value_options_violated=Es werden mindestens {0} Optionen erwartet.
pattern_violated=Der Wert {0} entspricht nicht dem Muster {1}. pattern_violated=Der Wert {0} entspricht nicht dem Muster {1}.

View File

@ -4,10 +4,8 @@ data_type_violated=Ο τύπος δεδομένων της τιμής δεν τ
max_value_txt_violated=Η τιμή δεν πρέπει να αποτελείται από περισσότερους από {0} χαρακτήρες. max_value_txt_violated=Η τιμή δεν πρέπει να αποτελείται από περισσότερους από {0} χαρακτήρες.
max_value_numeric_violated=Η τιμή δεν πρέπει να είναι μεγαλύτερη από {0}. max_value_numeric_violated=Η τιμή δεν πρέπει να είναι μεγαλύτερη από {0}.
max_value_options_violated=Δεν επιτρέπονται περισσότερες από {0} επιλογές.
min_value_txt_violated=Η τιμή δεν πρέπει να αποτελείται από λιγότερους από {0} χαρακτήρες. min_value_txt_violated=Η τιμή δεν πρέπει να αποτελείται από λιγότερους από {0} χαρακτήρες.
min_value_numeric_violated=Η τιμή δεν πρέπει να είναι μικρότερη από {0}. min_value_numeric_violated=Η τιμή δεν πρέπει να είναι μικρότερη από {0}.
min_value_options_violated=Απαιτούνται τουλάχιστον {0} επιλογές.
pattern_violated=Η τιμή {0} δεν ταιριάζει με το μοτίβο {1}. pattern_violated=Η τιμή {0} δεν ταιριάζει με το μοτίβο {1}.

View File

@ -4,10 +4,8 @@ data_type_violated=El tipo de datos del valor no coincide con la declaración de
max_value_txt_violated=El valor no puede tener más de {0} caracteres. max_value_txt_violated=El valor no puede tener más de {0} caracteres.
max_value_numeric_violated=El valor no puede ser mayor que {0}. max_value_numeric_violated=El valor no puede ser mayor que {0}.
max_value_options_violated=No hay más de {0} opciones permitidas.
min_value_txt_violated=El valor no puede tener menos de {0} caracteres. min_value_txt_violated=El valor no puede tener menos de {0} caracteres.
min_value_numeric_violated=El valor no puede ser menor que {0}. min_value_numeric_violated=El valor no puede ser menor que {0}.
min_value_options_violated=Hay al menos {0} opciones necesarias.
pattern_violated=El valor {0} no coincide con el patrón {1}. pattern_violated=El valor {0} no coincide con el patrón {1}.

View File

@ -4,10 +4,8 @@ data_type_violated=Arvon datatyyppi ({0}) ei vastaa konfiguraation määritelmä
max_value_txt_violated=Arvo ei saa sisältää enemmän kuin {0} merkkiä. max_value_txt_violated=Arvo ei saa sisältää enemmän kuin {0} merkkiä.
max_value_numeric_violated=Arvo ei saa olla suurempi kuin {0}. max_value_numeric_violated=Arvo ei saa olla suurempi kuin {0}.
max_value_options_violated=Enemmän kuin {0} vaihtoehtoa ei ole sallittu.
min_value_txt_violated=Arvo ei saa sisältää vähemmän kuin {0} merkkiä. min_value_txt_violated=Arvo ei saa sisältää vähemmän kuin {0} merkkiä.
min_value_numeric_violated=Arvo ei saa olla pienempi kuin {0}. min_value_numeric_violated=Arvo ei saa olla pienempi kuin {0}.
min_value_options_violated=Vaaditaan vähintään {0} vaihtoehtoa.
pattern_violated=Arvo {0} ei vastaa malli-lauseketta {1}. pattern_violated=Arvo {0} ei vastaa malli-lauseketta {1}.

View File

@ -4,10 +4,8 @@ data_type_violated=Le type de données de la valeur ne correspond pas à la déc
max_value_txt_violated=La valeur ne doit pas contenir plus de {0} caractères. max_value_txt_violated=La valeur ne doit pas contenir plus de {0} caractères.
max_value_numeric_violated=La valeur ne doit pas être supérieure à {0}. max_value_numeric_violated=La valeur ne doit pas être supérieure à {0}.
max_value_options_violated=Il n''y a pas plus de {0} options autorisées.
min_value_txt_violated=La valeur ne doit pas contenir moins de {0} caractères. min_value_txt_violated=La valeur ne doit pas contenir moins de {0} caractères.
min_value_numeric_violated=La valeur ne doit pas être inférieure à {0}. min_value_numeric_violated=La valeur ne doit pas être inférieure à {0}.
min_value_options_violated=Il y a au moins {0} options nécessaires.
pattern_violated=La valeur {0} ne correspond pas au modèle {1}. pattern_violated=La valeur {0} ne correspond pas au modèle {1}.

View File

@ -4,10 +4,8 @@ data_type_violated=סוג הנתונים של הערך ({0}) אינו תואם
max_value_txt_violated=הערך אינו יכול לכלול יותר מ- {0} תווים. max_value_txt_violated=הערך אינו יכול לכלול יותר מ- {0} תווים.
max_value_numeric_violated=הערך אינו יכול להיות גדול מ-{0}. max_value_numeric_violated=הערך אינו יכול להיות גדול מ-{0}.
max_value_options_violated=אין יותר מ- {0} אפשרויות מותרות.
min_value_txt_violated=הערך איננו יכול לכלול פחות מ- {0} תווים. min_value_txt_violated=הערך איננו יכול לכלול פחות מ- {0} תווים.
min_value_numeric_violated=הערך איננו יכול להיות קטן מ- {0}. min_value_numeric_violated=הערך איננו יכול להיות קטן מ- {0}.
min_value_options_violated=נדרשת הגדרה של לפחות {0} אפשרויות.
pattern_violated=הערך {0} לא מתאים לתבנית {1}. pattern_violated=הערך {0} לא מתאים לתבנית {1}.

View File

@ -4,10 +4,8 @@ data_type_violated=A konfigurációs beállításokban szereplő típus megadás
max_value_txt_violated=Az érték {0} karakternél rövidebb kell legyen. max_value_txt_violated=Az érték {0} karakternél rövidebb kell legyen.
max_value_numeric_violated=Az érték nem lehet nagyobb, mint {0}. max_value_numeric_violated=Az érték nem lehet nagyobb, mint {0}.
max_value_options_violated=Maximum {0} lehetőség megengedett.
min_value_txt_violated=Az érték {0} karakternél hosszabb kell legyen. min_value_txt_violated=Az érték {0} karakternél hosszabb kell legyen.
min_value_numeric_violated=Az érték nem lehet kisebb, mint {0}. min_value_numeric_violated=Az érték nem lehet kisebb, mint {0}.
min_value_options_violated=Legalább {0} lehetőség szükséges.
pattern_violated=Az {0} érték nem felel meg a(z) {1} mintának. pattern_violated=Az {0} érték nem felel meg a(z) {1} mintának.

View File

@ -4,10 +4,8 @@ data_type_violated=Il tipo di dati del valore ({0}) non corrisponde alla dichiar
max_value_txt_violated=Il valore non deve contenere più di {0} caratteri. max_value_txt_violated=Il valore non deve contenere più di {0} caratteri.
max_value_numeric_violated=Il valore non deve essere maggiore di {0}. max_value_numeric_violated=Il valore non deve essere maggiore di {0}.
max_value_options_violated=Non ci sono più di {0} opzioni permesse.
min_value_txt_violated=Il valore non deve consistere di meno di {0} caratteri. min_value_txt_violated=Il valore non deve consistere di meno di {0} caratteri.
min_value_numeric_violated=Il valore non deve essere inferiore a {0}. min_value_numeric_violated=Il valore non deve essere inferiore a {0}.
min_value_options_violated=Ci sono almeno {0} opzioni richieste.
pattern_violated=Il valore {0} non corrisponde al modello {1}. pattern_violated=Il valore {0} non corrisponde al modello {1}.

View File

@ -4,10 +4,8 @@ data_type_violated=値のデータ型が、設定説明の型宣言 ({0}) と一
max_value_txt_violated=値は {0} 文字以上で構成することはできません。 max_value_txt_violated=値は {0} 文字以上で構成することはできません。
max_value_numeric_violated=値は{0} を超えてはいけません。 max_value_numeric_violated=値は{0} を超えてはいけません。
max_value_options_violated=許可されるオプションは{0} 個までです。
min_value_txt_violated=値は{0} 文字未満であってはなりません。 min_value_txt_violated=値は{0} 文字未満であってはなりません。
min_value_numeric_violated=値は{0} 以上である必要があります。 min_value_numeric_violated=値は{0} 以上である必要があります。
min_value_options_violated=少なくとも{0} 個のオプションが必要です。
pattern_violated=値{0} がパターン{1} と一致しません。 pattern_violated=値{0} がパターン{1} と一致しません。

View File

@ -4,10 +4,8 @@ data_type_violated=Den Datentyp vum Wäert ({0}) stëmmt net mat der Typendeklar
max_value_txt_violated=Dëse Wäert däerf net méi wéi {0} Zeechen hunn. max_value_txt_violated=Dëse Wäert däerf net méi wéi {0} Zeechen hunn.
max_value_numeric_violated=Dëse Wäert muss méi grouss wéi {0} sinn. max_value_numeric_violated=Dëse Wäert muss méi grouss wéi {0} sinn.
max_value_options_violated=Et sinn net méi wéi {0} Optiounen erlaabt.
min_value_txt_violated=Dëse Wäert muss mindestens {0} Zeechen hunn. min_value_txt_violated=Dëse Wäert muss mindestens {0} Zeechen hunn.
min_value_numeric_violated=Dëse Wäert muss mindestens {0} sinn. min_value_numeric_violated=Dëse Wäert muss mindestens {0} sinn.
min_value_options_violated=Et ginn op mannst {0} Optiounen erwaart.
pattern_violated=De Wäert {0} passt net mam Muster {1} iwwerteneen. pattern_violated=De Wäert {0} passt net mam Muster {1} iwwerteneen.

View File

@ -4,10 +4,8 @@ data_type_violated=Het gegevenstype van de waarde komt niet overeen met de type
max_value_txt_violated=De waarde mag niet meer dan {0} tekens bevatten. max_value_txt_violated=De waarde mag niet meer dan {0} tekens bevatten.
max_value_numeric_violated=De waarde mag niet groter zijn dan {0}. max_value_numeric_violated=De waarde mag niet groter zijn dan {0}.
max_value_options_violated=Er zijn niet meer dan {0} opties toegestaan.
min_value_txt_violated=De waarde mag niet minder dan {0} tekens bevatten. min_value_txt_violated=De waarde mag niet minder dan {0} tekens bevatten.
min_value_numeric_violated=De waarde mag niet kleiner zijn dan {0}. min_value_numeric_violated=De waarde mag niet kleiner zijn dan {0}.
min_value_options_violated=Er zijn ten minste {0} opties vereist.
pattern_violated=De waarde {0} komt niet overeen met het patroon {1}. pattern_violated=De waarde {0} komt niet overeen met het patroon {1}.

View File

@ -4,10 +4,8 @@ data_type_violated=Datatypen til verdien samsvarer ikke med typedeklarasjonen ({
max_value_txt_violated=Verdien må ikke bestå av mer enn {0} tegn. max_value_txt_violated=Verdien må ikke bestå av mer enn {0} tegn.
max_value_numeric_violated=Verdien kan ikke være større enn {0}. max_value_numeric_violated=Verdien kan ikke være større enn {0}.
max_value_options_violated=Det er ikke mer enn {0} alternativer tillatt.
min_value_txt_violated=Verdien må ikke bestå av mindre enn {0} tegn. min_value_txt_violated=Verdien må ikke bestå av mindre enn {0} tegn.
min_value_numeric_violated=Verdien må ikke være mindre enn {0}. min_value_numeric_violated=Verdien må ikke være mindre enn {0}.\
min_value_options_violated=Det er nødvendig med minst {0} valg.
pattern_violated=Verdien {0} samsvarer ikke med mønsteret {1}. pattern_violated=Verdien {0} samsvarer ikke med mønsteret {1}.

View File

@ -4,10 +4,8 @@ data_type_violated=Typ danych wartości nie pasuje do deklaracji typu ({0}) w op
max_value_txt_violated=Wartość nie może składać się z więcej niż {0} znaków. max_value_txt_violated=Wartość nie może składać się z więcej niż {0} znaków.
max_value_numeric_violated=Wartość musi być większa niż {0}. max_value_numeric_violated=Wartość musi być większa niż {0}.
max_value_options_violated=Nie ma więcej niż {0} opcji dozwolonych.
min_value_txt_violated=Wartość nie może składać się z mniej niż {0} znaków. min_value_txt_violated=Wartość nie może składać się z mniej niż {0} znaków.
min_value_numeric_violated=Wartość nie może być mniejsza niż {0}. min_value_numeric_violated=Wartość nie może być mniejsza niż {0}.
min_value_options_violated=Wymagana liczba opcji\: {0}.
pattern_violated=Wartość {0} nie pasuje do wzoru {1}. pattern_violated=Wartość {0} nie pasuje do wzoru {1}.

View File

@ -4,10 +4,8 @@ data_type_violated=O tipo de dados do valor não coincide com a declaração de
max_value_txt_violated=O valor não pode conter mais de {0} caracteres. max_value_txt_violated=O valor não pode conter mais de {0} caracteres.
max_value_numeric_violated=O valor não deve ser maior que {0}. max_value_numeric_violated=O valor não deve ser maior que {0}.
max_value_options_violated=Não há mais do que {0} opções permitidas.
min_value_txt_violated=O valor não pode conter menos de {0} caracteres. min_value_txt_violated=O valor não pode conter menos de {0} caracteres.
min_value_numeric_violated=O valor não deve ser menor que {0}. min_value_numeric_violated=O valor não deve ser menor que {0}.
min_value_options_violated=Existem pelo menos {0} opções obrigatórias.
pattern_violated=O valor {0} não corresponde ao padrão {1}. pattern_violated=O valor {0} não corresponde ao padrão {1}.

View File

@ -4,10 +4,8 @@ data_type_violated=Tipul de date al valorii nu se potrivește cu declarația de
max_value_txt_violated=Valoarea nu trebuie să conțină mai mult de {0} caractere. max_value_txt_violated=Valoarea nu trebuie să conțină mai mult de {0} caractere.
max_value_numeric_violated=Valoarea nu trebuie să fie mai mare de {0}. max_value_numeric_violated=Valoarea nu trebuie să fie mai mare de {0}.
max_value_options_violated=Nu există mai mult de {0} opțiuni permise.
min_value_txt_violated=Valoarea nu trebuie să fie mai mică de {0} caractere. min_value_txt_violated=Valoarea nu trebuie să fie mai mică de {0} caractere.
min_value_numeric_violated=Valoarea nu trebuie să fie mai mică de {0}. min_value_numeric_violated=Valoarea nu trebuie să fie mai mică de {0}.
min_value_options_violated=Există cel puțin {0} opțiuni necesare.
pattern_violated=Valoarea {0} nu se potrivește cu modelul {1}. pattern_violated=Valoarea {0} nu se potrivește cu modelul {1}.

View File

@ -4,10 +4,8 @@ data_type_violated=Тип данных значения не соответст
max_value_txt_violated=Значение не должно содержать больше, чем {0} символов. max_value_txt_violated=Значение не должно содержать больше, чем {0} символов.
max_value_numeric_violated=Значение должно быть меньше, чем {0}. max_value_numeric_violated=Значение должно быть меньше, чем {0}.
max_value_options_violated=Доступно не более {0} вариантов.
min_value_txt_violated=Значение должно содержать более {0} символов. min_value_txt_violated=Значение должно содержать более {0} символов.
min_value_numeric_violated=Значение должно быть больше, чем {0}. min_value_numeric_violated=Значение должно быть больше, чем {0}.
min_value_options_violated=Требуется как минимум {0} вариантов.
pattern_violated=Значение {0} не соответствует шаблону {1}. pattern_violated=Значение {0} не соответствует шаблону {1}.

View File

@ -4,10 +4,8 @@ data_type_violated=Datatypen för värdet stämmer inte överens med typ-deklara
max_value_txt_violated=Värdet får inte bestå av mer än {0} tecken. max_value_txt_violated=Värdet får inte bestå av mer än {0} tecken.
max_value_numeric_violated=Värdet får inte vara större än {0}. max_value_numeric_violated=Värdet får inte vara större än {0}.
max_value_options_violated=Det finns inte mer än {0} tillåtna alternativ.
min_value_txt_violated=Värdet får inte bestå av mindre än {0} tecken. min_value_txt_violated=Värdet får inte bestå av mindre än {0} tecken.
min_value_numeric_violated=Värdet får inte vara mindre än {0}. min_value_numeric_violated=Värdet får inte vara mindre än {0}.
min_value_options_violated=Det krävs minst {0} alternativ.
pattern_violated=Värdet {0} uppfyller inte mönstret {1}. pattern_violated=Värdet {0} uppfyller inte mönstret {1}.

View File

@ -4,10 +4,8 @@ data_type_violated=Değerin veri tipi ({0})''nin yapılandırma açıklamasında
max_value_txt_violated=Değer {0}''dan fazla karakter içeremez. max_value_txt_violated=Değer {0}''dan fazla karakter içeremez.
max_value_numeric_violated=Değer {0}''dan büyük olamaz. max_value_numeric_violated=Değer {0}''dan büyük olamaz.
max_value_options_violated={0}''dan fazla seçeneğe izin verilmemektedir.
min_value_txt_violated=Değer {0}''dan daha az karakter içeremez. min_value_txt_violated=Değer {0}''dan daha az karakter içeremez.
min_value_numeric_violated=Değer {0}''dan az olamaz. min_value_numeric_violated=Değer {0}''dan az olamaz.
min_value_options_violated=En az {0} adet seçenek gereklidir.
pattern_violated={0} değeri, {1} ablonu ile uyumsuz. pattern_violated={0} değeri, {1} ablonu ile uyumsuz.

View File

@ -4,10 +4,8 @@ data_type_violated=Тип даних значення не відповідає
max_value_txt_violated=Значення не може складатися з більш ніж {0} символів. max_value_txt_violated=Значення не може складатися з більш ніж {0} символів.
max_value_numeric_violated=Значення не має бути більшим за {0}. max_value_numeric_violated=Значення не має бути більшим за {0}.
max_value_options_violated=Дозволено не більше ніж {0} варіантів.
min_value_txt_violated=Значення не може складатися з менш ніж {0} символів. min_value_txt_violated=Значення не може складатися з менш ніж {0} символів.
min_value_numeric_violated=Значення не має бути меншим за {0}. min_value_numeric_violated=Значення не має бути меншим за {0}.
min_value_options_violated=Необхідні принаймні {0} опції.
pattern_violated=Значення {0} не відповідає шаблону{1}. pattern_violated=Значення {0} не відповідає шаблону{1}.

View File

@ -4,10 +4,8 @@ data_type_violated=该值的数据类型与配置描述中的类型声明({0})
max_value_txt_violated=该值不能超过{0} 字符。 max_value_txt_violated=该值不能超过{0} 字符。
max_value_numeric_violated=该值必须大于 {0}。 max_value_numeric_violated=该值必须大于 {0}。
max_value_options_violated=允许的选项不超过 {0} 个。
min_value_txt_violated=该值不能小于 {0} 个字符。 min_value_txt_violated=该值不能小于 {0} 个字符。
min_value_numeric_violated=该值不能小于 {0}。 min_value_numeric_violated=该值不能小于 {0}。
min_value_options_violated=至少需要 {0} 个选项。
pattern_violated=该值 {0} 与模式 {1} 不匹配。 pattern_violated=该值 {0} 与模式 {1} 不匹配。

View File

@ -31,7 +31,6 @@ import java.util.stream.Stream;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer; import org.mockito.stubbing.Answer;
import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.core.ConfigDescription;
import org.openhab.core.config.core.ConfigDescriptionBuilder; import org.openhab.core.config.core.ConfigDescriptionBuilder;
@ -83,6 +82,7 @@ public class ConfigDescriptionValidatorTest {
private static final String TXT_MAX_PARAM_NAME = "txt-max-name"; private static final String TXT_MAX_PARAM_NAME = "txt-max-name";
private static final String TXT_PATTERN_PARAM_NAME = "txt-pattern-name"; private static final String TXT_PATTERN_PARAM_NAME = "txt-pattern-name";
private static final String TXT_MAX_PATTERN_PARAM_NAME = "txt-max-pattern-name"; private static final String TXT_MAX_PATTERN_PARAM_NAME = "txt-max-pattern-name";
private static final String TXT_MULTIPLE_LIMIT_PARAM_NAME = "txt-multiple-limit-name";
private static final String INT_PARAM_NAME = "int-param"; private static final String INT_PARAM_NAME = "int-param";
private static final String INT_REQUIRED_PARAM_NAME = "int-required-param"; private static final String INT_REQUIRED_PARAM_NAME = "int-required-param";
@ -112,6 +112,8 @@ public class ConfigDescriptionValidatorTest {
private static final ConfigDescriptionParameter TXT_MAX_PATTERN_PARAM = ConfigDescriptionParameterBuilder private static final ConfigDescriptionParameter TXT_MAX_PATTERN_PARAM = ConfigDescriptionParameterBuilder
.create(TXT_MAX_PATTERN_PARAM_NAME, ConfigDescriptionParameter.Type.TEXT).withMaximum(MAX) .create(TXT_MAX_PATTERN_PARAM_NAME, ConfigDescriptionParameter.Type.TEXT).withMaximum(MAX)
.withPattern(PATTERN).build(); .withPattern(PATTERN).build();
private static final ConfigDescriptionParameter TXT_MULTIPLE_LIMIT_PARAM = ConfigDescriptionParameterBuilder
.create(TXT_MULTIPLE_LIMIT_PARAM_NAME, Type.TEXT).withMultiple(true).withMultipleLimit(2).build();
private static final ConfigDescriptionParameter INT_PARAM = ConfigDescriptionParameterBuilder private static final ConfigDescriptionParameter INT_PARAM = ConfigDescriptionParameterBuilder
.create(INT_PARAM_NAME, ConfigDescriptionParameter.Type.INTEGER).build(); .create(INT_PARAM_NAME, ConfigDescriptionParameter.Type.INTEGER).build();
@ -142,11 +144,10 @@ public class ConfigDescriptionValidatorTest {
} }
private static final ConfigDescription CONFIG_DESCRIPTION = ConfigDescriptionBuilder.create(CONFIG_DESCRIPTION_URI) private static final ConfigDescription CONFIG_DESCRIPTION = ConfigDescriptionBuilder.create(CONFIG_DESCRIPTION_URI)
.withParameters(Stream .withParameters(Stream.of(BOOL_PARAM, BOOL_REQUIRED_PARAM, TXT_PARAM, TXT_REQUIRED_PARAM, TXT_MIN_PARAM,
.of(BOOL_PARAM, BOOL_REQUIRED_PARAM, TXT_PARAM, TXT_REQUIRED_PARAM, TXT_MIN_PARAM, TXT_MAX_PARAM, TXT_MAX_PARAM, TXT_PATTERN_PARAM, TXT_MAX_PATTERN_PARAM, TXT_MULTIPLE_LIMIT_PARAM, INT_PARAM,
TXT_PATTERN_PARAM, TXT_MAX_PATTERN_PARAM, INT_PARAM, INT_REQUIRED_PARAM, INT_MIN_PARAM, INT_REQUIRED_PARAM, INT_MIN_PARAM, INT_MAX_PARAM, DECIMAL_PARAM, DECIMAL_REQUIRED_PARAM,
INT_MAX_PARAM, DECIMAL_PARAM, DECIMAL_REQUIRED_PARAM, DECIMAL_MIN_PARAM, DECIMAL_MAX_PARAM) DECIMAL_MIN_PARAM, DECIMAL_MAX_PARAM).collect(toList()))
.collect(toList()))
.build(); .build();
private Map<String, Object> params; private Map<String, Object> params;
@ -155,12 +156,10 @@ public class ConfigDescriptionValidatorTest {
@BeforeEach @BeforeEach
public void setUp() { public void setUp() {
ConfigDescriptionRegistry configDescriptionRegistry = mock(ConfigDescriptionRegistry.class); ConfigDescriptionRegistry configDescriptionRegistry = mock(ConfigDescriptionRegistry.class);
when(configDescriptionRegistry.getConfigDescription(any())).thenAnswer(new Answer<ConfigDescription>() { when(configDescriptionRegistry.getConfigDescription(any()))
@Override .thenAnswer((Answer<ConfigDescription>) invocation -> {
public ConfigDescription answer(InvocationOnMock invocation) throws Throwable { URI uri = invocation.getArgument(0);
URI uri = (URI) invocation.getArgument(0);
return !CONFIG_DESCRIPTION_URI.equals(uri) ? null : CONFIG_DESCRIPTION; return !CONFIG_DESCRIPTION_URI.equals(uri) ? null : CONFIG_DESCRIPTION;
}
}); });
BundleContext bundleContext = mock(BundleContext.class); BundleContext bundleContext = mock(BundleContext.class);
@ -179,6 +178,7 @@ public class ConfigDescriptionValidatorTest {
params.put(TXT_MAX_PARAM_NAME, String.valueOf(MIN_VIOLATED)); params.put(TXT_MAX_PARAM_NAME, String.valueOf(MIN_VIOLATED));
params.put(TXT_PATTERN_PARAM_NAME, "abbbc"); params.put(TXT_PATTERN_PARAM_NAME, "abbbc");
params.put(TXT_MAX_PATTERN_PARAM_NAME, "abc"); params.put(TXT_MAX_PATTERN_PARAM_NAME, "abc");
params.put(TXT_MULTIPLE_LIMIT_PARAM_NAME, List.of("1", "2"));
params.put(INT_PARAM_NAME, null); params.put(INT_PARAM_NAME, null);
params.put(INT_REQUIRED_PARAM_NAME, 0); params.put(INT_REQUIRED_PARAM_NAME, 0);
params.put(INT_MIN_PARAM_NAME, MIN); params.put(INT_MIN_PARAM_NAME, MIN);
@ -422,6 +422,16 @@ public class ConfigDescriptionValidatorTest {
// MISC VALIDATIONS // MISC VALIDATIONS
// =========================================================================== // ===========================================================================
@Test
public void assertValidationThrowsExceptionForMultipleLimitViolated() {
List<ConfigValidationMessage> expected = List.of(new ConfigValidationMessage(TXT_MULTIPLE_LIMIT_PARAM_NAME,
MessageKey.MULTIPLE_LIMIT_VIOLATED.defaultMessage, MessageKey.MULTIPLE_LIMIT_VIOLATED.key, 2, 3));
params.put(TXT_MULTIPLE_LIMIT_PARAM_NAME, List.of("1", "2", "3"));
ConfigValidationException exception = Assertions.assertThrows(ConfigValidationException.class,
() -> configDescriptionValidator.validate(params, CONFIG_DESCRIPTION_URI));
assertThat(getConfigValidationMessages(exception), is(expected));
}
@Test @Test
public void assertValidationThrowsExceptionContainingMultipleVariousViolations() { public void assertValidationThrowsExceptionContainingMultipleVariousViolations() {
List<ConfigValidationMessage> expected = Stream.of( List<ConfigValidationMessage> expected = Stream.of(