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


Java JobOperator.getRunningExecutions方法代码示例

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


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

示例1: runningExecutionMemory_BATCHEE112

import javax.batch.operations.JobOperator; //导入方法依赖的package包/类
@Test
public void runningExecutionMemory_BATCHEE112() {
    final JobOperator operator = new JobOperatorImpl(new ServicesManager() {{
        init(new Properties() {{
            setProperty(PersistenceManagerService.class.getSimpleName(), MemoryPersistenceManagerService.class.getName());
        }});
    }});
    for (int i = 0; i < 10; i++) {
        final long id = operator.start("simple", new Properties() {{
            setProperty("duration", "3000");
        }});
        final List<Long> running = operator.getRunningExecutions("simple");
        assertEquals("Iteration: " + i, singletonList(id), running);
        waitForEnd(operator, id);
    }
}
 
开发者ID:apache,项目名称:incubator-batchee,代码行数:17,代码来源:JobOperatorImplTest.java

示例2: startProcess

import javax.batch.operations.JobOperator; //导入方法依赖的package包/类
@Test
public void startProcess() throws Exception {
	logger.info("starting process test");
	CountDownLatch latch = new CountDownLatch(1);
	JobOperator jobOperator = getJobOperator();
	Properties props = new Properties();
	props.setProperty(INPUT_DATA_FILE_NAME, INPUT_PROPERTIES);
	long executionId = jobOperator.start(JOB_NAME, props);
	latch.await(10, SECONDS);
	List<Long> runningExecutions = jobOperator.getRunningExecutions(JOB_NAME);
	assertEquals("running executions. The process is end", 0, runningExecutions.size());
	Set<String> jobNames = jobOperator.getJobNames();
	assertTrue("one or three jobs", jobNames.size() >= 1 && jobNames.size() <= 3);
	String strJobNames = "";
	for (String jobName : jobNames)
		strJobNames += jobName;
	assertTrue("one only job called", strJobNames.contains(JOB_NAME));
	List<StepExecution> stepExecutions = jobOperator.getStepExecutions(executionId);
	assertEquals("no step executions", 1, stepExecutions.size());
	stepExecutions(stepExecutions.get(0));
	Properties properties = jobOperator.getParameters(executionId);
	assertEquals("one property found", 1, properties.size());
	assertEquals("MY_NEW_PROPERTY found", INPUT_PROPERTIES, properties.get(INPUT_DATA_FILE_NAME));
	JobInstance jobInstance = jobInstance(jobOperator.getJobInstance(executionId), JOB_NAME);
	jobExecutions(jobOperator.getJobExecutions(jobInstance));
	assertNotNull("executionId not empty", executionId);
	assertTrue("Created file from writer 1", new File(PAYROLL_TEMP_FILE + "1.tmp").exists());
	assertTrue("Created file from writer 2", new File(PAYROLL_TEMP_FILE + "2.tmp").exists());
	assertTrue("Created file from writer 3", new File(PAYROLL_TEMP_FILE + "3.tmp").exists());
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:31,代码来源:SimpleJobTestCase.java

示例3: startProcess

import javax.batch.operations.JobOperator; //导入方法依赖的package包/类
@Test
public void startProcess() throws Exception {
	logger.info("starting mail process test");
	CountDownLatch latch = new CountDownLatch(1);
	long executionId = 0;
	JobOperator jobOperator = getJobOperator();

	Properties p = new Properties();
	p.setProperty("source", INPUT_PROPERTIES);
	p.setProperty("destination", "target/output.properties");
	p.setProperty("filesystem", "target");
	executionId = jobOperator.start(JOB_NAME, p);
	latch.await(2, SECONDS);
	List<Long> runningExecutions = jobOperator.getRunningExecutions(JOB_NAME);
	assertEquals("running executions. The process is end", 0, runningExecutions.size());
	Set<String> jobNames = jobOperator.getJobNames();
	assertTrue("one or two job", jobNames.size() >= 1 && jobNames.size() <= 3);
	String strJobNames = "";
	for (String jobName : jobNames)
		strJobNames += jobName;
	assertTrue("one only job called", strJobNames.contains(JOB_NAME));
	List<StepExecution> stepExecutions = jobOperator.getStepExecutions(executionId);
	assertEquals("no step executions", 2, stepExecutions.size());
	stepExecutions(stepExecutions.get(0), false);
	stepExecutions(stepExecutions.get(1), true);
	Properties properties = jobOperator.getParameters(executionId);
	assertEquals("one property found", 3, properties.size());
	assertEquals("MY_NEW_PROPERTY found", INPUT_PROPERTIES, properties.get("source"));
	JobInstance jobInstance = jobInstance(jobOperator.getJobInstance(executionId));
	jobExecutions(jobOperator.getJobExecutions(jobInstance));
	assertNotNull("executionId not empty", executionId);
	assertTrue("the destination file is created", new File(properties.get("destination") + "").exists());
	assertTrue("message received",
			myFactory.getBody().contains("Job Execution id " + executionId + " warned disk space getting low!"));
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:36,代码来源:MailJobTestCase.java


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