本文整理汇总了Java中org.apache.jmeter.util.JMeterUtils.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java JMeterUtils.getProperty方法的具体用法?Java JMeterUtils.getProperty怎么用?Java JMeterUtils.getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.jmeter.util.JMeterUtils
的用法示例。
在下文中一共展示了JMeterUtils.getProperty方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupTest
import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
@Override
public void setupTest(BackendListenerContext context) throws Exception {
try {
this.index = context.getParameter(ES_INDEX);
this.bulkSize = Integer.parseInt(context.getParameter(ES_BULK_SIZE));
this.timeoutMs = JMeterUtils.getPropDefault(ES_TIMEOUT_MS, DEFAULT_TIMEOUT_MS);
this.buildNumber = (JMeterUtils.getProperty(ElasticsearchBackend.BUILD_NUMBER) != null
&& JMeterUtils.getProperty(ElasticsearchBackend.BUILD_NUMBER).trim() != "")
? Integer.parseInt(JMeterUtils.getProperty(ElasticsearchBackend.BUILD_NUMBER)) : 0;
String host = context.getParameter(ES_HOST);
int port = Integer.parseInt(context.getParameter(ES_PORT));
this.client = new RestHighLevelClient(
RestClient.builder(
new HttpHost(host, port, context.getParameter(ES_SCHEME, "http")))
.setRequestConfigCallback(requestConfigBuilder ->
requestConfigBuilder
.setConnectTimeout(5000)
.setSocketTimeout((int)timeoutMs))
.setMaxRetryTimeoutMillis(60000));
this.bulkRequest = new BulkRequest().timeout(TimeValue.timeValueMillis(timeoutMs));
super.setupTest(context);
} catch (Exception e) {
throw new IllegalStateException("Unable to setup connectivity to ES", e);
}
}
示例2: getLanguages
import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
/**
* Generate the list of supported languages.
*
* @return list of languages
*/
// Also used by org.apache.jmeter.resources.PackageTest
public static String[] getLanguages(){
List<String> lang = new ArrayList<String>(20);
lang.add(Locale.ENGLISH.toString()); // en
lang.add(Locale.FRENCH.toString()); // fr
lang.add(Locale.GERMAN.toString()); // de
lang.add("no"); // $NON-NLS-1$
lang.add("pl"); // $NON-NLS-1$
lang.add("pt_BR"); // $NON-NLS-1$
lang.add("es"); // $NON-NLS-1$
lang.add("tr"); // $NON-NLS-1$
lang.add(Locale.JAPANESE.toString()); // ja
lang.add(Locale.SIMPLIFIED_CHINESE.toString()); // zh_CN
lang.add(Locale.TRADITIONAL_CHINESE.toString()); // zh_TW
final String addedLocales = JMeterUtils.getProperty("locales.add");
if (addedLocales != null){
String [] addLanguages =addedLocales.split(","); // $NON-NLS-1$
for(String newLang : addLanguages){
log.info("Adding locale "+newLang);
lang.add(newLang);
}
}
return lang.toArray(new String[lang.size()]);
}
示例3: SSHSessionFactory
import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
public SSHSessionFactory() {
String knownHosts = JMeterUtils.getProperty("jmeter.sshmon.knownHosts");
if (knownHosts != null && !knownHosts.isEmpty()) {
try {
log.debug("known hosts file set to "+knownHosts);
jsch.setKnownHosts(knownHosts);
hostKeyValidation = true;
}
catch (JSchException e) {
log.error("Failed to set known hosts ", e);
}
}
}
示例4: getSemaphores
import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
int getSemaphores() {
final String semaphores = JMeterUtils.getProperty(HONO_PREFIX + getAddress());
if (semaphores == null) {
return 0;
} else {
return Integer.parseInt(semaphores);
}
}
示例5: preloadVariables
import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
private void preloadVariables(){
for (String property : PRE_LOAD) {
String value = JMeterUtils.getProperty(property);
if (value != null) {
variables.put(property, value);
}
}
}
示例6: TCPClientImpl
import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
public TCPClientImpl() {
super();
setEolByte(eolInt);
if (useEolByte) {
log.info("Using eolByte=" + eolByte);
}
setCharset(charset);
String configuredCharset = JMeterUtils.getProperty("tcp.charset");
if(StringUtils.isEmpty(configuredCharset)) {
log.info("Using platform default charset:"+charset);
} else {
log.info("Using charset:"+configuredCharset);
}
}
示例7: setParameters
import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public synchronized void setParameters(Collection<CompoundVariable> parameters) throws InvalidVariableException {
checkParameterCount(parameters, 1, 2);
values = parameters.toArray();
try {
bshInterpreter = new BeanShellInterpreter(JMeterUtils.getProperty(INIT_FILE), log);
} catch (ClassNotFoundException e) {
throw new InvalidVariableException("BeanShell not found", e);
}
}
示例8: getJMeterLaf
import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
/**
* Get LookAndFeel classname from the following properties:
* <ul>
* <li>jmeter.laf.<os.name> - lowercased; spaces replaced by '_'</li>
* <li>jmeter.laf.<os.family> - lowercased.</li>
* <li>jmeter.laf</li>
* <li>UIManager.getCrossPlatformLookAndFeelClassName()</li>
* </ul>
* @return LAF classname
*/
private static String getJMeterLaf(){
String laf;
laf = PREFS.get(USER_PREFS_KEY, null);
if (laf != null) {
return checkLafName(laf);
}
String osName = System.getProperty("os.name") // $NON-NLS-1$
.toLowerCase(Locale.ENGLISH);
// Spaces are not allowed in property names read from files
laf = JMeterUtils.getProperty(JMETER_LAF+"."+osName.replace(' ', '_'));
if (laf != null) {
return checkLafName(laf);
}
String[] osFamily = osName.split("\\s"); // e.g. windows xp => windows
laf = JMeterUtils.getProperty(JMETER_LAF+"."+osFamily[0]);
if (laf != null) {
return checkLafName(laf);
}
laf = JMeterUtils.getProperty(JMETER_LAF);
if (laf != null) {
return checkLafName(laf);
}
return UIManager.getCrossPlatformLookAndFeelClassName();
}
示例9: preloadVariables
import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
private void preloadVariables(){
for (int i = 0; i < PRE_LOAD.length; i++){
String property=PRE_LOAD[i];
String value=JMeterUtils.getProperty(property);
if (value != null){
variables.put(property,value);
}
}
}
示例10: initSampleVariables
import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
/**
* Set up the additional variable names to be saved
* from the value in the {@link #SAMPLE_VARIABLES} property
*/
public static void initSampleVariables() {
String vars = JMeterUtils.getProperty(SAMPLE_VARIABLES);
variableNames=vars != null ? vars.split(",") : new String[0];
log.info("List of sample_variables: " + Arrays.toString(variableNames));
}
示例11: getIconMappings
import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
/**
* Parse icon set file.
* @return List of icons/action definition
*/
private static List<IconToolbarBean> getIconMappings() {
// Get the standard toolbar properties
Properties defaultProps = JMeterUtils.loadProperties(DEFAULT_TOOLBAR_PROPERTY_FILE);
if (defaultProps == null) {
JOptionPane.showMessageDialog(null,
JMeterUtils.getResString("toolbar_icon_set_not_found"), // $NON-NLS-1$
JMeterUtils.getResString("toolbar_icon_set_not_found"), // $NON-NLS-1$
JOptionPane.WARNING_MESSAGE);
return null;
}
Properties p;
String userProp = JMeterUtils.getProperty(USER_DEFINED_TOOLBAR_PROPERTY_FILE);
if (userProp != null){
p = JMeterUtils.loadProperties(userProp, defaultProps);
} else {
p=defaultProps;
}
String order = JMeterUtils.getPropDefault(TOOLBAR_LIST, p.getProperty(TOOLBAR_PROP_NAME));
if (order == null) {
log.warn("Could not find toolbar definition list");
JOptionPane.showMessageDialog(null,
JMeterUtils.getResString("toolbar_icon_set_not_found"), // $NON-NLS-1$
JMeterUtils.getResString("toolbar_icon_set_not_found"), // $NON-NLS-1$
JOptionPane.WARNING_MESSAGE);
return null;
}
String[] oList = order.split(TOOLBAR_ENTRY_SEP);
List<IconToolbarBean> listIcons = new ArrayList<IconToolbarBean>();
for (String key : oList) {
log.debug("Toolbar icon key: " + key); //$NON-NLS-1$
String trimmed = key.trim();
if (trimmed.equals("|")) { //$NON-NLS-1$
listIcons.add(null);
} else {
String property = p.getProperty(trimmed);
if (property == null) {
log.warn("No definition for toolbar entry: " + key);
} else {
try {
IconToolbarBean itb = new IconToolbarBean(property);
listIcons.add(itb);
} catch (IllegalArgumentException e) {
// already reported by IconToolbarBean
}
}
}
}
return listIcons;
}
示例12: getColors
import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
/**
* Parse icon set file.
* @return List of icons/action definition
*/
public static List<Color> getColors() {
Properties defaultProps = JMeterUtils.loadProperties(DEFAULT_COLORS_PROPERTY_FILE);
if (defaultProps == null) {
JOptionPane.showMessageDialog(null,
JMeterUtils.getResString("toolbar_icon_set_not_found"), // $NON-NLS-1$
JMeterUtils.getResString("toolbar_icon_set_not_found"), // $NON-NLS-1$
JOptionPane.WARNING_MESSAGE);
return null;
}
Properties p;
String userProp = JMeterUtils.getProperty(USER_DEFINED_COLORS_PROPERTY_FILE);
if (userProp != null){
p = JMeterUtils.loadProperties(userProp, defaultProps);
} else {
p=defaultProps;
}
String order = JMeterUtils.getPropDefault(COLORS_ORDER, p.getProperty(ORDER_PROP_NAME));
if (order == null) {
log.warn("Could not find order list");
JOptionPane.showMessageDialog(null,
JMeterUtils.getResString("toolbar_icon_set_not_found"), // $NON-NLS-1$
JMeterUtils.getResString("toolbar_icon_set_not_found"), // $NON-NLS-1$
JOptionPane.WARNING_MESSAGE);
return null;
}
String[] oList = order.split(ENTRY_SEP);
List<Color> listColors = new ArrayList<Color>();
for (String key : oList) {
String trimmed = key.trim();
String property = p.getProperty(trimmed);
try {
String[] lcol = property.split(ENTRY_SEP);
Color itb = new Color(Integer.parseInt(lcol[0]), Integer.parseInt(lcol[1]), Integer.parseInt(lcol[2]));
listColors.add(itb);
} catch (java.lang.Exception e) {
log.warn("Error in colors.properties, current property=" + property); // $NON-NLS-1$
}
}
return listColors;
}