Amit Aviram has posted comments on this change.

Change subject: engine: Addition to ReplacementUtils
......................................................................


Patch Set 3:

(5 comments)

http://gerrit.ovirt.org/#/c/35915/3/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ReplacementUtils.java
File 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ReplacementUtils.java:

Line 29:      *         <li>The property name and its replacement items.</li>
Line 30:      *         <li>The property counter name and the items size.</li>
Line 31:      *         </ul>
Line 32:      */
Line 33:     public static Collection<String> replaceWith(String propertyName, 
List<?> items, String separator, int maxNumberOfPrintedItems) {
> please update the javadoc accordingly to describe the new parameters
Done
Line 34:         int size = Math.min(maxNumberOfPrintedItems, items.size());
Line 35:         List<String> printedItems = new ArrayList<String>(size);
Line 36: 
Line 37:         for (int i = 0; i < size; i++) {


Line 30:      *         <li>The property counter name and the items size.</li>
Line 31:      *         </ul>
Line 32:      */
Line 33:     public static Collection<String> replaceWith(String propertyName, 
List<?> items, String separator, int maxNumberOfPrintedItems) {
Line 34:         int size = Math.min(maxNumberOfPrintedItems, items.size());
> should you enforce input correctness ? i.e. by 
Done
Line 35:         List<String> printedItems = new ArrayList<String>(size);
Line 36: 
Line 37:         for (int i = 0; i < size; i++) {
Line 38:             printedItems.add(String.format("\t%s", 
String.valueOf(items.get(i))));


Line 47:         replacements.add(MessageFormat.format("${0}_COUNTER {1}", 
propertyName, items.size()));
Line 48: 
Line 49:         return replacements;
Line 50:     }
Line 51: 
> I wouldn't add this method. If someone decided to go "freestyle", let him f
Done
Line 52:     public static Collection<String> replaceWith(String propertyName, 
List<?> items, String separator) {
Line 53:         return replaceWith(propertyName, items, separator, 
DEFAULT_MAX_NUMBER_OF_PRINTED_ITEMS);
Line 54:     }
Line 55: 


Line 51: 
Line 52:     public static Collection<String> replaceWith(String propertyName, 
List<?> items, String separator) {
Line 53:         return replaceWith(propertyName, items, separator, 
DEFAULT_MAX_NUMBER_OF_PRINTED_ITEMS);
Line 54:     }
Line 55: 
> you should move the java doc of the original method (line 33) to this one.
Done
Line 56:     public static Collection<String> replaceWith(String propertyName, 
List<?> items) {
Line 57:         return replaceWith(propertyName, items, DEFAULT_SEPARATOR, 
DEFAULT_MAX_NUMBER_OF_PRINTED_ITEMS);
Line 58:     }
Line 59: 


http://gerrit.ovirt.org/#/c/35915/3/backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/ReplacementUtilsTest.java
File 
backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/ReplacementUtilsTest.java:

Line 69: 
Line 70:         // Less than the default number of elements to show.
Line 71:         int numOfElementsToShow = 3;
Line 72:         Collection<String> replacements = 
ReplacementUtils.replaceWith(PROPERTY_NAME, items, separator , 
numOfElementsToShow);
Line 73:         assertTrue(validateReplacementElementCount(replacements, 
separator,  numOfElementsToShow));
> please separate this method into 2 test methods, as each test a different a
Done
Line 74: 
Line 75:         // More than the default number of elements to show.
Line 76:         numOfElementsToShow = 8;
Line 77:         replacements = ReplacementUtils.replaceWith(PROPERTY_NAME, 
items, separator , numOfElementsToShow);


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I77f64b31b69574aff68a0706dd7d6afa3037511a
Gerrit-PatchSet: 3
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Amit Aviram <aavi...@redhat.com>
Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com>
Gerrit-Reviewer: Amit Aviram <aavi...@redhat.com>
Gerrit-Reviewer: Lior Vernia <lver...@redhat.com>
Gerrit-Reviewer: Moti Asayag <masa...@redhat.com>
Gerrit-Reviewer: automat...@ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to