blob: fa83182e8bae81221ce72befb5012316f9a5ff25 [file] [log] [blame]
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Copyright (c) 2018, 2020 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
-->
<!-- Security Testsuite - BankAdmin app - ported from RI1.4 -->
<!-- Author: jagadesh.munta@sun.com -->
<!DOCTYPE project [
<!ENTITY commonSetup SYSTEM "file:./../../../../config/properties.xml">
<!ENTITY commonBuild SYSTEM "file:./../../../../config/common.xml">
<!ENTITY commonRun SYSTEM "file:./../../../../config/run.xml">
<!ENTITY testProperties SYSTEM "./build.properties">
]>
<project name="bankadmin" default="usage" basedir=".">
&commonSetup;
&commonBuild;
&commonRun;
&testProperties;
<target name="all" depends="init-common">
<antcall target="setup"/>
<antcall target="restart-server"/>
<ant antfile="build.xml" dir="daomanager" target="all" />
<antcall target="unsetup"/>
</target>
<!-- run-test target added to have setup/unsetup commonly -->
<target name="run-test" depends="init-common">
<ant antfile="build.xml" dir="daomanager" target="run-test" />
</target>
<!--
Quick look test run for integrating with top level for running subset of tests.
-->
<target name="quick-look" depends="init-common,setup">
<ant antfile="build.xml" dir="daomanager" target="all" />
<ant antfile="build.xml" dir="daomanager" target="undeploy" />
<antcall target="clean-db"/>
</target>
<target name="usage">
<!--<antcall target="usage-common"/> -->
<echo message="=============================================="/>
<echo message="****** Security Testsuite (BankAdmin App) *****"/>
<echo message="Standard Commands:"/>
<echo message="ant quick-look -->build,deploy,setup and run a single test, daomanager from bankapp"/>
<echo message="ant all -->build,deploy,setup and run the testsuite"/>
<echo message=" "/>
<echo message="Optional Commands:"/>
<echo message="ant setup -->Does the serverside config"/>
<echo message="ant restart-server -->Restarts appserver"/>
<echo message="ant create-file-users-->Creates security file realm users/groups"/>
<echo message="ant create-jmsresource -->Configures all the required jms resources"/>
<echo message="ant config-db -->Configures the DB"/>
<echo message="=============================================="/>
</target>
<target name="clean" depends="init-common">
<ant antfile="build.xml" dir="daomanager" target="clean" />
<!--
<ant antfile="build.xml" dir="sessionmanager" target="clean" />
<ant antfile="build.xml" dir="mesgprovider" target="clean" />
-->
<antcall target="clean-db"/>
</target>
<target name="build">
<ant antfile="build.xml" dir="daomanager" target="build" />
<!--
<ant antfile="build.xml" dir="sessionmanager" target="build" />
<ant antfile="build.xml" dir="mesgprovider" target="build" />
-->
</target>
<target name="deploy">
<ant antfile="build.xml" dir="daomanager" target="deploy" />
<!--
<ant antfile="build.xml" dir="sessionmanager" target="deploy" />
<ant antfile="build.xml" dir="mesgprovider" target="deploy" />
-->
</target>
<target name="undeploy">
<ant antfile="build.xml" dir="daomanager" target="undeploy" />
<!--
<ant antfile="build.xml" dir="sessionmanager" target="undeploy" />
<ant antfile="build.xml" dir="mesgprovider" target="undeploy" />
-->
</target>
<target name="run" depends="init-common">
<ant antfile="build.xml" dir="daomanager" target="run" />
<!--
<ant antfile="build.xml" dir="sessionmanager" target="run" />
<ant antfile="build.xml" dir="mesgprovider" target="run" />
-->
</target>
<!-- unsetup all the resources -->
<target name="unsetup" depends="init-common">
<antcall target="delete-file-users"/>
<antcall target="delete-jmsresources"/>
<antcall target="undeploy-jdbc-common"/>
<antcall target="delete-persistence-resource-common"/>
<antcall target="clean-db"/>
<antcall target="reconfig-common"/>
</target>
<target name="delete-users" depends="init-common">
<exec executable="${ASADMIN}" failonerror="false">
<arg line="delete-file-user"/>
<arg line="${as.props}"/>
<arg line="--instance ${appserver.instance.name}"/>
<arg line="deepa"/>
</exec>
<exec executable="${ASADMIN}" failonerror="false">
<arg line="delete-file-user"/>
<arg line="${as.props}"/>
<arg line="--instance ${appserver.instance.name}"/>
<arg line="scott"/>
</exec>
</target>
<!--delete all the jms resources -->
<target name="delete-jmsresources" depends="init-common">
<antcall target="undeploy-jms-common">
<param name="jms.factory.name" value="jms/QueueConnectionFactory"/>
<param name="dest.name" value="adminQueue"/>
<param name="jms.resource.name" value="jms/adminQueue"/>
</antcall>
<antcall target="undeploy-jms-common">
<param name="jms.factory.name" value="jms/MyQueueConnectionFactory"/>
<param name="dest.name" value="MyQueue"/>
<param name="jms.resource.name" value="jms/MyQueue"/>
</antcall>
</target>
<target name="delete-jmsresources-local" depends="init-common">
<exec executable="${ASADMIN}" failonerror="false">
<arg line="delete-jms-resource"/>
<arg line="${as.props}"/>
<arg line="--instance ${appserver.instance.name}"/>
<arg line="jms/adminQueue"/>
</exec>
<exec executable="${ASADMIN}" failonerror="false">
<arg line="delete-jms-resource"/>
<arg line="${as.props}"/>
<arg line="--instance ${appserver.instance.name}"/>
<arg line="jms/MyQueue"/>
</exec>
<exec executable="${ASADMIN}" failonerror="false">
<arg line="delete-jms-resource"/>
<arg line="${as.props}"/>
<arg line="--instance ${appserver.instance.name}"/>
<arg line="jms/QueueConnectionFactory"/>
</exec>
<exec executable="${ASADMIN}" failonerror="false">
<arg line="delete-jms-resource"/>
<arg line="${as.props}"/>
<arg line="--instance ${appserver.instance.name}"/>
<arg line="jms/MyQueueConnectionFactory"/>
</exec>
<exec executable="${ASADMIN}" failonerror="false">
<arg line="delete-jmsdest"/>
<arg line="${as.props}"/>
<arg line="--instance ${appserver.instance.name}"/>
<arg line="--desttype jakarta.jms.Queue"/>
<arg line="MyQueue"/>
</exec>
<exec executable="${ASADMIN}" failonerror="false">
<arg line="delete-jmsdest"/>
<arg line="${as.props}"/>
<arg line="--instance ${appserver.instance.name}"/>
<arg line="--desttype jakarta.jms.Queue"/>
<arg line="adminQueue"/>
</exec>
</target>
<!--target for creating the file users -->
<target name="create-file-users" depends="init-common">
<antcall target="create-user-common">
<param name="user" value="scott"/>
<param name="password" value="j2ee"/>
<param name="groups" value="ejb-test"/>
</antcall>
<antcall target="create-user-common">
<param name="user" value="deepa"/>
<param name="password" value="deepa"/>
<param name="groups" value="staff"/>
</antcall>
</target>
<!--target for deleting the file users -->
<target name="delete-file-users" depends="init-common">
<antcall target="delete-user-common">
<param name="user" value="scott"/>
<param name="groups" value="ejb-test"/>
</antcall>
<antcall target="delete-user-common">
<param name="user" value="deepa"/>
<param name="groups" value="staff"/>
</antcall>
</target>
<!-- Create all the required JMS resources using common target -->
<target name="create-jmsresources" depends="init-common">
<antcall target="deploy-jms-common">
<param name="jms.factory.type" value="jakarta.jms.QueueConnectionFactory"/>
<param name="jms.factory.name" value="jms/QueueConnectionFactory"/>
<param name="dest.type" value="queue" />
<param name="dest.name" value="adminQueue"/>
<param name="jms.resource.type" value="jakarta.jms.Queue"/>
<param name="jms.resource.name" value="jms/adminQueue"/>
</antcall>
<antcall target="deploy-jms-common">
<param name="jms.factory.type" value="jakarta.jms.QueueConnectionFactory"/>
<param name="jms.factory.name" value="jms/MyQueueConnectionFactory"/>
<param name="dest.type" value="queue" />
<param name="dest.name" value="MyQueue"/>
<param name="jms.resource.type" value="jakarta.jms.Queue"/>
<param name="jms.resource.name" value="jms/MyQueue"/>
</antcall>
</target>
<!-- Target for creating the db and configuration of db" -->
<target name="config-db">
<antcall target="execute-sql-common">
<param name="sql.file" value="sql/bankadmin_pointbase.sql"/>
</antcall>
</target>
<!-- Target for creating the db" -->
<target name="create-db" depends="init-common">
<echo message="Creating the sample db - ${db.url}"/>
<exec executable="${db.root}/client_tools/PB_Commander.sh">
<arg line="${db.driver}"/>
<arg line="${db.url}"/>
<!--<arg line="${db.home},create=force"/>-->
<arg line="${db.user}"/>
<arg line="${db.pwd}"/>
</exec>
</target>
<!-- Setup and Restart the server -->
<target name="restart-server" depends="init-common">
<echo message="Restarting the AppServer instance..."/>
<antcall target="restart-server-instance-common"/>
</target>
<!-- creating the outfile with zero size to have the file during jdbc setup -->
<target name="init" depends="init-common">
<mkdir dir="${build.classes.dir}"/>
<touch file="${build.classes.dir}/setupDBTables.out"/>
</target>
<target name="setup"
depends="init,create-file-users,create-jmsresources,deploy-jdbc-common,create-persistence-resource-common,reconfig-common,config-db">
<mkdir dir="${build.classes.dir}"/>
<echo message="Configured the security file realm, jms resources, jdbc resources, populating db, restarting the server...done"/>
</target>
<target name="setup-norestart"
depends="init,create-file-users,create-jmsresources,deploy-jdbc-common,create-persistence-resource-common,config-db">
<mkdir dir="${build.classes.dir}"/>
<echo message="Configured the security file realm, jms resources, jdbc resources, populating db...done"/>
</target>
<!--
Clean the DB
-->
<target name="clean-db" depends="init-common,create-dboutfile">
<antcall target="execute-sql-common">
<param name="sql.file" value="sql/bankadmin_drop_pointbase.sql"/>
</antcall>
</target>
<!--
Create the outfile before executing the sql
-->
<target name="create-dboutfile" depends="init-common">
<mkdir dir="${build.classes.dir}"/>
<touch file="${build.classes.dir}/setupDBTables.out"/>
</target>
</project>