Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,42 +46,6 @@ public DiagramCheckerService(DiagramComparator diagramComparator, IDescriptionNa
this.descriptionNameGenerator = descriptionNameGenerator;
}

/**
* Returns a checker that verifies a child node was created on the diagram.
*
* @param previousDiagram
* the reference to the previous diagram state
* @param diagramDescriptionIdProvider
* the provider for diagram description IDs
* @param parentLabel
* the label of the parent node
* @param childEClass
* the EClass of the expected child node
* @param compartmentCount
* the expected number of compartments
* @return the diagram checker
* @deprecated this function will be removed when all the tests will be migrated to follow the same format as Sirius Web.
* Please, use {@link #childNodeGraphicalChecker(AtomicReference, DiagramDescriptionIdProvider, String, EClass, int)} instead.
*/
@Deprecated
public IDiagramChecker getChildNodeGraphicalChecker(AtomicReference<Diagram> previousDiagram, DiagramDescriptionIdProvider diagramDescriptionIdProvider, String parentLabel, EClass childEClass,
int compartmentCount) {
return (initialDiagram, newDiagram) -> {
int createdNodesExpectedCount = 1 + compartmentCount;
new CheckDiagramElementCount(this.diagramComparator)
.hasNewNodeCount(createdNodesExpectedCount)
.hasNewEdgeCount(0)
.check(previousDiagram.get(), newDiagram);

String newNodeDescriptionName = this.descriptionNameGenerator.getNodeName(childEClass);
new CheckChildNode(diagramDescriptionIdProvider, this.diagramComparator)
.withParentLabel(parentLabel)
.hasNodeDescriptionName(newNodeDescriptionName)
.hasCompartmentCount(compartmentCount)
.check(previousDiagram.get(), newDiagram);
};
}

/**
* Returns a consumer that checks a child node was created on the diagram.
*
Expand Down Expand Up @@ -115,44 +79,6 @@ public Consumer<Object> childNodeGraphicalChecker(AtomicReference<Diagram> previ
});
}

/**
* Returns a checker that verifies a node was created in a compartment.
*
* @param previousDiagram
* the reference to the previous diagram state
* @param diagramDescriptionIdProvider
* the provider for diagram description IDs
* @param parentLabel
* the label of the parent node
* @param parentEClass
* the EClass of the parent node
* @param containmentReference
* the containment reference for the compartment item
* @param compartmentName
* the name of the compartment
* @return the diagram checker
* @deprecated this function will be removed when all the tests will be migrated to follow the same format as Sirius Web.
* Please, use {@link #compartmentNodeGraphicalChecker(AtomicReference, DiagramDescriptionIdProvider, String, EClass, EReference, String)} instead.
*/
@Deprecated
public IDiagramChecker getCompartmentNodeGraphicalChecker(AtomicReference<Diagram> previousDiagram, DiagramDescriptionIdProvider diagramDescriptionIdProvider, String parentLabel,
EClass parentEClass, EReference containmentReference, String compartmentName) {
return (initialDiagram, newDiagram) -> {
new CheckDiagramElementCount(this.diagramComparator)
.hasNewNodeCount(1)
.hasNewEdgeCount(0)
.check(previousDiagram.get(), newDiagram);

String newNodeDescriptionName = this.descriptionNameGenerator.getCompartmentItemName(parentEClass, containmentReference);
new CheckNodeInCompartment(diagramDescriptionIdProvider, this.diagramComparator)
.withParentLabel(parentLabel)
.withCompartmentName(compartmentName)
.hasNodeDescriptionName(newNodeDescriptionName)
.hasCompartmentCount(0)
.check(previousDiagram.get(), newDiagram);
};
}

