Java Code Examples for org.apache.jmeter.testelement.property.PropertyIterator#next()

The following examples show how to use org.apache.jmeter.testelement.property.PropertyIterator#next() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebSocketAbstractSampler.java    From jmeter-bzm-plugins with Apache License 2.0 6 votes vote down vote up
protected void setConnectionHeaders(ClientUpgradeRequest request, HeaderManager headerManager, CacheManager cacheManager) {
    if (headerManager != null) {
        CollectionProperty headers = headerManager.getHeaders();
        PropertyIterator p = headers.iterator();
        if (headers != null) {
        	while (p.hasNext()){
        		JMeterProperty jMeterProperty = p.next();
        		org.apache.jmeter.protocol.http.control.Header header
                = (org.apache.jmeter.protocol.http.control.Header)
                        jMeterProperty.getObjectValue();
                String n = header.getName();
                if (! HTTPConstants.HEADER_CONTENT_LENGTH.equalsIgnoreCase(n)){
                    String v = header.getValue();
            		request.setHeader(n, v);
                }
        	}
        }
    }
    if (cacheManager != null){
    }
}
 
Example 2
Source File: CompositeGraphGui.java    From jmeter-plugins with Apache License 2.0 6 votes vote down vote up
private void setConfig(CollectionProperty properties) {
    PropertyIterator iter = properties.iterator();

    CollectionProperty testplans = (CollectionProperty) iter.next();
    CollectionProperty rows = (CollectionProperty) iter.next();

    if (rows.size() > 0) {
        PropertyIterator iterTestplans = testplans.iterator();
        PropertyIterator iterRows = rows.iterator();

        while (iterTestplans.hasNext() && iterRows.hasNext()) {
            String testplan = iterTestplans.next().getStringValue();
            String row = iterRows.next().getStringValue();
            compositeRowsSelectorPanel.addItemsToComposite(testplan, row);
        }

    }
}
 
Example 3
Source File: FreeFormArrivalsThreadStarter.java    From jmeter-plugins with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example 4
Source File: BaseCollectorConfig.java    From jmeter-prometheus-plugin with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
	PropertyIterator it = this.propertyIterator();
	StringBuilder sb = new StringBuilder();
	sb.append("[");
	while(it.hasNext()) {
		JMeterProperty prop = it.next();
		sb.append(prop.getName()).append(": ").append(prop.getStringValue()).append(", ");
	}

	sb.append("]");
	return sb.toString();
}
 
Example 5
Source File: TreeClonerTG.java    From jmeter-debugger with Apache License 2.0 5 votes vote down vote up
private JMeterTreeNode getClonedNode(JMeterTreeNode node) {
    TestElement orig = getOriginalObject(node);
    TestElement cloned = (TestElement) orig.clone();
    TestElement altered = getAlteredElement(cloned);

    if (altered instanceof Wrapper) {
        Wrapper wrp = (Wrapper) altered;
        //noinspection unchecked
        wrp.setWrappedElement(cloned);
        PropertyIterator iter = cloned.propertyIterator();
        while (iter.hasNext()) {
            JMeterProperty prop = iter.next();
            if (!prop.getName().startsWith("TestElement")) {
                wrp.setProperty(prop.clone());
            }
        }
    }

    if (altered instanceof OriginalLink) {
        OriginalLink link = (OriginalLink) altered;
        //noinspection unchecked
        link.setOriginal(orig);
    } else {
        log.debug("Not linking original: " + altered);
    }

    JMeterTreeNode res = new JMeterTreeNode();
    altered.setName(cloned.getName());
    altered.setEnabled(cloned.isEnabled());
    if (altered.getProperty(TestElement.GUI_CLASS) instanceof NullProperty) {
        altered.setProperty(TestElement.GUI_CLASS, ControllerDebugGui.class.getCanonicalName());
    }
    res.setUserObject(altered);
    return res;
}
 
Example 6
Source File: FreeFormArrivalsThreadGroupGui.java    From jmeter-plugins with Apache License 2.0 5 votes vote down vote up
protected void updateChart(AbstractDynamicThreadGroup tg) {
    FreeFormArrivalsThreadGroup atg = (FreeFormArrivalsThreadGroup) tg;
    CollectionProperty data = atg.getData();
    chartModel.clear();
    previewChart.clearErrorMessage();
    AbstractGraphRow row = new GraphRowExactValues();
    row.setColor(getRowColor());
    row.setDrawLine(true);
    row.setMarkerSize(AbstractGraphRow.MARKER_SIZE_NONE);
    row.setDrawThickLines(true);

    row.add(0, 0); // initial value to force min Y

    JMeterVariableEvaluator evaluator = new JMeterVariableEvaluator();
    int offset = 0;
    double totalArrivals = 0;
    PropertyIterator it = data.iterator();
    while (it.hasNext()) {
        CollectionProperty record = (CollectionProperty) it.next();
        double from = evaluator.getDouble(record.get(0));
        double to = evaluator.getDouble(record.get(1));
        double during = evaluator.getDouble(record.get(2));
        row.add(offset * 1000, from);
        offset += during * tg.getUnitFactor();
        row.add(offset * 1000, to);
        totalArrivals += during * from + during * (to - from) / 2;
    }

    previewChart.setxAxisLabelRenderer(new DateTimeRenderer(DateTimeRenderer.HHMMSS, 0));
    chartModel.put(getRowLabel(totalArrivals), row);
}