UtilizationModelPlanetLab extends UtilizationModelAbstract { public int getDataSamples(){ return utilization.length; } UtilizationModelPlanetLab(final String workloadFilePath, final double schedulingInterval);  UtilizationModelPlanetLab(final String workloadFilePath, final UnaryOperator<Double> mapper);  UtilizationModelPlanetLab(final String workloadFilePath, final double schedulingInterval, final int dataSamples); private  UtilizationModelPlanetLab(
        final InputStreamReader sreader,
        final double schedulingInterval,
        final int dataSamples); private  UtilizationModelPlanetLab(
        final InputStreamReader sreader,
        final double schedulingInterval,
        final int dataSamples,
        final UnaryOperator<Double> mapper); static UtilizationModelPlanetLab getInstance(final String workloadFilePath); static UtilizationModelPlanetLab getInstance(final String workloadFilePath, final double schedulingInterval); static UtilizationModelPlanetLab getInstance(final String workloadFilePath, final UnaryOperator<Double> mapper); int getDataSamples(); double getSchedulingInterval(); final void setSchedulingInterval(final double schedulingInterval); static final int DEF_DATA_SAMPLES; static final int DEF_SCHEDULING_INTERVAL; }
@Test public void testRead3LinesFromFileWith4LinesAndNoHeader() { final int totalLines = 4; final int linesToRead = 3; final String path = createTempTraceFile(totalLines, false); final UtilizationModelPlanetLab planetlab = new UtilizationModelPlanetLab(path, SCHEDULING_INTERVAL, linesToRead); assertEquals(linesToRead, planetlab.getDataSamples()); checkUtilizationValuesFromTempTrace(planetlab, linesToRead); }
@Test public void testRead3LinesFromFileWith4LinesAndHeader() { final int totalLines = 4; final int linesToRead = 3; final String path = createTempTraceFile(totalLines, true); final UtilizationModelPlanetLab planetlab = new UtilizationModelPlanetLab(path, SCHEDULING_INTERVAL, linesToRead); assertEquals(linesToRead, planetlab.getDataSamples()); checkUtilizationValuesFromTempTrace(planetlab, linesToRead); }
@Test public void testReadAllLinesFromFileWithHeader() { final int totalLines = 4; final String path = createTempTraceFile(totalLines, true); final UtilizationModelPlanetLab planetlab = new UtilizationModelPlanetLab(path, SCHEDULING_INTERVAL); assertEquals(totalLines, planetlab.getDataSamples()); checkUtilizationValuesFromTempTrace(planetlab, totalLines); }
@Test public void testReadAllLinesFromFileWith4LinesAndHeader() { final int totalLines = 4; final String path = createTempTraceFile(totalLines, true); final UtilizationModelPlanetLab planetlab = new UtilizationModelPlanetLab(path, SCHEDULING_INTERVAL, totalLines); assertEquals(totalLines, planetlab.getDataSamples()); checkUtilizationValuesFromTempTrace(planetlab, totalLines); }
@Test public void testReadAllLinesFromFileWith4LinesAndNoHeader() { final int totalLines = 4; final String path = createTempTraceFile(totalLines, false); final UtilizationModelPlanetLab planetlab = new UtilizationModelPlanetLab(path, SCHEDULING_INTERVAL, totalLines); assertEquals(totalLines, planetlab.getDataSamples()); checkUtilizationValuesFromTempTrace(planetlab, totalLines); }
@Test public void testReadDefaultNumLinesFromFileWithNoHeader() { final int linesToRead = UtilizationModelPlanetLab.DEF_DATA_SAMPLES; final int totalLines = linesToRead+10; final String path = createTempTraceFile(totalLines, false); final UtilizationModelPlanetLab planetlab = new UtilizationModelPlanetLab(path, SCHEDULING_INTERVAL, linesToRead); assertEquals(linesToRead, planetlab.getDataSamples()); checkUtilizationValuesFromTempTrace(planetlab, linesToRead); }
@Test public void testReadDefaultNumLinesFromFileWithNoHeader2() { final int linesToRead = UtilizationModelPlanetLab.DEF_DATA_SAMPLES; final int totalLines = linesToRead+10; final String path = createTempTraceFile(totalLines, false); final UtilizationModelPlanetLab planetlab = new UtilizationModelPlanetLab(path, SCHEDULING_INTERVAL, -1); assertEquals(linesToRead, planetlab.getDataSamples()); checkUtilizationValuesFromTempTrace(planetlab, linesToRead); }