コード例 #1
0
  @Test
  public void shouldGenerateIdsOnCreate() {
    BpmnModelInstance modelInstance = Bpmn.createEmptyModel();
    Definitions definitions = modelInstance.newInstance(Definitions.class);
    assertThat(definitions.getId()).isNotNull();

    Process process = modelInstance.newInstance(Process.class);
    assertThat(process.getId()).isNotNull();

    StartEvent startEvent = modelInstance.newInstance(StartEvent.class);
    assertThat(startEvent.getId()).isNotNull();

    UserTask userTask = modelInstance.newInstance(UserTask.class);
    assertThat(userTask.getId()).isNotNull();
  }
コード例 #2
0
  @Test
  public void shouldNotGenerateIdsOnRead() {
    BpmnModelInstance modelInstance =
        Bpmn.readModelFromStream(GenerateIdTest.class.getResourceAsStream("GenerateIdTest.bpmn"));
    Definitions definitions = modelInstance.getDefinitions();
    assertThat(definitions.getId()).isNull();

    Process process = modelInstance.getModelElementsByType(Process.class).iterator().next();
    assertThat(process.getId()).isNull();

    StartEvent startEvent =
        modelInstance.getModelElementsByType(StartEvent.class).iterator().next();
    assertThat(startEvent.getId()).isNull();

    UserTask userTask = modelInstance.getModelElementsByType(UserTask.class).iterator().next();
    assertThat(userTask.getId()).isNull();
  }