Package org.camunda.bpm.engine.form

Examples of org.camunda.bpm.engine.form.FormField


    // validate properties:
    List<FormField> formFields = taskFormData.getFormFields();

    // validate field 1
    FormField formField1 = formFields.get(0);
    assertNotNull(formField1);
    assertEquals(formField1.getId(), "formField1");
    assertEquals(formField1.getLabel(), "Form Field 1");
    assertEquals("string", formField1.getTypeName());
    assertNotNull(formField1.getType());

    // validate field 2
    FormField formField2 = formFields.get(1);
    assertNotNull(formField2);
    assertEquals(formField2.getId(), "formField2");
    assertEquals(formField2.getLabel(), "Form Field 2");
    assertEquals("boolean", formField2.getTypeName());
    assertNotNull(formField1.getType());

  }
View Full Code Here


    // validate properties:
    List<FormField> formFields = taskFormData.getFormFields();

    // validate string field
    FormField stringField = formFields.get(0);
    assertNotNull(stringField);
    assertEquals("string", stringField.getTypeName());
    assertNotNull(stringField.getType());
    assertEquals("someString", stringField.getDefaultValue());

    // validate long field
    FormField longField = formFields.get(1);
    assertNotNull(longField);
    assertEquals("long", longField.getTypeName());
    assertNotNull(longField.getType());
    assertEquals(Long.valueOf(1l), longField.getDefaultValue());

    // validate boolean field
    FormField booleanField = formFields.get(2);
    assertNotNull(booleanField);
    assertEquals("boolean", booleanField.getTypeName());
    assertNotNull(booleanField.getType());
    assertEquals(Boolean.valueOf(true), booleanField.getDefaultValue());

    // validate date field
    FormField dateField = formFields.get(3);
    assertNotNull(dateField);
    assertEquals("date", dateField.getTypeName());
    assertNotNull(dateField.getType());
    Date dateValue = (Date) dateField.getDefaultValue();
    Calendar calendar = Calendar.getInstance();
    calendar.setTime(dateValue);
    assertEquals(10, calendar.get(Calendar.DAY_OF_MONTH));
    assertEquals(Calendar.JANUARY, calendar.get(Calendar.MONTH));
    assertEquals(2013, calendar.get(Calendar.YEAR));

    // validate enum field
    FormField enumField = formFields.get(4);
    assertNotNull(enumField);
    assertEquals("enum", enumField.getTypeName());
    assertNotNull(enumField.getType());
    EnumFormType enumFormType = (EnumFormType) enumField.getType();
    Map<String, String> values = enumFormType.getValues();
    assertEquals("A", values.get("a"));
    assertEquals("B", values.get("b"));
    assertEquals("C", values.get("c"));
View Full Code Here

    TaskFormData taskFormData = formService.getTaskFormData(task.getId());

    List<FormField> formFields = taskFormData.getFormFields();

    FormField stringField = formFields.get(0);
    Map<String, String> properties = stringField.getProperties();
    assertEquals("property1", properties.get("p1"));
    assertEquals("property2", properties.get("p2"));

  }
View Full Code Here

    TaskFormData taskFormData = formService.getTaskFormData(task.getId());

    List<FormField> formFields = taskFormData.getFormFields();

    FormField field1 = formFields.get(0);
    List<FormFieldValidationConstraint> validationConstraints = field1.getValidationConstraints();
    FormFieldValidationConstraint constraint1 = validationConstraints.get(0);
    assertEquals("maxlength", constraint1.getName());
    assertEquals("10", constraint1.getConfiguration());
    FormFieldValidationConstraint constraint2 = validationConstraints.get(1);
    assertEquals("minlength", constraint2.getName());
View Full Code Here

    when(mockFormData.getFormProperties()).thenReturn(mockFormProperties);
    return mockFormData;
  }

  public static TaskFormData createMockTaskFormDataUsingFormFieldsWithoutFormKey() {
    FormField mockFormField = mock(FormField.class);
    when(mockFormField.getId()).thenReturn(EXAMPLE_FORM_PROPERTY_ID);
    when(mockFormField.getLabel()).thenReturn(EXAMPLE_FORM_PROPERTY_NAME);
    when(mockFormField.getDefaultValue()).thenReturn(EXAMPLE_FORM_PROPERTY_VALUE);

    FormType mockFormType = mock(FormType.class);
    when(mockFormType.getName()).thenReturn(EXAMPLE_FORM_PROPERTY_TYPE_NAME);
    when(mockFormField.getType()).thenReturn(mockFormType);

    TaskFormData mockFormData = mock(TaskFormData.class);
    when(mockFormData.getDeploymentId()).thenReturn(EXAMPLE_DEPLOYMENT_ID);

    List<FormField> mockFormFields = new ArrayList<FormField>();
View Full Code Here

    when(mockFormData.getFormProperties()).thenReturn(mockFormProperties);
    return mockFormData;
  }

  public static StartFormData createMockStartFormDataUsingFormFieldsWithoutFormKey(ProcessDefinition definition) {
    FormField mockFormField = mock(FormField.class);
    when(mockFormField.getId()).thenReturn(EXAMPLE_FORM_PROPERTY_ID);
    when(mockFormField.getLabel()).thenReturn(EXAMPLE_FORM_PROPERTY_NAME);
    when(mockFormField.getDefaultValue()).thenReturn(EXAMPLE_FORM_PROPERTY_VALUE);

    FormType mockFormType = mock(FormType.class);
    when(mockFormType.getName()).thenReturn(EXAMPLE_FORM_PROPERTY_TYPE_NAME);
    when(mockFormField.getType()).thenReturn(mockFormType);

    StartFormData mockFormData = mock(StartFormData.class);
    when(mockFormData.getDeploymentId()).thenReturn(EXAMPLE_DEPLOYMENT_ID);
    when(mockFormData.getProcessDefinition()).thenReturn(definition);
View Full Code Here

TOP

Related Classes of org.camunda.bpm.engine.form.FormField

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.