Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 106118 Details for
Bug 238842
need to add support for running JPA tests on WebSphere
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
add support for running jpa tests on WebSphere
eclipselink-jpa-bug238842.patch (text/plain), 19.22 KB, created by
Yiping Zhao
on 2008-06-30 10:33:06 EDT
(
hide
)
Description:
add support for running jpa tests on WebSphere
Filename:
MIME Type:
Creator:
Yiping Zhao
Created:
2008-06-30 10:33:06 EDT
Size:
19.22 KB
patch
obsolete
>Index: jpa/eclipselink.jpa.test/build.xml >=================================================================== >--- jpa/eclipselink.jpa.test/build.xml (revision 1676) >+++ jpa/eclipselink.jpa.test/build.xml (working copy) >@@ -58,11 +58,48 @@ > <!-- This checks if the trunk was checked out, or just the Eclipse projects. --> > <available file="${eclipselink.jpa.test}/${eclipselink.core.trunk}" type="dir" property="is.trunk"/> > >+ <!-- Allows we run websphere tests from Windows & Linux both. --> >+ <target name="detect-os"> >+ <condition property="is.windows" value="true"> >+ <os family="windows"/> >+ </condition> >+ <condition property="is.unix" value="true"> >+ <os family="unix"/> >+ </condition> >+ <condition property="suffix" value="bat"> >+ <isset property="is.windows"/> >+ </condition> >+ <condition property="suffix" value="sh"> >+ <isset property="is.unix"/> >+ </condition> >+ </target> >+ > <!-- This checks if the tests are run on Oracle database --> > <condition property="is.oracle"> > <contains string="${db.url}" substring="oracle"/> > </condition> > >+ <!-- This checks if the tests are run on WebSphere --> >+ <condition property="is.websphere"> >+ <contains string="${server.name}" substring="websphere"/> >+ </condition> >+ >+ <!-- We can't append application name after ${server.url} for WebSphere jndi lookup, so need to differenciate with other servers --> >+ <target name="set-app-name"> >+ <condition property="APP_NAME" value=""> >+ <contains string="${server.name}" substring="websphere"/> >+ </condition> >+ <condition property="APP_NAME" value="${MODEL_NAME}"> >+ <contains string="${server.name}" substring="weblogic"/> >+ </condition> >+ <condition property="APP_NAME" value="${MODEL_NAME}"> >+ <contains string="${server.name}" substring="jboss"/> >+ </condition> >+ <condition property="APP_NAME" value="${MODEL_NAME}"> >+ <contains string="${server.name}" substring="oc4j"/> >+ </condition> >+ </target> >+ > <!-- Configures paths for trunk checkout. --> > <target name="config-trunk" if="is.trunk"> > <property name="eclipselink.core.dir" value="${eclipselink.jpa.test}/${eclipselink.core.trunk}"/> >@@ -712,7 +749,7 @@ > <ant antfile="${eclipselink.jpa.test}/${server.name}.xml" target="${server.name}-install" inheritRefs="true"/> > </target> > >- <target name="server-setup"> >+ <target name="server-setup" depends="detect-os"> > <ant antfile="${eclipselink.jpa.test}/${server.name}.xml" target="${server.name}-setup" inheritRefs="true"/> > </target> > >@@ -720,11 +757,11 @@ > <ant antfile="${eclipselink.jpa.test}/${server.name}.xml" target="${server.name}-reset" inheritRefs="true"/> > </target> > >- <target name="server-start"> >+ <target name="server-start" depends="detect-os"> > <ant antfile="${eclipselink.jpa.test}/${server.name}.xml" target="${server.name}-start" inheritRefs="true"/> > </target> > >- <target name="server-stop"> >+ <target name="server-stop" depends="detect-os"> > <ant antfile="${eclipselink.jpa.test}/${server.name}.xml" target="${server.name}-stop" inheritRefs="true"/> > </target> > >@@ -831,13 +868,21 @@ > <copy todir="${eclipselink.jpa.test}/stage/META-INF"> > <fileset dir="${eclipselink.jpa.test}/resource/${MODEL_NAME}/server/"> > <include name="ejb-jar.xml"/> >+ <include name="ibm-ejb-jar-bnd.xml"/> > </fileset> > </copy> > <!-- Create ejb jar. --> > <jar destfile="${eclipselink.jpa.test}/${build.dir}/${MODEL_NAME}_ejb.jar" basedir="stage"/> >+ <antcall target="create-ejb-stubs" inheritRefs="true"/> > <delete dir="stage"/> > </target> > >+ <target name="create-ejb-stubs" depends="detect-os" if="is.websphere"> >+ <exec executable="${was.home}/bin/createEJBStubs.${suffix}"> >+ <arg line="${eclipselink.jpa.test}/${build.dir}/${MODEL_NAME}_ejb.jar"/> >+ </exec> >+ </target> >+ > <!-- Build server test ear. --> > <target name="server-build-ear"> > <copy overwrite="true" file="./resource/${MODEL_NAME}/server/application.xml" todir="${build.dir}/META-INF"/> >@@ -851,7 +896,7 @@ > <target name="server-build" depends="server-build-client-jar,server-build-ejb-jar,server-build-ear"/> > > <!-- Build, deploy and run a test suite on the server. --> >- <target name="server-run-all"> >+ <target name="server-run-all" depends="detect-os"> > <antcall target="server-build" inheritRefs="true"/> > <antcall target="server-deploy" inheritRefs="true"> > <param name="ear.name" value="${EAR_NAME}.ear"/> >@@ -864,7 +909,7 @@ > </target> > > <!-- Run an ear on the server. --> >- <target name="server-run-test" depends="config-trunk, config-flat"> >+ <target name="server-run-test" depends="config-trunk, config-flat, set-app-name"> > <property file="${user.home}/${server.name}.properties"/> > <property file="${eclipselink.jpa.test}/${server.name}.properties"/> > <path id="run.path"> >@@ -879,14 +924,14 @@ > <sysproperty key="server.platform" value="${server.platform}"/> > <sysproperty key="server.user" value="${server.user}"/> > <sysproperty key="server.password" value="${server.pwd}"/> >- <sysproperty key="server.url" value="${server.url}${MODEL_NAME}"/> >+ <sysproperty key="server.url" value="${server.url}${APP_NAME}"/> > <sysproperty key="server.testrunner" value="${server.testrunner}"/> > <sysproperty key="server.run" value="TRUE"/> > <classpath refid="run.path"/> > <formatter type="xml"/> > <test name="${TEST_SUITE}" haltonfailure="no" outfile="${report.dir}/test-results"/> > </junit> >- <copy todir="${env.JAVA_HOME}/jre/lib" file="${eclipselink.jpa.test}/resource/weblogic/jaxp.properties" failonerror="false"/> >+ <copy todir="${env.JAVA_HOME}/jre/lib" file="${eclipselink.jpa.test}/resource/${server.name}/jaxp.properties" failonerror="false"/> > <junitreport todir="${eclipselink.jpa.test}/${report.dir}"> > <fileset dir="${eclipselink.jpa.test}/${report.dir}"> > <include name="test-results.xml"/> >Index: jpa/eclipselink.jpa.test/configWebSphere.py >=================================================================== >--- jpa/eclipselink.jpa.test/configWebSphere.py (revision 0) >+++ jpa/eclipselink.jpa.test/configWebSphere.py (revision 0) >@@ -0,0 +1,58 @@ >+# This program may be used, executed, copied, modified and distributed >+# without royalty for the purpose of developing, using, marketing, or distribution >+ >+#------------------------------------------------------------------------ >+# >+# installEJB3CounterSample >+# >+# This is a jython script designed to be run with the wsadmin command. It >+# assumes a simple single node, single server install. It should be >+# invoked from within the <was-home>/bin directory as: >+# wsadmin.bat|sh -lang jython -f c:\Temp\Was\configWebSphere.py >+#------------------------------------------------------------------------ >+# Create JDBC Driver >+try: >+ AdminConfig.remove(AdminConfig.getid('/Node:%%hostName%%Node01/Server:server1/JDBCProvider:OracleJDBCProvider/')) >+except: >+ print 'OracleJDBCProvider was not previously installed' >+AdminConfig.save() >+ >+n1 = ['name', 'OracleJDBCProvider'] >+implCN = ['implementationClassName', 'oracle.jdbc.pool.OracleConnectionPoolDataSource'] >+jdbcAttrs = [n1, implCN, ['classpath', '%%oracleDriver%%']] >+print jdbcAttrs >+node = AdminConfig.getid('/Node:%%hostName%%Node01/Server:server1/') >+newJDBC = AdminConfig.create('JDBCProvider', node, jdbcAttrs) >+AdminConfig.save() >+print newJDBC >+ >+# Create DataSource >+name = ['name', 'EclipseLinkDS'] >+dsAttrs = [name, ['jndiName', 'jdbc/EclipseLinkDS']] >+newds = AdminConfig.create('DataSource', newJDBC, dsAttrs) >+AdminConfig.save() >+print newds >+ >+# Create DataSource Custom Properties >+newds = AdminConfig.getid('/Node:%%hostName%%Node01/Server:server1/JDBCProvider:OracleJDBCProvider/DataSource:EclipseLinkDS/') >+print newds >+newpropset = AdminConfig.create('J2EEResourcePropertySet',newds,[]) >+AdminConfig.create('J2EEResourceProperty', newpropset, [['name', 'URL'], ['value', '%%dbURL%%']]) >+AdminConfig.create('J2EEResourceProperty', newpropset, [['name', 'user'], ['value', '%%dbUser%%']]) >+AdminConfig.create('J2EEResourceProperty', newpropset, [['name', 'password'], ['value', '%%dbPassword%%']]) >+AdminConfig.save() >+print '-> Done!' >+ >+# Create Shared Library >+try: >+ AdminConfig.remove(AdminConfig.getid('/Node:%%hostName%%Node01/Server:server1/Library:eclipselinkjpa')) >+except: >+ print 'eclipselinkjpa was not previously installed' >+AdminConfig.save() >+ >+n1 = AdminConfig.getid('/Node:%%hostName%%Node01/Server:server1/') >+print n1 >+library = AdminConfig.create('Library', n1, [['name', 'eclipselinkjpa'], >+['classPath', '%%eclipselinkLibDir%%/eclipselink.jar']]) >+print library >+AdminConfig.save() >Index: jpa/eclipselink.jpa.test/installApps.py >=================================================================== >--- jpa/eclipselink.jpa.test/installApps.py (revision 0) >+++ jpa/eclipselink.jpa.test/installApps.py (revision 0) >@@ -0,0 +1,41 @@ >+# This program may be used, executed, copied, modified and distributed >+# without royalty for the purpose of developing, using, marketing, or distribution >+ >+#------------------------------------------------------------------------ >+# >+# installApps >+# >+# This is a jython script designed to be run with the wsadmin command. It >+# assumes a simple single node, single server install. It should be >+# invoked from within the <was-home>/bin directory as: >+# wsadmin.bat|sh -lang jython -f <path-to>/installApps.py >+#------------------------------------------------------------------------ >+ >+# If the application is currently installed, uninstall it >+try: >+ AdminApp.uninstall('%%appName%%') >+except: >+ print '%%appName%% was not previously installed' >+AdminConfig.save() >+ >+# Set the options for the install >+attrs = ['-appname', '%%appName%%'] >+ >+# Install the application >+AdminApp.install('%%ear%%', attrs) >+AdminConfig.save() >+ >+# Associate shared library >+deployment = AdminConfig.getid('/Deployment:%%appName%%/') >+print deployment >+appDeploy = AdminConfig.showAttribute(deployment, 'deployedObject') >+print appDeploy >+classLoad1 = AdminConfig.showAttribute(appDeploy, 'classloader') >+print classLoad1 >+print AdminConfig.create('LibraryRef', classLoad1, [['libraryName', >+'eclipselinkjpa'], ['sharedClassloader', 'true']]) >+AdminConfig.save() >+ >+# Start the application >+appManager = AdminControl.queryNames('type=ApplicationManager,*') >+AdminControl.invoke(appManager, 'startApplication', '%%appName%%') >Index: jpa/eclipselink.jpa.test/resource/websphere/jaxp.properties >=================================================================== >--- jpa/eclipselink.jpa.test/resource/websphere/jaxp.properties (revision 0) >+++ jpa/eclipselink.jpa.test/resource/websphere/jaxp.properties (revision 0) >@@ -0,0 +1 @@ >+javax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl >Index: jpa/eclipselink.jpa.test/resource/websphere/jaxp.properties >=================================================================== >--- jpa/eclipselink.jpa.test/resource/websphere/jaxp.properties (revision 0) >+++ jpa/eclipselink.jpa.test/resource/websphere/jaxp.properties (revision 0) >@@ -0,0 +1 @@ >+javax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl >Index: jpa/eclipselink.jpa.test/unInstallApps.py >=================================================================== >--- jpa/eclipselink.jpa.test/unInstallApps.py (revision 0) >+++ jpa/eclipselink.jpa.test/unInstallApps.py (revision 0) >@@ -0,0 +1,19 @@ >+# This program may be used, executed, copied, modified and distributed >+# without royalty for the purpose of developing, using, marketing, or distribution >+ >+#------------------------------------------------------------------------ >+# >+# installApps >+# >+# This is a jython script designed to be run with the wsadmin command. It >+# assumes a simple single node, single server install. It should be >+# invoked from within the <was-home>/bin directory as: >+# wsadmin.bat|sh -lang jython -f <path-to>/unInstallApps.py >+#------------------------------------------------------------------------ >+ >+# If the application is currently installed, uninstall it >+try: >+ AdminApp.uninstall('%%appName%%') >+except: >+ print '%%appName%% was not previously installed' >+AdminConfig.save() >Index: jpa/eclipselink.jpa.test/websphere.properties >=================================================================== >--- jpa/eclipselink.jpa.test/websphere.properties (revision 0) >+++ jpa/eclipselink.jpa.test/websphere.properties (revision 0) >@@ -0,0 +1,21 @@ >+# WebSphere Server Testing Environment Properties. >+ >+# Standard server properties. >+server.user= >+server.pwd= >+server.url=iiop://localhost:2809/ >+server.testrunner=org.eclipse.persistence.testing.framework.server.TestRunner >+server.lib=C:/IBM/WAS61/runtimes >+server.depend=com.ibm.ws.admin.client_6.1.0.jar >+server.platform=WebSphere_6_1 >+server.factory=com.ibm.websphere.naming.WsnInitialContextFactory >+ >+# WebSphere specific properties. >+was.home=C:/IBM/WAS61 >+instance.host=yzhao-pc >+eclipselink.jar.dir=C:/EclipseLink/trunk >+ >+junit.lib=../../../extension.lib.external/junit.jar >+eclipselink.jar.name=../../eclipselink.jar >+jdbc.driver.jar=C:/Drivers/OracleDrivers/10gr1/ojdbc14.jar >+ >Index: jpa/eclipselink.jpa.test/websphere.xml >=================================================================== >--- jpa/eclipselink.jpa.test/websphere.xml (revision 0) >+++ jpa/eclipselink.jpa.test/websphere.xml (revision 0) >@@ -0,0 +1,117 @@ >+<!--/******************************************************************************* >+* This program and the accompanying materials are made available under the >+* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 >+* which accompanies this distribution. >+* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html >+* and the Eclipse Distribution License is available at >+* http://www.eclipse.org/org/documents/edl-v10.php. >+* >+* Ant naming conventions: >+* - regardless of the actual OS platform,'/' is the directory separator >+* (Ant will convert as appropriate). >+* - multi-word properties use periods '.' >+* - multi-word targets use hyphens '-' >+* - multi-word macros use underscores '_' >+* - multi-word macro attributes are concatinated >+* e.g. 'runpathref' >+* - multi-word tasks (taskdef) names are concatinated >+* e.g. 'validateconnection' >+* - OS environment variables are in ALLCAPS and have 'env' as a prefix >+* e.g. ${env.XXX}. >+* - Ant properties are lower case. >+* >+* Contributors: >+* yipzhao - initial implementation >+#******************************************************************************/--> >+ >+<!-- This ant project includes the following tasks: >+ - websphere-install : adds jars >+ - websphere-setup : removes and creates datasource and shared library >+ - websphere-start : starts server >+ - websphere-stop : stops server >+ - websphere-deploy : deploys ear >+ - websphere-undeploy : undeploys ear >+ >+ websphere-setup will remove the datasource and shared library and recreate those, so we don't have websphere-reset target. >+--> >+ >+<project name="Eclipse Persistence Services JPA WLS Testing" basedir="."> >+ >+ <property name="env" environment="env" value="env"/> >+ <!-- Allows a user to overide certain user specific properties. --> >+ <property file="${user.home}/websphere.properties"/> >+ <property file="./test.properties"/> >+ <property file="./websphere.properties"/> >+ >+ <!-- This copy junit.jar to WebSphere server lib/ext. --> >+ <target name="websphere-install"> >+ <copy file="${junit.lib}" todir="${was.home}/lib/ext"/> >+ </target> >+ >+ <!-- Start the server. --> >+ <target name="websphere-start"> >+ <echo message="WebSphere Server is Starting......"/> >+ <exec executable="${was.home}/bin/startServer.${suffix}"> >+ <arg value="server1"/> >+ </exec> >+ <echo message="Finish Starting WebSphere Server."/> >+ </target> >+ >+ <!-- >+ This target is to create datasource, shared library for running JPA tests on the WebSphere server. >+ Note: WebSphere server must be running. >+ --> >+ <target name="websphere-setup"> >+ <echo message="*****Config WebSphere Server*****"/> >+ <copy overwrite="true" file="configWebSphere.py" tofile="${was.home}/bin/configWebSphere.py"/> >+ <replace file="${was.home}/bin/configWebSphere.py" token="%%oracleDriver%%" value="${jdbc.driver.jar}"/> >+ <replace file="${was.home}/bin/configWebSphere.py" token="%%hostName%%" value="${instance.host}"/> >+ <replace file="${was.home}/bin/configWebSphere.py" token="%%dbUser%%" value="${db.user}"/> >+ <replace file="${was.home}/bin/configWebSphere.py" token="%%dbPassword%%" value="${db.pwd}"/> >+ <replace file="${was.home}/bin/configWebSphere.py" token="%%dbURL%%" value="${db.url}"/> >+ <replace file="${was.home}/bin/configWebSphere.py" token="%%eclipselinkLibDir%%" value="${eclipselink.jar.dir}"/> >+ <sleep seconds="20"/> >+ <exec executable="${was.home}/bin/wsadmin.${suffix}"> >+ <arg line="-lang jython -f ${was.home}/bin/configWebSphere.py"/> >+ </exec> >+ </target> >+ >+ <!-- Stop the server. --> >+ <target name="websphere-stop"> >+ <echo message="WebSphere Server is Stopping......"/> >+ <exec executable="${was.home}/bin/stopServer.${suffix}"> >+ <arg value="server1"/> >+ </exec> >+ <echo message="Finish Stopping WebSphere Server."/> >+ </target> >+ >+ <!-- >+ Deploy the application ear to the server. >+ Note: WebSphere server must be running. >+ --> >+ <target name="websphere-deploy"> >+ <echo message="*****Deploy ${application.name} on WebSphere Server*****"/> >+ <copy overwrite="true" file="installApps.py" tofile="${was.home}/bin/installApps.py"/> >+ <replace file="${was.home}/bin/installApps.py" token="%%appName%%" value="${application.name}"/> >+ <replace file="${was.home}/bin/installApps.py" token="%%ear%%" value="${application.name}.ear"/> >+ <sleep seconds="20"/> >+ <exec executable="${was.home}/bin/wsadmin.${suffix}"> >+ <arg line="-lang jython -f ${was.home}/bin/installApps.py"/> >+ </exec> >+ </target> >+ >+ <!-- >+ Undeploy the application ear to the server. >+ Note: WebSphere server must be running. >+ --> >+ <target name="websphere-undeploy"> >+ <echo message="*****Undeploy ${application.name} on WebSphere Server*****"/> >+ <copy overwrite="true" file="unInstallApps.py" tofile="${was.home}/bin/unInstallApps.py"/> >+ <replace file="${was.home}/bin/unInstallApps.py" token="%%appName%%" value="${application.name}"/> >+ <sleep seconds="20"/> >+ <exec executable="${was.home}/bin/wsadmin.${suffix}"> >+ <arg line="-lang jython -f ${was.home}/bin/unInstallApps.py"/> >+ </exec> >+ </target> >+ >+</project>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 238842
:
106118
|
106143
|
107230
|
108566