org.camunda.bpm.engine.test.Deployment Java Examples

The following examples show how to use org.camunda.bpm.engine.test.Deployment. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EventSubprocessInterruptingTimerTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {"org/camunda/bpm/scenario/test/timers/EventSubprocessInterruptingTimerTest.bpmn"})
public void testTakeABitTimeForTask() {

  when(scenario.waitsAtUserTask("UserTask")).thenReturn(new UserTaskAction() {
    @Override
    public void execute(final TaskDelegate task) {
      task.defer("PT4M", new Deferred() {
        @Override
        public void execute() {
          task.complete();
        }
      });
    }
  });

  Scenario.run(scenario).startByKey("EventSubprocessInterruptingTimerTest").execute();

  verify(scenario, times(1)).waitsAtUserTask("UserTask");
  verify(scenario, times(1)).hasStarted("UserTask");
  verify(scenario, times(1)).hasFinished("UserTask");
  verify(scenario, times(1)).hasFinished("EndEventCompleted");
  verify(scenario, never()).hasFinished("EndEventCanceled");

}
 
Example #2
Source File: ConditionaBoundaryEventTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {"org/camunda/bpm/scenario/test/boundary/ConditionalBoundaryEventTest.bpmn"})
public void testConditionInitiallyFalseAndCompleteTask() {

  when(scenario.waitsAtUserTask("UserTask")).thenReturn(new UserTaskAction() {
    @Override
    public void execute(TaskDelegate task) {
      task.complete();
    }
  });

  Scenario.run(scenario).startByKey("ConditionalBoundaryEventTest", variables).execute();

  verify(scenario, times(1)).hasStarted("UserTask");
  verify(scenario, times(1)).hasFinished("UserTask");
  verify(scenario, never()).hasFinished("ConditionalBoundaryEvent");
  verify(scenario, times(1)).hasFinished("EndEventAfterUserTask");
  verify(scenario, never()).hasFinished("EndEventAfterBoundaryEvent");

}
 
Example #3
Source File: ConditionaBoundaryEventTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {"org/camunda/bpm/scenario/test/boundary/ConditionalBoundaryEventTest.bpmn"})
public void testConditionInitiallyFalseAndSetTrue() {

  when(scenario.waitsAtUserTask("UserTask")).thenReturn(new UserTaskAction() {
    @Override
    public void execute(TaskDelegate task) {
      rule.getRuntimeService().setVariable(task.getProcessInstance().getId(), "condition", true);
    }
  });

  Scenario.run(scenario)
      .startByKey("ConditionalBoundaryEventTest", variables)
      .execute();

  verify(scenario, times(1)).hasStarted("UserTask");
  verify(scenario, times(1)).hasFinished("UserTask");
  verify(scenario, times(1)).hasFinished("ConditionalBoundaryEvent");
  verify(scenario, never()).hasFinished("EndEventAfterUserTask");
  verify(scenario, times(1)).hasFinished("EndEventAfterBoundaryEvent");

}
 
Example #4
Source File: CallActivityTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {
  "org/camunda/bpm/scenario/test/waitstates/CallActivityTest.bpmn",
  "org/camunda/bpm/scenario/test/waitstates/UserTaskTest.bpmn"
})
public void testCompleteCallActivityUserTask() {

  when(scenario.runsCallActivity("CallActivity")).thenReturn(Scenario.use(calledScenario));
  when(calledScenario.waitsAtUserTask("UserTask")).thenReturn(new UserTaskAction() {
    @Override
    public void execute(TaskDelegate task) {
      task.complete();
    }
  });

  Scenario.run(scenario).startByKey("CallActivityTest").execute();

  verify(calledScenario, times(1)).hasFinished("UserTask");

  verify(scenario, times(1)).hasFinished("EndEvent");
  verify(scenario, times(1)).hasFinished("CallActivity");

}
 
