Tabnine Logo
FlowExecution
Code IndexAdd Tabnine to your IDE (free)

How to use
FlowExecution
in
org.springframework.batch.core.job.flow

Best Java code snippets using org.springframework.batch.core.job.flow.FlowExecution (Showing top 20 results out of 315)

origin: spring-projects/spring-batch

@Test
public void testBasicProperties() throws Exception {
  FlowExecution execution = new FlowExecution("foo", new FlowExecutionStatus("BAR"));
  assertEquals("foo",execution.getName());
  assertEquals("BAR",execution.getStatus().getName());
}
origin: spring-projects/spring-batch

@Test
public void testEnumOrdering() throws Exception {
  FlowExecution first = new FlowExecution("foo", FlowExecutionStatus.COMPLETED);
  FlowExecution second = new FlowExecution("foo", FlowExecutionStatus.FAILED);
  assertTrue("Should be negative",first.compareTo(second)<0);
  assertTrue("Should be positive",second.compareTo(first)>0);
}
origin: spring-projects/spring-batch

@Test
public void testOneStep() throws Exception {
  flow.setStateTransitions(Collections.singletonList(StateTransition.createEndStateTransition(new StubState(
      "step1"))));
  flow.afterPropertiesSet();
  FlowExecution execution = flow.start(executor);
  assertEquals(FlowExecutionStatus.COMPLETED, execution.getStatus());
  assertEquals("step1", execution.getName());
}
origin: spring-projects/spring-batch

/**
 * Aggregate all of the {@link FlowExecutionStatus}es of the
 * {@link FlowExecution}s into one status. The aggregate status will be the
 * status with the highest precedence.
 *
 * @see FlowExecutionAggregator#aggregate(Collection)
 */
@Override
public FlowExecutionStatus aggregate(Collection<FlowExecution> executions) {
  if (executions == null || executions.size() == 0) {
    return FlowExecutionStatus.UNKNOWN;
  }
  return Collections.max(executions).getStatus();
}
origin: spring-projects/spring-batch

    executor.close(new FlowExecution(stateName, status));
    throw e;
    executor.close(new FlowExecution(stateName, status));
    throw new FlowExecutionException(String.format("Ended flow=%s at state=%s with exception", name,
                               stateName), e);
FlowExecution result = new FlowExecution(stateName, status);
executor.close(result);
return result;
origin: spring-projects/spring-batch

@Override
public FlowExecutionStatus handle(FlowExecutor executor) throws Exception {
  return flow.start(executor).getStatus();
}
origin: spring-projects/spring-batch

@Test
public void testOneStepWithListenerCallsClose() throws Exception {
  flow.setStateTransitions(Collections.singletonList(StateTransition.createEndStateTransition(new StubState(
      "step1"))));
  flow.afterPropertiesSet();
  final List<FlowExecution> list = new ArrayList<>();
  executor = new JobFlowExecutorSupport() {
    @Override
    public void close(FlowExecution result) {
      list.add(result);
    }
  };
  FlowExecution execution = flow.start(executor);
  assertEquals(1, list.size());
  assertEquals(FlowExecutionStatus.COMPLETED, execution.getStatus());
  assertEquals("step1", execution.getName());
}
origin: spring-projects/spring-batch

@Test
public void testBasicHandling() throws Exception {
  Collection<Flow> flows  = new ArrayList<>();
  Flow flow1 = mock(Flow.class);
  Flow flow2 = mock(Flow.class);
  flows.add(flow1);
  flows.add(flow2);
  SplitState state = new SplitState(flows, "foo");
  when(flow1.start(executor)).thenReturn(new FlowExecution("step1", FlowExecutionStatus.COMPLETED));
  when(flow2.start(executor)).thenReturn(new FlowExecution("step1", FlowExecutionStatus.COMPLETED));
  FlowExecutionStatus result = state.handle(executor);
  assertEquals(FlowExecutionStatus.COMPLETED, result);
}
origin: spring-projects/spring-batch

/**
 * Create an ordering on {@link FlowExecution} instances by comparing their
 * statuses.
 *
 * @see Comparable#compareTo(Object)
 *
 * @param other the {@link FlowExecution} instance to compare with this instance.
 * @return negative, zero or positive as per the contract
 */
@Override
public int compareTo(FlowExecution other) {
  return this.status.compareTo(other.getStatus());
}
origin: spring-projects/spring-batch

@Test
public void testUnconnectedSteps() throws Exception {
  flow.setStateTransitions(collect(StateTransition.createEndStateTransition(new StubState("step1")),
      StateTransition.createEndStateTransition(new StubState("step2"))));
  flow.afterPropertiesSet();
  FlowExecution execution = flow.start(executor);
  assertEquals(FlowExecutionStatus.COMPLETED, execution.getStatus());
  assertEquals("step1", execution.getName());
}
origin: spring-projects/spring-batch

@Test
public void testFailed() throws Exception {
  FlowExecution first = new FlowExecution("foo", FlowExecutionStatus.COMPLETED);
  FlowExecution second = new FlowExecution("foo", FlowExecutionStatus.FAILED);
  assertTrue("Should be negative", first.compareTo(second)<0);
  assertTrue("Should be positive", second.compareTo(first)>0);
  assertEquals(FlowExecutionStatus.FAILED, aggregator.aggregate(Arrays.asList(first, second)));
}
origin: spring-projects/spring-batch

