| Summary: | [Refactoring] Cannot refactor package names | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Technology] Tigerstripe | Reporter: | Navid Mehregani <nmehrega> | ||||||||||||||||||||
| Component: | UI | Assignee: | Navid Mehregani <nmehrega> | ||||||||||||||||||||
| Status: | VERIFIED FIXED | QA Contact: | |||||||||||||||||||||
| Severity: | major | ||||||||||||||||||||||
| Priority: | P2 | CC: | chrhartl, erdillon, mshulgina, skanton, valentin, yuri | ||||||||||||||||||||
| Version: | unspecified | ||||||||||||||||||||||
| Target Milestone: | 0.5M0 | ||||||||||||||||||||||
| Hardware: | PC | ||||||||||||||||||||||
| OS: | Mac OS X - Carbon (unsup.) | ||||||||||||||||||||||
| Whiteboard: | |||||||||||||||||||||||
| Attachments: |
|
||||||||||||||||||||||
|
Description
Navid Mehregani
Need to test on a package containing both model artifacts and diagrams. It looks like the annotation framework is causing the problem here? The problem was not in the Annotation Framework, but the mechanism of Tigerstripe refactoring which made an incorrect project state. We found two refactoring problems: 1. Invalid order of refactoring operations. Must first be processed elements of the lower level in the project tree (classes, subpackages) and then the top-level (packages). We've added sorting operations by level in tree to fix it before the refactoring operation to be launched. 2. Parent references wasn't updated correctly during refactoring and next refactoring operations works wrong. To fix these two issues we've fixed BaseRefactorCommand and ModelRefactorCommandFactory classes in the org.eclipse.tigerstripe.workbench.base plugin. The logged error message is fixed, but refactoring package names is still not working as expected. The point of this defect was to get this functionality working. Fixing just the error messages won't do any good for users unless the feature is actually functional. After checking out the latest changes, I no longer get any error messages logged in Error Log view. Refactoring the package name sometimes works for the first time. However, refactoring the same package for the second time, gets rid of everything under that package and only displays the first segment of the package in TS explorer. For example, renaming 'com.mycompany' to 'com.mycompany.blah' will only display 'com' in TS Explorer!! Hi Navid, Sorry for misunderstanding. As I firstly understood you already mentioned all refactoring problems and that’s why we did not test other scenarios and fix only two mentioned issues. Now I can test refactoring completely, report all problems I’ll found and fix it. Also If you know any other problems please report it to this issue. Created attachment 179744 [details]
Unable to rename the package
Unable to rename the package after restart the eclipse(see screenshot) (In reply to comment #7) > Unable to rename the package after restart the eclipse(see screenshot) Can you try this in Tigerstripe explorer instead? (In reply to comment #8) > (In reply to comment #7) > > Unable to rename the package after restart the eclipse(see screenshot) > > Can you try this in Tigerstripe explorer instead? Yes, I can. This is actually Tigerstripe issue, but I attached ambiguous screenshot. Created attachment 179938 [details] Fixed Comment 4 Another problem: When you rename a package, resources(facets, profile...) are lost. Steps to reproduce: 1. Create facet in package com.mycompany 2. Create artifact and class diagram in package com.mycompany 3. Rename package com.mycompany to com.mycompany2 Package successfully renamed with contained artifacts and diagrams, but the facet we have lost. (In reply to comment #11) > Another problem: > When you rename a package, resources(facets, profile...) are lost. > Steps to reproduce: > 1. Create facet in package com.mycompany > 2. Create artifact and class diagram in package com.mycompany > 3. Rename package com.mycompany to com.mycompany2 > > Package successfully renamed with contained artifacts and diagrams, but the > facet we have lost. Thanks Valentin. Let's keep this bug open until all corresponding problems with package renaming are resolved. If you don't think you have enough time to address comment#11 in this iteration, we can mark its corresponding JIRA as fixed and recreate another JIRA in I25 to address the rest of the problems. Created attachment 179975 [details]
Fixes for the problems described in the comments 11 and 4
I fixed the problem described in the comment 11. I extended the mechanism of refactoring and added there a new concept "resources refactoring"(to the existing "model refactoring" and "diagram refactoring") Verified that all mentioned issues fixed and applied patch. The following use case breaks with this fix:
Consider a project with the following three packages:
MyProject
com.mycompany
Entity1
com.mycompany.foo
Entity2
com.mycompany.fee
Entity3
Now rename 'com.mycompany' package to 'com.mycompany.blah'. This causes a change in the other packages as well. It results in the following:
MyProject
com.mycompany.blah *CORRECT*
Entity1
com.mycompany.blah.foo *INCORRECT*
Entity2
com.mycompany.blah.fee *INCORRECT*
Entity3
Hi Navid, Both behaviors are correct. In JDN is responsible for this option check-button "Rename Subpackages". I suggest we do likewise. In other words, I propose to make a button that would switch between different behaviors described by you. Reopening per discussion with Xored. Cannot rename package in following case: 1. Create package 'com.mycompany' 2. Rename package to 'com.mycompany.z1.z2.z3' 3. Rename package back to 'com.mycompany' Error message "type already exists" is displayed and package cannot be renamed back. Created attachment 181708 [details] Patch for Comment 20 Problem described in comment 20 fixed. 1. Create a package with class diagram, entity and session facade. 2. Create implements link with entity and session facade 3. Rename package com.mycompany to com.mycompany.test with Refactor Model -> Rename 4. View Entity artifact editor. "Implements" link is not renamed from "com.mycompany" to "com.mycompany.test". Error message "Implemented artifact is not a valid ISessionArtifact" is displayed (In reply to comment #22) > 1. Create a package with class diagram, entity and session facade. > 2. Create implements link with entity and session facade > 3. Rename package com.mycompany to com.mycompany.test with Refactor Model -> > Rename > 4. View Entity artifact editor. "Implements" link is not renamed from > "com.mycompany" to "com.mycompany.test". Error message "Implemented artifact is > not a valid ISessionArtifact" is displayed The problem isn't reproducible in current trunk. > (In reply to comment #22)
> > 1. Create a package with class diagram, entity and session facade.
> > 2. Create implements link with entity and session facade
> > 3. Rename package com.mycompany to com.mycompany.test with Refactor Model ->
> > Rename
> > 4. View Entity artifact editor. "Implements" link is not renamed from
> > "com.mycompany" to "com.mycompany.test". Error message "Implemented artifact is
> > not a valid ISessionArtifact" is displayed
> The problem isn't reproducible in current trunk.
I wasn't able to reproduce this either. The implements field is updated as expected. Maria, can you please try reproducing this again?
(In reply to comment #24) > > (In reply to comment #22) > > > 1. Create a package with class diagram, entity and session facade. > > > 2. Create implements link with entity and session facade > > > 3. Rename package com.mycompany to com.mycompany.test with Refactor Model -> > > > Rename > > > 4. View Entity artifact editor. "Implements" link is not renamed from > > > "com.mycompany" to "com.mycompany.test". Error message "Implemented artifact is > > > not a valid ISessionArtifact" is displayed > > The problem isn't reproducible in current trunk. > I wasn't able to reproduce this either. The implements field is updated as > expected. Maria, can you please try reproducing this again? I've tried to reproduce this case again on the latest version from the HEAD. Now it works correctly. (In reply to comment #25) > I've tried to reproduce this case again on the latest version from the HEAD. > Now it works correctly. Thanks Maria. Anton/Yuri, if all the problems reported in this bug have been resolved, please mark it as Fixed and I'll proceed with verifying it. Created attachment 182295 [details] Patch for comment 16 Applied patch from Anton which fix issue in the comment #16. So mark this issue as resolved. Try the following: - Create two TS projects called One and Two - Open tigerstripe.xml file of project One > Switch to dependencies tab > under 'referenced tigerstripe projects' click on Add > add project Two. - Under project One create an entity artifact called Ent1 under package com.mycompany - Under project Two create an entity artifact called Ent2 under package com.mycompany - Rename package com.mycompany under project Two to 'foo'. Result: 'com.mycompany' under project ONE changes to foo and Ent1 under project One disappears!! Expected Result: Package under project Two should change without effecting project One. Created attachment 183113 [details] Patch for comment 29 Patch applied. Another issue:
Create a project with package with contained Entity artifacts with Dependency on Diagram.
MyProject
com.mycompany
Dependency1
Entity1
Entity2
DefaultDiagram
Open diagram. Dependency1 is displayed.
Rename "com.mycompany" to "com.mycompany.test" with checked "rename subpackage". Dependency1 is displayed in Tigerstripe Explorer but is not displayed on the diagram
Reopened per comment#32 Created attachment 183462 [details] 321409_32 Patch to comment 32 added. I applied Anton's patch. Great job Anton! Most of the issues have been resolved. I only found one issue. I think we can put this bug to rest when this is resolved. - Create two project: One and Two - Open tigerstripe.xml file of project One and add project Two under dependencies tab (in the 'Referenced Tigerstripe Projects' list). - Create an entity under package com.mycompany of project One called Entity1 - Create an entity under package com.mycompany of project Two called Entity2 - Create a class diagram under com.mycompany of project One - Drag and drop Entity1 and Entity2 from TS Explorer to class diagram - Create an association between Entity1 and Entity2 - Rename package 'com.mycompany' from project Two to 'foo' - Notice that the association artifact under project One now has an error, since the appropriate reference is not updated after a package rename: 'com.mycompandy.Entity2 cannot be resolve to a type'. Created attachment 184039 [details] 321409_36 Patch to comment #36 added. I've applied the last patch. Navid, could you please verify it and resolve this issue if everything is OK? Created attachment 184044 [details] Snapshot Something is wrong here. When I follow the instructions under comment#36 and create an association between Entity1 and Entity2, I get an error in the Association indicating that 'com.mycompany.Entity2' cannot be resolved. This shouldn't happen, since project One has declared a dependency on project Two. This wasn't happening in the past. Related issue 331413 was fixed. So I guess this issue can be resolved as well. Looks good. Thanks guys! |