| <?xml version="1.0"?> | |
| <!-- | |
| 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 | |
| --> | |
| <!DOCTYPE project [ | |
| <!ENTITY commonBuild SYSTEM "file:./../../annotations-common.xml"> | |
| <!ENTITY common SYSTEM "file:./../../../../config/common.xml"> | |
| ]> | |
| <project name="Hello" default="core" basedir="."> | |
| &commonBuild; | |
| <property name="src-name" value="endpoint/HelloImpl.java"/> | |
| <property name="client-src-name" value="client/Client.java"/> | |
| <property name="app-client-parameters" value="-xml ${env.S1AS_HOME}/domains/${admin.domain}/config/glassfish-acc.xml"/> | |
| <target name="all" depends="clean"> | |
| <antcall target="deploy"/> | |
| <basename file="${src-name}" property="server" suffix=".java"/> | |
| <condition property="deploy_succeeded"> | |
| <available file="${env.S1AS_HOME}/domains/domain1/autodeploy/${server}.jar_deployed"/> | |
| </condition> | |
| <condition property="deploy_failed"> | |
| <available file="${env.S1AS_HOME}/domains/domain1/autodeploy/${server}.jar_deployFailed"/> | |
| </condition> | |
| <fail message="Deployment failed" if="deploy_failed"/> | |
| <echo message="Deployment passed ${deploy_succeeded}"/> | |
| <echo message="ALL WEBSERVICE INVOCATION SHOULD FAIL..."/> | |
| <antcall target="run"> | |
| <param name="app-client-extra-parameters" value="-user nouser -password nopass"/> | |
| </antcall> | |
| <echo message="CREATING USERS..."/> | |
| <copy file="${admin.password.file}" tofile="./passwordfile" overwrite="true"/> | |
| <echo file="./passwordfile" append="true"> | |
| AS_ADMIN_USERPASSWORD=tester | |
| </echo> | |
| <exec executable="${env.S1AS_HOME}/bin/asadmin"> | |
| <arg line="create-file-user --port ${admin.port} --user ${admin.user} --passwordfile ./passwordfile --groups webservicetester --authrealmname file webservicetester"/> | |
| </exec> | |
| <copy file="${admin.password.file}" tofile="./passwordfile" overwrite="true"/> | |
| <echo file="./passwordfile" append="true"> | |
| AS_ADMIN_USERPASSWORD=tester2 | |
| </echo> | |
| <exec executable="${env.S1AS_HOME}/bin/asadmin"> | |
| <arg line="create-file-user --port ${admin.port} --user ${admin.user} --passwordfile ./passwordfile --groups webservicetester2 --authrealmname file webservicetester2"/> | |
| </exec> | |
| <antcall target="internal-run"> | |
| <param name="app-client-extra-parameters" value="-user nouser -password nopass webservicetester tester"/> | |
| </antcall> | |
| <antcall target="internal-run"> | |
| <param name="app-client-extra-parameters" value="-user nouser -password nopass webservicetester2 tester2 FAILURE"/> | |
| </antcall> | |
| <echo message="DELETING USERS..."/> | |
| <exec executable="${env.S1AS_HOME}/bin/asadmin"> | |
| <arg line="delete-file-user --port ${admin.port} --user ${admin.user} --passwordfile ${admin.password.file} --authrealmname file webservicetester"/> | |
| </exec> | |
| <exec executable="${env.S1AS_HOME}/bin/asadmin"> | |
| <arg line="delete-file-user --port ${admin.port} --user ${admin.user} --passwordfile ${admin.password.file} --authrealmname file webservicetester2"/> | |
| </exec> | |
| <antcall target="undeploy"/> | |
| </target> | |
| <target name="report-success"> | |
| <echo message="Test passed"/> | |
| </target> | |
| <target name="report-failure"> | |
| <echo message="Test failed"/> | |
| </target> | |
| </project> |