@Test
public void testConcurrentHandling() throws Exception {
  Flow flow1 = mock(Flow.class);
  Flow flow2 = mock(Flow.class);
  SplitState state = new SplitState(Arrays.asList(flow1, flow2), "foo");
  state.setTaskExecutor(new SimpleAsyncTaskExecutor());
  when(flow1.start(executor)).thenReturn(new FlowExecution("step1", FlowExecutionStatus.COMPLETED));
  when(flow2.start(executor)).thenReturn(new FlowExecution("step1", FlowExecutionStatus.COMPLETED));
  FlowExecutionStatus result = state.handle(executor);
  assertEquals(FlowExecutionStatus.COMPLETED, result);
}
origin: spring-projects/spring-batch

/**
 * @see AbstractJob#doExecute(JobExecution)
 */
@Override
protected void doExecute(final JobExecution execution) throws JobExecutionException {
  try {
    JobFlowExecutor executor = new JobFlowExecutor(getJobRepository(),
        new SimpleStepHandler(getJobRepository()), execution);
    executor.updateJobExecutionStatus(flow.start(executor).getStatus());
  }
  catch (FlowExecutionException e) {
    if (e.getCause() instanceof JobExecutionException) {
      throw (JobExecutionException) e.getCause();
    }
    throw new JobExecutionException("Flow execution ended unexpectedly", e);
  }
}
origin: spring-projects/spring-batch

@Test
public void testResume() throws Exception {
  flow.setStateTransitions(collect(StateTransition.createStateTransition(new StubState("step1"), "step2"),
      StateTransition.createEndStateTransition(new StubState("step2"))));
  flow.afterPropertiesSet();
  FlowExecution execution = flow.resume("step2", executor);
  assertEquals(FlowExecutionStatus.COMPLETED, execution.getStatus());
  assertEquals("step2", execution.getName());
}
origin: spring-projects/spring-batch

@Test
public void testEnumStartsWithOrdering() throws Exception {
  FlowExecution first = new FlowExecution("foo", new FlowExecutionStatus("COMPLETED.BAR"));
  FlowExecution second = new FlowExecution("foo", new FlowExecutionStatus("FAILED.FOO"));
  assertTrue("Should be negative",first.compareTo(second)<0);
  assertTrue("Should be positive",second.compareTo(first)>0);
}
origin: org.springframework.batch/org.springframework.batch.core

    executor.close(new FlowExecution(stateName, status));
    throw e;
    executor.close(new FlowExecution(stateName, status));
    throw new FlowExecutionException(String.format("Ended flow=%s at state=%s with exception", name,
        stateName), e);
FlowExecution result = new FlowExecution(stateName, status);
executor.close(result);
return result;
origin: spring-projects/spring-batch

/**
 * Delegate to the flow provided for the execution of the step.
 * 
 * @see AbstractStep#doExecute(StepExecution)
 */
@Override
protected void doExecute(StepExecution stepExecution) throws Exception {
  try {
    stepExecution.getExecutionContext().put(STEP_TYPE_KEY, this.getClass().getName());
    StepHandler stepHandler = new SimpleStepHandler(getJobRepository(), stepExecution.getExecutionContext());
    FlowExecutor executor = new JobFlowExecutor(getJobRepository(), stepHandler, stepExecution.getJobExecution());
    executor.updateJobExecutionStatus(flow.start(executor).getStatus());
    stepExecution.upgradeStatus(executor.getJobExecution().getStatus());
    stepExecution.setExitStatus(executor.getJobExecution().getExitStatus());
  }
  catch (FlowExecutionException e) {
    if (e.getCause() instanceof JobExecutionException) {
      throw (JobExecutionException) e.getCause();
    }
    throw new JobExecutionException("Flow execution ended unexpectedly", e);
  }
}
origin: spring-projects/spring-batch

@Test
public void testTwoSteps() throws Exception {
  flow.setStateTransitions(collect(StateTransition.createStateTransition(new StubState("step1"), "step2"),
      StateTransition.createEndStateTransition(new StubState("step2"))));
  flow.afterPropertiesSet();
  FlowExecution execution = flow.start(executor);
  assertEquals(FlowExecutionStatus.COMPLETED, execution.getStatus());
  assertEquals("step2", execution.getName());
}
origin: spring-projects/spring-batch

@Test
public void testEnumAndAlpha() throws Exception {
  FlowExecution first = new FlowExecution("foo", new FlowExecutionStatus("ZZZZZ"));
  FlowExecution second = new FlowExecution("foo", new FlowExecutionStatus("FAILED.FOO"));
  assertTrue("Should be negative",first.compareTo(second)<0);
  assertTrue("Should be positive",second.compareTo(first)>0);
}
origin: org.springframework.batch/spring-batch-core

    executor.close(new FlowExecution(stateName, status));
    throw e;
    executor.close(new FlowExecution(stateName, status));
    throw new FlowExecutionException(String.format("Ended flow=%s at state=%s with exception", name,
                               stateName), e);
FlowExecution result = new FlowExecution(stateName, status);
executor.close(result);
return result;
org.springframework.batch.core.job.flowFlowExecution

Most used methods

  • <init>
  • getStatus
  • compareTo
    Create an ordering on FlowExecution instances by comparing their statuses.
  • getName

Popular in Java

  • Reading from database using SQL prepared statement
  • notifyDataSetChanged (ArrayAdapter)
  • getApplicationContext (Context)
  • compareTo (BigDecimal)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now