本文整理汇总了Java中org.apache.jmeter.testbeans.gui.TestBeanGUI类的典型用法代码示例。如果您正苦于以下问题:Java TestBeanGUI类的具体用法?Java TestBeanGUI怎么用?Java TestBeanGUI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TestBeanGUI类属于org.apache.jmeter.testbeans.gui包,在下文中一共展示了TestBeanGUI类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTestElement
import org.apache.jmeter.testbeans.gui.TestBeanGUI; //导入依赖的package包/类
public TestElement getTestElement() {
Preconditions.checkNotNull(name);
Preconditions.checkNotNull(fileName);
CSVDataSet csvDataSet = new CSVDataSet();
csvDataSet.setProperty(TestElement.GUI_CLASS, TestBeanGUI.class.getName());
csvDataSet.setProperty(TestElement.TEST_CLASS, CSVDataSet.class.getName());
csvDataSet.setName(name);
csvDataSet.setEnabled(true);
// calling the setters doesn't work in jmeter 2.11
csvDataSet.setProperty("filename", getOptionalValue(fileName, String.format("%s%s", outputFilePath, fileName.toString())));
csvDataSet.setProperty("fileEncoding", fileEncoding);
csvDataSet.setProperty("variableNames", variableNames);
csvDataSet.setProperty("delimiter",delimiter);
csvDataSet.setProperty("quotedData", quotedData);
csvDataSet.setProperty("recycle", recycle);
csvDataSet.setProperty("stopThread", stopThread);
csvDataSet.setProperty("shareMode", shareMode);
return csvDataSet;
}
示例2: suiteGUIComponents
import org.apache.jmeter.testbeans.gui.TestBeanGUI; //导入依赖的package包/类
private static Test suiteGUIComponents() throws Exception {
TestSuite suite = new TestSuite("GuiComponents");
Iterator<Object> iter = getObjects(JMeterGUIComponent.class).iterator();
while (iter.hasNext()) {
JMeterGUIComponent item = (JMeterGUIComponent) iter.next();
if (item instanceof JMeterTreeNode) {
System.out.println("o.a.j.junit.JMeterTest INFO: JMeterGUIComponent: skipping all tests " + item.getClass().getName());
continue;
}
if (item instanceof ObsoleteGui){
continue;
}
TestSuite ts = new TestSuite(item.getClass().getName());
ts.addTest(new JMeterTest("GUIComponents1", item));
if (item instanceof TestBeanGUI) {
System.out.println("o.a.j.junit.JMeterTest INFO: JMeterGUIComponent: skipping some tests " + item.getClass().getName());
} else {
ts.addTest(new JMeterTest("GUIComponents2", item));
ts.addTest(new JMeterTest("runGUITitle", item));
}
suite.addTest(ts);
}
return suite;
}
示例3: suiteBeanComponents
import org.apache.jmeter.testbeans.gui.TestBeanGUI; //导入依赖的package包/类
private static Test suiteBeanComponents() throws Exception {
TestSuite suite = new TestSuite("BeanComponents");
Iterator<Object> iter = getObjects(TestBean.class).iterator();
while (iter.hasNext()) {
Class<? extends Object> c = iter.next().getClass();
try {
JMeterGUIComponent item = new TestBeanGUI(c);
// JMeterGUIComponent item = (JMeterGUIComponent) iter.next();
TestSuite ts = new TestSuite(item.getClass().getName());
ts.addTest(new JMeterTest("GUIComponents2", item));
ts.addTest(new JMeterTest("runGUITitle", item));
suite.addTest(ts);
} catch (IllegalArgumentException e) {
System.out.println("o.a.j.junit.JMeterTest Cannot create test for " + c.getName() + " " + e);
e.printStackTrace(System.out);
}
}
return suite;
}
示例4: getTestElement
import org.apache.jmeter.testbeans.gui.TestBeanGUI; //导入依赖的package包/类
public TestElement getTestElement() {
ConstantThroughputTimer timer = new ConstantThroughputTimer();
timer.setProperty(TestElement.GUI_CLASS, TestBeanGUI.class.getName());
timer.setProperty(TestElement.TEST_CLASS, ConstantThroughputTimer.class.getName());
timer.setName("Constant Throughput Timer");
timer.setComment("Used to throttle the amount of activity in any given minute to simulate real user loads");
timer.setEnabled(true);
// calling the setters doesn't work in jmeter 2.11
timer.setProperty("throughput", throughput);
timer.setProperty("calcMode", calcMode.getIndex());
return timer;
}
示例5: actionPerformed
import org.apache.jmeter.testbeans.gui.TestBeanGUI; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent actionEvent) {
//Get class from input text field
String className = this.textField.getText();
//Get list of class properties
List<FieldExpressionMapping> attributeList = new ArrayList<>();
try {
//Load class and get fields using reflection
Class loadedClass = Class.forName(className);
Field fields[] = loadedClass.getDeclaredFields();
for (Field field : fields) {
field.setAccessible(true);
FieldExpressionMapping expressionMapping = new FieldExpressionMapping();
expressionMapping.setFieldName(field.getName());
expressionMapping.setFieldExpression(PropsKeys.IGNORE);
attributeList.add(expressionMapping);
}
//Get current test GUI component
TestBeanGUI testBeanGUI = (TestBeanGUI) GuiPackage.getInstance().getCurrentGui();
Field customizer = TestBeanGUI.class.getDeclaredField(PropsKeys.CUSTOMIZER);
customizer.setAccessible(true);
//From TestBeanGUI retrieve Bean Customizer as it includes all editors like ClassPropertyEditor, TableEditor
GenericTestBeanCustomizer testBeanCustomizer = (GenericTestBeanCustomizer) customizer.get(testBeanGUI);
Field editors = GenericTestBeanCustomizer.class.getDeclaredField(PropsKeys.EDITORS);
editors.setAccessible(true);
//Retrieve TableEditor and set all fields with default values to it
PropertyEditor propertyEditors[] = (PropertyEditor[]) editors.get(testBeanCustomizer);
for (PropertyEditor propertyEditor : propertyEditors){
if (propertyEditor instanceof TableEditor){
propertyEditor.setValue(attributeList);
}
}
} catch (NoSuchFieldException | IllegalAccessException | ClassNotFoundException e) {
JOptionPane.showMessageDialog(null, "Failed to load class properties : " + e.getMessage(), "ERROR: Failed to load class properties!" , JOptionPane.ERROR_MESSAGE);
LOGGER.log(Level.SEVERE, "Failed to load class properties", e);
}
}