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


Java JMeterUtils.initLocale方法代码示例

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


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

示例1: loadControl1

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
@Test
public void loadControl1() throws Exception {
   log.info("start loadControl1()");

   // Initialize Properties, logging, locale, etc.
   JMeterUtils.loadJMeterProperties(JMETER_HOME + "/bin/jmeter.properties");
   JMeterUtils.setJMeterHome(JMETER_HOME);
   JMeterUtils.initLocale();

   // Initialize JMeter SaveService
   SaveService.loadProperties();

   // Load existing .jmx Test Plan
   ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
   URL url = classLoader.getResource("tutorial/jmeter/Tutorial6.jmx");
   File file = new File(url.toURI());
   HashTree testPlanTree = SaveService.loadTree(file);

   // Run JMeter Test
   StandardJMeterEngine jmeter = new StandardJMeterEngine();
   jmeter.configure(testPlanTree);
   jmeter.run();
}
 
开发者ID:Wolfgang-Winter,项目名称:cibet,代码行数:24,代码来源:Tutorial6.java

示例2: setupClass

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
@BeforeAll
static void setupClass() throws IOException {
	jmeter = new StandardJMeterEngine();

	//JMeter initialization (properties, log levels, locale, etc)
	JMeterUtils.setJMeterHome("src/test/resources/");
	JMeterUtils.loadJMeterProperties("src/test/resources/jmeter.properties");
	JMeterUtils.initLocale();
}
 
开发者ID:CMSgov,项目名称:qpp-conversion-tool,代码行数:10,代码来源:ConverterLoadTest.java

示例3: main

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
public static void main(String[] args) {
//JMeter Engine
        StandardJMeterEngine jmeter = new StandardJMeterEngine();

        //JMeter initialization (properties, log levels, locale, etc)
        JMeterUtils.loadJMeterProperties("/path/to/your/jmeter/bin/jmeter.properties");
        JMeterUtils.setLocale(Locale.ENGLISH);

        // ??? 啥用
        JMeterUtils.setJMeterHome("");
        JMeterUtils.initLocale();

        // JMeter Test Plan, basic all u JOrphan HashTree
        HashTree testPlanTree = new HashTree();

        // Java Sampler
        JavaSampler javaSampler = new JavaSampler();
        javaSampler.setClassname("这里设置要运行的case主类");
        javaSampler.setName("");
        javaSampler.setComment("这个采集器的描述信息");

        // Loop Controller
        LoopController loopController = new LoopController();
        // 循环次数
        loopController.setLoops(1);
        loopController.addTestElement(javaSampler);
        loopController.setFirst(true);
        loopController.initialize();

        // Thread Group
        org.apache.jmeter.threads.ThreadGroup threadGroup = new org.apache.jmeter.threads.ThreadGroup();
        // 设置线程数
        threadGroup.setNumThreads(1);
        //
        threadGroup.setRampUp(1);
        threadGroup.setSamplerController(loopController);

        // Test Plan
        TestPlan testPlan = new TestPlan("Create JMeter Script From Java Code");

        // Construct Test Plan from previously initialized elements
        testPlanTree.add("testPlan", testPlan);
        testPlanTree.add("loopController", loopController);
        testPlanTree.add("threadGroup", threadGroup);
        testPlanTree.add("javaSampler", javaSampler);

        // Run Test Plan
        jmeter.configure(testPlanTree);
        jmeter.run();
    }
 
开发者ID:cbooy,项目名称:cakes,代码行数:51,代码来源:Demo1.java

示例4: JMeterRunner

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
public JMeterRunner(String testPlanName, String jmeterResourceDir) {
    this.jmeterResourceDir = jmeterResourceDir;
    jmeter = new StandardJMeterEngine();
    JMeterUtils.setJMeterHome(jmeterResourceDir);
    readProperties();
    JMeterUtils.initLogging();
    JMeterUtils.initLocale();
    testPlanTree = new ListedHashTree();
    this.testPlanName = testPlanName;
    this.testPlanFileName = testPlanName.toLowerCase().replaceAll("\\s+", "-");
    createTestPlan();
}
 
开发者ID:lithiumtech,项目名称:mineraloil-jmeter,代码行数:13,代码来源:JMeterRunner.java

