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


Java StepExecution.getPersistentUserData方法代码示例

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


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

示例1: checkpointAlgorithm

import javax.batch.runtime.StepExecution; //导入方法依赖的package包/类
@Test
public void checkpointAlgorithm() throws Exception {
	logger.info("starting checkpoint test");
	CountDownLatch latch = new CountDownLatch(1);
	JobOperator jobOperator = getJobOperator();
	Properties props = new Properties();
	long executionId = jobOperator.start(JOB_NAME, props);
	latch.await(10, SECONDS);

	JobInstance jobInstance = jobInstance(jobOperator.getJobInstance(executionId), JOB_NAME);
	JobExecution jobExecution = jobOperator.getJobExecutions(jobInstance).get(0);
	Properties jobProperties = jobExecution.getJobParameters();
	assertEquals("properties are: ", 0, jobProperties.size());
	assertEquals("batch failed because a NoRollbackException is throwed", FAILED, jobExecution.getBatchStatus());
	StepExecution stepExecution = jobOperator.getStepExecutions(executionId).get(0);
	PersistentCheckpointUserData persistentCheckpointUserData = (PersistentCheckpointUserData) stepExecution
			.getPersistentUserData();
	assertNull("persistent user data after step", persistentCheckpointUserData.getStartedAfterStep());
	Metric[] stepMetrics = stepExecution.getMetrics();
	stepMetrics(stepMetrics, 3, 10, 12, 2, 1);
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:22,代码来源:CheckpointJobTestCase.java

示例2: coreExitStatus

import javax.batch.runtime.StepExecution; //导入方法依赖的package包/类
private String coreExitStatus(StepExecution stepExec) {		
	String action = (String)stepExec.getPersistentUserData();
	String currentExitStatus = stepExec.getExitStatus();
	
	// "Normally" we just pass set 'normalExitStatus' as exit status.
	if (currentExitStatus.equals(GOOD_STEP_EXIT_STATUS)) {
		return action;			
	// But if it's the magic number then we return our "SpecialExitStatus".
	} else {
		return specialExitStatus;
	}		
}
 
开发者ID:WASdev,项目名称:standards.jsr352.tck,代码行数:13,代码来源:DeciderTestsDecider.java

示例3: testPartitionPropertyResolverForCollector

import javax.batch.runtime.StepExecution; //导入方法依赖的package包/类
@Test
public void testPartitionPropertyResolverForCollector() throws Exception {
       final JobOperator op = BatchRuntime.getJobOperator();
       Properties jobParams = new Properties();
       jobParams.setProperty(STEP_PROP, STEP_PROP_VAL);
	final long id = op.start("partition-propertyResolver", jobParams);
       Batches.waitForEnd(op, id);

       StepExecution stepExecution = op.getStepExecutions(id).iterator().next();

	assertEquals(op.getJobExecution(id).getBatchStatus(), BatchStatus.COMPLETED);
       assertNotNull(op.getJobExecution(id).getJobParameters());
       assertEquals(jobParams, op.getJobExecution(id).getJobParameters());
       for (final JobExecution exec: op.getJobExecutions(new JobInstanceImpl(id))) {
           assertNotNull(exec.getJobParameters());
           assertEquals(jobParams, exec.getJobParameters());
       }

	ArrayList<String> data = (ArrayList<String>)stepExecution.getPersistentUserData();

	for (String nextStringifiedProps : data) {
		Properties props = PropertyHelper.stringToProperties(nextStringifiedProps);
		String valFromStepProp = props.getProperty(STEP_CONTEXT_PROPERTY);
		String valFromSubstitution = props.getProperty(SUBSTITUTION_PROPERTY);
		assertEquals(valFromStepProp, STEP_PROP_VAL, "Compare values from step-level property with param used in substitution");
		assertEquals(valFromSubstitution, STEP_PROP_VAL, "Compare values from step-level property with a collector-property using this step-level property via a 'jobProperties' substitution.");
	}
}
 
开发者ID:apache,项目名称:incubator-batchee,代码行数:29,代码来源:PartitionPropertySubstitutionTest.java

示例4: testUserDataIsPersistedAfterCheckpoint

import javax.batch.runtime.StepExecution; //导入方法依赖的package包/类
@Test
@org.junit.Test
public void testUserDataIsPersistedAfterCheckpoint() throws Exception {

    String METHOD = "testChunkRestartItemCount10";
    try {
        Reporter.log("Create job parameters for execution #1:<p>");
        Properties jobParams = new Properties();
        Reporter.log("execution.number=1<p>");
        Reporter.log("readrecord.fail=12<p>");
        Reporter.log("app.arraysize=30<p>");
        Reporter.log("app.writepoints=0,5,10,15,20,25,30<p>");
        Reporter.log("app.next.writepoints=0,5,10,15,20,25,30<p>");
        jobParams.put("execution.number", "1");
        jobParams.put("readrecord.fail", "12");
        jobParams.put("app.arraysize", "30");
        jobParams.put("app.checkpoint.position" , "0");
        jobParams.put("app.writepoints", "0,10,20,30");
        jobParams.put("app.next.writepoints", "10,20,30");

        Reporter.log("Locate job XML file: chunkrestartCheckpt10.xml<p>");

        Reporter.log("Invoke startJobAndWaitForResult for execution #1<p>");
        TCKJobExecutionWrapper execution1 = jobOp.startJobAndWaitForResult("chunkrestartCheckpt10", jobParams);
        Reporter.log("execution #1 JobExecution getBatchStatus()=" + execution1.getBatchStatus() + "<p>");
        Reporter.log("execution #1 JobExecution getExitStatus()=" + execution1.getExitStatus() + "<p>");
        assertWithMessage("Testing execution #1", BatchStatus.FAILED, execution1.getBatchStatus());
        assertWithMessage("Testing execution #1", "FAILED", execution1.getExitStatus());
        
        List<StepExecution> stepExecs = jobOp.getStepExecutions(execution1.getExecutionId());
        
        MyPersistentRestartUserData persistedStepData = null;
        for (StepExecution stepExec : stepExecs) {
            if (stepExec.getStepName().equals("step1")) {
                persistedStepData = (MyPersistentRestartUserData) stepExec.getPersistentUserData();
                break;
            }
        }
        
        assertWithMessage("Testing execution #1", 1, persistedStepData.getExecutionNumber());
        

    } catch (Exception e) {
        handleException(METHOD, e);
    }

}
 
开发者ID:WASdev,项目名称:standards.jsr352.tck,代码行数:48,代码来源:ChunkTests.java


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