Search in sources :

Example 16 with TimerSettingsValue

use of org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.TimerSettingsValue in project kie-wb-common by kiegroup.

the class TimerSettingsFieldEditorPresenterTest method testTimeCycleTimerValue.

@Test
public void testTimeCycleTimerValue() {
    TimerSettingsValue value = new TimerSettingsValue();
    value.setTimeCycleLanguage(TIME_CYCLE_LANGUAGE.ISO.value());
    value.setTimeCycle(VALUE_1);
    editor.setValue(value);
    verifyHideParams(3);
    verify(view, times(1)).clear();
    verifyDurationTimerDisplayMode(2, true);
    verifyMultipleTimerDisplayMode(1, true);
    verify(view, times(1)).setTimeCycleLanguage(TIME_CYCLE_LANGUAGE.ISO.value());
    verify(view, times(1)).setTimeCycle(VALUE_1);
}
Also used : TimerSettingsValue(org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.TimerSettingsValue) Test(org.junit.Test) FieldEditorPresenterBaseTest(org.kie.workbench.common.stunner.bpmn.client.forms.util.FieldEditorPresenterBaseTest)

Example 17 with TimerSettingsValue

use of org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.TimerSettingsValue in project kie-wb-common by kiegroup.

the class TimerSettingsFieldEditorPresenterTest method testOnTimeDateChange.

@Test
public void testOnTimeDateChange() {
    TimerSettingsValue value = new TimerSettingsValue();
    editor.setValue(value);
    when(view.getTimeDate()).thenReturn(VALUE_1);
    editor.onTimeDateChange();
    verify(changeHandler, times(1)).onValueChange(oldValueCaptor.capture(), newValueCaptor.capture());
    assertEquals(value, oldValueCaptor.getValue());
    value.setTimeDate(VALUE_1);
    assertEquals(value, newValueCaptor.getValue());
}
Also used : TimerSettingsValue(org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.TimerSettingsValue) Test(org.junit.Test) FieldEditorPresenterBaseTest(org.kie.workbench.common.stunner.bpmn.client.forms.util.FieldEditorPresenterBaseTest)

Example 18 with TimerSettingsValue

use of org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.TimerSettingsValue in project kie-wb-common by kiegroup.

the class Bpmn2JsonMarshaller method setTimerEventProperties.

private void setTimerEventProperties(TimerEventDefinition timerEventDef, Map<String, Object> properties) {
    final TimerSettingsValue timerSettings = new TimerSettingsValue();
    if (timerEventDef.getTimeDate() != null) {
        timerSettings.setTimeDate(((FormalExpression) timerEventDef.getTimeDate()).getBody());
    }
    if (timerEventDef.getTimeDuration() != null) {
        timerSettings.setTimeDuration(((FormalExpression) timerEventDef.getTimeDuration()).getBody());
    }
    if (timerEventDef.getTimeCycle() != null) {
        timerSettings.setTimeCycle(((FormalExpression) timerEventDef.getTimeCycle()).getBody());
        if (((FormalExpression) timerEventDef.getTimeCycle()).getLanguage() != null) {
            timerSettings.setTimeCycleLanguage(((FormalExpression) timerEventDef.getTimeCycle()).getLanguage());
        }
    }
    properties.put(TIMERSETTINGS, new TimerSettingsTypeSerializer().serialize(timerSettings));
}
Also used : TimerSettingsTypeSerializer(org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.TimerSettingsTypeSerializer) TimerSettingsValue(org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.TimerSettingsValue)

Aggregations

TimerSettingsValue (org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.TimerSettingsValue)18 Test (org.junit.Test)8 FieldEditorPresenterBaseTest (org.kie.workbench.common.stunner.bpmn.client.forms.util.FieldEditorPresenterBaseTest)7 TimerSettingsTypeSerializer (org.kie.workbench.common.stunner.bpmn.backend.marshall.json.oryx.property.TimerSettingsTypeSerializer)3 FormalExpression (org.eclipse.bpmn2.FormalExpression)2 ConstraintValidatorContext (javax.validation.ConstraintValidatorContext)1 TimerEventDefinition (org.eclipse.bpmn2.TimerEventDefinition)1 Before (org.junit.Before)1 TimerSettings (org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.TimerSettings)1