Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested Executions initial implementation #394

Merged
merged 11 commits into from
Nov 8, 2018

Conversation

rschnekenbu
Copy link
Collaborator

[WIP] Currently updating with new features implemented these last weeks (message reorient for example is not taken perfectly into account + anchoring for automatically created messages like reply message)

- new method to get elementAt on execution specification, and access to
nested executions
- command to create a nested execution, that may be refactored with
some commons of the insertExecutionCommand on lifelines
- Add some tests
- handle destruction of nested executions (and their related messages /
nested lifelines in chain)

Some points left:
- adding a nested execution always nudge parent exec, where it should
not if there is enough space
- no side is currently handled for the nested execution representation
- getNestedExecution() may rely on recently introduced getCovered() for
#52


Change-Id: I50589eb0e4ae7b850579d6e1cad5966937dffa4c
Signed-off-by: Remi Schnekenburger <rschnekenburger@eclipsesource.com>
- Check and update model generation for test and model plugin from
seqd.ecore
- do not update edit plugin (formatting issues with current version on
the server)

Change-Id: I532032620ae40c29412ef113f183709a4cc25b5c
Signed-off-by: Remi Schnekenburger <rschnekenburger@eclipsesource.com>
- update the nudging policy to be similar to the current implementation
of standard executions
- 2 issues in the tests: 1 is ignored (but not by my dev env) as the
test is not implemented yet, and one that can be reproduced by hand: if
a lifeline has an execution with a nested execution, it can not be
deleted.

Change-Id: I4b52b6d0a7248dcfe01365c40d559602d30406c5
Signed-off-by: Remi Schnekenburger <rschnekenburger@eclipsesource.com>
- update lifeline API with a method to get first level executions to be
able to remove only these executions. Nested ones will be remove in
chain by the remove execution command
- update tests

Change-Id: Iae629bd73730a75880ecdb4ff263aaefd7428ac7
Signed-off-by: Remi Schnekenburger <rschnekenburger@eclipsesource.com>
- Develop additional tests for complex scenarios (dependencies with
messages between different lifelines)
- 2 tests are failing, but this seems independant from the nested exec
spec, as it fails even if they are removed from initial model.

Change-Id: I56794a50383e3e4d793ffa62d49089188f2c8f2a
Signed-off-by: Remi Schnekenburger <rschnekenburger@eclipsesource.com>
Conflicts:
	plugins/org.eclipse.papyrus.uml.interaction.model/model/seqd.ecore
	plugins/org.eclipse.papyrus.uml.interaction.model/model/seqd.genmodel
	plugins/org.eclipse.papyrus.uml.interaction.model/src-gen/org/eclipse/papyrus/uml/interaction/internal/model/SequenceDiagramPackage.java
	plugins/org.eclipse.papyrus.uml.interaction.model/src-gen/org/eclipse/papyrus/uml/interaction/internal/model/impl/MExecutionImpl.java
	plugins/org.eclipse.papyrus.uml.interaction.model/src-gen/org/eclipse/papyrus/uml/interaction/internal/model/impl/MLifelineImpl.java
	plugins/org.eclipse.papyrus.uml.interaction.model/src-gen/org/eclipse/papyrus/uml/interaction/internal/model/impl/SequenceDiagramPackageImpl.java
	plugins/org.eclipse.papyrus.uml.interaction.model/src-gen/org/eclipse/papyrus/uml/interaction/model/MExecution.java
	plugins/org.eclipse.papyrus.uml.interaction.model/src-gen/org/eclipse/papyrus/uml/interaction/model/MLifeline.java
	tests/org.eclipse.papyrus.uml.interaction.model.tests/src-gen/org/eclipse/papyrus/uml/interaction/model/tests/MExecutionTest.java
	tests/org.eclipse.papyrus.uml.interaction.model.tests/src-gen/org/eclipse/papyrus/uml/interaction/model/tests/MLifelineTest.java
- generate code from ecore model after merge
- Add functional test for creation

Change-Id: I08bd36736552dbe715c426107c7108a50cd20b20
Signed-off-by: Remi Schnekenburger <rschnekenburger@eclipsesource.com>
@cdamus cdamus self-requested a review November 2, 2018 11:17
Copy link
Collaborator

