Package javax.batch.runtime

Examples of javax.batch.runtime.JobExecution


            JobOperator jo = BatchRuntime.getJobOperator();
            out.println("Got the job operator: " + jo + "<br>");
            long jid = jo.start("myJob", new Properties());
            out.println("Job submitted: " + jid + "<br>");
            out.println(jo.getJobInstanceCount("myJob") + " job instance found<br/>");
            JobExecution je = jo.getJobExecution(jid);
//            jo.abandon(jid);
            out.println("Job created on: " + je.getCreateTime() + "<br>");
            out.println("Job started on: " + je.getStartTime() + "<br>");
            out.println("Found: " + jo.getJobNames().size() + " jobs<br>");
            for (String j : jo.getJobNames()) {
                out.println("--> " + j + "<br>");
            }
            out.println("<br><br>Check server.log for output, also look at \"myJob.xml\" for Job XML.");
View Full Code Here


  public void testSkippable() throws Exception {
    JobOperator jobOperator = BatchRuntime.getJobOperator();

    Properties jobParameters = new Properties();
    jobParameters.setProperty("run", "1");
    JobExecution execution1 = runJob("ExceptionHandlingParsingTests-context", jobParameters, 10000l);

    List<StepExecution> stepExecutions = jobOperator.getStepExecutions(execution1.getExecutionId());
    assertEquals(BatchStatus.FAILED, execution1.getBatchStatus());
    assertEquals(1, stepExecutions.size());
    assertEquals(1, getMetric(stepExecutions.get(0), Metric.MetricType.PROCESS_SKIP_COUNT).getValue());

    jobParameters = new Properties();
    jobParameters.setProperty("run", "2");
    JobExecution execution2 = restartJob(execution1.getExecutionId(), jobParameters, 10000l);
    stepExecutions = jobOperator.getStepExecutions(execution2.getExecutionId());
    assertEquals(BatchStatus.FAILED, execution2.getBatchStatus());
    assertEquals(2, stepExecutions.size());

    jobParameters = new Properties();
    jobParameters.setProperty("run", "3");
    JobExecution execution3 = restartJob(execution2.getExecutionId(), jobParameters, 10000l);
    stepExecutions = jobOperator.getStepExecutions(execution3.getExecutionId());
    assertEquals(BatchStatus.COMPLETED, execution3.getBatchStatus());
    assertEquals(2, stepExecutions.size());

    assertEquals(0, getMetric(stepExecutions.get(1), Metric.MetricType.ROLLBACK_COUNT).getValue());

    jobParameters = new Properties();
    jobParameters.setProperty("run", "4");
    JobExecution execution4 = runJob("ExceptionHandlingParsingTests-context", jobParameters, 10000l);
    stepExecutions = jobOperator.getStepExecutions(execution4.getExecutionId());
    assertEquals(BatchStatus.COMPLETED, execution4.getBatchStatus());
    assertEquals(3, stepExecutions.size());
  }
View Full Code Here

    Properties jobParameters = new Properties();
    jobParameters.setProperty("allow.start.if.complete", "true");
    jobParameters.setProperty("deciderName", "stepDecider");
    jobParameters.setProperty("deciderNumber", "1");

    JobExecution jobExecution = runJob("jsrJobPropertyTestsContext", jobParameters, 5000L);
    assertEquals(BatchStatus.COMPLETED, jobExecution.getBatchStatus());
  }
View Full Code Here

    assertEquals(10, MyBatchlet.threadNames.size());
  }

  @Test
  public void testChunkNoProperties() throws Exception {
    JobExecution execution = runJob("partitionParserTestsChunk", new Properties(), TIMEOUT);

    assertEquals(BatchStatus.COMPLETED, execution.getBatchStatus());
    assertEquals(30, ItemReader.processedItems.size());
    assertEquals(10, ItemReader.threadNames.size());
    assertEquals(30, ItemWriter.processedItems.size());
    assertEquals(10, ItemWriter.threadNames.size());
  }
