• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TestElementProperty类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.jmeter.testelement.property.TestElementProperty的典型用法代码示例。如果您正苦于以下问题:Java TestElementProperty类的具体用法?Java TestElementProperty怎么用?Java TestElementProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TestElementProperty类属于org.apache.jmeter.testelement.property包,在下文中一共展示了TestElementProperty类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: sampleTest2

import org.apache.jmeter.testelement.property.TestElementProperty; //导入依赖的package包/类
@Test
public void sampleTest2() throws Exception {
 http2Req.testStarted();
 
 Arguments args = new Arguments();
       String text = "{\"header\":{\"applicationId\":\"HJS\"},\"initSession\":{}}";
       HTTPArgument arg = new HTTPArgument("", text.replaceAll("\n","\r\n"), false);
       arg.setAlwaysEncoded(false);
       args.addArgument(arg);
       http2Req.setProperty(new TestElementProperty(HTTP2Request.ARGUMENTS, args));

 URL url = new URL("https", "www.sprint.com", 443, "/apiservices/framework/initSession");
 
 HTTP2Connection connection = Mockito.mock(HTTP2Connection.class);
 
 Mockito.when(connection.isClosed()).thenReturn(true);
 Mockito.doNothing().when(connection).connect(Mockito.any(String.class), Mockito.any(Integer.class));
 Mockito.when(connection.getConnectionId()).thenReturn("10www.sprint.com443");
 
 HTTP2SampleResult sampleResult =new HTTP2SampleResult(url, "POST");
 http2Req.addConnection("10www.sprint.com443", connection);
 http2Req.setConnection(url, sampleResult);
 http2Req.setProperty(new BooleanProperty(HTTP2Request.SYNCREQUEST, true));
 HTTP2SampleResult sample = http2Req.sample(url, "POST", false, 0, http2Req.getConnection(), sampleResult);
 
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:27,代码来源:HTTP2RequestTest.java


示例2: createPostContentTest

import org.apache.jmeter.testelement.property.TestElementProperty; //导入依赖的package包/类
@Test
public void createPostContentTest() throws Exception {
 String text = "{\"header\":{\"applicationId\":\"HJS\"},\"initSession\":{}}";
 
 
 DataPostContent dataPostExp = new DataPostContent();
 dataPostExp.setDataPath("/apiservices/framework/initSession");
 dataPostExp.setPayload(text.getBytes());
 		 
 Arguments args = new Arguments();
       
       HTTPArgument arg = new HTTPArgument("", text.replaceAll("\n","\r\n"), false);
       arg.setAlwaysEncoded(false);
       args.addArgument(arg);
       http2Req.setProperty(new TestElementProperty(HTTP2Request.ARGUMENTS, args));
 http2Req.setProperty(HTTP2Request.PATH, "/apiservices/framework/initSession");
       DataPostContent dataPostRes = http2Req.createPostContent("POST");
       
       assertEquals(dataPostExp.getDataPath(), dataPostRes.getDataPath());     
       
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:22,代码来源:HTTP2RequestTest.java


示例3: getSendFileAsPostBodyTest

import org.apache.jmeter.testelement.property.TestElementProperty; //导入依赖的package包/类
@Test
public void getSendFileAsPostBodyTest(){
 HTTPFileArgs fileArgs = new HTTPFileArgs();
 http2Req.setProperty(new TestElementProperty("HTTPsampler.Files", fileArgs));
 boolean valueRes=http2Req.getSendFileAsPostBody();
 assertFalse(valueRes);		
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:8,代码来源:HTTP2RequestTest.java


示例4: marshal

import org.apache.jmeter.testelement.property.TestElementProperty; //导入依赖的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


示例5: initilizeElement

import org.apache.jmeter.testelement.property.TestElementProperty; //导入依赖的package包/类
@Override
public TestElement initilizeElement() {
	ConfigTestElement ele = new ConfigTestElement();
	this.baseElement(ele, "HTTP Request Defaults");
	ArgumentsInitializer argsIniter = new ArgumentsInitializer();
	
	ele.setProperty(HTTPSampler.CONCURRENT_POOL, "6");
	ele.setProperty(HTTPSampler.CONNECT_TIMEOUT, EMPTY_STRING);
	ele.setProperty(HTTPSampler.CONTENT_ENCODING, EMPTY_STRING);
	ele.setProperty(HTTPSampler.DOMAIN, EMPTY_STRING);
	ele.setProperty(HTTPSampler.PATH, EMPTY_STRING);
	ele.setProperty(HTTPSampler.PORT, EMPTY_STRING);
	ele.setProperty(HTTPSampler.PROTOCOL, EMPTY_STRING);
	ele.setProperty(HTTPSampler.RESPONSE_TIMEOUT, EMPTY_STRING);
	

	TestElementProperty argProp = new TestElementProperty(HTTPSampler.ARGUMENTS, argsIniter.initilizeElement());
	ele.setProperty(argProp);
	
	return ele;
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:22,代码来源:HTTPDefaultsInitializer.java


示例6: modifyTestElement

import org.apache.jmeter.testelement.property.TestElementProperty; //导入依赖的package包/类
@Override
public void modifyTestElement(TestElement element) {
    configureTestElement(element);
    element.setProperty(WebSocketSampler.DOMAIN, domain.getText());
    element.setProperty(WebSocketSampler.PATH, path.getText());
    element.setProperty(WebSocketSampler.PORT, port.getText());
    element.setProperty(WebSocketSampler.PROTOCOL, protocol.getText());
    element.setProperty(WebSocketSampler.CONTENT_ENCODING, contentEncoding.getText());

    Arguments args = (Arguments) argsPanel.createTestElement();
    HTTPArgument.convertArgumentsToHTTP(args);
    element.setProperty(new TestElementProperty(WebSocketSampler.ARGUMENTS, args));

    element.setProperty(WebSocketSampler.SEND_MESSAGE, sendMessage.getText());
    element.setProperty(WebSocketSampler.RECV_MESSAGE, recvMessage.getText());
}
 
开发者ID:kawasima,项目名称:jmeter-websocket,代码行数:17,代码来源:WebSocketSamplerGui.java


示例7: unwrapProperty

import org.apache.jmeter.testelement.property.TestElementProperty; //导入依赖的package包/类
private static Object unwrapProperty(PropertyDescriptor desc, JMeterProperty jprop, Class<?> type) {
    Object value;
    if(jprop instanceof TestElementProperty)
    {
        TestElement te = ((TestElementProperty)jprop).getElement();
        if(te instanceof TestBean)
        {
            prepare(te);
        }
        value = te;
    }
    else if(jprop instanceof MultiProperty)
    {
        value = unwrapCollection((MultiProperty)jprop,(String)desc.getValue(TableEditor.CLASSNAME));
    }
    // value was not provided, and this is allowed
    else if (jprop instanceof NullProperty &&
            // use negative condition so missing (null) value is treated as FALSE
            ! Boolean.TRUE.equals(desc.getValue(GenericTestBeanCustomizer.NOT_UNDEFINED))) {    
        value=null;
    } else {
        value = Converter.convert(jprop.getStringValue(), type);
    }
    return value;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:26,代码来源:TestBeanHelper.java


示例8: convertCollection

import org.apache.jmeter.testelement.property.TestElementProperty; //导入依赖的package包/类
private Collection<Object> convertCollection(Collection<?> values)
{
    List<Object> l = new LinkedList<Object>();
    for(Object obj : values)
    {
        if(obj instanceof TestElementProperty)
        {
            l.add(((TestElementProperty)obj).getElement());
        }
        else
        {
            l.add(obj);
        }
    }
    return l;
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:17,代码来源:TableEditor.java


示例9: setUp

import org.apache.jmeter.testelement.property.TestElementProperty; //导入依赖的package包/类
@Override
protected void setUp() {
    Arguments args = new Arguments();
    args.addArgument("username", "mstover");
    args.addArgument("password", "pass");
    args.addArgument("action", "login");
    config = new HTTPNullSampler();
    config.setName("Full Config");
    config.setProperty(HTTPSamplerBase.DOMAIN, "www.lazer.com");
    config.setProperty(HTTPSamplerBase.PATH, "login.jsp");
    config.setProperty(HTTPSamplerBase.METHOD, HTTPConstants.POST);
    config.setProperty(new TestElementProperty(HTTPSamplerBase.ARGUMENTS, args));
    defaultConfig = new HTTPNullSampler();
    defaultConfig.setName("default");
    defaultConfig.setProperty(HTTPSamplerBase.DOMAIN, "www.xerox.com");
    defaultConfig.setProperty(HTTPSamplerBase.PATH, "default.html");
    partialConfig = new HTTPNullSampler();
    partialConfig.setProperty(HTTPSamplerBase.PATH, "main.jsp");
    partialConfig.setProperty(HTTPSamplerBase.METHOD, HTTPConstants.GET);
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:21,代码来源:UrlConfigTest.java


示例10: testRecovery

import org.apache.jmeter.testelement.property.TestElementProperty; //导入依赖的package包/类
public void testRecovery() throws Exception {
    ConfigTestElement config = new ConfigTestElement();
    config.addProperty(new StringProperty("name", "config"));
    config.setRunningVersion(true);
    LoginConfig loginConfig = new LoginConfig();
    loginConfig.setUsername("user1");
    loginConfig.setPassword("pass1");
    assertTrue(config.getProperty("login") instanceof NullProperty);
    // This test should work whether or not all Nulls are equal
    assertEquals(new NullProperty("login"), config.getProperty("login"));
    config.addProperty(new TestElementProperty("login", loginConfig));
    assertEquals(loginConfig.toString(), config.getPropertyAsString("login"));
    config.recoverRunningVersion();
    assertTrue(config.getProperty("login") instanceof NullProperty);
    assertEquals(new NullProperty("login"), config.getProperty("login"));
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:17,代码来源:PackageTest.java


示例11: testArguments

import org.apache.jmeter.testelement.property.TestElementProperty; //导入依赖的package包/类
public void testArguments() throws Exception {
    Arguments args = new Arguments();
    args.addArgument("arg1", "val1", "=");
    TestElementProperty prop = new TestElementProperty("args", args);
    ConfigTestElement te = new ConfigTestElement();
    te.addProperty(prop);
    te.setRunningVersion(true);
    Arguments config = new Arguments();
    config.addArgument("config1", "configValue", "=");
    TestElementProperty configProp = new TestElementProperty("args", config);
    ConfigTestElement te2 = new ConfigTestElement();
    te2.addProperty(configProp);
    te.addTestElement(te2);
    assertEquals(2, args.getArgumentCount());
    assertEquals("config1=configValue", args.getArgument(1).toString());
    te.recoverRunningVersion();
    te.addTestElement(te2);
    assertEquals(2, args.getArgumentCount());
    assertEquals("config1=configValue", args.getArgument(1).toString());

}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:22,代码来源:PackageTest.java


示例12: setHeaderManager

import org.apache.jmeter.testelement.property.TestElementProperty; //导入依赖的package包/类
public void setHeaderManager(HeaderManager value) {
	HeaderManager mgr = getHeaderManager();
	if (mgr != null) {
		value = mgr.merge(value, true);
		if (log.isDebugEnabled()) {
			log.debug("Existing HeaderManager '" + mgr.getName() + "' merged with '" + value.getName() + "'");
			for (int i = 0; i < value.getHeaders().size(); i++) {
				log.debug("    " + value.getHeader(i).getName() + "=" + value.getHeader(i).getValue());
			}
		}
	}
	setProperty(new TestElementProperty(HEADER_MANAGER, (TestElement) value));
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:14,代码来源:HlsSampler.java


示例13: setHeaderManager

import org.apache.jmeter.testelement.property.TestElementProperty; //导入依赖的package包/类
public void setHeaderManager(HeaderManager value) {
	HeaderManager mgr = getHeaderManager();
	if (mgr != null) {
		value = mgr.merge(value, true);
		if (log.isDebugEnabled()) {
			log.debug("Existing HeaderManager '" + mgr.getName() + "' merged with '" + value.getName() + "'");
			for (int i = 0; i < value.getHeaders().size(); i++) {
				log.debug("    " + value.getHeader(i).getName() + "=" + value.getHeader(i).getValue());
			}
		}
	}
	setProperty(new TestElementProperty(HEADER_MANAGER, value));
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:14,代码来源:WebSocketAbstractSampler.java


示例14: modifyTestElement

import org.apache.jmeter.testelement.property.TestElementProperty; //导入依赖的package包/类
@Override
public void modifyTestElement(TestElement te) {
    configureTestElement(te);
    if (te instanceof ConfigTestElement) {
    	ConfigTestElement configTestElement = (ConfigTestElement) te;
    	configTestElement.setProperty("WebSocketConnectionConfig.Server", webSocketConnectionConfigPanel.getServer());
    	configTestElement.setProperty("WebSocketConnectionConfig.Port", webSocketConnectionConfigPanel.getPort());
    	configTestElement.setProperty("WebSocketConnectionConfig.ConnectionTimeout", webSocketConnectionConfigPanel.getConnectionTimeout());
    	configTestElement.setProperty("WebSocketConnectionConfig.Protocol", webSocketConnectionConfigPanel.getProtocolSelected());
    	configTestElement.setProperty("WebSocketConnectionConfig.Path", webSocketConnectionConfigPanel.getPath());
    	configTestElement.setProperty("WebSocketConnectionConfig.Topic", webSocketConnectionConfigPanel.getTopic());
    	configTestElement.setProperty("WebSocketConnectionConfig.Encoding", webSocketConnectionConfigPanel.getContentEncoding());
    	configTestElement.setProperty("WebSocketConnectionConfig.Implementation", webSocketConnectionConfigPanel.getImplementation());
        configTestElement.setProperty("WebSocketConnectionConfig.CloseConnectionPattern", webSocketConnectionConfigPanel.getCloseConnectionPattern());
        configTestElement.setProperty("WebSocketConnectionConfig.ProtocolWSMQTTComboBox", webSocketConnectionConfigPanel.getProtocolWSMQTTComboBox());
        configTestElement.setProperty("WebSocketConnectionConfig.LogLevel", webSocketConnectionConfigPanel.getLogLevel());
        
        
        HTTPArgumentsPanel queryStringParameters = webSocketConnectionConfigPanel.getAttributePanel();
        if (queryStringParameters != null) {
        	configTestElement.setProperty(new TestElementProperty("WebSocketConnectionConfig.HTTPRequest.ARGUMENTS", (Arguments)queryStringParameters.createTestElement()));
        }
        
        ArgumentsPanel queryStringPatterns = webSocketConnectionConfigPanel.getPatternsPanel();
        if (queryStringPatterns != null) {
        	configTestElement.setProperty(new TestElementProperty("WebSocketConnectionConfig.ResponsePatterns.ARGUMENTS", (Arguments)queryStringPatterns.createTestElement()));
        }
    }
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:30,代码来源:WebSocketConnectionConfigGui.java


示例15: setHeaderManager

import org.apache.jmeter.testelement.property.TestElementProperty; //导入依赖的package包/类
public void setHeaderManager(HeaderManager value) {
    HeaderManager mgr = getHeaderManager();
    if (mgr != null) {
        value = mgr.merge(value, true);
        if (log.isDebugEnabled()) {
            log.debug("Existing HeaderManager '" + mgr.getName() + "' merged with '" + value.getName() + "'");
            for (int i = 0; i < value.getHeaders().size(); i++) {
                log.debug("    " + value.getHeader(i).getName() + "=" + value.getHeader(i).getValue());
            }
        }
    }
    setProperty(new TestElementProperty(HEADER_MANAGER, value));
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:14,代码来源:HTTP2Request.java


示例16: getHTTPFilesTest

import org.apache.jmeter.testelement.property.TestElementProperty; //导入依赖的package包/类
@Test
public void getHTTPFilesTest(){
 HTTPFileArg[] fileArgsRes = http2Req.getHTTPFiles();
 assertNotEquals(null, fileArgsRes);
 HTTPFileArgs fileArgs = new HTTPFileArgs();
 HTTPFileArg[] fileArgsExp = fileArgs.asArray();
 http2Req.setProperty(new TestElementProperty("HTTPsampler.Files", fileArgs));
 fileArgsRes = http2Req.getHTTPFiles();
 
 assertEquals(fileArgsExp, fileArgsRes);

}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:13,代码来源:HTTP2RequestTest.java


示例17: unmarshal

import org.apache.jmeter.testelement.property.TestElementProperty; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
    try {
        TestElementProperty prop = (TestElementProperty) createCollection(context.getRequiredType());
        prop.setName(ConversionHelp.decode(reader.getAttribute(ConversionHelp.ATT_NAME)));
        String element = reader.getAttribute(ConversionHelp.ATT_ELEMENT_TYPE);
        boolean isHeader = HEADER_CLASSNAME.equals(element);
        prop.setObjectValue(mapper().realClass(element).newInstance());// Always decode
        TestElement te = (TestElement)prop.getObjectValue();
        // No need to check version, just process the attributes if present
        ConversionHelp.restoreSpecialProperties(te, reader);
        while (reader.hasMoreChildren()) {
            reader.moveDown();
            JMeterProperty subProp = (JMeterProperty) readItem(reader, context, prop);
            if (subProp != null) { // could be null if it has been deleted via NameUpdater
                if (isHeader) {
                    String name = subProp.getName();
                    if (TestElement.NAME.equals(name)) {
                        subProp.setName("Header.name");// $NON-NLS-1$
                        // Must be same as Header.HNAME - but that is built
                        // later
                    }
                }
                prop.addProperty(subProp);
            }
            reader.moveUp();
        }
        return prop;
    } catch (InstantiationException | IllegalAccessException e) {
        log.error("Couldn't unmarshall TestElementProperty", e);
        return new TestElementProperty("ERROR", new ConfigTestElement());// $NON-NLS-1$
    }
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:35,代码来源:TestElementPropertyConverter.java


示例18: traverseProperty

import org.apache.jmeter.testelement.property.TestElementProperty; //导入依赖的package包/类
protected void traverseProperty(TestElementTraverser traverser, JMeterProperty value) {
    traverser.startProperty(value);
    if (value instanceof TestElementProperty) {
        ((TestElement) value.getObjectValue()).traverse(traverser);
    } else if (value instanceof CollectionProperty) {
        traverseCollection((CollectionProperty) value, traverser);
    } else if (value instanceof MapProperty) {
        traverseMap((MapProperty) value, traverser);
    }
    traverser.endProperty(value);
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:12,代码来源:AbstractTestElement.java


示例19: addArgument

import org.apache.jmeter.testelement.property.TestElementProperty; //导入依赖的package包/类
/**
 * Add a new argument.
 *
 * @param arg
 *            the new argument
 */
public void addArgument(Argument arg) {
    TestElementProperty newArg = new TestElementProperty(arg.getName(), arg);
    if (isRunningVersion()) {
        this.setTemporary(newArg);
    }
    getArguments().addItem(newArg);
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:14,代码来源:Arguments.java


示例20: unwrapProperty

import org.apache.jmeter.testelement.property.TestElementProperty; //导入依赖的package包/类
private static Object unwrapProperty(PropertyDescriptor desc, JMeterProperty jprop, Class<?> type) {
    Object value;
    if(jprop instanceof TestElementProperty)
    {
        TestElement te = ((TestElementProperty)jprop).getElement();
        if(te instanceof TestBean)
        {
            prepare(te);
        }
        value = te;
    } else {
        value = Converter.convert(jprop.getStringValue(), type);
    }
    return value;
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:16,代码来源:TestBeanHelper.java



注:本文中的org.apache.jmeter.testelement.property.TestElementProperty类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SessionInfo类代码示例发布时间:2022-05-23
下一篇:
Java AnalysisScope类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap