コード例 #1
0
  @Test
  public void createForProcessOverviewShouldAddCorrectAuthorizations() throws Exception {
    doReturn("clave")
        .when(formMappingKeyGenerator)
        .generateKey(PROCESS_DEFINITION_ID, null, FormMappingType.PROCESS_OVERVIEW.getId());

    formMappingService.create(
        PROCESS_DEFINITION_ID,
        null,
        FormMappingType.PROCESS_OVERVIEW.getId(),
        SFormMapping.TARGET_URL,
        null);

    verify(pageMappingService)
        .create(
            "clave",
            null,
            EXTERNAL,
            Arrays.asList(
                IS_ADMIN,
                IS_PROCESS_OWNER,
                IS_PROCESS_INITIATOR,
                IS_TASK_PERFORMER,
                IS_INVOLVED_IN_PROCESS_INSTANCE));
  }
コード例 #2
0
  @Test
  public void testSearchFormMappings() throws Exception {
    QueryOptions queryOptions = mock(QueryOptions.class);
    formMappingService.searchFormMappings(queryOptions);

    verify(persistenceService)
        .searchEntity(SFormMapping.class, queryOptions, Collections.<String, Object>emptyMap());
  }
コード例 #3
0
  @Test
  public void testGetNumberOfFormMappings() throws Exception {
    QueryOptions queryOptions = mock(QueryOptions.class);
    formMappingService.getNumberOfFormMappings(queryOptions);

    verify(persistenceService)
        .getNumberOfEntities(
            SFormMapping.class, queryOptions, Collections.<String, Object>emptyMap());
  }
コード例 #4
0
  @Test
  public void createWithInternalPageShouldCallPageMapping_create() throws Exception {
    doReturn("theKey").when(formMappingKeyGenerator).generateKey(PROCESS_DEFINITION_ID, "step1", 2);

    formMappingService.create(
        PROCESS_DEFINITION_ID, "step1", 2, SFormMapping.TARGET_INTERNAL, null);

    verify(pageMappingService).create(eq("theKey"), isNull(Long.class), anyList());
  }
コード例 #5
0
  @Test
  public void createFormMappingWithUndefinedTargetShouldNotAddPageMapping() throws Exception {
    doReturn("mockedKey")
        .when(formMappingKeyGenerator)
        .generateKey(PROCESS_DEFINITION_ID, "someHumanTask", 84);

    formMappingService.create(
        PROCESS_DEFINITION_ID, "someHumanTask", 84, SFormMapping.TARGET_UNDEFINED, null);

    verifyZeroInteractions(pageMappingService);
  }
コード例 #6
0
  @Test
  public void testGetByKey() throws Exception {
    formMappingService.get("theKey");

    verify(persistenceService)
        .selectOne(
            new SelectOneDescriptor<SFormMapping>(
                "getFormMappingByKey",
                Collections.<String, Object>singletonMap("key", "theKey"),
                SFormMapping.class));
  }
コード例 #7
0
  @Test
  public void test_update_with_page() throws Exception {
    SFormMapping formMapping = createFormMapping(ID);

    formMappingService.update(formMapping, null, PAGE_ID);

    verify(recorder).recordUpdate(updateRecordCaptor.capture(), updateEventCaptor.capture());
    assertThat(updateRecordCaptor.getValue().getFields())
        .contains(
            entry("target", SFormMapping.TARGET_INTERNAL),
            entry("pageMapping.url", null),
            entry("pageMapping.pageId", PAGE_ID),
            entry("pageMapping.urlAdapter", null));
  }
コード例 #8
0
  @Test
  public void createLegacyFormShouldNotAddCorrectAuthorizations() throws Exception {
    doReturn("keye")
        .when(formMappingKeyGenerator)
        .generateKey(PROCESS_DEFINITION_ID, null, FormMappingType.PROCESS_START.getId());

    formMappingService.create(
        PROCESS_DEFINITION_ID,
        null,
        FormMappingType.PROCESS_START.getId(),
        SFormMapping.TARGET_LEGACY,
        null);

    verify(pageMappingService).create("keye", null, LEGACY, null);
  }
コード例 #9
0
  @Test
  public void createForProcessStartShouldAddCorrectAuthorizations() throws Exception {
    doReturn("keye")
        .when(formMappingKeyGenerator)
        .generateKey(PROCESS_DEFINITION_ID, null, FormMappingType.PROCESS_START.getId());

    formMappingService.create(
        PROCESS_DEFINITION_ID,
        null,
        FormMappingType.PROCESS_START.getId(),
        SFormMapping.TARGET_URL,
        null);

    verify(pageMappingService)
        .create(
            "keye", null, EXTERNAL, Arrays.asList(IS_ADMIN, IS_PROCESS_OWNER, IS_ACTOR_INITIATOR));
  }
コード例 #10
0
  @Test
  public void createForTaskShouldAddCorrectAuthorizations() throws Exception {
    doReturn("clef")
        .when(formMappingKeyGenerator)
        .generateKey(PROCESS_DEFINITION_ID, "task", FormMappingType.TASK.getId());

    formMappingService.create(
        PROCESS_DEFINITION_ID,
        "task",
        FormMappingType.TASK.getId(),
        SFormMapping.TARGET_INTERNAL,
        null);

    verify(pageMappingService)
        .create(
            "clef", null, Arrays.asList(IS_ADMIN, IS_PROCESS_OWNER, IS_TASK_AVAILABLE_FOR_USER));
  }
コード例 #11
0
  @Test(expected = SObjectModificationException.class)
  public void test_update_with_invalid_parameters3() throws Exception {
    SFormMapping formMapping = createFormMapping(ID);

    formMappingService.update(formMapping, "", null);
  }
コード例 #12
0
  @Test(expected = SObjectModificationException.class)
  public void test_update_with_page_that_does_not_exists() throws Exception {
    SFormMapping formMapping = createFormMapping(ID);

    formMappingService.update(formMapping, null, 557441l);
  }
コード例 #13
0
 @Test(expected = IllegalArgumentException.class)
 public void testCreateWithNullTarget() throws Exception {
   formMappingService.create(1654L, "step1", 1, null, null);
 }