@Test public void testSchedule() throws Exception { CollectionProperty sched = new CollectionProperty(FreeFormArrivalsThreadGroup.SCHEDULE, new LinkedHashSet<>()); sched.addProperty(getRow(1, 10, 30)); sched.addProperty(getRow(0, 0, 5)); sched.addProperty(getRow(10, 1, 15)); FreeFormArrivalsThreadGroup atg = new FreeFormArrivalsThreadGroup(); atg.setProperty(sched); FreeFormArrivalsThreadStarterEmul obj = new FreeFormArrivalsThreadStarterEmul(atg); for (int n = 0; n < 60; n++) { log.info("Rate " + n + ": " + obj.getCurrentRate()); obj.addRollingTime(1000); } }
@Override protected double getCurrentRate() { CollectionProperty data = arrivalsTG.getData(); PropertyIterator it = data.iterator(); int offset = 0; while (it.hasNext()) { CollectionProperty record = (CollectionProperty) it.next(); double chunkLen = record.get(2).getDoubleValue() * arrivalsTG.getUnitFactor(); double timeProgress = this.rollingTime / 1000.0 - startTime; double chunkProgress = (timeProgress - offset) / chunkLen; offset += chunkLen; if (timeProgress <= offset) { double chunkStart = record.get(0).getDoubleValue() / arrivalsTG.getUnitFactor(); double chunkEnd = record.get(1).getDoubleValue() / arrivalsTG.getUnitFactor(); double chunkHeight = chunkEnd - chunkStart; return chunkStart + chunkProgress * chunkHeight; } } log.info("Got no further schedule, can stop now"); return -1; }
FreeFormArrivalsThreadStarter extends ArrivalsThreadStarter { @Override protected double getCurrentRate() { CollectionProperty data = arrivalsTG.getData(); PropertyIterator it = data.iterator(); int offset = 0; while (it.hasNext()) { CollectionProperty record = (CollectionProperty) it.next(); double chunkLen = record.get(2).getDoubleValue() * arrivalsTG.getUnitFactor(); double timeProgress = this.rollingTime / 1000.0 - startTime; double chunkProgress = (timeProgress - offset) / chunkLen; offset += chunkLen; if (timeProgress <= offset) { double chunkStart = record.get(0).getDoubleValue() / arrivalsTG.getUnitFactor(); double chunkEnd = record.get(1).getDoubleValue() / arrivalsTG.getUnitFactor(); double chunkHeight = chunkEnd - chunkStart; return chunkStart + chunkProgress * chunkHeight; } } log.info("Got no further schedule, can stop now"); return -1; } }
FreeFormArrivalsThreadStarter extends ArrivalsThreadStarter { @Override protected double getCurrentRate() { CollectionProperty data = arrivalsTG.getData(); PropertyIterator it = data.iterator(); int offset = 0; while (it.hasNext()) { CollectionProperty record = (CollectionProperty) it.next(); double chunkLen = record.get(2).getDoubleValue() * arrivalsTG.getUnitFactor(); double timeProgress = this.rollingTime / 1000.0 - startTime; double chunkProgress = (timeProgress - offset) / chunkLen; offset += chunkLen; if (timeProgress <= offset) { double chunkStart = record.get(0).getDoubleValue() / arrivalsTG.getUnitFactor(); double chunkEnd = record.get(1).getDoubleValue() / arrivalsTG.getUnitFactor(); double chunkHeight = chunkEnd - chunkStart; return chunkStart + chunkProgress * chunkHeight; } } log.info("Got no further schedule, can stop now"); return -1; } FreeFormArrivalsThreadStarter(int groupIndex, ListenerNotifier listenerNotifier, ListedHashTree listedHashTree, StandardJMeterEngine standardJMeterEngine, FreeFormArrivalsThreadGroup owner); }
FreeFormArrivalsThreadStarter extends ArrivalsThreadStarter { @Override protected double getCurrentRate() { CollectionProperty data = arrivalsTG.getData(); PropertyIterator it = data.iterator(); int offset = 0; while (it.hasNext()) { CollectionProperty record = (CollectionProperty) it.next(); double chunkLen = record.get(2).getDoubleValue() * arrivalsTG.getUnitFactor(); double timeProgress = this.rollingTime / 1000.0 - startTime; double chunkProgress = (timeProgress - offset) / chunkLen; offset += chunkLen; if (timeProgress <= offset) { double chunkStart = record.get(0).getDoubleValue() / arrivalsTG.getUnitFactor(); double chunkEnd = record.get(1).getDoubleValue() / arrivalsTG.getUnitFactor(); double chunkHeight = chunkEnd - chunkStart; return chunkStart + chunkProgress * chunkHeight; } } log.info("Got no further schedule, can stop now"); return -1; } FreeFormArrivalsThreadStarter(int groupIndex, ListenerNotifier listenerNotifier, ListedHashTree listedHashTree, StandardJMeterEngine standardJMeterEngine, FreeFormArrivalsThreadGroup owner);  }
FreeFormArrivalsThreadStarter extends ArrivalsThreadStarter { @Override protected double getCurrentRate() { CollectionProperty data = arrivalsTG.getData(); PropertyIterator it = data.iterator(); int offset = 0; while (it.hasNext()) { CollectionProperty record = (CollectionProperty) it.next(); double chunkLen = record.get(2).getDoubleValue() * arrivalsTG.getUnitFactor(); double timeProgress = this.rollingTime / 1000.0 - startTime; double chunkProgress = (timeProgress - offset) / chunkLen; offset += chunkLen; if (timeProgress <= offset) { double chunkStart = record.get(0).getDoubleValue() / arrivalsTG.getUnitFactor(); double chunkEnd = record.get(1).getDoubleValue() / arrivalsTG.getUnitFactor(); double chunkHeight = chunkEnd - chunkStart; return chunkStart + chunkProgress * chunkHeight; } } log.info("Got no further schedule, can stop now"); return -1; } FreeFormArrivalsThreadStarter(int groupIndex, ListenerNotifier listenerNotifier, ListedHashTree listedHashTree, StandardJMeterEngine standardJMeterEngine, FreeFormArrivalsThreadGroup owner);   }