Martin Sivák has posted comments on this change. Change subject: sla: Add support for basic PolicyUnit testing ......................................................................
Patch Set 12: (3 comments) https://gerrit.ovirt.org/#/c/39728/12/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/SlaValidator.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/SlaValidator.java: Line 56: + curVds.getReservedMem(); Line 57: } Line 58: Line 59: public static Integer getEffectiveCpuCores(VDS vds, VdsGroupDAO vdsGroupDao) { Line 60: VDSGroup vdsGroup = vdsGroupDao.get(vds.getVdsGroupId()); > -1 please don't infect our api. I realize this is for testing. But what? It is a static method, so there is nothing else you can use even with CDI Singleton.. I have to mock the values here somehow. Line 61: return getEffectiveCpuCores(vds, vdsGroup != null ? vdsGroup.getCountThreadsAsCores() : false); Line 62: } Line 63: Line 64: public static Integer getEffectiveCpuCores(VDS vds, boolean countThreadsAsCores) { https://gerrit.ovirt.org/#/c/39728/12/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/scheduling/policyunits/AbstractPolicyUnitTest.java File backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/scheduling/policyunits/AbstractPolicyUnitTest.java: Line 142: throws NoSuchFieldException, InvocationTargetException, NoSuchMethodException, InstantiationException, Line 143: IllegalAccessException, IOException, ParseException { Line 144: Map<Guid, T> entities = new HashMap<>(); Line 145: InputStream inputStream = getClass().getResourceAsStream("/scheduling/" + fixtureName); Line 146: BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); > those sources most be closed, its not being treated upon collecting them. ( Done Line 147: Line 148: /* First line contains the field names */ Line 149: String header = bufferedReader.readLine(); Line 150: String[] fields = header.split(","); https://gerrit.ovirt.org/#/c/39728/12/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/scheduling/policyunits/CpuAndMemoryBalancingPolicyUnitTest.java File backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/scheduling/policyunits/CpuAndMemoryBalancingPolicyUnitTest.java: Line 21: import static org.mockito.Mockito.mock; Line 22: import static org.mockito.Mockito.spy; Line 23: Line 24: public class CpuAndMemoryBalancingPolicyUnitTest extends AbstractPolicyUnitTest { Line 25: protected <T extends CpuAndMemoryBalancingPolicyUnit> T mockUnit(Class<T> unitType, > create a new line here Done Line 26: VDSGroup cluster, Line 27: Map<Guid, VDS> hosts, Line 28: Map<Guid, VM> vms) Line 29: throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, -- To view, visit https://gerrit.ovirt.org/39728 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ied30d4ac4c1eeee2911e5f276d5333982147effa Gerrit-PatchSet: 12 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Martin Sivák <[email protected]> Gerrit-Reviewer: Gilad Chaplik <[email protected]> Gerrit-Reviewer: Martin Betak <[email protected]> Gerrit-Reviewer: Martin Sivák <[email protected]> Gerrit-Reviewer: Roy Golan <[email protected]> Gerrit-Reviewer: Tomer Saban <[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
