Search in sources :

Example 1 with SubscriptionManager

use of org.eclipse.sirius.components.collaborative.representations.SubscriptionManager in project sirius-components by eclipse-sirius.

the class DiagramEventProcessorTests method testUpdateInitialDiagramForNewSubscription.

@Test
public void testUpdateInitialDiagramForNewSubscription() {
    DiagramEventInput input = new DiagramEventInput(UUID.randomUUID(), UUID.randomUUID().toString(), UUID.randomUUID().toString());
    DiagramEventProcessor diagramEventProcessor = new DiagramEventProcessor(new IEditingContext.NoOp(), this.diagramContext, List.of(), new SubscriptionManager(), new IRepresentationDescriptionSearchService.NoOp(), new IRepresentationRefreshPolicyRegistry.NoOp(), this.diagramCreationService);
    Runnable performRefresh = () -> diagramEventProcessor.refresh(new ChangeDescription(ChangeKind.SEMANTIC_CHANGE, input.getDiagramId(), input));
    // @formatter:off
    StepVerifier.create(diagramEventProcessor.getOutputEvents(input)).expectNextMatches(this.getRefreshDiagramEventPayloadPredicate(1)).then(performRefresh).expectNextMatches(this.getRefreshDiagramEventPayloadPredicate(2)).thenCancel().verify();
    // @formatter:on
    // @formatter:off
    StepVerifier.create(diagramEventProcessor.getOutputEvents(input)).expectNextMatches(this.getRefreshDiagramEventPayloadPredicate(2)).thenCancel().verify();
// @formatter:on
}
Also used : DiagramEventInput(org.eclipse.sirius.components.collaborative.diagrams.dto.DiagramEventInput) IEditingContext(org.eclipse.sirius.components.core.api.IEditingContext) IRepresentationRefreshPolicyRegistry(org.eclipse.sirius.components.collaborative.api.IRepresentationRefreshPolicyRegistry) ChangeDescription(org.eclipse.sirius.components.collaborative.api.ChangeDescription) SubscriptionManager(org.eclipse.sirius.components.collaborative.representations.SubscriptionManager) IRepresentationDescriptionSearchService(org.eclipse.sirius.components.core.api.IRepresentationDescriptionSearchService) Test(org.junit.jupiter.api.Test)

Example 2 with SubscriptionManager

use of org.eclipse.sirius.components.collaborative.representations.SubscriptionManager in project sirius-components by eclipse-sirius.

the class DiagramEventProcessorTests method testCompleteOnDispose.

@Test
public void testCompleteOnDispose() {
    DiagramEventInput input = new DiagramEventInput(UUID.randomUUID(), UUID.randomUUID().toString(), UUID.randomUUID().toString());
    DiagramEventProcessor diagramEventProcessor = new DiagramEventProcessor(new IEditingContext.NoOp(), this.diagramContext, List.of(), new SubscriptionManager(), new IRepresentationDescriptionSearchService.NoOp(), new IRepresentationRefreshPolicyRegistry.NoOp(), this.diagramCreationService);
    Runnable disposeDiagramEventProcessor = () -> diagramEventProcessor.dispose();
    // @formatter:off
    StepVerifier.create(diagramEventProcessor.getOutputEvents(input)).expectNextMatches(this.getRefreshDiagramEventPayloadPredicate(1)).then(disposeDiagramEventProcessor).expectComplete().verify();
// @formatter:on
}
Also used : DiagramEventInput(org.eclipse.sirius.components.collaborative.diagrams.dto.DiagramEventInput) IEditingContext(org.eclipse.sirius.components.core.api.IEditingContext) IRepresentationRefreshPolicyRegistry(org.eclipse.sirius.components.collaborative.api.IRepresentationRefreshPolicyRegistry) SubscriptionManager(org.eclipse.sirius.components.collaborative.representations.SubscriptionManager) IRepresentationDescriptionSearchService(org.eclipse.sirius.components.core.api.IRepresentationDescriptionSearchService) Test(org.junit.jupiter.api.Test)

Example 3 with SubscriptionManager

use of org.eclipse.sirius.components.collaborative.representations.SubscriptionManager in project sirius-components by eclipse-sirius.

the class DiagramEventProcessorTests method testEmitDiagramOnRefresh.

@Test
public void testEmitDiagramOnRefresh() {
    DiagramEventInput input = new DiagramEventInput(UUID.randomUUID(), UUID.randomUUID().toString(), UUID.randomUUID().toString());
    DiagramEventProcessor diagramEventProcessor = new DiagramEventProcessor(new IEditingContext.NoOp(), this.diagramContext, List.of(), new SubscriptionManager(), new IRepresentationDescriptionSearchService.NoOp(), new IRepresentationRefreshPolicyRegistry.NoOp(), this.diagramCreationService);
    Runnable performRefresh = () -> diagramEventProcessor.refresh(new ChangeDescription(ChangeKind.SEMANTIC_CHANGE, input.getDiagramId(), input));
    // @formatter:off
    StepVerifier.create(diagramEventProcessor.getOutputEvents(input)).expectNextMatches(this.getRefreshDiagramEventPayloadPredicate(1)).then(performRefresh).expectNextMatches(this.getRefreshDiagramEventPayloadPredicate(2)).thenCancel().verify();
// @formatter:on
}
Also used : DiagramEventInput(org.eclipse.sirius.components.collaborative.diagrams.dto.DiagramEventInput) IEditingContext(org.eclipse.sirius.components.core.api.IEditingContext) IRepresentationRefreshPolicyRegistry(org.eclipse.sirius.components.collaborative.api.IRepresentationRefreshPolicyRegistry) ChangeDescription(org.eclipse.sirius.components.collaborative.api.ChangeDescription) SubscriptionManager(org.eclipse.sirius.components.collaborative.representations.SubscriptionManager) IRepresentationDescriptionSearchService(org.eclipse.sirius.components.core.api.IRepresentationDescriptionSearchService) Test(org.junit.jupiter.api.Test)

