def _gen_input_prop(_input): row, col, label, text = RTEProtocolHandler._handle_input_notaiton( _input) if row and col: prop = JMX._element_prop( "elementProp", "com.blazemeter.jmeter.rte.sampler.CoordInputRowGUI") prop.append(JMX._string_prop("CoordInputRowGUI.row", row)) prop.append(JMX._string_prop("CoordInputRowGUI.column", col)) elif label: prop = JMX._element_prop( "elementProp", "com.blazemeter.jmeter.rte.sampler.LabelInputRowGUI") prop.append(JMX._string_prop("LabelInputRowGUI.label", label)) prop.append(JMX._string_prop("Input.input", text)) return prop
def get_sampler_pair(self, request): action = etree.Element( "com.blazemeter.jmeter.rte.sampler.RTESampler", guiclass="com.blazemeter.jmeter.rte.sampler.gui.RTESamplerGui", testclass="com.blazemeter.jmeter.rte.sampler.", testname=request.label) action.append( JMX._string_prop("RTESampler.action", request.config.get('rte-action'))) if "wait-for" in request.config: self._gen_wait(action, request.config.get("wait-for")) if 'fields' in request.config: inputs = JMX._collection_prop("Inputs.inputs") for _input in request.config["fields"]: inputs.append(self._gen_input_prop(_input)) elem_props = JMX._element_prop( "Inputs.inputs", "com.blazemeter.jmeter.rte.sampler.Inputs") elem_props.append(inputs) action.append(elem_props) if 'attention-key' in request.config: action.append( JMX._string_prop("RTESampler.attentionKey", request.config.get('attention-key'))) children = etree.Element("hashTree") if 'extract-cursor-position' in request.config and request.config.get( 'extract-cursor-position'): element = request.config.get('extract-cursor-position') extractor = self._gen_rte_extractor(element['varname'], "CURSOR_POSITION") children.append(extractor) children.append( etree.Element("hashTree") ) # Is this an RTE extension bug? doesn't seem necesary, # but won't work without it. if 'extract-field-position' in request.config and request.config.get( 'extract-field-position'): element = request.config.get('extract-field-position') position = element['base-position'].strip("()") row, column = position.split(",") offset = element['field-offset'] extractor = self._gen_rte_extractor(element['varname'], "NEXT_FIELD_POSITION", row, column, offset) children.append(extractor) children.append(etree.Element("hashTree")) return action, children
def _gen_input_prop(_input): row, col, label, text, tabs = RTEProtocolHandler._handle_input_notation( _input) if row and col: prop = JMX._element_prop( "elementProp", "com.blazemeter.jmeter.rte.sampler.CoordInputRowGUI") prop.append(JMX._string_prop("CoordInputRowGUI.row", row)) prop.append(JMX._string_prop("CoordInputRowGUI.column", col)) elif label: prop = JMX._element_prop( "elementProp", "com.blazemeter.jmeter.rte.sampler.LabelInputRowGUI") prop.append(JMX._string_prop("LabelInputRowGUI.label", label)) elif tabs is not None: prop = JMX._element_prop( "elementProp", "com.blazemeter.jmeter.rte.sampler.TabulatorInputRowGui") prop.append( JMX._string_prop("TabulatorInputOffsetGUI.column", tabs)) prop.append(JMX._string_prop("Input.input", text)) return prop