Bug 301295 - WDF test framework is better to be enhanced in order to run all WDF tests on application servers
Summary: WDF test framework is better to be enhanced in order to run all WDF tests on ...
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords: test
Depends on:
Blocks:
 
Reported: 2010-01-29 14:39 EST by Kevin Yuan CLA
Modified: 2022-06-09 10:33 EDT (History)
6 users (show)

See Also:


Attachments
proposed patch (86.23 KB, patch)
2010-03-31 04:41 EDT, Adrian Goerler CLA
no flags Details | Diff
proposed patch (83.04 KB, patch)
2010-03-31 05:32 EDT, Adrian Goerler CLA
no flags Details | Diff
proposed patch - now with copyright headers (100.05 KB, patch)
2010-04-01 10:06 EDT, Adrian Goerler CLA
no flags Details | Diff
patch submitted (97.35 KB, patch)
2010-04-09 07:49 EDT, Adrian Goerler CLA
no flags Details | Diff
enables server testing for weblogic (4.84 KB, patch)
2010-04-16 10:54 EDT, Adrian Goerler CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Yuan CLA 2010-01-29 14:39:18 EST
Currently, there is no mechanism to run WDF tests on the server. The mechanism used by the eclipselink.jpa.test tests won’t work out-of the box. These tests overwrite the runBare method in TestCase to redirect the test to the server. But the WDF tests don’t extend TestCase so there’s no runBare method to overwrite.

The existing WDF test framework is using a custom test runner so it might be able to implement something in the runChild method of this test runner. It will be doable somehow.
Comment 1 Adrian Goerler CLA 2010-03-31 04:41:12 EDT
Created attachment 163501 [details]
proposed patch

Proposal for initial patch: 
- run WDF JPA 1 tests on server
- resource local transactions are used
- tested with NetWeaver 7.1 and JBoss 5.1
Comment 2 Adrian Goerler CLA 2010-03-31 04:50:59 EDT
The tests should be invoked in the jpa/eclipselink.jpa.wdf.test directory with the ant targte server-test.

The target server is configured just as with the eclipselink.jpa.test tests in the tests.properties or build.properties file.

The detailed server configuration is shared with the eclipselink.jpa.test server tests and is taken from the jpa/eclipselink.jpa.test/<server>.properties files.
Comment 3 Adrian Goerler CLA 2010-03-31 05:32:33 EDT
Created attachment 163506 [details]
proposed patch

replaces previous patch
Comment 4 Sabine Heider CLA 2010-04-01 05:08:38 EDT
Tested on NetWeaver 7.3 application server - runs successfully.

However, I would suggest to change the following things before submitting:
1. Add a line <property file="${user.home}/${server.name}.properties"/> to the ant target "get-server-properties" in the build.xml file.
2. Add copyright headers to the newly introduced classes. 
3. Improve javadoc.
Comment 5 Adrian Goerler CLA 2010-04-01 10:06:07 EDT
Created attachment 163632 [details]
proposed patch - now with copyright headers

- added copyright headers
- lookup server properties in users home directory alternatively
- improved javadoc
Comment 6 Adrian Goerler CLA 2010-04-09 06:01:54 EDT
received this comment from Kevin by mail:

I have looked through all your changes, but haven't run on JBoss yet since you have lots of changes (I met some compile error after I manually made some changes based on your patch). But I think you can check in first if all WDF tests work fine on JAVASE (out of container) with your patch. So far I only have the following suggestions with your changes:

- Add "server-test" target explanation in the beginning of \trunk\jpa\eclipselink.jpa.wdf.test\build.xml, just like other targets, e.g. "test";
- It's better to pass the dynamic values for "transaction-type" and "data-source-type" (current values are hard code),  in trunk\jpa\eclipselink.jpa.wdf.test\resource\eclipselink-wdf-jpa1-model\persistence.xml;
- Some new classes for testing framework need to add copyright headers.

After you check in, it will be easy to run on JBoss and other application servers, probably we need to give extra enhancement in order to run all WDF tests on servers automatically, just like existing other jpa testing.
Comment 7 Adrian Goerler CLA 2010-04-09 06:03:56 EDT
> 
> - Add "server-test" target explanation in the beginning of
> \trunk\jpa\eclipselink.jpa.wdf.test\build.xml, just like other targets, e.g.
> "test";

Good idea.

> - It's better to pass the dynamic values for "transaction-type" and
> "data-source-type" (current values are hard code),  in
> trunk\jpa\eclipselink.jpa.wdf.test\resource\eclipselink-wdf-jpa1-model\persistence.xml;

Currently, the tests are running in application-managed/resource-local/extended-scoped mode only. As a next step, I’d like to add an application-managed/JTA/transaction-scoped mode. I’ll tackle this in the next step.


> - Some new classes for testing framework need to add copyright headers.

I have double-checked the new classes but the copyright headers look fine to me.
Comment 8 Adrian Goerler CLA 2010-04-09 07:49:27 EDT
Created attachment 164357 [details]
patch submitted