Example 4 with SubscriptionManager

use of org.eclipse.sirius.components.collaborative.representations.SubscriptionManager in project sirius-components by eclipse-sirius.

the class FormEventProcessorTests method testCompleteOnDispose.

@Test
public void testCompleteOnDispose() {
    FormEventInput input = new FormEventInput(UUID.randomUUID(), UUID.randomUUID().toString(), UUID.randomUUID().toString());
    // @formatter:off
    FormCreationParameters formCreationParameters = FormCreationParameters.newFormCreationParameters(FORM_ID).formDescription(this.getFormDescription()).editingContext(new IEditingContext.NoOp()).objects(List.of(new Object())).build();
    // @formatter:on
    FormEventProcessor formEventProcessor = new FormEventProcessor(formCreationParameters, List.of(), new SubscriptionManager(), new WidgetSubscriptionManager(), new RepresentationRefreshPolicyRegistry());
    Runnable disposeFormEventProcessor = () -> formEventProcessor.dispose();
    // @formatter:off
    StepVerifier.create(formEventProcessor.getOutputEvents(input)).expectNextMatches(this.getRefreshFormEventPayloadPredicate()).then(disposeFormEventProcessor).expectComplete().verify();
// @formatter:on
}
Also used : FormEventInput(org.eclipse.sirius.components.collaborative.forms.dto.FormEventInput) IEditingContext(org.eclipse.sirius.components.core.api.IEditingContext) RepresentationRefreshPolicyRegistry(org.eclipse.sirius.components.collaborative.representations.RepresentationRefreshPolicyRegistry) FormCreationParameters(org.eclipse.sirius.components.collaborative.forms.api.FormCreationParameters) SubscriptionManager(org.eclipse.sirius.components.collaborative.representations.SubscriptionManager) Test(org.junit.jupiter.api.Test)

Example 5 with SubscriptionManager

use of org.eclipse.sirius.components.collaborative.representations.SubscriptionManager in project sirius-components by eclipse-sirius.

the class DiagramEventProcessorTests method testEmitDiagramOnSubscription.

@Test
public void testEmitDiagramOnSubscription() {
    IInput input = new DiagramEventInput(UUID.randomUUID(), UUID.randomUUID().toString(), UUID.randomUUID().toString());
    DiagramEventProcessor diagramEventProcessor = new DiagramEventProcessor(new IEditingContext.NoOp(), this.diagramContext, List.of(), new SubscriptionManager(), new IRepresentationDescriptionSearchService.NoOp(), new IRepresentationRefreshPolicyRegistry.NoOp(), this.diagramCreationService);
    // @formatter:off
    StepVerifier.create(diagramEventProcessor.getOutputEvents(input)).expectNextMatches(this.getRefreshDiagramEventPayloadPredicate(1)).thenCancel().verify();
// @formatter:on
}
Also used : DiagramEventInput(org.eclipse.sirius.components.collaborative.diagrams.dto.DiagramEventInput) IEditingContext(org.eclipse.sirius.components.core.api.IEditingContext) IRepresentationRefreshPolicyRegistry(org.eclipse.sirius.components.collaborative.api.IRepresentationRefreshPolicyRegistry) IInput(org.eclipse.sirius.components.core.api.IInput) SubscriptionManager(org.eclipse.sirius.components.collaborative.representations.SubscriptionManager) IRepresentationDescriptionSearchService(org.eclipse.sirius.components.core.api.IRepresentationDescriptionSearchService) Test(org.junit.jupiter.api.Test)

Aggregations

SubscriptionManager (org.eclipse.sirius.components.collaborative.representations.SubscriptionManager)7 IEditingContext (org.eclipse.sirius.components.core.api.IEditingContext)7 Test (org.junit.jupiter.api.Test)7 IRepresentationRefreshPolicyRegistry (org.eclipse.sirius.components.collaborative.api.IRepresentationRefreshPolicyRegistry)4 DiagramEventInput (org.eclipse.sirius.components.collaborative.diagrams.dto.DiagramEventInput)4 IRepresentationDescriptionSearchService (org.eclipse.sirius.components.core.api.IRepresentationDescriptionSearchService)4 ChangeDescription (org.eclipse.sirius.components.collaborative.api.ChangeDescription)3 FormCreationParameters (org.eclipse.sirius.components.collaborative.forms.api.FormCreationParameters)3 FormEventInput (org.eclipse.sirius.components.collaborative.forms.dto.FormEventInput)3 RepresentationRefreshPolicyRegistry (org.eclipse.sirius.components.collaborative.representations.RepresentationRefreshPolicyRegistry)3 IInput (org.eclipse.sirius.components.core.api.IInput)2