anmolbabu has posted comments on this change. Change subject: engine : Introduce TimeConverter ......................................................................
Patch Set 11: (2 comments) http://gerrit.ovirt.org/#/c/27469/11/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/TimeConverter.java File backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/TimeConverter.java: Line 23: })); Line 24: } Line 25: Line 26: public static long convert(long interval, TimeUnit inUnit, TimeUnit toUnit) { Line 27: return TimeUnit.valueOf(toUnit.name()).convert(interval, inUnit); > %s/inUnit/fromUnit/g ??? Done Line 28: } Line 29: Line 30: public static Pair<Long, TimeUnit> autoConvert(long interval, TimeUnit inUnit) { Line 31: init(); http://gerrit.ovirt.org/#/c/27469/11/backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/TimeConverterTest.java File backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/utils/TimeConverterTest.java: Line 1: package org.ovirt.engine.core.common.utils; > No test cases for convert method ?? It is just a wrapper around the java.util.concurrent.TimeUnit 's convert method.And has no new functionality.I wrote this just to make it more easy to use. i.e, the TimeUnit's convert function is invoked as, ex: to convert 60000 milliseconds to minutes, Without wrapper, TimeUnit.MINUTE.convert(60000, TimeUnit.MILLISECONDS); pattern : toUnit.convert(interval, fromUnit); but with my wrapper it can be done as , TimeConverter.convert(60000, TimeUnit.MILLISECONDS, TimeUnit.MINUTE); pattern : wrpper.convert(interval, fromUnit, toUnit); Line 2: Line 3: import static org.junit.Assert.assertEquals; Line 4: Line 5: import java.util.concurrent.TimeUnit; -- To view, visit http://gerrit.ovirt.org/27469 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I045aaa4f93b345e0457e1a0ce2ccf0ceeb9071ad Gerrit-PatchSet: 11 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: anmolbabu <[email protected]> Gerrit-Reviewer: Kanagaraj M <[email protected]> Gerrit-Reviewer: Ramesh N <[email protected]> Gerrit-Reviewer: Sahina Bose <[email protected]> Gerrit-Reviewer: Shubhendu Tripathi <[email protected]> Gerrit-Reviewer: anmolbabu <[email protected]> Gerrit-Reviewer: [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
