Allon Mureinik has posted comments on this change.

Change subject: core: ImportVm test cleanup: Use StringUtil.repeat
......................................................................


Patch Set 7: (2 inline comments)

....................................................
File 
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/ImportVmCommandTest.java
Line 66:     }
Line 67: 
Line 68:     @Test
Line 69:     public void testValidateNameSizeImportAsCloned() {
Line 70:         checkVmName(true, StringUtils.repeat("A", 300));
Re unicode: onpe. Just [0-9a-zA-Z-_\\.]+.

Re a full spectrum of chars - good idea.
Line 71:     }
Line 72: 
Line 73:     @Test
Line 74:     public void testDoNotValidateNameSizeImport() {


Line 105:     @Test
Line 106:     public void testOtherFieldsNotValidatedInImport() {
Line 107:         ImportVmParameters parameters = createParameters();
Line 108:         String stringOf5000Chars = StringUtils.repeat("A", 5000);
Line 109:         assertFalse(BusinessEntitiesDefinitions.GENERAL_MAX_SIZE > 
stringOf5000Chars.length());
Note this is old code that was just refactored here, not new logic.
I'm assuming this is to make sure we aren't mistakenly generating an illegal 
name if someone changes the constant.

But you're right - this is dumb. The correct thing would be to generate a 
string of length GENERAL_MAX_SIZE + 1.
Line 110:         
parameters.getVm().setUserDefinedProperties(stringOf5000Chars);
Line 111:         parameters.setImportAsNewEntity(true);
Line 112:         ImportVmCommand command = new ImportVmCommand(parameters);
Line 113:         Set<ConstraintViolation<ImportVmParameters>> validate =


--
To view, visit http://gerrit.ovirt.org/9619
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I1f04e067e8bce2c6cd1010f83a44809a3c8c464c
Gerrit-PatchSet: 7
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <amure...@redhat.com>
Gerrit-Reviewer: Alissa Bonas <abo...@redhat.com>
Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com>
Gerrit-Reviewer: Ayal Baron <aba...@redhat.com>
Gerrit-Reviewer: Daniel Erez <de...@redhat.com>
Gerrit-Reviewer: Liron Aravot <lara...@redhat.com>
Gerrit-Reviewer: Maor Lipchuk <mlipc...@redhat.com>
Gerrit-Reviewer: Vered Volansky <vvola...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to