当前位置: 首页>>代码示例>>Java>>正文


Java SampleResult.setDataEncoding方法代码示例

本文整理汇总了Java中org.apache.jmeter.samplers.SampleResult.setDataEncoding方法的典型用法代码示例。如果您正苦于以下问题:Java SampleResult.setDataEncoding方法的具体用法?Java SampleResult.setDataEncoding怎么用?Java SampleResult.setDataEncoding使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.jmeter.samplers.SampleResult的用法示例。


在下文中一共展示了SampleResult.setDataEncoding方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMasterList

import org.apache.jmeter.samplers.SampleResult; //导入方法依赖的package包/类
private DataRequest getMasterList(SampleResult masterResult, Parser parser) throws IOException {

		masterResult.sampleStart();
		DataRequest respond = parser.getBaseUrl(new URL(getURLData()), masterResult, true);
		masterResult.sampleEnd();

		masterResult.setRequestHeaders(respond.getRequestHeaders() + "\n\n" + getCookieHeader(getURLData()) + "\n\n"
				+ getRequestHeader(this.getHeaderManager()));
		masterResult.setSuccessful(respond.isSuccess());
		masterResult.setResponseMessage(respond.getResponseMessage());
		masterResult.setSampleLabel(this.getName());
		masterResult.setResponseHeaders(respond.getHeadersAsString());
		masterResult.setResponseData(respond.getResponse().getBytes());
		masterResult.setResponseCode(respond.getResponseCode());
		masterResult.setContentType(respond.getContentType());
		masterResult.setBytes(masterResult.getBytesAsLong() + (long) masterResult.getRequestHeaders().length());

		int headerBytes = masterResult.getResponseHeaders().length() // condensed
																		// length
																		// (without
																		// \r)
				+ respond.getHeaders().size() // Add \r for each header
				+ 1 // Add \r for initial header
				+ 2; // final \r\n before data

		masterResult.setHeadersSize((int) headerBytes);
		masterResult.setSentBytes(respond.getSentBytes());
		masterResult.setDataEncoding(respond.getContentEncoding());

		return respond;

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

示例2: getPlayList

import org.apache.jmeter.samplers.SampleResult; //导入方法依赖的package包/类
private DataRequest getPlayList(SampleResult playListResult, Parser parser) throws IOException {

		String lastPath = "";
		playListResult.sampleStart();
		DataRequest subRespond = parser.getBaseUrl(new URL(playlist), playListResult, true);
		playListResult.sampleEnd();

		String[] urlArray = playlist.split("/");
		lastPath = urlArray[urlArray.length - 1];

		playListResult.setRequestHeaders(subRespond.getRequestHeaders() + "\n\n" + getCookieHeader(playlist) + "\n\n"
				+ getRequestHeader(this.getHeaderManager()));
		playListResult.setSuccessful(subRespond.isSuccess());
		playListResult.setResponseMessage(subRespond.getResponseMessage());
		playListResult.setSampleLabel(lastPath);
		playListResult.setResponseHeaders(subRespond.getHeadersAsString());
		playListResult.setResponseData(subRespond.getResponse().getBytes());
		playListResult.setResponseCode(subRespond.getResponseCode());
		playListResult.setContentType(subRespond.getContentType());
		playListResult.setBytes(playListResult.getBytesAsLong() + (long) playListResult.getRequestHeaders().length());

		int headerBytes = playListResult.getResponseHeaders().length() // condensed
																		// length
																		// (without
																		// \r)
				+ subRespond.getHeaders().size() // Add \r for each header
				+ 1 // Add \r for initial header
				+ 2; // final \r\n before data

		playListResult.setHeadersSize((int) headerBytes);
		playListResult.setSentBytes(subRespond.getSentBytes());
		playListResult.setDataEncoding(subRespond.getContentEncoding());

		return subRespond;
	}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:36,代码来源:HlsSampler.java

示例3: getFragments

import org.apache.jmeter.samplers.SampleResult; //导入方法依赖的package包/类
public List<SampleResult> getFragments(Parser parser, List<DataFragment> uris, String url) {
	List<SampleResult> res = new ArrayList<>();

	if (!uris.isEmpty()) {
		SampleResult result = new SampleResult();
		String uriString = uris.get(0).getTsUri();
		if ((url != null) && (!uriString.startsWith("http"))) {
			uriString = url + uriString;
		}

		result.sampleStart();

		try {

			DataRequest respond = parser.getBaseUrl(new URL(uriString), result, false);

			result.sampleEnd();

			String[] urlArray = uriString.split("/");
			String lastPath = urlArray[urlArray.length - 1];

			result.setRequestHeaders(respond.getRequestHeaders() + "\n\n" + getCookieHeader(uriString) + "\n\n"
					+ getRequestHeader(this.getHeaderManager()));
			result.setSuccessful(respond.isSuccess());
			result.setResponseMessage(respond.getResponseMessage());
			result.setSampleLabel(lastPath);
			result.setResponseHeaders("URL: " + uriString + "\n" + respond.getHeadersAsString());
			result.setResponseCode(respond.getResponseCode());
			result.setContentType(respond.getContentType());
			result.setBytes(result.getBytesAsLong() + (long) result.getRequestHeaders().length());
			int headerBytes = result.getResponseHeaders().length() // condensed
																	// length
																	// (without
																	// \r)
					+ respond.getHeaders().size() // Add \r for each header
					+ 1 // Add \r for initial header
					+ 2; // final \r\n before data

			result.setHeadersSize((int) headerBytes);
			result.setSentBytes(respond.getSentBytes());
			result.setDataEncoding(respond.getContentEncoding());

			res.add(result);

		} catch (IOException e1) {
			e1.printStackTrace();
			result.sampleEnd();
			result.setSuccessful(false);
			result.setResponseMessage("Exception: " + e1);
			res.add(result);
		}

		uris.remove(0);
		List<SampleResult> aux = getFragments(parser, uris, url);
		for (SampleResult s : aux) {
			if(!res.contains(s))
				res.add(s);
		}
	}
	return res;
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:62,代码来源:HlsSampler.java


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