- checked in in trunk at rev # 6941
- tested on NetWeaver 7.3 and JBoss 5.1
- retested by Sabine Heider
- reviewed by Kevin Yuan
Comment 9 Kevin Yuan CLA 2010-04-15 10:42:26 EDT
Testing failed on WebLogic and Glassfish-v3 with the same issues, just like the following:
    [junit] Exception in thread "Main Thread" java.lang.RuntimeException: javax.naming.NameNotFoundException: While trying to lookup 'ServerTestRunnerImpl#org.eclipse.persistence.testing.framework.wdf.server.ServerTestRunner' didn't find subcontext 'ServerTestRunnerImpl#org'. Resolved '' [Root exception is javax.naming.NameNotFoundException: While trying to lookup 'ServerTestRunnerImpl#org.eclipse.persistence.testing.framework.wdf.server.ServerTestRunner' didn't find subcontext 'ServerTestRunnerImpl#org'. Resolved '']; remaining name 'ServerTestRunnerImpl#org/eclipse/persistence/testing/framework/wdf/server/ServerTestRunner'
    [junit] 	at org.eclipse.persistence.testing.framework.wdf.SkipBugzillaTestRunner.runOnServer(SkipBugzillaTestRunner.java:79)
    [junit] 	at org.eclipse.persistence.testing.framework.wdf.SkipBugzillaTestRunner.run(SkipBugzillaTestRunner.java:47)
    [junit] 	at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
    [junit] 	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:421)
    [junit] 	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:912)
    [junit] 	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:743)
    [junit] Caused by: javax.naming.NameNotFoundException: While trying to lookup 'ServerTestRunnerImpl#org.eclipse.persistence.testing.framework.wdf.server.ServerTestRunner' didn't find subcontext 'ServerTestRunnerImpl#org'. Resolved '' [Root exception is javax.naming.NameNotFoundException: While trying to lookup 'ServerTestRunnerImpl#org.eclipse.persistence.testing.framework.wdf.server.ServerTestRunner' didn't find subcontext 'ServerTestRunnerImpl#org'. Resolved '']; remaining name 'ServerTestRunnerImpl#org/eclipse/persistence/testing/framework/wdf/server/ServerTestRunner'
    [junit] 	at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:234)
    [junit] 	at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:348)
    [junit] 	at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
    [junit] 	at weblogic.jndi.internal.ServerNamingNode_1032_WLStub.lookup(Unknown Source)
    [junit] 	at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:405)
    [junit] 	at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:393)
    [junit] 	at javax.naming.InitialContext.lookup(InitialContext.java:392)
    [junit] 	at org.eclipse.persistence.testing.framework.wdf.SkipBugzillaTestRunner.runOnServer(SkipBugzillaTestRunner.java:70)
    [junit] 	... 5 more
    [junit] Caused by: javax.naming.NameNotFoundException: While trying to lookup 'ServerTestRunnerImpl#org.eclipse.persistence.testing.framework.wdf.server.ServerTestRunner' didn't find subcontext 'ServerTestRunnerImpl#org'. Resolved ''
    [junit] 	at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
    [junit] 	at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:247)
    [junit] 	at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182)
    [junit] 	at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)
    [junit] 	at weblogic.jndi.internal.RootNamingNode_WLSkel.invoke(Unknown Source)
    [junit] 	at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:589)
    [junit] 	at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:230)
    [junit] 	at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:477)
    [junit] 	at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
    [junit] 	at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
    [junit] 	at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:473)
    [junit] 	at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
    [junit] 	at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    [junit] 	at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Comment 10 Adrian Goerler CLA 2010-04-15 11:33:04 EDT
This is expected.

For all servers, the absolute JNDI lookup name for the session bean 

org.eclipse.persistence.testing.framework.wdf.server.ServerTestRunnerImpl

must be configured with the property "server.testrunner.wdf" in the jpa/eclipselink.jpa.test/<server>.properties file. 

So far, this has been done for JBoss and NetWeaver only.

The lookup path is server-specific and I am not having access to a different server. I'd assume that the lookup names must be constructed similar to the lookup names of the property "server.testrunner".
Comment 11 Kevin Yuan CLA 2010-04-15 11:48:20 EDT
That's true, I have add "server.testrunner.wdf=ServerTestRunnerImpl#org.eclipse.persistence.testing.framework.wdf.server.ServerTestRunner" in jpa/eclipselink.jpa.test/weblogic.properties and jpa/eclipselink.jpa.test/glassfish.properties. That's why you can see the it in the stack trace: 

Root exception
is javax.naming.NameNotFoundException: While trying to lookup
'ServerTestRunnerImpl#org.eclipse.persistence.testing.framework.wdf.server.ServerTestRunner'
didn't find subcontext 'ServerTestRunnerImpl#org'. Resolved ''
Comment 12 Adrian Goerler CLA 2010-04-16 10:54:51 EDT
Created attachment 165106 [details]
enables server testing for weblogic

It turned out that weblogic does not like if @Remote is specified on the business interface. I had to move the annotation to the session bean.

With this change, server testing is working now on weblogic as well.
Comment 13 Adrian Goerler CLA 2010-04-19 03:32:46 EDT
retested on weblogic by Kevin
checked in in trunk at rev # 7010
Comment 14 Michael OBrien CLA 2010-05-31 10:53:03 EDT
>Just for reference - regarding comment 12 - The following @Remote configuration is working on WebLogic 10.3.3.0 from the examples folder
- the annotation is on the interface class - not the @Stateless implementation bean 
- however specifying @Remote on the session bean as well works fine
- no named class is specified on the annotations though

@Remote
public interface ApplicationServiceRemote {..}

@Local
public interface ApplicationServiceLocal {..}

@Stateless
public class ApplicationService implements ApplicationServiceLocal, ApplicationServiceRemote {..}
Comment 15 Adrian Goerler CLA 2010-06-08 04:41:08 EDT
Closing this ticked as suggested by Kevin:

"Hi Adrian,
Based on our discussion in "EclipseLink QA/Dev Leads Sync-Up" meeting, 
WDF testing already run on JBoss/WLS, and also can run on NetWeaver. 
That is enough for us, so I think you can close this bug. Thanks a lot 
for your help.

- Kevin
"
Comment 16 Eclipse Webmaster CLA 2022-06-09 10:33:59 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink