本文整理匯總了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);
}
}