target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void testSetValueNull() { presenter.setValue(null); verifyClear(); assertNull(presenter.getValue()); verify(paramInstance, never()).get(); } | @Override public void setValue(Condition value) { super.setValue(value); clear(); if (value != null) { if (value.getParams().size() >= 1) { String type = variableSearchService.getOptionType(value.getParams().get(0)); if (type != null) { functionSearchService.reload(type, () -> onSetValue(value)); } else { view.setVariableError(translationService.getValue(VARIABLE_NOT_FOUND_ERROR, value.getParams().get(0))); } } else { view.setConditionError(translationService.getValue(CONDITION_MAL_FORMED)); } } } | SimpleConditionEditorPresenter extends FieldEditorPresenter<Condition> { @Override public void setValue(Condition value) { super.setValue(value); clear(); if (value != null) { if (value.getParams().size() >= 1) { String type = variableSearchService.getOptionType(value.getParams().get(0)); if (type != null) { functionSearchService.reload(type, () -> onSetValue(value)); } else { view.setVariableError(translationService.getValue(VARIABLE_NOT_FOUND_ERROR, value.getParams().get(0))); } } else { view.setConditionError(translationService.getValue(CONDITION_MAL_FORMED)); } } } } | SimpleConditionEditorPresenter extends FieldEditorPresenter<Condition> { @Override public void setValue(Condition value) { super.setValue(value); clear(); if (value != null) { if (value.getParams().size() >= 1) { String type = variableSearchService.getOptionType(value.getParams().get(0)); if (type != null) { functionSearchService.reload(type, () -> onSetValue(value)); } else { view.setVariableError(translationService.getValue(VARIABLE_NOT_FOUND_ERROR, value.getParams().get(0))); } } else { view.setConditionError(translationService.getValue(CONDITION_MAL_FORMED)); } } } @Inject SimpleConditionEditorPresenter(final View view,
final ManagedInstance<ConditionParamPresenter> paramInstance,
final VariableSearchService variableSearchService,
final FunctionSearchService functionSearchService,
final FunctionNamingService functionNamingService,
final ClientTranslationService translationService); } | SimpleConditionEditorPresenter extends FieldEditorPresenter<Condition> { @Override public void setValue(Condition value) { super.setValue(value); clear(); if (value != null) { if (value.getParams().size() >= 1) { String type = variableSearchService.getOptionType(value.getParams().get(0)); if (type != null) { functionSearchService.reload(type, () -> onSetValue(value)); } else { view.setVariableError(translationService.getValue(VARIABLE_NOT_FOUND_ERROR, value.getParams().get(0))); } } else { view.setConditionError(translationService.getValue(CONDITION_MAL_FORMED)); } } } @Inject SimpleConditionEditorPresenter(final View view,
final ManagedInstance<ConditionParamPresenter> paramInstance,
final VariableSearchService variableSearchService,
final FunctionSearchService functionSearchService,
final FunctionNamingService functionNamingService,
final ClientTranslationService translationService); @PostConstruct void init(); View getView(); void init(ClientSession session); @Override void setValue(Condition value); @Override void setReadOnly(boolean readOnly); void clear(); boolean isValid(); } | SimpleConditionEditorPresenter extends FieldEditorPresenter<Condition> { @Override public void setValue(Condition value) { super.setValue(value); clear(); if (value != null) { if (value.getParams().size() >= 1) { String type = variableSearchService.getOptionType(value.getParams().get(0)); if (type != null) { functionSearchService.reload(type, () -> onSetValue(value)); } else { view.setVariableError(translationService.getValue(VARIABLE_NOT_FOUND_ERROR, value.getParams().get(0))); } } else { view.setConditionError(translationService.getValue(CONDITION_MAL_FORMED)); } } } @Inject SimpleConditionEditorPresenter(final View view,
final ManagedInstance<ConditionParamPresenter> paramInstance,
final VariableSearchService variableSearchService,
final FunctionSearchService functionSearchService,
final FunctionNamingService functionNamingService,
final ClientTranslationService translationService); @PostConstruct void init(); View getView(); void init(ClientSession session); @Override void setValue(Condition value); @Override void setReadOnly(boolean readOnly); void clear(); boolean isValid(); } |
@Test public void testSetValueWhenConditionMalFormed() { Condition condition = new Condition(); when(translationService.getValue(CONDITION_MAL_FORMED)).thenReturn(TRANSLATED_MESSAGE); presenter.setValue(condition); verify(view).setConditionError(TRANSLATED_MESSAGE); verifyClear(); assertEquals(condition, presenter.getValue()); verify(paramInstance, never()).get(); } | @Override public void setValue(Condition value) { super.setValue(value); clear(); if (value != null) { if (value.getParams().size() >= 1) { String type = variableSearchService.getOptionType(value.getParams().get(0)); if (type != null) { functionSearchService.reload(type, () -> onSetValue(value)); } else { view.setVariableError(translationService.getValue(VARIABLE_NOT_FOUND_ERROR, value.getParams().get(0))); } } else { view.setConditionError(translationService.getValue(CONDITION_MAL_FORMED)); } } } | SimpleConditionEditorPresenter extends FieldEditorPresenter<Condition> { @Override public void setValue(Condition value) { super.setValue(value); clear(); if (value != null) { if (value.getParams().size() >= 1) { String type = variableSearchService.getOptionType(value.getParams().get(0)); if (type != null) { functionSearchService.reload(type, () -> onSetValue(value)); } else { view.setVariableError(translationService.getValue(VARIABLE_NOT_FOUND_ERROR, value.getParams().get(0))); } } else { view.setConditionError(translationService.getValue(CONDITION_MAL_FORMED)); } } } } | SimpleConditionEditorPresenter extends FieldEditorPresenter<Condition> { @Override public void setValue(Condition value) { super.setValue(value); clear(); if (value != null) { if (value.getParams().size() >= 1) { String type = variableSearchService.getOptionType(value.getParams().get(0)); if (type != null) { functionSearchService.reload(type, () -> onSetValue(value)); } else { view.setVariableError(translationService.getValue(VARIABLE_NOT_FOUND_ERROR, value.getParams().get(0))); } } else { view.setConditionError(translationService.getValue(CONDITION_MAL_FORMED)); } } } @Inject SimpleConditionEditorPresenter(final View view,
final ManagedInstance<ConditionParamPresenter> paramInstance,
final VariableSearchService variableSearchService,
final FunctionSearchService functionSearchService,
final FunctionNamingService functionNamingService,
final ClientTranslationService translationService); } | SimpleConditionEditorPresenter extends FieldEditorPresenter<Condition> { @Override public void setValue(Condition value) { super.setValue(value); clear(); if (value != null) { if (value.getParams().size() >= 1) { String type = variableSearchService.getOptionType(value.getParams().get(0)); if (type != null) { functionSearchService.reload(type, () -> onSetValue(value)); } else { view.setVariableError(translationService.getValue(VARIABLE_NOT_FOUND_ERROR, value.getParams().get(0))); } } else { view.setConditionError(translationService.getValue(CONDITION_MAL_FORMED)); } } } @Inject SimpleConditionEditorPresenter(final View view,
final ManagedInstance<ConditionParamPresenter> paramInstance,
final VariableSearchService variableSearchService,
final FunctionSearchService functionSearchService,
final FunctionNamingService functionNamingService,
final ClientTranslationService translationService); @PostConstruct void init(); View getView(); void init(ClientSession session); @Override void setValue(Condition value); @Override void setReadOnly(boolean readOnly); void clear(); boolean isValid(); } | SimpleConditionEditorPresenter extends FieldEditorPresenter<Condition> { @Override public void setValue(Condition value) { super.setValue(value); clear(); if (value != null) { if (value.getParams().size() >= 1) { String type = variableSearchService.getOptionType(value.getParams().get(0)); if (type != null) { functionSearchService.reload(type, () -> onSetValue(value)); } else { view.setVariableError(translationService.getValue(VARIABLE_NOT_FOUND_ERROR, value.getParams().get(0))); } } else { view.setConditionError(translationService.getValue(CONDITION_MAL_FORMED)); } } } @Inject SimpleConditionEditorPresenter(final View view,
final ManagedInstance<ConditionParamPresenter> paramInstance,
final VariableSearchService variableSearchService,
final FunctionSearchService functionSearchService,
final FunctionNamingService functionNamingService,
final ClientTranslationService translationService); @PostConstruct void init(); View getView(); void init(ClientSession session); @Override void setValue(Condition value); @Override void setReadOnly(boolean readOnly); void clear(); boolean isValid(); } |
@Test public void testClear() { presenter.clear(); verifyClear(); } | public void clear() { variableSearchSelectionHandler.clearSelection(); functionSearchSelectionHandler.clearSelection(); functionSearchService.clear(); removeParams(); clearErrors(); } | SimpleConditionEditorPresenter extends FieldEditorPresenter<Condition> { public void clear() { variableSearchSelectionHandler.clearSelection(); functionSearchSelectionHandler.clearSelection(); functionSearchService.clear(); removeParams(); clearErrors(); } } | SimpleConditionEditorPresenter extends FieldEditorPresenter<Condition> { public void clear() { variableSearchSelectionHandler.clearSelection(); functionSearchSelectionHandler.clearSelection(); functionSearchService.clear(); removeParams(); clearErrors(); } @Inject SimpleConditionEditorPresenter(final View view,
final ManagedInstance<ConditionParamPresenter> paramInstance,
final VariableSearchService variableSearchService,
final FunctionSearchService functionSearchService,
final FunctionNamingService functionNamingService,
final ClientTranslationService translationService); } | SimpleConditionEditorPresenter extends FieldEditorPresenter<Condition> { public void clear() { variableSearchSelectionHandler.clearSelection(); functionSearchSelectionHandler.clearSelection(); functionSearchService.clear(); removeParams(); clearErrors(); } @Inject SimpleConditionEditorPresenter(final View view,
final ManagedInstance<ConditionParamPresenter> paramInstance,
final VariableSearchService variableSearchService,
final FunctionSearchService functionSearchService,
final FunctionNamingService functionNamingService,
final ClientTranslationService translationService); @PostConstruct void init(); View getView(); void init(ClientSession session); @Override void setValue(Condition value); @Override void setReadOnly(boolean readOnly); void clear(); boolean isValid(); } | SimpleConditionEditorPresenter extends FieldEditorPresenter<Condition> { public void clear() { variableSearchSelectionHandler.clearSelection(); functionSearchSelectionHandler.clearSelection(); functionSearchService.clear(); removeParams(); clearErrors(); } @Inject SimpleConditionEditorPresenter(final View view,
final ManagedInstance<ConditionParamPresenter> paramInstance,
final VariableSearchService variableSearchService,
final FunctionSearchService functionSearchService,
final FunctionNamingService functionNamingService,
final ClientTranslationService translationService); @PostConstruct void init(); View getView(); void init(ClientSession session); @Override void setValue(Condition value); @Override void setReadOnly(boolean readOnly); void clear(); boolean isValid(); } |
@Test public void testOnParamChangeWhenParamsAreValid() { prepareForParamChangeTest(true); paramCommandCaptor.getValue().execute(); verifyConditionWasCreated(); assertTrue(presenter.isValid()); } | public boolean isValid() { return valid; } | SimpleConditionEditorPresenter extends FieldEditorPresenter<Condition> { public boolean isValid() { return valid; } } | SimpleConditionEditorPresenter extends FieldEditorPresenter<Condition> { public boolean isValid() { return valid; } @Inject SimpleConditionEditorPresenter(final View view,
final ManagedInstance<ConditionParamPresenter> paramInstance,
final VariableSearchService variableSearchService,
final FunctionSearchService functionSearchService,
final FunctionNamingService functionNamingService,
final ClientTranslationService translationService); } | SimpleConditionEditorPresenter extends FieldEditorPresenter<Condition> { public boolean isValid() { return valid; } @Inject SimpleConditionEditorPresenter(final View view,
final ManagedInstance<ConditionParamPresenter> paramInstance,
final VariableSearchService variableSearchService,
final FunctionSearchService functionSearchService,
final FunctionNamingService functionNamingService,
final ClientTranslationService translationService); @PostConstruct void init(); View getView(); void init(ClientSession session); @Override void setValue(Condition value); @Override void setReadOnly(boolean readOnly); void clear(); boolean isValid(); } | SimpleConditionEditorPresenter extends FieldEditorPresenter<Condition> { public boolean isValid() { return valid; } @Inject SimpleConditionEditorPresenter(final View view,
final ManagedInstance<ConditionParamPresenter> paramInstance,
final VariableSearchService variableSearchService,
final FunctionSearchService functionSearchService,
final FunctionNamingService functionNamingService,
final ClientTranslationService translationService); @PostConstruct void init(); View getView(); void init(ClientSession session); @Override void setValue(Condition value); @Override void setReadOnly(boolean readOnly); void clear(); boolean isValid(); } |
@Test public void testOnParamChangeWhenParamsAreNotValid() { prepareForParamChangeTest(false); paramCommandCaptor.getValue().execute(); verifyConditionWasCreated(); assertFalse(presenter.isValid()); } | public boolean isValid() { return valid; } | SimpleConditionEditorPresenter extends FieldEditorPresenter<Condition> { public boolean isValid() { return valid; } } | SimpleConditionEditorPresenter extends FieldEditorPresenter<Condition> { public boolean isValid() { return valid; } @Inject SimpleConditionEditorPresenter(final View view,
final ManagedInstance<ConditionParamPresenter> paramInstance,
final VariableSearchService variableSearchService,
final FunctionSearchService functionSearchService,
final FunctionNamingService functionNamingService,
final ClientTranslationService translationService); } | SimpleConditionEditorPresenter extends FieldEditorPresenter<Condition> { public boolean isValid() { return valid; } @Inject SimpleConditionEditorPresenter(final View view,
final ManagedInstance<ConditionParamPresenter> paramInstance,
final VariableSearchService variableSearchService,
final FunctionSearchService functionSearchService,
final FunctionNamingService functionNamingService,
final ClientTranslationService translationService); @PostConstruct void init(); View getView(); void init(ClientSession session); @Override void setValue(Condition value); @Override void setReadOnly(boolean readOnly); void clear(); boolean isValid(); } | SimpleConditionEditorPresenter extends FieldEditorPresenter<Condition> { public boolean isValid() { return valid; } @Inject SimpleConditionEditorPresenter(final View view,
final ManagedInstance<ConditionParamPresenter> paramInstance,
final VariableSearchService variableSearchService,
final FunctionSearchService functionSearchService,
final FunctionNamingService functionNamingService,
final ClientTranslationService translationService); @PostConstruct void init(); View getView(); void init(ClientSession session); @Override void setValue(Condition value); @Override void setReadOnly(boolean readOnly); void clear(); boolean isValid(); } |
@Test public void getDefinitionType() { assertEquals(tested.getDefinitionType(), BPMNDiagramImpl.class); } | @Override public Class<?> getDefinitionType() { return BPMNDiagramImpl.class; } | BPMNDiagramFilterProvider implements StunnerFormElementFilterProvider { @Override public Class<?> getDefinitionType() { return BPMNDiagramImpl.class; } } | BPMNDiagramFilterProvider implements StunnerFormElementFilterProvider { @Override public Class<?> getDefinitionType() { return BPMNDiagramImpl.class; } BPMNDiagramFilterProvider(); @Inject BPMNDiagramFilterProvider(final SessionManager sessionManager,
final DiagramTypeClientService diagramTypeService,
final FieldChangeHandlerManager fieldChangeHandlerManager,
final Event<RefreshFormPropertiesEvent> refreshFormPropertiesEvent); } | BPMNDiagramFilterProvider implements StunnerFormElementFilterProvider { @Override public Class<?> getDefinitionType() { return BPMNDiagramImpl.class; } BPMNDiagramFilterProvider(); @Inject BPMNDiagramFilterProvider(final SessionManager sessionManager,
final DiagramTypeClientService diagramTypeService,
final FieldChangeHandlerManager fieldChangeHandlerManager,
final Event<RefreshFormPropertiesEvent> refreshFormPropertiesEvent); @Override Class<?> getDefinitionType(); @Override Collection<FormElementFilter> provideFilters(String elementUUID, Object definition); } | BPMNDiagramFilterProvider implements StunnerFormElementFilterProvider { @Override public Class<?> getDefinitionType() { return BPMNDiagramImpl.class; } BPMNDiagramFilterProvider(); @Inject BPMNDiagramFilterProvider(final SessionManager sessionManager,
final DiagramTypeClientService diagramTypeService,
final FieldChangeHandlerManager fieldChangeHandlerManager,
final Event<RefreshFormPropertiesEvent> refreshFormPropertiesEvent); @Override Class<?> getDefinitionType(); @Override Collection<FormElementFilter> provideFilters(String elementUUID, Object definition); } |
@Test public void onFormFieldChanged() { tested.onFormFieldChanged(formFieldChanged); final ArgumentCaptor<RefreshFormPropertiesEvent> refreshFormPropertiesArgumentCaptor = ArgumentCaptor.forClass(RefreshFormPropertiesEvent.class); verify(refreshFormPropertiesEvent).fire(refreshFormPropertiesArgumentCaptor.capture()); RefreshFormPropertiesEvent refreshEvent = refreshFormPropertiesArgumentCaptor.getValue(); assertEquals(refreshEvent.getUuid(), UUID); assertEquals(refreshEvent.getSession(), session); } | void onFormFieldChanged(@Observes FormFieldChanged formFieldChanged) { final String adHocFieldName = BPMNDiagramImpl.DIAGRAM_SET + "." + DiagramSet.ADHOC; if (!Objects.equals(formFieldChanged.getName(), adHocFieldName)) { return; } refreshFormPropertiesEvent.fire(new RefreshFormPropertiesEvent(sessionManager.getCurrentSession(), formFieldChanged.getUuid())); } | BPMNDiagramFilterProvider implements StunnerFormElementFilterProvider { void onFormFieldChanged(@Observes FormFieldChanged formFieldChanged) { final String adHocFieldName = BPMNDiagramImpl.DIAGRAM_SET + "." + DiagramSet.ADHOC; if (!Objects.equals(formFieldChanged.getName(), adHocFieldName)) { return; } refreshFormPropertiesEvent.fire(new RefreshFormPropertiesEvent(sessionManager.getCurrentSession(), formFieldChanged.getUuid())); } } | BPMNDiagramFilterProvider implements StunnerFormElementFilterProvider { void onFormFieldChanged(@Observes FormFieldChanged formFieldChanged) { final String adHocFieldName = BPMNDiagramImpl.DIAGRAM_SET + "." + DiagramSet.ADHOC; if (!Objects.equals(formFieldChanged.getName(), adHocFieldName)) { return; } refreshFormPropertiesEvent.fire(new RefreshFormPropertiesEvent(sessionManager.getCurrentSession(), formFieldChanged.getUuid())); } BPMNDiagramFilterProvider(); @Inject BPMNDiagramFilterProvider(final SessionManager sessionManager,
final DiagramTypeClientService diagramTypeService,
final FieldChangeHandlerManager fieldChangeHandlerManager,
final Event<RefreshFormPropertiesEvent> refreshFormPropertiesEvent); } | BPMNDiagramFilterProvider implements StunnerFormElementFilterProvider { void onFormFieldChanged(@Observes FormFieldChanged formFieldChanged) { final String adHocFieldName = BPMNDiagramImpl.DIAGRAM_SET + "." + DiagramSet.ADHOC; if (!Objects.equals(formFieldChanged.getName(), adHocFieldName)) { return; } refreshFormPropertiesEvent.fire(new RefreshFormPropertiesEvent(sessionManager.getCurrentSession(), formFieldChanged.getUuid())); } BPMNDiagramFilterProvider(); @Inject BPMNDiagramFilterProvider(final SessionManager sessionManager,
final DiagramTypeClientService diagramTypeService,
final FieldChangeHandlerManager fieldChangeHandlerManager,
final Event<RefreshFormPropertiesEvent> refreshFormPropertiesEvent); @Override Class<?> getDefinitionType(); @Override Collection<FormElementFilter> provideFilters(String elementUUID, Object definition); } | BPMNDiagramFilterProvider implements StunnerFormElementFilterProvider { void onFormFieldChanged(@Observes FormFieldChanged formFieldChanged) { final String adHocFieldName = BPMNDiagramImpl.DIAGRAM_SET + "." + DiagramSet.ADHOC; if (!Objects.equals(formFieldChanged.getName(), adHocFieldName)) { return; } refreshFormPropertiesEvent.fire(new RefreshFormPropertiesEvent(sessionManager.getCurrentSession(), formFieldChanged.getUuid())); } BPMNDiagramFilterProvider(); @Inject BPMNDiagramFilterProvider(final SessionManager sessionManager,
final DiagramTypeClientService diagramTypeService,
final FieldChangeHandlerManager fieldChangeHandlerManager,
final Event<RefreshFormPropertiesEvent> refreshFormPropertiesEvent); @Override Class<?> getDefinitionType(); @Override Collection<FormElementFilter> provideFilters(String elementUUID, Object definition); } |
@Test @SuppressWarnings("unchecked") public void testProvideFilters() { String arbitraryElementUUID = "arbitraryElementUUID"; Object arbitraryObject = mock(Object.class); Collection<FormElementFilter> result = filterProvider.provideFilters(arbitraryElementUUID, arbitraryObject); assertEquals(1, result.size()); FormElementFilter filter = result.iterator().next(); assertEquals("general.name", filter.getElementName()); Object arbitraryValue = mock(Object.class); assertFalse(filter.getPredicate().test(arbitraryValue)); assertEquals(DirectionalAssociation.class, filterProvider.getDefinitionType()); } | @SuppressWarnings("unchecked") @Override public Collection<FormElementFilter> provideFilters(String elementUUID, Object definition) { FormElementFilter nameFilter = new FormElementFilter("general.name", o -> false); return Collections.singletonList(nameFilter); } | AssociationFilterProvider implements StunnerFormElementFilterProvider { @SuppressWarnings("unchecked") @Override public Collection<FormElementFilter> provideFilters(String elementUUID, Object definition) { FormElementFilter nameFilter = new FormElementFilter("general.name", o -> false); return Collections.singletonList(nameFilter); } } | AssociationFilterProvider implements StunnerFormElementFilterProvider { @SuppressWarnings("unchecked") @Override public Collection<FormElementFilter> provideFilters(String elementUUID, Object definition) { FormElementFilter nameFilter = new FormElementFilter("general.name", o -> false); return Collections.singletonList(nameFilter); } AssociationFilterProvider(); } | AssociationFilterProvider implements StunnerFormElementFilterProvider { @SuppressWarnings("unchecked") @Override public Collection<FormElementFilter> provideFilters(String elementUUID, Object definition) { FormElementFilter nameFilter = new FormElementFilter("general.name", o -> false); return Collections.singletonList(nameFilter); } AssociationFilterProvider(); @Override Class<?> getDefinitionType(); @SuppressWarnings("unchecked") @Override Collection<FormElementFilter> provideFilters(String elementUUID,
Object definition); } | AssociationFilterProvider implements StunnerFormElementFilterProvider { @SuppressWarnings("unchecked") @Override public Collection<FormElementFilter> provideFilters(String elementUUID, Object definition) { FormElementFilter nameFilter = new FormElementFilter("general.name", o -> false); return Collections.singletonList(nameFilter); } AssociationFilterProvider(); @Override Class<?> getDefinitionType(); @SuppressWarnings("unchecked") @Override Collection<FormElementFilter> provideFilters(String elementUUID,
Object definition); } |
@Test public void testOnFormFieldChangedForMultipleInstance() { FormFieldChanged formFieldChanged = mockFormFieldChanged(IS_MULTIPLE_INSTANCE, UUID); filterProvider.onFormFieldChanged(formFieldChanged); verifyFieldChangeFired(); } | void onFormFieldChanged(@Observes final FormFieldChanged formFieldChanged) { applyFormFieldChange(formFieldChanged); } | MultipleInstanceNodeFilterProvider implements StunnerFormElementFilterProvider { void onFormFieldChanged(@Observes final FormFieldChanged formFieldChanged) { applyFormFieldChange(formFieldChanged); } } | MultipleInstanceNodeFilterProvider implements StunnerFormElementFilterProvider { void onFormFieldChanged(@Observes final FormFieldChanged formFieldChanged) { applyFormFieldChange(formFieldChanged); } MultipleInstanceNodeFilterProvider(); MultipleInstanceNodeFilterProvider(final SessionManager sessionManager,
final Event<RefreshFormPropertiesEvent> refreshFormPropertiesEvent); } | MultipleInstanceNodeFilterProvider implements StunnerFormElementFilterProvider { void onFormFieldChanged(@Observes final FormFieldChanged formFieldChanged) { applyFormFieldChange(formFieldChanged); } MultipleInstanceNodeFilterProvider(); MultipleInstanceNodeFilterProvider(final SessionManager sessionManager,
final Event<RefreshFormPropertiesEvent> refreshFormPropertiesEvent); abstract boolean isMultipleInstance(final Object definition); @Override @SuppressWarnings("unchecked") Collection<FormElementFilter> provideFilters(final String elementUUID, final Object definition); } | MultipleInstanceNodeFilterProvider implements StunnerFormElementFilterProvider { void onFormFieldChanged(@Observes final FormFieldChanged formFieldChanged) { applyFormFieldChange(formFieldChanged); } MultipleInstanceNodeFilterProvider(); MultipleInstanceNodeFilterProvider(final SessionManager sessionManager,
final Event<RefreshFormPropertiesEvent> refreshFormPropertiesEvent); abstract boolean isMultipleInstance(final Object definition); @Override @SuppressWarnings("unchecked") Collection<FormElementFilter> provideFilters(final String elementUUID, final Object definition); } |
@Test public void testGetView() { assertEquals(view, item.getView()); } | public View getView() { return view; } | DecisionComponentsItem { public View getView() { return view; } } | DecisionComponentsItem { public View getView() { return view; } @Inject DecisionComponentsItem(final View view); } | DecisionComponentsItem { public View getView() { return view; } @Inject DecisionComponentsItem(final View view); @PostConstruct void init(); View getView(); void setDecisionComponent(final DecisionComponent decisionComponent); void show(); void hide(); DRGElement getDrgElement(); } | DecisionComponentsItem { public View getView() { return view; } @Inject DecisionComponentsItem(final View view); @PostConstruct void init(); View getView(); void setDecisionComponent(final DecisionComponent decisionComponent); void show(); void hide(); DRGElement getDrgElement(); } |
@Test public void testOnFormFieldChangedForOtherThanMultipleInstance() { FormFieldChanged formFieldChanged = mockFormFieldChanged("anyOtherField", "anyOtherUUID"); filterProvider.onFormFieldChanged(formFieldChanged); verify(refreshFormPropertiesEvent, never()).fire(any()); } | void onFormFieldChanged(@Observes final FormFieldChanged formFieldChanged) { applyFormFieldChange(formFieldChanged); } | MultipleInstanceNodeFilterProvider implements StunnerFormElementFilterProvider { void onFormFieldChanged(@Observes final FormFieldChanged formFieldChanged) { applyFormFieldChange(formFieldChanged); } } | MultipleInstanceNodeFilterProvider implements StunnerFormElementFilterProvider { void onFormFieldChanged(@Observes final FormFieldChanged formFieldChanged) { applyFormFieldChange(formFieldChanged); } MultipleInstanceNodeFilterProvider(); MultipleInstanceNodeFilterProvider(final SessionManager sessionManager,
final Event<RefreshFormPropertiesEvent> refreshFormPropertiesEvent); } | MultipleInstanceNodeFilterProvider implements StunnerFormElementFilterProvider { void onFormFieldChanged(@Observes final FormFieldChanged formFieldChanged) { applyFormFieldChange(formFieldChanged); } MultipleInstanceNodeFilterProvider(); MultipleInstanceNodeFilterProvider(final SessionManager sessionManager,
final Event<RefreshFormPropertiesEvent> refreshFormPropertiesEvent); abstract boolean isMultipleInstance(final Object definition); @Override @SuppressWarnings("unchecked") Collection<FormElementFilter> provideFilters(final String elementUUID, final Object definition); } | MultipleInstanceNodeFilterProvider implements StunnerFormElementFilterProvider { void onFormFieldChanged(@Observes final FormFieldChanged formFieldChanged) { applyFormFieldChange(formFieldChanged); } MultipleInstanceNodeFilterProvider(); MultipleInstanceNodeFilterProvider(final SessionManager sessionManager,
final Event<RefreshFormPropertiesEvent> refreshFormPropertiesEvent); abstract boolean isMultipleInstance(final Object definition); @Override @SuppressWarnings("unchecked") Collection<FormElementFilter> provideFilters(final String elementUUID, final Object definition); } |
@Test public void testGetProviderName() { assertEquals(tested.getClass().getSimpleName(), tested.getProviderName()); } | @Override public String getProviderName() { return getClass().getSimpleName(); } | RuleFlowGroupFormProvider implements SelectorDataProvider { @Override public String getProviderName() { return getClass().getSimpleName(); } } | RuleFlowGroupFormProvider implements SelectorDataProvider { @Override public String getProviderName() { return getClass().getSimpleName(); } } | RuleFlowGroupFormProvider implements SelectorDataProvider { @Override public String getProviderName() { return getClass().getSimpleName(); } @PostConstruct void populateData(); @Override String getProviderName(); @Override SelectorData<String> getSelectorData(final FormRenderingContext context); static void initServerData(); static Event<RequestRuleFlowGroupDataEvent> getRequestRuleFlowGroupDataEventEventSingleton(); } | RuleFlowGroupFormProvider implements SelectorDataProvider { @Override public String getProviderName() { return getClass().getSimpleName(); } @PostConstruct void populateData(); @Override String getProviderName(); @Override SelectorData<String> getSelectorData(final FormRenderingContext context); static void initServerData(); static Event<RequestRuleFlowGroupDataEvent> getRequestRuleFlowGroupDataEventEventSingleton(); } |
@Test @SuppressWarnings("unchecked") public void testGetSelectorData() { RuleFlowGroup group1 = new RuleFlowGroup("g1"); group1.setPathUri("default: RuleFlowGroup group2 = new RuleFlowGroup("g2"); group2.setPathUri("default: RuleFlowGroup group3 = new RuleFlowGroup("g1"); group3.setPathUri("default: List<RuleFlowGroup> groups = Arrays.asList(group1, group2, group3); when(dataProvider.getRuleFlowGroupNames()).thenReturn(groups); FormRenderingContext context = mock(FormRenderingContext.class); SelectorData data = tested.getSelectorData(context); Map<String, String> values = data.getValues(); assertNotNull(values); assertEquals(2, values.size()); assertEquals("g2 [Project1]", values.get(group2.getName())); assertEquals("g1 [Project1, Project2]", values.get(group1.getName())); verify(requestRuleFlowGroupDataEvent, times(1)).fire(any(RequestRuleFlowGroupDataEvent.class)); } | @Override public SelectorData<String> getSelectorData(final FormRenderingContext context) { requestRuleFlowGroupDataEvent.fire(new RequestRuleFlowGroupDataEvent()); return new SelectorData<>(toMap(dataProvider.getRuleFlowGroupNames()), null); } | RuleFlowGroupFormProvider implements SelectorDataProvider { @Override public SelectorData<String> getSelectorData(final FormRenderingContext context) { requestRuleFlowGroupDataEvent.fire(new RequestRuleFlowGroupDataEvent()); return new SelectorData<>(toMap(dataProvider.getRuleFlowGroupNames()), null); } } | RuleFlowGroupFormProvider implements SelectorDataProvider { @Override public SelectorData<String> getSelectorData(final FormRenderingContext context) { requestRuleFlowGroupDataEvent.fire(new RequestRuleFlowGroupDataEvent()); return new SelectorData<>(toMap(dataProvider.getRuleFlowGroupNames()), null); } } | RuleFlowGroupFormProvider implements SelectorDataProvider { @Override public SelectorData<String> getSelectorData(final FormRenderingContext context) { requestRuleFlowGroupDataEvent.fire(new RequestRuleFlowGroupDataEvent()); return new SelectorData<>(toMap(dataProvider.getRuleFlowGroupNames()), null); } @PostConstruct void populateData(); @Override String getProviderName(); @Override SelectorData<String> getSelectorData(final FormRenderingContext context); static void initServerData(); static Event<RequestRuleFlowGroupDataEvent> getRequestRuleFlowGroupDataEventEventSingleton(); } | RuleFlowGroupFormProvider implements SelectorDataProvider { @Override public SelectorData<String> getSelectorData(final FormRenderingContext context) { requestRuleFlowGroupDataEvent.fire(new RequestRuleFlowGroupDataEvent()); return new SelectorData<>(toMap(dataProvider.getRuleFlowGroupNames()), null); } @PostConstruct void populateData(); @Override String getProviderName(); @Override SelectorData<String> getSelectorData(final FormRenderingContext context); static void initServerData(); static Event<RequestRuleFlowGroupDataEvent> getRequestRuleFlowGroupDataEventEventSingleton(); } |
@Test public void testGroupWithSameProject() { RuleFlowGroup group1 = new RuleFlowGroup("g1"); group1.setPathUri("default: RuleFlowGroup group2 = new RuleFlowGroup("g1"); group2.setPathUri("default: RuleFlowGroup group3 = new RuleFlowGroup("g1"); group3.setPathUri("default: List<RuleFlowGroup> groups = Arrays.asList(group1, group2, group3); when(dataProvider.getRuleFlowGroupNames()).thenReturn(groups); FormRenderingContext context = mock(FormRenderingContext.class); SelectorData<String> data = tested.getSelectorData(context); Map<String, String> values = data.getValues(); assertNotNull(values); assertEquals(1, values.size()); assertEquals("g1 [Project1, Project2]", values.get(group1.getName())); verify(requestRuleFlowGroupDataEvent, times(1)).fire(any(RequestRuleFlowGroupDataEvent.class)); } | @Override public SelectorData<String> getSelectorData(final FormRenderingContext context) { requestRuleFlowGroupDataEvent.fire(new RequestRuleFlowGroupDataEvent()); return new SelectorData<>(toMap(dataProvider.getRuleFlowGroupNames()), null); } | RuleFlowGroupFormProvider implements SelectorDataProvider { @Override public SelectorData<String> getSelectorData(final FormRenderingContext context) { requestRuleFlowGroupDataEvent.fire(new RequestRuleFlowGroupDataEvent()); return new SelectorData<>(toMap(dataProvider.getRuleFlowGroupNames()), null); } } | RuleFlowGroupFormProvider implements SelectorDataProvider { @Override public SelectorData<String> getSelectorData(final FormRenderingContext context) { requestRuleFlowGroupDataEvent.fire(new RequestRuleFlowGroupDataEvent()); return new SelectorData<>(toMap(dataProvider.getRuleFlowGroupNames()), null); } } | RuleFlowGroupFormProvider implements SelectorDataProvider { @Override public SelectorData<String> getSelectorData(final FormRenderingContext context) { requestRuleFlowGroupDataEvent.fire(new RequestRuleFlowGroupDataEvent()); return new SelectorData<>(toMap(dataProvider.getRuleFlowGroupNames()), null); } @PostConstruct void populateData(); @Override String getProviderName(); @Override SelectorData<String> getSelectorData(final FormRenderingContext context); static void initServerData(); static Event<RequestRuleFlowGroupDataEvent> getRequestRuleFlowGroupDataEventEventSingleton(); } | RuleFlowGroupFormProvider implements SelectorDataProvider { @Override public SelectorData<String> getSelectorData(final FormRenderingContext context) { requestRuleFlowGroupDataEvent.fire(new RequestRuleFlowGroupDataEvent()); return new SelectorData<>(toMap(dataProvider.getRuleFlowGroupNames()), null); } @PostConstruct void populateData(); @Override String getProviderName(); @Override SelectorData<String> getSelectorData(final FormRenderingContext context); static void initServerData(); static Event<RequestRuleFlowGroupDataEvent> getRequestRuleFlowGroupDataEventEventSingleton(); } |
@Test public void testGetProviderName() { assertEquals(tested.getClass().getSimpleName(), tested.getProviderName()); } | @Override public String getProviderName() { return getClass().getSimpleName(); } | CalledElementFormProvider implements SelectorDataProvider { @Override public String getProviderName() { return getClass().getSimpleName(); } } | CalledElementFormProvider implements SelectorDataProvider { @Override public String getProviderName() { return getClass().getSimpleName(); } } | CalledElementFormProvider implements SelectorDataProvider { @Override public String getProviderName() { return getClass().getSimpleName(); } @Override String getProviderName(); @PostConstruct void populateData(); @Override @SuppressWarnings("unchecked") SelectorData getSelectorData(final FormRenderingContext context); static void initServerData(); static Event<RequestProcessDataEvent> getRequestProcessDataEventSingleton(); } | CalledElementFormProvider implements SelectorDataProvider { @Override public String getProviderName() { return getClass().getSimpleName(); } @Override String getProviderName(); @PostConstruct void populateData(); @Override @SuppressWarnings("unchecked") SelectorData getSelectorData(final FormRenderingContext context); static void initServerData(); static Event<RequestProcessDataEvent> getRequestProcessDataEventSingleton(); } |
@Test public void testGetSelectorData() { List<String> names = Arrays.asList("p1", "p2", "p3"); when(dataProvider.getProcessIds()).thenReturn(names); FormRenderingContext context = mock(FormRenderingContext.class); SelectorData data = tested.getSelectorData(context); Map values = data.getValues(); assertNotNull(values); assertEquals(3, values.size()); assertTrue(values.containsKey("p1")); assertTrue(values.containsKey("p2")); assertTrue(values.containsKey("p3")); verify(event, times(1)).fire(any(RequestProcessDataEvent.class)); } | @Override @SuppressWarnings("unchecked") public SelectorData getSelectorData(final FormRenderingContext context) { requestProcessDataEvent.fire(new RequestProcessDataEvent()); return new SelectorData(toMap(dataProvider.getProcessIds()), null); } | CalledElementFormProvider implements SelectorDataProvider { @Override @SuppressWarnings("unchecked") public SelectorData getSelectorData(final FormRenderingContext context) { requestProcessDataEvent.fire(new RequestProcessDataEvent()); return new SelectorData(toMap(dataProvider.getProcessIds()), null); } } | CalledElementFormProvider implements SelectorDataProvider { @Override @SuppressWarnings("unchecked") public SelectorData getSelectorData(final FormRenderingContext context) { requestProcessDataEvent.fire(new RequestProcessDataEvent()); return new SelectorData(toMap(dataProvider.getProcessIds()), null); } } | CalledElementFormProvider implements SelectorDataProvider { @Override @SuppressWarnings("unchecked") public SelectorData getSelectorData(final FormRenderingContext context) { requestProcessDataEvent.fire(new RequestProcessDataEvent()); return new SelectorData(toMap(dataProvider.getProcessIds()), null); } @Override String getProviderName(); @PostConstruct void populateData(); @Override @SuppressWarnings("unchecked") SelectorData getSelectorData(final FormRenderingContext context); static void initServerData(); static Event<RequestProcessDataEvent> getRequestProcessDataEventSingleton(); } | CalledElementFormProvider implements SelectorDataProvider { @Override @SuppressWarnings("unchecked") public SelectorData getSelectorData(final FormRenderingContext context) { requestProcessDataEvent.fire(new RequestProcessDataEvent()); return new SelectorData(toMap(dataProvider.getProcessIds()), null); } @Override String getProviderName(); @PostConstruct void populateData(); @Override @SuppressWarnings("unchecked") SelectorData getSelectorData(final FormRenderingContext context); static void initServerData(); static Event<RequestProcessDataEvent> getRequestProcessDataEventSingleton(); } |
@Test public void testOnRuleFlowGroupDataChanged() { RuleFlowGroup group1 = new RuleFlowGroup("g1"); RuleFlowGroup group2 = new RuleFlowGroup("g2"); RuleFlowGroupDataEvent event = mock(RuleFlowGroupDataEvent.class); when(event.getGroups()).thenReturn(new RuleFlowGroup[]{group1, group2}); tested.onRuleFlowGroupDataChanged(event); verify(formsHandler, times(1)).refreshCurrentSessionForms(eq(BPMNDefinitionSet.class)); List<RuleFlowGroup> values = tested.getRuleFlowGroupNames(); assertNotNull(values); assertEquals(2, values.size()); assertEquals("g1", values.get(0).getName()); assertEquals("g2", values.get(1).getName()); } | void onRuleFlowGroupDataChanged(final @Observes RuleFlowGroupDataEvent event) { setRuleFlowGroupNames(toList(event.getGroups())); } | RuleFlowGroupDataProvider { void onRuleFlowGroupDataChanged(final @Observes RuleFlowGroupDataEvent event) { setRuleFlowGroupNames(toList(event.getGroups())); } } | RuleFlowGroupDataProvider { void onRuleFlowGroupDataChanged(final @Observes RuleFlowGroupDataEvent event) { setRuleFlowGroupNames(toList(event.getGroups())); } RuleFlowGroupDataProvider(); @Inject RuleFlowGroupDataProvider(final StunnerFormsHandler formsHandler); } | RuleFlowGroupDataProvider { void onRuleFlowGroupDataChanged(final @Observes RuleFlowGroupDataEvent event) { setRuleFlowGroupNames(toList(event.getGroups())); } RuleFlowGroupDataProvider(); @Inject RuleFlowGroupDataProvider(final StunnerFormsHandler formsHandler); List<RuleFlowGroup> getRuleFlowGroupNames(); } | RuleFlowGroupDataProvider { void onRuleFlowGroupDataChanged(final @Observes RuleFlowGroupDataEvent event) { setRuleFlowGroupNames(toList(event.getGroups())); } RuleFlowGroupDataProvider(); @Inject RuleFlowGroupDataProvider(final StunnerFormsHandler formsHandler); List<RuleFlowGroup> getRuleFlowGroupNames(); } |
@Test public void testOnRuleFlowGroupDataNotChanged() { RuleFlowGroup group1 = new RuleFlowGroup("g1"); RuleFlowGroup group2 = new RuleFlowGroup("g2"); tested.groups.add(group1); tested.groups.add(group2); RuleFlowGroupDataEvent event = mock(RuleFlowGroupDataEvent.class); when(event.getGroups()).thenReturn(new RuleFlowGroup[]{group1, group2}); tested.onRuleFlowGroupDataChanged(event); verify(formsHandler, never()).refreshCurrentSessionForms(any(Class.class)); } | void onRuleFlowGroupDataChanged(final @Observes RuleFlowGroupDataEvent event) { setRuleFlowGroupNames(toList(event.getGroups())); } | RuleFlowGroupDataProvider { void onRuleFlowGroupDataChanged(final @Observes RuleFlowGroupDataEvent event) { setRuleFlowGroupNames(toList(event.getGroups())); } } | RuleFlowGroupDataProvider { void onRuleFlowGroupDataChanged(final @Observes RuleFlowGroupDataEvent event) { setRuleFlowGroupNames(toList(event.getGroups())); } RuleFlowGroupDataProvider(); @Inject RuleFlowGroupDataProvider(final StunnerFormsHandler formsHandler); } | RuleFlowGroupDataProvider { void onRuleFlowGroupDataChanged(final @Observes RuleFlowGroupDataEvent event) { setRuleFlowGroupNames(toList(event.getGroups())); } RuleFlowGroupDataProvider(); @Inject RuleFlowGroupDataProvider(final StunnerFormsHandler formsHandler); List<RuleFlowGroup> getRuleFlowGroupNames(); } | RuleFlowGroupDataProvider { void onRuleFlowGroupDataChanged(final @Observes RuleFlowGroupDataEvent event) { setRuleFlowGroupNames(toList(event.getGroups())); } RuleFlowGroupDataProvider(); @Inject RuleFlowGroupDataProvider(final StunnerFormsHandler formsHandler); List<RuleFlowGroup> getRuleFlowGroupNames(); } |
@Test public void testGetSelectorData() { SelectorData selectorData = provider.getSelectorData(context); assertNotNull(selectorData.getValues()); assertEquals(2, selectorData.getValues().size()); assertEquals(ExecutionOrder.SEQUENTIAL.value(), selectorData.getSelectedValue()); assertEquals(SEQUENTIAL_LABEL, selectorData.getValues().get(ExecutionOrder.SEQUENTIAL.value())); assertEquals(PARALLEL_LABEL, selectorData.getValues().get(ExecutionOrder.PARALLEL.value())); } | @Override @SuppressWarnings("unchecked") public SelectorData getSelectorData(final FormRenderingContext context) { Map<Object, String> values = new TreeMap<>(Comparator.comparing(o -> valuePosition.get(o))); Arrays.stream(DataProviderOption.values()) .forEach(scope -> values.put(scope.value(), translationService.getValue(scope.i18nKey()))); return new SelectorData(values, DataProviderOption.SEQUENTIAL.value()); } | ExecutionOrderProvider implements SelectorDataProvider { @Override @SuppressWarnings("unchecked") public SelectorData getSelectorData(final FormRenderingContext context) { Map<Object, String> values = new TreeMap<>(Comparator.comparing(o -> valuePosition.get(o))); Arrays.stream(DataProviderOption.values()) .forEach(scope -> values.put(scope.value(), translationService.getValue(scope.i18nKey()))); return new SelectorData(values, DataProviderOption.SEQUENTIAL.value()); } } | ExecutionOrderProvider implements SelectorDataProvider { @Override @SuppressWarnings("unchecked") public SelectorData getSelectorData(final FormRenderingContext context) { Map<Object, String> values = new TreeMap<>(Comparator.comparing(o -> valuePosition.get(o))); Arrays.stream(DataProviderOption.values()) .forEach(scope -> values.put(scope.value(), translationService.getValue(scope.i18nKey()))); return new SelectorData(values, DataProviderOption.SEQUENTIAL.value()); } @Inject ExecutionOrderProvider(final ClientTranslationService translationService); } | ExecutionOrderProvider implements SelectorDataProvider { @Override @SuppressWarnings("unchecked") public SelectorData getSelectorData(final FormRenderingContext context) { Map<Object, String> values = new TreeMap<>(Comparator.comparing(o -> valuePosition.get(o))); Arrays.stream(DataProviderOption.values()) .forEach(scope -> values.put(scope.value(), translationService.getValue(scope.i18nKey()))); return new SelectorData(values, DataProviderOption.SEQUENTIAL.value()); } @Inject ExecutionOrderProvider(final ClientTranslationService translationService); @Override String getProviderName(); @Override @SuppressWarnings("unchecked") SelectorData getSelectorData(final FormRenderingContext context); } | ExecutionOrderProvider implements SelectorDataProvider { @Override @SuppressWarnings("unchecked") public SelectorData getSelectorData(final FormRenderingContext context) { Map<Object, String> values = new TreeMap<>(Comparator.comparing(o -> valuePosition.get(o))); Arrays.stream(DataProviderOption.values()) .forEach(scope -> values.put(scope.value(), translationService.getValue(scope.i18nKey()))); return new SelectorData(values, DataProviderOption.SEQUENTIAL.value()); } @Inject ExecutionOrderProvider(final ClientTranslationService translationService); @Override String getProviderName(); @Override @SuppressWarnings("unchecked") SelectorData getSelectorData(final FormRenderingContext context); } |
@Test public void testGetSelectorDataWhenNoNodeSelected() { setSelectedNode(null); SelectorData result = provider.getSelectorData(renderingContext); assertResult(new ArrayList<>(), result); } | @Override @SuppressWarnings("unchecked") public SelectorData getSelectorData(FormRenderingContext context) { final Diagram diagram = sessionManager.getCurrentSession().getCanvasHandler().getDiagram(); final String rootUUID = diagram.getMetadata().getCanvasRootUUID(); final Node<?, ? extends Edge> selectedNode = getSelectedNode(diagram, sessionManager.getCurrentSession()); final Map<Object, String> values = new TreeMap<>(SafeComparator.TO_STRING_COMPARATOR); if (selectedNode != null) { Node<?, ? extends Edge> currentNode = selectedNode; final List<Node> compensableNodes = new ArrayList<>(); Node<?, ? extends Edge> parentNode; int levels = 0; do { parentNode = GraphUtils.getParent(currentNode).asNode(); compensableNodes.addAll(getCompensableNodes(parentNode)); if (rootUUID.equals(parentNode.getUUID())) { levels = 2; } else if (isSubProcess(parentNode)) { currentNode = parentNode; levels++; } else if (isLane(parentNode)) { currentNode = parentNode; } } while (levels < 2); compensableNodes.stream() .map(node -> buildPair(node.getUUID(), (BPMNDefinition) (((View) node.getContent()).getDefinition()))) .forEach(pair -> values.put(pair.getK1(), pair.getK2())); ActivityRef currentActivityRef = null; if (isEndCompensationEvent(selectedNode)) { currentActivityRef = ((EndCompensationEvent) ((View) selectedNode.getContent()).getDefinition()).getExecutionSet().getActivityRef(); } else if (isIntermediateCompensationEventThrowing(selectedNode)) { currentActivityRef = ((IntermediateCompensationEventThrowing) ((View) selectedNode.getContent()).getDefinition()).getExecutionSet().getActivityRef(); } if (currentActivityRef != null && !isEmpty(currentActivityRef.getValue()) && !values.containsKey(currentActivityRef.getValue())) { Node configured = diagram.getGraph().getNode(currentActivityRef.getValue()); if (configured != null) { Pair<Object, String> pair = buildPair(configured.getUUID(), (BPMNDefinition) ((View) configured.getContent()).getDefinition()); values.put(pair.getK1(), pair.getK2()); } } } return new SelectorData(values, null); } | ProcessCompensationRefProvider implements SelectorDataProvider { @Override @SuppressWarnings("unchecked") public SelectorData getSelectorData(FormRenderingContext context) { final Diagram diagram = sessionManager.getCurrentSession().getCanvasHandler().getDiagram(); final String rootUUID = diagram.getMetadata().getCanvasRootUUID(); final Node<?, ? extends Edge> selectedNode = getSelectedNode(diagram, sessionManager.getCurrentSession()); final Map<Object, String> values = new TreeMap<>(SafeComparator.TO_STRING_COMPARATOR); if (selectedNode != null) { Node<?, ? extends Edge> currentNode = selectedNode; final List<Node> compensableNodes = new ArrayList<>(); Node<?, ? extends Edge> parentNode; int levels = 0; do { parentNode = GraphUtils.getParent(currentNode).asNode(); compensableNodes.addAll(getCompensableNodes(parentNode)); if (rootUUID.equals(parentNode.getUUID())) { levels = 2; } else if (isSubProcess(parentNode)) { currentNode = parentNode; levels++; } else if (isLane(parentNode)) { currentNode = parentNode; } } while (levels < 2); compensableNodes.stream() .map(node -> buildPair(node.getUUID(), (BPMNDefinition) (((View) node.getContent()).getDefinition()))) .forEach(pair -> values.put(pair.getK1(), pair.getK2())); ActivityRef currentActivityRef = null; if (isEndCompensationEvent(selectedNode)) { currentActivityRef = ((EndCompensationEvent) ((View) selectedNode.getContent()).getDefinition()).getExecutionSet().getActivityRef(); } else if (isIntermediateCompensationEventThrowing(selectedNode)) { currentActivityRef = ((IntermediateCompensationEventThrowing) ((View) selectedNode.getContent()).getDefinition()).getExecutionSet().getActivityRef(); } if (currentActivityRef != null && !isEmpty(currentActivityRef.getValue()) && !values.containsKey(currentActivityRef.getValue())) { Node configured = diagram.getGraph().getNode(currentActivityRef.getValue()); if (configured != null) { Pair<Object, String> pair = buildPair(configured.getUUID(), (BPMNDefinition) ((View) configured.getContent()).getDefinition()); values.put(pair.getK1(), pair.getK2()); } } } return new SelectorData(values, null); } } | ProcessCompensationRefProvider implements SelectorDataProvider { @Override @SuppressWarnings("unchecked") public SelectorData getSelectorData(FormRenderingContext context) { final Diagram diagram = sessionManager.getCurrentSession().getCanvasHandler().getDiagram(); final String rootUUID = diagram.getMetadata().getCanvasRootUUID(); final Node<?, ? extends Edge> selectedNode = getSelectedNode(diagram, sessionManager.getCurrentSession()); final Map<Object, String> values = new TreeMap<>(SafeComparator.TO_STRING_COMPARATOR); if (selectedNode != null) { Node<?, ? extends Edge> currentNode = selectedNode; final List<Node> compensableNodes = new ArrayList<>(); Node<?, ? extends Edge> parentNode; int levels = 0; do { parentNode = GraphUtils.getParent(currentNode).asNode(); compensableNodes.addAll(getCompensableNodes(parentNode)); if (rootUUID.equals(parentNode.getUUID())) { levels = 2; } else if (isSubProcess(parentNode)) { currentNode = parentNode; levels++; } else if (isLane(parentNode)) { currentNode = parentNode; } } while (levels < 2); compensableNodes.stream() .map(node -> buildPair(node.getUUID(), (BPMNDefinition) (((View) node.getContent()).getDefinition()))) .forEach(pair -> values.put(pair.getK1(), pair.getK2())); ActivityRef currentActivityRef = null; if (isEndCompensationEvent(selectedNode)) { currentActivityRef = ((EndCompensationEvent) ((View) selectedNode.getContent()).getDefinition()).getExecutionSet().getActivityRef(); } else if (isIntermediateCompensationEventThrowing(selectedNode)) { currentActivityRef = ((IntermediateCompensationEventThrowing) ((View) selectedNode.getContent()).getDefinition()).getExecutionSet().getActivityRef(); } if (currentActivityRef != null && !isEmpty(currentActivityRef.getValue()) && !values.containsKey(currentActivityRef.getValue())) { Node configured = diagram.getGraph().getNode(currentActivityRef.getValue()); if (configured != null) { Pair<Object, String> pair = buildPair(configured.getUUID(), (BPMNDefinition) ((View) configured.getContent()).getDefinition()); values.put(pair.getK1(), pair.getK2()); } } } return new SelectorData(values, null); } @Inject ProcessCompensationRefProvider(final SessionManager sessionManager); } | ProcessCompensationRefProvider implements SelectorDataProvider { @Override @SuppressWarnings("unchecked") public SelectorData getSelectorData(FormRenderingContext context) { final Diagram diagram = sessionManager.getCurrentSession().getCanvasHandler().getDiagram(); final String rootUUID = diagram.getMetadata().getCanvasRootUUID(); final Node<?, ? extends Edge> selectedNode = getSelectedNode(diagram, sessionManager.getCurrentSession()); final Map<Object, String> values = new TreeMap<>(SafeComparator.TO_STRING_COMPARATOR); if (selectedNode != null) { Node<?, ? extends Edge> currentNode = selectedNode; final List<Node> compensableNodes = new ArrayList<>(); Node<?, ? extends Edge> parentNode; int levels = 0; do { parentNode = GraphUtils.getParent(currentNode).asNode(); compensableNodes.addAll(getCompensableNodes(parentNode)); if (rootUUID.equals(parentNode.getUUID())) { levels = 2; } else if (isSubProcess(parentNode)) { currentNode = parentNode; levels++; } else if (isLane(parentNode)) { currentNode = parentNode; } } while (levels < 2); compensableNodes.stream() .map(node -> buildPair(node.getUUID(), (BPMNDefinition) (((View) node.getContent()).getDefinition()))) .forEach(pair -> values.put(pair.getK1(), pair.getK2())); ActivityRef currentActivityRef = null; if (isEndCompensationEvent(selectedNode)) { currentActivityRef = ((EndCompensationEvent) ((View) selectedNode.getContent()).getDefinition()).getExecutionSet().getActivityRef(); } else if (isIntermediateCompensationEventThrowing(selectedNode)) { currentActivityRef = ((IntermediateCompensationEventThrowing) ((View) selectedNode.getContent()).getDefinition()).getExecutionSet().getActivityRef(); } if (currentActivityRef != null && !isEmpty(currentActivityRef.getValue()) && !values.containsKey(currentActivityRef.getValue())) { Node configured = diagram.getGraph().getNode(currentActivityRef.getValue()); if (configured != null) { Pair<Object, String> pair = buildPair(configured.getUUID(), (BPMNDefinition) ((View) configured.getContent()).getDefinition()); values.put(pair.getK1(), pair.getK2()); } } } return new SelectorData(values, null); } @Inject ProcessCompensationRefProvider(final SessionManager sessionManager); @Override String getProviderName(); @Override @SuppressWarnings("unchecked") SelectorData getSelectorData(FormRenderingContext context); } | ProcessCompensationRefProvider implements SelectorDataProvider { @Override @SuppressWarnings("unchecked") public SelectorData getSelectorData(FormRenderingContext context) { final Diagram diagram = sessionManager.getCurrentSession().getCanvasHandler().getDiagram(); final String rootUUID = diagram.getMetadata().getCanvasRootUUID(); final Node<?, ? extends Edge> selectedNode = getSelectedNode(diagram, sessionManager.getCurrentSession()); final Map<Object, String> values = new TreeMap<>(SafeComparator.TO_STRING_COMPARATOR); if (selectedNode != null) { Node<?, ? extends Edge> currentNode = selectedNode; final List<Node> compensableNodes = new ArrayList<>(); Node<?, ? extends Edge> parentNode; int levels = 0; do { parentNode = GraphUtils.getParent(currentNode).asNode(); compensableNodes.addAll(getCompensableNodes(parentNode)); if (rootUUID.equals(parentNode.getUUID())) { levels = 2; } else if (isSubProcess(parentNode)) { currentNode = parentNode; levels++; } else if (isLane(parentNode)) { currentNode = parentNode; } } while (levels < 2); compensableNodes.stream() .map(node -> buildPair(node.getUUID(), (BPMNDefinition) (((View) node.getContent()).getDefinition()))) .forEach(pair -> values.put(pair.getK1(), pair.getK2())); ActivityRef currentActivityRef = null; if (isEndCompensationEvent(selectedNode)) { currentActivityRef = ((EndCompensationEvent) ((View) selectedNode.getContent()).getDefinition()).getExecutionSet().getActivityRef(); } else if (isIntermediateCompensationEventThrowing(selectedNode)) { currentActivityRef = ((IntermediateCompensationEventThrowing) ((View) selectedNode.getContent()).getDefinition()).getExecutionSet().getActivityRef(); } if (currentActivityRef != null && !isEmpty(currentActivityRef.getValue()) && !values.containsKey(currentActivityRef.getValue())) { Node configured = diagram.getGraph().getNode(currentActivityRef.getValue()); if (configured != null) { Pair<Object, String> pair = buildPair(configured.getUUID(), (BPMNDefinition) ((View) configured.getContent()).getDefinition()); values.put(pair.getK1(), pair.getK2()); } } } return new SelectorData(values, null); } @Inject ProcessCompensationRefProvider(final SessionManager sessionManager); @Override String getProviderName(); @Override @SuppressWarnings("unchecked") SelectorData getSelectorData(FormRenderingContext context); } |
@Test public void testSetDecisionComponent() { final DecisionComponent decisionComponent = mock(DecisionComponent.class); when(decisionComponent.getIcon()).thenReturn(DECISION_PALETTE); when(decisionComponent.getName()).thenReturn("name"); when(decisionComponent.getFileName()).thenReturn("file"); item.setDecisionComponent(decisionComponent); verify(view).setIcon(DECISION_PALETTE.getUri().asString()); verify(view).setName(decisionComponent.getName()); verify(view).setFile(decisionComponent.getFileName()); } | public void setDecisionComponent(final DecisionComponent decisionComponent) { this.decisionComponent = decisionComponent; setupView(); } | DecisionComponentsItem { public void setDecisionComponent(final DecisionComponent decisionComponent) { this.decisionComponent = decisionComponent; setupView(); } } | DecisionComponentsItem { public void setDecisionComponent(final DecisionComponent decisionComponent) { this.decisionComponent = decisionComponent; setupView(); } @Inject DecisionComponentsItem(final View view); } | DecisionComponentsItem { public void setDecisionComponent(final DecisionComponent decisionComponent) { this.decisionComponent = decisionComponent; setupView(); } @Inject DecisionComponentsItem(final View view); @PostConstruct void init(); View getView(); void setDecisionComponent(final DecisionComponent decisionComponent); void show(); void hide(); DRGElement getDrgElement(); } | DecisionComponentsItem { public void setDecisionComponent(final DecisionComponent decisionComponent) { this.decisionComponent = decisionComponent; setupView(); } @Inject DecisionComponentsItem(final View view); @PostConstruct void init(); View getView(); void setDecisionComponent(final DecisionComponent decisionComponent); void show(); void hide(); DRGElement getDrgElement(); } |
@Test public void testGetProviderName() { assertEquals(tested.getClass().getSimpleName(), tested.getProviderName()); } | @Override public String getProviderName() { return getClass().getSimpleName(); } | ProcessTypeProvider extends AbstractProcessFilteredNodeProvider { @Override public String getProviderName() { return getClass().getSimpleName(); } } | ProcessTypeProvider extends AbstractProcessFilteredNodeProvider { @Override public String getProviderName() { return getClass().getSimpleName(); } @Inject ProcessTypeProvider(final SessionManager sessionManager); } | ProcessTypeProvider extends AbstractProcessFilteredNodeProvider { @Override public String getProviderName() { return getClass().getSimpleName(); } @Inject ProcessTypeProvider(final SessionManager sessionManager); @Override String getProviderName(); @Override Predicate<Node> getFilter(); @Override Function<Node, Pair<Object, String>> getMapper(); @Override @SuppressWarnings("unchecked") SelectorData getSelectorData(final FormRenderingContext context); } | ProcessTypeProvider extends AbstractProcessFilteredNodeProvider { @Override public String getProviderName() { return getClass().getSimpleName(); } @Inject ProcessTypeProvider(final SessionManager sessionManager); @Override String getProviderName(); @Override Predicate<Node> getFilter(); @Override Function<Node, Pair<Object, String>> getMapper(); @Override @SuppressWarnings("unchecked") SelectorData getSelectorData(final FormRenderingContext context); } |
@Test public void testGetValues() { SelectorData selectorData = tested.getSelectorData(context); assertEquals(2, selectorData.getValues().size()); assertEquals("Public", selectorData.getSelectedValue()); assertTrue(selectorData.getValues().containsValue("Public")); assertTrue(selectorData.getValues().containsValue("Private")); } | @Override @SuppressWarnings("unchecked") public SelectorData getSelectorData(final FormRenderingContext context) { return new SelectorData(Arrays.asList(TYPES) .stream() .collect(Collectors.toMap(p -> p, p -> p)), "Public"); } | ProcessTypeProvider extends AbstractProcessFilteredNodeProvider { @Override @SuppressWarnings("unchecked") public SelectorData getSelectorData(final FormRenderingContext context) { return new SelectorData(Arrays.asList(TYPES) .stream() .collect(Collectors.toMap(p -> p, p -> p)), "Public"); } } | ProcessTypeProvider extends AbstractProcessFilteredNodeProvider { @Override @SuppressWarnings("unchecked") public SelectorData getSelectorData(final FormRenderingContext context) { return new SelectorData(Arrays.asList(TYPES) .stream() .collect(Collectors.toMap(p -> p, p -> p)), "Public"); } @Inject ProcessTypeProvider(final SessionManager sessionManager); } | ProcessTypeProvider extends AbstractProcessFilteredNodeProvider { @Override @SuppressWarnings("unchecked") public SelectorData getSelectorData(final FormRenderingContext context) { return new SelectorData(Arrays.asList(TYPES) .stream() .collect(Collectors.toMap(p -> p, p -> p)), "Public"); } @Inject ProcessTypeProvider(final SessionManager sessionManager); @Override String getProviderName(); @Override Predicate<Node> getFilter(); @Override Function<Node, Pair<Object, String>> getMapper(); @Override @SuppressWarnings("unchecked") SelectorData getSelectorData(final FormRenderingContext context); } | ProcessTypeProvider extends AbstractProcessFilteredNodeProvider { @Override @SuppressWarnings("unchecked") public SelectorData getSelectorData(final FormRenderingContext context) { return new SelectorData(Arrays.asList(TYPES) .stream() .collect(Collectors.toMap(p -> p, p -> p)), "Public"); } @Inject ProcessTypeProvider(final SessionManager sessionManager); @Override String getProviderName(); @Override Predicate<Node> getFilter(); @Override Function<Node, Pair<Object, String>> getMapper(); @Override @SuppressWarnings("unchecked") SelectorData getSelectorData(final FormRenderingContext context); } |
@Test public void testGetFilter() { assertTrue(tested.getFilter().test(new NodeImpl("uuid_1"))); } | @Override public Predicate<Node> getFilter() { return node -> true; } | ProcessTypeProvider extends AbstractProcessFilteredNodeProvider { @Override public Predicate<Node> getFilter() { return node -> true; } } | ProcessTypeProvider extends AbstractProcessFilteredNodeProvider { @Override public Predicate<Node> getFilter() { return node -> true; } @Inject ProcessTypeProvider(final SessionManager sessionManager); } | ProcessTypeProvider extends AbstractProcessFilteredNodeProvider { @Override public Predicate<Node> getFilter() { return node -> true; } @Inject ProcessTypeProvider(final SessionManager sessionManager); @Override String getProviderName(); @Override Predicate<Node> getFilter(); @Override Function<Node, Pair<Object, String>> getMapper(); @Override @SuppressWarnings("unchecked") SelectorData getSelectorData(final FormRenderingContext context); } | ProcessTypeProvider extends AbstractProcessFilteredNodeProvider { @Override public Predicate<Node> getFilter() { return node -> true; } @Inject ProcessTypeProvider(final SessionManager sessionManager); @Override String getProviderName(); @Override Predicate<Node> getFilter(); @Override Function<Node, Pair<Object, String>> getMapper(); @Override @SuppressWarnings("unchecked") SelectorData getSelectorData(final FormRenderingContext context); } |
@Test public void testGetMapper() { assertNull(tested.getMapper()); } | @Override public Function<Node, Pair<Object, String>> getMapper() { return null; } | ProcessTypeProvider extends AbstractProcessFilteredNodeProvider { @Override public Function<Node, Pair<Object, String>> getMapper() { return null; } } | ProcessTypeProvider extends AbstractProcessFilteredNodeProvider { @Override public Function<Node, Pair<Object, String>> getMapper() { return null; } @Inject ProcessTypeProvider(final SessionManager sessionManager); } | ProcessTypeProvider extends AbstractProcessFilteredNodeProvider { @Override public Function<Node, Pair<Object, String>> getMapper() { return null; } @Inject ProcessTypeProvider(final SessionManager sessionManager); @Override String getProviderName(); @Override Predicate<Node> getFilter(); @Override Function<Node, Pair<Object, String>> getMapper(); @Override @SuppressWarnings("unchecked") SelectorData getSelectorData(final FormRenderingContext context); } | ProcessTypeProvider extends AbstractProcessFilteredNodeProvider { @Override public Function<Node, Pair<Object, String>> getMapper() { return null; } @Inject ProcessTypeProvider(final SessionManager sessionManager); @Override String getProviderName(); @Override Predicate<Node> getFilter(); @Override Function<Node, Pair<Object, String>> getMapper(); @Override @SuppressWarnings("unchecked") SelectorData getSelectorData(final FormRenderingContext context); } |
@Test public void testOnProcessesUpdatedEvent() { ProcessDataEvent event = mock(ProcessDataEvent.class); when(event.getProcessIds()).thenReturn(new String[]{"p1", "p2"}); tested.onProcessesUpdatedEvent(event); verify(formsHandler, times(1)).refreshCurrentSessionForms(eq(BPMNDefinitionSet.class)); List<String> values = tested.getProcessIds(); assertNotNull(values); assertEquals(2, values.size()); assertTrue(values.contains("p1")); assertTrue(values.contains("p2")); } | void onProcessesUpdatedEvent(final @Observes ProcessDataEvent event) { setProcessIds(toList(event.getProcessIds())); } | ProcessesDataProvider { void onProcessesUpdatedEvent(final @Observes ProcessDataEvent event) { setProcessIds(toList(event.getProcessIds())); } } | ProcessesDataProvider { void onProcessesUpdatedEvent(final @Observes ProcessDataEvent event) { setProcessIds(toList(event.getProcessIds())); } ProcessesDataProvider(); @Inject ProcessesDataProvider(final StunnerFormsHandler formsHandler); } | ProcessesDataProvider { void onProcessesUpdatedEvent(final @Observes ProcessDataEvent event) { setProcessIds(toList(event.getProcessIds())); } ProcessesDataProvider(); @Inject ProcessesDataProvider(final StunnerFormsHandler formsHandler); List<String> getProcessIds(); } | ProcessesDataProvider { void onProcessesUpdatedEvent(final @Observes ProcessDataEvent event) { setProcessIds(toList(event.getProcessIds())); } ProcessesDataProvider(); @Inject ProcessesDataProvider(final StunnerFormsHandler formsHandler); List<String> getProcessIds(); } |
@Test public void emptyWidsTest() { List<WorkItemDefinition> defs = WorkItemDefinitionClientParser.parse(""); assertTrue(defs.isEmpty()); defs = WorkItemDefinitionClientParser.parse("[]"); assertTrue(defs.isEmpty()); defs = WorkItemDefinitionClientParser.parse("[\n]"); assertTrue(defs.isEmpty()); defs = WorkItemDefinitionClientParser.parse(null); assertTrue(defs.isEmpty()); } | public static List<WorkItemDefinition> parse(String widStr) { if (empty(widStr)) { return Collections.emptyList(); } List<WorkItemDefinition> widList = new ArrayList<>(); String[] lines = widStr.split("\r\n|\r|\n"); Queue<String> linesQueue = new LinkedList<>(Arrays.asList(lines)); while (!linesQueue.isEmpty()) { String line = linesQueue.peek().trim(); if (!(empty(line) || isStartingObject(line) || isEndingObject(line))) { WorkItemDefinition wid = parseWorkItemDefinitionObject(linesQueue); widList.add(wid); } linesQueue.poll(); } return widList; } | WorkItemDefinitionClientParser { public static List<WorkItemDefinition> parse(String widStr) { if (empty(widStr)) { return Collections.emptyList(); } List<WorkItemDefinition> widList = new ArrayList<>(); String[] lines = widStr.split("\r\n|\r|\n"); Queue<String> linesQueue = new LinkedList<>(Arrays.asList(lines)); while (!linesQueue.isEmpty()) { String line = linesQueue.peek().trim(); if (!(empty(line) || isStartingObject(line) || isEndingObject(line))) { WorkItemDefinition wid = parseWorkItemDefinitionObject(linesQueue); widList.add(wid); } linesQueue.poll(); } return widList; } } | WorkItemDefinitionClientParser { public static List<WorkItemDefinition> parse(String widStr) { if (empty(widStr)) { return Collections.emptyList(); } List<WorkItemDefinition> widList = new ArrayList<>(); String[] lines = widStr.split("\r\n|\r|\n"); Queue<String> linesQueue = new LinkedList<>(Arrays.asList(lines)); while (!linesQueue.isEmpty()) { String line = linesQueue.peek().trim(); if (!(empty(line) || isStartingObject(line) || isEndingObject(line))) { WorkItemDefinition wid = parseWorkItemDefinitionObject(linesQueue); widList.add(wid); } linesQueue.poll(); } return widList; } } | WorkItemDefinitionClientParser { public static List<WorkItemDefinition> parse(String widStr) { if (empty(widStr)) { return Collections.emptyList(); } List<WorkItemDefinition> widList = new ArrayList<>(); String[] lines = widStr.split("\r\n|\r|\n"); Queue<String> linesQueue = new LinkedList<>(Arrays.asList(lines)); while (!linesQueue.isEmpty()) { String line = linesQueue.peek().trim(); if (!(empty(line) || isStartingObject(line) || isEndingObject(line))) { WorkItemDefinition wid = parseWorkItemDefinitionObject(linesQueue); widList.add(wid); } linesQueue.poll(); } return widList; } static List<WorkItemDefinition> parse(String widStr); } | WorkItemDefinitionClientParser { public static List<WorkItemDefinition> parse(String widStr) { if (empty(widStr)) { return Collections.emptyList(); } List<WorkItemDefinition> widList = new ArrayList<>(); String[] lines = widStr.split("\r\n|\r|\n"); Queue<String> linesQueue = new LinkedList<>(Arrays.asList(lines)); while (!linesQueue.isEmpty()) { String line = linesQueue.peek().trim(); if (!(empty(line) || isStartingObject(line) || isEndingObject(line))) { WorkItemDefinition wid = parseWorkItemDefinitionObject(linesQueue); widList.add(wid); } linesQueue.poll(); } return widList; } static List<WorkItemDefinition> parse(String widStr); } |
@Test @SuppressWarnings("unchecked") public void testIsAutoConnection() { assertFalse(isAutoMagnetConnection(gatewayNode, taskNode)); assertFalse(isAutoMagnetConnection(gatewayNode, eventNode)); assertFalse(isAutoMagnetConnection(taskNode, gatewayNode)); assertFalse(isAutoMagnetConnection(eventNode, gatewayNode)); assertFalse(isAutoMagnetConnection(gatewayNode, gatewayNode)); assertTrue(isAutoMagnetConnection(taskNode, taskNode)); assertTrue(isAutoMagnetConnection(eventNode, taskNode)); assertTrue(isAutoMagnetConnection(taskNode, eventNode)); assertTrue(isAutoMagnetConnection(eventNode, eventNode)); } | public static boolean isAutoMagnetConnection(final Node<View<?>, Edge> sourceNode, final Node<View<?>, Edge> targetNode) { final Object sourceDefinition = null != sourceNode ? sourceNode.getContent().getDefinition() : null; final Object targetDefinition = null != targetNode ? targetNode.getContent().getDefinition() : null; final boolean isSourceGateway = isGateway(sourceDefinition); final boolean isTargetGateway = isGateway(targetDefinition); return !(isSourceGateway || isTargetGateway); } | BPMNCreateNodeAction extends GeneralCreateNodeAction { public static boolean isAutoMagnetConnection(final Node<View<?>, Edge> sourceNode, final Node<View<?>, Edge> targetNode) { final Object sourceDefinition = null != sourceNode ? sourceNode.getContent().getDefinition() : null; final Object targetDefinition = null != targetNode ? targetNode.getContent().getDefinition() : null; final boolean isSourceGateway = isGateway(sourceDefinition); final boolean isTargetGateway = isGateway(targetDefinition); return !(isSourceGateway || isTargetGateway); } } | BPMNCreateNodeAction extends GeneralCreateNodeAction { public static boolean isAutoMagnetConnection(final Node<View<?>, Edge> sourceNode, final Node<View<?>, Edge> targetNode) { final Object sourceDefinition = null != sourceNode ? sourceNode.getContent().getDefinition() : null; final Object targetDefinition = null != targetNode ? targetNode.getContent().getDefinition() : null; final boolean isSourceGateway = isGateway(sourceDefinition); final boolean isTargetGateway = isGateway(targetDefinition); return !(isSourceGateway || isTargetGateway); } @Inject BPMNCreateNodeAction(final DefinitionUtils definitionUtils,
final ClientFactoryManager clientFactoryManager,
final CanvasLayoutUtils canvasLayoutUtils,
final Event<CanvasSelectionEvent> selectionEvent,
final SessionCommandManager<AbstractCanvasHandler> sessionCommandManager,
final @Any ManagedInstance<DefaultCanvasCommandFactory> canvasCommandFactories); } | BPMNCreateNodeAction extends GeneralCreateNodeAction { public static boolean isAutoMagnetConnection(final Node<View<?>, Edge> sourceNode, final Node<View<?>, Edge> targetNode) { final Object sourceDefinition = null != sourceNode ? sourceNode.getContent().getDefinition() : null; final Object targetDefinition = null != targetNode ? targetNode.getContent().getDefinition() : null; final boolean isSourceGateway = isGateway(sourceDefinition); final boolean isTargetGateway = isGateway(targetDefinition); return !(isSourceGateway || isTargetGateway); } @Inject BPMNCreateNodeAction(final DefinitionUtils definitionUtils,
final ClientFactoryManager clientFactoryManager,
final CanvasLayoutUtils canvasLayoutUtils,
final Event<CanvasSelectionEvent> selectionEvent,
final SessionCommandManager<AbstractCanvasHandler> sessionCommandManager,
final @Any ManagedInstance<DefaultCanvasCommandFactory> canvasCommandFactories); static boolean isAutoMagnetConnection(final Node<View<?>, Edge> sourceNode,
final Node<View<?>, Edge> targetNode); } | BPMNCreateNodeAction extends GeneralCreateNodeAction { public static boolean isAutoMagnetConnection(final Node<View<?>, Edge> sourceNode, final Node<View<?>, Edge> targetNode) { final Object sourceDefinition = null != sourceNode ? sourceNode.getContent().getDefinition() : null; final Object targetDefinition = null != targetNode ? targetNode.getContent().getDefinition() : null; final boolean isSourceGateway = isGateway(sourceDefinition); final boolean isTargetGateway = isGateway(targetDefinition); return !(isSourceGateway || isTargetGateway); } @Inject BPMNCreateNodeAction(final DefinitionUtils definitionUtils,
final ClientFactoryManager clientFactoryManager,
final CanvasLayoutUtils canvasLayoutUtils,
final Event<CanvasSelectionEvent> selectionEvent,
final SessionCommandManager<AbstractCanvasHandler> sessionCommandManager,
final @Any ManagedInstance<DefaultCanvasCommandFactory> canvasCommandFactories); static boolean isAutoMagnetConnection(final Node<View<?>, Edge> sourceNode,
final Node<View<?>, Edge> targetNode); } |
@Test public void init() { tested.init(); FormFiltersProviderFactory.getFilterForDefinition(UUID, diagramDef); verify(bpmnDiagramFilterProvider).provideFilters(UUID, diagramDef); FormFiltersProviderFactory.getFilterForDefinition(UUID, startEventDef); verify(startEventFilterProvider).provideFilters(UUID, startEventDef); FormFiltersProviderFactory.getFilterForDefinition(UUID, intermediateEventDef); verify(catchingIntermediateEventFilterProvider).provideFilters(UUID, intermediateEventDef); } | @PostConstruct public void init() { PatternFlyBootstrapper.ensureMonacoEditorLoaderIsAvailable(); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartNoneEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartCompensationEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartSignalEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartMessageEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartErrorEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartTimerEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartConditionalEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartEscalationEvent.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateTimerEvent.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateErrorEventCatching.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateConditionalEvent.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateCompensationEvent.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateSignalEventCatching.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateLinkEventCatching.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateEscalationEvent.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateMessageEventCatching.class)); FormFiltersProviderFactory.registerProvider(new AssociationFilterProvider()); managedFilters.forEach(FormFiltersProviderFactory::registerProvider); } | StunnerBPMNEntryPoint { @PostConstruct public void init() { PatternFlyBootstrapper.ensureMonacoEditorLoaderIsAvailable(); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartNoneEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartCompensationEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartSignalEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartMessageEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartErrorEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartTimerEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartConditionalEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartEscalationEvent.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateTimerEvent.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateErrorEventCatching.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateConditionalEvent.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateCompensationEvent.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateSignalEventCatching.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateLinkEventCatching.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateEscalationEvent.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateMessageEventCatching.class)); FormFiltersProviderFactory.registerProvider(new AssociationFilterProvider()); managedFilters.forEach(FormFiltersProviderFactory::registerProvider); } } | StunnerBPMNEntryPoint { @PostConstruct public void init() { PatternFlyBootstrapper.ensureMonacoEditorLoaderIsAvailable(); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartNoneEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartCompensationEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartSignalEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartMessageEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartErrorEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartTimerEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartConditionalEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartEscalationEvent.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateTimerEvent.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateErrorEventCatching.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateConditionalEvent.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateCompensationEvent.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateSignalEventCatching.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateLinkEventCatching.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateEscalationEvent.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateMessageEventCatching.class)); FormFiltersProviderFactory.registerProvider(new AssociationFilterProvider()); managedFilters.forEach(FormFiltersProviderFactory::registerProvider); } @Inject StunnerBPMNEntryPoint(SessionManager sessionManager, ManagedInstance<StunnerFormElementFilterProvider> managedFilters); } | StunnerBPMNEntryPoint { @PostConstruct public void init() { PatternFlyBootstrapper.ensureMonacoEditorLoaderIsAvailable(); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartNoneEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartCompensationEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartSignalEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartMessageEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartErrorEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartTimerEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartConditionalEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartEscalationEvent.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateTimerEvent.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateErrorEventCatching.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateConditionalEvent.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateCompensationEvent.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateSignalEventCatching.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateLinkEventCatching.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateEscalationEvent.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateMessageEventCatching.class)); FormFiltersProviderFactory.registerProvider(new AssociationFilterProvider()); managedFilters.forEach(FormFiltersProviderFactory::registerProvider); } @Inject StunnerBPMNEntryPoint(SessionManager sessionManager, ManagedInstance<StunnerFormElementFilterProvider> managedFilters); @PostConstruct void init(); } | StunnerBPMNEntryPoint { @PostConstruct public void init() { PatternFlyBootstrapper.ensureMonacoEditorLoaderIsAvailable(); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartNoneEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartCompensationEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartSignalEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartMessageEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartErrorEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartTimerEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartConditionalEvent.class)); FormFiltersProviderFactory.registerProvider(new StartEventFilterProvider(sessionManager, StartEscalationEvent.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateTimerEvent.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateErrorEventCatching.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateConditionalEvent.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateCompensationEvent.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateSignalEventCatching.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateLinkEventCatching.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateEscalationEvent.class)); FormFiltersProviderFactory.registerProvider(new CatchingIntermediateEventFilterProvider(sessionManager, IntermediateMessageEventCatching.class)); FormFiltersProviderFactory.registerProvider(new AssociationFilterProvider()); managedFilters.forEach(FormFiltersProviderFactory::registerProvider); } @Inject StunnerBPMNEntryPoint(SessionManager sessionManager, ManagedInstance<StunnerFormElementFilterProvider> managedFilters); @PostConstruct void init(); } |
@Test public void validateSerialized() { Collection<BPMNViolation> violations = bpmnValidador.validate(getSerializedProcess(BPMN_VALID), PROCESS_UUID); assertTrue(violations.isEmpty()); } | @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } | BPMNValidatorImpl implements BPMNValidator { @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } } | BPMNValidatorImpl implements BPMNValidator { @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } BPMNValidatorImpl(); @Inject BPMNValidatorImpl(final @Default DiagramService diagramService); } | BPMNValidatorImpl implements BPMNValidator { @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } BPMNValidatorImpl(); @Inject BPMNValidatorImpl(final @Default DiagramService diagramService); @Override void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer); @Override String getDefinitionSetId(); } | BPMNValidatorImpl implements BPMNValidator { @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } BPMNValidatorImpl(); @Inject BPMNValidatorImpl(final @Default DiagramService diagramService); @Override void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer); @Override String getDefinitionSetId(); } |
@Test public void validateWithExceptionsOnParsingXML() { final Collection<BPMNViolation> violations = bpmnValidador.validate("INVALID_XML", PROCESS_UUID); assertProcessException(violations); } | @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } | BPMNValidatorImpl implements BPMNValidator { @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } } | BPMNValidatorImpl implements BPMNValidator { @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } BPMNValidatorImpl(); @Inject BPMNValidatorImpl(final @Default DiagramService diagramService); } | BPMNValidatorImpl implements BPMNValidator { @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } BPMNValidatorImpl(); @Inject BPMNValidatorImpl(final @Default DiagramService diagramService); @Override void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer); @Override String getDefinitionSetId(); } | BPMNValidatorImpl implements BPMNValidator { @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } BPMNValidatorImpl(); @Inject BPMNValidatorImpl(final @Default DiagramService diagramService); @Override void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer); @Override String getDefinitionSetId(); } |
@Test public void testShow() { final HTMLElement viewElement = mock(HTMLElement.class); when(view.getElement()).thenReturn(viewElement); viewElement.classList = mock(DOMTokenList.class); item.show(); verify(viewElement.classList).remove(HIDDEN_CSS_CLASS); } | public void show() { HiddenHelper.show(getView().getElement()); } | DecisionComponentsItem { public void show() { HiddenHelper.show(getView().getElement()); } } | DecisionComponentsItem { public void show() { HiddenHelper.show(getView().getElement()); } @Inject DecisionComponentsItem(final View view); } | DecisionComponentsItem { public void show() { HiddenHelper.show(getView().getElement()); } @Inject DecisionComponentsItem(final View view); @PostConstruct void init(); View getView(); void setDecisionComponent(final DecisionComponent decisionComponent); void show(); void hide(); DRGElement getDrgElement(); } | DecisionComponentsItem { public void show() { HiddenHelper.show(getView().getElement()); } @Inject DecisionComponentsItem(final View view); @PostConstruct void init(); View getView(); void setDecisionComponent(final DecisionComponent decisionComponent); void show(); void hide(); DRGElement getDrgElement(); } |
@Test public void validateWithException() { when(diagram.getMetadata()).thenThrow(new RuntimeException()); final Collection<BPMNViolation> violations = bpmnValidador.validate(null, PROCESS_UUID); assertProcessException(violations); } | @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } | BPMNValidatorImpl implements BPMNValidator { @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } } | BPMNValidatorImpl implements BPMNValidator { @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } BPMNValidatorImpl(); @Inject BPMNValidatorImpl(final @Default DiagramService diagramService); } | BPMNValidatorImpl implements BPMNValidator { @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } BPMNValidatorImpl(); @Inject BPMNValidatorImpl(final @Default DiagramService diagramService); @Override void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer); @Override String getDefinitionSetId(); } | BPMNValidatorImpl implements BPMNValidator { @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } BPMNValidatorImpl(); @Inject BPMNValidatorImpl(final @Default DiagramService diagramService); @Override void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer); @Override String getDefinitionSetId(); } |
@Test public void validateWithViolation() { when(diagramService.getRawContent(diagram)).thenReturn(getSerializedProcess(BPMN_VALIDATION_ISSUES)); bpmnValidador.validate(diagram, result -> { assertNotNull(result); assertEquals(10, result.size()); assertTrue(result.stream().map(DomainViolation::getViolationType).allMatch(t -> Violation.Type.WARNING.equals(t))); assertEquals(10, result.stream().map(DomainViolation::getUUID).filter(StringUtils::nonEmpty).count()); assertEquals(4, result.stream() .map(DomainViolation::getUUID) .filter("_426E32AD-E08B-4025-B201-9850EEC82254"::equals) .count()); assertEquals(3, result.stream() .map(DomainViolation::getUUID) .filter("_3E6C197E-FF8A-41F4-AEB6-710454E8529C"::equals) .count()); assertEquals(1, result.stream() .map(DomainViolation::getUUID) .filter("_0F455E77-669C-480F-A4A2-C5070EF1A83F"::equals) .count()); assertEquals(2, result.stream() .map(DomainViolation::getUUID) .filter("_5B1068ED-1260-41FD-B7C1-226CB909E569"::equals) .count()); }); } | @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } | BPMNValidatorImpl implements BPMNValidator { @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } } | BPMNValidatorImpl implements BPMNValidator { @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } BPMNValidatorImpl(); @Inject BPMNValidatorImpl(final @Default DiagramService diagramService); } | BPMNValidatorImpl implements BPMNValidator { @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } BPMNValidatorImpl(); @Inject BPMNValidatorImpl(final @Default DiagramService diagramService); @Override void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer); @Override String getDefinitionSetId(); } | BPMNValidatorImpl implements BPMNValidator { @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } BPMNValidatorImpl(); @Inject BPMNValidatorImpl(final @Default DiagramService diagramService); @Override void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer); @Override String getDefinitionSetId(); } |
@Test public void validateNoViolations() { when(diagramService.getRawContent(diagram)).thenReturn(getSerializedProcess(BPMN_VALID)); bpmnValidador.validate(diagram, result -> { assertNotNull(result); assertTrue(result.isEmpty()); }); } | @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } | BPMNValidatorImpl implements BPMNValidator { @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } } | BPMNValidatorImpl implements BPMNValidator { @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } BPMNValidatorImpl(); @Inject BPMNValidatorImpl(final @Default DiagramService diagramService); } | BPMNValidatorImpl implements BPMNValidator { @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } BPMNValidatorImpl(); @Inject BPMNValidatorImpl(final @Default DiagramService diagramService); @Override void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer); @Override String getDefinitionSetId(); } | BPMNValidatorImpl implements BPMNValidator { @Override public void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer) { String rawContent = diagramService.getRawContent(diagram); if (Objects.nonNull(rawContent)) { resultConsumer.accept(validate(rawContent, diagram.getMetadata().getTitle()).stream().collect(Collectors.toSet())); return; } resultConsumer.accept(Collections.emptyList()); } BPMNValidatorImpl(); @Inject BPMNValidatorImpl(final @Default DiagramService diagramService); @Override void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer); @Override String getDefinitionSetId(); } |
@Test public void getDefinitionSetId() { assertEquals(bpmnValidador.getDefinitionSetId(), BindableAdapterUtils.getDefinitionId(BPMNDefinitionSet.class)); } | @Override public String getDefinitionSetId() { return BindableAdapterUtils.getDefinitionSetId(BPMNDefinitionSet.class); } | BPMNValidatorImpl implements BPMNValidator { @Override public String getDefinitionSetId() { return BindableAdapterUtils.getDefinitionSetId(BPMNDefinitionSet.class); } } | BPMNValidatorImpl implements BPMNValidator { @Override public String getDefinitionSetId() { return BindableAdapterUtils.getDefinitionSetId(BPMNDefinitionSet.class); } BPMNValidatorImpl(); @Inject BPMNValidatorImpl(final @Default DiagramService diagramService); } | BPMNValidatorImpl implements BPMNValidator { @Override public String getDefinitionSetId() { return BindableAdapterUtils.getDefinitionSetId(BPMNDefinitionSet.class); } BPMNValidatorImpl(); @Inject BPMNValidatorImpl(final @Default DiagramService diagramService); @Override void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer); @Override String getDefinitionSetId(); } | BPMNValidatorImpl implements BPMNValidator { @Override public String getDefinitionSetId() { return BindableAdapterUtils.getDefinitionSetId(BPMNDefinitionSet.class); } BPMNValidatorImpl(); @Inject BPMNValidatorImpl(final @Default DiagramService diagramService); @Override void validate(Diagram diagram, Consumer<Collection<DomainViolation>> resultConsumer); @Override String getDefinitionSetId(); } |
@Test public void flowElementDecorator() { MarshallingMessageDecorator<FlowElement> decorator = BPMNElementDecorators.flowElementDecorator(); FlowElement element = mock(FlowElement.class); when(element.getName()).thenReturn(NAME); assertEquals(NAME, decorator.getName(element)); assertEquals(element.getClass().getSimpleName(), decorator.getType(element)); } | public static <T extends FlowElement> MarshallingMessageDecorator<T> flowElementDecorator() { return MarshallingMessageDecorator.of(o -> Optional.ofNullable(o.getName()) .orElseGet(o::getId), g -> g.getClass().getSimpleName()); } | BPMNElementDecorators { public static <T extends FlowElement> MarshallingMessageDecorator<T> flowElementDecorator() { return MarshallingMessageDecorator.of(o -> Optional.ofNullable(o.getName()) .orElseGet(o::getId), g -> g.getClass().getSimpleName()); } } | BPMNElementDecorators { public static <T extends FlowElement> MarshallingMessageDecorator<T> flowElementDecorator() { return MarshallingMessageDecorator.of(o -> Optional.ofNullable(o.getName()) .orElseGet(o::getId), g -> g.getClass().getSimpleName()); } } | BPMNElementDecorators { public static <T extends FlowElement> MarshallingMessageDecorator<T> flowElementDecorator() { return MarshallingMessageDecorator.of(o -> Optional.ofNullable(o.getName()) .orElseGet(o::getId), g -> g.getClass().getSimpleName()); } static MarshallingMessageDecorator<T> flowElementDecorator(); static MarshallingMessageDecorator<T> baseElementDecorator(); static MarshallingMessageDecorator<T> bpmnNodeDecorator(); static MarshallingMessageDecorator<Result> resultBpmnDecorator(); } | BPMNElementDecorators { public static <T extends FlowElement> MarshallingMessageDecorator<T> flowElementDecorator() { return MarshallingMessageDecorator.of(o -> Optional.ofNullable(o.getName()) .orElseGet(o::getId), g -> g.getClass().getSimpleName()); } static MarshallingMessageDecorator<T> flowElementDecorator(); static MarshallingMessageDecorator<T> baseElementDecorator(); static MarshallingMessageDecorator<T> bpmnNodeDecorator(); static MarshallingMessageDecorator<Result> resultBpmnDecorator(); } |
@Test public void baseElementDecorator() { MarshallingMessageDecorator<BaseElement> decorator = BPMNElementDecorators.baseElementDecorator(); BaseElement element = mock(FlowElement.class); when(element.getId()).thenReturn(NAME); assertEquals(NAME, decorator.getName(element)); assertEquals(element.getClass().getSimpleName(), decorator.getType(element)); } | public static <T extends BaseElement> MarshallingMessageDecorator<T> baseElementDecorator() { return MarshallingMessageDecorator.of(BaseElement::getId, g -> g.getClass().getSimpleName()); } | BPMNElementDecorators { public static <T extends BaseElement> MarshallingMessageDecorator<T> baseElementDecorator() { return MarshallingMessageDecorator.of(BaseElement::getId, g -> g.getClass().getSimpleName()); } } | BPMNElementDecorators { public static <T extends BaseElement> MarshallingMessageDecorator<T> baseElementDecorator() { return MarshallingMessageDecorator.of(BaseElement::getId, g -> g.getClass().getSimpleName()); } } | BPMNElementDecorators { public static <T extends BaseElement> MarshallingMessageDecorator<T> baseElementDecorator() { return MarshallingMessageDecorator.of(BaseElement::getId, g -> g.getClass().getSimpleName()); } static MarshallingMessageDecorator<T> flowElementDecorator(); static MarshallingMessageDecorator<T> baseElementDecorator(); static MarshallingMessageDecorator<T> bpmnNodeDecorator(); static MarshallingMessageDecorator<Result> resultBpmnDecorator(); } | BPMNElementDecorators { public static <T extends BaseElement> MarshallingMessageDecorator<T> baseElementDecorator() { return MarshallingMessageDecorator.of(BaseElement::getId, g -> g.getClass().getSimpleName()); } static MarshallingMessageDecorator<T> flowElementDecorator(); static MarshallingMessageDecorator<T> baseElementDecorator(); static MarshallingMessageDecorator<T> bpmnNodeDecorator(); static MarshallingMessageDecorator<Result> resultBpmnDecorator(); } |
@Test public void bpmnNodeDecorator() { MarshallingMessageDecorator<BpmnNode> decorator = BPMNElementDecorators.bpmnNodeDecorator(); BpmnNode element = mockBpmnNode(); assertEquals(NAME, decorator.getName(element)); assertEquals(element.value().getContent().getDefinition().getClass().getSimpleName(), decorator.getType(element)); } | public static <T extends BpmnNode> MarshallingMessageDecorator<T> bpmnNodeDecorator() { return MarshallingMessageDecorator.of(o -> Optional.ofNullable(o.value() .getContent() .getDefinition() .getGeneral() .getName() .getValue()) .orElseGet(() -> o.value().getUUID()), bpmnNode -> bpmnNode.value() .getContent() .getDefinition() .getClass() .getSimpleName()); } | BPMNElementDecorators { public static <T extends BpmnNode> MarshallingMessageDecorator<T> bpmnNodeDecorator() { return MarshallingMessageDecorator.of(o -> Optional.ofNullable(o.value() .getContent() .getDefinition() .getGeneral() .getName() .getValue()) .orElseGet(() -> o.value().getUUID()), bpmnNode -> bpmnNode.value() .getContent() .getDefinition() .getClass() .getSimpleName()); } } | BPMNElementDecorators { public static <T extends BpmnNode> MarshallingMessageDecorator<T> bpmnNodeDecorator() { return MarshallingMessageDecorator.of(o -> Optional.ofNullable(o.value() .getContent() .getDefinition() .getGeneral() .getName() .getValue()) .orElseGet(() -> o.value().getUUID()), bpmnNode -> bpmnNode.value() .getContent() .getDefinition() .getClass() .getSimpleName()); } } | BPMNElementDecorators { public static <T extends BpmnNode> MarshallingMessageDecorator<T> bpmnNodeDecorator() { return MarshallingMessageDecorator.of(o -> Optional.ofNullable(o.value() .getContent() .getDefinition() .getGeneral() .getName() .getValue()) .orElseGet(() -> o.value().getUUID()), bpmnNode -> bpmnNode.value() .getContent() .getDefinition() .getClass() .getSimpleName()); } static MarshallingMessageDecorator<T> flowElementDecorator(); static MarshallingMessageDecorator<T> baseElementDecorator(); static MarshallingMessageDecorator<T> bpmnNodeDecorator(); static MarshallingMessageDecorator<Result> resultBpmnDecorator(); } | BPMNElementDecorators { public static <T extends BpmnNode> MarshallingMessageDecorator<T> bpmnNodeDecorator() { return MarshallingMessageDecorator.of(o -> Optional.ofNullable(o.value() .getContent() .getDefinition() .getGeneral() .getName() .getValue()) .orElseGet(() -> o.value().getUUID()), bpmnNode -> bpmnNode.value() .getContent() .getDefinition() .getClass() .getSimpleName()); } static MarshallingMessageDecorator<T> flowElementDecorator(); static MarshallingMessageDecorator<T> baseElementDecorator(); static MarshallingMessageDecorator<T> bpmnNodeDecorator(); static MarshallingMessageDecorator<Result> resultBpmnDecorator(); } |
@Test public void resultBpmnDecorator() { MarshallingMessageDecorator<Result> decorator = BPMNElementDecorators.resultBpmnDecorator(); BpmnNode node = mockBpmnNode(); Result result = Result.success(node); assertEquals(NAME, decorator.getName(result)); assertEquals(node.value().getContent().getDefinition().getClass().getSimpleName(), decorator.getType(result)); } | public static MarshallingMessageDecorator<Result> resultBpmnDecorator() { return MarshallingMessageDecorator.of(r -> { BpmnNode o = (BpmnNode) r.value(); return Optional.ofNullable(o.value() .getContent() .getDefinition() .getGeneral() .getName() .getValue()) .orElseGet(() -> o.value().getUUID()); }, r -> { BpmnNode o1 = (BpmnNode) r.value(); return o1.value() .getContent() .getDefinition() .getClass() .getSimpleName(); }); } | BPMNElementDecorators { public static MarshallingMessageDecorator<Result> resultBpmnDecorator() { return MarshallingMessageDecorator.of(r -> { BpmnNode o = (BpmnNode) r.value(); return Optional.ofNullable(o.value() .getContent() .getDefinition() .getGeneral() .getName() .getValue()) .orElseGet(() -> o.value().getUUID()); }, r -> { BpmnNode o1 = (BpmnNode) r.value(); return o1.value() .getContent() .getDefinition() .getClass() .getSimpleName(); }); } } | BPMNElementDecorators { public static MarshallingMessageDecorator<Result> resultBpmnDecorator() { return MarshallingMessageDecorator.of(r -> { BpmnNode o = (BpmnNode) r.value(); return Optional.ofNullable(o.value() .getContent() .getDefinition() .getGeneral() .getName() .getValue()) .orElseGet(() -> o.value().getUUID()); }, r -> { BpmnNode o1 = (BpmnNode) r.value(); return o1.value() .getContent() .getDefinition() .getClass() .getSimpleName(); }); } } | BPMNElementDecorators { public static MarshallingMessageDecorator<Result> resultBpmnDecorator() { return MarshallingMessageDecorator.of(r -> { BpmnNode o = (BpmnNode) r.value(); return Optional.ofNullable(o.value() .getContent() .getDefinition() .getGeneral() .getName() .getValue()) .orElseGet(() -> o.value().getUUID()); }, r -> { BpmnNode o1 = (BpmnNode) r.value(); return o1.value() .getContent() .getDefinition() .getClass() .getSimpleName(); }); } static MarshallingMessageDecorator<T> flowElementDecorator(); static MarshallingMessageDecorator<T> baseElementDecorator(); static MarshallingMessageDecorator<T> bpmnNodeDecorator(); static MarshallingMessageDecorator<Result> resultBpmnDecorator(); } | BPMNElementDecorators { public static MarshallingMessageDecorator<Result> resultBpmnDecorator() { return MarshallingMessageDecorator.of(r -> { BpmnNode o = (BpmnNode) r.value(); return Optional.ofNullable(o.value() .getContent() .getDefinition() .getGeneral() .getName() .getValue()) .orElseGet(() -> o.value().getUUID()); }, r -> { BpmnNode o1 = (BpmnNode) r.value(); return o1.value() .getContent() .getDefinition() .getClass() .getSimpleName(); }); } static MarshallingMessageDecorator<T> flowElementDecorator(); static MarshallingMessageDecorator<T> baseElementDecorator(); static MarshallingMessageDecorator<T> bpmnNodeDecorator(); static MarshallingMessageDecorator<Result> resultBpmnDecorator(); } |
@Test public void whenExactlyTest() { UserTaskImpl element = (UserTaskImpl) Bpmn2Factory.eINSTANCE.createUserTask(); Result<BpmnNode> result = match().apply(element); verify(assertUserTask).apply(element); assertTrue(result.isSuccess()); } | public <Sub> Match<In, Out> whenExactly(Class<Sub> type, Function<Sub, Out> then) { Function<Sub, Result<Out>> thenWrapped = sub -> Result.of(then.apply(sub)); return whenExactly_(type, thenWrapped); } | Match { public <Sub> Match<In, Out> whenExactly(Class<Sub> type, Function<Sub, Out> then) { Function<Sub, Result<Out>> thenWrapped = sub -> Result.of(then.apply(sub)); return whenExactly_(type, thenWrapped); } } | Match { public <Sub> Match<In, Out> whenExactly(Class<Sub> type, Function<Sub, Out> then) { Function<Sub, Result<Out>> thenWrapped = sub -> Result.of(then.apply(sub)); return whenExactly_(type, thenWrapped); } Match(Class<?> outputType); } | Match { public <Sub> Match<In, Out> whenExactly(Class<Sub> type, Function<Sub, Out> then) { Function<Sub, Result<Out>> thenWrapped = sub -> Result.of(then.apply(sub)); return whenExactly_(type, thenWrapped); } Match(Class<?> outputType); static Match<In, Out> of(Class<In> inputType, Class<Out> outputType); static Match<In, Node<? extends View<? extends Out>, ?>> ofNode(Class<In> inputType, Class<Out> outputType); static Match<Node<? extends View<? extends In>, ?>, Out> fromNode(Class<In> inputType, Class<Out> outputType); static Match<In, Edge<? extends View<? extends Out>, ?>> ofEdge(Class<In> inputType, Class<Out> outputType); Match<In, Out> when(Class<Sub> type, Function<Sub, Out> then); Match<In, Out> whenExactly(Class<Sub> type, Function<Sub, Out> then); Match<In, Out> missing(Class<Sub> type); Match<In, Out> ignore(Class<Sub> type); Match<In, Out> ignore(Class<Sub> type, Out outValue); Match<In, Out> orElse(Function<In, Out> then); Match<In, Out> inputDecorator(MarshallingMessageDecorator<In> decorator); Match<In, Out> outputDecorator(MarshallingMessageDecorator<Out> decorator); Match<In, Out> defaultValue(Out value); Match<In, Out> mode(Mode mode); Result<Out> apply(In value); } | Match { public <Sub> Match<In, Out> whenExactly(Class<Sub> type, Function<Sub, Out> then) { Function<Sub, Result<Out>> thenWrapped = sub -> Result.of(then.apply(sub)); return whenExactly_(type, thenWrapped); } Match(Class<?> outputType); static Match<In, Out> of(Class<In> inputType, Class<Out> outputType); static Match<In, Node<? extends View<? extends Out>, ?>> ofNode(Class<In> inputType, Class<Out> outputType); static Match<Node<? extends View<? extends In>, ?>, Out> fromNode(Class<In> inputType, Class<Out> outputType); static Match<In, Edge<? extends View<? extends Out>, ?>> ofEdge(Class<In> inputType, Class<Out> outputType); Match<In, Out> when(Class<Sub> type, Function<Sub, Out> then); Match<In, Out> whenExactly(Class<Sub> type, Function<Sub, Out> then); Match<In, Out> missing(Class<Sub> type); Match<In, Out> ignore(Class<Sub> type); Match<In, Out> ignore(Class<Sub> type, Out outValue); Match<In, Out> orElse(Function<In, Out> then); Match<In, Out> inputDecorator(MarshallingMessageDecorator<In> decorator); Match<In, Out> outputDecorator(MarshallingMessageDecorator<Out> decorator); Match<In, Out> defaultValue(Out value); Match<In, Out> mode(Mode mode); Result<Out> apply(In value); } |
@Test public void whenTest() { EventSubprocess element = Bpmn2Factory.eINSTANCE.createEventSubprocess(); Result<BpmnNode> result = match().apply(element); verify(assertSubProcess).apply(element); assertNotEquals(result.value(), defaultValue); assertTrue(result.isSuccess()); } | public <Sub> Match<In, Out> when(Class<Sub> type, Function<Sub, Out> then) { Function<Sub, Result<Out>> thenWrapped = sub -> Result.of(then.apply(sub)); return when_(type, thenWrapped); } | Match { public <Sub> Match<In, Out> when(Class<Sub> type, Function<Sub, Out> then) { Function<Sub, Result<Out>> thenWrapped = sub -> Result.of(then.apply(sub)); return when_(type, thenWrapped); } } | Match { public <Sub> Match<In, Out> when(Class<Sub> type, Function<Sub, Out> then) { Function<Sub, Result<Out>> thenWrapped = sub -> Result.of(then.apply(sub)); return when_(type, thenWrapped); } Match(Class<?> outputType); } | Match { public <Sub> Match<In, Out> when(Class<Sub> type, Function<Sub, Out> then) { Function<Sub, Result<Out>> thenWrapped = sub -> Result.of(then.apply(sub)); return when_(type, thenWrapped); } Match(Class<?> outputType); static Match<In, Out> of(Class<In> inputType, Class<Out> outputType); static Match<In, Node<? extends View<? extends Out>, ?>> ofNode(Class<In> inputType, Class<Out> outputType); static Match<Node<? extends View<? extends In>, ?>, Out> fromNode(Class<In> inputType, Class<Out> outputType); static Match<In, Edge<? extends View<? extends Out>, ?>> ofEdge(Class<In> inputType, Class<Out> outputType); Match<In, Out> when(Class<Sub> type, Function<Sub, Out> then); Match<In, Out> whenExactly(Class<Sub> type, Function<Sub, Out> then); Match<In, Out> missing(Class<Sub> type); Match<In, Out> ignore(Class<Sub> type); Match<In, Out> ignore(Class<Sub> type, Out outValue); Match<In, Out> orElse(Function<In, Out> then); Match<In, Out> inputDecorator(MarshallingMessageDecorator<In> decorator); Match<In, Out> outputDecorator(MarshallingMessageDecorator<Out> decorator); Match<In, Out> defaultValue(Out value); Match<In, Out> mode(Mode mode); Result<Out> apply(In value); } | Match { public <Sub> Match<In, Out> when(Class<Sub> type, Function<Sub, Out> then) { Function<Sub, Result<Out>> thenWrapped = sub -> Result.of(then.apply(sub)); return when_(type, thenWrapped); } Match(Class<?> outputType); static Match<In, Out> of(Class<In> inputType, Class<Out> outputType); static Match<In, Node<? extends View<? extends Out>, ?>> ofNode(Class<In> inputType, Class<Out> outputType); static Match<Node<? extends View<? extends In>, ?>, Out> fromNode(Class<In> inputType, Class<Out> outputType); static Match<In, Edge<? extends View<? extends Out>, ?>> ofEdge(Class<In> inputType, Class<Out> outputType); Match<In, Out> when(Class<Sub> type, Function<Sub, Out> then); Match<In, Out> whenExactly(Class<Sub> type, Function<Sub, Out> then); Match<In, Out> missing(Class<Sub> type); Match<In, Out> ignore(Class<Sub> type); Match<In, Out> ignore(Class<Sub> type, Out outValue); Match<In, Out> orElse(Function<In, Out> then); Match<In, Out> inputDecorator(MarshallingMessageDecorator<In> decorator); Match<In, Out> outputDecorator(MarshallingMessageDecorator<Out> decorator); Match<In, Out> defaultValue(Out value); Match<In, Out> mode(Mode mode); Result<Out> apply(In value); } |
@Test public void testHide() { final HTMLElement viewElement = mock(HTMLElement.class); when(view.getElement()).thenReturn(viewElement); viewElement.classList = mock(DOMTokenList.class); item.hide(); verify(viewElement.classList).add(HIDDEN_CSS_CLASS); } | public void hide() { HiddenHelper.hide(getView().getElement()); } | DecisionComponentsItem { public void hide() { HiddenHelper.hide(getView().getElement()); } } | DecisionComponentsItem { public void hide() { HiddenHelper.hide(getView().getElement()); } @Inject DecisionComponentsItem(final View view); } | DecisionComponentsItem { public void hide() { HiddenHelper.hide(getView().getElement()); } @Inject DecisionComponentsItem(final View view); @PostConstruct void init(); View getView(); void setDecisionComponent(final DecisionComponent decisionComponent); void show(); void hide(); DRGElement getDrgElement(); } | DecisionComponentsItem { public void hide() { HiddenHelper.hide(getView().getElement()); } @Inject DecisionComponentsItem(final View view); @PostConstruct void init(); View getView(); void setDecisionComponent(final DecisionComponent decisionComponent); void show(); void hide(); DRGElement getDrgElement(); } |
@Test public void missingTest() { ReceiveTask element = Bpmn2Factory.eINSTANCE.createReceiveTask(); Result<BpmnNode> result = match().apply(element); assertEquals(result.value(), defaultValue); assertTrue(result.isFailure()); } | public <Sub> Match<In, Out> missing(Class<Sub> type) { return when_(type, reportMissing(type)); } | Match { public <Sub> Match<In, Out> missing(Class<Sub> type) { return when_(type, reportMissing(type)); } } | Match { public <Sub> Match<In, Out> missing(Class<Sub> type) { return when_(type, reportMissing(type)); } Match(Class<?> outputType); } | Match { public <Sub> Match<In, Out> missing(Class<Sub> type) { return when_(type, reportMissing(type)); } Match(Class<?> outputType); static Match<In, Out> of(Class<In> inputType, Class<Out> outputType); static Match<In, Node<? extends View<? extends Out>, ?>> ofNode(Class<In> inputType, Class<Out> outputType); static Match<Node<? extends View<? extends In>, ?>, Out> fromNode(Class<In> inputType, Class<Out> outputType); static Match<In, Edge<? extends View<? extends Out>, ?>> ofEdge(Class<In> inputType, Class<Out> outputType); Match<In, Out> when(Class<Sub> type, Function<Sub, Out> then); Match<In, Out> whenExactly(Class<Sub> type, Function<Sub, Out> then); Match<In, Out> missing(Class<Sub> type); Match<In, Out> ignore(Class<Sub> type); Match<In, Out> ignore(Class<Sub> type, Out outValue); Match<In, Out> orElse(Function<In, Out> then); Match<In, Out> inputDecorator(MarshallingMessageDecorator<In> decorator); Match<In, Out> outputDecorator(MarshallingMessageDecorator<Out> decorator); Match<In, Out> defaultValue(Out value); Match<In, Out> mode(Mode mode); Result<Out> apply(In value); } | Match { public <Sub> Match<In, Out> missing(Class<Sub> type) { return when_(type, reportMissing(type)); } Match(Class<?> outputType); static Match<In, Out> of(Class<In> inputType, Class<Out> outputType); static Match<In, Node<? extends View<? extends Out>, ?>> ofNode(Class<In> inputType, Class<Out> outputType); static Match<Node<? extends View<? extends In>, ?>, Out> fromNode(Class<In> inputType, Class<Out> outputType); static Match<In, Edge<? extends View<? extends Out>, ?>> ofEdge(Class<In> inputType, Class<Out> outputType); Match<In, Out> when(Class<Sub> type, Function<Sub, Out> then); Match<In, Out> whenExactly(Class<Sub> type, Function<Sub, Out> then); Match<In, Out> missing(Class<Sub> type); Match<In, Out> ignore(Class<Sub> type); Match<In, Out> ignore(Class<Sub> type, Out outValue); Match<In, Out> orElse(Function<In, Out> then); Match<In, Out> inputDecorator(MarshallingMessageDecorator<In> decorator); Match<In, Out> outputDecorator(MarshallingMessageDecorator<Out> decorator); Match<In, Out> defaultValue(Out value); Match<In, Out> mode(Mode mode); Result<Out> apply(In value); } |
@Test public void convertEdge() { org.eclipse.bpmn2.SequenceFlow sequenceFlow = Bpmn2Factory.eINSTANCE.createSequenceFlow(); FlowNode source = Bpmn2Factory.eINSTANCE.createUserTask(); sequenceFlow.setSourceRef(source); FlowNode target = Bpmn2Factory.eINSTANCE.createBusinessRuleTask(); sequenceFlow.setTargetRef(target); Result<BpmnEdge> result = tested.convertEdge(sequenceFlow, new HashMap<>()); assertTrue(result.isIgnored()); assertNull(result.value()); Map<String, BpmnNode> nodes = new Maps.Builder<String, BpmnNode>() .put(SOURCE_ID, mock(BpmnNode.class)) .put(TARGET_ID, mock(BpmnNode.class)) .build(); result = tested.convertEdge(sequenceFlow, nodes); assertTrue(result.isSuccess()); BpmnEdge.Simple value = (BpmnEdge.Simple) result.value(); assertEquals(edge, value.getEdge()); } | @Override public Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.SequenceFlow seq, Map<String, BpmnNode> nodes) { Edge<View<SequenceFlow>, Node> edge = factoryManager.newEdge(seq.getId(), SequenceFlow.class); SequenceFlow definition = edge.getContent().getDefinition(); SequenceFlowPropertyReader p = propertyReaderFactory.of(seq); definition.setGeneral(new BPMNGeneralSet( new Name(p.getName()), new Documentation(p.getDocumentation()) )); definition.setExecutionSet(new SequenceFlowExecutionSet( new Priority(p.getPriority()), new ConditionExpression(p.getConditionExpression()) )); return result(nodes, edge, p, "Sequence Flow ignored from " + p.getSourceId() + " to " + p.getTargetId(), MarshallingMessageKeys.sequenceFlowIgnored); } | SequenceFlowConverter implements EdgeConverter<org.eclipse.bpmn2.SequenceFlow> { @Override public Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.SequenceFlow seq, Map<String, BpmnNode> nodes) { Edge<View<SequenceFlow>, Node> edge = factoryManager.newEdge(seq.getId(), SequenceFlow.class); SequenceFlow definition = edge.getContent().getDefinition(); SequenceFlowPropertyReader p = propertyReaderFactory.of(seq); definition.setGeneral(new BPMNGeneralSet( new Name(p.getName()), new Documentation(p.getDocumentation()) )); definition.setExecutionSet(new SequenceFlowExecutionSet( new Priority(p.getPriority()), new ConditionExpression(p.getConditionExpression()) )); return result(nodes, edge, p, "Sequence Flow ignored from " + p.getSourceId() + " to " + p.getTargetId(), MarshallingMessageKeys.sequenceFlowIgnored); } } | SequenceFlowConverter implements EdgeConverter<org.eclipse.bpmn2.SequenceFlow> { @Override public Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.SequenceFlow seq, Map<String, BpmnNode> nodes) { Edge<View<SequenceFlow>, Node> edge = factoryManager.newEdge(seq.getId(), SequenceFlow.class); SequenceFlow definition = edge.getContent().getDefinition(); SequenceFlowPropertyReader p = propertyReaderFactory.of(seq); definition.setGeneral(new BPMNGeneralSet( new Name(p.getName()), new Documentation(p.getDocumentation()) )); definition.setExecutionSet(new SequenceFlowExecutionSet( new Priority(p.getPriority()), new ConditionExpression(p.getConditionExpression()) )); return result(nodes, edge, p, "Sequence Flow ignored from " + p.getSourceId() + " to " + p.getTargetId(), MarshallingMessageKeys.sequenceFlowIgnored); } SequenceFlowConverter(TypedFactoryManager factoryManager, PropertyReaderFactory propertyReaderFactory); } | SequenceFlowConverter implements EdgeConverter<org.eclipse.bpmn2.SequenceFlow> { @Override public Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.SequenceFlow seq, Map<String, BpmnNode> nodes) { Edge<View<SequenceFlow>, Node> edge = factoryManager.newEdge(seq.getId(), SequenceFlow.class); SequenceFlow definition = edge.getContent().getDefinition(); SequenceFlowPropertyReader p = propertyReaderFactory.of(seq); definition.setGeneral(new BPMNGeneralSet( new Name(p.getName()), new Documentation(p.getDocumentation()) )); definition.setExecutionSet(new SequenceFlowExecutionSet( new Priority(p.getPriority()), new ConditionExpression(p.getConditionExpression()) )); return result(nodes, edge, p, "Sequence Flow ignored from " + p.getSourceId() + " to " + p.getTargetId(), MarshallingMessageKeys.sequenceFlowIgnored); } SequenceFlowConverter(TypedFactoryManager factoryManager, PropertyReaderFactory propertyReaderFactory); @Override Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.SequenceFlow seq, Map<String, BpmnNode> nodes); } | SequenceFlowConverter implements EdgeConverter<org.eclipse.bpmn2.SequenceFlow> { @Override public Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.SequenceFlow seq, Map<String, BpmnNode> nodes) { Edge<View<SequenceFlow>, Node> edge = factoryManager.newEdge(seq.getId(), SequenceFlow.class); SequenceFlow definition = edge.getContent().getDefinition(); SequenceFlowPropertyReader p = propertyReaderFactory.of(seq); definition.setGeneral(new BPMNGeneralSet( new Name(p.getName()), new Documentation(p.getDocumentation()) )); definition.setExecutionSet(new SequenceFlowExecutionSet( new Priority(p.getPriority()), new ConditionExpression(p.getConditionExpression()) )); return result(nodes, edge, p, "Sequence Flow ignored from " + p.getSourceId() + " to " + p.getTargetId(), MarshallingMessageKeys.sequenceFlowIgnored); } SequenceFlowConverter(TypedFactoryManager factoryManager, PropertyReaderFactory propertyReaderFactory); @Override Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.SequenceFlow seq, Map<String, BpmnNode> nodes); } |
@Test public void convertTextAnnotation() { TextAnnotation element = Bpmn2Factory.eINSTANCE.createTextAnnotation(); when(typedFactoryManager.newNode(anyString(), eq(org.kie.workbench.common.stunner.bpmn.definition.TextAnnotation.class))).thenReturn(nodeTextAnnotation); when(nodeTextAnnotation.getContent()).thenReturn(contentTextAnnotation); when(contentTextAnnotation.getDefinition()).thenReturn(defTextAnnotation); when(propertyReaderFactory.of(element)).thenReturn(readerTextAnnotation); final Result<BpmnNode> node = tested.convert(element); final Node<? extends View<? extends BPMNViewDefinition>, ?> value = node.value().value(); assertEquals(contentTextAnnotation, value.getContent()); assertEquals(defTextAnnotation, value.getContent().getDefinition()); } | @Override public Result<BpmnNode> convert(org.eclipse.bpmn2.FlowElement element) { return Match.of(FlowElement.class, BpmnNode.class) .when(org.eclipse.bpmn2.TextAnnotation.class, this::toTextAnnotation) .when(org.eclipse.bpmn2.DataObjectReference.class, this::toDataObject) .apply(element); } | ArtifactsConverter implements NodeConverter<org.eclipse.bpmn2.FlowElement> { @Override public Result<BpmnNode> convert(org.eclipse.bpmn2.FlowElement element) { return Match.of(FlowElement.class, BpmnNode.class) .when(org.eclipse.bpmn2.TextAnnotation.class, this::toTextAnnotation) .when(org.eclipse.bpmn2.DataObjectReference.class, this::toDataObject) .apply(element); } } | ArtifactsConverter implements NodeConverter<org.eclipse.bpmn2.FlowElement> { @Override public Result<BpmnNode> convert(org.eclipse.bpmn2.FlowElement element) { return Match.of(FlowElement.class, BpmnNode.class) .when(org.eclipse.bpmn2.TextAnnotation.class, this::toTextAnnotation) .when(org.eclipse.bpmn2.DataObjectReference.class, this::toDataObject) .apply(element); } ArtifactsConverter(TypedFactoryManager typedFactoryManager, PropertyReaderFactory propertyReaderFactory); } | ArtifactsConverter implements NodeConverter<org.eclipse.bpmn2.FlowElement> { @Override public Result<BpmnNode> convert(org.eclipse.bpmn2.FlowElement element) { return Match.of(FlowElement.class, BpmnNode.class) .when(org.eclipse.bpmn2.TextAnnotation.class, this::toTextAnnotation) .when(org.eclipse.bpmn2.DataObjectReference.class, this::toDataObject) .apply(element); } ArtifactsConverter(TypedFactoryManager typedFactoryManager, PropertyReaderFactory propertyReaderFactory); @Override Result<BpmnNode> convert(org.eclipse.bpmn2.FlowElement element); } | ArtifactsConverter implements NodeConverter<org.eclipse.bpmn2.FlowElement> { @Override public Result<BpmnNode> convert(org.eclipse.bpmn2.FlowElement element) { return Match.of(FlowElement.class, BpmnNode.class) .when(org.eclipse.bpmn2.TextAnnotation.class, this::toTextAnnotation) .when(org.eclipse.bpmn2.DataObjectReference.class, this::toDataObject) .apply(element); } ArtifactsConverter(TypedFactoryManager typedFactoryManager, PropertyReaderFactory propertyReaderFactory); @Override Result<BpmnNode> convert(org.eclipse.bpmn2.FlowElement element); } |
@Test public void convertDataObject() { DataObjectReference element = Bpmn2Factory.eINSTANCE.createDataObjectReference(); when(typedFactoryManager.newNode(anyString(), eq(org.kie.workbench.common.stunner.bpmn.definition.DataObject.class))).thenReturn(nodeDataObject); when(nodeDataObject.getContent()).thenReturn(contentDataObject); when(contentDataObject.getDefinition()).thenReturn(defDataObject); when(propertyReaderFactory.of(element)).thenReturn(readerDataObject); final Result<BpmnNode> node = tested.convert(element); final Node<? extends View<? extends BPMNViewDefinition>, ?> value = node.value().value(); assertEquals(contentDataObject, value.getContent()); assertEquals(defDataObject, value.getContent().getDefinition()); } | @Override public Result<BpmnNode> convert(org.eclipse.bpmn2.FlowElement element) { return Match.of(FlowElement.class, BpmnNode.class) .when(org.eclipse.bpmn2.TextAnnotation.class, this::toTextAnnotation) .when(org.eclipse.bpmn2.DataObjectReference.class, this::toDataObject) .apply(element); } | ArtifactsConverter implements NodeConverter<org.eclipse.bpmn2.FlowElement> { @Override public Result<BpmnNode> convert(org.eclipse.bpmn2.FlowElement element) { return Match.of(FlowElement.class, BpmnNode.class) .when(org.eclipse.bpmn2.TextAnnotation.class, this::toTextAnnotation) .when(org.eclipse.bpmn2.DataObjectReference.class, this::toDataObject) .apply(element); } } | ArtifactsConverter implements NodeConverter<org.eclipse.bpmn2.FlowElement> { @Override public Result<BpmnNode> convert(org.eclipse.bpmn2.FlowElement element) { return Match.of(FlowElement.class, BpmnNode.class) .when(org.eclipse.bpmn2.TextAnnotation.class, this::toTextAnnotation) .when(org.eclipse.bpmn2.DataObjectReference.class, this::toDataObject) .apply(element); } ArtifactsConverter(TypedFactoryManager typedFactoryManager, PropertyReaderFactory propertyReaderFactory); } | ArtifactsConverter implements NodeConverter<org.eclipse.bpmn2.FlowElement> { @Override public Result<BpmnNode> convert(org.eclipse.bpmn2.FlowElement element) { return Match.of(FlowElement.class, BpmnNode.class) .when(org.eclipse.bpmn2.TextAnnotation.class, this::toTextAnnotation) .when(org.eclipse.bpmn2.DataObjectReference.class, this::toDataObject) .apply(element); } ArtifactsConverter(TypedFactoryManager typedFactoryManager, PropertyReaderFactory propertyReaderFactory); @Override Result<BpmnNode> convert(org.eclipse.bpmn2.FlowElement element); } | ArtifactsConverter implements NodeConverter<org.eclipse.bpmn2.FlowElement> { @Override public Result<BpmnNode> convert(org.eclipse.bpmn2.FlowElement element) { return Match.of(FlowElement.class, BpmnNode.class) .when(org.eclipse.bpmn2.TextAnnotation.class, this::toTextAnnotation) .when(org.eclipse.bpmn2.DataObjectReference.class, this::toDataObject) .apply(element); } ArtifactsConverter(TypedFactoryManager typedFactoryManager, PropertyReaderFactory propertyReaderFactory); @Override Result<BpmnNode> convert(org.eclipse.bpmn2.FlowElement element); } |
@Test public void testIsCase_true() { String id = UUID.randomUUID().toString(); CallActivity callActivity = bpmn2.createCallActivity(); callActivity.setId(id); CustomElement.isCase.of(callActivity).set(Boolean.TRUE); tested = new CallActivityPropertyReader(callActivity, definitionResolver.getDiagram(), definitionResolver); assertTrue(tested.isCase()); } | public boolean isCase() { return CustomElement.isCase.of(element).get(); } | CallActivityPropertyReader extends MultipleInstanceActivityPropertyReader { public boolean isCase() { return CustomElement.isCase.of(element).get(); } } | CallActivityPropertyReader extends MultipleInstanceActivityPropertyReader { public boolean isCase() { return CustomElement.isCase.of(element).get(); } CallActivityPropertyReader(CallActivity callActivity, BPMNDiagram diagram, DefinitionResolver definitionResolver); } | CallActivityPropertyReader extends MultipleInstanceActivityPropertyReader { public boolean isCase() { return CustomElement.isCase.of(element).get(); } CallActivityPropertyReader(CallActivity callActivity, BPMNDiagram diagram, DefinitionResolver definitionResolver); String getCalledElement(); boolean isIndependent(); boolean isAbortParent(); boolean isWaitForCompletion(); boolean isAsync(); boolean isCase(); boolean isAdHocAutostart(); String getSlaDueDate(); } | CallActivityPropertyReader extends MultipleInstanceActivityPropertyReader { public boolean isCase() { return CustomElement.isCase.of(element).get(); } CallActivityPropertyReader(CallActivity callActivity, BPMNDiagram diagram, DefinitionResolver definitionResolver); String getCalledElement(); boolean isIndependent(); boolean isAbortParent(); boolean isWaitForCompletion(); boolean isAsync(); boolean isCase(); boolean isAdHocAutostart(); String getSlaDueDate(); } |
@Test public void testIsCase_false() { String id = UUID.randomUUID().toString(); CallActivity callActivity = bpmn2.createCallActivity(); callActivity.setId(id); CustomElement.isCase.of(callActivity).set(Boolean.FALSE); tested = new CallActivityPropertyReader(callActivity, definitionResolver.getDiagram(), definitionResolver); assertFalse(tested.isCase()); } | public boolean isCase() { return CustomElement.isCase.of(element).get(); } | CallActivityPropertyReader extends MultipleInstanceActivityPropertyReader { public boolean isCase() { return CustomElement.isCase.of(element).get(); } } | CallActivityPropertyReader extends MultipleInstanceActivityPropertyReader { public boolean isCase() { return CustomElement.isCase.of(element).get(); } CallActivityPropertyReader(CallActivity callActivity, BPMNDiagram diagram, DefinitionResolver definitionResolver); } | CallActivityPropertyReader extends MultipleInstanceActivityPropertyReader { public boolean isCase() { return CustomElement.isCase.of(element).get(); } CallActivityPropertyReader(CallActivity callActivity, BPMNDiagram diagram, DefinitionResolver definitionResolver); String getCalledElement(); boolean isIndependent(); boolean isAbortParent(); boolean isWaitForCompletion(); boolean isAsync(); boolean isCase(); boolean isAdHocAutostart(); String getSlaDueDate(); } | CallActivityPropertyReader extends MultipleInstanceActivityPropertyReader { public boolean isCase() { return CustomElement.isCase.of(element).get(); } CallActivityPropertyReader(CallActivity callActivity, BPMNDiagram diagram, DefinitionResolver definitionResolver); String getCalledElement(); boolean isIndependent(); boolean isAbortParent(); boolean isWaitForCompletion(); boolean isAsync(); boolean isCase(); boolean isAdHocAutostart(); String getSlaDueDate(); } |
@Test public void testIsAdHocAutostart_true() { String id = UUID.randomUUID().toString(); CallActivity callActivity = bpmn2.createCallActivity(); callActivity.setId(id); CustomElement.autoStart.of(callActivity).set(Boolean.TRUE); tested = new CallActivityPropertyReader(callActivity, definitionResolver.getDiagram(), definitionResolver); assertTrue(tested.isAdHocAutostart()); } | public boolean isAdHocAutostart() { return CustomElement.autoStart.of(element).get(); } | CallActivityPropertyReader extends MultipleInstanceActivityPropertyReader { public boolean isAdHocAutostart() { return CustomElement.autoStart.of(element).get(); } } | CallActivityPropertyReader extends MultipleInstanceActivityPropertyReader { public boolean isAdHocAutostart() { return CustomElement.autoStart.of(element).get(); } CallActivityPropertyReader(CallActivity callActivity, BPMNDiagram diagram, DefinitionResolver definitionResolver); } | CallActivityPropertyReader extends MultipleInstanceActivityPropertyReader { public boolean isAdHocAutostart() { return CustomElement.autoStart.of(element).get(); } CallActivityPropertyReader(CallActivity callActivity, BPMNDiagram diagram, DefinitionResolver definitionResolver); String getCalledElement(); boolean isIndependent(); boolean isAbortParent(); boolean isWaitForCompletion(); boolean isAsync(); boolean isCase(); boolean isAdHocAutostart(); String getSlaDueDate(); } | CallActivityPropertyReader extends MultipleInstanceActivityPropertyReader { public boolean isAdHocAutostart() { return CustomElement.autoStart.of(element).get(); } CallActivityPropertyReader(CallActivity callActivity, BPMNDiagram diagram, DefinitionResolver definitionResolver); String getCalledElement(); boolean isIndependent(); boolean isAbortParent(); boolean isWaitForCompletion(); boolean isAsync(); boolean isCase(); boolean isAdHocAutostart(); String getSlaDueDate(); } |
@Test public void testIsAdHocAutostart_false() { String id = UUID.randomUUID().toString(); CallActivity callActivity = bpmn2.createCallActivity(); callActivity.setId(id); CustomElement.autoStart.of(callActivity).set(Boolean.FALSE); tested = new CallActivityPropertyReader(callActivity, definitionResolver.getDiagram(), definitionResolver); assertFalse(tested.isAdHocAutostart()); } | public boolean isAdHocAutostart() { return CustomElement.autoStart.of(element).get(); } | CallActivityPropertyReader extends MultipleInstanceActivityPropertyReader { public boolean isAdHocAutostart() { return CustomElement.autoStart.of(element).get(); } } | CallActivityPropertyReader extends MultipleInstanceActivityPropertyReader { public boolean isAdHocAutostart() { return CustomElement.autoStart.of(element).get(); } CallActivityPropertyReader(CallActivity callActivity, BPMNDiagram diagram, DefinitionResolver definitionResolver); } | CallActivityPropertyReader extends MultipleInstanceActivityPropertyReader { public boolean isAdHocAutostart() { return CustomElement.autoStart.of(element).get(); } CallActivityPropertyReader(CallActivity callActivity, BPMNDiagram diagram, DefinitionResolver definitionResolver); String getCalledElement(); boolean isIndependent(); boolean isAbortParent(); boolean isWaitForCompletion(); boolean isAsync(); boolean isCase(); boolean isAdHocAutostart(); String getSlaDueDate(); } | CallActivityPropertyReader extends MultipleInstanceActivityPropertyReader { public boolean isAdHocAutostart() { return CustomElement.autoStart.of(element).get(); } CallActivityPropertyReader(CallActivity callActivity, BPMNDiagram diagram, DefinitionResolver definitionResolver); String getCalledElement(); boolean isIndependent(); boolean isAbortParent(); boolean isWaitForCompletion(); boolean isAsync(); boolean isCase(); boolean isAdHocAutostart(); String getSlaDueDate(); } |
@Test public void testIsAsync() { CallActivity callActivity = bpmn2.createCallActivity(); CustomElement.async.of(callActivity).set(Boolean.TRUE); tested = new CallActivityPropertyReader(callActivity, definitionResolver.getDiagram(), definitionResolver); assertTrue(tested.isAsync()); } | public boolean isAsync() { return CustomElement.async.of(element).get(); } | CallActivityPropertyReader extends MultipleInstanceActivityPropertyReader { public boolean isAsync() { return CustomElement.async.of(element).get(); } } | CallActivityPropertyReader extends MultipleInstanceActivityPropertyReader { public boolean isAsync() { return CustomElement.async.of(element).get(); } CallActivityPropertyReader(CallActivity callActivity, BPMNDiagram diagram, DefinitionResolver definitionResolver); } | CallActivityPropertyReader extends MultipleInstanceActivityPropertyReader { public boolean isAsync() { return CustomElement.async.of(element).get(); } CallActivityPropertyReader(CallActivity callActivity, BPMNDiagram diagram, DefinitionResolver definitionResolver); String getCalledElement(); boolean isIndependent(); boolean isAbortParent(); boolean isWaitForCompletion(); boolean isAsync(); boolean isCase(); boolean isAdHocAutostart(); String getSlaDueDate(); } | CallActivityPropertyReader extends MultipleInstanceActivityPropertyReader { public boolean isAsync() { return CustomElement.async.of(element).get(); } CallActivityPropertyReader(CallActivity callActivity, BPMNDiagram diagram, DefinitionResolver definitionResolver); String getCalledElement(); boolean isIndependent(); boolean isAbortParent(); boolean isWaitForCompletion(); boolean isAsync(); boolean isCase(); boolean isAdHocAutostart(); String getSlaDueDate(); } |
@Test public void testGetSlaDueDate() { String rawSlaDueDate = "12/25/1983"; CallActivity callActivity = bpmn2.createCallActivity(); CustomElement.slaDueDate.of(callActivity).set(rawSlaDueDate); tested = new CallActivityPropertyReader(callActivity, definitionResolver.getDiagram(), definitionResolver); assertTrue(tested.getSlaDueDate().contains(rawSlaDueDate)); } | public String getSlaDueDate() { return CustomElement.slaDueDate.of(element).get(); } | CallActivityPropertyReader extends MultipleInstanceActivityPropertyReader { public String getSlaDueDate() { return CustomElement.slaDueDate.of(element).get(); } } | CallActivityPropertyReader extends MultipleInstanceActivityPropertyReader { public String getSlaDueDate() { return CustomElement.slaDueDate.of(element).get(); } CallActivityPropertyReader(CallActivity callActivity, BPMNDiagram diagram, DefinitionResolver definitionResolver); } | CallActivityPropertyReader extends MultipleInstanceActivityPropertyReader { public String getSlaDueDate() { return CustomElement.slaDueDate.of(element).get(); } CallActivityPropertyReader(CallActivity callActivity, BPMNDiagram diagram, DefinitionResolver definitionResolver); String getCalledElement(); boolean isIndependent(); boolean isAbortParent(); boolean isWaitForCompletion(); boolean isAsync(); boolean isCase(); boolean isAdHocAutostart(); String getSlaDueDate(); } | CallActivityPropertyReader extends MultipleInstanceActivityPropertyReader { public String getSlaDueDate() { return CustomElement.slaDueDate.of(element).get(); } CallActivityPropertyReader(CallActivity callActivity, BPMNDiagram diagram, DefinitionResolver definitionResolver); String getCalledElement(); boolean isIndependent(); boolean isAbortParent(); boolean isWaitForCompletion(); boolean isAsync(); boolean isCase(); boolean isAdHocAutostart(); String getSlaDueDate(); } |
@Test public void testGetDrgElement() { final DecisionComponent decisionComponent = mock(DecisionComponent.class); final DRGElement expectedDrgElement = null; when(decisionComponent.getDrgElement()).thenReturn(expectedDrgElement); doReturn(decisionComponent).when(item).getDecisionComponent(); final DRGElement actualDrgElement = item.getDrgElement(); assertEquals(expectedDrgElement, actualDrgElement); } | public DRGElement getDrgElement() { return getDecisionComponent().getDrgElement(); } | DecisionComponentsItem { public DRGElement getDrgElement() { return getDecisionComponent().getDrgElement(); } } | DecisionComponentsItem { public DRGElement getDrgElement() { return getDecisionComponent().getDrgElement(); } @Inject DecisionComponentsItem(final View view); } | DecisionComponentsItem { public DRGElement getDrgElement() { return getDecisionComponent().getDrgElement(); } @Inject DecisionComponentsItem(final View view); @PostConstruct void init(); View getView(); void setDecisionComponent(final DecisionComponent decisionComponent); void show(); void hide(); DRGElement getDrgElement(); } | DecisionComponentsItem { public DRGElement getDrgElement() { return getDecisionComponent().getDrgElement(); } @Inject DecisionComponentsItem(final View view); @PostConstruct void init(); View getView(); void setDecisionComponent(final DecisionComponent decisionComponent); void show(); void hide(); DRGElement getDrgElement(); } |
@Test public void getExtendedName() { String name = tested.getName(); assertEquals("custom", name); } | public String getName() { return CustomElement.name.of(element).get(); } | DataObjectPropertyReader extends BasePropertyReader { public String getName() { return CustomElement.name.of(element).get(); } } | DataObjectPropertyReader extends BasePropertyReader { public String getName() { return CustomElement.name.of(element).get(); } DataObjectPropertyReader(DataObjectReference ref, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); } | DataObjectPropertyReader extends BasePropertyReader { public String getName() { return CustomElement.name.of(element).get(); } DataObjectPropertyReader(DataObjectReference ref, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); String getName(); String getType(); } | DataObjectPropertyReader extends BasePropertyReader { public String getName() { return CustomElement.name.of(element).get(); } DataObjectPropertyReader(DataObjectReference ref, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); String getName(); String getType(); } |
@Test public void getName() { when(dataObject.getExtensionValues()).thenReturn(Collections.emptyList()); String name = tested.getName(); assertEquals("name", name); } | public String getName() { return CustomElement.name.of(element).get(); } | DataObjectPropertyReader extends BasePropertyReader { public String getName() { return CustomElement.name.of(element).get(); } } | DataObjectPropertyReader extends BasePropertyReader { public String getName() { return CustomElement.name.of(element).get(); } DataObjectPropertyReader(DataObjectReference ref, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); } | DataObjectPropertyReader extends BasePropertyReader { public String getName() { return CustomElement.name.of(element).get(); } DataObjectPropertyReader(DataObjectReference ref, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); String getName(); String getType(); } | DataObjectPropertyReader extends BasePropertyReader { public String getName() { return CustomElement.name.of(element).get(); } DataObjectPropertyReader(DataObjectReference ref, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); String getName(); String getType(); } |
@Test public void testNullBody() { final Assignment assignment = createAssignment(null); final InputAssignmentReader iar = new InputAssignmentReader(assignment, ID); final AssociationDeclaration associationDeclaration = iar.getAssociationDeclaration(); assertEquals(AssociationDeclaration.Type.FromTo, associationDeclaration.getType()); assertEquals("", associationDeclaration.getSource()); } | public AssociationDeclaration getAssociationDeclaration() { return associationDeclaration; } | InputAssignmentReader { public AssociationDeclaration getAssociationDeclaration() { return associationDeclaration; } } | InputAssignmentReader { public AssociationDeclaration getAssociationDeclaration() { return associationDeclaration; } InputAssignmentReader(Assignment assignment, String targetName); InputAssignmentReader(ItemAwareElement source, String targetName); } | InputAssignmentReader { public AssociationDeclaration getAssociationDeclaration() { return associationDeclaration; } InputAssignmentReader(Assignment assignment, String targetName); InputAssignmentReader(ItemAwareElement source, String targetName); static InputAssignmentReader fromAssociation(DataInputAssociation in); AssociationDeclaration getAssociationDeclaration(); } | InputAssignmentReader { public AssociationDeclaration getAssociationDeclaration() { return associationDeclaration; } InputAssignmentReader(Assignment assignment, String targetName); InputAssignmentReader(ItemAwareElement source, String targetName); static InputAssignmentReader fromAssociation(DataInputAssociation in); AssociationDeclaration getAssociationDeclaration(); } |
@Test public void testGetSourcePositionWithNoWaypoint() { when(edge.getWaypoint()).thenReturn(Collections.emptyList()); Point2D point = PropertyReaderUtils.getSourcePosition(definitionResolver, EDGE_ID, SHAPE_ID); assertPoint(BOUNDS_WIDTH, BOUNDS_HEIGHT / 2, point); } | public static Point2D getSourcePosition(DefinitionResolver definitionResolver, String edgeId, String sourceId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final Bounds sourceBounds = definitionResolver.getShape(sourceId).getBounds(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); return waypoint.isEmpty() ? sourcePosition(sourceBounds, resolutionFactor) : offsetPosition(sourceBounds, waypoint.get(0), resolutionFactor); } | PropertyReaderUtils { public static Point2D getSourcePosition(DefinitionResolver definitionResolver, String edgeId, String sourceId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final Bounds sourceBounds = definitionResolver.getShape(sourceId).getBounds(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); return waypoint.isEmpty() ? sourcePosition(sourceBounds, resolutionFactor) : offsetPosition(sourceBounds, waypoint.get(0), resolutionFactor); } } | PropertyReaderUtils { public static Point2D getSourcePosition(DefinitionResolver definitionResolver, String edgeId, String sourceId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final Bounds sourceBounds = definitionResolver.getShape(sourceId).getBounds(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); return waypoint.isEmpty() ? sourcePosition(sourceBounds, resolutionFactor) : offsetPosition(sourceBounds, waypoint.get(0), resolutionFactor); } } | PropertyReaderUtils { public static Point2D getSourcePosition(DefinitionResolver definitionResolver, String edgeId, String sourceId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final Bounds sourceBounds = definitionResolver.getShape(sourceId).getBounds(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); return waypoint.isEmpty() ? sourcePosition(sourceBounds, resolutionFactor) : offsetPosition(sourceBounds, waypoint.get(0), resolutionFactor); } static Point2D getSourcePosition(DefinitionResolver definitionResolver,
String edgeId,
String sourceId); static Point2D getTargetPosition(DefinitionResolver definitionResolver,
String edgeId,
String targetId); static List<Point2D> getControlPoints(DefinitionResolver definitionResolver,
String edgeId); static boolean isAutoConnectionSource(BaseElement element); static boolean isAutoConnectionTarget(BaseElement element); static WSDLImport toWSDLImports(Import imp); } | PropertyReaderUtils { public static Point2D getSourcePosition(DefinitionResolver definitionResolver, String edgeId, String sourceId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final Bounds sourceBounds = definitionResolver.getShape(sourceId).getBounds(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); return waypoint.isEmpty() ? sourcePosition(sourceBounds, resolutionFactor) : offsetPosition(sourceBounds, waypoint.get(0), resolutionFactor); } static Point2D getSourcePosition(DefinitionResolver definitionResolver,
String edgeId,
String sourceId); static Point2D getTargetPosition(DefinitionResolver definitionResolver,
String edgeId,
String targetId); static List<Point2D> getControlPoints(DefinitionResolver definitionResolver,
String edgeId); static boolean isAutoConnectionSource(BaseElement element); static boolean isAutoConnectionTarget(BaseElement element); static WSDLImport toWSDLImports(Import imp); } |
@Test public void testGetSourcePositionWithWaypoint() { when(edge.getWaypoint()).thenReturn(Collections.singletonList(point)); Point2D point = PropertyReaderUtils.getSourcePosition(definitionResolver, EDGE_ID, SHAPE_ID); assertPoint(WAY_POINT_X - BOUNDS_X, WAY_POINT_Y - BOUNDS_Y, point); } | public static Point2D getSourcePosition(DefinitionResolver definitionResolver, String edgeId, String sourceId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final Bounds sourceBounds = definitionResolver.getShape(sourceId).getBounds(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); return waypoint.isEmpty() ? sourcePosition(sourceBounds, resolutionFactor) : offsetPosition(sourceBounds, waypoint.get(0), resolutionFactor); } | PropertyReaderUtils { public static Point2D getSourcePosition(DefinitionResolver definitionResolver, String edgeId, String sourceId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final Bounds sourceBounds = definitionResolver.getShape(sourceId).getBounds(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); return waypoint.isEmpty() ? sourcePosition(sourceBounds, resolutionFactor) : offsetPosition(sourceBounds, waypoint.get(0), resolutionFactor); } } | PropertyReaderUtils { public static Point2D getSourcePosition(DefinitionResolver definitionResolver, String edgeId, String sourceId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final Bounds sourceBounds = definitionResolver.getShape(sourceId).getBounds(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); return waypoint.isEmpty() ? sourcePosition(sourceBounds, resolutionFactor) : offsetPosition(sourceBounds, waypoint.get(0), resolutionFactor); } } | PropertyReaderUtils { public static Point2D getSourcePosition(DefinitionResolver definitionResolver, String edgeId, String sourceId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final Bounds sourceBounds = definitionResolver.getShape(sourceId).getBounds(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); return waypoint.isEmpty() ? sourcePosition(sourceBounds, resolutionFactor) : offsetPosition(sourceBounds, waypoint.get(0), resolutionFactor); } static Point2D getSourcePosition(DefinitionResolver definitionResolver,
String edgeId,
String sourceId); static Point2D getTargetPosition(DefinitionResolver definitionResolver,
String edgeId,
String targetId); static List<Point2D> getControlPoints(DefinitionResolver definitionResolver,
String edgeId); static boolean isAutoConnectionSource(BaseElement element); static boolean isAutoConnectionTarget(BaseElement element); static WSDLImport toWSDLImports(Import imp); } | PropertyReaderUtils { public static Point2D getSourcePosition(DefinitionResolver definitionResolver, String edgeId, String sourceId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final Bounds sourceBounds = definitionResolver.getShape(sourceId).getBounds(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); return waypoint.isEmpty() ? sourcePosition(sourceBounds, resolutionFactor) : offsetPosition(sourceBounds, waypoint.get(0), resolutionFactor); } static Point2D getSourcePosition(DefinitionResolver definitionResolver,
String edgeId,
String sourceId); static Point2D getTargetPosition(DefinitionResolver definitionResolver,
String edgeId,
String targetId); static List<Point2D> getControlPoints(DefinitionResolver definitionResolver,
String edgeId); static boolean isAutoConnectionSource(BaseElement element); static boolean isAutoConnectionTarget(BaseElement element); static WSDLImport toWSDLImports(Import imp); } |
@Test public void testGetTargetPositionWithNoWaypoint() { when(edge.getWaypoint()).thenReturn(Collections.emptyList()); Point2D point = PropertyReaderUtils.getTargetPosition(definitionResolver, EDGE_ID, SHAPE_ID); assertPoint(0, BOUNDS_HEIGHT / 2, point); } | public static Point2D getTargetPosition(DefinitionResolver definitionResolver, String edgeId, String targetId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final Bounds targetBounds = definitionResolver.getShape(targetId).getBounds(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); return waypoint.isEmpty() ? targetPosition(targetBounds, resolutionFactor) : offsetPosition(targetBounds, waypoint.get(waypoint.size() - 1), resolutionFactor); } | PropertyReaderUtils { public static Point2D getTargetPosition(DefinitionResolver definitionResolver, String edgeId, String targetId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final Bounds targetBounds = definitionResolver.getShape(targetId).getBounds(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); return waypoint.isEmpty() ? targetPosition(targetBounds, resolutionFactor) : offsetPosition(targetBounds, waypoint.get(waypoint.size() - 1), resolutionFactor); } } | PropertyReaderUtils { public static Point2D getTargetPosition(DefinitionResolver definitionResolver, String edgeId, String targetId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final Bounds targetBounds = definitionResolver.getShape(targetId).getBounds(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); return waypoint.isEmpty() ? targetPosition(targetBounds, resolutionFactor) : offsetPosition(targetBounds, waypoint.get(waypoint.size() - 1), resolutionFactor); } } | PropertyReaderUtils { public static Point2D getTargetPosition(DefinitionResolver definitionResolver, String edgeId, String targetId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final Bounds targetBounds = definitionResolver.getShape(targetId).getBounds(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); return waypoint.isEmpty() ? targetPosition(targetBounds, resolutionFactor) : offsetPosition(targetBounds, waypoint.get(waypoint.size() - 1), resolutionFactor); } static Point2D getSourcePosition(DefinitionResolver definitionResolver,
String edgeId,
String sourceId); static Point2D getTargetPosition(DefinitionResolver definitionResolver,
String edgeId,
String targetId); static List<Point2D> getControlPoints(DefinitionResolver definitionResolver,
String edgeId); static boolean isAutoConnectionSource(BaseElement element); static boolean isAutoConnectionTarget(BaseElement element); static WSDLImport toWSDLImports(Import imp); } | PropertyReaderUtils { public static Point2D getTargetPosition(DefinitionResolver definitionResolver, String edgeId, String targetId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final Bounds targetBounds = definitionResolver.getShape(targetId).getBounds(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); return waypoint.isEmpty() ? targetPosition(targetBounds, resolutionFactor) : offsetPosition(targetBounds, waypoint.get(waypoint.size() - 1), resolutionFactor); } static Point2D getSourcePosition(DefinitionResolver definitionResolver,
String edgeId,
String sourceId); static Point2D getTargetPosition(DefinitionResolver definitionResolver,
String edgeId,
String targetId); static List<Point2D> getControlPoints(DefinitionResolver definitionResolver,
String edgeId); static boolean isAutoConnectionSource(BaseElement element); static boolean isAutoConnectionTarget(BaseElement element); static WSDLImport toWSDLImports(Import imp); } |
@Test public void testGetTargetPositionWithWaypoint() { when(edge.getWaypoint()).thenReturn(Collections.singletonList(point)); Point2D point = PropertyReaderUtils.getTargetPosition(definitionResolver, EDGE_ID, SHAPE_ID); assertPoint(WAY_POINT_X - BOUNDS_X, WAY_POINT_Y - BOUNDS_Y, point); } | public static Point2D getTargetPosition(DefinitionResolver definitionResolver, String edgeId, String targetId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final Bounds targetBounds = definitionResolver.getShape(targetId).getBounds(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); return waypoint.isEmpty() ? targetPosition(targetBounds, resolutionFactor) : offsetPosition(targetBounds, waypoint.get(waypoint.size() - 1), resolutionFactor); } | PropertyReaderUtils { public static Point2D getTargetPosition(DefinitionResolver definitionResolver, String edgeId, String targetId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final Bounds targetBounds = definitionResolver.getShape(targetId).getBounds(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); return waypoint.isEmpty() ? targetPosition(targetBounds, resolutionFactor) : offsetPosition(targetBounds, waypoint.get(waypoint.size() - 1), resolutionFactor); } } | PropertyReaderUtils { public static Point2D getTargetPosition(DefinitionResolver definitionResolver, String edgeId, String targetId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final Bounds targetBounds = definitionResolver.getShape(targetId).getBounds(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); return waypoint.isEmpty() ? targetPosition(targetBounds, resolutionFactor) : offsetPosition(targetBounds, waypoint.get(waypoint.size() - 1), resolutionFactor); } } | PropertyReaderUtils { public static Point2D getTargetPosition(DefinitionResolver definitionResolver, String edgeId, String targetId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final Bounds targetBounds = definitionResolver.getShape(targetId).getBounds(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); return waypoint.isEmpty() ? targetPosition(targetBounds, resolutionFactor) : offsetPosition(targetBounds, waypoint.get(waypoint.size() - 1), resolutionFactor); } static Point2D getSourcePosition(DefinitionResolver definitionResolver,
String edgeId,
String sourceId); static Point2D getTargetPosition(DefinitionResolver definitionResolver,
String edgeId,
String targetId); static List<Point2D> getControlPoints(DefinitionResolver definitionResolver,
String edgeId); static boolean isAutoConnectionSource(BaseElement element); static boolean isAutoConnectionTarget(BaseElement element); static WSDLImport toWSDLImports(Import imp); } | PropertyReaderUtils { public static Point2D getTargetPosition(DefinitionResolver definitionResolver, String edgeId, String targetId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final Bounds targetBounds = definitionResolver.getShape(targetId).getBounds(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); return waypoint.isEmpty() ? targetPosition(targetBounds, resolutionFactor) : offsetPosition(targetBounds, waypoint.get(waypoint.size() - 1), resolutionFactor); } static Point2D getSourcePosition(DefinitionResolver definitionResolver,
String edgeId,
String sourceId); static Point2D getTargetPosition(DefinitionResolver definitionResolver,
String edgeId,
String targetId); static List<Point2D> getControlPoints(DefinitionResolver definitionResolver,
String edgeId); static boolean isAutoConnectionSource(BaseElement element); static boolean isAutoConnectionTarget(BaseElement element); static WSDLImport toWSDLImports(Import imp); } |
@Test public void testGetControlPointsWhenZeroPoints() { when(edge.getWaypoint()).thenReturn(Collections.emptyList()); List<Point2D> result = PropertyReaderUtils.getControlPoints(definitionResolver, EDGE_ID); assertTrue(result.isEmpty()); } | public static List<Point2D> getControlPoints(DefinitionResolver definitionResolver, String edgeId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); final List<Point2D> result = new ArrayList<>(); if (waypoint.size() > 2) { List<Point> points = waypoint.subList(1, waypoint.size() - 1); for (Point p : points) { result.add(createPoint2D(p, resolutionFactor)); } } return result; } | PropertyReaderUtils { public static List<Point2D> getControlPoints(DefinitionResolver definitionResolver, String edgeId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); final List<Point2D> result = new ArrayList<>(); if (waypoint.size() > 2) { List<Point> points = waypoint.subList(1, waypoint.size() - 1); for (Point p : points) { result.add(createPoint2D(p, resolutionFactor)); } } return result; } } | PropertyReaderUtils { public static List<Point2D> getControlPoints(DefinitionResolver definitionResolver, String edgeId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); final List<Point2D> result = new ArrayList<>(); if (waypoint.size() > 2) { List<Point> points = waypoint.subList(1, waypoint.size() - 1); for (Point p : points) { result.add(createPoint2D(p, resolutionFactor)); } } return result; } } | PropertyReaderUtils { public static List<Point2D> getControlPoints(DefinitionResolver definitionResolver, String edgeId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); final List<Point2D> result = new ArrayList<>(); if (waypoint.size() > 2) { List<Point> points = waypoint.subList(1, waypoint.size() - 1); for (Point p : points) { result.add(createPoint2D(p, resolutionFactor)); } } return result; } static Point2D getSourcePosition(DefinitionResolver definitionResolver,
String edgeId,
String sourceId); static Point2D getTargetPosition(DefinitionResolver definitionResolver,
String edgeId,
String targetId); static List<Point2D> getControlPoints(DefinitionResolver definitionResolver,
String edgeId); static boolean isAutoConnectionSource(BaseElement element); static boolean isAutoConnectionTarget(BaseElement element); static WSDLImport toWSDLImports(Import imp); } | PropertyReaderUtils { public static List<Point2D> getControlPoints(DefinitionResolver definitionResolver, String edgeId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); final List<Point2D> result = new ArrayList<>(); if (waypoint.size() > 2) { List<Point> points = waypoint.subList(1, waypoint.size() - 1); for (Point p : points) { result.add(createPoint2D(p, resolutionFactor)); } } return result; } static Point2D getSourcePosition(DefinitionResolver definitionResolver,
String edgeId,
String sourceId); static Point2D getTargetPosition(DefinitionResolver definitionResolver,
String edgeId,
String targetId); static List<Point2D> getControlPoints(DefinitionResolver definitionResolver,
String edgeId); static boolean isAutoConnectionSource(BaseElement element); static boolean isAutoConnectionTarget(BaseElement element); static WSDLImport toWSDLImports(Import imp); } |
@Test public void testGetControlPointsWhenOnePoints() { List<Point> waypoints = mockPoints(1, 2, 1); when(edge.getWaypoint()).thenReturn(waypoints); List<Point2D> result = PropertyReaderUtils.getControlPoints(definitionResolver, EDGE_ID); assertTrue(result.isEmpty()); } | public static List<Point2D> getControlPoints(DefinitionResolver definitionResolver, String edgeId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); final List<Point2D> result = new ArrayList<>(); if (waypoint.size() > 2) { List<Point> points = waypoint.subList(1, waypoint.size() - 1); for (Point p : points) { result.add(createPoint2D(p, resolutionFactor)); } } return result; } | PropertyReaderUtils { public static List<Point2D> getControlPoints(DefinitionResolver definitionResolver, String edgeId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); final List<Point2D> result = new ArrayList<>(); if (waypoint.size() > 2) { List<Point> points = waypoint.subList(1, waypoint.size() - 1); for (Point p : points) { result.add(createPoint2D(p, resolutionFactor)); } } return result; } } | PropertyReaderUtils { public static List<Point2D> getControlPoints(DefinitionResolver definitionResolver, String edgeId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); final List<Point2D> result = new ArrayList<>(); if (waypoint.size() > 2) { List<Point> points = waypoint.subList(1, waypoint.size() - 1); for (Point p : points) { result.add(createPoint2D(p, resolutionFactor)); } } return result; } } | PropertyReaderUtils { public static List<Point2D> getControlPoints(DefinitionResolver definitionResolver, String edgeId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); final List<Point2D> result = new ArrayList<>(); if (waypoint.size() > 2) { List<Point> points = waypoint.subList(1, waypoint.size() - 1); for (Point p : points) { result.add(createPoint2D(p, resolutionFactor)); } } return result; } static Point2D getSourcePosition(DefinitionResolver definitionResolver,
String edgeId,
String sourceId); static Point2D getTargetPosition(DefinitionResolver definitionResolver,
String edgeId,
String targetId); static List<Point2D> getControlPoints(DefinitionResolver definitionResolver,
String edgeId); static boolean isAutoConnectionSource(BaseElement element); static boolean isAutoConnectionTarget(BaseElement element); static WSDLImport toWSDLImports(Import imp); } | PropertyReaderUtils { public static List<Point2D> getControlPoints(DefinitionResolver definitionResolver, String edgeId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); final List<Point2D> result = new ArrayList<>(); if (waypoint.size() > 2) { List<Point> points = waypoint.subList(1, waypoint.size() - 1); for (Point p : points) { result.add(createPoint2D(p, resolutionFactor)); } } return result; } static Point2D getSourcePosition(DefinitionResolver definitionResolver,
String edgeId,
String sourceId); static Point2D getTargetPosition(DefinitionResolver definitionResolver,
String edgeId,
String targetId); static List<Point2D> getControlPoints(DefinitionResolver definitionResolver,
String edgeId); static boolean isAutoConnectionSource(BaseElement element); static boolean isAutoConnectionTarget(BaseElement element); static WSDLImport toWSDLImports(Import imp); } |
@Test public void testGetControlPointsWhenTwoPoints() { List<Point> waypoints = mockPoints(1, 2, 2); when(edge.getWaypoint()).thenReturn(waypoints); List<Point2D> result = PropertyReaderUtils.getControlPoints(definitionResolver, EDGE_ID); assertTrue(result.isEmpty()); } | public static List<Point2D> getControlPoints(DefinitionResolver definitionResolver, String edgeId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); final List<Point2D> result = new ArrayList<>(); if (waypoint.size() > 2) { List<Point> points = waypoint.subList(1, waypoint.size() - 1); for (Point p : points) { result.add(createPoint2D(p, resolutionFactor)); } } return result; } | PropertyReaderUtils { public static List<Point2D> getControlPoints(DefinitionResolver definitionResolver, String edgeId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); final List<Point2D> result = new ArrayList<>(); if (waypoint.size() > 2) { List<Point> points = waypoint.subList(1, waypoint.size() - 1); for (Point p : points) { result.add(createPoint2D(p, resolutionFactor)); } } return result; } } | PropertyReaderUtils { public static List<Point2D> getControlPoints(DefinitionResolver definitionResolver, String edgeId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); final List<Point2D> result = new ArrayList<>(); if (waypoint.size() > 2) { List<Point> points = waypoint.subList(1, waypoint.size() - 1); for (Point p : points) { result.add(createPoint2D(p, resolutionFactor)); } } return result; } } | PropertyReaderUtils { public static List<Point2D> getControlPoints(DefinitionResolver definitionResolver, String edgeId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); final List<Point2D> result = new ArrayList<>(); if (waypoint.size() > 2) { List<Point> points = waypoint.subList(1, waypoint.size() - 1); for (Point p : points) { result.add(createPoint2D(p, resolutionFactor)); } } return result; } static Point2D getSourcePosition(DefinitionResolver definitionResolver,
String edgeId,
String sourceId); static Point2D getTargetPosition(DefinitionResolver definitionResolver,
String edgeId,
String targetId); static List<Point2D> getControlPoints(DefinitionResolver definitionResolver,
String edgeId); static boolean isAutoConnectionSource(BaseElement element); static boolean isAutoConnectionTarget(BaseElement element); static WSDLImport toWSDLImports(Import imp); } | PropertyReaderUtils { public static List<Point2D> getControlPoints(DefinitionResolver definitionResolver, String edgeId) { final double resolutionFactor = definitionResolver.getResolutionFactor(); final List<Point> waypoint = definitionResolver.getEdge(edgeId).getWaypoint(); final List<Point2D> result = new ArrayList<>(); if (waypoint.size() > 2) { List<Point> points = waypoint.subList(1, waypoint.size() - 1); for (Point p : points) { result.add(createPoint2D(p, resolutionFactor)); } } return result; } static Point2D getSourcePosition(DefinitionResolver definitionResolver,
String edgeId,
String sourceId); static Point2D getTargetPosition(DefinitionResolver definitionResolver,
String edgeId,
String targetId); static List<Point2D> getControlPoints(DefinitionResolver definitionResolver,
String edgeId); static boolean isAutoConnectionSource(BaseElement element); static boolean isAutoConnectionTarget(BaseElement element); static WSDLImport toWSDLImports(Import imp); } |
@Test public void testInit() { decisionComponents.init(); verify(view).init(decisionComponents); } | @PostConstruct public void init() { view.init(this); } | DecisionComponents { @PostConstruct public void init() { view.init(this); } } | DecisionComponents { @PostConstruct public void init() { view.init(this); } DecisionComponents(); @Inject DecisionComponents(final View view,
final DMNIncludeModelsClient client,
final ManagedInstance<DecisionComponentsItem> itemManagedInstance,
final DecisionComponentFilter filter,
final DMNDiagramsSession dmnDiagramsSession,
final DMNGraphUtils dmnGraphUtils); } | DecisionComponents { @PostConstruct public void init() { view.init(this); } DecisionComponents(); @Inject DecisionComponents(final View view,
final DMNIncludeModelsClient client,
final ManagedInstance<DecisionComponentsItem> itemManagedInstance,
final DecisionComponentFilter filter,
final DMNDiagramsSession dmnDiagramsSession,
final DMNGraphUtils dmnGraphUtils); @PostConstruct void init(); View getView(); void refresh(); void removeAllItems(); } | DecisionComponents { @PostConstruct public void init() { view.init(this); } DecisionComponents(); @Inject DecisionComponents(final View view,
final DMNIncludeModelsClient client,
final ManagedInstance<DecisionComponentsItem> itemManagedInstance,
final DecisionComponentFilter filter,
final DMNDiagramsSession dmnDiagramsSession,
final DMNGraphUtils dmnGraphUtils); @PostConstruct void init(); View getView(); void refresh(); void removeAllItems(); } |
@Test public void toWSDLImports() { final String LOCATION = "location"; final String NAMESPACE = "namespace"; WSDLImport wsdlImport = new WSDLImport(LOCATION, NAMESPACE); Import imp = PropertyWriterUtils.toImport(wsdlImport); WSDLImport result = PropertyReaderUtils.toWSDLImports(imp); assertEquals("location", result.getLocation()); assertEquals("namespace", result.getNamespace()); } | public static WSDLImport toWSDLImports(Import imp) { return new WSDLImport(imp.getLocation(), imp.getNamespace()); } | PropertyReaderUtils { public static WSDLImport toWSDLImports(Import imp) { return new WSDLImport(imp.getLocation(), imp.getNamespace()); } } | PropertyReaderUtils { public static WSDLImport toWSDLImports(Import imp) { return new WSDLImport(imp.getLocation(), imp.getNamespace()); } } | PropertyReaderUtils { public static WSDLImport toWSDLImports(Import imp) { return new WSDLImport(imp.getLocation(), imp.getNamespace()); } static Point2D getSourcePosition(DefinitionResolver definitionResolver,
String edgeId,
String sourceId); static Point2D getTargetPosition(DefinitionResolver definitionResolver,
String edgeId,
String targetId); static List<Point2D> getControlPoints(DefinitionResolver definitionResolver,
String edgeId); static boolean isAutoConnectionSource(BaseElement element); static boolean isAutoConnectionTarget(BaseElement element); static WSDLImport toWSDLImports(Import imp); } | PropertyReaderUtils { public static WSDLImport toWSDLImports(Import imp) { return new WSDLImport(imp.getLocation(), imp.getNamespace()); } static Point2D getSourcePosition(DefinitionResolver definitionResolver,
String edgeId,
String sourceId); static Point2D getTargetPosition(DefinitionResolver definitionResolver,
String edgeId,
String targetId); static List<Point2D> getControlPoints(DefinitionResolver definitionResolver,
String edgeId); static boolean isAutoConnectionSource(BaseElement element); static boolean isAutoConnectionTarget(BaseElement element); static WSDLImport toWSDLImports(Import imp); } |
@Test public void testNullTimeParameters() { assertEquals(new SimulationAttributeSet(), SimulationAttributeSets.of(simulationParameters)); } | public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.of(ParameterValue.class, SimulationAttributeSet.class) .when(NormalDistributionType.class, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .when(UniformDistributionType.class, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .when(PoissonDistributionType.class, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } | SimulationAttributeSets { public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.of(ParameterValue.class, SimulationAttributeSet.class) .when(NormalDistributionType.class, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .when(UniformDistributionType.class, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .when(PoissonDistributionType.class, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } } | SimulationAttributeSets { public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.of(ParameterValue.class, SimulationAttributeSet.class) .when(NormalDistributionType.class, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .when(UniformDistributionType.class, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .when(PoissonDistributionType.class, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } private SimulationAttributeSets(); } | SimulationAttributeSets { public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.of(ParameterValue.class, SimulationAttributeSet.class) .when(NormalDistributionType.class, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .when(UniformDistributionType.class, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .when(PoissonDistributionType.class, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } private SimulationAttributeSets(); static SimulationAttributeSet of(ElementParameters eleType); static ElementParameters toElementParameters(SimulationAttributeSet simulationSet); } | SimulationAttributeSets { public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.of(ParameterValue.class, SimulationAttributeSet.class) .when(NormalDistributionType.class, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .when(UniformDistributionType.class, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .when(PoissonDistributionType.class, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } private SimulationAttributeSets(); static SimulationAttributeSet of(ElementParameters eleType); static ElementParameters toElementParameters(SimulationAttributeSet simulationSet); } |
@Test public void testTimeParamsWithNullValue() { TimeParameters timeParameters = factory.createTimeParameters(); simulationParameters.setTimeParameters(timeParameters); assertEquals(new SimulationAttributeSet(), SimulationAttributeSets.of(simulationParameters)); } | public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.of(ParameterValue.class, SimulationAttributeSet.class) .when(NormalDistributionType.class, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .when(UniformDistributionType.class, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .when(PoissonDistributionType.class, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } | SimulationAttributeSets { public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.of(ParameterValue.class, SimulationAttributeSet.class) .when(NormalDistributionType.class, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .when(UniformDistributionType.class, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .when(PoissonDistributionType.class, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } } | SimulationAttributeSets { public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.of(ParameterValue.class, SimulationAttributeSet.class) .when(NormalDistributionType.class, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .when(UniformDistributionType.class, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .when(PoissonDistributionType.class, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } private SimulationAttributeSets(); } | SimulationAttributeSets { public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.of(ParameterValue.class, SimulationAttributeSet.class) .when(NormalDistributionType.class, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .when(UniformDistributionType.class, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .when(PoissonDistributionType.class, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } private SimulationAttributeSets(); static SimulationAttributeSet of(ElementParameters eleType); static ElementParameters toElementParameters(SimulationAttributeSet simulationSet); } | SimulationAttributeSets { public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.of(ParameterValue.class, SimulationAttributeSet.class) .when(NormalDistributionType.class, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .when(UniformDistributionType.class, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .when(PoissonDistributionType.class, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } private SimulationAttributeSets(); static SimulationAttributeSet of(ElementParameters eleType); static ElementParameters toElementParameters(SimulationAttributeSet simulationSet); } |
@Test public void testTimeParamsWithEmptyParameter() { TimeParameters timeParameters = factory.createTimeParameters(); Parameter parameter = factory.createParameter(); timeParameters.setProcessingTime(parameter); simulationParameters.setTimeParameters(timeParameters); assertEquals(new SimulationAttributeSet(), SimulationAttributeSets.of(simulationParameters)); } | public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.of(ParameterValue.class, SimulationAttributeSet.class) .when(NormalDistributionType.class, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .when(UniformDistributionType.class, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .when(PoissonDistributionType.class, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } | SimulationAttributeSets { public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.of(ParameterValue.class, SimulationAttributeSet.class) .when(NormalDistributionType.class, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .when(UniformDistributionType.class, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .when(PoissonDistributionType.class, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } } | SimulationAttributeSets { public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.of(ParameterValue.class, SimulationAttributeSet.class) .when(NormalDistributionType.class, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .when(UniformDistributionType.class, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .when(PoissonDistributionType.class, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } private SimulationAttributeSets(); } | SimulationAttributeSets { public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.of(ParameterValue.class, SimulationAttributeSet.class) .when(NormalDistributionType.class, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .when(UniformDistributionType.class, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .when(PoissonDistributionType.class, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } private SimulationAttributeSets(); static SimulationAttributeSet of(ElementParameters eleType); static ElementParameters toElementParameters(SimulationAttributeSet simulationSet); } | SimulationAttributeSets { public static SimulationAttributeSet of(ElementParameters eleType) { TimeParameters timeParams = eleType.getTimeParameters(); if (timeParams == null) { return new SimulationAttributeSet(); } Parameter processingTime = timeParams.getProcessingTime(); if (processingTime == null || processingTime.getParameterValue() == null || processingTime.getParameterValue().isEmpty()) { return new SimulationAttributeSet(); } ParameterValue paramValue = processingTime.getParameterValue().get(0); return Match.of(ParameterValue.class, SimulationAttributeSet.class) .when(NormalDistributionType.class, ndt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(ndt.getMean()); simulationSet.getStandardDeviation().setValue(ndt.getStandardDeviation()); simulationSet.getDistributionType().setValue("normal"); return simulationSet; }) .when(UniformDistributionType.class, udt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMin().setValue(udt.getMin()); simulationSet.getMax().setValue(udt.getMax()); simulationSet.getDistributionType().setValue("uniform"); return simulationSet; }) .when(PoissonDistributionType.class, pdt -> { SimulationAttributeSet simulationSet = new SimulationAttributeSet(); simulationSet.getMean().setValue(pdt.getMean()); simulationSet.getDistributionType().setValue("poisson"); return simulationSet; }) .apply(paramValue) .asSuccess() .value(); } private SimulationAttributeSets(); static SimulationAttributeSet of(ElementParameters eleType); static ElementParameters toElementParameters(SimulationAttributeSet simulationSet); } |
@Test public void JBPM_7523_shouldPreserveNameChars() { PropertyReaderFactory factory = new PropertyReaderFactory( new TestDefinitionsWriter().getDefinitionResolver()); Lane lane = bpmn2.createLane(); PropertyWriterFactory writerFactory = new PropertyWriterFactory(); LanePropertyWriter w = writerFactory.of(lane); String aWeirdName = " XXX !!@@ <><> "; String aWeirdDoc = " XXX !!@@ <><> Docs "; w.setName(aWeirdName); w.setDocumentation(aWeirdDoc); LanePropertyReader r = factory.of(lane); assertThat(r.getName()).isEqualTo(asCData(aWeirdName)); assertThat(r.getDocumentation()).isEqualTo(asCData(aWeirdDoc)); } | public String getName() { String extendedName = CustomElement.name.of(element).get(); return extendedName.isEmpty() ? Optional.ofNullable(lane.getName()).orElse("") : extendedName; } | LanePropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return extendedName.isEmpty() ? Optional.ofNullable(lane.getName()).orElse("") : extendedName; } } | LanePropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return extendedName.isEmpty() ? Optional.ofNullable(lane.getName()).orElse("") : extendedName; } LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, BPMNShape parentLaneShape, double resolutionFactor); LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, double resolutionFactor); } | LanePropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return extendedName.isEmpty() ? Optional.ofNullable(lane.getName()).orElse("") : extendedName; } LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, BPMNShape parentLaneShape, double resolutionFactor); LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, double resolutionFactor); String getName(); @Override RectangleDimensionsSet getRectangleDimensionsSet(); } | LanePropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return extendedName.isEmpty() ? Optional.ofNullable(lane.getName()).orElse("") : extendedName; } LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, BPMNShape parentLaneShape, double resolutionFactor); LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, double resolutionFactor); String getName(); @Override RectangleDimensionsSet getRectangleDimensionsSet(); } |
@Test public void testGetRectangleDimensionsSet() { LanePropertyReader propertyReader = new LanePropertyReader(lane, diagram, shape, RESOLUTION_FACTOR); RectangleDimensionsSet dimensionsSet = propertyReader.getRectangleDimensionsSet(); assertRectangleDimensions(WIDTH * RESOLUTION_FACTOR, HEIGHT * RESOLUTION_FACTOR, dimensionsSet); } | @Override public RectangleDimensionsSet getRectangleDimensionsSet() { if (shape == null || parentLaneShape == null) { return super.getRectangleDimensionsSet(); } org.eclipse.dd.dc.Bounds bounds = shape.getBounds(); return new RectangleDimensionsSet(parentLaneShape.getBounds().getWidth() * resolutionFactor, bounds.getHeight() * resolutionFactor); } | LanePropertyReader extends BasePropertyReader { @Override public RectangleDimensionsSet getRectangleDimensionsSet() { if (shape == null || parentLaneShape == null) { return super.getRectangleDimensionsSet(); } org.eclipse.dd.dc.Bounds bounds = shape.getBounds(); return new RectangleDimensionsSet(parentLaneShape.getBounds().getWidth() * resolutionFactor, bounds.getHeight() * resolutionFactor); } } | LanePropertyReader extends BasePropertyReader { @Override public RectangleDimensionsSet getRectangleDimensionsSet() { if (shape == null || parentLaneShape == null) { return super.getRectangleDimensionsSet(); } org.eclipse.dd.dc.Bounds bounds = shape.getBounds(); return new RectangleDimensionsSet(parentLaneShape.getBounds().getWidth() * resolutionFactor, bounds.getHeight() * resolutionFactor); } LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, BPMNShape parentLaneShape, double resolutionFactor); LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, double resolutionFactor); } | LanePropertyReader extends BasePropertyReader { @Override public RectangleDimensionsSet getRectangleDimensionsSet() { if (shape == null || parentLaneShape == null) { return super.getRectangleDimensionsSet(); } org.eclipse.dd.dc.Bounds bounds = shape.getBounds(); return new RectangleDimensionsSet(parentLaneShape.getBounds().getWidth() * resolutionFactor, bounds.getHeight() * resolutionFactor); } LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, BPMNShape parentLaneShape, double resolutionFactor); LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, double resolutionFactor); String getName(); @Override RectangleDimensionsSet getRectangleDimensionsSet(); } | LanePropertyReader extends BasePropertyReader { @Override public RectangleDimensionsSet getRectangleDimensionsSet() { if (shape == null || parentLaneShape == null) { return super.getRectangleDimensionsSet(); } org.eclipse.dd.dc.Bounds bounds = shape.getBounds(); return new RectangleDimensionsSet(parentLaneShape.getBounds().getWidth() * resolutionFactor, bounds.getHeight() * resolutionFactor); } LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, BPMNShape parentLaneShape, double resolutionFactor); LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, double resolutionFactor); String getName(); @Override RectangleDimensionsSet getRectangleDimensionsSet(); } |
@Test public void testGetRectangleDimensionsSetWithParentShape() { LanePropertyReader propertyReader = new LanePropertyReader(lane, diagram, shape, parentLaneShape, RESOLUTION_FACTOR); RectangleDimensionsSet dimensionsSet = propertyReader.getRectangleDimensionsSet(); assertRectangleDimensions(PARENT_WIDTH * RESOLUTION_FACTOR, HEIGHT * RESOLUTION_FACTOR, dimensionsSet); } | @Override public RectangleDimensionsSet getRectangleDimensionsSet() { if (shape == null || parentLaneShape == null) { return super.getRectangleDimensionsSet(); } org.eclipse.dd.dc.Bounds bounds = shape.getBounds(); return new RectangleDimensionsSet(parentLaneShape.getBounds().getWidth() * resolutionFactor, bounds.getHeight() * resolutionFactor); } | LanePropertyReader extends BasePropertyReader { @Override public RectangleDimensionsSet getRectangleDimensionsSet() { if (shape == null || parentLaneShape == null) { return super.getRectangleDimensionsSet(); } org.eclipse.dd.dc.Bounds bounds = shape.getBounds(); return new RectangleDimensionsSet(parentLaneShape.getBounds().getWidth() * resolutionFactor, bounds.getHeight() * resolutionFactor); } } | LanePropertyReader extends BasePropertyReader { @Override public RectangleDimensionsSet getRectangleDimensionsSet() { if (shape == null || parentLaneShape == null) { return super.getRectangleDimensionsSet(); } org.eclipse.dd.dc.Bounds bounds = shape.getBounds(); return new RectangleDimensionsSet(parentLaneShape.getBounds().getWidth() * resolutionFactor, bounds.getHeight() * resolutionFactor); } LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, BPMNShape parentLaneShape, double resolutionFactor); LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, double resolutionFactor); } | LanePropertyReader extends BasePropertyReader { @Override public RectangleDimensionsSet getRectangleDimensionsSet() { if (shape == null || parentLaneShape == null) { return super.getRectangleDimensionsSet(); } org.eclipse.dd.dc.Bounds bounds = shape.getBounds(); return new RectangleDimensionsSet(parentLaneShape.getBounds().getWidth() * resolutionFactor, bounds.getHeight() * resolutionFactor); } LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, BPMNShape parentLaneShape, double resolutionFactor); LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, double resolutionFactor); String getName(); @Override RectangleDimensionsSet getRectangleDimensionsSet(); } | LanePropertyReader extends BasePropertyReader { @Override public RectangleDimensionsSet getRectangleDimensionsSet() { if (shape == null || parentLaneShape == null) { return super.getRectangleDimensionsSet(); } org.eclipse.dd.dc.Bounds bounds = shape.getBounds(); return new RectangleDimensionsSet(parentLaneShape.getBounds().getWidth() * resolutionFactor, bounds.getHeight() * resolutionFactor); } LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, BPMNShape parentLaneShape, double resolutionFactor); LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, double resolutionFactor); String getName(); @Override RectangleDimensionsSet getRectangleDimensionsSet(); } |
@Test public void testGetNameFromExtensionElement() { List<ExtensionAttributeValue> extensionValues = mockExtensionValues(DroolsPackage.Literals.DOCUMENT_ROOT__META_DATA, METADATA_ELEMENT_NAME, NAME); when(lane.getName()).thenReturn(null); when(lane.getExtensionValues()).thenReturn(extensionValues); LanePropertyReader propertyReader = new LanePropertyReader(lane, diagram, shape, RESOLUTION_FACTOR); assertEquals(NAME, propertyReader.getName()); } | public String getName() { String extendedName = CustomElement.name.of(element).get(); return extendedName.isEmpty() ? Optional.ofNullable(lane.getName()).orElse("") : extendedName; } | LanePropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return extendedName.isEmpty() ? Optional.ofNullable(lane.getName()).orElse("") : extendedName; } } | LanePropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return extendedName.isEmpty() ? Optional.ofNullable(lane.getName()).orElse("") : extendedName; } LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, BPMNShape parentLaneShape, double resolutionFactor); LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, double resolutionFactor); } | LanePropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return extendedName.isEmpty() ? Optional.ofNullable(lane.getName()).orElse("") : extendedName; } LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, BPMNShape parentLaneShape, double resolutionFactor); LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, double resolutionFactor); String getName(); @Override RectangleDimensionsSet getRectangleDimensionsSet(); } | LanePropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return extendedName.isEmpty() ? Optional.ofNullable(lane.getName()).orElse("") : extendedName; } LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, BPMNShape parentLaneShape, double resolutionFactor); LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, double resolutionFactor); String getName(); @Override RectangleDimensionsSet getRectangleDimensionsSet(); } |
@Test public void testGetNameFromNameValue() { LanePropertyReader propertyReader = new LanePropertyReader(lane, diagram, shape, RESOLUTION_FACTOR); when(lane.getExtensionValues()).thenReturn(null); when(lane.getName()).thenReturn(NAME); assertEquals(NAME, propertyReader.getName()); } | public String getName() { String extendedName = CustomElement.name.of(element).get(); return extendedName.isEmpty() ? Optional.ofNullable(lane.getName()).orElse("") : extendedName; } | LanePropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return extendedName.isEmpty() ? Optional.ofNullable(lane.getName()).orElse("") : extendedName; } } | LanePropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return extendedName.isEmpty() ? Optional.ofNullable(lane.getName()).orElse("") : extendedName; } LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, BPMNShape parentLaneShape, double resolutionFactor); LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, double resolutionFactor); } | LanePropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return extendedName.isEmpty() ? Optional.ofNullable(lane.getName()).orElse("") : extendedName; } LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, BPMNShape parentLaneShape, double resolutionFactor); LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, double resolutionFactor); String getName(); @Override RectangleDimensionsSet getRectangleDimensionsSet(); } | LanePropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return extendedName.isEmpty() ? Optional.ofNullable(lane.getName()).orElse("") : extendedName; } LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, BPMNShape parentLaneShape, double resolutionFactor); LanePropertyReader(Lane el, BPMNDiagram diagram, BPMNShape shape, double resolutionFactor); String getName(); @Override RectangleDimensionsSet getRectangleDimensionsSet(); } |
@Test public void getExtendedName() { String name = tested.getName(); assertEquals("custom", name); } | public String getName() { String extendedName = CustomElement.name.of(element).get(); return StringUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return StringUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return StringUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } TextAnnotationPropertyReader(TextAnnotation element, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return StringUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } TextAnnotationPropertyReader(TextAnnotation element, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); String getName(); } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return StringUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } TextAnnotationPropertyReader(TextAnnotation element, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); String getName(); } |
@Test public void testGetView() { assertEquals(view, decisionComponents.getView()); } | public View getView() { return view; } | DecisionComponents { public View getView() { return view; } } | DecisionComponents { public View getView() { return view; } DecisionComponents(); @Inject DecisionComponents(final View view,
final DMNIncludeModelsClient client,
final ManagedInstance<DecisionComponentsItem> itemManagedInstance,
final DecisionComponentFilter filter,
final DMNDiagramsSession dmnDiagramsSession,
final DMNGraphUtils dmnGraphUtils); } | DecisionComponents { public View getView() { return view; } DecisionComponents(); @Inject DecisionComponents(final View view,
final DMNIncludeModelsClient client,
final ManagedInstance<DecisionComponentsItem> itemManagedInstance,
final DecisionComponentFilter filter,
final DMNDiagramsSession dmnDiagramsSession,
final DMNGraphUtils dmnGraphUtils); @PostConstruct void init(); View getView(); void refresh(); void removeAllItems(); } | DecisionComponents { public View getView() { return view; } DecisionComponents(); @Inject DecisionComponents(final View view,
final DMNIncludeModelsClient client,
final ManagedInstance<DecisionComponentsItem> itemManagedInstance,
final DecisionComponentFilter filter,
final DMNDiagramsSession dmnDiagramsSession,
final DMNGraphUtils dmnGraphUtils); @PostConstruct void init(); View getView(); void refresh(); void removeAllItems(); } |
@Test public void getName() { when(element.getExtensionValues()).thenReturn(Collections.emptyList()); String name = tested.getName(); assertEquals("name", name); } | public String getName() { String extendedName = CustomElement.name.of(element).get(); return StringUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return StringUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return StringUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } TextAnnotationPropertyReader(TextAnnotation element, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return StringUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } TextAnnotationPropertyReader(TextAnnotation element, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); String getName(); } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return StringUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } TextAnnotationPropertyReader(TextAnnotation element, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); String getName(); } |
@Test public void getTextName() { when(element.getExtensionValues()).thenReturn(Collections.emptyList()); when(element.getName()).thenReturn(null); String name = tested.getName(); assertEquals("text", name); } | public String getName() { String extendedName = CustomElement.name.of(element).get(); return StringUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return StringUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return StringUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } TextAnnotationPropertyReader(TextAnnotation element, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return StringUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } TextAnnotationPropertyReader(TextAnnotation element, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); String getName(); } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return StringUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } TextAnnotationPropertyReader(TextAnnotation element, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); String getName(); } |
@Test public void getNameNull() { when(element.getExtensionValues()).thenReturn(Collections.emptyList()); when(element.getName()).thenReturn(null); when(element.getText()).thenReturn(null); String name = tested.getName(); assertEquals("", name); } | public String getName() { String extendedName = CustomElement.name.of(element).get(); return StringUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return StringUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return StringUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } TextAnnotationPropertyReader(TextAnnotation element, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return StringUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } TextAnnotationPropertyReader(TextAnnotation element, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); String getName(); } | TextAnnotationPropertyReader extends BasePropertyReader { public String getName() { String extendedName = CustomElement.name.of(element).get(); return StringUtils.isEmpty(extendedName) ? Optional.ofNullable(element.getText()).orElse("") : extendedName; } TextAnnotationPropertyReader(TextAnnotation element, BPMNDiagram diagram,
BPMNShape shape,
double resolutionFactor); String getName(); } |
@Test public void ofDefinition() { assertTrue(tested.of(definitions) instanceof DefinitionsPropertyReader); } | public FlowElementPropertyReader of(FlowElement el) { return new FlowElementPropertyReader(el, diagram, definitionResolver.getShape(el.getId()), definitionResolver.getResolutionFactor()); } | PropertyReaderFactory { public FlowElementPropertyReader of(FlowElement el) { return new FlowElementPropertyReader(el, diagram, definitionResolver.getShape(el.getId()), definitionResolver.getResolutionFactor()); } } | PropertyReaderFactory { public FlowElementPropertyReader of(FlowElement el) { return new FlowElementPropertyReader(el, diagram, definitionResolver.getShape(el.getId()), definitionResolver.getResolutionFactor()); } PropertyReaderFactory(DefinitionResolver definitionResolver); } | PropertyReaderFactory { public FlowElementPropertyReader of(FlowElement el) { return new FlowElementPropertyReader(el, diagram, definitionResolver.getShape(el.getId()), definitionResolver.getResolutionFactor()); } PropertyReaderFactory(DefinitionResolver definitionResolver); FlowElementPropertyReader of(FlowElement el); LanePropertyReader of(Lane el); LanePropertyReader of(Lane el, Lane elParent); SequenceFlowPropertyReader of(SequenceFlow el); AssociationPropertyReader of(Association el); GatewayPropertyReader of(Gateway el); TaskPropertyReader of(Task el); UserTaskPropertyReader of(UserTask el); ScriptTaskPropertyReader of(ScriptTask el); GenericServiceTaskPropertyReader of(ServiceTask el); BusinessRuleTaskPropertyReader of(BusinessRuleTask el); Optional<ServiceTaskPropertyReader> ofCustom(Task el); CallActivityPropertyReader of(CallActivity el); CatchEventPropertyReader of(CatchEvent el); ThrowEventPropertyReader of(ThrowEvent el); SubProcessPropertyReader of(SubProcess el); AdHocSubProcessPropertyReader of(AdHocSubProcess el); MultipleInstanceSubProcessPropertyReader ofMultipleInstance(SubProcess el); ProcessPropertyReader of(Process el); TextAnnotationPropertyReader of(TextAnnotation el); DefinitionsPropertyReader of(Definitions el); DataObjectPropertyReader of(DataObjectReference el); } | PropertyReaderFactory { public FlowElementPropertyReader of(FlowElement el) { return new FlowElementPropertyReader(el, diagram, definitionResolver.getShape(el.getId()), definitionResolver.getResolutionFactor()); } PropertyReaderFactory(DefinitionResolver definitionResolver); FlowElementPropertyReader of(FlowElement el); LanePropertyReader of(Lane el); LanePropertyReader of(Lane el, Lane elParent); SequenceFlowPropertyReader of(SequenceFlow el); AssociationPropertyReader of(Association el); GatewayPropertyReader of(Gateway el); TaskPropertyReader of(Task el); UserTaskPropertyReader of(UserTask el); ScriptTaskPropertyReader of(ScriptTask el); GenericServiceTaskPropertyReader of(ServiceTask el); BusinessRuleTaskPropertyReader of(BusinessRuleTask el); Optional<ServiceTaskPropertyReader> ofCustom(Task el); CallActivityPropertyReader of(CallActivity el); CatchEventPropertyReader of(CatchEvent el); ThrowEventPropertyReader of(ThrowEvent el); SubProcessPropertyReader of(SubProcess el); AdHocSubProcessPropertyReader of(AdHocSubProcess el); MultipleInstanceSubProcessPropertyReader ofMultipleInstance(SubProcess el); ProcessPropertyReader of(Process el); TextAnnotationPropertyReader of(TextAnnotation el); DefinitionsPropertyReader of(Definitions el); DataObjectPropertyReader of(DataObjectReference el); } |
@Test public void testGetPropertyName() { when(property.getName()).thenReturn(NAME); when(property.getId()).thenReturn(ID); testGetName(NAME, property); } | public String getName() { return name; } | ItemNameReader { public String getName() { return name; } } | ItemNameReader { public String getName() { return name; } private ItemNameReader(ItemAwareElement element); } | ItemNameReader { public String getName() { return name; } private ItemNameReader(ItemAwareElement element); static ItemNameReader from(ItemAwareElement element); String getName(); } | ItemNameReader { public String getName() { return name; } private ItemNameReader(ItemAwareElement element); static ItemNameReader from(ItemAwareElement element); String getName(); } |
@Test public void testGetPropertyID() { when(property.getName()).thenReturn(null); when(property.getId()).thenReturn(ID); testGetName(ID, property); } | public String getName() { return name; } | ItemNameReader { public String getName() { return name; } } | ItemNameReader { public String getName() { return name; } private ItemNameReader(ItemAwareElement element); } | ItemNameReader { public String getName() { return name; } private ItemNameReader(ItemAwareElement element); static ItemNameReader from(ItemAwareElement element); String getName(); } | ItemNameReader { public String getName() { return name; } private ItemNameReader(ItemAwareElement element); static ItemNameReader from(ItemAwareElement element); String getName(); } |
@Test public void testGetDataInputName() { when(dataInput.getName()).thenReturn(NAME); when(dataInput.getId()).thenReturn(ID); testGetName(NAME, dataInput); } | public String getName() { return name; } | ItemNameReader { public String getName() { return name; } } | ItemNameReader { public String getName() { return name; } private ItemNameReader(ItemAwareElement element); } | ItemNameReader { public String getName() { return name; } private ItemNameReader(ItemAwareElement element); static ItemNameReader from(ItemAwareElement element); String getName(); } | ItemNameReader { public String getName() { return name; } private ItemNameReader(ItemAwareElement element); static ItemNameReader from(ItemAwareElement element); String getName(); } |
@Test public void testGetDataInputID() { when(dataInput.getName()).thenReturn(null); when(dataInput.getId()).thenReturn(ID); testGetName(ID, dataInput); } | public String getName() { return name; } | ItemNameReader { public String getName() { return name; } } | ItemNameReader { public String getName() { return name; } private ItemNameReader(ItemAwareElement element); } | ItemNameReader { public String getName() { return name; } private ItemNameReader(ItemAwareElement element); static ItemNameReader from(ItemAwareElement element); String getName(); } | ItemNameReader { public String getName() { return name; } private ItemNameReader(ItemAwareElement element); static ItemNameReader from(ItemAwareElement element); String getName(); } |
@Test public void testGetDataOutputName() { when(dataOutput.getName()).thenReturn(NAME); when(dataOutput.getId()).thenReturn(ID); testGetName(NAME, dataOutput); } | public String getName() { return name; } | ItemNameReader { public String getName() { return name; } } | ItemNameReader { public String getName() { return name; } private ItemNameReader(ItemAwareElement element); } | ItemNameReader { public String getName() { return name; } private ItemNameReader(ItemAwareElement element); static ItemNameReader from(ItemAwareElement element); String getName(); } | ItemNameReader { public String getName() { return name; } private ItemNameReader(ItemAwareElement element); static ItemNameReader from(ItemAwareElement element); String getName(); } |
@Test public void testGetDataOutputID() { when(dataOutput.getName()).thenReturn(null); when(dataOutput.getId()).thenReturn(ID); testGetName(ID, dataOutput); } | public String getName() { return name; } | ItemNameReader { public String getName() { return name; } } | ItemNameReader { public String getName() { return name; } private ItemNameReader(ItemAwareElement element); } | ItemNameReader { public String getName() { return name; } private ItemNameReader(ItemAwareElement element); static ItemNameReader from(ItemAwareElement element); String getName(); } | ItemNameReader { public String getName() { return name; } private ItemNameReader(ItemAwareElement element); static ItemNameReader from(ItemAwareElement element); String getName(); } |
@Test public void testRefresh() { final Consumer<List<DMNIncludedNode>> listConsumer = (list) -> {}; final List<DMNIncludedModel> includedModels = new ArrayList<>(); includedModels.add(makeDMNIncludedModel(": includedModels.add(makeDMNIncludedModel(": doReturn(includedModels).when(decisionComponents).getDMNIncludedModels(); doReturn(listConsumer).when(decisionComponents).getNodesConsumer(); decisionComponents.refreshIncludedNodesList(); verify(decisionComponents).startLoading(); verify(client).loadNodesFromImports(includedModels, listConsumer); assertEquals(includedModels, decisionComponents.getLatestIncludedModelsLoaded()); } | public void refresh() { if (!dmnDiagramsSession.isSessionStatePresent()) { return; } if (!isIncludedNodeListsUpdated()) { refreshIncludedNodesList(); } loadModelComponents(); } | DecisionComponents { public void refresh() { if (!dmnDiagramsSession.isSessionStatePresent()) { return; } if (!isIncludedNodeListsUpdated()) { refreshIncludedNodesList(); } loadModelComponents(); } } | DecisionComponents { public void refresh() { if (!dmnDiagramsSession.isSessionStatePresent()) { return; } if (!isIncludedNodeListsUpdated()) { refreshIncludedNodesList(); } loadModelComponents(); } DecisionComponents(); @Inject DecisionComponents(final View view,
final DMNIncludeModelsClient client,
final ManagedInstance<DecisionComponentsItem> itemManagedInstance,
final DecisionComponentFilter filter,
final DMNDiagramsSession dmnDiagramsSession,
final DMNGraphUtils dmnGraphUtils); } | DecisionComponents { public void refresh() { if (!dmnDiagramsSession.isSessionStatePresent()) { return; } if (!isIncludedNodeListsUpdated()) { refreshIncludedNodesList(); } loadModelComponents(); } DecisionComponents(); @Inject DecisionComponents(final View view,
final DMNIncludeModelsClient client,
final ManagedInstance<DecisionComponentsItem> itemManagedInstance,
final DecisionComponentFilter filter,
final DMNDiagramsSession dmnDiagramsSession,
final DMNGraphUtils dmnGraphUtils); @PostConstruct void init(); View getView(); void refresh(); void removeAllItems(); } | DecisionComponents { public void refresh() { if (!dmnDiagramsSession.isSessionStatePresent()) { return; } if (!isIncludedNodeListsUpdated()) { refreshIncludedNodesList(); } loadModelComponents(); } DecisionComponents(); @Inject DecisionComponents(final View view,
final DMNIncludeModelsClient client,
final ManagedInstance<DecisionComponentsItem> itemManagedInstance,
final DecisionComponentFilter filter,
final DMNDiagramsSession dmnDiagramsSession,
final DMNGraphUtils dmnGraphUtils); @PostConstruct void init(); View getView(); void refresh(); void removeAllItems(); } |
@Test public void testGetDocumentFromImportsWithImportsFileIsImported() { includedModels.add(new PMMLIncludedModel(NAME, PACKAGE, IMPORT_PATH, DMNImportTypes.DMN.getDefaultNamespace(), MODEL_COUNT)); when(pathsHelper.getRelativeURI(dmnModelPath, includedModelPath)).thenReturn(IMPORT_PATH); assertThat(filter.getDocumentFromImports(dmnModelPath, includedModelPath, includedModels)).isEqualTo(pmmlDocumentMetadata); } | public PMMLDocumentMetadata getDocumentFromImports(final Path dmnModelPath, final Path includedModelPath, final List<PMMLIncludedModel> includedModels) { final Optional<PMMLIncludedModel> documentImport = getDocumentImport(dmnModelPath, includedModelPath, includedModels); return documentImport .map(pmml -> pmmlDocumentFactory.getDocumentByPath(includedModelPath, pmml)) .orElse(null); } | PMMLIncludedDocumentsFilter { public PMMLDocumentMetadata getDocumentFromImports(final Path dmnModelPath, final Path includedModelPath, final List<PMMLIncludedModel> includedModels) { final Optional<PMMLIncludedModel> documentImport = getDocumentImport(dmnModelPath, includedModelPath, includedModels); return documentImport .map(pmml -> pmmlDocumentFactory.getDocumentByPath(includedModelPath, pmml)) .orElse(null); } } | PMMLIncludedDocumentsFilter { public PMMLDocumentMetadata getDocumentFromImports(final Path dmnModelPath, final Path includedModelPath, final List<PMMLIncludedModel> includedModels) { final Optional<PMMLIncludedModel> documentImport = getDocumentImport(dmnModelPath, includedModelPath, includedModels); return documentImport .map(pmml -> pmmlDocumentFactory.getDocumentByPath(includedModelPath, pmml)) .orElse(null); } @Inject PMMLIncludedDocumentsFilter(final DMNPathsHelper pathsHelper,
final PMMLIncludedDocumentFactory pmmlDocumentFactory); } | PMMLIncludedDocumentsFilter { public PMMLDocumentMetadata getDocumentFromImports(final Path dmnModelPath, final Path includedModelPath, final List<PMMLIncludedModel> includedModels) { final Optional<PMMLIncludedModel> documentImport = getDocumentImport(dmnModelPath, includedModelPath, includedModels); return documentImport .map(pmml -> pmmlDocumentFactory.getDocumentByPath(includedModelPath, pmml)) .orElse(null); } @Inject PMMLIncludedDocumentsFilter(final DMNPathsHelper pathsHelper,
final PMMLIncludedDocumentFactory pmmlDocumentFactory); PMMLDocumentMetadata getDocumentFromImports(final Path dmnModelPath,
final Path includedModelPath,
final List<PMMLIncludedModel> includedModels); } | PMMLIncludedDocumentsFilter { public PMMLDocumentMetadata getDocumentFromImports(final Path dmnModelPath, final Path includedModelPath, final List<PMMLIncludedModel> includedModels) { final Optional<PMMLIncludedModel> documentImport = getDocumentImport(dmnModelPath, includedModelPath, includedModels); return documentImport .map(pmml -> pmmlDocumentFactory.getDocumentByPath(includedModelPath, pmml)) .orElse(null); } @Inject PMMLIncludedDocumentsFilter(final DMNPathsHelper pathsHelper,
final PMMLIncludedDocumentFactory pmmlDocumentFactory); PMMLDocumentMetadata getDocumentFromImports(final Path dmnModelPath,
final Path includedModelPath,
final List<PMMLIncludedModel> includedModels); } |
@Test public void testGetDataObject() { when(dataObject.getName()).thenReturn(null); when(dataObject.getId()).thenReturn(ID); testGetName(ID, dataObject); } | public String getName() { return name; } | ItemNameReader { public String getName() { return name; } } | ItemNameReader { public String getName() { return name; } private ItemNameReader(ItemAwareElement element); } | ItemNameReader { public String getName() { return name; } private ItemNameReader(ItemAwareElement element); static ItemNameReader from(ItemAwareElement element); String getName(); } | ItemNameReader { public String getName() { return name; } private ItemNameReader(ItemAwareElement element); static ItemNameReader from(ItemAwareElement element); String getName(); } |
@Test public void testGetCollectionInput() { ItemAwareElement item = mockItemAwareElement(ITEM_ID); when(miloop.getLoopDataInputRef()).thenReturn(item); List<DataInputAssociation> inputAssociations = Collections.singletonList(mockDataInputAssociation(ITEM_ID, PROPERTY_ID)); when(activity.getDataInputAssociations()).thenReturn(inputAssociations); assertEquals(PROPERTY_ID, reader.getCollectionInput()); } | public String getCollectionInput() { String ieDataInputId = getLoopDataInputRefId(); return super.getDataInputAssociations().stream() .filter(dia -> hasTargetRef(dia, ieDataInputId)) .filter(MultipleInstanceActivityPropertyReader::hasSourceRefs) .map(dia -> ItemNameReader.from(dia.getSourceRef().get(0)).getName()) .findFirst() .orElse(null); } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getCollectionInput() { String ieDataInputId = getLoopDataInputRefId(); return super.getDataInputAssociations().stream() .filter(dia -> hasTargetRef(dia, ieDataInputId)) .filter(MultipleInstanceActivityPropertyReader::hasSourceRefs) .map(dia -> ItemNameReader.from(dia.getSourceRef().get(0)).getName()) .findFirst() .orElse(null); } } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getCollectionInput() { String ieDataInputId = getLoopDataInputRefId(); return super.getDataInputAssociations().stream() .filter(dia -> hasTargetRef(dia, ieDataInputId)) .filter(MultipleInstanceActivityPropertyReader::hasSourceRefs) .map(dia -> ItemNameReader.from(dia.getSourceRef().get(0)).getName()) .findFirst() .orElse(null); } MultipleInstanceActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getCollectionInput() { String ieDataInputId = getLoopDataInputRefId(); return super.getDataInputAssociations().stream() .filter(dia -> hasTargetRef(dia, ieDataInputId)) .filter(MultipleInstanceActivityPropertyReader::hasSourceRefs) .map(dia -> ItemNameReader.from(dia.getSourceRef().get(0)).getName()) .findFirst() .orElse(null); } MultipleInstanceActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); boolean isMultipleInstance(); String getCollectionInput(); String getCollectionOutput(); String getDataInput(); String getDataOutput(); String getCompletionCondition(); boolean isSequential(); } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getCollectionInput() { String ieDataInputId = getLoopDataInputRefId(); return super.getDataInputAssociations().stream() .filter(dia -> hasTargetRef(dia, ieDataInputId)) .filter(MultipleInstanceActivityPropertyReader::hasSourceRefs) .map(dia -> ItemNameReader.from(dia.getSourceRef().get(0)).getName()) .findFirst() .orElse(null); } MultipleInstanceActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); boolean isMultipleInstance(); String getCollectionInput(); String getCollectionOutput(); String getDataInput(); String getDataOutput(); String getCompletionCondition(); boolean isSequential(); } |
@Test public void testGetDataInput() { DataInput item = mockDataInput(ITEM_ID, PROPERTY_ID); when(miloop.getInputDataItem()).thenReturn(item); assertEquals(PROPERTY_ID + DELIMITER + DATA_TYPE, reader.getDataInput()); } | public String getDataInput() { return getMultiInstanceLoopCharacteristics() .map(MultiInstanceLoopCharacteristics::getInputDataItem) .map(MultipleInstanceActivityPropertyReader::createInputVariable) .orElse(""); } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getDataInput() { return getMultiInstanceLoopCharacteristics() .map(MultiInstanceLoopCharacteristics::getInputDataItem) .map(MultipleInstanceActivityPropertyReader::createInputVariable) .orElse(""); } } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getDataInput() { return getMultiInstanceLoopCharacteristics() .map(MultiInstanceLoopCharacteristics::getInputDataItem) .map(MultipleInstanceActivityPropertyReader::createInputVariable) .orElse(""); } MultipleInstanceActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getDataInput() { return getMultiInstanceLoopCharacteristics() .map(MultiInstanceLoopCharacteristics::getInputDataItem) .map(MultipleInstanceActivityPropertyReader::createInputVariable) .orElse(""); } MultipleInstanceActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); boolean isMultipleInstance(); String getCollectionInput(); String getCollectionOutput(); String getDataInput(); String getDataOutput(); String getCompletionCondition(); boolean isSequential(); } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getDataInput() { return getMultiInstanceLoopCharacteristics() .map(MultiInstanceLoopCharacteristics::getInputDataItem) .map(MultipleInstanceActivityPropertyReader::createInputVariable) .orElse(""); } MultipleInstanceActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); boolean isMultipleInstance(); String getCollectionInput(); String getCollectionOutput(); String getDataInput(); String getDataOutput(); String getCompletionCondition(); boolean isSequential(); } |
@Test public void testGetEmptyDataInput() { DataInput item = mockDataInput(ITEM_ID, null); when(miloop.getInputDataItem()).thenReturn(item); assertEquals(ITEM_ID + DELIMITER + DATA_TYPE, reader.getDataInput()); } | public String getDataInput() { return getMultiInstanceLoopCharacteristics() .map(MultiInstanceLoopCharacteristics::getInputDataItem) .map(MultipleInstanceActivityPropertyReader::createInputVariable) .orElse(""); } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getDataInput() { return getMultiInstanceLoopCharacteristics() .map(MultiInstanceLoopCharacteristics::getInputDataItem) .map(MultipleInstanceActivityPropertyReader::createInputVariable) .orElse(""); } } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getDataInput() { return getMultiInstanceLoopCharacteristics() .map(MultiInstanceLoopCharacteristics::getInputDataItem) .map(MultipleInstanceActivityPropertyReader::createInputVariable) .orElse(""); } MultipleInstanceActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getDataInput() { return getMultiInstanceLoopCharacteristics() .map(MultiInstanceLoopCharacteristics::getInputDataItem) .map(MultipleInstanceActivityPropertyReader::createInputVariable) .orElse(""); } MultipleInstanceActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); boolean isMultipleInstance(); String getCollectionInput(); String getCollectionOutput(); String getDataInput(); String getDataOutput(); String getCompletionCondition(); boolean isSequential(); } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getDataInput() { return getMultiInstanceLoopCharacteristics() .map(MultiInstanceLoopCharacteristics::getInputDataItem) .map(MultipleInstanceActivityPropertyReader::createInputVariable) .orElse(""); } MultipleInstanceActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); boolean isMultipleInstance(); String getCollectionInput(); String getCollectionOutput(); String getDataInput(); String getDataOutput(); String getCompletionCondition(); boolean isSequential(); } |
@Test public void testGetEmptyDataOutput() { DataOutput item = mockDataOutput(ITEM_ID, null); when(miloop.getOutputDataItem()).thenReturn(item); assertEquals(ITEM_ID + DELIMITER + DATA_TYPE, reader.getDataOutput()); } | public String getDataOutput() { return getMultiInstanceLoopCharacteristics() .map(MultiInstanceLoopCharacteristics::getOutputDataItem) .map(MultipleInstanceActivityPropertyReader::createOutputVariable) .orElse(""); } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getDataOutput() { return getMultiInstanceLoopCharacteristics() .map(MultiInstanceLoopCharacteristics::getOutputDataItem) .map(MultipleInstanceActivityPropertyReader::createOutputVariable) .orElse(""); } } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getDataOutput() { return getMultiInstanceLoopCharacteristics() .map(MultiInstanceLoopCharacteristics::getOutputDataItem) .map(MultipleInstanceActivityPropertyReader::createOutputVariable) .orElse(""); } MultipleInstanceActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getDataOutput() { return getMultiInstanceLoopCharacteristics() .map(MultiInstanceLoopCharacteristics::getOutputDataItem) .map(MultipleInstanceActivityPropertyReader::createOutputVariable) .orElse(""); } MultipleInstanceActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); boolean isMultipleInstance(); String getCollectionInput(); String getCollectionOutput(); String getDataInput(); String getDataOutput(); String getCompletionCondition(); boolean isSequential(); } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getDataOutput() { return getMultiInstanceLoopCharacteristics() .map(MultiInstanceLoopCharacteristics::getOutputDataItem) .map(MultipleInstanceActivityPropertyReader::createOutputVariable) .orElse(""); } MultipleInstanceActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); boolean isMultipleInstance(); String getCollectionInput(); String getCollectionOutput(); String getDataInput(); String getDataOutput(); String getCompletionCondition(); boolean isSequential(); } |
@Test public void testGetCollectionOutput() { ItemAwareElement item = mockItemAwareElement(ITEM_ID); when(miloop.getLoopDataOutputRef()).thenReturn(item); List<DataOutputAssociation> outputAssociations = Collections.singletonList(mockDataOutputAssociation(ITEM_ID, PROPERTY_ID)); when(activity.getDataOutputAssociations()).thenReturn(outputAssociations); assertEquals(PROPERTY_ID, reader.getCollectionOutput()); } | public String getCollectionOutput() { String ieDataOutputId = getLoopDataOutputRefId(); return super.getDataOutputAssociations().stream() .filter(doa -> hasSourceRef(doa, ieDataOutputId)) .map(doa -> ItemNameReader.from(doa.getTargetRef()).getName()) .findFirst() .orElse(null); } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getCollectionOutput() { String ieDataOutputId = getLoopDataOutputRefId(); return super.getDataOutputAssociations().stream() .filter(doa -> hasSourceRef(doa, ieDataOutputId)) .map(doa -> ItemNameReader.from(doa.getTargetRef()).getName()) .findFirst() .orElse(null); } } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getCollectionOutput() { String ieDataOutputId = getLoopDataOutputRefId(); return super.getDataOutputAssociations().stream() .filter(doa -> hasSourceRef(doa, ieDataOutputId)) .map(doa -> ItemNameReader.from(doa.getTargetRef()).getName()) .findFirst() .orElse(null); } MultipleInstanceActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getCollectionOutput() { String ieDataOutputId = getLoopDataOutputRefId(); return super.getDataOutputAssociations().stream() .filter(doa -> hasSourceRef(doa, ieDataOutputId)) .map(doa -> ItemNameReader.from(doa.getTargetRef()).getName()) .findFirst() .orElse(null); } MultipleInstanceActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); boolean isMultipleInstance(); String getCollectionInput(); String getCollectionOutput(); String getDataInput(); String getDataOutput(); String getCompletionCondition(); boolean isSequential(); } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getCollectionOutput() { String ieDataOutputId = getLoopDataOutputRefId(); return super.getDataOutputAssociations().stream() .filter(doa -> hasSourceRef(doa, ieDataOutputId)) .map(doa -> ItemNameReader.from(doa.getTargetRef()).getName()) .findFirst() .orElse(null); } MultipleInstanceActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); boolean isMultipleInstance(); String getCollectionInput(); String getCollectionOutput(); String getDataInput(); String getDataOutput(); String getCompletionCondition(); boolean isSequential(); } |
@Test public void testGetDataOutput() { DataOutput item = mockDataOutput(ITEM_ID, PROPERTY_ID); when(miloop.getOutputDataItem()).thenReturn(item); assertEquals(PROPERTY_ID + DELIMITER + DATA_TYPE, reader.getDataOutput()); } | public String getDataOutput() { return getMultiInstanceLoopCharacteristics() .map(MultiInstanceLoopCharacteristics::getOutputDataItem) .map(MultipleInstanceActivityPropertyReader::createOutputVariable) .orElse(""); } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getDataOutput() { return getMultiInstanceLoopCharacteristics() .map(MultiInstanceLoopCharacteristics::getOutputDataItem) .map(MultipleInstanceActivityPropertyReader::createOutputVariable) .orElse(""); } } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getDataOutput() { return getMultiInstanceLoopCharacteristics() .map(MultiInstanceLoopCharacteristics::getOutputDataItem) .map(MultipleInstanceActivityPropertyReader::createOutputVariable) .orElse(""); } MultipleInstanceActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getDataOutput() { return getMultiInstanceLoopCharacteristics() .map(MultiInstanceLoopCharacteristics::getOutputDataItem) .map(MultipleInstanceActivityPropertyReader::createOutputVariable) .orElse(""); } MultipleInstanceActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); boolean isMultipleInstance(); String getCollectionInput(); String getCollectionOutput(); String getDataInput(); String getDataOutput(); String getCompletionCondition(); boolean isSequential(); } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getDataOutput() { return getMultiInstanceLoopCharacteristics() .map(MultiInstanceLoopCharacteristics::getOutputDataItem) .map(MultipleInstanceActivityPropertyReader::createOutputVariable) .orElse(""); } MultipleInstanceActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); boolean isMultipleInstance(); String getCollectionInput(); String getCollectionOutput(); String getDataInput(); String getDataOutput(); String getCompletionCondition(); boolean isSequential(); } |
@Test public void getGetCompletionCondition() { FormalExpression expression = mock(FormalExpression.class); when(expression.getBody()).thenReturn(EXPRESSION); when(miloop.getCompletionCondition()).thenReturn(expression); assertEquals(EXPRESSION, reader.getCompletionCondition()); } | public String getCompletionCondition() { return getMultiInstanceLoopCharacteristics() .map(miloop -> (FormalExpression) miloop.getCompletionCondition()) .map(FormalExpression::getBody) .orElse(""); } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getCompletionCondition() { return getMultiInstanceLoopCharacteristics() .map(miloop -> (FormalExpression) miloop.getCompletionCondition()) .map(FormalExpression::getBody) .orElse(""); } } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getCompletionCondition() { return getMultiInstanceLoopCharacteristics() .map(miloop -> (FormalExpression) miloop.getCompletionCondition()) .map(FormalExpression::getBody) .orElse(""); } MultipleInstanceActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getCompletionCondition() { return getMultiInstanceLoopCharacteristics() .map(miloop -> (FormalExpression) miloop.getCompletionCondition()) .map(FormalExpression::getBody) .orElse(""); } MultipleInstanceActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); boolean isMultipleInstance(); String getCollectionInput(); String getCollectionOutput(); String getDataInput(); String getDataOutput(); String getCompletionCondition(); boolean isSequential(); } | MultipleInstanceActivityPropertyReader extends ActivityPropertyReader { public String getCompletionCondition() { return getMultiInstanceLoopCharacteristics() .map(miloop -> (FormalExpression) miloop.getCompletionCondition()) .map(FormalExpression::getBody) .orElse(""); } MultipleInstanceActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); boolean isMultipleInstance(); String getCollectionInput(); String getCollectionOutput(); String getDataInput(); String getDataOutput(); String getCompletionCondition(); boolean isSequential(); } |
@Test public void getGenericServiceTask() { GenericServiceTaskValue task = reader.getGenericServiceTask(); assertEquals("Java", task.getServiceImplementation()); assertEquals("serviceOperation", task.getServiceOperation()); assertEquals("serviceInterface", task.getServiceInterface()); assertEquals("inMessageStructure", task.getInMessageStructure()); assertEquals("outMessageStructure", task.getOutMessagetructure()); assertEquals(SLA_DUE_DATE_CDATA, reader.getSLADueDate()); assertEquals(false, reader.isAsync()); assertEquals(true, reader.isAdHocAutostart()); assertNotNull(reader.getOnEntryAction()); assertNotNull(reader.getOnExitAction()); assertNotNull(reader.getAssignmentsInfo()); } | public GenericServiceTaskValue getGenericServiceTask() { GenericServiceTaskValue value = new GenericServiceTaskValue(); final String implementation = Optional.ofNullable(CustomAttribute.serviceImplementation.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> task.getImplementation()); value.setServiceImplementation(getServiceImplementation(implementation)); final String operation = Optional.ofNullable(CustomAttribute.serviceOperation.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> Optional .ofNullable(task.getOperationRef()) .map(Operation::getName) .orElse(null)); value.setServiceOperation(operation); value.setInMessageStructure(Optional.ofNullable(task.getOperationRef()) .map(Operation::getInMessageRef) .map(Message::getItemRef) .map(ItemDefinition::getStructureRef) .orElse(null)); value.setOutMessagetructure(Optional.ofNullable(task.getOperationRef()) .map(Operation::getOutMessageRef) .map(Message::getItemRef) .map(ItemDefinition::getStructureRef) .orElse(null)); final String serviceInterface = Optional.ofNullable(CustomAttribute.serviceInterface.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> Optional .ofNullable(task.getOperationRef()) .map(Operation::eContainer) .filter(container -> container instanceof Interface) .map(container -> (Interface) container) .map(Interface::getName) .orElse(null)); value.setServiceInterface(serviceInterface); return value; } | GenericServiceTaskPropertyReader extends MultipleInstanceActivityPropertyReader { public GenericServiceTaskValue getGenericServiceTask() { GenericServiceTaskValue value = new GenericServiceTaskValue(); final String implementation = Optional.ofNullable(CustomAttribute.serviceImplementation.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> task.getImplementation()); value.setServiceImplementation(getServiceImplementation(implementation)); final String operation = Optional.ofNullable(CustomAttribute.serviceOperation.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> Optional .ofNullable(task.getOperationRef()) .map(Operation::getName) .orElse(null)); value.setServiceOperation(operation); value.setInMessageStructure(Optional.ofNullable(task.getOperationRef()) .map(Operation::getInMessageRef) .map(Message::getItemRef) .map(ItemDefinition::getStructureRef) .orElse(null)); value.setOutMessagetructure(Optional.ofNullable(task.getOperationRef()) .map(Operation::getOutMessageRef) .map(Message::getItemRef) .map(ItemDefinition::getStructureRef) .orElse(null)); final String serviceInterface = Optional.ofNullable(CustomAttribute.serviceInterface.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> Optional .ofNullable(task.getOperationRef()) .map(Operation::eContainer) .filter(container -> container instanceof Interface) .map(container -> (Interface) container) .map(Interface::getName) .orElse(null)); value.setServiceInterface(serviceInterface); return value; } } | GenericServiceTaskPropertyReader extends MultipleInstanceActivityPropertyReader { public GenericServiceTaskValue getGenericServiceTask() { GenericServiceTaskValue value = new GenericServiceTaskValue(); final String implementation = Optional.ofNullable(CustomAttribute.serviceImplementation.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> task.getImplementation()); value.setServiceImplementation(getServiceImplementation(implementation)); final String operation = Optional.ofNullable(CustomAttribute.serviceOperation.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> Optional .ofNullable(task.getOperationRef()) .map(Operation::getName) .orElse(null)); value.setServiceOperation(operation); value.setInMessageStructure(Optional.ofNullable(task.getOperationRef()) .map(Operation::getInMessageRef) .map(Message::getItemRef) .map(ItemDefinition::getStructureRef) .orElse(null)); value.setOutMessagetructure(Optional.ofNullable(task.getOperationRef()) .map(Operation::getOutMessageRef) .map(Message::getItemRef) .map(ItemDefinition::getStructureRef) .orElse(null)); final String serviceInterface = Optional.ofNullable(CustomAttribute.serviceInterface.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> Optional .ofNullable(task.getOperationRef()) .map(Operation::eContainer) .filter(container -> container instanceof Interface) .map(container -> (Interface) container) .map(Interface::getName) .orElse(null)); value.setServiceInterface(serviceInterface); return value; } GenericServiceTaskPropertyReader(ServiceTask task, BPMNDiagram diagram, DefinitionResolver definitionResolver); } | GenericServiceTaskPropertyReader extends MultipleInstanceActivityPropertyReader { public GenericServiceTaskValue getGenericServiceTask() { GenericServiceTaskValue value = new GenericServiceTaskValue(); final String implementation = Optional.ofNullable(CustomAttribute.serviceImplementation.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> task.getImplementation()); value.setServiceImplementation(getServiceImplementation(implementation)); final String operation = Optional.ofNullable(CustomAttribute.serviceOperation.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> Optional .ofNullable(task.getOperationRef()) .map(Operation::getName) .orElse(null)); value.setServiceOperation(operation); value.setInMessageStructure(Optional.ofNullable(task.getOperationRef()) .map(Operation::getInMessageRef) .map(Message::getItemRef) .map(ItemDefinition::getStructureRef) .orElse(null)); value.setOutMessagetructure(Optional.ofNullable(task.getOperationRef()) .map(Operation::getOutMessageRef) .map(Message::getItemRef) .map(ItemDefinition::getStructureRef) .orElse(null)); final String serviceInterface = Optional.ofNullable(CustomAttribute.serviceInterface.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> Optional .ofNullable(task.getOperationRef()) .map(Operation::eContainer) .filter(container -> container instanceof Interface) .map(container -> (Interface) container) .map(Interface::getName) .orElse(null)); value.setServiceInterface(serviceInterface); return value; } GenericServiceTaskPropertyReader(ServiceTask task, BPMNDiagram diagram, DefinitionResolver definitionResolver); GenericServiceTaskValue getGenericServiceTask(); static String getServiceImplementation(String implementation); boolean isAsync(); boolean isAdHocAutostart(); String getSLADueDate(); } | GenericServiceTaskPropertyReader extends MultipleInstanceActivityPropertyReader { public GenericServiceTaskValue getGenericServiceTask() { GenericServiceTaskValue value = new GenericServiceTaskValue(); final String implementation = Optional.ofNullable(CustomAttribute.serviceImplementation.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> task.getImplementation()); value.setServiceImplementation(getServiceImplementation(implementation)); final String operation = Optional.ofNullable(CustomAttribute.serviceOperation.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> Optional .ofNullable(task.getOperationRef()) .map(Operation::getName) .orElse(null)); value.setServiceOperation(operation); value.setInMessageStructure(Optional.ofNullable(task.getOperationRef()) .map(Operation::getInMessageRef) .map(Message::getItemRef) .map(ItemDefinition::getStructureRef) .orElse(null)); value.setOutMessagetructure(Optional.ofNullable(task.getOperationRef()) .map(Operation::getOutMessageRef) .map(Message::getItemRef) .map(ItemDefinition::getStructureRef) .orElse(null)); final String serviceInterface = Optional.ofNullable(CustomAttribute.serviceInterface.of(task).get()) .filter(StringUtils::nonEmpty) .orElseGet(() -> Optional .ofNullable(task.getOperationRef()) .map(Operation::eContainer) .filter(container -> container instanceof Interface) .map(container -> (Interface) container) .map(Interface::getName) .orElse(null)); value.setServiceInterface(serviceInterface); return value; } GenericServiceTaskPropertyReader(ServiceTask task, BPMNDiagram diagram, DefinitionResolver definitionResolver); GenericServiceTaskValue getGenericServiceTask(); static String getServiceImplementation(String implementation); boolean isAsync(); boolean isAdHocAutostart(); String getSLADueDate(); static final String JAVA; static final String WEB_SERVICE; } |
@Test public void getProcessVariables() { String result = ProcessVariableReader.getProcessVariables(properties); assertEquals("PV1:Boolean:<![CDATA[internal;input;customTag]]>,PV2::[],PV3::[]", result); } | static String getProcessVariables(List<Property> properties) { return properties .stream() .filter(ProcessVariableReader::isProcessVariable) .map(ProcessVariableReader::toProcessVariableString) .collect(Collectors.joining(",")); } | ProcessVariableReader { static String getProcessVariables(List<Property> properties) { return properties .stream() .filter(ProcessVariableReader::isProcessVariable) .map(ProcessVariableReader::toProcessVariableString) .collect(Collectors.joining(",")); } } | ProcessVariableReader { static String getProcessVariables(List<Property> properties) { return properties .stream() .filter(ProcessVariableReader::isProcessVariable) .map(ProcessVariableReader::toProcessVariableString) .collect(Collectors.joining(",")); } } | ProcessVariableReader { static String getProcessVariables(List<Property> properties) { return properties .stream() .filter(ProcessVariableReader::isProcessVariable) .map(ProcessVariableReader::toProcessVariableString) .collect(Collectors.joining(",")); } static String getProcessVariableName(Property p); static boolean isProcessVariable(Property p); } | ProcessVariableReader { static String getProcessVariables(List<Property> properties) { return properties .stream() .filter(ProcessVariableReader::isProcessVariable) .map(ProcessVariableReader::toProcessVariableString) .collect(Collectors.joining(",")); } static String getProcessVariableName(Property p); static boolean isProcessVariable(Property p); } |
@Test public void testLoadModelComponents() { final String dmnModelName = "ModelName"; final DRGElement drgElement1 = mock(DRGElement.class); final DRGElement drgElement2 = mock(DRGElement.class); final DecisionComponent decisionComponent1 = mock(DecisionComponent.class); final DecisionComponent decisionComponent2 = mock(DecisionComponent.class); final List<DecisionComponent> decisionComponentsList = new ArrayList<>(); final Definitions definitions = mock(Definitions.class); when(definitions.getName()).thenReturn(new Name(dmnModelName)); when(dmnGraphUtils.getModelDefinitions()).thenReturn(definitions); when(dmnDiagramsSession.getModelDRGElements()).thenReturn(Arrays.asList(drgElement1, drgElement2)); when(drgElement1.getName()).thenReturn(new Name("Decision-1")); when(drgElement2.getName()).thenReturn(new Name("Decision-2")); when(decisionComponent1.getName()).thenReturn("Decision-1"); when(decisionComponent2.getName()).thenReturn("Decision-2"); doReturn(decisionComponent1).when(decisionComponents).makeDecisionComponent(dmnModelName, drgElement1); doReturn(decisionComponent2).when(decisionComponents).makeDecisionComponent(dmnModelName, drgElement2); doReturn(decisionComponentsList).when(decisionComponents).getModelDRGElements(); doNothing().when(decisionComponents).refreshView(); decisionComponents.loadModelComponents(); assertTrue(decisionComponentsList.contains(decisionComponent1)); assertTrue(decisionComponentsList.contains(decisionComponent2)); assertEquals(2, decisionComponentsList.size()); verify(decisionComponents).refreshView(); } | void loadModelComponents() { final String dmnModelName = dmnGraphUtils.getModelDefinitions().getName().getValue(); final List<DRGElement> dmnModelDRGElements = dmnDiagramsSession.getModelDRGElements(); getModelDRGElements().clear(); dmnModelDRGElements.forEach(drgElement -> { getModelDRGElements().add(makeDecisionComponent(dmnModelName, drgElement)); }); refreshView(); } | DecisionComponents { void loadModelComponents() { final String dmnModelName = dmnGraphUtils.getModelDefinitions().getName().getValue(); final List<DRGElement> dmnModelDRGElements = dmnDiagramsSession.getModelDRGElements(); getModelDRGElements().clear(); dmnModelDRGElements.forEach(drgElement -> { getModelDRGElements().add(makeDecisionComponent(dmnModelName, drgElement)); }); refreshView(); } } | DecisionComponents { void loadModelComponents() { final String dmnModelName = dmnGraphUtils.getModelDefinitions().getName().getValue(); final List<DRGElement> dmnModelDRGElements = dmnDiagramsSession.getModelDRGElements(); getModelDRGElements().clear(); dmnModelDRGElements.forEach(drgElement -> { getModelDRGElements().add(makeDecisionComponent(dmnModelName, drgElement)); }); refreshView(); } DecisionComponents(); @Inject DecisionComponents(final View view,
final DMNIncludeModelsClient client,
final ManagedInstance<DecisionComponentsItem> itemManagedInstance,
final DecisionComponentFilter filter,
final DMNDiagramsSession dmnDiagramsSession,
final DMNGraphUtils dmnGraphUtils); } | DecisionComponents { void loadModelComponents() { final String dmnModelName = dmnGraphUtils.getModelDefinitions().getName().getValue(); final List<DRGElement> dmnModelDRGElements = dmnDiagramsSession.getModelDRGElements(); getModelDRGElements().clear(); dmnModelDRGElements.forEach(drgElement -> { getModelDRGElements().add(makeDecisionComponent(dmnModelName, drgElement)); }); refreshView(); } DecisionComponents(); @Inject DecisionComponents(final View view,
final DMNIncludeModelsClient client,
final ManagedInstance<DecisionComponentsItem> itemManagedInstance,
final DecisionComponentFilter filter,
final DMNDiagramsSession dmnDiagramsSession,
final DMNGraphUtils dmnGraphUtils); @PostConstruct void init(); View getView(); void refresh(); void removeAllItems(); } | DecisionComponents { void loadModelComponents() { final String dmnModelName = dmnGraphUtils.getModelDefinitions().getName().getValue(); final List<DRGElement> dmnModelDRGElements = dmnDiagramsSession.getModelDRGElements(); getModelDRGElements().clear(); dmnModelDRGElements.forEach(drgElement -> { getModelDRGElements().add(makeDecisionComponent(dmnModelName, drgElement)); }); refreshView(); } DecisionComponents(); @Inject DecisionComponents(final View view,
final DMNIncludeModelsClient client,
final ManagedInstance<DecisionComponentsItem> itemManagedInstance,
final DecisionComponentFilter filter,
final DMNDiagramsSession dmnDiagramsSession,
final DMNGraphUtils dmnGraphUtils); @PostConstruct void init(); View getView(); void refresh(); void removeAllItems(); } |
@Test public void getProcessVariableName() { assertEquals("PV1", ProcessVariableReader.getProcessVariableName(property1)); assertEquals("PV2", ProcessVariableReader.getProcessVariableName(property2)); assertEquals("PV3", ProcessVariableReader.getProcessVariableName(property3)); assertEquals("caseFile_CV4", ProcessVariableReader.getProcessVariableName(property4)); assertEquals("caseFile_CV5", ProcessVariableReader.getProcessVariableName(property5)); } | public static String getProcessVariableName(Property p) { String name = p.getName(); return name == null || name.isEmpty() ? p.getId() : name; } | ProcessVariableReader { public static String getProcessVariableName(Property p) { String name = p.getName(); return name == null || name.isEmpty() ? p.getId() : name; } } | ProcessVariableReader { public static String getProcessVariableName(Property p) { String name = p.getName(); return name == null || name.isEmpty() ? p.getId() : name; } } | ProcessVariableReader { public static String getProcessVariableName(Property p) { String name = p.getName(); return name == null || name.isEmpty() ? p.getId() : name; } static String getProcessVariableName(Property p); static boolean isProcessVariable(Property p); } | ProcessVariableReader { public static String getProcessVariableName(Property p) { String name = p.getName(); return name == null || name.isEmpty() ? p.getId() : name; } static String getProcessVariableName(Property p); static boolean isProcessVariable(Property p); } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.