src_fm_fc_ms_ff
stringlengths 43
86.8k
| target
stringlengths 20
276k
|
|---|---|
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 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()); }
@Test public void testGetCollectionOutput() { ItemAwareElement item = mockItemAwareElement(ITEM_ID); when(miloop.getLoopDataOutputRef()).thenReturn(item); EList<DataOutputAssociation> outputAssociations = ECollections.singletonEList(mockDataOutputAssociation(ITEM_ID, PROPERTY_ID)); when(activity.getDataOutputAssociations()).thenReturn(outputAssociations); assertEquals(PROPERTY_ID, reader.getCollectionOutput()); }
|
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 getGetCompletionCondition() { FormalExpression expression = mock(FormalExpression.class); when(expression.getBody()).thenReturn(EXPRESSION); when(miloop.getCompletionCondition()).thenReturn(expression); assertEquals(EXPRESSION, reader.getCompletionCondition()); }
|
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 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()); }
@Test public void getGenericServiceTask() { GenericServiceTaskValue task = reader.getGenericServiceTask(); assertEquals("Java", task.getServiceImplementation()); assertEquals("serviceOperation", task.getServiceOperation()); assertEquals("serviceInterface", task.getServiceInterface()); assertEquals(SLA_DUE_DATE_CDATA, reader.getSLADueDate()); assertEquals(false, reader.isAsync()); assertEquals(true, reader.isAdHocAutostart()); assertNotNull(reader.getOnEntryAction()); assertNotNull(reader.getOnExitAction()); assertNotNull(reader.getAssignmentsInfo()); }
|
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 getProcessVariables() { String result = ProcessVariableReader.getProcessVariables(properties); assertEquals("PV1:Boolean:<![CDATA[internal;input;customTag]]>,PV2::[],PV3::[]", result); }
|
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 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(); }
|
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); }
|
@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)); }
|
ProcessVariableReader { public static boolean isProcessVariable(Property p) { return !CaseFileVariableReader.isCaseFileVariable(p); } static String getProcessVariableName(Property p); static boolean isProcessVariable(Property p); }
|
@Test public void isProcessVariable() { assertTrue(ProcessVariableReader.isProcessVariable(property1)); assertTrue(ProcessVariableReader.isProcessVariable(property2)); assertTrue(ProcessVariableReader.isProcessVariable(property3)); assertFalse(ProcessVariableReader.isProcessVariable(property4)); assertFalse(ProcessVariableReader.isProcessVariable(property5)); }
|
BasePropertyReader implements PropertyReader { @Override public Bounds getBounds() { if (shape == null) { return Bounds.create(); } return computeBounds(shape.getBounds()); } BasePropertyReader(final BaseElement element,
final BPMNDiagram diagram,
final BPMNShape shape,
final double resolutionFactor); @Override String getDocumentation(); @Override String getDescription(); @Override FontSet getFontSet(); @Override BackgroundSet getBackgroundSet(); @Override Bounds getBounds(); @Override CircleDimensionSet getCircleDimensionSet(); @Override RectangleDimensionsSet getRectangleDimensionsSet(); @Override boolean isExpanded(); @Override BaseElement getElement(); @Override BPMNShape getShape(); }
|
@Test public void testBounds() { Bounds bounds = tested.getBounds(); assertTrue(bounds.hasLowerRight()); assertTrue(bounds.hasUpperLeft()); assertEquals(0.7150000154972077d, bounds.getUpperLeft().getX(), 0d); assertEquals(1.4300000309944154d, bounds.getUpperLeft().getY(), 0d); assertEquals(65.71500001549721d, bounds.getLowerRight().getX(), 0d); assertEquals(355.9010174870491d, bounds.getLowerRight().getY(), 0d); }
|
BasePropertyReader implements PropertyReader { @Override public CircleDimensionSet getCircleDimensionSet() { if (shape == null) { return new CircleDimensionSet(); } return new CircleDimensionSet(new Radius( shape.getBounds().getWidth() * resolutionFactor / 2d)); } BasePropertyReader(final BaseElement element,
final BPMNDiagram diagram,
final BPMNShape shape,
final double resolutionFactor); @Override String getDocumentation(); @Override String getDescription(); @Override FontSet getFontSet(); @Override BackgroundSet getBackgroundSet(); @Override Bounds getBounds(); @Override CircleDimensionSet getCircleDimensionSet(); @Override RectangleDimensionsSet getRectangleDimensionsSet(); @Override boolean isExpanded(); @Override BaseElement getElement(); @Override BPMNShape getShape(); }
|
@Test public void testGetCircleDimensionSet() { CircleDimensionSet circleDimensionSet = tested.getCircleDimensionSet(); assertEquals(32.5d, circleDimensionSet.getRadius().getValue(), 0d); }
|
BasePropertyReader implements PropertyReader { @Override public RectangleDimensionsSet getRectangleDimensionsSet() { if (shape == null) { return new RectangleDimensionsSet(); } org.eclipse.dd.dc.Bounds bounds = shape.getBounds(); return new RectangleDimensionsSet(bounds.getWidth() * resolutionFactor, bounds.getHeight() * resolutionFactor); } BasePropertyReader(final BaseElement element,
final BPMNDiagram diagram,
final BPMNShape shape,
final double resolutionFactor); @Override String getDocumentation(); @Override String getDescription(); @Override FontSet getFontSet(); @Override BackgroundSet getBackgroundSet(); @Override Bounds getBounds(); @Override CircleDimensionSet getCircleDimensionSet(); @Override RectangleDimensionsSet getRectangleDimensionsSet(); @Override boolean isExpanded(); @Override BaseElement getElement(); @Override BPMNShape getShape(); }
|
@Test public void testGetRectangleDimensionsSet() { RectangleDimensionsSet rectangleDimensionsSet = tested.getRectangleDimensionsSet(); assertEquals(65.0d, rectangleDimensionsSet.getWidth().getValue(), 0d); assertEquals(354.4710174560547d, rectangleDimensionsSet.getHeight().getValue(), 0d); }
|
BasePropertyReader implements PropertyReader { @Override public boolean isExpanded() { return shape.isIsExpanded(); } BasePropertyReader(final BaseElement element,
final BPMNDiagram diagram,
final BPMNShape shape,
final double resolutionFactor); @Override String getDocumentation(); @Override String getDescription(); @Override FontSet getFontSet(); @Override BackgroundSet getBackgroundSet(); @Override Bounds getBounds(); @Override CircleDimensionSet getCircleDimensionSet(); @Override RectangleDimensionsSet getRectangleDimensionsSet(); @Override boolean isExpanded(); @Override BaseElement getElement(); @Override BPMNShape getShape(); }
|
@Test public void testIsExpandedTrue() { when(shape.isIsExpanded()).thenReturn(true); assertTrue(tested.isExpanded()); }
|
BasePropertyReader implements PropertyReader { @Override public BaseElement getElement() { return element; } BasePropertyReader(final BaseElement element,
final BPMNDiagram diagram,
final BPMNShape shape,
final double resolutionFactor); @Override String getDocumentation(); @Override String getDescription(); @Override FontSet getFontSet(); @Override BackgroundSet getBackgroundSet(); @Override Bounds getBounds(); @Override CircleDimensionSet getCircleDimensionSet(); @Override RectangleDimensionsSet getRectangleDimensionsSet(); @Override boolean isExpanded(); @Override BaseElement getElement(); @Override BPMNShape getShape(); }
|
@Test public void testGetElement() { assertEquals(element, tested.getElement()); }
|
BasePropertyReader implements PropertyReader { @Override public BPMNShape getShape() { return shape; } BasePropertyReader(final BaseElement element,
final BPMNDiagram diagram,
final BPMNShape shape,
final double resolutionFactor); @Override String getDocumentation(); @Override String getDescription(); @Override FontSet getFontSet(); @Override BackgroundSet getBackgroundSet(); @Override Bounds getBounds(); @Override CircleDimensionSet getCircleDimensionSet(); @Override RectangleDimensionsSet getRectangleDimensionsSet(); @Override boolean isExpanded(); @Override BaseElement getElement(); @Override BPMNShape getShape(); }
|
@Test public void testGetShape() { assertEquals(shape, tested.getShape()); }
|
AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { @Override public String getSourceId() { return association.getSourceRef().getId(); } AssociationPropertyReader(Association association,
BPMNDiagram diagram,
DefinitionResolver definitionResolver); @Override String getSourceId(); @Override String getTargetId(); Class<? extends org.kie.workbench.common.stunner.bpmn.definition.Association> getAssociationByDirection(); @Override Connection getSourceConnection(); @Override Connection getTargetConnection(); @Override List<Point2D> getControlPoints(); @Override DefinitionResolver getDefinitionResolver(); }
|
@Test public void testGetSourceId() { assertEquals(SOURCE_ID, propertyReader.getSourceId()); }
|
AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { @Override public String getTargetId() { return association.getTargetRef().getId(); } AssociationPropertyReader(Association association,
BPMNDiagram diagram,
DefinitionResolver definitionResolver); @Override String getSourceId(); @Override String getTargetId(); Class<? extends org.kie.workbench.common.stunner.bpmn.definition.Association> getAssociationByDirection(); @Override Connection getSourceConnection(); @Override Connection getTargetConnection(); @Override List<Point2D> getControlPoints(); @Override DefinitionResolver getDefinitionResolver(); }
|
@Test public void testGetTargetId() { assertEquals(TARGET_ID, propertyReader.getTargetId()); }
|
DecisionComponents { List<DMNIncludedModel> getDMNIncludedModels() { return dmnDiagramsSession .getModelImports() .stream() .filter(anImport -> Objects.equals(DMNImportTypes.DMN, determineImportType(anImport.getImportType()))) .map(this::asDMNIncludedModel) .collect(Collectors.toList()); } 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 testGetDMNIncludedModelsOnlyIncludesDMN() { final ImportDMN dmnImport = new ImportDMN(); final ImportPMML pmmlImport = new ImportPMML(); dmnImport.getName().setValue("dmn"); dmnImport.setImportType(DMNImportTypes.DMN.getDefaultNamespace()); pmmlImport.setImportType(DMNImportTypes.PMML.getDefaultNamespace()); when(dmnDiagramsSession.getModelImports()).thenReturn(asList(dmnImport, pmmlImport)); final List<DMNIncludedModel> includedModels = decisionComponents.getDMNIncludedModels(); assertThat(includedModels).hasSize(1); assertThat(includedModels.get(0).getModelName()).isEqualTo("dmn"); assertThat(includedModels.get(0).getImportType()).isEqualTo(DMNImportTypes.DMN.getDefaultNamespace()); }
|
AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { @Override public Connection getSourceConnection() { Point2D sourcePosition = PropertyReaderUtils.getSourcePosition(definitionResolver, element.getId(), getSourceId()); return MagnetConnection.Builder .at(sourcePosition.getX(), sourcePosition.getY()) .setAuto(PropertyReaderUtils.isAutoConnectionSource(element)); } AssociationPropertyReader(Association association,
BPMNDiagram diagram,
DefinitionResolver definitionResolver); @Override String getSourceId(); @Override String getTargetId(); Class<? extends org.kie.workbench.common.stunner.bpmn.definition.Association> getAssociationByDirection(); @Override Connection getSourceConnection(); @Override Connection getTargetConnection(); @Override List<Point2D> getControlPoints(); @Override DefinitionResolver getDefinitionResolver(); }
|
@Test public void testGetSourceConnection() { mockStatic(PropertyReaderUtils.class); PowerMockito.when(PropertyReaderUtils.getSourcePosition(definitionResolver, ASSOCIATION_ID, SOURCE_ID)).thenReturn(position); boolean arbitraryBoolean = true; PowerMockito.when(PropertyReaderUtils.isAutoConnectionSource(association)).thenReturn(arbitraryBoolean); Connection result = propertyReader.getSourceConnection(); assertEquals(X, result.getLocation().getX(), 0); assertEquals(Y, result.getLocation().getY(), 0); }
|
AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { @Override public Connection getTargetConnection() { Point2D targetPosition = PropertyReaderUtils.getTargetPosition(definitionResolver, element.getId(), getTargetId()); return MagnetConnection.Builder .at(targetPosition.getX(), targetPosition.getY()) .setAuto(PropertyReaderUtils.isAutoConnectionTarget(element)); } AssociationPropertyReader(Association association,
BPMNDiagram diagram,
DefinitionResolver definitionResolver); @Override String getSourceId(); @Override String getTargetId(); Class<? extends org.kie.workbench.common.stunner.bpmn.definition.Association> getAssociationByDirection(); @Override Connection getSourceConnection(); @Override Connection getTargetConnection(); @Override List<Point2D> getControlPoints(); @Override DefinitionResolver getDefinitionResolver(); }
|
@Test public void testGetTargetConnection() { mockStatic(PropertyReaderUtils.class); PowerMockito.when(PropertyReaderUtils.getTargetPosition(definitionResolver, ASSOCIATION_ID, TARGET_ID)).thenReturn(position); boolean arbitraryBoolean = true; PowerMockito.when(PropertyReaderUtils.isAutoConnectionSource(association)).thenReturn(arbitraryBoolean); Connection result = propertyReader.getTargetConnection(); assertEquals(X, result.getLocation().getX(), 0); assertEquals(Y, result.getLocation().getY(), 0); }
|
AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { public Class<? extends org.kie.workbench.common.stunner.bpmn.definition.Association> getAssociationByDirection() { return Optional.ofNullable(association.getAssociationDirection()) .filter(d -> !AssociationDirection.NONE.equals(d)) .<Class<? extends org.kie.workbench.common.stunner.bpmn.definition.Association>>map(d -> DirectionalAssociation.class) .orElse(NonDirectionalAssociation.class); } AssociationPropertyReader(Association association,
BPMNDiagram diagram,
DefinitionResolver definitionResolver); @Override String getSourceId(); @Override String getTargetId(); Class<? extends org.kie.workbench.common.stunner.bpmn.definition.Association> getAssociationByDirection(); @Override Connection getSourceConnection(); @Override Connection getTargetConnection(); @Override List<Point2D> getControlPoints(); @Override DefinitionResolver getDefinitionResolver(); }
|
@Test public void testGetAssociationByDirection() { final Association association = Bpmn2Factory.eINSTANCE.createAssociation(); association.setAssociationDirection(null); propertyReader = new AssociationPropertyReader(association, bpmnDiagram, definitionResolver); assertEquals(NonDirectionalAssociation.class, propertyReader.getAssociationByDirection()); association.setAssociationDirection(AssociationDirection.NONE); assertEquals(NonDirectionalAssociation.class, propertyReader.getAssociationByDirection()); association.setAssociationDirection(AssociationDirection.ONE); assertEquals(DirectionalAssociation.class, propertyReader.getAssociationByDirection()); }
|
AssociationPropertyReader extends BasePropertyReader implements EdgePropertyReader { @Override public List<Point2D> getControlPoints() { return PropertyReaderUtils.getControlPoints(definitionResolver, element.getId()); } AssociationPropertyReader(Association association,
BPMNDiagram diagram,
DefinitionResolver definitionResolver); @Override String getSourceId(); @Override String getTargetId(); Class<? extends org.kie.workbench.common.stunner.bpmn.definition.Association> getAssociationByDirection(); @Override Connection getSourceConnection(); @Override Connection getTargetConnection(); @Override List<Point2D> getControlPoints(); @Override DefinitionResolver getDefinitionResolver(); }
|
@Test @SuppressWarnings("unchecked") public void testGetControlPoints() { List<Point2D> controlPoints = mock(List.class); mockStatic(PropertyReaderUtils.class); PowerMockito.when(PropertyReaderUtils.getControlPoints(definitionResolver, ASSOCIATION_ID)).thenReturn(controlPoints); assertEquals(controlPoints, propertyReader.getControlPoints()); }
|
CaseFileVariableReader { static String getCaseFileVariables(List<Property> properties) { return properties .stream() .filter(CaseFileVariableReader::isCaseFileVariable) .map(CaseFileVariableReader::toCaseFileVariableString) .collect(Collectors.joining(",")); } static boolean isCaseFileVariable(Property p); }
|
@Test public void getCaseFileVariables() { String caseFileVariables = CaseFileVariableReader.getCaseFileVariables(properties); assertEquals(caseFileVariables, "CFV1:Boolean,CFV2:Boolean"); }
|
CaseFileVariableReader { public static boolean isCaseFileVariable(Property p) { String name = getCaseFileVariableName(p); return name.startsWith(CaseFileVariables.CASE_FILE_PREFIX); } static boolean isCaseFileVariable(Property p); }
|
@Test public void isCaseFileVariable() { boolean isCaseFile1 = CaseFileVariableReader.isCaseFileVariable(property1); assertTrue(isCaseFile1); boolean isCaseFile2 = CaseFileVariableReader.isCaseFileVariable(property2); assertTrue(isCaseFile2); boolean isCaseFile3 = CaseFileVariableReader.isCaseFileVariable(property3); assertFalse(isCaseFile3); boolean isCaseFile4 = CaseFileVariableReader.isCaseFileVariable(property4); assertFalse(isCaseFile4); }
|
AssignmentsInfos { public static ParsedAssignmentsInfo parsed( List<DataInput> datainput, List<DataInputAssociation> inputAssociations, List<DataOutput> dataoutput, List<DataOutputAssociation> outputAssociations, boolean alternativeEncoding) { DeclarationList inputs = dataInputDeclarations(datainput); DeclarationList outputs = dataOutputDeclarations(dataoutput); AssociationList associations = new AssociationList( inAssociationDeclarations(inputAssociations), outAssociationDeclarations(outputAssociations)); return new ParsedAssignmentsInfo( inputs, outputs, associations, alternativeEncoding); } static AssignmentsInfo of(
final List<DataInput> datainput,
final List<DataInputAssociation> inputAssociations,
final List<DataOutput> dataoutput,
final List<DataOutputAssociation> outputAssociations,
boolean alternativeEncoding); static ParsedAssignmentsInfo parsed(
List<DataInput> datainput,
List<DataInputAssociation> inputAssociations,
List<DataOutput> dataoutput,
List<DataOutputAssociation> outputAssociations,
boolean alternativeEncoding); static boolean isReservedDeclaration(DataInput o); static boolean isReservedIdentifier(String targetName); }
|
@Test public void JBPM_7447_shouldNotFilterOutDataOutputsWithEmptyType() { DataInput dataInput = bpmn2.createDataInput(); dataInput.setName("InputName"); dataInput.setId("InputID"); DataOutput dataOutput = bpmn2.createDataOutput(); dataOutput.setName("OutputName"); dataOutput.setId("OutputID"); ParsedAssignmentsInfo result = AssignmentsInfos.parsed( Collections.singletonList(dataInput), Collections.emptyList(), Collections.singletonList(dataOutput), Collections.emptyList(), false ); assertThat(result.getOutputs().getDeclarations()).isNotEmpty(); }
@Test public void JBPM_7447_shouldNotFilterOutDataOutputsWithEmptyType() { DataInput dataInput = bpmn2.createDataInput(); dataInput.setName("InputName"); dataInput.setId("InputID"); DataOutput dataOutput = bpmn2.createDataOutput(); dataOutput.setName("OutputName"); dataOutput.setId("OutputID"); ParsedAssignmentsInfo result = AssignmentsInfos.parsed( Collections.singletonList(dataInput), Collections.emptyList(), Collections.singletonList(dataOutput), Collections.emptyList(), false ); assertFalse(result.getOutputs().getDeclarations().isEmpty()); }
|
DefinitionsPropertyReader extends BasePropertyReader { public List<WSDLImport> getWSDLImports() { return definitions.getImports().stream() .map(PropertyReaderUtils::toWSDLImports) .collect(Collectors.toList()); } DefinitionsPropertyReader(Definitions element, BPMNDiagram diagram, BPMNShape shape, double resolutionFactor); List<WSDLImport> getWSDLImports(); }
|
@Test public void getWSDLImports() { final String LOCATION = "location"; final String NAMESPACE = "namespace"; final int QTY = 10; for (int i = 0; i < QTY; i++) { Import imp = PropertyWriterUtils.toImport(new WSDLImport(LOCATION + i, NAMESPACE + i)); definitions.getImports().add(imp); } List<WSDLImport> wsdlImports = tested.getWSDLImports(); assertEquals(QTY, wsdlImports.size()); for (int i = 0; i < QTY; i++) { assertEquals(LOCATION + i, wsdlImports.get(i).getLocation()); assertEquals(NAMESPACE + i, wsdlImports.get(i).getNamespace()); } }
|
ProcessPropertyReader extends BasePropertyReader { public List<DefaultImport> getDefaultImports() { return CustomElement.defaultImports.of(process).get(); } ProcessPropertyReader(Process element, BPMNDiagram diagram, BPMNShape shape, double resolutionFactor); String getPackage(); String getProcessType(); String getVersion(); boolean isAdHoc(); @Override Bounds getBounds(); String getProcessVariables(); String getCaseIdPrefix(); String getCaseFileVariables(); String getCaseRoles(); FlowElement getFlowElement(String id); String getGlobalVariables(); String getMetaDataAttributes(); List<DefaultImport> getDefaultImports(); String getSlaDueDate(); }
|
@Test public void getDefaultImports() { final String CLASS_NAME = "className"; final int QTY = 10; List<DefaultImport> defaultImports = new ArrayList<>(); for (int i = 0; i < QTY; i++) { defaultImports.add(new DefaultImport(CLASS_NAME + i)); } CustomElement.defaultImports.of(process).set(defaultImports); List<DefaultImport> result = tested.getDefaultImports(); assertEquals(QTY, result.size()); for (int i = 0; i < result.size(); i++) { assertEquals(CLASS_NAME + i, result.get(i).getClassName()); } }
|
ProcessPropertyReader extends BasePropertyReader { public String getProcessType() { return process.getProcessType().getName(); } ProcessPropertyReader(Process element, BPMNDiagram diagram, BPMNShape shape, double resolutionFactor); String getPackage(); String getProcessType(); String getVersion(); boolean isAdHoc(); @Override Bounds getBounds(); String getProcessVariables(); String getCaseIdPrefix(); String getCaseFileVariables(); String getCaseRoles(); FlowElement getFlowElement(String id); String getGlobalVariables(); String getMetaDataAttributes(); List<DefaultImport> getDefaultImports(); String getSlaDueDate(); }
|
@Test public void getProcessType() { ProcessPropertyWriter writer = new ProcessPropertyWriter( bpmn2.createProcess(), null, null); writer.setType(ProcessType.PRIVATE.getName()); tested = new ProcessPropertyReader(writer.getProcess(), definitionResolver.getDiagram(), definitionResolver.getShape(process.getId()), definitionResolver.getResolutionFactor()); assertEquals(tested.getProcessType(), ProcessType.PRIVATE.getName()); writer.setType(ProcessType.PUBLIC.getName()); tested = new ProcessPropertyReader(writer.getProcess(), definitionResolver.getDiagram(), definitionResolver.getShape(process.getId()), definitionResolver.getResolutionFactor()); assertEquals(tested.getProcessType(), ProcessType.PUBLIC.getName()); writer.setType(ProcessType.NONE.getName()); tested = new ProcessPropertyReader(writer.getProcess(), definitionResolver.getDiagram(), definitionResolver.getShape(process.getId()), definitionResolver.getResolutionFactor()); assertEquals(tested.getProcessType(), ProcessType.NONE.getName()); }
|
DecisionComponents { void applyTermFilter(final String value) { getFilter().setTerm(value); applyFilter(); } 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 testApplyTermFilter() { final String value = "value"; doNothing().when(decisionComponents).applyFilter(); decisionComponents.applyTermFilter(value); verify(filter).setTerm(value); verify(decisionComponents).applyFilter(); }
|
ScriptTaskPropertyReader extends TaskPropertyReader { public ScriptTypeValue getScript() { return new ScriptTypeValue( Scripts.scriptLanguageFromUri(task.getScriptFormat(), Scripts.LANGUAGE.JAVA.language()), Optional.ofNullable(task.getScript()).orElse(null) ); } ScriptTaskPropertyReader(ScriptTask task, BPMNDiagram diagram, DefinitionResolver definitionResolver); ScriptTypeValue getScript(); boolean isAsync(); boolean isAdHocAutoStart(); }
|
@Test public void testGetScript() { for (Scripts.LANGUAGE language : Scripts.LANGUAGE.values()) { testGetScript(new ScriptTypeValue(language.language(), SCRIPT), language.format(), SCRIPT); } }
|
AdHocSubProcessPropertyReader extends SubProcessPropertyReader { public ScriptTypeValue getAdHocCompletionCondition() { if (process.getCompletionCondition() instanceof FormalExpression) { FormalExpression completionCondition = (FormalExpression) process.getCompletionCondition(); return new ScriptTypeValue( Scripts.scriptLanguageFromUri(completionCondition.getLanguage(), Scripts.LANGUAGE.MVEL.language()), completionCondition.getBody() ); } else { return new ScriptTypeValue(Scripts.LANGUAGE.MVEL.language(), "autocomplete"); } } AdHocSubProcessPropertyReader(AdHocSubProcess element, BPMNDiagram diagram, DefinitionResolver definitionResolver); String getAdHocActivationCondition(); ScriptTypeValue getAdHocCompletionCondition(); String getAdHocOrdering(); boolean isAdHocAutostart(); }
|
@Test public void testGetAdHocCompletionConditionWithoutFormalExpression() { when(process.getCompletionCondition()).thenReturn(null); assertEquals(new ScriptTypeValue(Scripts.LANGUAGE.MVEL.language(), "autocomplete"), propertyReader.getAdHocCompletionCondition()); }
|
AdHocSubProcessPropertyReader extends SubProcessPropertyReader { public boolean isAdHocAutostart() { return CustomElement.autoStart.of(element).get(); } AdHocSubProcessPropertyReader(AdHocSubProcess element, BPMNDiagram diagram, DefinitionResolver definitionResolver); String getAdHocActivationCondition(); ScriptTypeValue getAdHocCompletionCondition(); String getAdHocOrdering(); boolean isAdHocAutostart(); }
|
@Test public void testIsAdHocAutostart_true() { String id = UUID.randomUUID().toString(); AdHocSubProcess adHocSubProcess = bpmn2.createAdHocSubProcess(); adHocSubProcess.setId(id); CustomElement.autoStart.of(adHocSubProcess).set(Boolean.TRUE); tested = new AdHocSubProcessPropertyReader(adHocSubProcess, definitionResolverReal.getDiagram(), definitionResolverReal); assertTrue(tested.isAdHocAutostart()); }
@Test public void testIsAdHocAutostart_false() { String id = UUID.randomUUID().toString(); AdHocSubProcess adHocSubProcess = bpmn2.createAdHocSubProcess(); adHocSubProcess.setId(id); CustomElement.autoStart.of(adHocSubProcess).set(Boolean.FALSE); tested = new AdHocSubProcessPropertyReader(adHocSubProcess, definitionResolverReal.getDiagram(), definitionResolverReal); assertFalse(tested.isAdHocAutostart()); }
|
AdHocSubProcessPropertyReader extends SubProcessPropertyReader { public String getAdHocActivationCondition() { return CustomElement.customActivationCondition.of(element).get(); } AdHocSubProcessPropertyReader(AdHocSubProcess element, BPMNDiagram diagram, DefinitionResolver definitionResolver); String getAdHocActivationCondition(); ScriptTypeValue getAdHocCompletionCondition(); String getAdHocOrdering(); boolean isAdHocAutostart(); }
|
@Test public void testIsAdHocActivationCondition() { AdHocSubProcess adHocSubProcess = bpmn2.createAdHocSubProcess(); CustomElement.customActivationCondition.of(adHocSubProcess).set("some condition"); tested = new AdHocSubProcessPropertyReader(adHocSubProcess, definitionResolverReal.getDiagram(), definitionResolverReal); assertEquals(asCData("some condition"), tested.getAdHocActivationCondition()); }
|
ActivityPropertyReader extends FlowElementPropertyReader { public ScriptTypeListValue getOnEntryAction() { return Scripts.onEntry(element.getExtensionValues()); } ActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); ScriptTypeListValue getOnEntryAction(); ScriptTypeListValue getOnExitAction(); SimulationSet getSimulationSet(); AssignmentsInfo getAssignmentsInfo(); }
|
@Test public void testGetOnEntryScript() { OnEntryScriptType onEntryScript = Mockito.mock(OnEntryScriptType.class); when(onEntryScript.getScript()).thenReturn(SCRIPT); when(onEntryScript.getScriptFormat()).thenReturn(JAVA_FORMAT); List<OnEntryScriptType> onEntryScripts = Collections.singletonList(onEntryScript); List<ExtensionAttributeValue> extensions = mockExtensions(DroolsPackage.Literals.DOCUMENT_ROOT__ON_ENTRY_SCRIPT, onEntryScripts); when(activity.getExtensionValues()).thenReturn(extensions); assertScript(JAVA, SCRIPT, reader.getOnEntryAction()); }
@Test public void testGetOnEntryScript() { OnEntryScriptType onEntryScript = Mockito.mock(OnEntryScriptType.class); when(onEntryScript.getScript()).thenReturn(SCRIPT); when(onEntryScript.getScriptFormat()).thenReturn(JAVA_FORMAT); List<OnEntryScriptType> onEntryScripts = Collections.singletonList(onEntryScript); EList<ExtensionAttributeValue> extensions = mockExtensions(DroolsPackage.Literals.DOCUMENT_ROOT__ON_ENTRY_SCRIPT, onEntryScripts); when(activity.getExtensionValues()).thenReturn(extensions); assertScript(JAVA, SCRIPT, reader.getOnEntryAction()); }
|
ActivityPropertyReader extends FlowElementPropertyReader { public ScriptTypeListValue getOnExitAction() { return Scripts.onExit(element.getExtensionValues()); } ActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); ScriptTypeListValue getOnEntryAction(); ScriptTypeListValue getOnExitAction(); SimulationSet getSimulationSet(); AssignmentsInfo getAssignmentsInfo(); }
|
@Test public void testGetOnExitScript() { OnExitScriptType onExitScript = Mockito.mock(OnExitScriptType.class); when(onExitScript.getScript()).thenReturn(SCRIPT); when(onExitScript.getScriptFormat()).thenReturn(JAVA_FORMAT); List<OnExitScriptType> onExitScripts = Collections.singletonList(onExitScript); List<ExtensionAttributeValue> extensions = mockExtensions(DroolsPackage.Literals.DOCUMENT_ROOT__ON_EXIT_SCRIPT, onExitScripts); when(activity.getExtensionValues()).thenReturn(extensions); assertScript(JAVA, SCRIPT, reader.getOnExitAction()); }
@Test public void testGetOnExitScript() { OnExitScriptType onExitScript = Mockito.mock(OnExitScriptType.class); when(onExitScript.getScript()).thenReturn(SCRIPT); when(onExitScript.getScriptFormat()).thenReturn(JAVA_FORMAT); List<OnExitScriptType> onExitScripts = Collections.singletonList(onExitScript); EList<ExtensionAttributeValue> extensions = mockExtensions(DroolsPackage.Literals.DOCUMENT_ROOT__ON_EXIT_SCRIPT, onExitScripts); when(activity.getExtensionValues()).thenReturn(extensions); assertScript(JAVA, SCRIPT, reader.getOnExitAction()); }
|
ActivityPropertyReader extends FlowElementPropertyReader { public AssignmentsInfo getAssignmentsInfo() { AssignmentsInfo info = AssignmentsInfos.of(getDataInputs(), getDataInputAssociations(), getDataOutputs(), getDataOutputAssociations(), getIOSpecification().isPresent()); if (info.getValue().isEmpty()) { info.setValue(EMPTY_ASSIGNMENTS); } return info; } ActivityPropertyReader(Activity activity, BPMNDiagram diagram, DefinitionResolver definitionResolver); ScriptTypeListValue getOnEntryAction(); ScriptTypeListValue getOnExitAction(); SimulationSet getSimulationSet(); AssignmentsInfo getAssignmentsInfo(); }
|
@Test public void testGetAssignmentsInfo() { List<DataInput> dataInputs = new ArrayList<>(); DataInput dataInput1 = mockDataInput("INPUT_ID_1", "INPUT_NAME_1", mockEntry("dtype", "Integer")); DataInput dataInput2 = mockDataInput("INPUT_ID_2", "INPUT_NAME_2", mockEntry("dtype", "String")); dataInputs.add(dataInput1); dataInputs.add(dataInput2); InputOutputSpecification ioSpec = mock(InputOutputSpecification.class); List<DataInputAssociation> dataInputAssociations = new ArrayList<>(); DataInputAssociation inputAssociation = mockDataInputAssociation(dataInput1, "VARIABLE1"); DataInputAssociation inputAssociation2 = mockDataInputAssociation(dataInput2, "VARIABLE2"); dataInputAssociations.add(inputAssociation); dataInputAssociations.add(inputAssociation2); List<DataOutput> dataOutputs = new ArrayList<>(); DataOutput dataOutput1 = mockDataOutput("OUTPUT_ID_1", "OUTPUT_NAME_1", mockEntry("dtype", "Boolean")); DataOutput dataOutput2 = mockDataOutput("OUTPUT_ID_2", "OUTPUT_NAME_2", mockEntry("dtype", "Float")); dataOutputs.add(dataOutput1); dataOutputs.add(dataOutput2); List<DataOutputAssociation> dataOutputAssociations = new ArrayList<>(); DataOutputAssociation outputAssociation1 = mockDataOutputAssociation(dataOutput1, "VARIABLE3"); DataOutputAssociation outputAssociation2 = mockDataOutputAssociation(dataOutput2, "VARIABLE4"); dataOutputAssociations.add(outputAssociation1); dataOutputAssociations.add(outputAssociation2); when(ioSpec.getDataInputs()).thenReturn(dataInputs); when(ioSpec.getDataOutputs()).thenReturn(dataOutputs); when(activity.getIoSpecification()).thenReturn(ioSpec); when(activity.getDataInputAssociations()).thenReturn(dataInputAssociations); when(activity.getDataOutputAssociations()).thenReturn(dataOutputAssociations); AssignmentsInfo result = reader.getAssignmentsInfo(); String expectedResult = "|INPUT_NAME_1:Integer,INPUT_NAME_2:String||OUTPUT_NAME_1:Boolean,OUTPUT_NAME_2:Float|[din]VARIABLE1->INPUT_NAME_1,[din]VARIABLE2->INPUT_NAME_2,[dout]OUTPUT_NAME_1->VARIABLE3,[dout]OUTPUT_NAME_2->VARIABLE4"; assertEquals(expectedResult, result.getValue()); }
@Test public void testGetAssignmentsInfo() { EList<DataInput> dataInputs = ECollections.newBasicEList(); DataInput dataInput1 = mockDataInput("INPUT_ID_1", "INPUT_NAME_1", mockEntry("dtype", "Integer")); DataInput dataInput2 = mockDataInput("INPUT_ID_2", "INPUT_NAME_2", mockEntry("dtype", "String")); dataInputs.add(dataInput1); dataInputs.add(dataInput2); InputOutputSpecification ioSpec = mock(InputOutputSpecification.class); EList<DataInputAssociation> dataInputAssociations = ECollections.newBasicEList(); DataInputAssociation inputAssociation = mockDataInputAssociation(dataInput1, "VARIABLE1"); DataInputAssociation inputAssociation2 = mockDataInputAssociation(dataInput2, "VARIABLE2"); dataInputAssociations.add(inputAssociation); dataInputAssociations.add(inputAssociation2); EList<DataOutput> dataOutputs = ECollections.newBasicEList(); DataOutput dataOutput1 = mockDataOutput("OUTPUT_ID_1", "OUTPUT_NAME_1", mockEntry("dtype", "Boolean")); DataOutput dataOutput2 = mockDataOutput("OUTPUT_ID_2", "OUTPUT_NAME_2", mockEntry("dtype", "Float")); dataOutputs.add(dataOutput1); dataOutputs.add(dataOutput2); EList<DataOutputAssociation> dataOutputAssociations = ECollections.newBasicEList(); DataOutputAssociation outputAssociation1 = mockDataOutputAssociation(dataOutput1, "VARIABLE3"); DataOutputAssociation outputAssociation2 = mockDataOutputAssociation(dataOutput2, "VARIABLE4"); dataOutputAssociations.add(outputAssociation1); dataOutputAssociations.add(outputAssociation2); when(ioSpec.getDataInputs()).thenReturn(dataInputs); when(ioSpec.getDataOutputs()).thenReturn(dataOutputs); when(activity.getIoSpecification()).thenReturn(ioSpec); when(activity.getDataInputAssociations()).thenReturn(dataInputAssociations); when(activity.getDataOutputAssociations()).thenReturn(dataOutputAssociations); AssignmentsInfo result = reader.getAssignmentsInfo(); String expectedResult = "|INPUT_NAME_1:Integer,INPUT_NAME_2:String||OUTPUT_NAME_1:Boolean,OUTPUT_NAME_2:Float|[din]VARIABLE1->INPUT_NAME_1,[din]VARIABLE2->INPUT_NAME_2,[dout]OUTPUT_NAME_1->VARIABLE3,[dout]OUTPUT_NAME_2->VARIABLE4"; assertEquals(expectedResult, result.getValue()); }
|
BaseTaskConverter extends AbstractConverter implements NodeConverter<Task> { @Override public Result<BpmnNode> convert(org.eclipse.bpmn2.Task task) { return Match.of(Task.class, BpmnNode.class) .when(org.eclipse.bpmn2.BusinessRuleTask.class, this::businessRuleTask) .when(org.eclipse.bpmn2.ScriptTask.class, this::scriptTask) .when(org.eclipse.bpmn2.UserTask.class, this::userTask) .when(org.eclipse.bpmn2.ServiceTask.class, this::serviceTaskResolver) .whenExactly(org.eclipse.bpmn2.impl.TaskImpl.class, this::defaultTaskResolver) .missing(ManualTask.class) .missing(SendTask.class) .missing(ReceiveTask.class) .orElse(this::defaultTaskResolver) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.bpmnNodeDecorator()) .mode(getMode()) .apply(task); } BaseTaskConverter(TypedFactoryManager factoryManager, PropertyReaderFactory propertyReaderFactory,
Mode mode); @Override Result<BpmnNode> convert(org.eclipse.bpmn2.Task task); }
|
@Test public void convertBusinessRuleTask() { org.eclipse.bpmn2.BusinessRuleTask task = mock(org.eclipse.bpmn2.BusinessRuleTask.class); BusinessRuleTaskPropertyReader propertyReader = mock(BusinessRuleTaskPropertyReader.class); BusinessRuleTask businessRuleDefinition = new BusinessRuleTask(); when(factoryManager.newNode(anyString(), eq(BusinessRuleTask.class))).thenReturn(businessRuleTaskNode); when(businessRuleTaskNode.getContent()).thenReturn(businessRuleTaskContent); when(businessRuleTaskContent.getDefinition()).thenReturn(businessRuleDefinition); when(propertyReaderFactory.of(task)).thenReturn(propertyReader); final BpmnNode converted = (BpmnNode) tested.convert(task).value(); assertNotEquals(converted.value(), noneTaskNode); assertEquals(converted.value(), businessRuleTaskNode); }
@Test public void convertServiceTask() { org.eclipse.bpmn2.ServiceTask task = mock(org.eclipse.bpmn2.ServiceTask.class); ServiceTaskPropertyReader serviceTaskPropertyReader = mock(ServiceTaskPropertyReader.class); CustomTask definition = new CustomTask(); FeatureMap attributes = mock(FeatureMap.class); FeatureMap.Entry ruleAttr = mock(FeatureMap.Entry.class); EStructuralFeature ruleFeature = mock(EStructuralFeature.class); when(factoryManager.newNode(anyString(), eq(CustomTask.class))).thenReturn(serviceTaskNode); when(serviceTaskNode.getContent()).thenReturn(serviceTaskContent); when(serviceTaskContent.getDefinition()).thenReturn(definition); when(propertyReaderFactory.ofCustom(task)).thenReturn(Optional.of(serviceTaskPropertyReader)); when(task.getAnyAttribute()).thenReturn(attributes); when(attributes.stream()).thenReturn(Stream.of(ruleAttr)); when(ruleAttr.getEStructuralFeature()).thenReturn(ruleFeature); when(ruleAttr.getValue()).thenReturn(""); when(ruleFeature.getName()).thenReturn(CustomAttribute.serviceImplementation.name()); final BpmnNode converted = (BpmnNode) tested.convert(task).value(); assertNotEquals(converted.value(), noneTaskNode); assertEquals(converted.value(), serviceTaskNode); }
@Test public void convertGenericServiceTask() { org.eclipse.bpmn2.ServiceTask task = mock(org.eclipse.bpmn2.ServiceTask.class); GenericServiceTaskPropertyReader genericServiceTaskPropertyReader = mock(GenericServiceTaskPropertyReader.class); GenericServiceTask definition = new GenericServiceTask(); FeatureMap attributes = mock(FeatureMap.class); FeatureMap.Entry ruleAttr = mock(FeatureMap.Entry.class); EStructuralFeature ruleFeature = mock(EStructuralFeature.class); when(factoryManager.newNode(anyString(), eq(GenericServiceTask.class))).thenReturn(genericServiceTaskNode); when(genericServiceTaskNode.getContent()).thenReturn(genericServiceTaskContent); when(genericServiceTaskContent.getDefinition()).thenReturn(definition); when(propertyReaderFactory.of(task)).thenReturn(genericServiceTaskPropertyReader); when(task.getAnyAttribute()).thenReturn(attributes); when(attributes.stream()).thenReturn(Stream.of(ruleAttr)); when(ruleAttr.getEStructuralFeature()).thenReturn(ruleFeature); when(ruleAttr.getValue()).thenReturn("Java"); when(ruleFeature.getName()).thenReturn(CustomAttribute.serviceImplementation.name()); final BpmnNode converted = (BpmnNode) tested.convert(task).value(); assertNotEquals(converted.value(), noneTaskNode); assertEquals(converted.value(), genericServiceTaskNode); }
|
DecisionComponents { void applyDrgElementFilterFilter(final String value) { getFilter().setDrgElement(value); applyFilter(); } 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 testApplyDrgElementFilterFilter() { final String value = "value"; doNothing().when(decisionComponents).applyFilter(); decisionComponents.applyDrgElementFilterFilter(value); verify(filter).setDrgElement(value); verify(decisionComponents).applyFilter(); }
|
AssociationConverter implements EdgeConverter<org.eclipse.bpmn2.Association> { public Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.Association association, Map<String, BpmnNode> nodes) { AssociationPropertyReader p = propertyReaderFactory.of(association); Edge<View<Association>, Node> edge = factoryManager.newEdge(association.getId(), p.getAssociationByDirection()); Association definition = edge.getContent().getDefinition(); definition.setGeneral(new BPMNGeneralSet( new Name(""), new Documentation(p.getDocumentation()) )); return result(nodes, edge, p, "Association ignored from " + p.getSourceId() + " to " + p.getTargetId(), MarshallingMessageKeys.associationIgnored); } AssociationConverter(TypedFactoryManager factoryManager,
PropertyReaderFactory propertyReaderFactory); Result<BpmnEdge> convertEdge(org.eclipse.bpmn2.Association association,
Map<String, BpmnNode> nodes); }
|
@Test public void testConvertEdge() { associationConverter.convertEdge(association, nodes); verify(definition).setGeneral(generalSetCaptor.capture()); assertEquals(ASSOCIATION_DOCUMENTATION, generalSetCaptor.getValue().getDocumentation().getValue()); assertEdgeWithConnections(); }
@Test public void testConvertEdgeNonDirectional() { when(factoryManager.newEdge(ASSOCIATION_ID, NonDirectionalAssociation.class)).thenReturn((Edge) edgeNonDirectional); when(associationReader.getAssociationByDirection()).thenAnswer(a -> NonDirectionalAssociation.class); when(edgeNonDirectional.getContent()).thenReturn(contentNonDirectional); when(contentNonDirectional.getDefinition()).thenReturn(definitionNonDirectional); BpmnEdge.Simple result = (BpmnEdge.Simple) associationConverter.convertEdge(association, nodes).value(); assertEquals(edgeNonDirectional, result.getEdge()); }
@Test public void testConvertIgnoredEdge() { assertEdgeWithConnections(); nodes.remove(SOURCE_ID); BpmnEdge.Simple result = (BpmnEdge.Simple) associationConverter.convertEdge(association, nodes).value(); assertNull(result); nodes.put(SOURCE_ID, sourceNode); nodes.remove(TARGET_ID); result = (BpmnEdge.Simple) associationConverter.convertEdge(association, nodes).value(); assertNull(result); nodes.put(SOURCE_ID, sourceNode); nodes.put(TARGET_ID, targetNode); assertEdgeWithConnections(); }
|
ProcessPostConverter { public Result<BpmnNode> postConvert(BpmnNode rootNode, DefinitionResolver definitionResolver) { if (definitionResolver.getResolutionFactor() != 1) { context = PostConverterContext.of(rootNode, definitionResolver.isJbpm()); adjustAllEdgeConnections(rootNode, true); if (context.hasCollapsedNodes()) { List<LaneInfo> laneInfos = new ArrayList<>(); new ArrayList<>(rootNode.getChildren()).stream() .filter(ProcessPostConverter::isLane) .filter(BpmnNode::hasChildren) .forEach(lane -> { LaneInfo laneInfo = new LaneInfo(lane, Padding.of(lane), new ArrayList<>(lane.getChildren())); laneInfos.add(laneInfo); laneInfo.getChildren().forEach(child -> child.setParent(rootNode)); rootNode.removeChild(lane); }); rootNode.getChildren().stream() .filter(ProcessPostConverter::isSubProcess) .forEach(this::postConvertSubProcess); List<BpmnNode> resizedChildren = context.getResizedChildren(rootNode); resizedChildren.forEach(resizedChild -> applyNodeResize(rootNode, resizedChild)); laneInfos.forEach(laneInfo -> { laneInfo.getLane().setParent(rootNode); laneInfo.getChildren().forEach(node -> node.setParent(laneInfo.getLane())); adjustLane(laneInfo.getLane(), laneInfo.getPadding()); }); adjustAllEdgeConnections(rootNode, false); return Result.success(rootNode, resizedChildren.stream() .map(n -> MarshallingMessage.builder() .message("Collapsed node was resized " + n.value().getContent().getDefinition()) .messageKey(MarshallingMessageKeys.collapsedElementExpanded) .messageArguments(n.value().getUUID(), Optional.ofNullable(n.value()) .map(Node::getContent) .map(View::getDefinition) .map(BPMNViewDefinition::getGeneral) .map(BPMNBaseInfo::getName) .map(Name::getValue) .orElse("")) .type(Violation.Type.WARNING) .build()) .toArray(MarshallingMessage[]::new)); } } return Result.success(rootNode); } ProcessPostConverter(); Result<BpmnNode> postConvert(BpmnNode rootNode, DefinitionResolver definitionResolver); }
|
@Test public void testPostConvert() { DefinitionResolver definitionResolver = mock(DefinitionResolver.class); double laneX = 80; double laneY = 100; double laneWidth = 500; double laneHeight = 200; RectangleDimensionsSet laneRectangleDimensionsSet = new RectangleDimensionsSet(laneWidth, laneHeight); Lane laneDefinition = mock(Lane.class); when(laneDefinition.getDimensionsSet()).thenReturn(laneRectangleDimensionsSet); Node<? extends View<? extends BPMNViewDefinition>, ?> lane = mockNode(laneDefinition, laneX, laneY, laneWidth, laneHeight); BpmnNode laneNode = mockBpmnNode(lane); double startEventX = 180; double startEventY = 130; double eventWidth = 56; double eventHeight = 56; Node<? extends View<? extends BPMNViewDefinition>, ?> startEvent = mockNode(mock(StartNoneEvent.class), startEventX + laneX, startEventY + laneY, eventWidth, eventHeight); BpmnNode startEventNode = mockBpmnNode(startEvent); double subprocessX = 270; double subprocessY = 180; double subprocessWidth = 100; double subprocessHeight = 60; RectangleDimensionsSet subprocessRectangleDimensionsSet = new RectangleDimensionsSet(subprocessWidth, subprocessHeight); EmbeddedSubprocess subprocessDefinition = mock(EmbeddedSubprocess.class); when(subprocessDefinition.getDimensionsSet()).thenReturn(subprocessRectangleDimensionsSet); Node<? extends View<? extends BPMNViewDefinition>, ?> subprocess = mockNode(subprocessDefinition, subprocessX + laneX, subprocessY + laneY, subprocessWidth, subprocessHeight); BpmnNode subprocessNode = mockBpmnNode(subprocess); BasePropertyReader subprocessPropertyReader = subprocessNode.getPropertyReader(); when(subprocessPropertyReader.isExpanded()).thenReturn(false); double subprocessBoundaryEventX = subprocessWidth - 28; double subprocessBoundaryEventY = (subprocessHeight / 2) - 28; Node<? extends View<? extends BPMNViewDefinition>, ?> subprocessBoundaryEvent = mockNode(mock(IntermediateTimerEvent.class), subprocessBoundaryEventX, subprocessBoundaryEventY, eventWidth, eventHeight); BpmnNode subprocessBoundaryEventNode = mockBpmnNode(subprocessBoundaryEvent).docked(); double task1X = 10; double task1Y = 10; double taskWidth = 200; double taskHeight = 100; Node<? extends View<? extends BPMNViewDefinition>, ?> task1 = mockNode(mock(UserTask.class), task1X, task1Y, taskWidth, taskHeight); BpmnNode task1Node = mockBpmnNode(task1); double task2X = 300; double task2Y = 200; Node<? extends View<? extends BPMNViewDefinition>, ?> task2 = mockNode(mock(UserTask.class), task2X, task2Y, taskWidth, taskHeight); BpmnNode task2Node = mockBpmnNode(task2); double task2BoundaryEventX = taskWidth - 28; double task2BoundaryEventY = taskHeight - 28; Node<? extends View<? extends BPMNViewDefinition>, ?> task2BoundaryEvent = mockNode(mock(IntermediateTimerEvent.class), task2BoundaryEventX, task2BoundaryEventY, eventWidth, eventHeight); BpmnNode task2BoundaryEventNode = mockBpmnNode(task2BoundaryEvent).docked(); double endEventX = 450; double endEventY = 230; Node<? extends View<? extends BPMNViewDefinition>, ?> endEvent = mockNode(mock(EndNoneEvent.class), endEventX + laneX, endEventY + laneY, eventWidth, eventHeight); BpmnNode endEventNode = mockBpmnNode(endEvent); double task3X = 500; double task3Y = 600; Node<? extends View<? extends BPMNViewDefinition>, ?> task3 = mockNode(mock(UserTask.class), task3X + laneX, task3Y + laneY, taskWidth, taskHeight); BpmnNode task3Node = mockBpmnNode(task3); double task3BoundaryEventX = taskWidth - 28; double task3BoundaryEventY = taskHeight - 28; Node<? extends View<? extends BPMNViewDefinition>, ?> task3BoundaryEvent = mockNode(mock(IntermediateTimerEvent.class), task3BoundaryEventX, task3BoundaryEventY, eventWidth, eventHeight); BpmnNode task3BoundaryEventNode = mockBpmnNode(task3BoundaryEvent).docked(); double task4X = 900; double task4Y = 1000; Node<? extends View<? extends BPMNViewDefinition>, ?> task4 = mockNode(mock(UserTask.class), task4X + laneX, task4Y + laneY, taskWidth, taskHeight); BpmnNode task4Node = mockBpmnNode(task4); List<Point2D> controlPoints = new ArrayList<>(); controlPoints.add(Point2D.create(900 + 100 + laneX, 700 + laneY)); Connection sourceConnection = MagnetConnection.Builder.at(56, 28).setAuto(false); Connection targetConnection = MagnetConnection.Builder.at(100, 0).setAuto(false); BPMNEdge bpmnEdge = mock(BPMNEdge.class); BaseElement baseElement = mock(BaseElement.class); SequenceFlowPropertyReader edgePropertyReader = mock(SequenceFlowPropertyReader.class); when(edgePropertyReader.getDefinitionResolver()).thenReturn(definitionResolver); when(edgePropertyReader.getElement()).thenReturn(baseElement); when(baseElement.getId()).thenReturn("elementId"); when(definitionResolver.getEdge("elementId")).thenReturn(bpmnEdge); List<Point> wayPoints = new ArrayList<>(); wayPoints.add(mockPoint((float) (700 + 28 + laneX), (float) (700 + laneY))); wayPoints.add(mockPoint((float) (1000 + laneX), (float) (700 + laneY))); wayPoints.add(mockPoint((float) (900 + 100 + laneX), (float) (1000 + laneY))); when(bpmnEdge.getWaypoint()).thenReturn(wayPoints); org.eclipse.dd.dc.Bounds sourceShapeBounds = mockBounds((float) (task3X + taskWidth - 28 + laneX), (float) (task3Y + taskHeight - 28 + laneY), (float) eventWidth, (float) eventHeight); BPMNShape sourceShape = mockShape(sourceShapeBounds); when(task3BoundaryEventNode.getPropertyReader().getShape()).thenReturn(sourceShape); org.eclipse.dd.dc.Bounds targetShapeBounds = mockBounds(task4.getContent().getBounds()); BPMNShape targetShape = mockShape(targetShapeBounds); when(task4Node.getPropertyReader().getShape()).thenReturn(targetShape); BpmnEdge.Simple edgeTask3BoundaryEventToTask4 = BpmnEdge.of(null, task3BoundaryEventNode, sourceConnection, controlPoints, task4Node, targetConnection, edgePropertyReader); Node<? extends View<? extends BPMNViewDefinition>, ?> diagram = mockNode(mock(BPMNDiagramImpl.class), 0, 0, 10000, 10000); BpmnNode rootNode = mockBpmnNode(diagram); rootNode.addChild(laneNode); laneNode.addChild(startEventNode); laneNode.addChild(subprocessNode); laneNode.addChild(subprocessBoundaryEventNode); rootNode.addEdge(BpmnEdge.docked(subprocessNode, subprocessBoundaryEventNode)); subprocessNode.addChild(task1Node); subprocessNode.addChild(task2Node); subprocessNode.addChild(task2BoundaryEventNode); subprocessNode.addEdge(BpmnEdge.docked(task2Node, task2BoundaryEventNode)); laneNode.addChild(task3Node); laneNode.addChild(task3BoundaryEventNode); laneNode.addChild(task4Node); rootNode.addEdge(BpmnEdge.docked(task3Node, task3BoundaryEventNode)); rootNode.addEdge(edgeTask3BoundaryEventToTask4); laneNode.addChild(endEventNode); ProcessPostConverter postConverter = new ProcessPostConverter(); when(definitionResolver.getResolutionFactor()).thenReturn(2d); Result<BpmnNode> result = postConverter.postConvert(rootNode, definitionResolver); Bounds startEventBounds = startEventNode.value().getContent().getBounds(); assertEquals(laneX + startEventX, startEventBounds.getUpperLeft().getX(), 0); assertEquals(laneY + startEventY, startEventBounds.getUpperLeft().getY(), 0); assertEquals(eventWidth, startEventBounds.getWidth(), 0); assertEquals(eventHeight, startEventBounds.getHeight(), 0); Bounds subProcessBounds = subprocessNode.value().getContent().getBounds(); assertEquals(laneX + subprocessX, subProcessBounds.getUpperLeft().getX(), 0); assertEquals(laneY + subprocessY, subProcessBounds.getUpperLeft().getY(), 0); assertEquals(300 + 200 + 10, subProcessBounds.getWidth(), 0); assertEquals(200 + 100 + 10, subProcessBounds.getHeight(), 0); Bounds subProcessBoundaryEventBounds = subprocessBoundaryEventNode.value().getContent().getBounds(); assertEquals(subProcessBounds.getWidth() - 28, subProcessBoundaryEventBounds.getUpperLeft().getX(), 0); assertEquals(subProcessBounds.getHeight() / subprocessHeight * subprocessBoundaryEventY, subProcessBoundaryEventBounds.getUpperLeft().getY(), 0); Bounds task1Bounds = task1Node.value().getContent().getBounds(); assertEquals(laneX + subprocessX + task1X, task1Bounds.getUpperLeft().getX(), 0); assertEquals(laneY + subprocessY + task1Y, task1Bounds.getUpperLeft().getY(), 0); assertEquals(taskWidth, task1Bounds.getWidth(), 0); assertEquals(taskHeight, task1Bounds.getHeight(), 0); Bounds task2Bounds = task2Node.value().getContent().getBounds(); assertEquals(laneX + subprocessX + task2X, task2Bounds.getUpperLeft().getX(), 0); assertEquals(laneY + subprocessY + task2Y, task2Bounds.getUpperLeft().getY(), 0); assertEquals(taskWidth, task1Bounds.getWidth(), 0); assertEquals(taskHeight, task1Bounds.getHeight(), 0); Bounds task2BoundaryEventBounds = task2BoundaryEventNode.value().getContent().getBounds(); assertEquals(task2BoundaryEventX, task2BoundaryEventBounds.getUpperLeft().getX(), 0); assertEquals(task2BoundaryEventY, task2BoundaryEventBounds.getUpperLeft().getY(), 0); assertEquals(eventWidth, task2BoundaryEventBounds.getWidth(), 0); assertEquals(eventHeight, task2BoundaryEventBounds.getHeight(), 0); Bounds endEventBounds = endEventNode.value().getContent().getBounds(); double subprocessDeltaX = subProcessBounds.getWidth() - subprocessWidth; double subprocessDeltaY = subProcessBounds.getHeight() - subprocessHeight; assertEquals(laneX + endEventX + subprocessDeltaX, endEventBounds.getUpperLeft().getX(), 0); assertEquals(laneY + endEventY + subprocessDeltaY, endEventBounds.getUpperLeft().getY(), 0); Bounds task3Bounds = task3Node.value().getContent().getBounds(); assertEquals(laneX + task3X + subprocessDeltaX, task3Bounds.getUpperLeft().getX(), 0); assertEquals(laneY + task3Y + subprocessDeltaY, task3Bounds.getUpperLeft().getY(), 0); Bounds task3BoundaryEventBounds = task3BoundaryEventNode.value().getContent().getBounds(); assertEquals(task3BoundaryEventX, task3BoundaryEventBounds.getUpperLeft().getX(), 0); assertEquals(task3BoundaryEventY, task3BoundaryEventBounds.getUpperLeft().getY(), 0); assertEquals(eventWidth, task3BoundaryEventBounds.getWidth(), 0); assertEquals(eventHeight, task3BoundaryEventBounds.getHeight(), 0); Bounds task4Bounds = task4Node.value().getContent().getBounds(); assertEquals(laneX + task4X + subprocessDeltaX, task4Bounds.getUpperLeft().getX(), 0); assertEquals(laneY + task4Y + subprocessDeltaY, task4Bounds.getUpperLeft().getY(), 0); assertEquals(56, edgeTask3BoundaryEventToTask4.getSourceConnection().getLocation().getX(), 0); assertEquals(28, edgeTask3BoundaryEventToTask4.getSourceConnection().getLocation().getY(), 0); assertEquals(task4Node.value().getContent().getBounds().getUpperLeft().getX() + taskWidth / 2, controlPoints.get(0).getX(), 0); assertEquals(task3Node.value().getContent().getBounds().getLowerRight().getY(), controlPoints.get(0).getY(), 0); List<MarshallingMessage> messages = result.messages(); assertEquals(1, messages.size()); MarshallingMessage message = messages.get(0); assertEquals(Violation.Type.WARNING, message.getViolationType()); assertEquals(MarshallingMessageKeys.collapsedElementExpanded, message.getMessageKey()); }
@Test public void testPostConvert() { DefinitionResolver definitionResolver = mock(DefinitionResolver.class); double laneX = 80; double laneY = 100; double laneWidth = 500; double laneHeight = 200; RectangleDimensionsSet laneRectangleDimensionsSet = new RectangleDimensionsSet(laneWidth, laneHeight); Lane laneDefinition = mock(Lane.class); when(laneDefinition.getDimensionsSet()).thenReturn(laneRectangleDimensionsSet); Node<? extends View<? extends BPMNViewDefinition>, ?> lane = mockNode(laneDefinition, laneX, laneY, laneWidth, laneHeight); BpmnNode laneNode = mockBpmnNode(lane); double startEventX = 180; double startEventY = 130; double eventWidth = 56; double eventHeight = 56; Node<? extends View<? extends BPMNViewDefinition>, ?> startEvent = mockNode(mock(StartNoneEvent.class), startEventX + laneX, startEventY + laneY, eventWidth, eventHeight); BpmnNode startEventNode = mockBpmnNode(startEvent); double subprocessX = 270; double subprocessY = 180; double subprocessWidth = 100; double subprocessHeight = 60; RectangleDimensionsSet subprocessRectangleDimensionsSet = new RectangleDimensionsSet(subprocessWidth, subprocessHeight); EmbeddedSubprocess subprocessDefinition = mock(EmbeddedSubprocess.class); when(subprocessDefinition.getDimensionsSet()).thenReturn(subprocessRectangleDimensionsSet); Node<? extends View<? extends BPMNViewDefinition>, ?> subprocess = mockNode(subprocessDefinition, subprocessX + laneX, subprocessY + laneY, subprocessWidth, subprocessHeight); BpmnNode subprocessNode = mockBpmnNode(subprocess); BasePropertyReader subprocessPropertyReader = subprocessNode.getPropertyReader(); when(subprocessPropertyReader.isExpanded()).thenReturn(false); double subprocessBoundaryEventX = subprocessWidth - 28; double subprocessBoundaryEventY = (subprocessHeight / 2) - 28; Node<? extends View<? extends BPMNViewDefinition>, ?> subprocessBoundaryEvent = mockNode(mock(IntermediateTimerEvent.class), subprocessBoundaryEventX, subprocessBoundaryEventY, eventWidth, eventHeight); BpmnNode subprocessBoundaryEventNode = mockBpmnNode(subprocessBoundaryEvent).docked(); double task1X = 10; double task1Y = 10; double taskWidth = 200; double taskHeight = 100; Node<? extends View<? extends BPMNViewDefinition>, ?> task1 = mockNode(mock(UserTask.class), task1X, task1Y, taskWidth, taskHeight); BpmnNode task1Node = mockBpmnNode(task1); double task2X = 300; double task2Y = 200; Node<? extends View<? extends BPMNViewDefinition>, ?> task2 = mockNode(mock(UserTask.class), task2X, task2Y, taskWidth, taskHeight); BpmnNode task2Node = mockBpmnNode(task2); double task2BoundaryEventX = taskWidth - 28; double task2BoundaryEventY = taskHeight - 28; Node<? extends View<? extends BPMNViewDefinition>, ?> task2BoundaryEvent = mockNode(mock(IntermediateTimerEvent.class), task2BoundaryEventX, task2BoundaryEventY, eventWidth, eventHeight); BpmnNode task2BoundaryEventNode = mockBpmnNode(task2BoundaryEvent).docked(); double endEventX = 450; double endEventY = 230; Node<? extends View<? extends BPMNViewDefinition>, ?> endEvent = mockNode(mock(EndNoneEvent.class), endEventX + laneX, endEventY + laneY, eventWidth, eventHeight); BpmnNode endEventNode = mockBpmnNode(endEvent); double task3X = 500; double task3Y = 600; Node<? extends View<? extends BPMNViewDefinition>, ?> task3 = mockNode(mock(UserTask.class), task3X + laneX, task3Y + laneY, taskWidth, taskHeight); BpmnNode task3Node = mockBpmnNode(task3); double task3BoundaryEventX = taskWidth - 28; double task3BoundaryEventY = taskHeight - 28; Node<? extends View<? extends BPMNViewDefinition>, ?> task3BoundaryEvent = mockNode(mock(IntermediateTimerEvent.class), task3BoundaryEventX, task3BoundaryEventY, eventWidth, eventHeight); BpmnNode task3BoundaryEventNode = mockBpmnNode(task3BoundaryEvent).docked(); double task4X = 900; double task4Y = 1000; Node<? extends View<? extends BPMNViewDefinition>, ?> task4 = mockNode(mock(UserTask.class), task4X + laneX, task4Y + laneY, taskWidth, taskHeight); BpmnNode task4Node = mockBpmnNode(task4); List<Point2D> controlPoints = new ArrayList<>(); controlPoints.add(Point2D.create(900 + 100 + laneX, 700 + laneY)); Connection sourceConnection = MagnetConnection.Builder.at(56, 28).setAuto(false); Connection targetConnection = MagnetConnection.Builder.at(100, 0).setAuto(false); BPMNEdge bpmnEdge = mock(BPMNEdge.class); BaseElement baseElement = mock(BaseElement.class); SequenceFlowPropertyReader edgePropertyReader = mock(SequenceFlowPropertyReader.class); when(edgePropertyReader.getDefinitionResolver()).thenReturn(definitionResolver); when(edgePropertyReader.getElement()).thenReturn(baseElement); when(baseElement.getId()).thenReturn("elementId"); when(definitionResolver.getEdge("elementId")).thenReturn(bpmnEdge); EList<Point> wayPoints = ECollections.newBasicEList(); wayPoints.add(mockPoint((float) (700 + 28 + laneX), (float) (700 + laneY))); wayPoints.add(mockPoint((float) (1000 + laneX), (float) (700 + laneY))); wayPoints.add(mockPoint((float) (900 + 100 + laneX), (float) (1000 + laneY))); when(bpmnEdge.getWaypoint()).thenReturn(wayPoints); org.eclipse.dd.dc.Bounds sourceShapeBounds = mockBounds((float) (task3X + taskWidth - 28 + laneX), (float) (task3Y + taskHeight - 28 + laneY), (float) eventWidth, (float) eventHeight); BPMNShape sourceShape = mockShape(sourceShapeBounds); when(task3BoundaryEventNode.getPropertyReader().getShape()).thenReturn(sourceShape); org.eclipse.dd.dc.Bounds targetShapeBounds = mockBounds(task4.getContent().getBounds()); BPMNShape targetShape = mockShape(targetShapeBounds); when(task4Node.getPropertyReader().getShape()).thenReturn(targetShape); BpmnEdge.Simple edgeTask3BoundaryEventToTask4 = BpmnEdge.of(null, task3BoundaryEventNode, sourceConnection, controlPoints, task4Node, targetConnection, edgePropertyReader); Node<? extends View<? extends BPMNViewDefinition>, ?> diagram = mockNode(mock(BPMNDiagramImpl.class), 0, 0, 10000, 10000); BpmnNode rootNode = mockBpmnNode(diagram); rootNode.addChild(laneNode); laneNode.addChild(startEventNode); laneNode.addChild(subprocessNode); laneNode.addChild(subprocessBoundaryEventNode); rootNode.addEdge(BpmnEdge.docked(subprocessNode, subprocessBoundaryEventNode)); subprocessNode.addChild(task1Node); subprocessNode.addChild(task2Node); subprocessNode.addChild(task2BoundaryEventNode); subprocessNode.addEdge(BpmnEdge.docked(task2Node, task2BoundaryEventNode)); laneNode.addChild(task3Node); laneNode.addChild(task3BoundaryEventNode); laneNode.addChild(task4Node); rootNode.addEdge(BpmnEdge.docked(task3Node, task3BoundaryEventNode)); rootNode.addEdge(edgeTask3BoundaryEventToTask4); laneNode.addChild(endEventNode); ProcessPostConverter postConverter = new ProcessPostConverter(); when(definitionResolver.getResolutionFactor()).thenReturn(2d); Result<BpmnNode> result = postConverter.postConvert(rootNode, definitionResolver); Bounds startEventBounds = startEventNode.value().getContent().getBounds(); assertEquals(laneX + startEventX, startEventBounds.getUpperLeft().getX(), 0); assertEquals(laneY + startEventY, startEventBounds.getUpperLeft().getY(), 0); assertEquals(eventWidth, startEventBounds.getWidth(), 0); assertEquals(eventHeight, startEventBounds.getHeight(), 0); Bounds subProcessBounds = subprocessNode.value().getContent().getBounds(); assertEquals(laneX + subprocessX, subProcessBounds.getUpperLeft().getX(), 0); assertEquals(laneY + subprocessY, subProcessBounds.getUpperLeft().getY(), 0); assertEquals(300 + 200 + 10, subProcessBounds.getWidth(), 0); assertEquals(200 + 100 + 10, subProcessBounds.getHeight(), 0); Bounds subProcessBoundaryEventBounds = subprocessBoundaryEventNode.value().getContent().getBounds(); assertEquals(subProcessBounds.getWidth() - 28, subProcessBoundaryEventBounds.getUpperLeft().getX(), 0); assertEquals(subProcessBounds.getHeight() / subprocessHeight * subprocessBoundaryEventY, subProcessBoundaryEventBounds.getUpperLeft().getY(), 0); Bounds task1Bounds = task1Node.value().getContent().getBounds(); assertEquals(laneX + subprocessX + task1X, task1Bounds.getUpperLeft().getX(), 0); assertEquals(laneY + subprocessY + task1Y, task1Bounds.getUpperLeft().getY(), 0); assertEquals(taskWidth, task1Bounds.getWidth(), 0); assertEquals(taskHeight, task1Bounds.getHeight(), 0); Bounds task2Bounds = task2Node.value().getContent().getBounds(); assertEquals(laneX + subprocessX + task2X, task2Bounds.getUpperLeft().getX(), 0); assertEquals(laneY + subprocessY + task2Y, task2Bounds.getUpperLeft().getY(), 0); assertEquals(taskWidth, task1Bounds.getWidth(), 0); assertEquals(taskHeight, task1Bounds.getHeight(), 0); Bounds task2BoundaryEventBounds = task2BoundaryEventNode.value().getContent().getBounds(); assertEquals(task2BoundaryEventX, task2BoundaryEventBounds.getUpperLeft().getX(), 0); assertEquals(task2BoundaryEventY, task2BoundaryEventBounds.getUpperLeft().getY(), 0); assertEquals(eventWidth, task2BoundaryEventBounds.getWidth(), 0); assertEquals(eventHeight, task2BoundaryEventBounds.getHeight(), 0); Bounds endEventBounds = endEventNode.value().getContent().getBounds(); double subprocessDeltaX = subProcessBounds.getWidth() - subprocessWidth; double subprocessDeltaY = subProcessBounds.getHeight() - subprocessHeight; assertEquals(laneX + endEventX + subprocessDeltaX, endEventBounds.getUpperLeft().getX(), 0); assertEquals(laneY + endEventY + subprocessDeltaY, endEventBounds.getUpperLeft().getY(), 0); Bounds task3Bounds = task3Node.value().getContent().getBounds(); assertEquals(laneX + task3X + subprocessDeltaX, task3Bounds.getUpperLeft().getX(), 0); assertEquals(laneY + task3Y + subprocessDeltaY, task3Bounds.getUpperLeft().getY(), 0); Bounds task3BoundaryEventBounds = task3BoundaryEventNode.value().getContent().getBounds(); assertEquals(task3BoundaryEventX, task3BoundaryEventBounds.getUpperLeft().getX(), 0); assertEquals(task3BoundaryEventY, task3BoundaryEventBounds.getUpperLeft().getY(), 0); assertEquals(eventWidth, task3BoundaryEventBounds.getWidth(), 0); assertEquals(eventHeight, task3BoundaryEventBounds.getHeight(), 0); Bounds task4Bounds = task4Node.value().getContent().getBounds(); assertEquals(laneX + task4X + subprocessDeltaX, task4Bounds.getUpperLeft().getX(), 0); assertEquals(laneY + task4Y + subprocessDeltaY, task4Bounds.getUpperLeft().getY(), 0); assertEquals(56, edgeTask3BoundaryEventToTask4.getSourceConnection().getLocation().getX(), 0); assertEquals(28, edgeTask3BoundaryEventToTask4.getSourceConnection().getLocation().getY(), 0); assertEquals(task4Node.value().getContent().getBounds().getUpperLeft().getX() + taskWidth / 2, controlPoints.get(0).getX(), 0); assertEquals(task3Node.value().getContent().getBounds().getLowerRight().getY(), controlPoints.get(0).getY(), 0); List<MarshallingMessage> messages = result.messages(); assertEquals(1, messages.size()); MarshallingMessage message = messages.get(0); assertEquals(Violation.Type.WARNING, message.getViolationType()); assertEquals(MarshallingMessageKeys.collapsedElementExpanded, message.getMessageKey()); }
|
GraphBuilder { public void buildGraph(BpmnNode rootNode) { this.addNode(rootNode.value()); rootNode.getEdges().forEach(this::addEdge); List<BpmnNode> nodes = rootNode.getChildren(); Deque<BpmnNode> workingSet = new ArrayDeque<>(prioritized(nodes)); Set<BpmnNode> workedOff = new HashSet<>(); while (!workingSet.isEmpty()) { BpmnNode current = workingSet.pop(); if (workedOff.contains(current)) { continue; } workedOff.add(current); workingSet.addAll( prioritized(current.getChildren())); logger.debug("{} :: {}", current.getParent().value().getUUID(), current.value().getUUID()); this.addChildNode(current); current.getEdges().forEach(this::addEdge); } } GraphBuilder(
Graph<DefinitionSet, Node> graph,
DefinitionManager definitionManager,
TypedFactoryManager typedFactoryManager,
RuleManager ruleManager,
GraphCommandFactory commandFactory,
GraphCommandManager commandManager); void render(BpmnNode root); void buildGraph(BpmnNode rootNode); }
|
@Test public void testBoundsCalculation() { double subprocess1X = 10; double subprocess1Y = 10; double subprocess1Width = 100; double subprocess1Height = 200; EmbeddedSubprocess subprocess1Definition = mock(EmbeddedSubprocess.class); Node<? extends View<? extends BPMNViewDefinition>, ?> subprocess1 = mockNode(subprocess1Definition, subprocess1X, subprocess1Y, subprocess1Width, subprocess1Height); when(subprocess1.getUUID()).thenReturn(SUBPROCESS1_ID); BpmnNode subprocess1Node = mockBpmnNode(subprocess1); double subprocess2X = 20; double subprocess2Y = 20; double subprocess2Width = 70; double subprocess2Height = 170; EmbeddedSubprocess subprocess2Definition = mock(EmbeddedSubprocess.class); Node<? extends View<? extends BPMNViewDefinition>, ?> subprocess2 = mockNode(subprocess2Definition, subprocess1X + subprocess2X, subprocess1Y + subprocess2Y, subprocess2Width, subprocess2Height); when(subprocess2.getUUID()).thenReturn(SUBPROCESS2_ID); BpmnNode subprocess2Node = mockBpmnNode(subprocess2); double subprocess3X = 30; double subprocess3Y = 30; double subprocess3Width = 30; double subprocess3Height = 120; EmbeddedSubprocess subprocess3Definition = mock(EmbeddedSubprocess.class); Node<? extends View<? extends BPMNViewDefinition>, ?> subprocess3 = mockNode(subprocess3Definition, subprocess1X + subprocess2X + subprocess3X, subprocess1Y + subprocess2Y + subprocess3Y, subprocess3Width, subprocess3Height); when(subprocess3.getUUID()).thenReturn(SUBPROCESS3_ID); BpmnNode subprocess3Node = mockBpmnNode(subprocess3); Node<? extends View<? extends BPMNViewDefinition>, ?> rootDiagram = mockNode(mock(BPMNDiagramImpl.class), 0, 0, 1000, 1000); when(rootDiagram.getUUID()).thenReturn(DIAGRAM_UUID); BpmnNode rootNode = mockBpmnNode(rootDiagram); subprocess1Node.setParent(rootNode); subprocess2Node.setParent(subprocess1Node); subprocess3Node.setParent(subprocess2Node); graphBuilder.buildGraph(rootNode); assertNodePosition(SUBPROCESS1_ID, subprocess1X, subprocess1Y); assertNodePosition(SUBPROCESS2_ID, subprocess2X, subprocess2Y); assertNodePosition(SUBPROCESS3_ID, subprocess3X, subprocess3Y); }
|
DefinitionResolver { static double obtainResolutionFactor() { final String resolution = System.getProperty(BPMN_DIAGRAM_RESOLUTION_PROPERTY); if (null != resolution && resolution.trim().length() > 0) { try { return Double.parseDouble(resolution); } catch (NumberFormatException e) { LOG.error("Error parsing the BPMN diagram's resolution - marshalling factor... " + "Using as default [" + DEFAULT_RESOLUTION + "].", e); } } return DEFAULT_RESOLUTION; } DefinitionResolver(
Definitions definitions,
Collection<WorkItemDefinition> workItemDefinitions,
boolean jbpm,
Mode mode); DefinitionResolver(Definitions definitions,
Collection<WorkItemDefinition> workItemDefinitions); BPMNDiagram getDiagram(); double getResolutionFactor(); boolean isJbpm(); Definitions getDefinitions(); Process getProcess(); Mode getMode(); Collection<WorkItemDefinition> getWorkItemDefinitions(); Optional<Signal> resolveSignal(String id); String resolveSignalName(String id); Optional<ElementParameters> resolveSimulationParameters(String id); BPMNShape getShape(String elementId); BPMNEdge getEdge(String elementId); }
|
@Test public void testObtainResolutionFactor() { double factor = DefinitionResolver.obtainResolutionFactor(); assertEquals(DefinitionResolver.DEFAULT_RESOLUTION, factor, 0d); System.setProperty(DefinitionResolver.BPMN_DIAGRAM_RESOLUTION_PROPERTY, "0.25"); factor = DefinitionResolver.obtainResolutionFactor(); assertEquals(0.25d, factor, 0d); System.clearProperty(DefinitionResolver.BPMN_DIAGRAM_RESOLUTION_PROPERTY); }
|
DefinitionResolver { static double calculateResolutionFactor(final BPMNDiagram diagram) { final float resolution = diagram.getResolution(); return resolution == 0 ? 1 : obtainResolutionFactor() / resolution; } DefinitionResolver(
Definitions definitions,
Collection<WorkItemDefinition> workItemDefinitions,
boolean jbpm,
Mode mode); DefinitionResolver(Definitions definitions,
Collection<WorkItemDefinition> workItemDefinitions); BPMNDiagram getDiagram(); double getResolutionFactor(); boolean isJbpm(); Definitions getDefinitions(); Process getProcess(); Mode getMode(); Collection<WorkItemDefinition> getWorkItemDefinitions(); Optional<Signal> resolveSignal(String id); String resolveSignalName(String id); Optional<ElementParameters> resolveSimulationParameters(String id); BPMNShape getShape(String elementId); BPMNEdge getEdge(String elementId); }
|
@Test public void testCalculateResolutionFactor() { BPMNDiagram diagram = mock(BPMNDiagram.class); when(diagram.getResolution()).thenReturn(0f); double factor = DefinitionResolver.calculateResolutionFactor(diagram); assertEquals(1d, factor, 0d); when(diagram.getResolution()).thenReturn(250f); factor = DefinitionResolver.calculateResolutionFactor(diagram); assertEquals(0.45d, factor, 0d); }
|
DefinitionResolver { public BPMNShape getShape(String elementId) { return definitions.getDiagrams().stream() .map(BPMNDiagram::getPlane) .map(plane -> getShape(plane, elementId)) .filter(Objects::nonNull) .findFirst().orElse(null); } DefinitionResolver(
Definitions definitions,
Collection<WorkItemDefinition> workItemDefinitions,
boolean jbpm,
Mode mode); DefinitionResolver(Definitions definitions,
Collection<WorkItemDefinition> workItemDefinitions); BPMNDiagram getDiagram(); double getResolutionFactor(); boolean isJbpm(); Definitions getDefinitions(); Process getProcess(); Mode getMode(); Collection<WorkItemDefinition> getWorkItemDefinitions(); Optional<Signal> resolveSignal(String id); String resolveSignalName(String id); Optional<ElementParameters> resolveSimulationParameters(String id); BPMNShape getShape(String elementId); BPMNEdge getEdge(String elementId); }
|
@Test public void testGetShape() { BPMNShape shape = mock(BPMNShape.class); BaseElement bpmnElement = mock(BaseElement.class); when(shape.getBpmnElement()).thenReturn(bpmnElement); when(bpmnElement.getId()).thenReturn(ID); planeElement.add(shape); assertEquals(shape, definitionResolver.getShape(ID)); }
@Test public void testGetShape() { BPMNShape shape = mock(BPMNShape.class); BaseElement bpmnElement = mock(BaseElement.class); when(shape.getBpmnElement()).thenReturn(bpmnElement); when(bpmnElement.getId()).thenReturn(ID); planeElements.add(shape); assertEquals(shape, definitionResolver.getShape(ID)); }
|
DefinitionResolver { public BPMNEdge getEdge(String elementId) { return definitions.getDiagrams().stream() .map(BPMNDiagram::getPlane) .map(plane -> getEdge(plane, elementId)) .filter(Objects::nonNull) .findFirst().orElse(null); } DefinitionResolver(
Definitions definitions,
Collection<WorkItemDefinition> workItemDefinitions,
boolean jbpm,
Mode mode); DefinitionResolver(Definitions definitions,
Collection<WorkItemDefinition> workItemDefinitions); BPMNDiagram getDiagram(); double getResolutionFactor(); boolean isJbpm(); Definitions getDefinitions(); Process getProcess(); Mode getMode(); Collection<WorkItemDefinition> getWorkItemDefinitions(); Optional<Signal> resolveSignal(String id); String resolveSignalName(String id); Optional<ElementParameters> resolveSimulationParameters(String id); BPMNShape getShape(String elementId); BPMNEdge getEdge(String elementId); }
|
@Test public void testGetEdge() { BPMNEdge edge = mock(BPMNEdge.class); BaseElement bpmnElement = mock(BaseElement.class); when(edge.getBpmnElement()).thenReturn(bpmnElement); when(bpmnElement.getId()).thenReturn(ID); planeElement.add(edge); assertEquals(edge, definitionResolver.getEdge(ID)); }
@Test public void testGetEdge() { BPMNEdge edge = mock(BPMNEdge.class); BaseElement bpmnElement = mock(BaseElement.class); when(edge.getBpmnElement()).thenReturn(bpmnElement); when(bpmnElement.getId()).thenReturn(ID); planeElements.add(edge); assertEquals(edge, definitionResolver.getEdge(ID)); }
|
DecisionComponents { void applyFilter() { hideAllItems(); showFilteredItems(); } 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 testApplyFilter() { final DecisionComponentsItem item1 = mock(DecisionComponentsItem.class); final DecisionComponentsItem item2 = mock(DecisionComponentsItem.class); final DecisionComponentsItem item3 = mock(DecisionComponentsItem.class); final DecisionComponent component1 = mock(DecisionComponent.class); final DecisionComponent component2 = mock(DecisionComponent.class); final DecisionComponent component3 = mock(DecisionComponent.class); final List<DecisionComponentsItem> decisionComponentsItems = asList(item1, item2, item3); doReturn(new DecisionComponentFilter()).when(decisionComponents).getFilter(); doReturn(decisionComponentsItems).when(decisionComponents).getDecisionComponentsItems(); when(item1.getDecisionComponent()).thenReturn(component1); when(item2.getDecisionComponent()).thenReturn(component2); when(item3.getDecisionComponent()).thenReturn(component3); when(component1.getName()).thenReturn("name3"); when(component2.getName()).thenReturn("nome!!!"); when(component3.getName()).thenReturn("name1"); decisionComponents.getFilter().setTerm("name"); decisionComponents.applyFilter(); verify(item1).hide(); verify(item2).hide(); verify(item3).hide(); verify(item3).show(); verify(item1).show(); }
|
DefinitionResolver { public Optional<ElementParameters> resolveSimulationParameters(String id) { return Optional.ofNullable(simulationParameters.get(id)); } DefinitionResolver(
Definitions definitions,
Collection<WorkItemDefinition> workItemDefinitions,
boolean jbpm,
Mode mode); DefinitionResolver(Definitions definitions,
Collection<WorkItemDefinition> workItemDefinitions); BPMNDiagram getDiagram(); double getResolutionFactor(); boolean isJbpm(); Definitions getDefinitions(); Process getProcess(); Mode getMode(); Collection<WorkItemDefinition> getWorkItemDefinitions(); Optional<Signal> resolveSignal(String id); String resolveSignalName(String id); Optional<ElementParameters> resolveSimulationParameters(String id); BPMNShape getShape(String elementId); BPMNEdge getEdge(String elementId); }
|
@Test public void testSimulation() { String elementRef = "some_element_ref"; EList<Scenario> scenarios = mock(EList.class); Scenario scenario = mock(Scenario.class); when(scenarios.get(0)).thenReturn(scenario); EList<ElementParameters> parameters = mock(EList.class); ElementParameters parameter = mock(ElementParameters.class); when(parameter.getElementRef()).thenReturn(elementRef); Iterator<ElementParameters> iterator = mock(Iterator.class); when(parameters.iterator()).thenReturn(iterator); when(iterator.hasNext()).thenReturn(Boolean.TRUE, Boolean.FALSE); when(iterator.next()).thenReturn(parameter); when(scenario.getElementParameters()).thenReturn(parameters); BPSimDataType simDataType = mock(BPSimDataType.class); simData.add(simDataType); when(simDataType.getScenario()).thenReturn(scenarios); setUp(); assertEquals(parameter, definitionResolver.resolveSimulationParameters(elementRef).get()); }
@Test public void testSimulation() { String elementRef = "some_element_ref"; EList<Scenario> scenarios = ECollections.newBasicEList(); Scenario scenario = mock(Scenario.class); scenarios.add(scenario); EList<ElementParameters> parameters = ECollections.newBasicEList(); ElementParameters parameter = mock(ElementParameters.class); when(parameter.getElementRef()).thenReturn(elementRef); parameters.add(parameter); when(scenario.getElementParameters()).thenReturn(parameters); BPSimDataType simDataType = mock(BPSimDataType.class); simData.add(simDataType); when(simDataType.getScenario()).thenReturn(scenarios); setUp(); assertEquals(parameter, definitionResolver.resolveSimulationParameters(elementRef).get()); }
|
BoundaryEventConverter implements EdgeConverter<BoundaryEvent> { @Override public Result<BpmnEdge> convertEdge(BoundaryEvent event, Map<String, BpmnNode> nodes) { String parentId = event.getAttachedToRef().getId(); String childId = event.getId(); return valid(nodes, parentId, childId) ? Result.success(BpmnEdge.docked(nodes.get(parentId), nodes.get(childId))) : Result.ignored("Boundary ignored", MarshallingMessage.builder() .message("Boundary ignored") .messageKey(MarshallingMessageKeys.boundaryIgnored) .messageArguments(childId, parentId) .type(Violation.Type.WARNING) .build()); } @Override Result<BpmnEdge> convertEdge(BoundaryEvent event, Map<String, BpmnNode> nodes); }
|
@Test public void convertEdge() { Map<String, BpmnNode> nodes = new Maps.Builder<String, BpmnNode>() .put(PARENT_ID, node1) .put(CHILD_ID, node2) .build(); Result<BpmnEdge> result = tested.convertEdge(event, nodes); BpmnEdge value = result.value(); assertTrue(result.isSuccess()); assertEquals(node1, value.getSource()); assertEquals(node2, value.getTarget()); assertTrue(value.isDocked()); }
@Test public void convertMissingNodes() { Map<String, BpmnNode> nodes = new HashMap<>(); Result<BpmnEdge> result = tested.convertEdge(event, nodes); BpmnEdge value = result.value(); assertTrue(result.isIgnored()); assertNull(value); }
|
FlowElementConverter extends AbstractConverter { public Result<BpmnNode> convertNode(FlowElement flowElement) { return Match.of(FlowElement.class, Result.class) .when(StartEvent.class, converterFactory.startEventConverter()::convert) .when(EndEvent.class, converterFactory.endEventConverter()::convert) .when(BoundaryEvent.class, converterFactory.intermediateCatchEventConverter()::convertBoundaryEvent) .when(IntermediateCatchEvent.class, converterFactory.intermediateCatchEventConverter()::convert) .when(IntermediateThrowEvent.class, converterFactory.intermediateThrowEventConverter()::convert) .when(Task.class, converterFactory.taskConverter()::convert) .when(Gateway.class, converterFactory.gatewayConverter()::convert) .when(SubProcess.class, converterFactory.subProcessConverter()::convertSubProcess) .when(CallActivity.class, converterFactory.callActivityConverter()::convert) .when(TextAnnotation.class, converterFactory.artifactsConverter()::convert) .when(DataObjectReference.class, converterFactory.artifactsConverter()::convert) .ignore(DataStoreReference.class) .ignore(DataStore.class) .ignore(SequenceFlow.class, null) .defaultValue(Result.ignored("FlowElement not found", getNotFoundMessage(flowElement))) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.resultBpmnDecorator()) .mode(getMode()) .apply(flowElement) .value(); } FlowElementConverter(BaseConverterFactory converterFactory); Result<BpmnNode> convertNode(FlowElement flowElement); }
|
@Test public void convertSupported() { StartEvent startEvent = mock(StartEvent.class); tested.convertNode(startEvent); verify(startEventConverter).convert(startEvent); EndEvent endEvent = mock(EndEvent.class); tested.convertNode(endEvent); verify(endEventConverter).convert(endEvent); BoundaryEvent boundaryEvent = mock(BoundaryEvent.class); tested.convertNode(boundaryEvent); verify(eventConverter).convertBoundaryEvent(boundaryEvent); IntermediateCatchEvent intermediateCatchEvent = mock(IntermediateCatchEvent.class); tested.convertNode(intermediateCatchEvent); verify(eventConverter).convert(intermediateCatchEvent); IntermediateThrowEvent intermediateThrowEvent = mock(IntermediateThrowEvent.class); tested.convertNode(intermediateThrowEvent); verify(throwEventConverter).convert(intermediateThrowEvent); Task task = mock(Task.class); tested.convertNode(task); verify(taskConverter).convert(task); Gateway gateway = mock(Gateway.class); tested.convertNode(gateway); verify(gatewayConverter).convert(gateway); SubProcess subProcess = mock(SubProcess.class); tested.convertNode(subProcess); verify(subProcessConverter).convertSubProcess(subProcess); CallActivity callActivity = mock(CallActivity.class); tested.convertNode(callActivity); verify(callActivityConverter).convert(callActivity); TextAnnotation textAnnotation = mock(TextAnnotation.class); tested.convertNode(textAnnotation); verify(artifactsConverter).convert(textAnnotation); DataObjectReference dataObjectReference = mock(DataObjectReference.class); tested.convertNode(dataObjectReference); verify(artifactsConverter).convert(dataObjectReference); }
|
RootProcessConverter extends BaseRootProcessConverter<BPMNDiagramImpl, DiagramSet, ProcessData, AdvancedData> { @Override protected Node<View<BPMNDiagramImpl>, Edge> createNode(String id) { return delegate.factoryManager.newNode(id, BPMNDiagramImpl.class); } RootProcessConverter(TypedFactoryManager typedFactoryManager,
PropertyReaderFactory propertyReaderFactory,
DefinitionResolver definitionResolver,
BaseConverterFactory factory); }
|
@Test public void testCreateNode() { assertTrue(tested.createNode("id").getContent().getDefinition() instanceof BPMNDiagramImpl); }
|
RootProcessConverter extends BaseRootProcessConverter<BPMNDiagramImpl, DiagramSet, ProcessData, AdvancedData> { @Override protected ProcessData createProcessData(String processVariables) { return new ProcessData(new ProcessVariables(processVariables)); } RootProcessConverter(TypedFactoryManager typedFactoryManager,
PropertyReaderFactory propertyReaderFactory,
DefinitionResolver definitionResolver,
BaseConverterFactory factory); }
|
@Test public void testCreateProcessData() { assertNotNull(tested.createProcessData("id")); }
|
RootProcessConverter extends BaseRootProcessConverter<BPMNDiagramImpl, DiagramSet, ProcessData, AdvancedData> { @Override protected DiagramSet createDiagramSet(Process process, ProcessPropertyReader p, DefinitionsPropertyReader d) { return new DiagramSet(new Name(revertIllegalCharsAttribute(process.getName())), new Documentation(p.getDocumentation()), new Id(revertIllegalCharsAttribute(process.getId())), new Package(p.getPackage()), new ProcessType(p.getProcessType()), new Version(p.getVersion()), new AdHoc(p.isAdHoc()), new ProcessInstanceDescription(p.getDescription()), new Imports(new ImportsValue(p.getDefaultImports(), d.getWSDLImports())), new Executable(process.isIsExecutable()), new SLADueDate(p.getSlaDueDate())); } RootProcessConverter(TypedFactoryManager typedFactoryManager,
PropertyReaderFactory propertyReaderFactory,
DefinitionResolver definitionResolver,
BaseConverterFactory factory); }
|
@Test public void testCreateDiagramSet() { DiagramSet diagramSet = createDiagramSet(); assertNotNull(diagramSet); }
@Test public void testImports() { DiagramSet diagramSet = createDiagramSet(); Imports imports = diagramSet.getImports(); assertNotNull(imports); ImportsValue importsValue = imports.getValue(); assertNotNull(importsValue); List<DefaultImport> defaultImports = importsValue.getDefaultImports(); assertNotNull(defaultImports); assertFalse(defaultImports.isEmpty()); DefaultImport defaultImport = defaultImports.get(0); assertNotNull(defaultImport); assertEquals(getClass().getName(), defaultImport.getClassName()); }
|
RootProcessConverter extends BaseRootProcessConverter<BPMNDiagramImpl, DiagramSet, ProcessData, AdvancedData> { @Override protected AdvancedData createAdvancedData(String globalVariables, String metaDataAttributes) { return new AdvancedData(new GlobalVariables(globalVariables), new MetaDataAttributes(metaDataAttributes)); } RootProcessConverter(TypedFactoryManager typedFactoryManager,
PropertyReaderFactory propertyReaderFactory,
DefinitionResolver definitionResolver,
BaseConverterFactory factory); }
|
@Test public void createAdvancedData() { assertTrue(AdvancedData.class.isInstance(tested.createAdvancedData("id", "testßval"))); }
@Test public void convertAdvancedData() { tested.createAdvancedData("id", "testßval"); assertTrue(tested.convertProcess().isSuccess()); }
|
DecisionComponents { public void removeAllItems() { clearDecisionComponents(); } 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 testRemoveAllItems() { decisionComponents.removeAllItems(); verify(decisionComponents).clearDecisionComponents(); }
|
ProcessConverterDelegate { Result<Boolean> convertEdges(BpmnNode processRoot, List<BaseElement> flowElements, Map<String, BpmnNode> nodes) { List<Result<BpmnEdge>> results = flowElements.stream() .map(e -> converterFactory.edgeConverter().convertEdge(e, nodes)) .filter(Result::isSuccess) .collect(Collectors.toList()); boolean value = results.size() > 0 ? results.stream() .map(Result::value) .filter(Objects::nonNull) .map(processRoot::addEdge) .allMatch(Boolean.TRUE::equals) : false; return ResultComposer.compose(value, results); } ProcessConverterDelegate(
TypedFactoryManager typedFactoryManager,
PropertyReaderFactory propertyReaderFactory,
DefinitionResolver definitionResolver,
BaseConverterFactory factory); }
|
@Test public void testConvertEdges() { Task task1 = mockTask("1"); Task task2 = mockTask("2"); BpmnNode task1Node = mockTaskNode(task1); BpmnNode task2Node = mockTaskNode(task2); SequenceFlow sequenceFlow = mockSequenceFlow("seq1", task1, task2); List<BaseElement> elements = Arrays.asList(sequenceFlow, task1, task2); assertFalse(converterDelegate.convertEdges(parentNode, elements, new HashMap<>()).value()); Map<String, BpmnNode> nodes = new Maps.Builder<String, BpmnNode>().put(task1.getId(), task1Node).put(task2.getId(), task2Node).build(); assertTrue(converterDelegate.convertEdges(parentNode, elements, nodes).value()); }
@Test public void testConvertEdgesIgnoredNonEdgeElement() { Map<String, BpmnNode> nodes = new HashMap<>(); List<BaseElement> elements = Arrays.asList(mockTask("1")); assertFalse(converterDelegate.convertEdges(parentNode, elements, nodes).value()); }
|
ProcessConverterDelegate { Result<Map<String, BpmnNode>> convertChildNodes( BpmnNode firstNode, List<FlowElement> flowElements, List<LaneSet> laneSets) { for (FlowElement element : flowElements) { element.setId(revertIllegalCharsAttribute(element.getId())); element.setName(revertIllegalCharsAttribute(element.getName())); } final Result<Map<String, BpmnNode>> flowElementsResult = convertFlowElements(flowElements); final Map<String, BpmnNode> freeFloatingNodes = flowElementsResult.value(); freeFloatingNodes .values() .forEach(n -> n.setParent(firstNode)); final Result<BpmnNode>[] laneSetsResult = convertLaneSets(laneSets, freeFloatingNodes, firstNode); final Map<String, BpmnNode> lanesMap = Stream.of(laneSetsResult) .filter(Objects::nonNull).map(v -> v.value()) .collect(Collectors.toMap(n -> n.value().getUUID(), n -> n)); freeFloatingNodes.putAll(lanesMap); return ResultComposer.compose(freeFloatingNodes, flowElementsResult, ResultComposer.compose(laneSets, laneSetsResult)); } ProcessConverterDelegate(
TypedFactoryManager typedFactoryManager,
PropertyReaderFactory propertyReaderFactory,
DefinitionResolver definitionResolver,
BaseConverterFactory factory); }
|
@Test public void testConvertUnsupportedChildNodes() { List<LaneSet> laneSets = Collections.emptyList(); List<FlowElement> flowElements = Arrays.asList(mockTask("1"), mockTask("2"), mockUnsupportedTask("3"), mockUnsupportedDataObject("4")); Result<Map<String, BpmnNode>> result = converterDelegate.convertChildNodes(parentNode, flowElements, laneSets); List<MarshallingMessage> messages = result.messages(); assertEquals(2, messages.size()); assertTrue(messages.stream().map(MarshallingMessage::getViolationType).allMatch(Violation.Type.WARNING::equals)); }
@Test public void testConvertIgnoredFlowElements() { List<LaneSet> laneSets = Collections.emptyList(); List<FlowElement> flowElements = Arrays.asList(mockTask("1"), mockTask("2"), mockSequenceFlow("3", null, null), mockUnsupportedDataObject("4")); Result<Map<String, BpmnNode>> result = converterDelegate.convertChildNodes(parentNode, flowElements, laneSets); Map<String, BpmnNode> values = result.value(); List<MarshallingMessage> messages = result.messages(); assertEquals(2, values.size()); assertEquals(1, messages.size()); assertTrue(messages.stream().map(MarshallingMessage::getViolationType).allMatch(Violation.Type.WARNING::equals)); }
@Test public void testConvertLanes() { Task task0_1 = mockTask("TASK0_1"); Task task0_2 = mockTask("TASK0_2"); Task task0_3 = mockTask("TASK0_3"); Task task1_1 = mockTask("TASK1_1"); Lane lane1 = mockLane("Lane1", "Lane1Name", task1_1); Task task2_1 = mockTask("TASK2_1"); Lane lane2 = mockLane("Lane2", "Lane2Name", task2_1); LaneSet laneSet1 = mockLaneSet("LaneSet1", lane1, lane2); Task task3_2_1 = mockTask("TASK3_2_1"); Task task3_2_2 = mockTask("TASK3_2_2"); Lane lane3_2 = mockLane("Lane3_2", "Lane3_2Name", task3_2_1, task3_2_2); Task task3_1_2_1 = mockTask("TASK3_1_2_1"); Lane lane3_1_2 = mockLane("Lane3_1_2", "Lane3_1_2Name", task3_1_2_1); Task task3_1_1_1_1 = mockTask("task3_1_1_1_1"); Lane lane3_1_1_1 = mockLane("Lane3_1_1_1", "lane3_1_1_1Name", task3_1_1_1_1); Task task3_1_1_2_1 = mockTask("task3_1_1_2_1"); Lane lane3_1_1_2 = mockLane("Lane3_1_1_2", "lane3_1_1_2Name", task3_1_1_2_1); Lane lane3_1_1 = mockLane("Lane3_1_1", "Lane3_1_1Name", mockLaneSet("laneSet3_1_1", lane3_1_1_1, lane3_1_1_2)); Lane lane3_1 = mockLane("Lane3_1", "Lane3_1Name", mockLaneSet("laneSet3_1", lane3_1_1, lane3_1_2)); Lane lane3 = mockLane("Lane3", "Lane3Name", mockLaneSet("LaneSet3", lane3_1, lane3_2)); LaneSet laneSet2 = mockLaneSet("LaneSet2", lane3); List<FlowElement> flowElements = Arrays.asList(task0_1, task0_2, task0_3, task1_1, task2_1, task3_1_1_1_1, task3_1_1_2_1, task3_1_2_1, task3_2_1, task3_2_2); List<LaneSet> laneSets = Arrays.asList(laneSet1, laneSet2); Result<Map<String, BpmnNode>> result = converterDelegate.convertChildNodes(parentNode, flowElements, laneSets); Map<String, BpmnNode> nodes = result.value(); assertEquals(16, nodes.size()); assertEquals(9, parentNode.getChildren().size()); assertHasChildren(parentNode, task0_1.getId(), task0_2.getId(), task0_3.getId(), lane1.getId(), lane2.getId(), lane3_2.getId(), lane3_1_2.getId(), lane3_1_1_1.getId(), lane3_1_1_2.getId()); BpmnNode lane1Node = getChildById(parentNode, lane1.getId()); assertNotNull(lane1Node); assertHasChildren(lane1Node, task1_1.getId()); BpmnNode lane2Node = getChildById(parentNode, lane2.getId()); assertNotNull(lane2Node); assertHasChildren(lane2Node, task2_1.getId()); BpmnNode lane3_1_1_1Node = getChildById(parentNode, lane3_1_1_1.getId()); assertNotNull(lane3_1_1_1Node); assertHasChildren(lane3_1_1_1Node, task3_1_1_1_1.getId()); BpmnNode lane3_1_1_2Node = getChildById(parentNode, lane3_1_1_2.getId()); assertNotNull(lane3_1_1_2Node); assertHasChildren(lane3_1_1_2Node, task3_1_1_2_1.getId()); BpmnNode lane3_1_2Node = getChildById(parentNode, lane3_1_2.getId()); assertNotNull(lane3_1_2Node); assertHasChildren(lane3_1_2Node, task3_1_2_1.getId()); BpmnNode lane3_2Node = getChildById(parentNode, lane3_2.getId()); assertHasChildren(lane3_2Node); assertHasChildren(lane3_2Node, task3_2_1.getId(), task3_2_2.getId()); List<MarshallingMessage> messages = result.messages(); assertEquals(4, messages.size()); assertTrue(messages.stream() .map(MarshallingMessage::getMessageKey) .allMatch(MarshallingMessageKeys.childLaneSetConverted::equals)); }
|
SubProcessConverter extends BaseSubProcessConverter<AdHocSubprocess, ProcessData, AdHocSubprocessTaskExecutionSet> { @Override protected Node<View<AdHocSubprocess>, Edge> createNode(String id) { return delegate.factoryManager.newNode(id, AdHocSubprocess.class); } SubProcessConverter(TypedFactoryManager typedFactoryManager,
PropertyReaderFactory propertyReaderFactory,
DefinitionResolver definitionResolver,
ConverterFactory converterFactory); }
|
@Test public void createNode() { assertTrue(AdHocSubprocess.class.isInstance(tested.createNode("id").getContent().getDefinition())); }
|
SubProcessConverter extends BaseSubProcessConverter<AdHocSubprocess, ProcessData, AdHocSubprocessTaskExecutionSet> { @Override protected ProcessData createProcessData(String processVariables) { return new ProcessData(new ProcessVariables(processVariables)); } SubProcessConverter(TypedFactoryManager typedFactoryManager,
PropertyReaderFactory propertyReaderFactory,
DefinitionResolver definitionResolver,
ConverterFactory converterFactory); }
|
@Test public void createProcessData() { assertTrue(ProcessData.class.isInstance(tested.createProcessData("id"))); }
|
SubProcessConverter extends BaseSubProcessConverter<AdHocSubprocess, ProcessData, AdHocSubprocessTaskExecutionSet> { @Override protected AdHocSubprocessTaskExecutionSet createAdHocSubprocessTaskExecutionSet(AdHocSubProcessPropertyReader p) { return new AdHocSubprocessTaskExecutionSet(new AdHocActivationCondition(p.getAdHocActivationCondition()), new AdHocCompletionCondition(p.getAdHocCompletionCondition()), new AdHocOrdering(p.getAdHocOrdering()), new AdHocAutostart(p.isAdHocAutostart()), new OnEntryAction(p.getOnEntryAction()), new OnExitAction(p.getOnExitAction()), new IsAsync(p.isAsync()), new SLADueDate(p.getSlaDueDate())); } SubProcessConverter(TypedFactoryManager typedFactoryManager,
PropertyReaderFactory propertyReaderFactory,
DefinitionResolver definitionResolver,
ConverterFactory converterFactory); }
|
@Test public void testCreateAdHocSubprocessTaskExecutionSet() { AdHocSubProcess adHocSubProcess = mock(AdHocSubProcess.class); when(adHocSubProcess.getCompletionCondition()).thenReturn(mock(FormalExpression.class)); when(adHocSubProcess.getOrdering()).thenReturn(AdHocOrdering.SEQUENTIAL); assertTrue(AdHocSubprocessTaskExecutionSet.class.isInstance(tested.createAdHocSubprocessTaskExecutionSet( new AdHocSubProcessPropertyReader(adHocSubProcess, definitionResolver.getDiagram(), definitionResolver)))); }
|
ResultComposer { public static <T, R> Result compose(T value, Collection<Result<R>>... results) { List<MarshallingMessage> messages = Stream.of(results).flatMap(Collection::stream) .map(Result::messages) .flatMap(List::stream) .collect(Collectors.toList()); return Result.success(value, messages.stream().toArray(MarshallingMessage[]::new)); } static Result compose(T value, Collection<Result<R>>... results); static Result compose(T value, Result... result); }
|
@Test public void compose() { final Result result = ResultComposer.compose(value, result1, result2, result3); assertResult(result); }
@Test public void composeList() { final Result result = ResultComposer.compose(value, Arrays.asList(result1, result2, result3)); assertResult(result); }
|
DecisionComponents { DMNIncludedModel asDMNIncludedModel(final Import anImport) { final String modelName = anImport.getName().getValue(); final String namespace = anImport.getNamespace(); final String importType = anImport.getImportType(); final String path = FileUtils.getFileName(anImport.getLocationURI().getValue()); return new DMNIncludedModel(modelName, "", path, namespace, importType, 0, 0); } 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 testAsDMNIncludedModel() { final String modelName = "Model Name"; final String namespace = "The Namespace"; final String type = "The type"; final String file = "my file.dmn"; final String filePath = " final Import anImport = new Import(); anImport.setName(new Name(modelName)); anImport.setNamespace(namespace); anImport.setImportType(type); anImport.setLocationURI(new LocationURI(filePath)); final DMNIncludedModel includedModel = decisionComponents.asDMNIncludedModel(anImport); assertEquals(modelName, includedModel.getModelName()); assertEquals(namespace, includedModel.getNamespace()); assertEquals(type, includedModel.getImportType()); assertEquals(file, includedModel.getPath()); }
|
CustomElement { public T get() { return elementDefinition.getValue(element); } CustomElement(ElementDefinition<T> elementDefinition, BaseElement element); T get(); void set(T value); static final MetadataTypeDefinition<Boolean> async; static final MetadataTypeDefinition<Boolean> autoStart; static final MetadataTypeDefinition<Boolean> autoConnectionSource; static final MetadataTypeDefinition<Boolean> autoConnectionTarget; static final MetadataTypeDefinition<String> customTags; static final MetadataTypeDefinition<String> description; static final MetadataTypeDefinition<String> scope; static final MetadataTypeDefinition<String> name; static final MetadataTypeDefinition<String> caseIdPrefix; static final MetadataTypeDefinition<String> caseRole; static final MetadataTypeDefinition<String> slaDueDate; static final GlobalVariablesElement globalVariables; static final MetaDataAttributesElement metaDataAttributes; static final MetadataTypeDefinition<Boolean> isCase; static final MetadataTypeDefinition<String> customActivationCondition; static final MetadataTypeDefinition<Boolean> abortParent; static final DefaultImportsElement defaultImports; }
|
@Test public void testGet() { Object value = new Object(); elementDefinition.setValue(baseElement, value); assertEquals(value, new CustomElement<>(elementDefinition, baseElement).get()); }
|
CustomElement { public void set(T value) { if (value != null && !value.equals(elementDefinition.getDefaultValue())) { elementDefinition.setValue(element, value); } } CustomElement(ElementDefinition<T> elementDefinition, BaseElement element); T get(); void set(T value); static final MetadataTypeDefinition<Boolean> async; static final MetadataTypeDefinition<Boolean> autoStart; static final MetadataTypeDefinition<Boolean> autoConnectionSource; static final MetadataTypeDefinition<Boolean> autoConnectionTarget; static final MetadataTypeDefinition<String> customTags; static final MetadataTypeDefinition<String> description; static final MetadataTypeDefinition<String> scope; static final MetadataTypeDefinition<String> name; static final MetadataTypeDefinition<String> caseIdPrefix; static final MetadataTypeDefinition<String> caseRole; static final MetadataTypeDefinition<String> slaDueDate; static final GlobalVariablesElement globalVariables; static final MetaDataAttributesElement metaDataAttributes; static final MetadataTypeDefinition<Boolean> isCase; static final MetadataTypeDefinition<String> customActivationCondition; static final MetadataTypeDefinition<Boolean> abortParent; static final DefaultImportsElement defaultImports; }
|
@Test public void testSetNonDefaultValue() { Object newValue = new Object(); CustomElement<Object> customElement = new CustomElement<>(elementDefinition, baseElement); customElement.set(newValue); assertEquals(newValue, elementDefinition.getValue(baseElement)); }
|
CustomInputDefinition { public CustomInput<T> of(Task element) { return new CustomInput<>(this, element); } CustomInputDefinition(String name, String type, T defaultValue); String name(); String type(); abstract T getValue(Task element); CustomInput<T> of(Task element); }
|
@Test public void shouldReuseInputSet() { Task task = bpmn2.createTask(); StringInput stringInput = new StringInput("BLAH", "ATYPE", "DEFAULTVAL"); stringInput.of(task).set("VALUE"); StringInput stringInput2 = new StringInput("BLAH2", "ATYPE", "DEFAULTVAL"); stringInput.of(task).set("VALUE"); InputOutputSpecification ioSpecification = task.getIoSpecification(); List<InputSet> inputSets = ioSpecification.getInputSets(); assertEquals(1, inputSets.size()); }
|
DefaultImportsElement extends ElementDefinition<List<DefaultImport>> { @Override public List<DefaultImport> getValue(BaseElement element) { List<ExtensionAttributeValue> extValues = element.getExtensionValues(); List<DefaultImport> defaultImports = extValues.stream() .map(ExtensionAttributeValue::getValue) .flatMap((Function<FeatureMap, Stream<?>>) extensionElements -> { List o = (List) extensionElements.get(DOCUMENT_ROOT__IMPORT, true); return o.stream(); }) .map(m -> new DefaultImport(((ImportType) m).getName())) .collect(Collectors.toList()); return defaultImports; } DefaultImportsElement(String name); @Override List<DefaultImport> getValue(BaseElement element); @Override void setValue(BaseElement element, List<DefaultImport> value); static FeatureMap.Entry extensionOf(DefaultImport defaultImport); static ImportType importTypeDataOf(DefaultImport defaultImport); }
|
@Test public void testGetValue() { BaseElement baseElement = bpmn2.createProcess(); assertEquals(new ArrayList<>(), CustomElement.defaultImports.of(baseElement).get()); }
|
DefaultImportsElement extends ElementDefinition<List<DefaultImport>> { @Override public void setValue(BaseElement element, List<DefaultImport> value) { value.stream() .map(DefaultImportsElement::extensionOf) .forEach(getExtensionElements(element)::add); } DefaultImportsElement(String name); @Override List<DefaultImport> getValue(BaseElement element); @Override void setValue(BaseElement element, List<DefaultImport> value); static FeatureMap.Entry extensionOf(DefaultImport defaultImport); static ImportType importTypeDataOf(DefaultImport defaultImport); }
|
@Test public void testSetValue() { List<DefaultImport> defaultImports = new ArrayList<>(); defaultImports.add(new DefaultImport(CLASS_NAME + 1)); defaultImports.add(new DefaultImport(CLASS_NAME + 2)); defaultImports.add(new DefaultImport(CLASS_NAME + 3)); BaseElement baseElement = bpmn2.createProcess(); CustomElement.defaultImports.of(baseElement).set(defaultImports); List<DefaultImport> result = CustomElement.defaultImports.of(baseElement).get(); assertEquals(3, result.size()); assertEquals(CLASS_NAME + 1, result.get(0).getClassName()); assertEquals(CLASS_NAME + 2, result.get(1).getClassName()); assertEquals(CLASS_NAME + 3, result.get(2).getClassName()); }
|
DefaultImportsElement extends ElementDefinition<List<DefaultImport>> { public static FeatureMap.Entry extensionOf(DefaultImport defaultImport) { return new EStructuralFeatureImpl.SimpleFeatureMapEntry( (EStructuralFeature.Internal) DOCUMENT_ROOT__IMPORT, importTypeDataOf(defaultImport)); } DefaultImportsElement(String name); @Override List<DefaultImport> getValue(BaseElement element); @Override void setValue(BaseElement element, List<DefaultImport> value); static FeatureMap.Entry extensionOf(DefaultImport defaultImport); static ImportType importTypeDataOf(DefaultImport defaultImport); }
|
@Test public void extensionOf() { DefaultImportsElement defaultImportsElement = new DefaultImportsElement(NAME); DefaultImport defaultImport = new DefaultImport(CLASS_NAME); ImportType importType = defaultImportsElement.importTypeDataOf(defaultImport); FeatureMap.Entry entry = defaultImportsElement.extensionOf(defaultImport); assertNotNull(entry); assertTrue(entry instanceof EStructuralFeatureImpl.SimpleFeatureMapEntry); assertEquals(DOCUMENT_ROOT__IMPORT, entry.getEStructuralFeature()); assertNotNull((ImportType) entry.getValue()); assertEquals(importType.getName(), ((ImportType) entry.getValue()).getName()); }
|
DefaultImportsElement extends ElementDefinition<List<DefaultImport>> { public static ImportType importTypeDataOf(DefaultImport defaultImport) { ImportType importType = DroolsFactory.eINSTANCE.createImportType(); importType.setName(defaultImport.getClassName()); return importType; } DefaultImportsElement(String name); @Override List<DefaultImport> getValue(BaseElement element); @Override void setValue(BaseElement element, List<DefaultImport> value); static FeatureMap.Entry extensionOf(DefaultImport defaultImport); static ImportType importTypeDataOf(DefaultImport defaultImport); }
|
@Test public void importTypeDataOf() { DefaultImportsElement defaultImportsElement = new DefaultImportsElement(NAME); DefaultImport defaultImport = new DefaultImport(CLASS_NAME); ImportType importType = defaultImportsElement.importTypeDataOf(defaultImport); assertEquals(CLASS_NAME, importType.getName()); }
|
MetaDataAttributesElement extends ElementDefinition<String> { @Override public void setValue(BaseElement element, String value) { setStringValue(element, value); } MetaDataAttributesElement(String name); @Override String getValue(BaseElement element); @Override void setValue(BaseElement element, String value); static final String DELIMITER; static final String SEPARATOR; }
|
@Test public void testSetValue() { BaseElement baseElement = bpmn2.createProcess(); CustomElement.metaDataAttributes.of(baseElement).set(ATTRIBUTES); assertEquals("att1ß<![CDATA[val1]]>Øatt2ß<![CDATA[val2]]>Øatt3ß<![CDATA[val3]]>", CustomElement.metaDataAttributes.of(baseElement).get()); }
|
MetaDataAttributesElement extends ElementDefinition<String> { protected FeatureMap.Entry extensionOf(String metaData) { return new EStructuralFeatureImpl.SimpleFeatureMapEntry( (EStructuralFeature.Internal) DOCUMENT_ROOT__META_DATA, metaDataTypeDataOf(metaData)); } MetaDataAttributesElement(String name); @Override String getValue(BaseElement element); @Override void setValue(BaseElement element, String value); static final String DELIMITER; static final String SEPARATOR; }
|
@Test public void testExtensionOf() { MetaDataAttributesElement metaDataAttributesElement = new MetaDataAttributesElement(NAME); MetaDataType metaDataType = metaDataAttributesElement.metaDataTypeDataOf(ATTRIBUTE); FeatureMap.Entry entry = metaDataAttributesElement.extensionOf(ATTRIBUTE); assertNotNull(entry); assertTrue(entry instanceof EStructuralFeatureImpl.SimpleFeatureMapEntry); assertEquals(DOCUMENT_ROOT__META_DATA, entry.getEStructuralFeature()); assertNotNull(entry.getValue()); assertEquals(metaDataType.getName(), ((MetaDataType) entry.getValue()).getName()); assertEquals(metaDataType.getMetaValue(), ((MetaDataType) entry.getValue()).getMetaValue()); }
|
MetaDataAttributesElement extends ElementDefinition<String> { protected MetaDataType metaDataTypeDataOf(String metaData) { MetaDataType metaDataType = DroolsFactory.eINSTANCE.createMetaDataType(); String[] properties = metaData.split(SEPARATOR); metaDataType.setName(properties[0]); metaDataType.setMetaValue(properties.length > 1 ? asCData(properties[1]) : null); return metaDataType; } MetaDataAttributesElement(String name); @Override String getValue(BaseElement element); @Override void setValue(BaseElement element, String value); static final String DELIMITER; static final String SEPARATOR; }
|
@Test public void testImportTypeDataOf() { MetaDataAttributesElement metaDataAttributesElement = new MetaDataAttributesElement(NAME); MetaDataType metaDataType = metaDataAttributesElement.metaDataTypeDataOf(ATTRIBUTE); assertTrue("att1ß<![CDATA[val1]]>".startsWith(metaDataType.getName())); assertTrue("att1ß<![CDATA[val1]]>".endsWith(metaDataType.getMetaValue())); }
|
DecisionComponents { void createDecisionComponentItem(final DecisionComponent component) { final DecisionComponentsItem item = itemManagedInstance.get(); item.setDecisionComponent(component); getDecisionComponentsItems().add(item); view.addListItem(item.getView().getElement()); } 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 testCreateDecisionComponentItem() { final DecisionComponentsItem item = mock(DecisionComponentsItem.class); final List<DecisionComponentsItem> decisionComponentsItems = spy(new ArrayList<>()); final DecisionComponentsItem.View decisionComponentsView = mock(DecisionComponentsItem.View.class); final HTMLElement htmlElement = mock(HTMLElement.class); final DecisionComponent component = mock(DecisionComponent.class); when(decisionComponentsView.getElement()).thenReturn(htmlElement); when(itemManagedInstance.get()).thenReturn(item); when(item.getView()).thenReturn(decisionComponentsView); doReturn(decisionComponentsItems).when(decisionComponents).getDecisionComponentsItems(); decisionComponents.createDecisionComponentItem(component); verify(item).setDecisionComponent(any(DecisionComponent.class)); verify(decisionComponentsItems).add(item); verify(view).addListItem(htmlElement); }
|
GlobalVariablesElement extends ElementDefinition<String> { @Override public String getValue(BaseElement element) { return getStringValue(element) .orElse(getDefaultValue()); } GlobalVariablesElement(String name); @Override String getValue(BaseElement element); @Override void setValue(BaseElement element, String value); }
|
@Test public void testGetValue() { BaseElement baseElement = bpmn2.createProcess(); CustomElement.globalVariables.of(baseElement).set(GLOBAL_VARIABLES); assertEquals(GLOBAL_VARIABLES, CustomElement.globalVariables.of(baseElement).get()); }
|
GlobalVariablesElement extends ElementDefinition<String> { @Override public void setValue(BaseElement element, String value) { setStringValue(element, value); } GlobalVariablesElement(String name); @Override String getValue(BaseElement element); @Override void setValue(BaseElement element, String value); }
|
@Test public void testSetValue() { BaseElement baseElement = bpmn2.createProcess(); CustomElement.globalVariables.of(baseElement).set(GLOBAL_VARIABLES); assertEquals(GLOBAL_VARIABLES, CustomElement.globalVariables.of(baseElement).get()); }
|
GlobalVariablesElement extends ElementDefinition<String> { static FeatureMap.Entry extensionOf(String variable) { return new EStructuralFeatureImpl.SimpleFeatureMapEntry( (EStructuralFeature.Internal) DOCUMENT_ROOT__GLOBAL, globalTypeDataOf(variable)); } GlobalVariablesElement(String name); @Override String getValue(BaseElement element); @Override void setValue(BaseElement element, String value); }
|
@Test public void testExtensionOf() { GlobalVariablesElement globalVariablesElement = new GlobalVariablesElement(NAME); GlobalType globalType = globalVariablesElement.globalTypeDataOf(GLOBAL_VARIABLE); FeatureMap.Entry entry = globalVariablesElement.extensionOf(GLOBAL_VARIABLE); assertNotNull(entry); assertTrue(entry instanceof EStructuralFeatureImpl.SimpleFeatureMapEntry); assertEquals(DOCUMENT_ROOT__GLOBAL, entry.getEStructuralFeature()); assertNotNull(entry.getValue()); assertEquals(globalType.getIdentifier(), ((GlobalType) entry.getValue()).getIdentifier()); assertEquals(globalType.getType(), ((GlobalType) entry.getValue()).getType()); }
|
GlobalVariablesElement extends ElementDefinition<String> { static GlobalType globalTypeDataOf(String variable) { GlobalType globalType = DroolsFactory.eINSTANCE.createGlobalType(); String[] properties = variable.split(":", -1); globalType.setIdentifier(properties[0]); globalType.setType(properties[1]); return globalType; } GlobalVariablesElement(String name); @Override String getValue(BaseElement element); @Override void setValue(BaseElement element, String value); }
|
@Test public void testGlobalTypeDataOf() { GlobalVariablesElement globalVariablesElement = new GlobalVariablesElement(NAME); GlobalType globalType = globalVariablesElement.globalTypeDataOf(GLOBAL_VARIABLE); assertTrue(GLOBAL_VARIABLE.startsWith(globalType.getIdentifier())); assertTrue(GLOBAL_VARIABLE.endsWith(globalType.getType())); }
|
AssociationDeclaration { public static AssociationDeclaration fromString(String encoded) { return AssociationParser.parse(encoded); } AssociationDeclaration(Direction direction, Type type, String source, String target); static AssociationDeclaration fromString(String encoded); String getSource(); void setSource(String source); String getTarget(); void setTarget(String target); Direction getDirection(); void setDirection(Direction direction); void setType(Type type); Type getType(); @Override String toString(); }
|
@Test(expected = IllegalArgumentException.class) public void testFromStringNull() { AssociationDeclaration.fromString(null); }
@Test(expected = IllegalArgumentException.class) public void testFromStringEmpty() { AssociationDeclaration.fromString(""); }
|
VariableDeclaration { public String getIdentifier() { return identifier; } VariableDeclaration(String identifier, String type); VariableDeclaration(String identifier, String type, String tags); static VariableDeclaration fromString(String encoded); String getTags(); void setTags(String tags); String getIdentifier(); void setIdentifier(String identifier); String getType(); void setType(String type); ItemDefinition getTypeDeclaration(); Property getTypedIdentifier(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
|
@Test public void testIdentifier() { String identifier = tested.getIdentifier(); assertEquals(identifier, VAR_IDENTIFIER); }
@Test public void testIdentifier() { String identifier = tested.getIdentifier(); assertEquals(VAR_IDENTIFIER, identifier); }
|
VariableDeclaration { public Property getTypedIdentifier() { return typedIdentifier; } VariableDeclaration(String identifier, String type); VariableDeclaration(String identifier, String type, String tags); static VariableDeclaration fromString(String encoded); String getTags(); void setTags(String tags); String getIdentifier(); void setIdentifier(String identifier); String getType(); void setType(String type); ItemDefinition getTypeDeclaration(); Property getTypedIdentifier(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
|
@Test public void testName() { String name = tested.getTypedIdentifier().getName(); assertEquals(name, VAR_NAME); }
@Test public void testName() { String name = tested.getTypedIdentifier().getName(); assertEquals(VAR_NAME, name); }
|
VariableDeclaration { public String getTags() { return tags; } VariableDeclaration(String identifier, String type); VariableDeclaration(String identifier, String type, String tags); static VariableDeclaration fromString(String encoded); String getTags(); void setTags(String tags); String getIdentifier(); void setIdentifier(String identifier); String getType(); void setType(String type); ItemDefinition getTypeDeclaration(); Property getTypedIdentifier(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
|
@Test public void testTags() { String tags = tested.getTags(); assertEquals(CONSTRUCTOR_TAGS, tags); }
|
VariableDeclaration { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } VariableDeclaration that = (VariableDeclaration) o; return Objects.equals(identifier, that.identifier) && Objects.equals(type, that.type) && Objects.equals(tags, that.tags); } VariableDeclaration(String identifier, String type); VariableDeclaration(String identifier, String type, String tags); static VariableDeclaration fromString(String encoded); String getTags(); void setTags(String tags); String getIdentifier(); void setIdentifier(String identifier); String getType(); void setType(String type); ItemDefinition getTypeDeclaration(); Property getTypedIdentifier(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
|
@Test public void testEquals() { VariableDeclaration comparable = new VariableDeclaration(CONSTRUCTOR_IDENTIFIER, CONSTRUCTOR_TYPE, CONSTRUCTOR_TAGS); assertEquals(tested, comparable); }
@Test public void testDataObjectEquals() { DataObject dataObject1 = mockDataObject("dataObject1"); DataObject dataObject2 = mockDataObject("dataObject2"); DataObjectImpl dataObject1Cast = (DataObjectImpl) dataObject1; DataObjectImpl dataObject2Cast = (DataObjectImpl) dataObject2; assertFalse(dataObject1Cast.equals(dataObject2Cast)); assertTrue(dataObject1Cast.equals(dataObject1Cast)); assertFalse(dataObject1Cast.equals("someString")); dataObject2 = mockDataObject("dataObject1"); dataObject2Cast = (DataObjectImpl) dataObject2; assertFalse(dataObject1Cast.equals(dataObject2Cast)); }
|
DecisionComponents { void createDecisionComponentItems(final List<DecisionComponent> decisionComponents) { for (final DecisionComponent component : decisionComponents) { if (!isDRGElementAdded(component)) { createDecisionComponentItem(component); } } } 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 testCreateDecisionComponentItems() { final List<DecisionComponent> decisionComponentsItems = new ArrayList<>(); decisionComponentsItems.add(makeDecisionComponent("Decision-1", "uuid1", "ModelName", false)); decisionComponentsItems.add(makeDecisionComponent("Decision-1", "uuid1", "ModelName", false)); decisionComponentsItems.add(makeDecisionComponent("Decision-1", "uuid2", "ModelName", false)); decisionComponentsItems.add(makeDecisionComponent("included.Decision-2", "uuidA", "included.dmn", true)); decisionComponentsItems.add(makeDecisionComponent("included.Decision-2", "uuidA", "included.dmn", true)); decisionComponentsItems.add(makeDecisionComponent("included.Decision-2", "uuidB", "included.dmn", true)); when(itemManagedInstance.get()).then((e) -> new DecisionComponentsItem(decisionComponentsItemView)); decisionComponents.createDecisionComponentItems(decisionComponentsItems); verify(decisionComponents, times(4)).createDecisionComponentItem(decisionComponentArgumentCaptor.capture()); final List<DecisionComponent> createdDecisionComponents = decisionComponentArgumentCaptor.getAllValues(); assertEquals("uuid1", createdDecisionComponents.get(0).getDrgElement().getId().getValue()); assertEquals("uuid2", createdDecisionComponents.get(1).getDrgElement().getId().getValue()); assertEquals("uuidA", createdDecisionComponents.get(2).getDrgElement().getId().getValue()); assertEquals("uuidB", createdDecisionComponents.get(3).getDrgElement().getId().getValue()); }
|
VariableDeclaration { @Override public String toString() { String tagsString = ""; if (!Strings.isNullOrEmpty(tags)) { tagsString = ":" + tags; } if (type == null || type.isEmpty()) { return typedIdentifier.getName() + tagsString; } else { return typedIdentifier.getName() + ":" + type + tagsString; } } VariableDeclaration(String identifier, String type); VariableDeclaration(String identifier, String type, String tags); static VariableDeclaration fromString(String encoded); String getTags(); void setTags(String tags); String getIdentifier(); void setIdentifier(String identifier); String getType(); void setType(String type); ItemDefinition getTypeDeclaration(); Property getTypedIdentifier(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
|
@Test public void testToString() { assertEquals(tested.toString(), CONSTRUCTOR_IDENTIFIER + ":" + CONSTRUCTOR_TYPE + ":" + CONSTRUCTOR_TAGS); assertNotEquals(tested.toString(), CONSTRUCTOR_IDENTIFIER + ":" + CONSTRUCTOR_TYPE + ":" + "[myCustomTag]"); VariableDeclaration comparable = new VariableDeclaration(CONSTRUCTOR_IDENTIFIER, CONSTRUCTOR_TYPE, null); assertEquals(comparable.toString(), CONSTRUCTOR_IDENTIFIER + ":" + CONSTRUCTOR_TYPE); comparable = new VariableDeclaration(CONSTRUCTOR_IDENTIFIER, CONSTRUCTOR_TYPE, ""); assertEquals(comparable.toString(), CONSTRUCTOR_IDENTIFIER + ":" + CONSTRUCTOR_TYPE); }
|
AssociationList { public static AssociationList fromString(String encoded) { return Optional.ofNullable(encoded) .filter(StringUtils::nonEmpty) .map(s -> new AssociationList( Arrays.stream(s.replaceAll(REGEX_DELIMITER, REPLACE_DELIMITER_AVOID_CONFLICTS) .split(REPLACED_DELIMITER)) .map(AssociationDeclaration::fromString) .collect(toList()))) .orElse(new AssociationList()); } AssociationList(List<AssociationDeclaration> inputs, List<AssociationDeclaration> outputs); AssociationList(List<AssociationDeclaration> all); AssociationList(); static AssociationList fromString(String encoded); List<AssociationDeclaration> getInputs(); AssociationDeclaration lookupInput(String id); List<AssociationDeclaration> lookupOutputs(String id); List<AssociationDeclaration> getOutputs(); @Override String toString(); static final String REGEX_DELIMITER; static final String RANDOM_DELIMITER; static final String REPLACE_DELIMITER_AVOID_CONFLICTS; static final String REPLACED_DELIMITER; }
|
@Test public void fromString() { AssociationList list = tested.fromString(VALUE); assertEquals(2, list.getInputs().size()); assertEquals(2, list.getOutputs().size()); }
|
DefinitionsPropertyWriter { public void setWSDLImports(List<WSDLImport> wsdlImports) { wsdlImports.stream() .map(PropertyWriterUtils::toImport) .forEach(definitions.getImports()::add); } DefinitionsPropertyWriter(Definitions definitions); void setExporter(String exporter); void setExporterVersion(String version); void setProcess(Process process); void setDiagram(BPMNDiagram bpmnDiagram); void setRelationship(Relationship relationship); void setWSDLImports(List<WSDLImport> wsdlImports); void addAllRootElements(Collection<? extends RootElement> rootElements); Definitions getDefinitions(); }
|
@Test public void setWSDLImports() { final String LOCATION = "location"; final String NAMESPACE = "namespace"; final int QTY = 10; List<WSDLImport> wsdlImports = new ArrayList<>(); for (int i = 0; i < QTY; i++) { wsdlImports.add(new WSDLImport(LOCATION + i, NAMESPACE + i)); } tested.setWSDLImports(wsdlImports); List<Import> imports = definitions.getImports(); assertEquals(QTY, imports.size()); for (int i = 0; i < QTY; i++) { assertEquals(LOCATION + i, imports.get(i).getLocation()); assertEquals(NAMESPACE + i, imports.get(i).getNamespace()); } }
|
CallActivityPropertyWriter extends MultipleInstanceActivityPropertyWriter { public void setCase(Boolean isCase) { CustomElement.isCase.of(flowElement).set(isCase); } CallActivityPropertyWriter(CallActivity activity, VariableScope variableScope, Set<DataObject> dataObjects); void setOnEntryAction(OnEntryAction onEntryAction); void setOnExitAction(OnExitAction onExitAction); void setIndependent(Boolean independent); void setAbortParent(Boolean abortParent); void setWaitForCompletion(Boolean waitForCompletion); void setAsync(Boolean async); void setCalledElement(String value); void setCase(Boolean isCase); void setAdHocAutostart(boolean autoStart); void setSlaDueDate(SLADueDate slaDueDate); }
|
@Test public void testSetCase_true() throws Exception { tested.setCase(Boolean.TRUE); assertTrue(CustomElement.isCase.of(tested.getFlowElement()).get()); }
@Test public void testSetCase_false() throws Exception { tested.setCase(Boolean.FALSE); assertFalse(CustomElement.isCase.of(tested.getFlowElement()).get()); }
|
CallActivityPropertyWriter extends MultipleInstanceActivityPropertyWriter { public void setAdHocAutostart(boolean autoStart) { CustomElement.autoStart.of(flowElement).set(autoStart); } CallActivityPropertyWriter(CallActivity activity, VariableScope variableScope, Set<DataObject> dataObjects); void setOnEntryAction(OnEntryAction onEntryAction); void setOnExitAction(OnExitAction onExitAction); void setIndependent(Boolean independent); void setAbortParent(Boolean abortParent); void setWaitForCompletion(Boolean waitForCompletion); void setAsync(Boolean async); void setCalledElement(String value); void setCase(Boolean isCase); void setAdHocAutostart(boolean autoStart); void setSlaDueDate(SLADueDate slaDueDate); }
|
@Test public void testSetAdHocAutostart_true() throws Exception { tested.setAdHocAutostart(Boolean.TRUE); assertTrue(CustomElement.autoStart.of(tested.getFlowElement()).get()); }
@Test public void testSetAdHocAutostart_false() throws Exception { tested.setAdHocAutostart(Boolean.FALSE); assertFalse(CustomElement.autoStart.of(tested.getFlowElement()).get()); }
|
CallActivityPropertyWriter extends MultipleInstanceActivityPropertyWriter { public void setAbortParent(Boolean abortParent) { CustomElement.abortParent.of(activity).set(abortParent); } CallActivityPropertyWriter(CallActivity activity, VariableScope variableScope, Set<DataObject> dataObjects); void setOnEntryAction(OnEntryAction onEntryAction); void setOnExitAction(OnExitAction onExitAction); void setIndependent(Boolean independent); void setAbortParent(Boolean abortParent); void setWaitForCompletion(Boolean waitForCompletion); void setAsync(Boolean async); void setCalledElement(String value); void setCase(Boolean isCase); void setAdHocAutostart(boolean autoStart); void setSlaDueDate(SLADueDate slaDueDate); }
|
@Test public void testAbortParentTrue() { tested.setAbortParent(true); }
@Test public void testAbortParentFalse() { tested.setAbortParent(false); }
|
CallActivityPropertyWriter extends MultipleInstanceActivityPropertyWriter { public void setAsync(Boolean async) { CustomElement.async.of(activity).set(async); } CallActivityPropertyWriter(CallActivity activity, VariableScope variableScope, Set<DataObject> dataObjects); void setOnEntryAction(OnEntryAction onEntryAction); void setOnExitAction(OnExitAction onExitAction); void setIndependent(Boolean independent); void setAbortParent(Boolean abortParent); void setWaitForCompletion(Boolean waitForCompletion); void setAsync(Boolean async); void setCalledElement(String value); void setCase(Boolean isCase); void setAdHocAutostart(boolean autoStart); void setSlaDueDate(SLADueDate slaDueDate); }
|
@Test public void testSetIsAsync() { tested.setAsync(Boolean.TRUE); assertTrue(CustomElement.async.of(tested.getFlowElement()).get()); }
|
DecisionComponentsView implements DecisionComponents.View { @PostConstruct public void init() { getDrgElementFilter().selectpicker("refresh"); getDrgElementFilter().on("hidden.bs.select", onDrgElementFilterChange()); setupTermFilterPlaceholder(); } @Inject DecisionComponentsView(final HTMLSelectElement drgElementFilter,
final HTMLInputElement termFilter,
final HTMLDivElement list,
final HTMLDivElement emptyState,
final HTMLDivElement loading,
final HTMLDivElement componentsCounter,
final TranslationService translationService); @PostConstruct void init(); @Override void init(final DecisionComponents presenter); @EventHandler("term-filter") void onTermFilterChange(final KeyUpEvent e); @Override void clear(); @Override void addListItem(final HTMLElement htmlElement); @Override void showEmptyState(); @Override void showLoading(); @Override void hideLoading(); @Override void disableFilterInputs(); @Override void enableFilterInputs(); @Override void setComponentsCounter(final Integer count); }
|
@Test public void testInit() { final JQuerySelectPicker selectPicker = mock(JQuerySelectPicker.class); final CallbackFunction callback = mock(CallbackFunction.class); final String placeholder = "placeholder"; doReturn(selectPicker).when(view).getDrgElementFilter(); when(view.onDrgElementFilterChange()).thenReturn(callback); when(translationService.format(DecisionComponentsView_EnterText)).thenReturn(placeholder); termFilter.placeholder = "something"; view.init(); verify(selectPicker).selectpicker("refresh"); verify(selectPicker).on("hidden.bs.select", callback); assertEquals(placeholder, termFilter.placeholder); }
|
DMNIncludedNodesFilter { public List<DMNIncludedNode> getNodesFromImports(final Path path, final List<DMNIncludedModel> includedModels) { try { final Diagram<Graph, Metadata> diagram = diagramHelper.getDiagramByPath(path); final Optional<DMNIncludedModel> diagramImport = getDiagramImport(diagram, includedModels); return diagramImport .map(dmn -> diagramHelper .getNodes(diagram) .stream() .map(node -> factory.makeDMNIncludeModel(path, dmn, node)) .collect(Collectors.toList())) .orElse(new ArrayList<>()); } catch (final Exception e) { } return new ArrayList<>(); } @Inject DMNIncludedNodesFilter(final DMNDiagramHelper diagramHelper,
final DMNIncludedNodeFactory factory); List<DMNIncludedNode> getNodesFromImports(final Path path,
final List<DMNIncludedModel> includedModels); }
|
@Test public void testGetNodesFromImports() { final Path path = mock(Path.class); final DMNIncludedModel includedModel1 = mock(DMNIncludedModel.class); final DMNIncludedModel includedModel2 = mock(DMNIncludedModel.class); final DMNIncludedModel includedModel3 = mock(DMNIncludedModel.class); final List<DMNIncludedModel> imports = asList(includedModel1, includedModel2, includedModel3); final DMNIncludedNode dmnNode1 = mock(DMNIncludedNode.class); final DMNIncludedNode dmnNode2 = mock(DMNIncludedNode.class); final Decision node1 = new Decision(); final InputData node2 = new InputData(); final List<DRGElement> diagramNodes = asList(node1, node2); when(includedModel1.getNamespace()).thenReturn(": when(includedModel2.getNamespace()).thenReturn(": when(includedModel3.getNamespace()).thenReturn(": when(diagramHelper.getDiagramByPath(path)).thenReturn(diagram); when(diagramHelper.getNodes(diagram)).thenReturn(diagramNodes); when(diagramHelper.getNamespace(diagram)).thenReturn(": when(factory.makeDMNIncludeModel(path, includedModel1, node1)).thenReturn(dmnNode1); when(factory.makeDMNIncludeModel(path, includedModel1, node2)).thenReturn(dmnNode2); final List<DMNIncludedNode> actualNodes = filter.getNodesFromImports(path, imports); final List<DMNIncludedNode> expectedNodes = asList(dmnNode1, dmnNode2); assertEquals(expectedNodes, actualNodes); }
@Test public void testGetNodesFromImportsWhenPathDoesNotRepresentsAnImportedDiagram() { final Path path = mock(Path.class); final DMNIncludedModel includedModel1 = mock(DMNIncludedModel.class); final DMNIncludedModel includedModel2 = mock(DMNIncludedModel.class); final DMNIncludedModel includedModel3 = mock(DMNIncludedModel.class); final List<DMNIncludedModel> imports = asList(includedModel1, includedModel2, includedModel3); when(includedModel1.getNamespace()).thenReturn(": when(includedModel2.getNamespace()).thenReturn(": when(includedModel3.getNamespace()).thenReturn(": when(diagramHelper.getDiagramByPath(path)).thenReturn(diagram); when(diagramHelper.getNamespace(diagram)).thenReturn(": final List<DMNIncludedNode> actualNodes = filter.getNodesFromImports(path, imports); final List<DMNIncludedNode> expectedNodes = emptyList(); assertEquals(expectedNodes, actualNodes); }
|
DMNContentServiceImpl extends KieService<String> implements DMNContentService { @Override public DMNContentResource getProjectContent(final Path path, final String defSetId) { final String content = getSource(path); final String title = path.getFileName(); final ProjectMetadata metadata = buildMetadataInstance(path, defSetId, title); return new DMNContentResource(content, metadata); } @Inject DMNContentServiceImpl(final CommentedOptionFactory commentedOptionFactory,
final DMNIOHelper dmnIOHelper,
final DMNPathsHelper pathsHelper,
final PMMLIncludedDocumentFactory pmmlIncludedDocumentFactory); @Override String getContent(final Path path); @Override DMNContentResource getProjectContent(final Path path,
final String defSetId); @Override void saveContent(final Path path,
final String content,
final Metadata metadata,
final String comment); @Override List<Path> getModelsPaths(final WorkspaceProject workspaceProject); @Override List<Path> getDMNModelsPaths(final WorkspaceProject workspaceProject); @Override List<Path> getPMMLModelsPaths(final WorkspaceProject workspaceProject); @Override PMMLDocumentMetadata loadPMMLDocumentMetadata(final Path path); @Override String getSource(final Path path); }
|
@Test public void testGetProjectContent() { final String defSetId = "defSetId"; final String expectedContent = "<xml/>"; final String moduleName = "moduleName"; final Package aPackage = mock(Package.class); final KieModule kieModule = mock(KieModule.class); final Overview overview = mock(Overview.class); doReturn(expectedContent).when(service).getSource(path); when(moduleService.resolvePackage(path)).thenReturn(aPackage); when(moduleService.resolveModule(path)).thenReturn(kieModule); when(overviewLoader.loadOverview(path)).thenReturn(overview); when(kieModule.getModuleName()).thenReturn(moduleName); final DMNContentResource contentResource = service.getProjectContent(path, defSetId); final String actualContent = contentResource.getContent(); final ProjectMetadataImpl metadata = (ProjectMetadataImpl) contentResource.getMetadata(); assertEquals(expectedContent, actualContent); assertEquals(defSetId, metadata.getDefinitionSetId()); assertEquals(moduleName, metadata.getModuleName()); assertEquals(aPackage, metadata.getProjectPackage()); assertEquals(overview, metadata.getOverview()); assertEquals(fileName, metadata.getTitle()); assertEquals(path, metadata.getPath()); }
|
CallActivityPropertyWriter extends MultipleInstanceActivityPropertyWriter { public void setSlaDueDate(SLADueDate slaDueDate) { CustomElement.slaDueDate.of(flowElement).set(slaDueDate.getValue()); } CallActivityPropertyWriter(CallActivity activity, VariableScope variableScope, Set<DataObject> dataObjects); void setOnEntryAction(OnEntryAction onEntryAction); void setOnExitAction(OnExitAction onExitAction); void setIndependent(Boolean independent); void setAbortParent(Boolean abortParent); void setWaitForCompletion(Boolean waitForCompletion); void setAsync(Boolean async); void setCalledElement(String value); void setCase(Boolean isCase); void setAdHocAutostart(boolean autoStart); void setSlaDueDate(SLADueDate slaDueDate); }
|
@Test public void testSetSlaDueDate() { String slaDueDate = "12/25/1983"; tested.setSlaDueDate(new SLADueDate(slaDueDate)); assertTrue(CustomElement.slaDueDate.of(tested.getFlowElement()).get().contains(slaDueDate)); }
|
PropertyWriterUtils { public static BPMNEdge createBPMNEdge(BasePropertyWriter source, BasePropertyWriter target, Connection sourceConnection, ControlPoint[] mid, Connection targetConnection) { BPMNEdge bpmnEdge = di.createBPMNEdge(); bpmnEdge.setId(Ids.bpmnEdge(source.getShape().getId(), target.getShape().getId())); Point2D sourcePt = getSourceLocation(source, sourceConnection); Point2D targetPt = getTargetLocation(target, targetConnection); org.eclipse.dd.dc.Point sourcePoint = pointOf( source.getShape().getBounds().getX() + sourcePt.getX(), source.getShape().getBounds().getY() + sourcePt.getY()); org.eclipse.dd.dc.Point targetPoint = pointOf( target.getShape().getBounds().getX() + targetPt.getX(), target.getShape().getBounds().getY() + targetPt.getY()); List<Point> waypoints = bpmnEdge.getWaypoint(); waypoints.add(sourcePoint); if (null != mid) { for (ControlPoint controlPoint : mid) { waypoints.add(pointOf(controlPoint.getLocation().getX(), controlPoint.getLocation().getY())); } } waypoints.add(targetPoint); return bpmnEdge; } static BPMNEdge createBPMNEdge(BasePropertyWriter source,
BasePropertyWriter target,
Connection sourceConnection,
ControlPoint[] mid,
Connection targetConnection); @SuppressWarnings("unchecked") static Optional<Node<View, Edge>> getDockSourceNode(final Node<? extends View, ?> node); static Import toImport(WSDLImport wsdlImport); }
|
@Test public void testCreateBPMNEdge() { BPMNShape sourceShape = mockShape(SOURCE_SHAPE_ID, 1, 1, 4, 4); BPMNShape targetShape = mockShape(TARGET_SHAPE_ID, 10, 10, 4, 4); when(sourceWriter.getShape()).thenReturn(sourceShape); when(targetWriter.getShape()).thenReturn(targetShape); Connection sourceConnection = mockConnection(1, 1); Connection targetConnection = mockConnection(10, 10); ControlPoint[] controlPoints = new ControlPoint[]{ new ControlPoint(Point2D.create(3, 3)), new ControlPoint(Point2D.create(4, 4)), new ControlPoint(Point2D.create(5, 5)) }; BPMNEdge edge = PropertyWriterUtils.createBPMNEdge(sourceWriter, targetWriter, sourceConnection, controlPoints, targetConnection); assertEquals("edge_SOURCE_SHAPE_ID_to_TARGET_SHAPE_ID", edge.getId()); assertWaypoint(2, 2, 0, edge.getWaypoint()); assertWaypoint(3, 3, 1, edge.getWaypoint()); assertWaypoint(4, 4, 2, edge.getWaypoint()); assertWaypoint(5, 5, 3, edge.getWaypoint()); assertWaypoint(20, 20, 4, edge.getWaypoint()); }
|
PropertyWriterUtils { @SuppressWarnings("unchecked") public static Optional<Node<View, Edge>> getDockSourceNode(final Node<? extends View, ?> node) { return node.getInEdges().stream() .filter(PropertyWriterUtils::isDockEdge) .map(Edge::getSourceNode) .map(n -> (Node<View, Edge>) n) .findFirst(); } static BPMNEdge createBPMNEdge(BasePropertyWriter source,
BasePropertyWriter target,
Connection sourceConnection,
ControlPoint[] mid,
Connection targetConnection); @SuppressWarnings("unchecked") static Optional<Node<View, Edge>> getDockSourceNode(final Node<? extends View, ?> node); static Import toImport(WSDLImport wsdlImport); }
|
@Test public void testGetDockSourceNodeWhenDocked() { Node<? extends View, Edge> dockSourceNode = mock(Node.class); Node<? extends View, Edge> node = mockDockedNode(dockSourceNode); Optional<Node<View, Edge>> result = PropertyWriterUtils.getDockSourceNode(node); assertTrue(result.isPresent()); assertEquals(dockSourceNode, result.get()); }
@Test public void testGetDockSourceNodeWhenNotDocked() { Node<? extends View, Edge> node = mock(Node.class); List<Edge> edges = new ArrayList<>(); when(node.getInEdges()).thenReturn(edges); Optional<Node<View, Edge>> result = PropertyWriterUtils.getDockSourceNode(node); assertFalse(result.isPresent()); }
|
PropertyWriterUtils { public static Import toImport(WSDLImport wsdlImport) { Import imp = Bpmn2Factory.eINSTANCE.createImport(); imp.setImportType("http: imp.setLocation(wsdlImport.getLocation()); imp.setNamespace(wsdlImport.getNamespace()); return imp; } static BPMNEdge createBPMNEdge(BasePropertyWriter source,
BasePropertyWriter target,
Connection sourceConnection,
ControlPoint[] mid,
Connection targetConnection); @SuppressWarnings("unchecked") static Optional<Node<View, Edge>> getDockSourceNode(final Node<? extends View, ?> node); static Import toImport(WSDLImport wsdlImport); }
|
@Test public void toImport() { final String LOCATION = "location"; final String NAMESPACE = "namespace"; WSDLImport wsdlImport = new WSDLImport(LOCATION, NAMESPACE); Import imp = PropertyWriterUtils.toImport(wsdlImport); assertEquals(LOCATION, imp.getLocation()); assertEquals(NAMESPACE, imp.getNamespace()); }
|
MultipleInstanceActivityPropertyWriter extends ActivityPropertyWriter { public void setCollectionInput(String collectionInput) { if (isEmpty(collectionInput)) { return; } setUpLoopCharacteristics(); String suffix = "IN_COLLECTION"; String id = Ids.dataInput(activity.getId(), suffix); DataInput dataInputElement = createDataInput(id, suffix); ioSpec.getDataInputs().add(dataInputElement); Optional<Property> property = findPropertyById(collectionInput); Optional<DataObject> dataObject = findDataObjectById(collectionInput); if (property.isPresent()) { processDataInput(dataInputElement, property.get()); } else if (dataObject.isPresent()) { processDataInput(dataInputElement, dataObject.get()); } } MultipleInstanceActivityPropertyWriter(Activity activity,
VariableScope variableScope,
Set<DataObject> dataObjects); void setCollectionInput(String collectionInput); void setCollectionOutput(String collectionOutput); void setInput(String name); void setOutput(String name); void setOutput(String name, boolean addDataOutputAssociation); void setCompletionCondition(String expression); void setIsSequential(boolean sequential); }
|
@Test public void testSetCollectionInput() { writer.setCollectionInput(PROPERTY_ID); assertInputsInitialized(); String inputId = ACTIVITY_ID + "_" + IN_COLLECTION + "InputX"; assertHasDataInput(activity.getIoSpecification(), inputId, ITEM_ID, IN_COLLECTION); assertHasDataInputAssociation(activity, PROPERTY_ID, inputId); assertEquals(inputId, ((MultiInstanceLoopCharacteristics) activity.getLoopCharacteristics()).getLoopDataInputRef().getId()); when(variableScope.lookup(PROPERTY_ID)).thenReturn(Optional.empty()); Set<DataObject> dataObjects = new HashSet<>(); DataObject dataObject = mockDataObject(PROPERTY_ID); dataObjects.add(dataObject); writer = new MultipleInstanceActivityPropertyWriter(activity, variableScope, dataObjects); writer.setCollectionInput(PROPERTY_ID); assertInputsInitialized(); inputId = ACTIVITY_ID + "_" + IN_COLLECTION + "InputX"; assertHasDataInput(activity.getIoSpecification(), inputId, ITEM_ID, IN_COLLECTION); assertHasDataInputAssociation(activity, PROPERTY_ID, inputId); when(variableScope.lookup(PROPERTY_ID)).thenReturn(Optional.empty()); dataObjects.clear(); dataObject = mockDataObject("SomeOtherId"); dataObjects.add(dataObject); writer = new MultipleInstanceActivityPropertyWriter(activity, variableScope, dataObjects); writer.setCollectionInput(PROPERTY_ID); assertInputsInitialized(); inputId = ACTIVITY_ID + "_" + IN_COLLECTION + "InputX"; assertHasDataInput(activity.getIoSpecification(), inputId, ITEM_ID, IN_COLLECTION); assertHasDataInputAssociation(activity, PROPERTY_ID, inputId); }
|
MultipleInstanceActivityPropertyWriter extends ActivityPropertyWriter { protected ItemDefinition createItemDefinition(String name, String type) { ItemDefinition item = bpmn2.createItemDefinition(); item.setId(Ids.multiInstanceItemType(activity.getId(), name)); String varType = type.isEmpty() ? Object.class.getName() : type; item.setStructureRef(varType); return item; } MultipleInstanceActivityPropertyWriter(Activity activity,
VariableScope variableScope,
Set<DataObject> dataObjects); void setCollectionInput(String collectionInput); void setCollectionOutput(String collectionOutput); void setInput(String name); void setOutput(String name); void setOutput(String name, boolean addDataOutputAssociation); void setCompletionCondition(String expression); void setIsSequential(boolean sequential); }
|
@Test public void testCreateItemDefinitionNoType() { ItemDefinition definition = writer.createItemDefinition("variableOne", ""); assertEquals("Must Be Object Type", Object.class.getName(), definition.getStructureRef()); definition = writer.createItemDefinition("variableTwo", "java.lang.String"); assertEquals("Must Be String Type", String.class.getName(), definition.getStructureRef()); }
|
MultipleInstanceActivityPropertyWriter extends ActivityPropertyWriter { public void setInput(String name) { setInput(name, true); } MultipleInstanceActivityPropertyWriter(Activity activity,
VariableScope variableScope,
Set<DataObject> dataObjects); void setCollectionInput(String collectionInput); void setCollectionOutput(String collectionOutput); void setInput(String name); void setOutput(String name); void setOutput(String name, boolean addDataOutputAssociation); void setCompletionCondition(String expression); void setIsSequential(boolean sequential); }
|
@Test public void testSetInputNotFailed() { writer.setInput(null, false); writer.setInput("", false); assertNull(activity.getIoSpecification()); assertTrue(activity.getDataInputAssociations().isEmpty()); assertNull(activity.getLoopCharacteristics()); }
@Test public void testSetEmptyVariable() { final String emptyName = ""; writer.setInput(":", false); assertInputsInitialized(); String inputId = ACTIVITY_ID + "_" + "InputX"; String itemSubjectRef = ACTIVITY_ID + "_multiInstanceItemType_"; assertHasDataInput(activity.getIoSpecification(), inputId, itemSubjectRef, emptyName); assertDontHasDataInputAssociation(activity, INPUT_VARIABLE_ID, inputId); }
|
MultipleInstanceActivityPropertyWriter extends ActivityPropertyWriter { public void setCollectionOutput(String collectionOutput) { if (isEmpty(collectionOutput)) { return; } setUpLoopCharacteristics(); String suffix = "OUT_COLLECTION"; String id = Ids.dataOutput(activity.getId(), suffix); DataOutput dataOutputElement = createDataOutput(id, suffix); addSafe(ioSpec.getDataOutputs(), dataOutputElement); Optional<Property> property = findPropertyById(collectionOutput); Optional<DataObject> dataObject = findDataObjectById(collectionOutput); if (property.isPresent()) { processDataOutput(dataOutputElement, property.get()); } else if (dataObject.isPresent()) { processDataOutput(dataOutputElement, dataObject.get()); } } MultipleInstanceActivityPropertyWriter(Activity activity,
VariableScope variableScope,
Set<DataObject> dataObjects); void setCollectionInput(String collectionInput); void setCollectionOutput(String collectionOutput); void setInput(String name); void setOutput(String name); void setOutput(String name, boolean addDataOutputAssociation); void setCompletionCondition(String expression); void setIsSequential(boolean sequential); }
|
@Test public void testSetCollectionOutput() { writer.setCollectionOutput(PROPERTY_ID); assertOutputsInitialized(); String outputId = ACTIVITY_ID + "_" + OUT_COLLECTION + "OutputX"; assertHasDataOutput(activity.getIoSpecification(), outputId, ITEM_ID, OUT_COLLECTION); assertHasDataOutputAssociation(activity, outputId, PROPERTY_ID); assertEquals(outputId, ((MultiInstanceLoopCharacteristics) activity.getLoopCharacteristics()).getLoopDataOutputRef().getId()); when(variableScope.lookup(PROPERTY_ID)).thenReturn(Optional.empty()); Set<DataObject> dataObjects = new HashSet<>(); DataObject dataObject = mockDataObject(PROPERTY_ID); dataObjects.add(dataObject); writer = new MultipleInstanceActivityPropertyWriter(activity, variableScope, dataObjects); writer.setCollectionOutput(PROPERTY_ID); assertOutputsInitialized(); outputId = ACTIVITY_ID + "_" + OUT_COLLECTION + "OutputX"; assertHasDataOutputAssociation(activity, outputId, PROPERTY_ID); when(variableScope.lookup(PROPERTY_ID)).thenReturn(Optional.empty()); dataObject = mockDataObject(PROPERTY_ID); dataObjects.add(dataObject); writer = new MultipleInstanceActivityPropertyWriter(activity, variableScope, dataObjects); writer.setCollectionOutput(PROPERTY_ID); assertOutputsInitialized(); outputId = ACTIVITY_ID + "_" + OUT_COLLECTION + "OutputX"; assertHasDataOutputAssociation(activity, outputId, PROPERTY_ID); when(variableScope.lookup(PROPERTY_ID)).thenReturn(Optional.empty()); dataObjects.clear(); dataObject = mockDataObject("SomeOtherId"); dataObjects.add(dataObject); writer = new MultipleInstanceActivityPropertyWriter(activity, variableScope, dataObjects); writer.setCollectionOutput(PROPERTY_ID); assertOutputsInitialized(); outputId = ACTIVITY_ID + "_" + OUT_COLLECTION + "OutputX"; assertHasDataOutputAssociation(activity, outputId, PROPERTY_ID); }
|
DecisionComponentsView implements DecisionComponents.View { @EventHandler("term-filter") public void onTermFilterChange(final KeyUpEvent e) { presenter.applyTermFilter(termFilter.value); } @Inject DecisionComponentsView(final HTMLSelectElement drgElementFilter,
final HTMLInputElement termFilter,
final HTMLDivElement list,
final HTMLDivElement emptyState,
final HTMLDivElement loading,
final HTMLDivElement componentsCounter,
final TranslationService translationService); @PostConstruct void init(); @Override void init(final DecisionComponents presenter); @EventHandler("term-filter") void onTermFilterChange(final KeyUpEvent e); @Override void clear(); @Override void addListItem(final HTMLElement htmlElement); @Override void showEmptyState(); @Override void showLoading(); @Override void hideLoading(); @Override void disableFilterInputs(); @Override void enableFilterInputs(); @Override void setComponentsCounter(final Integer count); }
|
@Test public void testOnTermFilterChange() { final KeyUpEvent event = mock(KeyUpEvent.class); final String term = "term"; termFilter.value = term; view.onTermFilterChange(event); verify(presenter).applyTermFilter(term); }
|
MultipleInstanceActivityPropertyWriter extends ActivityPropertyWriter { protected static void addSafe(List<DataInput> inputs, DataInput dataInput) { inputs.removeIf(existingDataInput -> dataInput.getId().equals(existingDataInput.getId())); inputs.add(dataInput); } MultipleInstanceActivityPropertyWriter(Activity activity,
VariableScope variableScope,
Set<DataObject> dataObjects); void setCollectionInput(String collectionInput); void setCollectionOutput(String collectionOutput); void setInput(String name); void setOutput(String name); void setOutput(String name, boolean addDataOutputAssociation); void setCompletionCondition(String expression); void setIsSequential(boolean sequential); }
|
@Test public void testAddSafeCollectionOutput() { List<DataOutputAssociation> associations = new ArrayList<>(); DataOutputAssociation outputAssociation = mock(DataOutputAssociation.class); associations.add(outputAssociation); DataOutputAssociation outputAssociation2 = mock(DataOutputAssociation.class); when(outputAssociation.getSourceRef()).thenReturn(null); writer.addSafe(associations, outputAssociation2); associations.clear(); associations.add(outputAssociation); when(outputAssociation.getSourceRef()).thenReturn(new ArrayList<>()); writer.addSafe(associations, outputAssociation2); associations.clear(); associations.add(outputAssociation); List<ItemAwareElement> list = new ArrayList<>(); ItemAwareElementImpl element = mock(ItemAwareElementImpl.class); when(element.getId()).thenReturn("elementId"); list.add(element); when(outputAssociation.getSourceRef()).thenReturn(list); when(outputAssociation2.getSourceRef()).thenReturn(list); writer.addSafe(associations, outputAssociation2); associations.clear(); associations.add(outputAssociation); list = new ArrayList<>(); element = mock(ItemAwareElementImpl.class); when(element.getId()).thenReturn("elementId"); list.add(element); List<ItemAwareElement> list2 = new ArrayList<>(); ItemAwareElementImpl element2 = mock(ItemAwareElementImpl.class); when(element2.getId()).thenReturn("elementId"); list2.add(element2); when(element.getId()).thenReturn("elementId2"); list.add(element); when(outputAssociation.getSourceRef()).thenReturn(list); when(outputAssociation2.getSourceRef()).thenReturn(list2); writer.addSafe(associations, outputAssociation2); assertTrue(associations.contains(outputAssociation2)); }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.