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

Bug 283846

Summary: Contribution of JAX-WS DOM tools
Product: [WebTools] WTP Webservices Reporter: Danail Branekov <danail.branekov>
Component: jst.ws.jaxwsAssignee: Project Inbox <wtp.inc.jaxws-inbox>
Status: RESOLVED FIXED QA Contact: Shane Clarke <shane_clarke>
Severity: enhancement    
Priority: P3 CC: bogdan.vatkov, keith.chong.ca, oisin.hurley
Version: unspecifiedKeywords: plan
Target Milestone: 3.2 M3   
Hardware: PC   
OS: All   
Whiteboard: jaxws
Attachments:
Description Flags
JAX-WS DOM tools plugins
none
JAX-WS DOM tools plugins (v2)
none
JAX-WS DOM tools plugins (v3)
none
JAX-WS DOM tools plugins (v4)
none
JAX-WS DOM tools plugins (v5) - no CGLib
none
JAX-WS DOM tools plugins (v6) shane_clarke: iplog+

Description Danail Branekov CLA 2009-07-17 09:32:36 EDT
Created attachment 141884 [details]
JAX-WS DOM tools plugins

Hi,

Within the SAP NetWeaver Developer Studio we have developed tools which provide support JAX-WS JSR-181 web services which we would like to contribute to Eclipse. The proposed implementation provides the following features:
 - JAX-WS domain object model (DOM)
 - API for accessing the JAX-WS DOM for both read and edit
 - A "JAX-WS Web Services" node in the Project Explorer view which contains all JSR-181 web services, their service endpoint interfaces, the web service operations and their parameters
 - Context menu actions which allow navigation between JAX-WS artifacts and JEE artifacts
 - Open java editor of the the compilation unit which represents the JAX-WS artifact
 - Contribution to the standard properties view which shows JAX-WS artifacts' properties which provides editing support for some of them
 - Validator for validating values of the JSR-181 annotations
 
Here is a list of implementation limitations:
 - The features above are relevant for web service provisioning only. Web service clients are out of scope
 - Web services implemented in referenced binaries are not processed
 - Deployment descriptors are ignored
 
The implementation consists of the following plugins:
 - org.eclipse.jst.ws.jaxws.sapnw.dom.runtime
 - org.eclipse.jst.ws.jaxws.sapnw.dom.ui
 - org.eclipse.jst.ws.jaxws.sapnw.utils
 - org.eclipse.jst.ws.jaxws.sapnw.dom.integration
The plugins are packed in the "org.eclipse.jst.ws.jaxws.sapnw.dom" feature.

We have also implemented tests which provide overall code coverage of about 75%. The tests are JUnit v3 and depend on JMock. Here is a list of the test plugins:
 - org.eclipse.jst.ws.jaxws.sapnw.dom.integration.tests
 - org.eclipse.jst.ws.jaxws.sapnw.dom.runtime.tests
 - org.eclipse.jst.ws.jaxws.sapnw.dom.ui.tests
 - org.eclipse.jst.ws.jaxws.sapnw.utils.tests
 - org.eclipse.jst.ws.jaxws.sapnw.testutils
 - org.jmock
