Tomas Jelinek has posted comments on this change.

Change subject: webadmin: Add validation for create/edit pool (#849426)
......................................................................


Patch Set 2: (2 inline comments)

Proposed a simplification.

....................................................
File 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/PoolModelBehaviorBase.java
Line 318:                         new LengthValidation(4),
Line 319:                         new IntegerValidation(isNew ? 1 : 0, isNew ? 
maxAllowedVms : maxAllowedVms - assignedVms)
Line 320:                 },
Line 321: 
Line 322:                         getNumOfDesktopsSpecificValidations()
Well, it did not look to me at first time but when you pointed it out, maybe it 
is over engineered :)

and what about overriding the Validate method and in children have something 
like:
if (super.Validate) {
// do the specific validation logic
)
}

This would avoid the copy-pasting of the common validation logic, and also the 
dummy validation and union could be removed.
Line 323:                 )
Line 324:                 );
Line 325: 
Line 326:         getModel().getPrestartedVms().ValidateEntity(


....................................................
File 
frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/validation/ExistingPoolNameLengthValidationTest.java
Line 7: import org.junit.Test;
Line 8: import org.ovirt.engine.core.common.businessentities.VmOsType;
Line 9: 
Line 10: public class ExistingPoolNameLengthValidationTest {
Line 11: 
most simple way is just to run mvn clean install on the uicommonweb project - 
the content of the src/test/java will be picked up automatically.
Line 12:     @Test
Line 13:     public void getPoolName_noVmsAlloved() {
Line 14:         assertGeneratesCorrect(5, 4, 0);
Line 15:     }


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I66f765ceb0567beb006d1ef4f45db3902ef95ea6
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Tomas Jelinek <[email protected]>
Gerrit-Reviewer: Daniel Erez <[email protected]>
Gerrit-Reviewer: Gilad Chaplik <[email protected]>
Gerrit-Reviewer: Tomas Jelinek <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to