use of org.eclipse.sirius.components.collaborative.diagrams.DiagramContext in project sirius-components by eclipse-sirius.
the class DeleteFromDiagramEventHandlerTests method testEdgeSemanticDeletionFromDiagram.
@Test
public void testEdgeSemanticDeletionFromDiagram() {
var handler = new DeleteFromDiagramEventHandler(this.objectService, this.diagramQueryService, this.diagramDescriptionService, this.representationDescriptionSearchService, new ICollaborativeDiagramMessageService.NoOp(), new SimpleMeterRegistry());
var nodeIds = List.<String>of();
var edgeIds = List.<String>of(EDGE_ID);
// $NON-NLS-1$ //$NON-NLS-2$
var input = new DeleteFromDiagramInput(UUID.randomUUID(), "editingContextId", "representationId", nodeIds, edgeIds, DeletionPolicy.SEMANTIC);
One<IPayload> payloadSink = Sinks.one();
Many<ChangeDescription> changeDescriptionSink = Sinks.many().unicast().onBackpressureBuffer();
assertThat(handler.canHandle(input)).isTrue();
IDiagramContext diagramContext = new DiagramContext(new TestDiagramBuilder().getDiagram(UUID.randomUUID().toString()));
handler.handle(payloadSink, changeDescriptionSink, new IEditingContext.NoOp(), diagramContext, input);
ChangeDescription changeDescription = changeDescriptionSink.asFlux().blockFirst();
assertThat(changeDescription.getKind()).isEqualTo(ChangeKind.SEMANTIC_CHANGE);
IPayload payload = payloadSink.asMono().block();
assertThat(payload).isInstanceOf(DeleteFromDiagramSuccessPayload.class);
}
use of org.eclipse.sirius.components.collaborative.diagrams.DiagramContext in project sirius-components by eclipse-sirius.
the class DeleteFromDiagramEventHandlerTests method testNodeSemanticDeletionFromDiagram.
@Test
public void testNodeSemanticDeletionFromDiagram() {
var handler = new DeleteFromDiagramEventHandler(this.objectService, this.diagramQueryService, this.diagramDescriptionService, this.representationDescriptionSearchService, new ICollaborativeDiagramMessageService.NoOp(), new SimpleMeterRegistry());
var nodeIds = List.of(NODE_ID);
var edgeIds = List.<String>of();
// $NON-NLS-1$ //$NON-NLS-2$
var input = new DeleteFromDiagramInput(UUID.randomUUID(), "editingContextId", "representationId", nodeIds, edgeIds, DeletionPolicy.SEMANTIC);
One<IPayload> payloadSink = Sinks.one();
Many<ChangeDescription> changeDescriptionSink = Sinks.many().unicast().onBackpressureBuffer();
assertThat(handler.canHandle(input)).isTrue();
IDiagramContext diagramContext = new DiagramContext(new TestDiagramBuilder().getDiagram(UUID.randomUUID().toString()));
handler.handle(payloadSink, changeDescriptionSink, new IEditingContext.NoOp(), diagramContext, input);
ChangeDescription changeDescription = changeDescriptionSink.asFlux().blockFirst();
assertThat(changeDescription.getKind()).isEqualTo(ChangeKind.SEMANTIC_CHANGE);
IPayload payload = payloadSink.asMono().block();
assertThat(payload).isInstanceOf(DeleteFromDiagramSuccessPayload.class);
}
use of org.eclipse.sirius.components.collaborative.diagrams.DiagramContext in project sirius-components by eclipse-sirius.
the class ArrangeAllEventHandlerTests method testArrangeAll.
@Test
public void testArrangeAll() {
var handler = new ArrangeAllEventHandler(new ICollaborativeDiagramMessageService.NoOp(), new SimpleMeterRegistry());
// $NON-NLS-1$//$NON-NLS-2$
var input = new ArrangeAllInput(UUID.randomUUID(), "editingContextId", "representationId");
assertThat(handler.canHandle(input)).isTrue();
One<IPayload> payloadSink = Sinks.one();
Many<ChangeDescription> changeDescriptionSink = Sinks.many().unicast().onBackpressureBuffer();
IDiagramContext diagramContext = new DiagramContext(new TestDiagramBuilder().getDiagram(UUID.randomUUID().toString()));
handler.handle(payloadSink, changeDescriptionSink, new IEditingContext.NoOp(), diagramContext, input);
ChangeDescription changeDescription = changeDescriptionSink.asFlux().blockFirst();
assertThat(changeDescription.getKind()).isEqualTo(DiagramChangeKind.DIAGRAM_LAYOUT_CHANGE);
IPayload payload = payloadSink.asMono().block();
assertThat(payload).isInstanceOf(ArrangeAllSuccessPayload.class);
assertThat(diagramContext.getDiagramEvent()).isInstanceOf(ArrangeAllEvent.class);
}
Aggregations