本文整理汇总了Java中org.apache.jmeter.testelement.property.JMeterProperty类的典型用法代码示例。如果您正苦于以下问题:Java JMeterProperty类的具体用法?Java JMeterProperty怎么用?Java JMeterProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JMeterProperty类属于org.apache.jmeter.testelement.property包,在下文中一共展示了JMeterProperty类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testBug54467
import org.apache.jmeter.testelement.property.JMeterProperty; //导入依赖的package包/类
public void testBug54467() throws Exception {
JMeterContext jmctx = JMeterContextService.getContext();
LoopController loop = new LoopController();
Map<String, String> variables = new HashMap<String, String>();
ReplaceStringWithFunctions transformer = new ReplaceStringWithFunctions(new CompoundVariable(), variables);
jmctx.setVariables(new JMeterVariables());
StringProperty prop = new StringProperty(LoopController.LOOPS,"${__Random(1,12,)}");
JMeterProperty newProp = transformer.transformValue(prop);
newProp.setRunningVersion(true);
loop.setProperty(newProp);
loop.addTestElement(new TestSampler("random run"));
loop.setRunningVersion(true);
loop.initialize();
int loops = loop.getLoops();
for (int i = 0; i < loops; i++) {
Sampler s = loop.next();
assertNotNull(s);
}
assertNull(loop.next());
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:23,代码来源:TestLoopController.java
示例2: getRequestHeader
import org.apache.jmeter.testelement.property.JMeterProperty; //导入依赖的package包/类
public String getRequestHeader(org.apache.jmeter.protocol.http.control.HeaderManager headerManager) {
String headerString = "";
if (headerManager != null) {
CollectionProperty headers = headerManager.getHeaders();
if (headers != null) {
for (JMeterProperty jMeterProperty : headers) {
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();
v = v.replaceFirst(":\\d+$", "");
headerString = headerString + n + ": " + v + "\n";
}
}
}
}
return headerString;
}
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:22,代码来源:HlsSampler.java
示例3: configure
import org.apache.jmeter.testelement.property.JMeterProperty; //导入依赖的package包/类
@Override
public void configure(TestElement tg) {
super.configure(tg);
ParallelHTTPSampler utg = (ParallelHTTPSampler) tg;
JMeterProperty threadValues = utg.getData();
if (threadValues instanceof NullProperty) {
log.warn("Received null property instead of collection");
return;
}
CollectionProperty columns = (CollectionProperty) threadValues;
tableModel.removeTableModelListener(this);
JMeterPluginsUtils.collectionPropertyToTableModelRows(columns, tableModel);
tableModel.addTableModelListener(this);
buttons.checkDeleteButtonStatus();
updateUI();
}
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:19,代码来源:ParallelHTTPSamplerGui.java
示例4: setConnectionHeaders
import org.apache.jmeter.testelement.property.JMeterProperty; //导入依赖的package包/类
protected void setConnectionHeaders(ClientUpgradeRequest request, HeaderManager headerManager, CacheManager cacheManager) {
if (headerManager != null) {
CollectionProperty headers = headerManager.getHeaders();
if (headers != null) {
for (JMeterProperty jMeterProperty : headers) {
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){
}
}
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:20,代码来源:WebSocketAbstractSampler.java
示例5: createPostContent
import org.apache.jmeter.testelement.property.JMeterProperty; //导入依赖的package包/类
/** Retorna el cuerpo que sera enviado en el post, de acuerdo a los parametros que obtenga */
public DataPostContent createPostContent(String method){
DataPostContent dpc = null;
if (method.equals("POST")) {
dpc = new DataPostContent();
//TODO set things
Arguments fafa = getArguments();
String valor = "";
for (JMeterProperty jmp : fafa) {
valor = ((HTTPArgument) jmp.getObjectValue()).getEncodedValue();
}
dpc.setPayload(valor.getBytes());
// TODO Code to send a file, need to figure out where is goes
dpc.setDataPath(getProperty(HTTP2Request.PATH).getStringValue());
}
return dpc;
}
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:21,代码来源:HTTP2Request.java
示例6: sample
import org.apache.jmeter.testelement.property.JMeterProperty; //导入依赖的package包/类
public SampleResult sample(Entry arg0) {
SampleResult res = new SampleResult();
res.setSampleLabel("函数助手小工具");
res.sampleStart();
// 输出GUI界面所输入的函数方法返回结果
JMeterProperty properties = this.getProperty(FUNCTION);
System.out.println(properties);
//
if (properties != null) {
res.setResponseData("Function结果是:" + properties.getStringValue(), null);
res.setDataType(SampleResult.TEXT);
}
res.sampleEnd();
res.setSuccessful(true);
return res;
}
开发者ID:mzanthem,项目名称:Baozun_jmeter,代码行数:21,代码来源:TestSampler.java
示例7: initiateConnectors
import org.apache.jmeter.testelement.property.JMeterProperty; //导入依赖的package包/类
@Override
protected void initiateConnectors() {
samplers.clear();
CollectionProperty rows = getSamplerSettings();
for (int i = 0; i < rows.size(); i++) {
ArrayList<Object> row = (ArrayList<Object>) rows.get(i).getObjectValue();
String label = ((JMeterProperty)row.get(0)).getStringValue();
String host = ((JMeterProperty)row.get(1)).getStringValue();
int port = ((JMeterProperty)row.get(2)).getIntValue();
String username = ((JMeterProperty)row.get(3)).getStringValue();
String privateKey = ((JMeterProperty)row.get(4)).getStringValue();
String password = ((JMeterProperty)row.get(5)).getStringValue();
String command = ((JMeterProperty)row.get(6)).getStringValue();
boolean isDelta = ((JMeterProperty)row.get(7)).getBooleanValue();
ConnectionDetails connectionDetails = new ConnectionDetails(username, host, port, password,
privateKey.isEmpty()? null: privateKey.getBytes());
log.debug("Adding sampler for "+connectionDetails+" / "+command);
samplers.add(new SSHMonSampler(label, connectionDetails, command, isDelta));
}
}
开发者ID:tilln,项目名称:jmeter-sshmon,代码行数:24,代码来源:SSHMonCollector.java
示例8: getLoops
import org.apache.jmeter.testelement.property.JMeterProperty; //导入依赖的package包/类
public int getLoops() {
// Evaluation occurs when nbLoops is not yet evaluated
// or when nbLoops is equal to special value INFINITE_LOOP_COUNT
if (nbLoops==null || // No evaluated yet
nbLoops.intValue()==0 || // Last iteration led to nbLoops == 0,
// in this case as resetLoopCount will not be called,
// it leads to no further evaluations if we don't evaluate, see BUG 56276
nbLoops.intValue()==INFINITE_LOOP_COUNT // Number of iteration is set to infinite
) {
try {
JMeterProperty prop = getProperty(LOOPS);
nbLoops = Integer.valueOf(prop.getStringValue());
} catch (NumberFormatException e) {
nbLoops = Integer.valueOf(0);
}
}
return nbLoops.intValue();
}
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:19,代码来源:LoopController.java
示例9: marshal
import org.apache.jmeter.testelement.property.JMeterProperty; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void marshal(Object arg0, HierarchicalStreamWriter writer, MarshallingContext context) {
TestElementProperty prop = (TestElementProperty) arg0;
writer.addAttribute(ConversionHelp.ATT_NAME, ConversionHelp.encode(prop.getName()));
Class<?> clazz = prop.getObjectValue().getClass();
writer.addAttribute(ConversionHelp.ATT_ELEMENT_TYPE,
mapper().serializedClass(clazz));
TestElement te = (TestElement)prop.getObjectValue();
ConversionHelp.saveSpecialProperties(te,writer);
for (JMeterProperty jmp : prop) {
// Skip special properties if required
if (!ConversionHelp.isSpecialProperty(jmp.getName()))
{
// Don't save empty comments
if (!(TestElement.COMMENTS.equals(jmp.getName())
&& jmp.getStringValue().isEmpty()))
{
writeItem(jmp, context, writer);
}
}
}
//TODO clazz is probably always the same as testclass
}
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:25,代码来源:TestElementPropertyConverter.java
示例10: marshal
import org.apache.jmeter.testelement.property.JMeterProperty; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void marshal(Object arg0, HierarchicalStreamWriter writer, MarshallingContext context) {
TestElement el = (TestElement) arg0;
ConversionHelp.saveSpecialProperties(el,writer);
PropertyIterator iter = el.propertyIterator();
while (iter.hasNext()) {
JMeterProperty jmp=iter.next();
// Skip special properties if required
if (!ConversionHelp.isSpecialProperty(jmp.getName())) {
// Don't save empty comments - except for the TestPlan (to maintain compatibility)
if (!(
TestElement.COMMENTS.equals(jmp.getName())
&& jmp.getStringValue().length()==0
&& !el.getClass().equals(TestPlan.class)
))
{
writeItem(jmp, context, writer);
}
}
}
}
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:23,代码来源:TestElementConverter.java
示例11: addProperty
import org.apache.jmeter.testelement.property.JMeterProperty; //导入依赖的package包/类
/**
* Add property to test element
* @param property {@link JMeterProperty} to add to current Test Element
* @param clone clone property
*/
protected void addProperty(JMeterProperty property, boolean clone) {
JMeterProperty propertyToPut = property;
if(clone) {
propertyToPut = property.clone();
}
if (isRunningVersion()) {
setTemporary(propertyToPut);
} else {
clearTemporary(property);
}
JMeterProperty prop = getProperty(property.getName());
if (prop instanceof NullProperty || (prop instanceof StringProperty && prop.getStringValue().isEmpty())) {
propMap.put(property.getName(), propertyToPut);
} else {
prop.mergeIn(propertyToPut);
}
}
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:24,代码来源:AbstractTestElement.java
示例12: recoverRunningVersion
import org.apache.jmeter.testelement.property.JMeterProperty; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void recoverRunningVersion() {
Iterator<Map.Entry<String, JMeterProperty>> iter = propMap.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<String, JMeterProperty> entry = iter.next();
JMeterProperty prop = entry.getValue();
if (isTemporary(prop)) {
iter.remove();
clearTemporary(prop);
} else {
prop.recoverRunningVersion(this);
}
}
emptyTemporary();
}
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:19,代码来源:AbstractTestElement.java
示例13: unwrapCollection
import org.apache.jmeter.testelement.property.JMeterProperty; //导入依赖的package包/类
private static Object unwrapCollection(MultiProperty prop, String type)
{
if(prop instanceof CollectionProperty)
{
Collection<Object> values = new LinkedList<>();
for (JMeterProperty jMeterProperty : prop) {
try {
values.add(unwrapProperty(null, jMeterProperty, Class.forName(type)));
}
catch(Exception e) {
log.error("Couldn't convert object: " + prop.getObjectValue() + " to " + type,e);
}
}
return values;
}
return null;
}
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:18,代码来源:TestBeanHelper.java
示例14: addAuth
import org.apache.jmeter.testelement.property.JMeterProperty; //导入依赖的package包/类
/**
* Add newAuthorization if it does not already exist
* @param newAuthorization authorization to be added
*/
public void addAuth(Authorization newAuthorization) {
boolean alreadyExists = false;
//iterate over authentication objects in manager
for (JMeterProperty jMeterProperty : getAuthObjects()) {
Authorization authorization = (Authorization) jMeterProperty.getObjectValue();
if (authorization == null) {
continue;
}
if (match(authorization,newAuthorization)) {
if (log.isDebugEnabled()) {
log.debug("Found the same Authorization object:" + newAuthorization.toString());
}
//set true, if found the same one
alreadyExists=true;
break;
}
}
if(!alreadyExists){
// if there was no such auth object, add.
getAuthObjects().addItem(newAuthorization);
}
}
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:27,代码来源:AuthManager.java
示例15: save
import org.apache.jmeter.testelement.property.JMeterProperty; //导入依赖的package包/类
/**
* Save the static cookie data to a file.
* <p>
* Cookies are only taken from the GUI - runtime cookies are not included.
*
* @param authFile
* name of the file to store the cookies into. If the name is
* relative, the system property <code>user.dir</code> will be
* prepended
* @throws IOException
* when writing to that file fails
*/
public void save(String authFile) throws IOException {
File file = new File(authFile);
if (!file.isAbsolute()) {
file = new File(System.getProperty("user.dir") // $NON-NLS-1$
+ File.separator + authFile);
}
try(PrintWriter writer = new PrintWriter(new FileWriter(file))) { // TODO Charset ?
writer.println("# JMeter generated Cookie file");// $NON-NLS-1$
long now = System.currentTimeMillis();
for (JMeterProperty jMeterProperty : getCookies()) {
Cookie cook = (Cookie) jMeterProperty.getObjectValue();
final long expiresMillis = cook.getExpiresMillis();
if (expiresMillis == 0 || expiresMillis > now) { // only save unexpired cookies
writer.println(cookieToString(cook));
}
}
writer.flush();
}
}
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:32,代码来源:CookieManager.java
示例16: getCookiesForUrl
import org.apache.jmeter.testelement.property.JMeterProperty; //导入依赖的package包/类
/**
* Get array of valid HttpClient cookies for the URL
*
* @param cookiesCP cookies to consider
* @param url the target URL
* @param allowVariableCookie flag whether to allow jmeter variables in cookie values
* @return array of HttpClient cookies
*
*/
org.apache.commons.httpclient.Cookie[] getCookiesForUrl(
CollectionProperty cookiesCP,
URL url,
boolean allowVariableCookie){
org.apache.commons.httpclient.Cookie[] cookies =
new org.apache.commons.httpclient.Cookie[cookiesCP.size()];
int i = 0;
for (JMeterProperty jMeterProperty : cookiesCP) {
Cookie jmcookie = (Cookie) jMeterProperty.getObjectValue();
// Set to running version, to allow function evaluation for the cookie values (bug 28715)
if (allowVariableCookie) {
jmcookie.setRunningVersion(true);
}
cookies[i++] = makeCookie(jmcookie);
if (allowVariableCookie) {
jmcookie.setRunningVersion(false);
}
}
String host = url.getHost();
String protocol = url.getProtocol();
int port= HTTPSamplerBase.getDefaultPort(protocol,url.getPort());
String path = url.getPath();
boolean secure = HTTPSamplerBase.isSecure(protocol);
return cookieSpec.match(host, port, path, secure, cookies);
}
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:35,代码来源:HC3CookieHandler.java
示例17: save
import org.apache.jmeter.testelement.property.JMeterProperty; //导入依赖的package包/类
/**
* Save the header data to a file.
*
* @param headFile
* name of the file to store headers into. If name is relative
* the system property <code>user.dir</code> will be prepended
* @throws IOException
* if writing the headers fails
*/
public void save(String headFile) throws IOException {
File file = new File(headFile);
if (!file.isAbsolute()) {
file = new File(System.getProperty("user.dir")// $NON-NLS-1$
+ File.separator + headFile);
}
PrintWriter writer = new PrintWriter(new FileWriter(file)); // TODO Charset ?
writer.println("# JMeter generated Header file");// $NON-NLS-1$
final CollectionProperty hdrs = getHeaders();
for (int i = 0; i < hdrs.size(); i++) {
final JMeterProperty hdr = hdrs.get(i);
Header head = (Header) hdr.getObjectValue();
writer.println(head.toString());
}
writer.flush();
writer.close();
}
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:27,代码来源:HeaderManager.java
示例18: setConnectionHeaders
import org.apache.jmeter.testelement.property.JMeterProperty; //导入依赖的package包/类
/**
* Extracts all the required headers for that particular URL request and
* sets them in the <code>HttpURLConnection</code> passed in
*
* @param conn
* <code>HttpUrlConnection</code> which represents the URL
* request
* @param u
* <code>URL</code> of the URL request
* @param headerManager
* the <code>HeaderManager</code> containing all the cookies
* for this <code>UrlConfig</code>
* @param cacheManager the CacheManager (may be null)
*/
private void setConnectionHeaders(HttpURLConnection conn, URL u, HeaderManager headerManager, CacheManager cacheManager) {
// Add all the headers from the HeaderManager
if (headerManager != null) {
CollectionProperty headers = headerManager.getHeaders();
if (headers != null) {
for (JMeterProperty jMeterProperty : headers) {
Header header = (Header) jMeterProperty.getObjectValue();
String n = header.getName();
String v = header.getValue();
conn.addRequestProperty(n, v);
}
}
}
if (cacheManager != null){
cacheManager.setHeaders(conn, u);
}
}
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:32,代码来源:HTTPJavaImpl.java
示例19: getUserAttributes
import org.apache.jmeter.testelement.property.JMeterProperty; //导入依赖的package包/类
/**
* Collect all the value from the table (Arguments), using this create the
* basicAttributes. This will create the Basic Attributes for the User
* defined TestCase for Add Test.
*
* @return the BasicAttributes
*/
private BasicAttributes getUserAttributes() {
BasicAttribute basicattribute = new BasicAttribute("objectclass"); //$NON-NLS-1$
basicattribute.add("top"); //$NON-NLS-1$
basicattribute.add("person"); //$NON-NLS-1$
basicattribute.add("organizationalPerson"); //$NON-NLS-1$
basicattribute.add("inetOrgPerson"); //$NON-NLS-1$
BasicAttributes attrs = new BasicAttributes(true);
attrs.put(basicattribute);
BasicAttribute attr;
for (JMeterProperty jMeterProperty : getArguments()) {
Argument item = (Argument) jMeterProperty.getObjectValue();
attr = getBasicAttribute(item.getName(), item.getValue());
attrs.put(attr);
}
return attrs;
}
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:25,代码来源:LDAPSampler.java
示例20: getUserAttributes
import org.apache.jmeter.testelement.property.JMeterProperty; //导入依赖的package包/类
/***************************************************************************
* Collect all the values from the table (Arguments), using this create the
* Attributes, this will create the Attributes for the User
* defined TestCase for Add Test
*
* @return The Attributes
**************************************************************************/
private Attributes getUserAttributes() {
Attributes attrs = new BasicAttributes(true);
Attribute attr;
for (JMeterProperty jMeterProperty : getArguments()) {
Argument item = (Argument) jMeterProperty.getObjectValue();
attr = attrs.get(item.getName());
if (attr == null) {
attr = getBasicAttribute(item.getName(), item.getValue());
} else {
attr.add(item.getValue());
}
attrs.put(attr);
}
return attrs;
}
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:24,代码来源:LDAPExtSampler.java
注:本文中的org.apache.jmeter.testelement.property.JMeterProperty类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论