Example #5
Source File: EventBasedGatewayWithoutTimerTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {"org/camunda/bpm/scenario/test/waitstates/EventBasedGatewayWithoutTimerTest.bpmn"})
public void testReceiveMessage() {

  when(scenario.waitsAtEventBasedGateway("EventBasedGateway")).thenReturn(new EventBasedGatewayAction() {
    @Override
    public void execute(EventBasedGatewayDelegate gateway) {
      gateway.getEventSubscription("MessageIntermediateCatchEvent").receive();
    }
  });

  Scenario.run(scenario).startByKey("EventBasedGatewayWithoutTimerTest").execute();

  verify(scenario, times(1)).hasFinished("EventBasedGateway");
  verify(scenario, times(1)).hasFinished("MessageIntermediateCatchEvent");
  verify(scenario, times(1)).hasFinished("EndEvent");

}
 
Example #6
Source File: EventBasedGatewayWithoutTimerTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {"org/camunda/bpm/scenario/test/waitstates/EventBasedGatewayWithoutTimerTest.bpmn"})
public void testDoNothing() {

  when(scenario.waitsAtEventBasedGateway("EventBasedGateway")).thenReturn(new EventBasedGatewayAction() {
    @Override
    public void execute(EventBasedGatewayDelegate gateway) {
      // Do nothing means process remains here because of no timers
    }
  });

  Scenario.run(scenario).startByKey("EventBasedGatewayWithoutTimerTest").execute();

  verify(scenario, times(1)).hasStarted("EventBasedGateway");
  verify(scenario, never()).hasFinished("EventBasedGateway");
  verify(scenario, never()).hasFinished("EndEvent");

}
 
Example #7
Source File: EventBasedGatewayTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {"org/camunda/bpm/scenario/test/waitstates/EventBasedGatewayTest.bpmn"})
public void testReceiveMessage() {

  when(scenario.waitsAtEventBasedGateway("EventBasedGateway")).thenReturn(new EventBasedGatewayAction() {
    @Override
    public void execute(EventBasedGatewayDelegate gateway) {
      gateway.getEventSubscription("MessageIntermediateCatchEvent").receive();
    }
  });

  Scenario.run(scenario).startByKey("EventBasedGatewayTest").execute();

  verify(scenario, times(1)).hasFinished("EventBasedGateway");
  verify(scenario, times(1)).hasFinished("MessageIntermediateCatchEvent");
  verify(scenario, times(1)).hasFinished("EndEvent");

}
 
Example #8
Source File: EventBasedGatewayTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {"org/camunda/bpm/scenario/test/waitstates/EventBasedGatewayTest.bpmn"})
public void testDoNothing() {

  when(scenario.waitsAtEventBasedGateway("EventBasedGateway")).thenReturn(new EventBasedGatewayAction() {
    @Override
    public void execute(EventBasedGatewayDelegate gateway) {
      // Do nothing means process moves forward because of the timers
    }
  });

  Scenario.run(scenario).startByKey("EventBasedGatewayTest").execute();

  verify(scenario, times(1)).hasFinished("TimerIntermediateEvent");
  verify(scenario, times(1)).hasFinished("EndEvent");

}
 
Example #9
Source File: CallActivityChildNonBlockingTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {
  "org/camunda/bpm/scenario/test/callactivities/CallActivityTest.bpmn",
  "org/camunda/bpm/scenario/test/callactivities/CallActivityChildNonBlockingTest.bpmn"
})
public void testWhileOtherProcessInstanceIsRunning() {

  when(scenario.runsCallActivity("CallActivity"))
      .thenReturn(Scenario.use(childScenario));
  when(otherScenario.runsCallActivity("CallActivity"))
      .thenReturn(Scenario.use(otherChildScenario));

  Scenario
    .run(scenario).startByKey("CallActivityTest")
    .run(otherScenario).startByKey("CallActivityTest")
    .execute();

  verify(scenario, times(1)).hasFinished("CallActivity");
  verify(scenario, times(1)).hasFinished("EndEvent");
  verify(otherScenario, times(1)).hasStarted("CallActivity");
  verify(otherScenario, times(1)).hasFinished("CallActivity");
  verify(otherScenario, times(1)).hasFinished("EndEvent");

}
 
Example #10
Source File: ReceiveTaskWithMessageSubscriptionTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {"org/camunda/bpm/scenario/test/waitstates/ReceiveTaskTest.bpmn"})
public void testReceiveMessage() {

  when(scenario.waitsAtReceiveTask("ReceiveTask")).thenReturn(new ReceiveTaskAction() {
    @Override
    public void execute(EventSubscriptionDelegate messageEventSubscription) {
      messageEventSubscription.receive();
    }
  });

  Scenario.run(scenario).startByKey("ReceiveTaskTest").execute();

  verify(scenario, times(1)).hasFinished("ReceiveTask");
  verify(scenario, times(1)).hasFinished("EndEvent");

}
 
Example #11
Source File: ReceiveTaskWithMessageSubscriptionTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {"org/camunda/bpm/scenario/test/waitstates/ReceiveTaskTest.bpmn"})
public void testDoNothing() {

  when(scenario.waitsAtReceiveTask("ReceiveTask")).thenReturn(new ReceiveTaskAction() {
    @Override
    public void execute(EventSubscriptionDelegate messageEventSubscription) {
      // Deal with messageEventSubscription but do nothing here
    }
  });

  Scenario.run(scenario).startByKey("ReceiveTaskTest").execute();

  verify(scenario, times(1)).hasStarted("ReceiveTask");
  verify(scenario, never()).hasFinished("ReceiveTask");
  verify(scenario, never()).hasFinished("EndEvent");

}
 
Example #12
Source File: StartByTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {"org/camunda/bpm/scenario/test/processes/StartByTest.bpmn"})
public void testStartByMessage2() {

  when(scenario.waitsAtReceiveTask("ReceiveTask")).thenReturn(new ReceiveTaskAction() {
    @Override
    public void execute(EventSubscriptionDelegate message) throws Exception {
      message.receive();
    }
  });

  Scenario.run(scenario).startByMessage("msg_StartEvent2").execute();

  verify(scenario, times(1)).hasFinished("StartEvent2");
  verify(scenario, times(1)).hasFinished("EndEvent");

}
 
Example #13
Source File: EventSubprocessInterruptingTimerTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {"org/camunda/bpm/scenario/test/timers/EventSubprocessInterruptingTimerTest.bpmn"})
public void testCompleteTask() {

  when(scenario.waitsAtUserTask("UserTask")).thenReturn(new UserTaskAction() {
    @Override
    public void execute(TaskDelegate task) {
      task.complete();
    }
  });

  Scenario.run(scenario).startByKey("EventSubprocessInterruptingTimerTest").execute();

  verify(scenario, times(1)).waitsAtUserTask("UserTask");
  verify(scenario, times(1)).hasStarted("UserTask");
  verify(scenario, times(1)).hasFinished("UserTask");
  verify(scenario, times(1)).hasFinished("EndEventCompleted");
  verify(scenario, never()).hasFinished("EndEventCanceled");

}
 
Example #14
Source File: EventSubprocessInterruptingTimerTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {"org/camunda/bpm/scenario/test/timers/EventSubprocessInterruptingTimerTest.bpmn"})
public void testExactlyReachingMaximalTimeForTask() {

  when(scenario.waitsAtUserTask("UserTask")).thenReturn(new UserTaskAction() {
    @Override
    public void execute(TaskDelegate task) {
      task.defer("PT5M", new Deferred() {
        @Override
        public void execute() {
          // do nothing
        }
      });
    }
  });

  Scenario.run(scenario).startByKey("EventSubprocessInterruptingTimerTest").execute();

  verify(scenario, times(1)).waitsAtUserTask("UserTask");
  verify(scenario, times(1)).hasStarted("UserTask");
  verify(scenario, times(1)).hasFinished("UserTask");
  verify(scenario, never()).hasFinished("EndEventCompleted");
  verify(scenario, times(1)).hasFinished("EndEventCanceled");

}
 
Example #15
Source File: StartByTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {"org/camunda/bpm/scenario/test/processes/StartByTest.bpmn"})
public void testStartByKey() {

  when(scenario.waitsAtReceiveTask("ReceiveTask")).thenReturn(new ReceiveTaskAction() {
    @Override
    public void execute(EventSubscriptionDelegate message) throws Exception {
      message.receive();
    }
  });

  Scenario.run(scenario).startByKey("StartByTest").execute();

  verify(scenario, times(1)).hasFinished("StartEvent");
  verify(scenario, times(1)).hasFinished("EndEvent");

}
 