View Full Code Here

    assertEquals(10, ItemWriter.threadNames.size());
  }

  @Test
  public void testFullPartitionConfiguration() throws Exception {
    JobExecution execution = runJob("fullPartitionParserTests", new Properties(), TIMEOUT);

    assertEquals(BatchStatus.COMPLETED, execution.getBatchStatus());
    assertTrue(execution.getExitStatus().startsWith("BPS_"));
    assertTrue(execution.getExitStatus().endsWith("BPSC_APSC"));
    assertEquals(3, countMatches(execution.getExitStatus(), caPattern));
    assertEquals(3, countMatches(execution.getExitStatus(), asPattern));
    assertEquals(3, MyBatchlet.processed);
    assertEquals(3, MyBatchlet.threadNames.size());
  }
View Full Code Here

    assertEquals(3, MyBatchlet.threadNames.size());
  }

  @Test
  public void testFullPartitionConfigurationWithProperties() throws Exception {
    JobExecution execution = runJob("fullPartitionParserWithPropertiesTests", new Properties(), TIMEOUT);

    assertEquals(BatchStatus.COMPLETED, execution.getBatchStatus());
    assertTrue(execution.getExitStatus().startsWith("BPS_"));
    assertTrue(execution.getExitStatus().endsWith("BPSC_APSC"));
    assertEquals(3, countMatches(execution.getExitStatus(), caPattern));
    assertEquals(3, countMatches(execution.getExitStatus(), asPattern));
    assertEquals(3, MyBatchlet.processed);
    assertEquals(3, MyBatchlet.threadNames.size());
    assertEquals(MyBatchlet.artifactNames.iterator().next(), "batchlet");
    assertEquals(PartitionMapper.name, "mapper");
    assertEquals(PartitionAnalyzer.name, "analyzer");
View Full Code Here

    assertTrue(PartitionCollector.artifactNames.contains("collector"));
  }

  @Test
  public void testFullPartitionConfigurationWithMapperSuppliedProperties() throws Exception {
    JobExecution execution = runJob("fullPartitionParserWithMapperPropertiesTests", new Properties(), TIMEOUT);

    assertEquals(BatchStatus.COMPLETED, execution.getBatchStatus());
    assertTrue(execution.getExitStatus().startsWith("BPS_"));
    assertTrue(execution.getExitStatus().endsWith("BPSC_APSC"));
    assertEquals(3, countMatches(execution.getExitStatus(), caPattern));
    assertEquals(3, countMatches(execution.getExitStatus(), asPattern));
    assertEquals(3, MyBatchlet.processed);
    assertEquals(3, MyBatchlet.threadNames.size());

    assertEquals(MyBatchlet.artifactNames.size(), 3);
    assertTrue(MyBatchlet.artifactNames.contains("batchlet0"));
View Full Code Here

    this.jobExplorer = jobExplorer;
  }

  @Test
  public void testDecisionAsFirstStepOfJob() throws Exception {
    JobExecution execution = runJob("DecisionStepTests-decisionAsFirstStep-context", new Properties(), 10000L);
    assertEquals(BatchStatus.FAILED, execution.getBatchStatus());
    assertEquals(0, BatchRuntime.getJobOperator().getStepExecutions(execution.getExecutionId()).size());
  }
View Full Code Here

    assertEquals(0, BatchRuntime.getJobOperator().getStepExecutions(execution.getExecutionId()).size());
  }

  @Test
  public void testDecisionThrowsException() throws Exception {
    JobExecution execution = runJob("DecisionStepTests-decisionThrowsException-context", new Properties(), 10000L);
    assertEquals(BatchStatus.FAILED, execution.getBatchStatus());
    assertEquals(2, BatchRuntime.getJobOperator().getStepExecutions(execution.getExecutionId()).size());
  }
View Full Code Here

    assertEquals(2, BatchRuntime.getJobOperator().getStepExecutions(execution.getExecutionId()).size());
  }

  @Test
  public void testDecisionValidExitStatus() throws Exception {
    JobExecution execution = runJob("DecisionStepTests-decisionValidExitStatus-context", new Properties(), 10000L);
    assertEquals(BatchStatus.COMPLETED, execution.getBatchStatus());
    assertEquals(3, BatchRuntime.getJobOperator().getStepExecutions(execution.getExecutionId()).size());
  }
View Full Code Here

TOP

Related Classes of javax.batch.runtime.JobExecution

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.