/**
* Returns a consumer that checks a node was created in a compartment.
*
Expand All @@ -168,15 +94,17 @@ public IDiagramChecker getCompartmentNodeGraphicalChecker(AtomicReference<Diagra
* the containment reference for the compartment item
* @param compartmentName
* the name of the compartment
* @param onlyNewVisibleNodesAndEdges
* check only new nodes and edges that are visible on the diagram
* @return a consumer that performs the graphical check
*/
public Consumer<Object> compartmentNodeGraphicalChecker(AtomicReference<Diagram> previousDiagram, DiagramDescriptionIdProvider diagramDescriptionIdProvider, String parentLabel,
EClass parentEClass, EReference containmentReference, String compartmentName) {
EClass parentEClass, EReference containmentReference, String compartmentName, boolean onlyNewVisibleNodesAndEdges) {
return assertRefreshedDiagramThat(newDiagram -> {
new CheckDiagramElementCount(this.diagramComparator)
.hasNewNodeCount(1)
.hasNewEdgeCount(0)
.check(previousDiagram.get(), newDiagram);
.check(previousDiagram.get(), newDiagram, onlyNewVisibleNodesAndEdges);

String newNodeDescriptionName = this.descriptionNameGenerator.getCompartmentItemName(parentEClass, containmentReference);
new CheckNodeInCompartment(diagramDescriptionIdProvider, this.diagramComparator)
Expand All @@ -188,62 +116,6 @@ public Consumer<Object> compartmentNodeGraphicalChecker(AtomicReference<Diagram>
});
}

/**
* Returns a checker that verifies a sibling node was created on the diagram.
*
* @param previousDiagram
* the reference to the previous diagram state
* @param diagramDescriptionIdProvider
* the provider for diagram description IDs
* @param childEClass
* the EClass of the expected child node
* @param compartmentCount
* the expected number of compartments
* @return the diagram checker
* @deprecated this function will be removed when all the tests will be migrated to follow the same format as Sirius Web.
* Please, use {@link #siblingNodeGraphicalChecker(AtomicReference previousDiagram, DiagramDescriptionIdProvider diagramDescriptionIdProvider, EClass childEClass, int compartmentCount)} instead.
*/
@Deprecated
public IDiagramChecker getSiblingNodeGraphicalChecker(AtomicReference<Diagram> previousDiagram, DiagramDescriptionIdProvider diagramDescriptionIdProvider, EClass childEClass,
int compartmentCount) {
return this.getSiblingNodeGraphicalChecker(previousDiagram, diagramDescriptionIdProvider, childEClass, compartmentCount, 1);
}

/**
* Returns a checker that verifies a sibling node was created on the diagram.
*
* @param previousDiagram
* the reference to the previous diagram state
* @param diagramDescriptionIdProvider
* the provider for diagram description IDs
* @param childEClass
* the EClass of the expected child node
* @param compartmentCount
* the expected number of compartments
* @param newNodesCount
* the expected number of new nodes
* @return the diagram checker
* @deprecated this function will be removed when all the tests will be migrated to follow the same format as Sirius Web.
* Please, use {@link #siblingNodeGraphicalChecker(AtomicReference previousDiagram, DiagramDescriptionIdProvider diagramDescriptionIdProvider, EClass childEClass, int compartmentCount, int newNodesCount)} instead.
*/
@Deprecated
public IDiagramChecker getSiblingNodeGraphicalChecker(AtomicReference<Diagram> previousDiagram, DiagramDescriptionIdProvider diagramDescriptionIdProvider, EClass childEClass,
int compartmentCount, int newNodesCount) {
return (initialDiagram, newDiagram) -> {
int createdNodesExpectedCount = newNodesCount + compartmentCount;
new CheckDiagramElementCount(this.diagramComparator)
.hasNewNodeCount(createdNodesExpectedCount)
.hasNewEdgeCount(1)
.check(previousDiagram.get(), newDiagram);

String newNodeDescriptionName = this.descriptionNameGenerator.getNodeName(childEClass);
new CheckNodeOnDiagram(diagramDescriptionIdProvider, this.diagramComparator)
.hasNodeDescriptionName(newNodeDescriptionName)
.hasCompartmentCount(compartmentCount)
.check(previousDiagram.get(), newDiagram);
};
}

/**
* Returns a consumer that checks a sibling node was created on the diagram.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ public void createCaseDefinitionChildNodes(EClass childEClass, String compartmen
EClass parentEClass = SysmlPackage.eINSTANCE.getCaseDefinition();
String parentLabel = "CaseDefinition";
Runnable createNodeRunnable = this.creationTestsService.createNode(diagramDescriptionIdProvider, diagram, parentEClass, parentLabel, childEClass);
Consumer<Object> diagramCheck = this.diagramCheckerService.compartmentNodeGraphicalChecker(diagram, diagramDescriptionIdProvider, parentLabel, parentEClass, containmentReference, compartmentName);
Consumer<Object> diagramCheck = this.diagramCheckerService.compartmentNodeGraphicalChecker(diagram, diagramDescriptionIdProvider, parentLabel, parentEClass, containmentReference, compartmentName, false);
Runnable semanticCheck = this.semanticCheckerService.checkEditingContext(this.semanticCheckerService.getElementInParentSemanticChecker(parentLabel, containmentReference, childEClass));

StepVerifier.create(flux)
Expand Down Expand Up @@ -471,7 +471,7 @@ public void createUseCaseDefinitionChildNodes(EClass childEClass, String compart
EClass parentEClass = SysmlPackage.eINSTANCE.getUseCaseDefinition();
String parentLabel = "UseCaseDefinition";
Runnable createNodeRunnable = this.creationTestsService.createNode(diagramDescriptionIdProvider, diagram, parentEClass, parentLabel, childEClass);
Consumer<Object> diagramCheck = this.diagramCheckerService.compartmentNodeGraphicalChecker(diagram, diagramDescriptionIdProvider, parentLabel, parentEClass, containmentReference, compartmentName);
Consumer<Object> diagramCheck = this.diagramCheckerService.compartmentNodeGraphicalChecker(diagram, diagramDescriptionIdProvider, parentLabel, parentEClass, containmentReference, compartmentName, false);
Runnable semanticCheck = this.semanticCheckerService.checkEditingContext(this.semanticCheckerService.getElementInParentSemanticChecker(parentLabel, containmentReference, childEClass));

StepVerifier.create(flux)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public void createAllocationUsageChildNodes(EClass childEClass, String compartme
String parentLabel = "allocation";
Runnable createNodeRunnable = this.creationTestsService.createNode(diagramDescriptionIdProvider, diagram, parentEClass, parentLabel, childEClass);
Consumer<Object> diagramCheck = this.diagramCheckerService.compartmentNodeGraphicalChecker(diagram, diagramDescriptionIdProvider, parentLabel, parentEClass, containmentReference,
compartmentName);
compartmentName, false);
Runnable semanticCheck = this.semanticCheckerService.checkEditingContext(this.semanticCheckerService.getElementInParentSemanticChecker(parentLabel, containmentReference, childEClass));

StepVerifier.create(flux)
Expand Down Expand Up @@ -379,7 +379,7 @@ public void createAllocationDefinitionChildNodes(EClass childEClass, String comp
String parentLabel = "AllocationDefinition";
Runnable createNodeRunnable = this.creationTestsService.createNode(diagramDescriptionIdProvider, diagram, parentEClass, parentLabel, childEClass);
Consumer<Object> diagramCheck = this.diagramCheckerService.compartmentNodeGraphicalChecker(diagram, diagramDescriptionIdProvider, parentLabel, parentEClass, containmentReference,
compartmentName);
compartmentName, false);
Runnable semanticCheck = this.semanticCheckerService.checkEditingContext(this.semanticCheckerService.getElementInParentSemanticChecker(parentLabel, containmentReference, childEClass));

StepVerifier.create(flux)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ public void createConstraintDefinitionChildNodes(EClass childEClass, String comp
String parentLabel = "ConstraintDefinition";
Runnable createNodeRunnable = this.creationTestsService.createNode(diagramDescriptionIdProvider, diagram, parentEClass, parentLabel, childEClass);
Consumer<Object> diagramCheck = this.diagramCheckerService.compartmentNodeGraphicalChecker(diagram, diagramDescriptionIdProvider, parentLabel, parentEClass, containmentReference,
compartmentName);
compartmentName, false);
Runnable semanticCheck = this.semanticCheckerService.checkEditingContext(this.semanticCheckerService.getElementInParentSemanticChecker(parentLabel, containmentReference, childEClass));

StepVerifier.create(flux)
Expand Down
Loading
Loading