| <!--/******************************************************************************* |
| * 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 '.' |
| * - properties ending in .jar define jarfile names only (no path) |
| * - properties ending in .lib are fully qualified jars (path and filename) |
| * - properties ending in .dir are directory paths |
| * - properties ending in .path are path refid names (classpath fragments) |
| * - multi-word targets use hyphens '-' |
| * - targets beginning with test- are reserved for high level test targets, |
| * and are used in test results parsing |
| * - targets typically use the form <action>-<object>-<type> (ie. package-bundle-zip) |
| * - multi-word macros use underscores '_' |
| * - multi-word macro attributes are concatenated |
| * e.g. 'runpathref' |
| * - multi-word tasks (taskdef) names are concatenated |
| * 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: |
| * tware - initial API and implementation |
| #******************************************************************************/--> |
| |
| <!-- This ant project includes the following tasks: |
| - weblogic-install : recreates server and adds jars |
| - weblogic-setup : creates connection pool |
| - weblogic-reset : removes connection pool |
| - weblogic-start : starts server |
| - weblogic-stop : stops server |
| - weblogic-deploy : deploys ear |
| - weblogic-undeploy : undeploys ear |
| |
| It requires some configuration of the weblogic.properties, it should be run through build.xml, not directly. |
| Also weblogic may require using the JRockit JVM, which can be setup through the setEnv.sh. |
| You may need to copy the /resouces/weblogic/jaxp.properties file to your JRockit JVM jre/lib directory to allow the ant junit task to work correctly, |
| (this may cause issues with weblogic starting, so you may need to do this after you start your server). |
| To connect to the weblogic admin console use http://${weblogic.host}:7001/console, this may be useful for debugging deployment failures. |
| Sometimes if a test or deployment fails, you server gets screwed up and you need to re-install your domain (ant server.install). |
| --> |
| |
| <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}/weblogic.properties"/> |
| <property file="./test.properties"/> |
| <property file="./weblogic.properties"/> |
| <property name="eclipselink.lib" value="../../${eclipselink.jar}"/> |
| <property name="temp.dir" value="temp"/> |
| |
| <!-- This checks if the tests are run on Derby database --> |
| <condition property="is.derby"> |
| <contains string="${db.driver}" substring="derby"/> |
| </condition> |
| |
| <condition property="is.v1030"> |
| <contains string="${server.version}" substring="10.3.0"/> |
| </condition> |
| |
| <condition property="WLS_SETUP_PY" value="wls_exalogic_setup.py" else="wls_setup.py"> |
| <contains string="${server.version}" substring="exalogic"/> |
| </condition> |
| |
| <path id="wls.path"> |
| <pathelement location="${weblogic.home}/lib/weblogic.jar"/> |
| </path> |
| |
| <!-- This replaces URL in JAX-RS testcases --> |
| <target name="weblogic-jaxrsconfig"> |
| <property name="jaxrs-url" value="${weblogic.host}:${weblogic.port}"/> |
| <replace file="${jpatest.basedir}/${src.dir}/org/eclipse/persistence/testing/tests/jpa/jaxrs/DefaultJAXBContextTestCases.java" token='%%host:port%%' value="${jaxrs-url}"/> |
| <replace file="${jpatest.basedir}/${src.dir}/org/eclipse/persistence/testing/tests/jpa/jaxrs/ContextResolverTestCases.java" token='%%host:port%%' value="${jaxrs-url}"/> |
| <replace file="${jpatest.basedir}/${src.dir}/org/eclipse/persistence/testing/tests/jpa/jaxrs/MessageBodyReaderWriterTestCases.java" token='%%host:port%%' value="${jaxrs-url}"/> |
| <replace file="${jpatest.basedir}/resource/eclipselink-jaxrs-model/server/persistence.xml" token='%%server-platform%%' value="${server.platform}"/> |
| </target> |
| |
| <!-- This creates the server domain. --> |
| <target name="weblogic-install"> |
| <delete dir="${weblogic.domain}"/> |
| <delete> |
| <fileset dir="." includes="std*.log"/> |
| </delete> |
| <delete dir="${jpatest.basedir}/${temp.dir}"/> |
| <mkdir dir="${jpatest.basedir}/${temp.dir}"/> |
| <antcall target="pass-weblogic-and-database-info" inheritRefs="true"/> |
| <java classname="weblogic.WLST" fork="yes"> |
| <arg line="${jpatest.basedir}/${temp.dir}/wls_install.py"/> |
| <classpath> |
| <path refid="wls.path"/> |
| </classpath> |
| </java> |
| <copy todir="${weblogic.domain}/lib" flatten="true"> |
| <path> |
| <pathelement path="${junit.lib}"/> |
| </path> |
| </copy> |
| <antcall target="copy-eclipselink-jar-to-domain-lib" inheritRefs="true"/> |
| <antcall target="copy-jdbc-driver-jar-to-domain-lib" inheritRefs="true"/> |
| </target> |
| |
| <target name="copy-jdbc-driver-jar-to-domain-lib" if="is.derby"> |
| <copy file="${jdbc.driver.jar}" todir="${weblogic.domain}/lib"/> |
| </target> |
| |
| <target name="copy-eclipselink-jar-to-domain-lib" if="is.v1030"> |
| <copy file="${eclipselink.lib}" todir="${weblogic.domain}/lib"/> |
| </target> |
| |
| <target name="pass-weblogic-and-database-info"> |
| <copy todir="${jpatest.basedir}/${temp.dir}" overwrite="true"> |
| <fileset dir="${jpatest.basedir}/resource/weblogic" includes="*.py"/> |
| </copy> |
| <replace dir="${jpatest.basedir}/${temp.dir}"> |
| <include name="**/*.py"/> |
| <replacefilter token="%%WL_HOME%%" value="${weblogic.installdir}"/> |
| <replacefilter token="%%WL_HOST%%" value="${weblogic.host}"/> |
| <replacefilter token="%%WL_PORT%%" value="${weblogic.port}"/> |
| <replacefilter token="%%WL_USR%%" value="${server.user}"/> |
| <replacefilter token="%%WL_PWD%%" value="${server.pwd}"/> |
| <replacefilter token="%%WL_DOMAIN%%" value="${weblogic.domain}"/> |
| <replacefilter token="%%DOMAIN_NAME%%" value="${domain.name}"/> |
| <replacefilter token="%%TARGET_SERVER%%" value="${target.server}"/> |
| <replacefilter token="%%DBDRV%%" value="${db.driver}"/> |
| <replacefilter token="%%DBURL%%" value="${db.url}"/> |
| <replacefilter token="%%DBUSR%%" value="${db.user}"/> |
| <replacefilter token="%%DBPWD%%" value="${db.pwd}"/> |
| <replacefilter token="%%DB2DRV%%" value="${db2.driver}"/> |
| <replacefilter token="%%DB2URL%%" value="${db2.url}"/> |
| <replacefilter token="%%DB2USR%%" value="${db2.user}"/> |
| <replacefilter token="%%DB2PWD%%" value="${db2.pwd}"/> |
| <replacefilter token="%%DB3DRV%%" value="${db3.driver}"/> |
| <replacefilter token="%%DB3URL%%" value="${db3.url}"/> |
| <replacefilter token="%%DB3USR%%" value="${db3.user}"/> |
| <replacefilter token="%%DB3PWD%%" value="${db3.pwd}"/> |
| </replace> |
| </target> |
| |
| <!-- Start the server. --> |
| <target name="weblogic-start"> |
| <java classname="weblogic.WLST" fork="yes"> |
| <arg line="${jpatest.basedir}/${temp.dir}/wls_start.py"/> |
| <classpath> |
| <!--this path is used for WebLogic JPA2.0 support--> |
| <!--<pathelement path="${server.persistence20.lib}/${server.persistence20.jar}"/>--> |
| <fileset dir="${server.lib}" includes="${server.depend}"/> |
| <pathelement location="${env.JAVA_HOME}/lib/tools.jar"/> |
| </classpath> |
| <sysproperty key="eclipselink.logging.level" value="${logging.level}"/> |
| <sysproperty key="ejb.lookup" value="${ejb.lookup}"/> |
| <sysproperty key="is.JTA" value="${is.JTA}"/> |
| </java> |
| </target> |
| |
| <!-- This creates datasource and deploy to the server. --> |
| <target name="weblogic-setup"> |
| <antcall target="pass-weblogic-and-database-info" inheritRefs="true"/> |
| <antcall target="weblogic-datasource-setup" inheritRefs="true"/> |
| </target> |
| |
| <target name="weblogic-datasource-setup" depends="weblogic-derby-setup,weblogic-non-derby-setup"/> |
| |
| <!-- This creates datasource on derby and deploy to the server. --> |
| <target name="weblogic-derby-setup" if="is.derby"> |
| <echo message="WebLogic will run on Derby Database ......"/> |
| <java classname="weblogic.WLST" fork="yes"> |
| <arg line="${jpatest.basedir}/${temp.dir}/wls_derby_setup.py"/> |
| <classpath> |
| <path refid="wls.path"/> |
| </classpath> |
| </java> |
| </target> |
| |
| <!-- This creates datasource on non-derby database and deploy to the server. --> |
| <target name="weblogic-non-derby-setup" unless="is.derby"> |
| <java classname="weblogic.WLST" fork="yes"> |
| <arg line="${jpatest.basedir}/${temp.dir}/${WLS_SETUP_PY}"/> |
| <classpath> |
| <path refid="wls.path"/> |
| </classpath> |
| </java> |
| </target> |
| |
| <!-- Remove all datasources created by target <weblogic-setup> |
| Note: WLS server must be running.--> |
| <target name="weblogic-reset"> |
| <java classname="weblogic.WLST" fork="yes"> |
| <arg line="${jpatest.basedir}/${temp.dir}/wls_reset.py"/> |
| <classpath> |
| <path refid="wls.path"/> |
| </classpath> |
| </java> |
| </target> |
| |
| <!-- Set EclipseLink JPA as DefaultJPAProvider for wls. --> |
| <target name="weblogic-domain-setup"> |
| <antcall target="pass-weblogic-and-database-info" inheritRefs="true"/> |
| <java classname="weblogic.WLST" fork="yes"> |
| <arg line="${jpatest.basedir}/${temp.dir}/wls_domain_setup.py"/> |
| <classpath> |
| <path refid="wls.path"/> |
| </classpath> |
| </java> |
| </target> |
| |
| <!-- Set back openjpa as DefaultJPAProvider for wls server. --> |
| <target name="weblogic-domain-reset"> |
| <java classname="weblogic.WLST" fork="yes"> |
| <arg line="${jpatest.basedir}/${temp.dir}/wls_domain_reset.py"/> |
| <classpath> |
| <path refid="wls.path"/> |
| </classpath> |
| </java> |
| </target> |
| |
| <!-- Create three datasources aginst Oracle, DB2 and MySQL for running composite test models. --> |
| <target name="weblogic-composite-setup"> |
| <antcall target="pass-weblogic-and-database-info" inheritRefs="true"/> |
| <java classname="weblogic.WLST" fork="yes"> |
| <arg line="${jpatest.basedir}/${temp.dir}/wls_composite_setup.py"/> |
| <classpath> |
| <path refid="wls.path"/> |
| </classpath> |
| </java> |
| </target> |
| |
| <!-- Remove three datasources created for running composite test models. --> |
| <target name="weblogic-composite-reset"> |
| <java classname="weblogic.WLST" fork="yes"> |
| <arg line="${jpatest.basedir}/${temp.dir}/wls_composite_reset.py"/> |
| <classpath> |
| <path refid="wls.path"/> |
| </classpath> |
| </java> |
| </target> |
| |
| <!-- Stop the server. --> |
| <target name="weblogic-stop"> |
| <java classname="weblogic.WLST" fork="yes"> |
| <arg line="${jpatest.basedir}/${temp.dir}/wls_stop.py"/> |
| <classpath> |
| <path refid="wls.path"/> |
| </classpath> |
| </java> |
| </target> |
| |
| <!-- Deploy the application ear to the server. |
| Note: WLS server must be running. --> |
| <target name="weblogic-deploy"> |
| <property name="ear.dir" value="${jpatest.basedir}"/> |
| <property name="ear.name" value="${application.name}.ear"/> |
| <antcall target="pass-weblogic-and-database-info" inheritRefs="true"/> |
| <replace dir="${jpatest.basedir}/${temp.dir}"> |
| <include name="**/wls_*deploy.py"/> |
| <replacefilter token="%%appName%%" value="${application.name}"/> |
| <replacefilter token="%%testDir%%" value="${ear.dir}"/> |
| <replacefilter token="%%earName%%" value="${ear.name}"/> |
| </replace> |
| |
| <java classname="weblogic.WLST" fork="yes"> |
| <arg line="${jpatest.basedir}/${temp.dir}/wls_deploy.py"/> |
| <classpath> |
| <path refid="wls.path"/> |
| </classpath> |
| </java> |
| </target> |
| |
| <!-- Undeploy the application ear to the server. |
| Note: WLS server must be running. --> |
| <target name="weblogic-undeploy"> |
| <java classname="weblogic.WLST" fork="yes"> |
| <arg line="${jpatest.basedir}/${temp.dir}/wls_undeploy.py"/> |
| <classpath> |
| <path refid="wls.path"/> |
| </classpath> |
| </java> |
| </target> |
| |
| </project> |