text: <?xml version="1.0"?>
  <!DOCTYPE project [
  <!--
  
      Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
  
      This program and the accompanying materials are made available under the
      terms of the Eclipse Public License v. 2.0, which is available at
      http://www.eclipse.org/legal/epl-2.0.
  
      This Source Code may also be made available under the following Secondary
      Licenses when the conditions for such availability set forth in the
      Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
      version 2 with the GNU Classpath Exception, which is available at
      https://www.gnu.org/software/classpath/license.html.
  
      SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
  
  -->
  
  <!ENTITY commonSetup SYSTEM "./../../../../config/common.xml">
  <!ENTITY commonBuild SYSTEM "./../../../../config/properties.xml">
  <!ENTITY testproperties SYSTEM "./build.properties">
  ]>
  
  <project name="EnvEntryScope" basedir="." default="usage">
  
    &commonSetup;
    &commonBuild;
    &testproperties;
  
      
    <target name="all" depends="build,setup-jdbc,setup-sql,deploy,runweb,undeploy,cleanup-jdbc,cleanup-sql"/>
    
    <target name="clean" depends="init-common">
      <delete dir="${build.classes.dir}"/>
      <delete dir="${assemble.dir}"/>
    </target>
    
    <target name="compile" depends="clean">
      <antcall target="compile-common">
        <param name="src" value="ejb"/>
      </antcall>
  
      <antcall target="compile-common">
        <param name="src" value="servlet"/>
      </antcall>
   </target>
  <!--
    <target name="compile-servlet" depends="init-common">
      <antcall target="compile-common">
        <param name="src" value="ejb"/>
      </antcall>
  
      <antcall target="compile-common">
        <param name="src" value="servlet"/>
      </antcall>
    </target>
  -->  
    <!--
    <target name="build" depends="compile">
      <antcall target="build-ear-war"/>
    </target>
    -->
    <target name="build" depends="compile">
      <antcall target="ejb-jar-common">
        <param name="ejbjar.classes" value="**/*.class"/>
      </antcall>
      <antcall target="package-war-local">
        <param name="war.classes" value="${build.classes.dir}"/>
        <param name="war.file" value="${assemble.dir}/${appname}-web.war"/>
      </antcall>
      <antcall target="ear-common"/>
    </target>
  
    <target name="package-war-local" >
    <!--
      <delete dir="${build.classes.dir}"/>
      <mkdir dir="${build.classes.dir}"/>
      <antcall target="compile-servlet"/>
    -->  
      <echo message="my build classes dir is:${build.classes.dir}"/>
      <delete file="${war.file}"/>
      <mkdir dir="${build.classes.dir}/tmp"/>
      <mkdir dir="${build.classes.dir}/tmp/WEB-INF"/>
      <mkdir dir="${build.classes.dir}/tmp/WEB-INF/classes"/>
      <copy file="${sun-web.xml}"
        tofile="${build.classes.dir}/tmp/WEB-INF/sun-web.xml" failonerror="false"/>
      <copy file="${web.xml}"
        tofile="${build.classes.dir}/tmp/WEB-INF/web.xml"/>
      <copy todir="${build.classes.dir}/tmp/WEB-INF/classes">
      <fileset dir="${war.classes}">
        <include name="**/*.class"/>
      </fileset>
      </copy>
      <echo message="Creating war file ${war.file}"/>
      <jar jarfile="${war.file}" update="true">
        <fileset dir="${build.classes.dir}/tmp/" casesensitive="true">
          <include name="WEB-INF/web.xml"/>
          <include name="WEB-INF/sun-web.xml"/>
          <include name="WEB-INF/**/bmservlet*.class"/>
        </fileset>
      </jar>
      <echo message="created war file ${war.file}"/>
      <delete dir="${build.classes.dir}/tmp/WEB-INF" failonerror="false"/>
    </target>
    
    <target name="build-ear-war" depends="ejb-jar-common">
      <antcall target="package-war-local">
        <param name="war.classes" value="${build.classes.dir}"/>
        <param name="war.file" value="${assemble.dir}/${appname}-web.war"/>
      </antcall>
      <delete file="${assemble.dir}/${appname}.ear"/>
      <mkdir dir="${assemble.dir}"/>
      <mkdir dir="${assemble.dir}/META-INF"/>
      <mkdir dir="${assemble.dir}/lib"/>
      <copy file="${sun-application.xml}"
        tofile="${assemble.dir}/META-INF/sun-application.xml"
        failonerror="false"/>
      <ear earfile="${assemble.dir}/${appname}App.ear" appxml="${application.xml}">
        <fileset dir="${assemble.dir}" 
          includes="*.jar,*.war,META-INF/sun-application.xml,lib/reporter.jar"/>
      </ear>
    </target>
  
    <target name="setup-jdbc" >
      <!--
      <antcall target="create-jdbc-xa-connpool-common" >
        <param name="db.url" value="${db.url2}"/>
        <param name="db.user" value="${db.user2}"/>
        <param name="db.pwd" value="${db.pwd2}"/>
        <param name="db.xaclass" value="${db.xaclass2}"/>
        <param name="db.name" value="${db.name2}"/>
        <param name="db.sid" value="${db.sid2}"/>
        <param name="db.host" value="${db.host2}"/>
        <param name="jdbc.conpool.name" value="jts-xa-pool2"/>
      </antcall>
      -->
      <antcall target="create-jdbc-oracle-xa-pool">
        <param name="poolname" value="jts-xa-pool2"/>
        <param name="ora.user" value="${ora.user2}"/>
        <param name="ora.pwd" value="${ora.pwd2}"/>
        <param name="ora.sid" value="${ora.sid2}"/>
        <param name="ora.url" value="${ora.url2}"/>
      </antcall>
  
      <antcall target="create-jdbc-resource-common" >
        <param name="jdbc.conpool.name" value="jts-xa-pool2"/>
        <param name="jdbc.resource.name" value="jdbc/oracleds2"/>
      </antcall> 
      
      <antcall target="create-jdbc-oracle-xa-pool" >
        <param name="poolname" value="jts-xa-pool1"/>
        <param name="ora.user" value="${ora.user1}"/>
        <param name="ora.pwd" value="${ora.pwd1}"/>
        <param name="ora.sid" value="${ora.sid1}"/>
        <param name="ora.url" value="${ora.url1}"/>
      </antcall>
      
      <antcall target="create-jdbc-resource-common" >
        <param name="jdbc.conpool.name" value="jts-xa-pool1"/>
        <param name="jdbc.resource.name" value="jdbc/oraclethird"/>
      </antcall>
    </target>
    
    <target name="cleanup-jdbc" >
      <antcall target="delete-jdbc-resource-common" >
        <param name="jdbc.resource.name" value="jdbc/oracleds2"/>
      </antcall>
  
      <antcall target="delete-jdbc-resource-common" >
        <param name="jdbc.resource.name" value="jdbc/oraclethird"/>
      </antcall>
      
      <antcall target="delete-jdbc-connpool-common" >
        <param name="jdbc.conpool.name" value="jts-xa-pool2"/>
      </antcall>
      
      <antcall target="delete-jdbc-connpool-common" >
        <param name="jdbc.conpool.name" value="jts-xa-pool1"/>
      </antcall>
    </target>
    
    <target name="setup-sql" >
      <echo message="Executing sql statement at from ${create.sql.file1}"/>
      <sql
        driver="${db.driver}"
        url="${ora.url1}"
        userid="${ora.user1}"
        password="${ora.pwd1}"
        src="${create.sql.file1}"
        onerror="continue"
        print="yes"
        classpath="${dbdriver.classpath}"/>
      
      <echo message="Executing sql statement at from ${create.sql.file2}"/>
      <sql
        driver="${db.driver}"
        url="${ora.url2}"
        userid="${ora.user2}"
        password="${ora.pwd2}"
        src="${create.sql.file2}"
        onerror="continue"
        print="yes"
        classpath="${dbdriver.classpath}"/>
  
    </target>
  
    <target name="cleanup-sql" depends="init-common">
      <echo message="Executing sql statement at from ${drop.sql.file1}"/>
      <sql
        driver="${db.driver}"
        url="${ora.url1}"
        userid="${ora.user1}"
        password="${ora.pwd1}"
        src="${drop.sql.file1}"
        onerror="continue"
        print="yes"
        classpath="${dbdriver.classpath}"/>
      
      <echo message="Executing sql statement at from ${drop.sql.file2}"/>
      <sql
        driver="${db.driver}"
        url="${ora.url2}"
        userid="${ora.user2}"
        password="${ora.pwd2}"
        src="${drop.sql.file2}"
        onerror="continue"
        print="yes"
        classpath="${dbdriver.classpath}"/>
  
    </target>
    
    <target name="deploy" depends="init-common">
      <antcall target="deploy-common"/>
    </target>
    
    
    <target name="undeploy" depends="init-common">
      <antcall target="undeploy-common"/>
    </target>
    
    <target name="usage">
      <antcall target="usage-common"/>
    </target>
    
    <!-- 
    Tomcat's GTest tool for webtests
    -->
    <target name="runweb" depends="init-common">
      <taskdef name="gtest" classname="org.apache.tomcat.task.GTest" 
          classpath="${env.APS_HOME}/lib/testdriversecurity.jar:${env.APS_HOME}/lib/commons-logging.jar"/>
      <property name="wgdir" value="${env.APS_HOME}/devtests/jdbc/transactions/test2"/>
      <gtest request="GET /txnstatus-test2/bmservlet HTTP/1.0" 
        debug="9"
        firstTask="true"
        lastTest="true"
        lastCase="true"
        lastTask="true"
        host="${http.host}"
        port="${http.port}"
        resultFileName="${env.APS_HOME}/as7-jts-results.xml"
        testSession="jts-as7-timeout-test1"
        goldenFile="${env.APS_HOME}/devtests/jdbc/transactions/test2/GoldenFile.html"
        testSuiteId="txnstatus-test2"
        testSuiteName="txnstatus-test2"
        testSuiteDescription="txnstatus-test2"
        testId="txnstatus-test2"
        testName="txnstatus-test2"
        testDescription="txnstatus-test2"
        testCaseId="txnstatus-test2"
        testCaseName="txnstatus-test2"
        testCaseDescription="txnstatus-test2"
        testStrategy="txnstatus-test2"/>
    </target>  
  
    <target name="create-jdbc-oracle-xa-pool" depends="init-common">
      <antcall target="create-jdbc-connpool-common" >
        <param name="jdbc.resource.type" value="javax.sql.XADataSource"/>
        <param name="jdbc.conpool.name" value="${poolname}"/>
        <param name="db.class" value="${ora.xaclass}"/>
        <param name="db.user" value="${ora.user}"/>
        <param name="db.pwd" value="${ora.pwd}"/>
        <param name="db.url" value="${ora.sid}"/>
      </antcall>
  
      <antcall target="asadmin-common">
        <param name="admin.command" value="set"/>
        <param name="operand.props" value="${resources.dottedname.prefix}.jdbc-connection-pool.${poolname}.property.URL=${ora.url}"/>
      </antcall>
    </target>
  
  </project>
  