@cdamus cdamus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, @rschnekenbu! I see only a few problems in the diagram behaviour:

  • most severe is that when reorienting the request message that starts the top execution of a stack to be received by another lifeline, all of the nested executions are moved with it (this "just works" as I had expected :-)) but the nesting is lost. All of the executions end up piled directly on top of one another
    screen shot 2018-11-02 at 08 48 06
  • if I create a synchronous message with execution and reply in which the request is drawn from right to left and then add a nested execution, that execution is on the right side. I think it should be on the left
    screen shot 2018-11-02 at 07 38 59
  • if I draw a message from right to left out of an execution that is nested on the right side, the message is anchored to the right side of the nested execution, not the left
    screen shot 2018-11-02 at 07 40 34
  • drawing a synchronous message to an execution specification doesn't create a nested execution. The editor prompts for the kind of execution to create, but then it doesn't create an
    execution nor does it create the reply message (obviously, because there's no execution). I expected to get a nested execution with reply
    screen shot 2018-11-02 at 07 44 16
  • I think it's already known, but I'll mention it here for completeness' sake, that when moving the lifeline that owns the executions so that messages incoming and outgoing those executions change orientation, they remain attached to the same side of the executions (except for the request/reply messages, which were fixed by improvements to the start/end anchors).

One new test fails on Mac (see the in-line comments) and there's a test that was deleted that should be restored (again, see the in-line comments).

Also, there are a lot of formatting changes in the EMF.Edit item providers. Is that expected? It looks like the code was formatted (with JDT's "clean up") after re-generating.

*/
@SuppressWarnings("restriction")
@ModelResource("one-exec.di")
public class ExecutionSpecificationCreationEditPolicyUITest extends AbstractGraphicalEditPolicyUITest {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Unfortunately, this test fails on my Mac:

Expected: location point that x that 276 ± 1 and y that 170 ± 1
     but: location y was <165>
	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:8)
	at org.eclipse.papyrus.uml.diagram.sequence.runtime.internal.edit.policies.tests.ExecutionSpecificationCreationEditPolicyUITest.createNestedExecution(ExecutionSpecificationCreationEditPolicyUITest.java:64)

On the plus side, all of the other tests still pass (with no new skips). 😉

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, interesting! Again an issue with different platforms. I updated the test so it does get the initial Y value and compare the value after execution with the initial one.
Funny fact is that this model is also used in other classes, like ExecutionSnappingUITest. In all other classes, it is not used directly, only with offset to set the message connection point, or not used at all ;)
I would still be very happy to understand this difference. The position of the execution is set on the lifeline body, at least in notation. The height of the header is set also, so as its y position. The interaction iself may have a different layout with its label on top, given the font? This is the only element that does not have a size pushed in notation.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now, on my system, the tests are green. So, that's good. However, there's now an assumption failure that skips the ExecutionMoveUITest::moveSyncMessageEnd test. It seems that the sync message is no longer located in the diagram where the test expects it to be.

- avoid issue on nested executions when reparenting the parent execution
on another lifeline using start message + add functional test
- fix typo on Occur'r'ence variables
- use Optionals#as in ExecutionSpecificationCreationEditPolicy
- improve code readability in MLifelineImpl
- update test in ExecutionSpecificationCreationEditPolicyUITest to avoid
issues on Mac.
- Fix header in InsertNestedExecutionCommand
- restore deleted test after merge

Change-Id: Ic08bb70eee73fb235fcb46876628e939deafdf14
Signed-off-by: Remi Schnekenburger <rschnekenburger@eclipsesource.com>
- Remove attempt to fix computation of coordinates in the
LifelineBodyFigure (currently, same code as overridden method)

Change-Id: I903b3c23925f5f74298119861beaa4ba6e729a2e
Signed-off-by: Remi Schnekenburger <rschnekenburger@eclipsesource.com>
@rschnekenbu
Copy link
Collaborator Author

I solved all the conversation items, I left the one about test failure on mac platform, because I am interested in understanding the diff here. For the other ones, commit 348a8d6 and e65b707 solves all of them.

For the diagram behaviour:

  • reorienting the message starting the nested execution moves now nicely the views. A reparentView was done while setting the owner of the executions, and so all moved elements views were added to the lifeline body figure. In the case of the nested execution, this is useless, as its parent is the nesting execution one. A check is now performed so it does not reparent views if not needed. A functional test was also added to check that layout is good on retargeting.
  • For the nesting of executions, according to some live discussions with Antonio, it seems better to always cascade in the same direction, in case of big executions spanning across several computer screens. In this case, it would be easier to detect which one is the nesting one, and which are the nested ones if they are always cascading on the same side. So I propose to always keep the nesting on the right currently. We may update later if the users think this is not practical.
  • for the side of the anchors, this is a bigger issue on executions in general. This will be handled in issue Messages attached to executions should swap sides when lifeline order is changed #376. I added a comment in that issue to ensure it is tested in the nested execution cases. I already started to implement some tests for that issue locally (currently failing of course!). This should be my next task.
  • Good catch for the issue of creating an execution on connecting a sync message! I will check what is not going there, probably some edit policy missing on the execution similar to the one on lifeline body.
  • For the test failures, I had fixed the inline comments. That should be fine now.

Finally, for the code formatting: looking at the history, it seems we have some trouble to keep consistency in formatting. I suspect we use different versions of EMF to generate code and / or do not apply the same actions after code generation. I did a format source code after generation / organize import and then a clean up using project profile (what I usually do when generating Papyrus diagram code). Even if I revert the edit plugin code and generate the code again, I get a lot of differences compared to the master branch. I am using EMF 2.14 for code generation.

Except for the automatic creation of the action execution when attaching a sync message to an execution, I addressed all the topics from your review.

Thank you again for that very valuable review!

@cdamus
Copy link
Collaborator

cdamus commented Nov 7, 2018

  • reorienting the message starting the nested execution moves now nicely the views. A reparentView was done while setting the owner of the executions, and so all moved elements views were added to the lifeline body figure. In the case of the nested execution, this is useless, as its parent is the nesting execution one. A check is now performed so it does not reparent views if not needed. A functional test was also added to check that layout is good on retargeting.

Ah, that makes sense. Good.

  • For the nesting of executions, according to some live discussions with Antonio, it seems better to always cascade in the same direction, in case of big executions spanning across several computer screens. In this case, it would be easier to detect which one is the nesting one, and which are the nested ones if they are always cascading on the same side. So I propose to always keep the nesting on the right currently. We may update later if the users think this is not practical.

Okay, I can understand that motivation. Certainly, the worst would be to have nesting switch orientations within a stack, so this is a good compromise.

Cool. TDD FTW 😉

  • Good catch for the issue of creating an execution on connecting a sync message! I will check what is not going there, probably some edit policy missing on the execution similar to the one on lifeline body.

Yes, that sounds likely. Another good motivation for moving more of this logic out of the edit-policies and into the logical model where it can be shared by the edit-policies.

Finally, for the code formatting: looking at the history, it seems we have some trouble to keep consistency in formatting. I suspect we use different versions of EMF to generate code and / or do not apply the same actions after code generation. I did a format source code after generation / organize import and then a clean up using project profile (what I usually do when generating Papyrus diagram code). Even if I revert the edit plugin code and generate the code again, I get a lot of differences compared to the master branch. I am using EMF 2.14 for code generation.

Yeah, I'm using Eclipse for Committers 2018-09, so that's EMF 2.15. Those templates can have some changes, hopefully only improvements, because the genmodel is still targeting EMF 2.14 run-time. However, our project configurations for JDT formatting and clean-up should take care of purely formatting issues (though the generated code may actually be semantically different).

Probably we should standardize on the development environment, perhaps via an Oomph setup model for this project.

Copy link
Collaborator

@cdamus cdamus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes, @rschnekenbu! I would just ask for one more change to update a test that skips on Mac but can readily be fixed to work on all platforms.

@@ -806,4 +806,20 @@ public void testMakeCreatedAt__OptionalInt() {
assertThat("Center line not moved", getFixture().getTop(), isPresent(expectedTop.getAsInt()));
}

public void testMakeCreatedAt__OptionalInt__empty() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

- Fix test failure on MAC (no assume on y position at the beginning, but
compute the initial position and then check element position compared to
this initial position)

Change-Id: I84df77c862bffa4faa7826b9d341af0ba3b55c81
Signed-off-by: Remi Schnekenburger <rschnekenburger@eclipsesource.com>
@rschnekenbu
Copy link
Collaborator Author

The test failure should be fixed now, thanks to commit 4ac2cc3

Copy link
Collaborator

@cdamus cdamus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup! Bingo. 👍

@rschnekenbu
Copy link
Collaborator Author

Solving conflicts by merging the master branch. This commit should be hopefully the last one on this PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants