Mike Kolesnik has posted comments on this change. Change subject: engine: Add ReplacementUtils ......................................................................
Patch Set 2: (3 inline comments) .................................................... File backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ReplacementUtils.java Line 6: Line 7: import org.apache.commons.lang.StringUtils; Line 8: import org.ovirt.engine.core.common.businessentities.Nameable; Line 9: Line 10: public class ReplacementUtils { Nice docs! Please make sure to document the return values as well Line 11: Line 12: protected static final int MAX_NUMBER_OF_PRINTED_ITEMS = 5; Line 13: Line 14: /** Line 44: * the property name which represents the collection Line 45: * @param collections Line 46: * the collection of items to be shown in the message Line 47: */ Line 48: public static <T extends Nameable> String[] replaceWithNameable(String propertyName, List<T> collections) { Weird field name, collections Line 49: List<Object> items = new ArrayList<Object>(collections.size()); Line 50: Line 51: for (Nameable itemName : collections) { Line 52: items.add(itemName.getName()); .................................................... File backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/ReplacementUtilsTest.java Line 48: public void replaceWithMoreThanMaxItems() { Line 49: List<Object> items = createItems(); Line 50: String[] messageItems = ReplacementUtils.replaceWith(PROPERTY_NAME, items); Line 51: validateMessageContainsProperties(messageItems); Line 52: assertTrue(messageItems[1].contains(String.valueOf(items.size()))); Also interesting to see that the items after the max one are not contained in the message Line 53: } Line 54: Line 55: private List<Object> createItems() { Line 56: List<Object> items = new ArrayList<Object>(ReplacementUtils.MAX_NUMBER_OF_PRINTED_ITEMS * 2); -- To view, visit http://gerrit.ovirt.org/10723 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia9d30047f090057561bd1a3e16f3edb4e724bd8d Gerrit-PatchSet: 2 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Moti Asayag <masa...@redhat.com> Gerrit-Reviewer: Mike Kolesnik <mkole...@redhat.com> Gerrit-Reviewer: Moti Asayag <masa...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches