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


Java Deployment类代码示例

本文整理汇总了Java中org.camunda.bpm.engine.test.Deployment的典型用法代码示例。如果您正苦于以下问题:Java Deployment类的具体用法?Java Deployment怎么用?Java Deployment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Deployment类属于org.camunda.bpm.engine.test包,在下文中一共展示了Deployment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testReceiveMessage

import org.camunda.bpm.engine.test.Deployment; //导入依赖的package包/类
@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");

}
 
开发者ID:camunda,项目名称:camunda-bpm-assert-scenario,代码行数:19,代码来源:EventBasedGatewayTest.java

示例2: testSimulationDrive

import org.camunda.bpm.engine.test.Deployment; //导入依赖的package包/类
@Test
@Deployment(resources = "simulate.bpmn")
public void testSimulationDrive() {
  TimeAwareDemoGenerator generator = new TimeAwareDemoGenerator(processEngine()) //
      .processDefinitionKey("simulate") //
      .numberOfDaysInPast(1) //
      .startTimeBusinessDay("00:00") //
      .endTimeBusinessDay("23:59") //
      .includeWeekend(true) //
      .timeBetweenStartsBusinessDays(6000.0, 100.0); // every 6000 seconds
  generator.generateData();

  // ProcessInstance pi =
  // runtimeService().startProcessInstanceByKey("simulate");
  // assertThat(pi).task();
  // complete(task());
  // assertThat(pi).isEnded();
}
 
开发者ID:camunda-consulting,项目名称:camunda-util-demo-data-generator,代码行数:19,代码来源:DemoDataGeneratorTest.java

示例3: testIsoTimeAndConstantDistribution

import org.camunda.bpm.engine.test.Deployment; //导入依赖的package包/类
@Test
@Deployment(resources = "isoTimeAndConstantDistribution.bpmn")
public void testIsoTimeAndConstantDistribution() {
  TimeAwareDemoGenerator generator = new TimeAwareDemoGenerator(processEngine()) //
      .processDefinitionKey("isoTimeAndConstantDistribution") //
      .numberOfDaysInPast(1) //
      .startTimeBusinessDay("00:00") //
      .endTimeBusinessDay("23:59") //
      .includeWeekend(true) //
      .timeBetweenStartsBusinessDays(3600.0, 0.0);
  generator.generateData();

  long epsilon = 1;

  List<HistoricProcessInstance> finished = processEngine().getHistoryService().createHistoricProcessInstanceQuery().finished()
      .processDefinitionKey("isoTimeAndConstantDistribution").list();

  assertEquals(25, finished.size());
  assert (finished.stream().map(HistoricProcessInstance::getDurationInMillis)
      .allMatch(duration -> duration - epsilon < 5400000 && duration + epsilon > 5400000));
}
 
开发者ID:camunda-consulting,项目名称:camunda-util-demo-data-generator,代码行数:22,代码来源:DemoDataGeneratorTest.java

示例4: testExternalTask

import org.camunda.bpm.engine.test.Deployment; //导入依赖的package包/类
@Test
@Deployment(resources = "externalTask.bpmn")
public void testExternalTask() {
  TimeAwareDemoGenerator generator = new TimeAwareDemoGenerator(processEngine()) //
      .processDefinitionKey("externalTask") //
      .numberOfDaysInPast(1) //
      .startTimeBusinessDay("00:00") //
      .endTimeBusinessDay("23:59") //
      .includeWeekend(true) //
      .timeBetweenStartsBusinessDays(600.0, 100.0);
  generator.generateData();

  long runned = processEngine().getHistoryService().createHistoricProcessInstanceQuery().finished().processDefinitionKey("externalTask").count();
  // we have at least every 740 seconds a finish and run at least 24h
  assert (runned > 115);
}
 
开发者ID:camunda-consulting,项目名称:camunda-util-demo-data-generator,代码行数:17,代码来源:DemoDataGeneratorTest.java

示例5: testCycleBoundaryTimer

import org.camunda.bpm.engine.test.Deployment; //导入依赖的package包/类
@Test
@Deployment(resources = "cycleBoundaryTimer.bpmn")
public void testCycleBoundaryTimer() {
  TimeAwareDemoGenerator generator = new TimeAwareDemoGenerator(processEngine()) //
      .processDefinitionKey("cycleBoundaryTimer") //
      .numberOfDaysInPast(1) //
      .startTimeBusinessDay("00:00") //
      .endTimeBusinessDay("23:59") //
      .includeWeekend(true) //
      .timeBetweenStartsBusinessDays(6000.0, 100.0);
  generator.generateData();

  long taken = processEngine().getHistoryService().createHistoricActivityInstanceQuery()
      .processDefinitionId(getProcessDefinitionIdByKey("cycleBoundaryTimer")).activityId("EndEvent_Taken").count();
  long notTaken = processEngine().getHistoryService().createHistoricActivityInstanceQuery()
      .processDefinitionId(getProcessDefinitionIdByKey("cycleBoundaryTimer")).activityId("EndEvent_NotTaken").count();
  double all = taken + notTaken; // force floating point later

  LOG.info(taken / all * 100 + "% taken, " + notTaken / all * 100 + "% not taken");

  // take timer roughly ten times before finish user task
  assert (Math.abs(taken / all) > 0.8);
  assert (Math.abs(taken / all) < 1);
}
 
开发者ID:camunda-consulting,项目名称:camunda-util-demo-data-generator,代码行数:25,代码来源:DemoDataGeneratorTest.java

示例6: testRepeatCallActivity

import org.camunda.bpm.engine.test.Deployment; //导入依赖的package包/类
@Test
@Deployment(resources = { "repeatCallActivityMain.bpmn", "repeatCallActivitySub.bpmn" })
public void testRepeatCallActivity() {
  TimeAwareDemoGenerator generator = new TimeAwareDemoGenerator(processEngine()) //
      .processDefinitionKey("repeatCallActivityMain") //
      .additionalModelKeys("repeatCallActivitySub") //
      .numberOfDaysInPast(1) //
      .startTimeBusinessDay("00:00") //
      .endTimeBusinessDay("23:59") //
      .includeWeekend(true) //
      .timeBetweenStartsBusinessDays(6000.0, 100.0);
  generator.generateData();

  long taken = processEngine().getHistoryService().createHistoricActivityInstanceQuery()
      .processDefinitionId(getProcessDefinitionIdByKey("repeatCallActivitySub")).activityId("EndEvent_SubTaken").count();
  long notTaken = processEngine().getHistoryService().createHistoricActivityInstanceQuery()
      .processDefinitionId(getProcessDefinitionIdByKey("repeatCallActivityMain")).activityId("EndEvent_NotTaken").count();
  double all = taken + notTaken; // force floating point later

  LOG.info(taken / all * 100 + "% taken, " + notTaken / all * 100 + "% not taken");

  // we expect call activitiy to be run 2 times per main run
  assert (taken > notTaken * 1.9);
  assert (taken < notTaken * 2.1);
}
 
开发者ID:camunda-consulting,项目名称:camunda-util-demo-data-generator,代码行数:26,代码来源:DemoDataGeneratorTest.java

示例7: testRunAlways

import org.camunda.bpm.engine.test.Deployment; //导入依赖的package包/类
@Test
@Deployment(resources = { "runAlways.bpmn", "runOnce.bpmn" })
public void testRunAlways() {
  DemoDataGenerator.autoGenerateFor(processEngine(), "runOnce", null);
  long firstRun = processEngine().getHistoryService().createHistoricProcessInstanceQuery().processDefinitionKey("runOnce").count();

  assert (firstRun > 0);

  DemoDataGenerator.autoGenerateFor(processEngine(), "runOnce", null);
  long secondRun = processEngine().getHistoryService().createHistoricProcessInstanceQuery().processDefinitionKey("runOnce").count();

  assertEquals(firstRun, secondRun);

  DemoDataGenerator.autoGenerateFor(processEngine(), "runAlways", null);
  firstRun = processEngine().getHistoryService().createHistoricProcessInstanceQuery().processDefinitionKey("runAlways").count();
  assert (firstRun > 0);
  DemoDataGenerator.autoGenerateFor(processEngine(), "runAlways", null);
  secondRun = processEngine().getHistoryService().createHistoricProcessInstanceQuery().processDefinitionKey("runAlways").count();
  assert (firstRun < secondRun);
}
 
开发者ID:camunda-consulting,项目名称:camunda-util-demo-data-generator,代码行数:21,代码来源:DemoDataGeneratorTest.java

示例8: testStartByKey

import org.camunda.bpm.engine.test.Deployment; //导入依赖的package包/类
@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");

}
 
开发者ID:camunda,项目名称:camunda-bpm-assert-scenario,代码行数:18,代码来源:StartByTest.java

示例9: testTakeMuchTooLongForTask

import org.camunda.bpm.engine.test.Deployment; //导入依赖的package包/类
@Test
@Deployment(resources = {"org/camunda/bpm/scenario/test/timers/BoundaryInterruptingTimerTest.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("BoundaryInterruptingTimerTest").execute();

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

}
 
开发者ID:camunda,项目名称:camunda-bpm-assert-scenario,代码行数:25,代码来源:BoundaryInterruptingTimerTest.java

示例10: pollMailWithTextBody

import org.camunda.bpm.engine.test.Deployment; //导入依赖的package包/类
@Test
@Deployment(resources = "processes/mail-poll.bpmn")
public void pollMailWithTextBody() throws MessagingException {
  greenMail.setUser("[email protected]", "bpmn");

  GreenMailUtil.sendTextEmailTest("[email protected]", "[email protected]", "subject", "text body");

  ProcessInstance processInstance = engineRule.getRuntimeService().startProcessInstanceByKey("poll-mails");

  @SuppressWarnings("unchecked")
  List<Mail> mails = (List<Mail>) engineRule.getRuntimeService().getVariable(processInstance.getId(), "mails");

  assertThat(mails)
    .isNotNull()
    .hasSize(1);

  Mail mail = mails.get(0);
  assertThat(mail.getFrom()).isEqualTo("[email protected]");
  assertThat(mail.getSubject()).isEqualTo("subject");
  assertThat(mail.getText()).isEqualTo("text body");
}
 
开发者ID:camunda,项目名称:camunda-bpm-mail,代码行数:22,代码来源:PollMailConnectorProcessTest.java

示例11: testDoTaskTenTimes

import org.camunda.bpm.engine.test.Deployment; //导入依赖的package包/类
@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");

}
 
开发者ID:camunda,项目名称:camunda-bpm-assert-scenario,代码行数:19,代码来源:ExclusiveGatewayLoopTest.java

示例12: sendMailWithFileName

import org.camunda.bpm.engine.test.Deployment; //导入依赖的package包/类
@Test
@Deployment(resources = "processes/mail-send-file.bpmn")
public void sendMailWithFileName() throws Exception {
  File attachment = new File(getClass().getResource("/attachment.txt").toURI());
  assertThat(attachment.exists()).isTrue();

  engineRule.getRuntimeService().startProcessInstanceByKey("send-mail",
      Variables.createVariables().putValue("file", attachment.getPath()));

  MimeMessage[] mails = greenMail.getReceivedMessages();
  assertThat(mails).hasSize(1);

  MimeMessage mail = mails[0];

  assertThat(mail.getContent()).isInstanceOf(MimeMultipart.class);
  MimeMultipart multiPart = (MimeMultipart) mail.getContent();

  assertThat(multiPart.getCount()).isEqualTo(1);
  assertThat(GreenMailUtil.getBody(multiPart.getBodyPart(0))).isEqualTo("plain text");
}
 
开发者ID:camunda,项目名称:camunda-bpm-mail,代码行数:21,代码来源:SendMailConnectorProcessTest.java

示例13: processPrintMail

import org.camunda.bpm.engine.test.Deployment; //导入依赖的package包/类
@Deployment(resources = "processes/printProcess.bpmn")
@Test
public void processPrintMail() throws Exception {

  processApplication.startService(engineRule.getProcessEngine());

  TaskQuery taskQuery = taskService.createTaskQuery().taskName("print it");

  // wait for first mail
  while(taskQuery.count() == 0) {
    Thread.sleep(500);
  }

  List<Task> tasks = taskQuery.list();
  assertThat(tasks).isNotEmpty();

  for (Task task : tasks) {
    taskService.complete(task.getId());
  }

  waitForAsyncJobs();

  assertThat(runtimeService.createProcessInstanceQuery().list()).isEmpty();
}
 
开发者ID:camunda,项目名称:camunda-bpm-mail,代码行数:25,代码来源:ProcessIntegrationTest.java

示例14: testConditionInitiallyFalseAndDoNothing

import org.camunda.bpm.engine.test.Deployment; //导入依赖的package包/类
@Test
@Deployment(resources = {"org/camunda/bpm/scenario/test/boundary/ConditionalBoundaryEventTest.bpmn"})
public void testConditionInitiallyFalseAndDoNothing() {

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

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

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

}
 
开发者ID:camunda,项目名称:camunda-bpm-assert-scenario,代码行数:23,代码来源:ConditionaBoundaryEventTest.java

示例15: testConditionInitiallyTrueAndDoNothing

import org.camunda.bpm.engine.test.Deployment; //导入依赖的package包/类
@Test
@Deployment(resources = {"org/camunda/bpm/scenario/test/boundary/ConditionalBoundaryEventTest.bpmn"})
public void testConditionInitiallyTrueAndDoNothing() {

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

  variables.put("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");

}
 
开发者ID:camunda,项目名称:camunda-bpm-assert-scenario,代码行数:25,代码来源:ConditionaBoundaryEventTest.java


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