Example #16
Source File: ProcessLocalTest.java    From camunda-bpm-identity-keycloak with Apache License 2.0 6 votes vote down vote up
/**
 * Test the happy (approved) path.
 */
@Test
@Deployment(resources = PROCESS_RESOURCE)
public void testApprovedPath() throws Exception {
	// start process
	ProcessInstance pi = runtimeService().startProcessInstanceByKey(PROCESS_DEFINITION_KEY,
			withVariables(Variable.NAME, "Demo"));
	assertThat(pi).isStarted();

	// check user task and approve user
	assertThat(pi).isWaitingAt("ApproveUser");
	Task task = task();
	assertNotNull("User task expected", task);
	complete(task, withVariables("approved", Boolean.TRUE));

	// check service task (asynchronous continuation)
	execute(job());
	assertThat(pi).hasPassed("ServiceTask_Logger");

	// check corresponding process end
	assertThat(pi).hasPassed("END_APPROVED");
	assertThat(pi).isEnded();

	// verify mocks
	verify(loggerTask, times(1)).execute(any(DelegateExecution.class));
}
 
Example #17
Source File: CallActivityChildNonBlockingTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {
  "org/camunda/bpm/scenario/test/callactivities/CallActivityTest.bpmn",
  "org/camunda/bpm/scenario/test/callactivities/CallActivityChildNonBlockingTest.bpmn"
})
public void testDoNothing() {

  when(scenario.runsCallActivity("CallActivity")).thenReturn(Scenario.use(childScenario));

  Scenario.run(scenario).startByKey("CallActivityTest").execute();

  verify(scenario, times(1)).hasStarted("CallActivity");
  verify(scenario, times(1)).hasFinished("CallActivity");
  verify(scenario, times(1)).hasFinished("EndEvent");

}
 
Example #18
Source File: EventSubprocessNonInterruptingTimerTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {"org/camunda/bpm/scenario/test/timers/EventSubprocessNonInterruptingTimerTest.bpmn"})
public void testCompleteTask() {

  when(scenario.waitsAtUserTask("UserTask")).thenReturn(new UserTaskAction() {
    @Override
    public void execute(TaskDelegate task) {
      task.complete();
    }
  });

  Scenario.run(scenario).startByKey("EventSubprocessNonInterruptingTimerTest").execute();

  verify(scenario, times(1)).waitsAtUserTask("UserTask");
  verify(scenario, times(1)).hasStarted("UserTask");
  verify(scenario, times(1)).hasFinished("UserTask");
  verify(scenario, times(1)).hasFinished("EndEventCompleted");
  verify(scenario, never()).hasFinished("EndEventAdditional");

}
 
Example #19
Source File: MultiInstanceLoopTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {"org/camunda/bpm/scenario/test/loops/MultiInstanceLoopTest.bpmn"})
public void testDoLoopASingleTime() {

  when(scenario.waitsAtUserTask("UserTask")).thenReturn(new UserTaskAction() {
    @Override
    public void execute(TaskDelegate task) {
      task.complete();
    }
  });

  variables.put("cardinality", 2);

  Scenario.run(scenario).startByKey("MultiInstanceLoopTest",variables).execute();

  verify(scenario, times(2)).hasFinished("UserTask");
  verify(scenario, times(1)).hasFinished("EndEvent");

}
 
Example #20
Source File: EventSubprocessNonInterruptingTimerTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {"org/camunda/bpm/scenario/test/timers/EventSubprocessNonInterruptingTimerTest.bpmn"})
public void testTakeABitTimeForTask() {

  when(scenario.waitsAtUserTask("UserTask")).thenReturn(new UserTaskAction() {
    @Override
    public void execute(final TaskDelegate task) {
      task.defer("PT4M", new Deferred() {
        @Override
        public void execute() {
          task.complete();
        }
      });
    }
  });

  Scenario.run(scenario).startByKey("EventSubprocessNonInterruptingTimerTest").execute();

  verify(scenario, times(1)).waitsAtUserTask("UserTask");
  verify(scenario, times(1)).hasStarted("UserTask");
  verify(scenario, times(1)).hasFinished("UserTask");
  verify(scenario, times(1)).hasFinished("EndEventCompleted");
  verify(scenario, never()).hasFinished("EndEventAdditional");

}
 