示例5: requestsAreSubmitted

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
@When("^(.+) requests are submitted for endpoints$")
public void requestsAreSubmitted(final Integer loops,
                                 final List<Endpoint> endpoints) {

    // Set status vars - number of endpoints and a CPU sampler
    this.samplersCount = endpoints.size() + 1;

    // Create JMeter engine
    StandardJMeterEngine jmeter = new StandardJMeterEngine();

    // Init JMeter engine
    // TODO Refactor config
    JMeterUtils.setJMeterHome("JMETER_HOME");
    JMeterUtils.loadJMeterProperties("JMETER_HOME/bin/jmeter.properties");
    JMeterUtils.initLocale();

    // Build samplers, use path for name of the sampler
    Stream<HTTPSampler> httpSamplers = endpoints.stream().map(endpoint -> {
        HTTPSampler httpSampler = new HTTPSampler();
        httpSampler.setName(endpoint.getPath());
        httpSampler.setDomain(endpoint.getDomain());
        httpSampler.setPort(endpoint.getPort());
        httpSampler.setPath(endpoint.getPath());
        httpSampler.setMethod(endpoint.getMethod());
        return httpSampler;
    });

    // Build a CPU sampler
    CpuSampler cpuSampler = new CpuSampler();
    cpuSampler.setName("cpu");

    // Loop Controller
    LoopController loopController = new LoopController();
    loopController.setName("Default Loop Controller");
    loopController.setLoops(loops);
    loopController.setFirst(true);
    loopController.initialize();

    // Thread Group
    org.apache.jmeter.threads.ThreadGroup threadGroup = new ThreadGroup();
    threadGroup.setName("Default Thread Group");
    threadGroup.setNumThreads(1);
    threadGroup.setRampUp(1);
    threadGroup.setSamplerController(loopController);

    // Create results collector
    ResultCollector logger = new ResultCollector();
    logger.setName("Default Results Collector");
    logger.setFilename("metrics.csv");

    // Create a test structure
    HashTree testPlanTree = new HashTree();

    // Add Test Plan
    TestPlan testPlan = new TestPlan("Sample R integration test plan");
    testPlanTree.add(testPlan);

    // Hang off Thread Group off Test Plan
    HashTree threadGroupHashTree = testPlanTree.add(testPlan, threadGroup);

    // Add samplers
    threadGroupHashTree.add(httpSamplers.toArray());
    threadGroupHashTree.add(cpuSampler);

    // Add logger
    testPlanTree.add(testPlan, logger);

    // Run Test Plan
    jmeter.configure(testPlanTree);
    jmeter.run();
    threadGroup.waitThreadsStopped();
}
 
开发者ID:cadmiumkitty,项目名称:cucumber-jmeter-r-integration,代码行数:73,代码来源:DataScienceLabDemoTestPerformanceAnomaliesSteps.java

示例6: handle

import org.apache.jmeter.util.JMeterUtils; //导入方法依赖的package包/类
@Override
public OutputMessage handle(AgentTokenWrapper token, InputMessage message) throws Exception {
	ApplicationContext context = token.getServices().getApplicationContextBuilder().getCurrentContext();
	if(context.get("initialized")==null) {
		FileVersionId jmeterLibs = getFileVersionId("$jmeter.libraries", message.getProperties());
		FileVersion jmeterLibFolder = token.getServices().getFileManagerClient().requestFileVersion(jmeterLibs.getFileId(), jmeterLibs.getVersion());
		jmeterHome = jmeterLibFolder.getFile().getAbsolutePath();
		updateClasspathSystemProperty();
		
		JMeterUtils.setJMeterHome(jmeterHome);
		JMeterUtils.loadJMeterProperties(jmeterHome+"/bin/jmeter.properties");
		JMeterUtils.initLogging();
		JMeterUtils.initLocale();
		
		context.put("initialized", true);
	}
	
	OutputMessageBuilder out = new OutputMessageBuilder();

	File testPlanFile = retrieveFileVersion("$jmeter.testplan.file", message.getProperties()).getFile();

	StandardJMeterEngine jmeter = new StandardJMeterEngine();

	HashTree testPlanTree = SaveService.loadTree(testPlanFile);

	Arguments arguments = createArguments(message);
	SampleListenerImpl listener = new SampleListenerImpl(out);

	testPlanTree.traverse(new HashTreeTraverser() {

		@Override
		public void subtractNode() {
		}

		@Override
		public void processPath() {
		}

		@Override
		public void addNode(Object node, HashTree subTree) {
			if (node instanceof TestPlan) {
				testPlanTree.getTree(node).add(listener);
				testPlanTree.getTree(node).add(arguments);
			}
		}
	});

	jmeter.configure(testPlanTree);
	try {
		jmeter.run();
	} finally {
		listener.collect();
	}

	return out.build();

}
 
开发者ID:denkbar,项目名称:step,代码行数:58,代码来源:JMeterLocalHandler.java


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