Yaniv Bronhaim has posted comments on this change.

Change subject: core: Adding RpmVersion utils
......................................................................


Patch Set 5:

(5 comments)

....................................................
Commit Message
Line 6: 
Line 7: core: Adding RpmVersion utils
Line 8: 
Line 9: Adding a utility class to serve RpmVersion issues
Line 10: to be used both by backend and frontend
please just add to the commit message that we need to merge it with 
core/compat/RpmVersion.java - just to keep in mind the todo tasks
Line 11: 
Line 12: Change-Id: Ia82d09e755b767f254224c84abd16516592715ac


....................................................
File 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/RpmVersionUtils.java
Line 11:      * @param part1
Line 12:      *            part from first RPM
Line 13:      * @param part2
Line 14:      *            part from second RPM
Line 15:      * @return same convention as {@link Comparable.compareTo}
more informative is to detail here:

0 = equal 

-1 = first parameter is larger (or higher in chronological order)

1 = second parameter is larger (or higher in chronological order)
Line 16:      */
Line 17:     public static int compareRpmPart(String part1, String part2) {
Line 18:         String[] comps1 = part1.split("\\.");
Line 19:         String[] comps2 = part2.split("\\.");


Line 45:     /**
Line 46:      * Splits RPM into parts of Prefix, Version and Release
Line 47:      *
Line 48:      * @param rpmName
Line 49:      * @return
returns array of strings filled with prefix,version,release strings (in this 
order)
Line 50:      */
Line 51:     public static String[] splitRpmToParts(String rpmName) {
Line 52:         int lastDashIndex = rpmName.lastIndexOf('-');
Line 53:         if (lastDashIndex == -1) {


Line 60:         for (; beforeLastDashIndex >= 0; beforeLastDashIndex--) {
Line 61:             if (chars[beforeLastDashIndex] == '-') {
Line 62:                 break;
Line 63:             }
Line 64:         }
isn't while loop more intuitive here?

while (beforeLastDashIndex >= 0) {
    if (chars[beforeLastDashIndex] == '-') {
        break;
     }
     beforeLastDashIndex--;
}
Line 65: 
Line 66:         if (beforeLastDashIndex == -1) {
Line 67:             throw new 
IllegalArgumentException(INVALID_RPM_NAME_FORMAT);
Line 68:         }


....................................................
File 
backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/RpmVersionUtilsTest.java
Line 9:     @Test
Line 10:     public void testCompareRpmRelease() {
Line 11:         assertEquals(-1, 
RpmVersionUtils.compareRpmPart("2.3.10.4.fc18.x86_64", "2.3.10.4.fc19.x86_64"));
Line 12:         assertEquals(1, 
RpmVersionUtils.compareRpmPart("20130821.fc18.x86_64", "20130820.fc18.x86_64"));
Line 13:         assertEquals(1, 
RpmVersionUtils.compareRpmPart("20130821.0.fc18.x86_64", 
"20130820.1.fc18.x86_64"));
check also comparison between:

"4.12.0-rc3.3" to "4.12.0-3.3", which should be greater?
Line 14:     }
Line 15: 
Line 16:     @Test(expected = IllegalArgumentException.class)
Line 17:     public void testIllegalRpmSplitNoDashes() {


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia82d09e755b767f254224c84abd16516592715ac
Gerrit-PatchSet: 5
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Yair Zaslavsky <[email protected]>
Gerrit-Reviewer: Daniel Erez <[email protected]>
Gerrit-Reviewer: Douglas Schilling Landgraf <[email protected]>
Gerrit-Reviewer: Vojtech Szocs <[email protected]>
Gerrit-Reviewer: Yair Zaslavsky <[email protected]>
Gerrit-Reviewer: Yaniv Bronhaim <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to