Example #21
Source File: EventSubprocessNonInterruptingTimerTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {"org/camunda/bpm/scenario/test/timers/EventSubprocessNonInterruptingTimerTest.bpmn"})
public void testDoNothing() {

  when(scenario.waitsAtUserTask("UserTask")).thenReturn(new UserTaskAction() {
    @Override
    public void execute(TaskDelegate task) {
      // Deal with task but do nothing here
    }
  });

  Scenario.run(scenario).startByKey("EventSubprocessNonInterruptingTimerTest").execute();

  verify(scenario, times(1)).waitsAtUserTask("UserTask");
  verify(scenario, times(1)).hasStarted("UserTask");
  verify(scenario, never()).hasFinished("UserTask");
  verify(scenario, never()).hasFinished("EndEventCompleted");
  verify(scenario, times(1)).hasFinished("EndEventAdditional");

}
 
Example #22
Source File: BoundaryInterruptingTimerTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {"org/camunda/bpm/scenario/test/timers/BoundaryInterruptingTimerTest.bpmn"})
public void testExactlyReachingMaximalTimeForTask() {

  when(scenario.waitsAtUserTask("UserTask")).thenReturn(new UserTaskAction() {
    @Override
    public void execute(final TaskDelegate task) {
      task.defer("PT5M", new Deferred() {
        @Override
        public void execute() {
          // do nothing
        }
      });
    }
  });

  Scenario.run(scenario).startByKey("BoundaryInterruptingTimerTest").execute();

  verify(scenario, times(1)).waitsAtUserTask("UserTask");
  verify(scenario, times(1)).hasStarted("UserTask");
  verify(scenario, times(1)).hasFinished("UserTask");
  verify(scenario, never()).hasFinished("EndEventCompleted");
  verify(scenario, times(1)).hasFinished("EndEventCanceled");

}
 
Example #23
Source File: BoundaryNonInterruptingTimerTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {"org/camunda/bpm/scenario/test/timers/BoundaryNonInterruptingTimerTest.bpmn"})
public void testCompleteTask() {

  when(scenario.waitsAtUserTask("UserTask")).thenReturn(new UserTaskAction() {
    @Override
    public void execute(TaskDelegate task) {
      task.complete();
    }
  });

  Scenario.run(scenario).startByKey("BoundaryNonInterruptingTimerTest").execute();

  verify(scenario, times(1)).waitsAtUserTask("UserTask");
  verify(scenario, times(1)).hasStarted("UserTask");
  verify(scenario, times(1)).hasFinished("UserTask");
  verify(scenario, times(1)).hasFinished("EndEventCompleted");
  verify(scenario, never()).hasFinished("EndEventAdditional");

}
 
Example #24
Source File: CallActivityChildBlockingTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {
  "org/camunda/bpm/scenario/test/callactivities/CallActivityTest.bpmn",
  "org/camunda/bpm/scenario/test/callactivities/CallActivityChildBlockingTest.bpmn"
})
public void testDoNothing() {

  when(scenario.runsCallActivity("CallActivity")).thenReturn(Scenario.use(childScenario));

  when(childScenario.waitsAtUserTask("UserTask")).thenReturn(new UserTaskAction() {
    @Override
    public void execute(TaskDelegate task) {
      // Deal with task but do nothing here
    }
  });

  Scenario.run(scenario).startByKey("CallActivityTest").execute();

  verify(scenario, times(1)).hasStarted("CallActivity");
  verify(scenario, never()).hasFinished("CallActivity");
  verify(scenario, never()).hasFinished("EndEvent");

}
 
Example #25
Source File: BoundaryNonInterruptingTimerTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {"org/camunda/bpm/scenario/test/timers/BoundaryNonInterruptingTimerTest.bpmn"})
public void testTakeMuchTooLongForTask() {

  when(scenario.waitsAtUserTask("UserTask")).thenReturn(new UserTaskAction() {
    @Override
    public void execute(final TaskDelegate task) {
      task.defer("PT6M", new Deferred() {
        @Override
        public void execute() {
          task.complete();
        }
      });
    }
  });

  Scenario.run(scenario).startByKey("BoundaryNonInterruptingTimerTest").execute();

  verify(scenario, times(1)).waitsAtUserTask("UserTask");
  verify(scenario, times(1)).hasStarted("UserTask");
  verify(scenario, times(1)).hasFinished("UserTask");
  verify(scenario, times(1)).hasFinished("EndEventCompleted");
  verify(scenario, times(1)).hasFinished("EndEventAdditional");

}
 
