| <!--/******************************************************************************* | |
| * 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: | |
| * 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://localhost: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"/> | |
| <!-- WebLogic ant tasks --> | |
| <taskdef name="wlserver" classname="weblogic.ant.taskdefs.management.WLServer"> | |
| <classpath> | |
| <pathelement location="${weblogic.home}/lib/weblogic.jar"/> | |
| </classpath> | |
| </taskdef> | |
| <taskdef name="wlconfig" classname="weblogic.ant.taskdefs.management.WLConfig"> | |
| <classpath> | |
| <pathelement location="${weblogic.home}/lib/weblogic.jar"/> | |
| </classpath> | |
| </taskdef> | |
| <taskdef name="wldeploy" classname="weblogic.ant.taskdefs.management.WLDeploy"> | |
| <classpath> | |
| <pathelement location="${weblogic.home}/lib/weblogic.jar"/> | |
| </classpath> | |
| </taskdef> | |
| <!-- This creates the server domain. --> | |
| <target name="weblogic-install"> | |
| <delete dir="${weblogic.domain}"/> | |
| <mkdir dir="${weblogic.domain}"/> | |
| <antcall target="weblogic-start-nosleep" inheritRefs="true"/> | |
| <copy file="${junit.lib}" todir="${weblogic.domain}/lib"/> | |
| <copy file="${eclipselink.jar.name}" todir="${weblogic.domain}/lib"/> | |
| <copy file="${jdbc.driver.jar}" todir="${weblogic.domain}/lib"/> | |
| <antcall target="weblogic-stop" inheritRefs="true"/> | |
| </target> | |
| <!-- Start the server. --> | |
| <target name="weblogic-start" depends="weblogic-start-nosleep"> | |
| <sleep hours="2"/> | |
| </target> | |
| <target name="weblogic-start-nosleep"> | |
| <wlserver fork="true" spawn="true" weblogichome="${weblogic.home}" | |
| dir="${weblogic.domain}" host="localhost" generateConfig="true" verbose="true" | |
| username="${server.user}" password="${server.pwd}" action="start"> | |
| <classpath> | |
| <fileset dir="${server.lib}" includes="${server.depend}"/> | |
| <pathelement location="${env.JAVA_HOME}/lib/tools.jar"/> | |
| </classpath> | |
| <jvmarg value="-Xms512m"/> | |
| <jvmarg value="-Xmx960m"/> | |
| <!--jvmarg value="-Xdebug"/--> | |
| <!--jvmarg value="-Xnoagent"/--> | |
| <!--jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=4000"/--> | |
| <!--sysproperty key="http.proxyHost" value="www-proxy.us.oracle.com"/--> | |
| <!--sysproperty key="http.proxyPort" value="80"/--> | |
| <sysproperty key="eclipselink.logging.level" value="${logging.level}"/> | |
| </wlserver> | |
| </target> | |
| <!-- | |
| This target is to create connection pool and managed datasource required for running JPA tests on the WLS server. | |
| Note: WLS server must be running. | |
| --> | |
| <target name="weblogic-setup"> | |
| <wlconfig url="${server.url}" username="${server.user}" password="${server.pwd}"> | |
| <query domain="mydomain" type="Server" name="myserver" | |
| property="myserver"/> | |
| <create type="JDBCConnectionPool" name="ejbPool"> | |
| <set attribute="CapacityIncrement" value="2"/> | |
| <set attribute="DriverName" value="${db.driver}"/> | |
| <set attribute="InitialCapacity" value="1"/> | |
| <set attribute="MaxCapacity" value="50"/> | |
| <set attribute="Password" value="${db.pwd}"/> | |
| <set attribute="Properties" value="user=${db.user}"/> | |
| <set attribute="URL" value="${db.url}"/> | |
| <set attribute="Targets" value="${myserver}"/> | |
| </create> | |
| <create type="JDBCTxDataSource" name="EclipseLinkDS"> | |
| <set attribute="JNDIName" value="jdbc/EclipseLinkDS"/> | |
| <set attribute="PoolName" value="ejbPool"/> | |
| <set attribute="Targets" value="${myserver}"/> | |
| </create> | |
| </wlconfig> | |
| </target> | |
| <!-- | |
| This target is to remove the connection pool and managed datasource created by target <weblogic-setup> | |
| Note: WLS server must not be running. | |
| --> | |
| <target name="weblogic-reset"> | |
| <wlconfig url="${server.url}" username="${server.user}" password="${server.pwd}"> | |
| <query domain="mydomain" type="JDBCDataSource" name="EclipseLinkDS"> | |
| <delete/> | |
| </query> | |
| <query domain="mydomain" type="JDBCConnectionPool" name="ejbPool"> | |
| <delete/> | |
| </query> | |
| </wlconfig> | |
| </target> | |
| <!-- Stop the server. --> | |
| <target name="weblogic-stop"> | |
| <wlserver fork="true" failonerror="true" weblogichome="${weblogic.home}" | |
| dir="${weblogic.domain}" host="localhost" | |
| username="${server.user}" password="${server.pwd}" action="shutdown"> | |
| </wlserver> | |
| </target> | |
| <!-- | |
| Deploy the application ear to the server. | |
| Note: WLS server must be running. | |
| --> | |
| <target name="weblogic-deploy"> | |
| <wldeploy action="deploy" | |
| name="${application.name}" source="${ear.name}" | |
| user="${server.user}" password="${server.pwd}" | |
| adminurl="${server.url}" | |
| failonerror="false"> | |
| </wldeploy> | |
| </target> | |
| <!-- | |
| Undeploy the application ear to the server. | |
| Note: WLS server must be running. | |
| --> | |
| <target name="weblogic-undeploy"> | |
| <wldeploy action="undeploy" name="${application.name}" | |
| user="${server.user}" password="${server.pwd}" | |
| adminurl="${server.url}" | |
| failonerror="false"> | |
| </wldeploy> | |
| </target> | |
| </project> |