Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 329599

Summary: NewManualServerComposite does not handle multiple instances of runtime with diff RT components correctly
Product: [WebTools] WTP ServerTools Reporter: Danny Ju <danny.ju>
Component: wst.serverAssignee: Angel Vera <arvera>
Status: RESOLVED FIXED QA Contact: Angel Vera <arvera>
Severity: normal    
Priority: P3 CC: ram.venkataswamy
Version: unspecified   
Target Milestone: 3.2.3   
Hardware: PC   
OS: Windows XP   
See Also: https://git.eclipse.org/r/109015
Whiteboard:
Attachments:
Description Flags
UI with problem
none
Expected UI
none
Expected UI with multiple RT instances
none
Proposed patch none

Description Danny Ju CLA 2010-11-05 17:58:45 EDT
Build Identifier: 

There are several issues in the implementation of NewManualServerComposite
causing the UI not displaying the Server/Module validation message when user selects a project and Run On Server.

Reproducible: Always

Steps to Reproduce:
We were able to reproduce with following use case:
Create multiple instances of JavaEE runtime(e.g. WebLogic server 10.3.4). 
Both runtime has the same runtime type, with with slightly different runtime component. Don't create any server instance.

Create a WTP project requiring  one of runtime component which is available only in one of the runtime created. Right click the project and RunOnServer,
select "Manually Define a New Server":
1. Notice Next is disabled, runtime instance selection combo is hidden and no error message was shown in Wizard. (See screen shot attached)

Expected:
NewManualServerComposite should display proper error message returned by runtime/module validation for runtime instanced selected -- in this case, the instance lacking the required runtime coponent
Comment 1 Danny Ju CLA 2010-11-05 17:59:35 EDT
Created attachment 182538 [details]
UI with problem
Comment 2 Danny Ju CLA 2010-11-05 18:00:16 EDT
Created attachment 182539 [details]
Expected UI
Comment 3 Danny Ju CLA 2010-11-05 18:00:44 EDT
Created attachment 182540 [details]
Expected UI with multiple RT instances
Comment 4 Danny Ju CLA 2010-11-05 18:38:14 EDT
Created attachment 182542 [details]
Proposed patch
Comment 5 Danny Ju CLA 2010-11-05 18:45:29 EDT
Explanation of the fixes:
1. Remove the wizard.setMessage(null) call in 
checkHostAndServerType
will prevent error message from NewServerComposite.isSupportedModule()
call being overridden. 

2. Added extra server/module validation in setRuntime(IRuntime)
to handle user select different runtime instances from Runtime combo

3. Added canSupportModule() method
to disable Next button if NewServerComposite.isSupportedModule()
returns error status.

4. A bug in updateRuntimeCombo() method:
 runtimeCombo.select(sel);
 setRuntime(runtimes[0]);        <===========
Comment 6 Angel Vera CLA 2010-11-08 10:50:41 EST
Danny, can you document (in a bullet form) what regression scenarios you have tested?
Comment 7 Danny Ju CLA 2010-11-08 16:26:24 EST
Regression scenarios tested:
* Launch WTP a new workspace, create several runtime but NOT server instances.
* Create basic Web2.5 web project, right click and RunOnServer, the wizard should default to "Manually Define a New Server", as no existing server instance in workspace

* select a server type which only support 2.4 facet, e.g. Tomcat5.0, the wizard displays error message as returned from basic project facet/runtime support checking in NewServerComposite.isSupportedModule(IServerAttributes, IModule) 
- With the same runtime, change selection in the runtime combo and make sure the error checking is triggered
- change a different server runtime, make sure the error checking is triggered

* Create a project facet which requires a specific runtime component
(in case of WebLogic server, it is dynamic module which can be installed 
on top of baseline server). The checking of the existence of runtime component
and project facet is done in the custom WLS ServerDelegate, which will be invoked by Server.canModifyModule().
Create two runtimes, one with the required runtime component, one without.
Right click the project and RunOnServer.
- make sure the runtime combo is displayed
- change selection in the runtime combo and make sure the error checking 
is triggered	
- make sure the error message from the WLS ServerDelegate is displayed
for the instance lacking the runtime component, Next button disabled.
- switch to the WLS runtime with the component, the error message is cleared
and Next button enabled.
Comment 8 Angel Vera CLA 2011-01-10 10:46:41 EST
The changes look safe and the testing didn't seem to bring any problems.

Changes committed to 32M
Comment 9 Angel Vera CLA 2011-01-10 10:49:30 EST
changes released to 32M
Comment 10 Angel Vera CLA 2011-01-10 10:56:34 EST
changes committed to HEAD
Comment 11 Angel Vera CLA 2011-01-10 10:56:55 EST
changes released to HEAD
Comment 12 Eclipse Genie CLA 2017-10-11 16:35:39 EDT
New Gerrit change created: https://git.eclipse.org/r/109015