Example #26
Source File: BoundaryNonInterruptingTimerTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {"org/camunda/bpm/scenario/test/timers/BoundaryNonInterruptingTimerTest.bpmn"})
public void testTakeABitTimeForTask() {

  when(scenario.waitsAtUserTask("UserTask")).thenReturn(new UserTaskAction() {
    @Override
    public void execute(final TaskDelegate task) {
      task.defer("PT4M", new Deferred() {
        @Override
        public void execute() {
          task.complete();
        }
      });
    }
  });

  Scenario.run(scenario).startByKey("BoundaryNonInterruptingTimerTest").execute();

  verify(scenario, times(1)).waitsAtUserTask("UserTask");
  verify(scenario, times(1)).hasStarted("UserTask");
  verify(scenario, times(1)).hasFinished("UserTask");
  verify(scenario, times(1)).hasFinished("EndEventCompleted");
  verify(scenario, never()).hasFinished("EndEventAdditional");

}
 
Example #27
Source File: BoundaryNonInterruptingTimerTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {"org/camunda/bpm/scenario/test/timers/BoundaryNonInterruptingTimerTest.bpmn"})
public void testDoNothing() {

  when(scenario.waitsAtUserTask("UserTask")).thenReturn(new UserTaskAction() {
    @Override
    public void execute(TaskDelegate task) {
      // Deal with task but do nothing here
    }
  });

  Scenario.run(scenario).startByKey("BoundaryNonInterruptingTimerTest").execute();

  verify(scenario, times(1)).waitsAtUserTask("UserTask");
  verify(scenario, times(1)).hasStarted("UserTask");
  verify(scenario, never()).hasFinished("UserTask");
  verify(scenario, never()).hasFinished("EndEventCompleted");
  verify(scenario, times(1)).hasFinished("EndEventAdditional");

}
 
Example #28
Source File: ExclusiveGatewayLoopTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {"org/camunda/bpm/scenario/test/loops/ExclusiveGatewayLoopTest.bpmn"})
public void testDoTaskTenTimes() {

  when(scenario.waitsAtUserTask("UserTask")).thenReturn(new UserTaskAction() {
    @Override
    public void execute(TaskDelegate task) {
      variables.put("leave", ++loop == 10);
      task.complete(variables);
    }
  });

  Scenario.run(scenario).startByKey("ExclusiveGatewayLoopTest").execute();

  verify(scenario, times(10)).hasFinished("UserTask");
  verify(scenario, times(1)).hasFinished("EndEvent");

}
 
Example #29
Source File: CallActivityChildBlockingTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {
  "org/camunda/bpm/scenario/test/callactivities/CallActivityTest.bpmn",
  "org/camunda/bpm/scenario/test/callactivities/CallActivityChildBlockingTest.bpmn"
})
public void testCompleteCallActivity() {

  when(scenario.runsCallActivity("CallActivity")).thenReturn(Scenario.use(childScenario));

  when(childScenario.waitsAtUserTask("UserTask")).thenReturn(new UserTaskAction() {
    @Override
    public void execute(TaskDelegate task) {
      task.complete();
    }
  });

  Scenario.run(scenario).startByKey("CallActivityTest").execute();

  verify(scenario, times(1)).hasFinished("CallActivity");
  verify(scenario, times(1)).hasFinished("EndEvent");

}
 
Example #30
Source File: MultiInstanceLoopTest.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {"org/camunda/bpm/scenario/test/loops/MultiInstanceLoopTest.bpmn"})
public void testDoNotLoop() {

  when(scenario.waitsAtUserTask("UserTask")).thenReturn(new UserTaskAction() {
    @Override
    public void execute(TaskDelegate task) {
      task.complete();
    }
  });

  Scenario.run(scenario).startByKey("MultiInstanceLoopTest", variables).execute();

  verify(scenario, times(1)).hasFinished("UserTask");
  verify(scenario, times(1)).hasFinished("EndEvent");

}