-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[3614] Add the ability to contribute additional payloads to represent…
…ation subscriptions Bug: #3614 Signed-off-by: Michaël Charfadi <[email protected]>
- Loading branch information
1 parent
2132ea8
commit 71a180b
Showing
15 changed files
with
968 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...ipse/sirius/components/collaborative/api/IRepresentationEventProcessorFluxCustomizer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Obeo. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.sirius.components.collaborative.api; | ||
|
||
import org.eclipse.sirius.components.core.api.IInput; | ||
import org.eclipse.sirius.components.core.api.IPayload; | ||
|
||
import reactor.core.publisher.Flux; | ||
|
||
/** | ||
* Can be used to customize outputEvents of IRepresentationEventProcessor. | ||
* | ||
* @author mcharfadi | ||
*/ | ||
public interface IRepresentationEventProcessorFluxCustomizer { | ||
|
||
boolean canHandle(String editingContextId, IRepresentationConfiguration configuration, IInput input, IRepresentationEventProcessor representationEventProcessor); | ||
|
||
Flux<IPayload> customize(String editingContextId, IRepresentationConfiguration configuration, IInput input, IRepresentationEventProcessor representationEventProcessor, Flux<IPayload> outputEvents); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
...-tests/src/main/java/org/eclipse/sirius/components/forms/tests/assertions/LinkAssert.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Obeo. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.sirius.components.forms.tests.assertions; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.assertj.core.api.AbstractAssert; | ||
import org.eclipse.sirius.components.forms.Link; | ||
|
||
/** | ||
* Custom assertion class used to perform some tests on a link widget. | ||
* | ||
* @author sbegaudeau | ||
*/ | ||
public class LinkAssert extends AbstractAssert<LinkAssert, Link> { | ||
|
||
public LinkAssert(Link link) { | ||
super(link, LinkAssert.class); | ||
} | ||
|
||
public LinkAssert hasLabel(String label) { | ||
assertThat(this.actual.getLabel()).isEqualTo(label); | ||
|
||
return this; | ||
} | ||
|
||
public LinkAssert hasUrl(String url) { | ||
assertThat(this.actual.getUrl()).isEqualTo(url); | ||
|
||
return this; | ||
} | ||
|
||
public LinkAssert hasHelp(String help) { | ||
assertThat(this.actual.getHelpTextProvider().get()).isEqualTo(help); | ||
|
||
return this; | ||
} | ||
|
||
public LinkAssert isReadOnly() { | ||
assertThat(this.actual.isReadOnly()) | ||
.withFailMessage("Expecting the link to be read only but was not read only instead") | ||
.isTrue(); | ||
|
||
return this; | ||
} | ||
|
||
public LinkAssert isNotReadOnly() { | ||
assertThat(this.actual.isReadOnly()) | ||
.withFailMessage("Expecting the link not to be read only but was read only instead") | ||
.isFalse(); | ||
|
||
return this; | ||
} | ||
|
||
public LinkAssert isBold() { | ||
assertThat(this.actual.getStyle().isBold()) | ||
.withFailMessage("Expecting the link to be bold but was not bold instead") | ||
.isTrue(); | ||
|
||
return this; | ||
} | ||
|
||
public LinkAssert isNotBold() { | ||
assertThat(this.actual.getStyle().isBold()) | ||
.withFailMessage("Expecting the link not to be bold but was bold instead") | ||
.isFalse(); | ||
|
||
return this; | ||
} | ||
|
||
public LinkAssert isItalic() { | ||
assertThat(this.actual.getStyle().isItalic()) | ||
.withFailMessage("Expecting the link to be italic but was not italic instead") | ||
.isTrue(); | ||
|
||
return this; | ||
} | ||
|
||
public LinkAssert isNotItalic() { | ||
assertThat(this.actual.getStyle().isItalic()) | ||
.withFailMessage("Expecting the link not to be italic but was italic instead") | ||
.isFalse(); | ||
|
||
return this; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...in/java/org/eclipse/sirius/components/forms/tests/graphql/EditCheckboxMutationRunner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Obeo. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.sirius.components.forms.tests.graphql; | ||
|
||
import java.util.Objects; | ||
|
||
import org.eclipse.sirius.components.collaborative.forms.dto.EditCheckboxInput; | ||
import org.eclipse.sirius.components.graphql.tests.api.IGraphQLRequestor; | ||
import org.eclipse.sirius.components.graphql.tests.api.IMutationRunner; | ||
import org.springframework.stereotype.Service; | ||
|
||
/** | ||
* Used to edit a checkbox with the GraphQL API. | ||
* | ||
* @author sbegaudeau | ||
*/ | ||
@Service | ||
public class EditCheckboxMutationRunner implements IMutationRunner<EditCheckboxInput> { | ||
|
||
private static final String EDIT_CHECKBOX_MUTATION = """ | ||
mutation editCheckbox($input: EditCheckboxInput!) { | ||
editCheckbox(input: $input) { | ||
__typename | ||
} | ||
} | ||
"""; | ||
|
||
private final IGraphQLRequestor graphQLRequestor; | ||
|
||
public EditCheckboxMutationRunner(IGraphQLRequestor graphQLRequestor) { | ||
this.graphQLRequestor = Objects.requireNonNull(graphQLRequestor); | ||
} | ||
|
||
@Override | ||
public String run(EditCheckboxInput input) { | ||
return this.graphQLRequestor.execute(EDIT_CHECKBOX_MUTATION, input); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.