Skip to content

Commit

Permalink
Added more test for Device field validation on create and update oper…
Browse files Browse the repository at this point in the history
…ations - partial backport

Signed-off-by: Alberto Codutti <alberto.codutti@eurotech.com>
  • Loading branch information
Coduz committed Feb 3, 2023
1 parent dcd2794 commit 7ad1805
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,8 @@ public static void validateCreatePreconditions(DeviceCreator deviceCreator) thro
// .extendedProperties
for (DeviceExtendedProperty deviceExtendedProperty : deviceCreator.getExtendedProperties()) {
// .groupName
if (!Strings.isNullOrEmpty(deviceExtendedProperty.getGroupName())) {
ArgumentValidator.lengthRange(deviceExtendedProperty.getGroupName(), 1, 64, "deviceCreator.extendedProperties[].groupName");
}
ArgumentValidator.notNull(deviceExtendedProperty.getGroupName(), "deviceCreator.extendedProperties[].groupName");
ArgumentValidator.lengthRange(deviceExtendedProperty.getGroupName(), 1, 64, "device.extendedProperties[].groupName");

// .name
ArgumentValidator.notNull(deviceExtendedProperty.getName(), "deviceCreator.extendedProperties[].name");
Expand Down Expand Up @@ -420,9 +419,8 @@ public static void validateUpdatePreconditions(Device device) throws KapuaExcept
// .extendedProperties
for (DeviceExtendedProperty deviceExtendedProperty : device.getExtendedProperties()) {
// .groupName
if (!Strings.isNullOrEmpty(deviceExtendedProperty.getGroupName())) {
ArgumentValidator.lengthRange(deviceExtendedProperty.getGroupName(), 1, 64, "device.extendedProperties[].groupName");
}
ArgumentValidator.notNull(deviceExtendedProperty.getGroupName(), "device.extendedProperties[].groupName");
ArgumentValidator.lengthRange(deviceExtendedProperty.getGroupName(), 1, 64, "device.extendedProperties[].groupName");

// .name
ArgumentValidator.notNull(deviceExtendedProperty.getName(), "device.extendedProperties[].name");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ device.registry.key=device.registry
device.registry.event.address=device

device.registry.lifecycle.birth.fields.clob.length.max=4096
device.registry.lifecycle.birth.fields.extendedProperties.value.length.max=2097152
device.registry.lifecycle.birth.fields.extendedProperties.value.length.max=524288

0 comments on commit 7ad1805

Please sign in to comment.