Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 349011 - Web Context Path in PDE and WTP models is inconsistent
Summary: Web Context Path in PDE and WTP models is inconsistent
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Libra (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Stefan Dimov CLA
QA Contact: Kaloyan Raev CLA
URL: https://jtrack/browse/NGPBUG-946
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-10 07:40 EDT by Kaloyan Raev CLA
Modified: 2022-02-24 11:24 EST (History)
1 user (show)

See Also:
kaloyan: iplog+


Attachments
patch (29.32 KB, patch)
2011-06-29 09:32 EDT, Stefan Dimov CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kaloyan Raev CLA 2011-06-10 07:40:52 EDT
Steps to reproduce:
1. Create a Web Application Bundle project with name "test". 
2. Change the Web-ContextPath header in the MANIFEST.MF from "test" to "test-changed". 
3. Go to <web-project> -> Properties -> Web Project Settings. The Context Root field still shows "test". 

This problem introduces inconsistency between the PDE and WTP models of the Web Application Bundle project, which causes problems in the behavior of the WTP Server Adapters. 

A possible solution is to synchronize the two model. If the PDE model changes, then the WTP model should update, and vice versa.
Comment 1 Stefan Dimov CLA 2011-06-29 09:32:29 EDT
Created attachment 198828 [details]
patch

This patch provides two-way synchronization of the Web-context root between WTP and PDE model. It's applicable for Indigo and for Juno
Comment 2 Kaloyan Raev CLA 2011-06-29 11:02:55 EDT
Stefan, thank you for this patch. Unfortunately, I cannot apply it - known issue with Git patches. 

Please, follow the instructions on this wiki page how to contribute the patch correctly: 
http://wiki.eclipse.org/Development_Resources/Handling_Git_Contributions
Comment 4 Kaloyan Raev CLA 2011-07-01 04:44:25 EDT
Stefan, thanks for the patch. 

Here is my experience with testing it:
1. If I change the context root in the Web Project Settings property page then a refactoring wizard pops up. After finishing it, the context root in the MANIFEST.MF is correctly change. 
2. If I change the context root in MANIFEST.MF, then is also change in the WTP model. No refactoring wizard pops up. 
3. If I change the context root in .settings/org.eclipse.wst.common.component (this is where the context root in the WTP model is persisted), then it is not changed in MANIFEST.MF. 

IMHO, we don't need the refactoring wizard. So, let's remove it from case 1. We also need case 3 working properly. 

I would be also happy to see some tests that cover the three use cases. 

Also I have some minor comments in the code:
  - there are lots of whitespace changes in the patch and makes it hard to read for seeing what is the actual change. Please, keep to the original code formatting and don't add unnecessary whitespaces. 
  - the Activator class became too overloaded with code. Please, consider moving the new logic in a separate Java class and call it from the Activator.
Comment 5 Stefan Dimov CLA 2011-07-01 11:03:45 EDT
The new commit:

https://github.com/stefan-dimov/libra/commit/f82c5da247414e8c797ec77abd39048a9eecd680

> 1. If I change the context root in the Web Project Settings property page then
> a refactoring wizard pops up. After finishing it, the context root in the
> MANIFEST.MF is correctly change. 

 - The refactoring wizard appearing is not introduced by this fix.

>2. If I change the context root in MANIFEST.MF, then is also change in the WTP
>model. No refactoring wizard pops up. 

 - Still no change by this fix

> 3. If I change the context root in .settings/org.eclipse.wst.common.component
> (this is where the context root in the WTP model is persisted), then it is not
> changed in MANIFEST.MF. 

 - The new fix handles it

> - there are lots of whitespace changes in the patch and makes it hard to read
> for seeing what is the actual change. Please, keep to the original code
> formatting and don't add unnecessary whitespaces. 

 - I don't know how did it happen. I had to fix it in the new commit row by row manually

> - the Activator class became too overloaded with code. Please, consider
>moving the new logic in a separate Java class and call it from the Activator.

 - Handled in the new fix

> I would be also happy to see some tests that cover the three use cases. 

 - Still no tests. Will be implemented next week
Comment 7 Stefan Dimov CLA 2011-07-19 04:35:11 EDT
New version of the patch:

https://github.com/stefan-dimov/libra/commit/86ae910f09248c5c5f0b11ba1c126fc65610661a
Comment 9 Stefan Dimov CLA 2011-07-22 09:59:29 EDT
New test for check how change of manifest file affects the models:

https://github.com/stefan-dimov/libra/commit/e8b3f8a89f77aba15d5b29a200da50cd7d822ba1
Comment 10 Kaloyan Raev CLA 2011-07-25 10:53:44 EDT
Change is pushed to the 'indigo' branch and merged to the 'master' branch: 
http://git.eclipse.org/c/libra/org.eclipse.libra.git/commit/?h=indigo&id=c887193cd644338142dc3c067070dbadb290bb7a

I did lots of refactoring of the code and the tests. 

The fix can be tested from the snapshot p2 repo:
http://download.eclipse.org/libra/maintenance/snapshot
Comment 11 Kaloyan Raev CLA 2011-07-29 02:09:43 EDT
Verified with http://download.eclipse.org/libra/maintenance/M-0.1.1-201107280918