The "org.jmock" plugin contains the JMock libraries packed as an eclipse plugin. The jar "cglib-nodep-2.2.jar" is distributed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt). The other JMock libraries are distributed under the JMock license (http://www.jmock.org/license.html)

The feature proposed is entirely implemented by SAP and SAP has given the agreement for contribution under the EPL license. 
The icons contained are either created by the EMF generation tool, or are taken from existing eclipse plugins. 
The code does not deal with cryptography

Here are the developers who contributed to the implementation:
 - Hristo Sabev, SAP AG (hristo.sabev@sap.com)
 - Georgi Vachkov, SAP AG (georgi.vachkov@sap.com)
 - Georgi Hristov, SAP AG (georgi.hristov@sap.com)
 - Danail Branekov, SAP AG (danail.branekov@sap.com)
It is hard to determine the percentage of authored code but one can assume that everyone of the people above had equal participation.

Regards, Danail
Comment 1 Shane Clarke CLA 2009-07-20 08:07:56 EDT
Hi Danail,

Thank you for the contribution.

I've had a look at the code and can run it successfully and see the items outlined above and it looks great.

I do have a question regarding the execution environment and plug-in dependencies for some of the plug-ins.

All but one of the plug-ins have a required execution environment of JavaSE-1.6 and the version ranges for the plug-in dependencies are set to a minimum level or Eclipse 3.5

Would it be possible to lower the required execution environment to J2SE-1.5 and the required versions of the plug-ins to Eclipse 3.4.x levels?

I ask because the minimum requirements for the current code base is Eclipse 3.4.x, WTP 3.0.x with it's dependencies (EMF 2.4.x, GEF 3.4.x) plus some bundles from Orbit (javax.jws, javax.xml.ws ...).

I did try lowering the execution environment and plug-in dependencies here to those levels. Fixed the compilation errors and it seemed to run fine. It wasn't an exhaustive test but the Project Explorer, properties view and validation all looked to be working.
Comment 2 Danail Branekov CLA 2009-07-20 08:26:13 EDT
Hi Shane,

These tools were originally developed for Java-1.5, Eclipse 3.3 and WTP 2.0.x. Later on we increased the execution environment due to adopting newer Eclipse releases and JDK6.
You can in fact remove all plugin dependencies restrictions. They are automatically added by the plugin.xml editor and this is the reason that they exist.

I will provide a patch with these changes later on.

Best regards, Danail
Comment 3 Shane Clarke CLA 2009-07-20 17:15:45 EDT
Hi Danail,

I'm going to start putting together a few contribution questionnaires to get the process going.

A couple of questions about the jMock jars.

Are they all unmodified?
And have you got links to the source code for those jars?

Also for the unit tests i noticed a reference to an internal Sun ByteInputStream class in there. Would it be possible to replace that with public API?

Thanks,
Shane
Comment 4 Danail Branekov CLA 2009-07-21 03:42:16 EDT
Created attachment 142101 [details]
JAX-WS DOM tools plugins (v2)
Comment 5 Danail Branekov CLA 2009-07-21 03:43:22 EDT
Hi Shane,

Please find attached a version which lowers the execution environment to J2SE-1.5 and removes the required bundle versions. The usage of the internal ByteInputStream class is also removed.
And here are the answers to your questions
 - All org.jmock plugin jars are not modified
 - Check http://jmock.org/repository.html for getting the JMock latest source code and http://www.jmock.org/dist/ for downloading JMock 1.1 (included in the org.jmock plugin) binaries and source code
 - Check http://sourceforge.net/projects/cglib/files/ for downloading the cglib-nodep-2.2 binary and source code
 
BTW, do you have any very rough estimation when this contribution could get out of its incubation phase? We need to somehow estimate when we should adapt our JAX-WS dependend code with regards to adoption of newer Eclipse releases.
 
Regards, Danail
Comment 6 Shane Clarke CLA 2009-07-21 09:13:52 EDT
Hi Danail,

Thank you for the update and the links.

>BTW, do you have any very rough estimation when this contribution could get out
>of its incubation phase? We need to somehow estimate when we should adapt our
>JAX-WS dependend code with regards to adoption of newer Eclipse releases.

This contribution if approved will graduate from incubation as part of the JAX-WS Tools 1.0 release.

We haven't officially set a date to aim for just yet for that 1.0 release.

But right now looking at the resources available and what's left to do to bring it up to the standard of a 1.0 release i'd be looking at next June as an estimate.

Outside of all the enhancements and bugs there are other requirements that we'll need to satisfy as well before graduating including building up the committer, user and adopter communities: 
http://wiki.eclipse.org/Development_Resources/HOWTO/Incubation_Phase

Comment 7 Shane Clarke CLA 2009-07-21 09:17:33 EDT
Speaking of committers. Could i get the name(s) of the committer(s) you'd like nominate to work on the contribution/integration and we'll look to start the election process as well.
Comment 8 Shane Clarke CLA 2009-07-21 09:26:25 EDT
Also just wanted to check to see if there's any possibility in using EasyMock instead of jMock for the unit tests.

I ask because EasyMock has already gone through the Eclipse IP process and has been approved. We'd just have to apply to reuse it.

If not, then that's not a problem and i'll start on the jMock submission.
Comment 9 Danail Branekov CLA 2009-07-21 11:39:25 EDT
Hi Shane,

I would nominate myself for committer. In case you need more information besides name, employer and e-mail, let me know.
Regarding JMock - refactoring existing tests to use EasyMock instead of JMock would definitely be quite an effort. I think that getting JMock in Eclipse is worth the approval process since in my opinion it sometimes lets developers implement expectations much easier than in EasyMock. Of course, EasyMock is the better choice in other situations. 
However, we could consider getting JMock2 instead of JMock1 in the org.jmock plugin. At the time we started writing these tests JMock2 was still unavailable. According to the JMock documentation, it should not be a big deal to run JMock1 tests with JMock2.
Speaking of test frameworks, has Abbot (http://abbot.sourceforge.net/doc/overview.shtml) passed the approval process? The web service wizards implementation, which we plan to contribute in near future as well, uses Abbot for UI testing.

Regards, Danail
Comment 10 Shane Clarke CLA 2009-07-21 17:34:14 EDT
> I would nominate myself for committer. In case you need more information
> besides name, employer and e-mail, let me know.

Excellent. I think i have all the information i need.

> However, we could consider getting JMock2 instead of JMock1 in the org.jmock
> plugin. At the time we started writing these tests JMock2 was still
> unavailable. According to the JMock documentation, it should not be a big deal
> to run JMock1 tests with JMock2.

I downloaded jMock 2.5.1 to have a look, replacing the jars in the attached org.jmock plugin. I'm not really familiar with jMock but 2.5.1 looks to be a completely different API to that found in jMock 1.1.0 for writing tests. Leads to unresolved imports and compilation errors in the test plugins.

It also mentions porting in the jMock 1 to jMock 2 upgrade documentation. So it looks like there could be a good deal of effort required to port from one version to the other.

> Speaking of test frameworks, has Abbot
> (http://abbot.sourceforge.net/doc/overview.shtml) passed the approval process?
> The web service wizards implementation, which we plan to contribute in near
> future as well, uses Abbot for UI testing.

No, it looks like Abbot has never been submitted for use by any Eclipse project.
Comment 11 Shane Clarke CLA 2009-07-22 08:41:35 EDT
Hi Danail,

Could we rename the navigatorContent name label in the 
org.eclipse.ui.navigator.navigatorContent extension point in org.eclipse.jst.ws.jaxws.sapnw.dom.integration plug-in.

from 'SAP Naviagator Content WS' to 'JAX-WS Web Services Elements' or similar.

It'd be more readily identifiable in the customize view dialog given the context.
Comment 12 Danail Branekov CLA 2009-07-22 08:54:16 EDT
> Could we rename the navigatorContent name label in the 
> org.eclipse.ui.navigator.navigatorContent extension point in
> org.eclipse.jst.ws.jaxws.sapnw.dom.integration plug-in.
> 
> from 'SAP Naviagator Content WS' to 'JAX-WS Web Services Elements' or similar.

Yes, of course. I thought that I have removed all SAP naming from the plugins, but it seems I have missed this one. Would you prefer a patch file, or a ZIP with all plugins? I am working against my own CVS locally and I am not sure whether a patch file for it would be useful for you

Regards, Danail
Comment 13 Shane Clarke CLA 2009-07-22 09:07:08 EDT
A zip file with the updated plugins would be best. Thanks.
Comment 14 Danail Branekov CLA 2009-07-22 09:23:21 EDT
Created attachment 142262 [details]
JAX-WS DOM tools plugins (v3)

Here is the ZIP with SAP labels removed

Regards, Danail
Comment 15 Shane Clarke CLA 2009-07-22 14:56:20 EDT
The last stable release of jMock 1 was version 1.2.0 so i think it's best to go with that version.
Comment 16 Danail Branekov CLA 2009-07-23 02:49:40 EDT
Created attachment 142348 [details]
JAX-WS DOM tools plugins (v4)

This is the next version of the source code which incorporates JMock 1.2.0.
I have run all tests with it to verify that everything is OK.

Regards, Danail
Comment 17 Shane Clarke CLA 2009-07-24 04:02:44 EDT
HI Danail,

It looks like there's a strong possibility that the cglib-nodep jar will not make it through the Eclipse due diligence review process.

We're trying to resolve the issues to move the process on and i've contacted the cglib team to try and do that but looking at previous attempts to resolve those same issues it's unlikely.

So i think we need to start looking at alternatives to jMock/cglib for implementing the tests.
Comment 18 Shane Clarke CLA 2009-07-28 18:40:37 EDT
Hi Danail,

I've got some questions back from the Eclipse IP team that they need clarification on that i'll need your help with. The questions are mostly related to the CGLIB, jMock and test related source code in the contribution.
 
And those questions are:

1. There are a few more @authors tags that appear in the contribution.
Plamen Pavlov
Mladen Tomov
d042817
d038406

Can you confirm that these authors are employees of SAP and does d042817 or d038406 equate to anyone else already listed as an author.

2. CGlibMockCL.java contains a comment of "* is based on CGLIB, so it's capable of mocking classes and interfaces". What does "based on" mean in this situation?

3. There's a question about AbstractMockObjectTestCase.java. Did this file originate from jMock?

4. Can you confirm the origin of BeforeAfterEnabler.java and/or provide some input of what this file is used for?

Thanks,
Shane
Comment 19 Danail Branekov CLA 2009-07-29 04:57:28 EDT
Hi Shane,

It is a shame for me that I have missed to mention my colleague Plamen Pavlov among the contributed source code authors. He definitely deserves credits for his work.
The other authors are also SAP employees. I will substitute their internal IDs with the real names. "d042817" is a colleague called Joerg Dehmel and "d038406" stands for Andre Hildebrandt. They have small contribution to the DOM tools implementation but you will see their names in the WS wizards integration.

Regarding CGlibMockCL - this class is an extension of the standard JMock proxy (org.jmock.core.AbstractDynamicMock) and uses CGLib means to mock classes (this is what "based on CGLIB" in the javadoc means). The class indirectly extends the standard JMock proxy class and "enriches" it via the CGLib net.sf.cglib.proxy.Enhancer API.
Further on, the org.eclipse.jst.ws.jaxws.sapnw.testutils.jmock.MockObjectTestCase (the parent of all our JMock tests) class creates instaces of CGlibMockCL in its mock() methods. The very tests use these instances instead of creating mocks via calling "new org.jmock.Mock()" by themselves.
The org.eclipse.jst.ws.jaxws.sapnw.testutils.jmock.AbstractMockObjectTestCase class is meant to be the parent class of all our jmock tests. This class is implemented within SAP and its purpose is to extend the standard JMock test fixture (org.jmock.core.MockObjectSupportTestCase) with generics thus making writing junit tests a bit easier.
BeforeAfterEnabler is also implemented within SAP. Its purpose is to override the "runBare" method of junit's TestCase and provide plugs for executing code before and after test methods execution (besides the standard "setUp" and "tearDown"). The is achieved via the provided IBeforeAfterEnabled instance in the class constructor.
The very usage of the BeforeAfterEnabler class is in org.eclipse.jst.ws.jaxws.sapnw.testutils.jmock.MockObjectTestCase. You can see that it overrides the "runBare" method and delegates to BeforeAfterEnabler.runBare()

Regards, Danail
Comment 20 Shane Clarke CLA 2009-07-30 05:04:12 EDT
Hi Danial,

Could you give me an idea of what your thoughts are on the jMock/cglib situation?

So far I haven't been able to get any feedback from the cglib team on their devlist to move the cglib-nodep submission forward.

And the cglib-nodep submission is blocking the jMock submission.

We can continue to take a wait and see approach there but i don't think that's going to get us anywhere.

Is there a possibility in reimplementing the tests?

Thanks,
Shane
Comment 21 Danail Branekov CLA 2009-07-30 07:39:35 EDT
Hi Shane,

Refactoring junit tests from JMock to EasyMock will be definitely a significant effort but the absence of cglib would be a problem.
The reason to insist on getting cglib in eclipse is that as far as I am aware, this is the most famous byte code modification framework. It is also used in the EasyMock class extension - http://easymock.org/EasyMock2_0_ClassExtension_Documentation.html , section Requirements. 
I know that JUnit gurus disregard such an approach, but there are situations where this is inevitable. For example, in our code we have a JUnit test which tests the action which navigates from the web service node to the EJB node in project explorer. In order to create the very action instance you need an instance of org.eclipse.jface.viewers.StructuredViewer (check the org.eclipse.ui.internal.navigator.extensions.CommonActionExtensionSite cinstructor). The StructuredViewer class does not have an interface which means that if one cannot mock StructuredViewers, then he would have to take a real structured viewer and pass it as parameter. Thus the junit test isolation is broken because it involves interraction with real StructuredViewers whose implementation might or might not be adequate. Extending StrucutredViewer with some test implementation is a solution which is superfluous and would prevent the test from compiling in case StrucutredViewer "interface" changed in an incompatible manner in future. 

Does eclipse offer some approved library for bytecode modification? We could research how we could substitute CGLib with it.

Regards, Danail

Comment 22 Shane Clarke CLA 2009-07-30 16:47:44 EDT
Hi Danail,

> Does eclipse offer some approved library for bytecode modification? We could
> research how we could substitute CGLib with it.

ASM http://asm.ow2.org/ versions 3.1 and 3.2 have been approved. That's used by CGLIB.

BCEL http://jakarta.apache.org/bcel/ version 5.2 has also been approved.

Both are available from Orbit http://download.eclipse.org/tools/orbit/downloads/drops/R20090529135407/

Thanks,
Shane
Comment 23 Danail Branekov CLA 2009-07-31 07:57:24 EDT
OK, then I could try refactoring the test plugin to start using ASM or BCEL. This would however take some time and efforts. 

I think that the most feasible approach (in case everything with JMock itself is fine) would be to remove CGLib and the tests which fail because of its absence. These are a couple of tests which represent a pretty insignificant piece of all tests. Later on, when I either implement class mocking or refactor the implementation to use interfaces I could contribute them as well.
Or you would prefer to get everyhting right in one step?

Regards, Danail
Comment 24 Shane Clarke CLA 2009-07-31 08:54:41 EDT
(In reply to comment #23)
> OK, then I could try refactoring the test plugin to start using ASM or BCEL.
> This would however take some time and efforts. 
> 
> I think that the most feasible approach (in case everything with JMock itself
> is fine) would be to remove CGLib and the tests which fail because of its
> absence. These are a couple of tests which represent a pretty insignificant
> piece of all tests. Later on, when I either implement class mocking or refactor
> the implementation to use interfaces I could contribute them as well.
> Or you would prefer to get everyhting right in one step?
> 
> Regards, Danail
> 

I agree, i think the best approach would be to remove the cglib-nodep and jmock-cglib jars along with the cglib references in the source and update the submissions.

JMock will still however have to complete a review once the cglib dependency is removed. Hopefully everything will be ok there.
Comment 25 Oisin Hurley CLA 2009-07-31 10:16:01 EDT
I think there's some value in bringing in the code in two tranches, having the material that is independent of cglib encumbrance arrive in CVS first, and have the rest follow later after refactor/approval. 
Comment 26 Danail Branekov CLA 2009-08-05 04:13:56 EDT
Created attachment 143478 [details]
JAX-WS DOM tools plugins (v5) - no CGLib

Here is the next version of the tools. Changes refere to test plugins only:
- The CGLib libraries (jmock-cglib-1.2.0.jar and cglib-nodep-2.2.jar) are removed from the org.jmock plugin
- The org.eclipse.jst.ws.jaxws.sapnw.testutils.jmock.CGlibMockCL class has been deleted
- The org.eclipse.jst.ws.jaxws.sapnw.testutils.jmock.PrefixPackageNamingPolicy class has been deleted
- Due to CGLib absence the following failing tests have been deleted:
  * org.eclipse.jst.ws.jaxws.sapnw.dom.integration.tests.navigator.actions.NavigateToImplementationActionTest
  * org.eclipse.jst.ws.jaxws.sapnw.dom.integration.tests.navigator.actions.OpenWSResourceActionTest
  * org.eclipse.jst.ws.jaxws.sapnw.dom.integration.tests.navigator.actions.WSActionProviderTest
These tests are going to be provided later on.
Comment 27 Danail Branekov CLA 2009-08-14 03:57:21 EDT
Created attachment 144509 [details]
JAX-WS DOM tools plugins (v6)

Gave credits to Shay Banon for the original idea of org.eclipse.jst.ws.jaxws.sapnw.testutils.jmock.testcases.BeforeAfterEnabler
Comment 28 Shane Clarke CLA 2009-08-16 17:09:17 EDT
Main part of this contribution has been approved. We're still waiting on JMock.

I've checked in the feature and main plug-ins. I'll wait for the ok on JMock before checking in the tests.

The feature and plug-ins can be found here (dev.eclipse.org):
/cvsroot/webtools/incubator/webservices/features/
/cvsroot/webtools/incubator/webservices/plugins/

I had to make a few changes to the feature and plug-ins:

Plug-ins:
For each plug-in i added an about.html file and i added the word incubation to the bundle.name. It's a requirement.

For the org.eclipse.jst.ws.jaxws.sapnw.dom.runtime plug-in i added a dependency on javax.jws (import-package) to fix a compilation problem caused by the drop to Java 1.5.

Feature.
I added a .feature suffix to the org.eclipse.jst.ws.jaxws.sapnw.dom feature name and added a license.html, epl-v10.html, eclipse_update_120.jpg image and a feature.properties file. The feature.properties file contains a text version of the feature update license and SAP AG copyright information.

I've also added an additional feature (org.eclipse.jst.ws.jaxws.sapnw.dom_sdk.feature) in preparation for integrating into the build system.
Comment 29 Shane Clarke CLA 2009-08-16 17:24:29 EDT
For the tests they'll be checked into: 
/cvsroot/webtools/incubator/webservices/tests/

There are a couple of compilation problems in the tests all of which are related to the drop to Eclipse 3.4.x and Java 1.5. I can fix these before or after i checkin the code.

org.eclipse.jst.ws.jaxws.sapnw.dom.integration.tests.navigator.actions.WSActionAbstractTest Line 810.

We can remove the "myPluginid" argument in the call to CommonActionExtensionSite(). (Eclipse 3.5 constructor)

org.eclipse.jst.ws.jaxws.sapnw.dom.runtime.tests.dom.persistence.Jee5WsDomRuntimeExtensionTest Line 127. 

We can change the call to the IOException constructor to pass in the localized message. (Java 1.6 constructor).

The drop to Java 1.5 is also causing two tests to fail:

org.eclipse.jst.ws.jaxws.sapnw.dom.runtime.tests.dom.persistence.sync.MethodParamsSynchronizationTests
* test_voidMethodWithNonParameterizedHolderParam() Line 157
* test_voidMethodWithParameterizedHolderParam() Line 170

Failure was junit.framework.AssertionFailedError: expected:<INOUT> but was:<IN>

I've looked into it and javax.xml.ws.Holder cannot be resolved. org.eclipse.jst.ws.jaxws.sapnw.dom.runtime.persistence.sync.ParameterSynchronizer Line 125 returns null.

If we can configure the test project used in those tests with Java 1.6 it should resolve that problem. We setup the existing test cases that way so it should be doable.
Comment 30 Danail Branekov CLA 2009-08-18 10:47:41 EDT
Hi Shane,

Once you get the tests source code in CVS I could check the failing tests and fix them.

Regards, Danail
Comment 31 Shane Clarke CLA 2009-08-20 16:18:32 EDT
Hi Danail,

jMock has received preliminary legal approval that allows us to check it into CVS.

It's now checked in along with the test plug-ins.

We can discuss integrating the code on the wtp-incubator dev list.

Marking this bug as fixed. Code is in CVS and a committer elected.

Thanks,
Shane

Comment 32 Shane Clarke CLA 2010-02-10 18:50:37 EST
Comment on attachment 144509 [details]
JAX-WS DOM tools plugins (v6)

Adding iplog flag