use of org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess in project kie-wb-common by kiegroup.
the class AdHocSubProcessTest method testUnmarshallTopLevelFilledPropertiesSubProcess.
@Test
@Override
public void testUnmarshallTopLevelFilledPropertiesSubProcess() {
final String SUB_PROCESS_NAME_JAVA = "Ad-hoc sub-process01 name ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
final String SUB_PROCESS_DOCUMENTATION_JAVA = "Ad-hoc sub-process01 doc\n ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
final String SUB_PROCESS_NAME_JAVASCRIPT = "Ad-hoc sub-process02 name ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
final String SUB_PROCESS_DOCUMENTATION_JAVASCRIPT = "Ad-hoc sub-process02 doc\n ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
final String SUB_PROCESS_NAME_MVEL = "Ad-hoc sub-process03 name ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
final String SUB_PROCESS_DOCUMENTATION_MVEL = "Ad-hoc sub-process03 doc\n ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
final String SUB_PROCESS_VARIABLES_JAVA = "subVar01:String:[]";
final String SUB_PROCESS_VARIABLES_JAVASCRIPT = "subVar02:String:[]";
final String SUB_PROCESS_VARIABLES_MVEL = "subVarString:String:[],subVarCustom:CustomType:[],subVarBoolean:Boolean:[],subVarFloat:Float:[],subVarInteger:Integer:[],subVarObject:Object:[]";
Diagram<Graph, Metadata> diagram = getDiagram();
assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM);
AdHocSubprocess topLevelSubProcessJava = getSubProcessNodeById(diagram, TOP_LEVEL_FILLED_SUBPROCESS_JAVA_ID, EMPTY_INCOME_EDGES, EMPTY_OUTCOME_EDGES);
assertGeneralSet(topLevelSubProcessJava.getGeneral(), SUB_PROCESS_NAME_JAVA, SUB_PROCESS_DOCUMENTATION_JAVA);
assertAdHocSubProcessExecutionSet(topLevelSubProcessJava.getExecutionSet(), ADHOC_COMPLETION_CONDITION_SCRIPT_DEFAULT, ADHOC_COMPLETION_CONDITION_LANGUAGE_MVEL, ADHOC_ORDERING_SEQUENTIAL, SUBPROCESS_ON_ENTRY_ACTION_JAVA, SUBPROCESS_SCRIPT_JAVA_LANGUAGE, SUBPROCESS_ON_EXIT_ACTION_JAVA, SUBPROCESS_SCRIPT_JAVA_LANGUAGE, IS_ASYNC, SLA_DUE_DATE);
assertSubProcessProcessData(topLevelSubProcessJava.getProcessData(), SUB_PROCESS_VARIABLES_JAVA);
AdHocSubprocess topLevelSubProcessJavascript = getSubProcessNodeById(diagram, TOP_LEVEL_FILLED_SUBPROCESS_JAVASCRIPT_ID, EMPTY_INCOME_EDGES, EMPTY_OUTCOME_EDGES);
assertGeneralSet(topLevelSubProcessJavascript.getGeneral(), SUB_PROCESS_NAME_JAVASCRIPT, SUB_PROCESS_DOCUMENTATION_JAVASCRIPT);
assertAdHocSubProcessExecutionSet(topLevelSubProcessJavascript.getExecutionSet(), ADHOC_COMPLETION_CONDITION_SCRIPT, ADHOC_COMPLETION_CONDITION_LANGUAGE_DROOLS, ADHOC_ORDERING_PARALLEL, SUBPROCESS_ON_ENTRY_ACTION_JAVASCRIPT, SUBPROCESS_SCRIPT_JAVASCRIPT_LANGUAGE, SUBPROCESS_ON_EXIT_ACTION_JAVASCRIPT, SUBPROCESS_SCRIPT_JAVASCRIPT_LANGUAGE, IS_ASYNC, SLA_DUE_DATE);
assertSubProcessProcessData(topLevelSubProcessJavascript.getProcessData(), SUB_PROCESS_VARIABLES_JAVASCRIPT);
AdHocSubprocess topLevelSubProcessMVEL = getSubProcessNodeById(diagram, TOP_LEVEL_FILLED_SUBPROCESS_MVEL_ID, EMPTY_INCOME_EDGES, EMPTY_OUTCOME_EDGES);
assertGeneralSet(topLevelSubProcessMVEL.getGeneral(), SUB_PROCESS_NAME_MVEL, SUB_PROCESS_DOCUMENTATION_MVEL);
assertAdHocSubProcessExecutionSet(topLevelSubProcessMVEL.getExecutionSet(), ADHOC_COMPLETION_CONDITION_SCRIPT_DEFAULT, ADHOC_COMPLETION_CONDITION_LANGUAGE_MVEL, ADHOC_ORDERING_SEQUENTIAL, SUBPROCESS_ON_ENTRY_ACTION_MVEL, SUBPROCESS_SCRIPT_MVEL_LANGUAGE, SUBPROCESS_ON_EXIT_ACTION_MVEL, SUBPROCESS_SCRIPT_MVEL_LANGUAGE, IS_ASYNC, SLA_DUE_DATE);
assertSubProcessProcessData(topLevelSubProcessMVEL.getProcessData(), SUB_PROCESS_VARIABLES_MVEL);
}
use of org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess in project kie-wb-common by kiegroup.
the class AdHocSubProcessTest method testUnmarshallSubProcessLevelEmptyPropertiesSubProcess.
@Test
@Override
public void testUnmarshallSubProcessLevelEmptyPropertiesSubProcess() {
Diagram<Graph, Metadata> diagram = getDiagram();
assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM);
AdHocSubprocess subProcessLevelSubProcess = getSubProcessNodeById(diagram, SUBPROCESS_LEVEL_EMPTY_SUBPROCESS_ID, EMPTY_INCOME_EDGES, EMPTY_OUTCOME_EDGES);
assertGeneralSet(subProcessLevelSubProcess.getGeneral(), DEFAULT_NAME, DEFAULT_DOCUMENTATION);
assertAdHocSubProcessExecutionSet(subProcessLevelSubProcess.getExecutionSet(), EMPTY_VALUE, ADHOC_COMPLETION_CONDITION_LANGUAGE_MVEL, ADHOC_ORDERING_SEQUENTIAL, EMPTY_VALUE, SUBPROCESS_SCRIPT_JAVA_LANGUAGE, EMPTY_VALUE, SUBPROCESS_SCRIPT_JAVA_LANGUAGE, IS_NOT_ASYNC, EMPTY_VALUE);
assertSubProcessProcessData(subProcessLevelSubProcess.getProcessData(), EMPTY_VALUE);
}
use of org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess in project kie-wb-common by kiegroup.
the class SubProcessConverterTest method setUp.
@Before
public void setUp() {
Definitions definitions = bpmn2.createDefinitions();
definitions.getRootElements().add(bpmn2.createProcess());
BPMNDiagram bpmnDiagram = di.createBPMNDiagram();
bpmnDiagram.setPlane(di.createBPMNPlane());
definitions.getDiagrams().add(bpmnDiagram);
definitionResolver = new DefinitionResolver(definitions, Collections.emptyList());
Node adHocNode = new NodeImpl("");
View<AdHocSubprocess> adHocContent = new ViewImpl<>(new AdHocSubprocess(), Bounds.create());
adHocNode.setContent(adHocContent);
Node multipleInstanceNode = new NodeImpl("");
View<MultipleInstanceSubprocess> miContent = new ViewImpl<>(new MultipleInstanceSubprocess(), Bounds.create());
multipleInstanceNode.setContent(miContent);
Node embeddedNode = new NodeImpl("");
View<EmbeddedSubprocess> embeddedContent = new ViewImpl<>(new EmbeddedSubprocess(), Bounds.create());
embeddedNode.setContent(embeddedContent);
Node eventNode = new NodeImpl("");
View<EventSubprocess> eventSubprocess = new ViewImpl<>(new EventSubprocess(), Bounds.create());
eventNode.setContent(eventSubprocess);
FactoryManager factoryManager = mock(FactoryManager.class);
when(factoryManager.newElement(any(), eq(getDefinitionId(AdHocSubprocess.class)))).thenReturn(adHocNode);
when(factoryManager.newElement(any(), eq(getDefinitionId(MultipleInstanceSubprocess.class)))).thenReturn(multipleInstanceNode);
when(factoryManager.newElement(any(), eq(getDefinitionId(EmbeddedSubprocess.class)))).thenReturn(embeddedNode);
when(factoryManager.newElement(any(), eq(getDefinitionId(EventSubprocess.class)))).thenReturn(eventNode);
TypedFactoryManager typedFactoryManager = new TypedFactoryManager(factoryManager);
tested = new SubProcessConverter(typedFactoryManager, new PropertyReaderFactory(definitionResolver), definitionResolver, new ConverterFactory(definitionResolver, typedFactoryManager));
}
use of org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess in project kie-wb-common by kiegroup.
the class AbstractDataTypeCacheTest method textExtractAdhocSubprocess.
@Test
public void textExtractAdhocSubprocess() {
AdHocSubprocess adHocSubprocess = new AdHocSubprocess();
AdHocSubprocess adHocSubprocess2 = new AdHocSubprocess();
when(firstView.getDefinition()).thenReturn(adHocSubprocess);
when(lastView.getDefinition()).thenReturn(adHocSubprocess2);
dataTypeCache.extractFromItem(firstView);
dataTypeCache.extractFromItem(lastView);
assertTrue(dataTypeCache.allDataTypes.contains("MyType"));
assertTrue(dataTypeCache.allDataTypes.contains("com.myspace.Person"));
}
use of org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess in project kie-wb-common by kiegroup.
the class VariableSearchService method getVariables.
protected String getVariables(Node<?, ? extends Edge> node) {
View view = node.getContent() instanceof View ? (View) node.getContent() : null;
if (view == null) {
return null;
}
if (view.getDefinition() instanceof EventSubprocess) {
return ((EventSubprocess) view.getDefinition()).getProcessData().getProcessVariables().getValue();
}
if (view.getDefinition() instanceof AdHocSubprocess) {
return ((AdHocSubprocess) view.getDefinition()).getProcessData().getProcessVariables().getValue();
}
if (view.getDefinition() instanceof EmbeddedSubprocess) {
return ((EmbeddedSubprocess) view.getDefinition()).getProcessData().getProcessVariables().getValue();
}
if (view.getDefinition() instanceof MultipleInstanceSubprocess) {
return ((MultipleInstanceSubprocess) view.getDefinition()).getProcessData().getProcessVariables().getValue();
}
if (view.getDefinition() instanceof BPMNDiagramImpl) {
BPMNDiagramImpl bpmnDiagram = ((BPMNDiagramImpl) view.getDefinition());
StringBuilder variablesBuilder = new StringBuilder();
String processVariables = bpmnDiagram.getProcessData().getProcessVariables().getValue();
if (!isEmpty(processVariables)) {
variablesBuilder.append(processVariables);
}
addCaseFileVariables(variablesBuilder, bpmnDiagram.getCaseManagementSet());
return variablesBuilder.length() > 0 ? variablesBuilder.toString() : null;
}
return null;
}
Aggregations