Skip to content

Commit

Permalink
Add support for running single tests to webservice and suspend
Browse files Browse the repository at this point in the history
Note that similar support has been added to e.g. cdi_all before.

Signed-off-by: Arjan Tijms <arjan.tijms@omnifish.ee>
  • Loading branch information
arjantijms committed May 10, 2023
1 parent 790f4b4 commit 4cf46cc
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 54 deletions.
53 changes: 43 additions & 10 deletions appserver/tests/appserv-tests/devtests/webservice/build.xml
Expand Up @@ -29,20 +29,26 @@
&commonBuild;
&reporting;

<target name="all">
<target name="all" xmlns:if="ant:if" xmlns:unless="ant:unless">
<echo message="@@## Running webservice developer tests ##@@" />
<echo unless:set="env.webservice" message="@@## Set environment variable 'webservice' to name of single test dir to run only that one. ##@@${line.separator}" />
<echo if:set="env.webservice" message="@@## environment variable 'webservice' set. Running only ${env.webservice} ##@@${line.separator}" />

<delete file="${env.APS_HOME}/test_results.html"/>
<delete file="${env.APS_HOME}/test_resultsValid.xml"/>
<delete file="${env.APS_HOME}/test_results.xml"/>
<delete dir="${env.APS_HOME}/build/module"/>
<record name="webservice.output" action="start" />
<delete dir="${env.APS_HOME}/build/module"/>
<ant dir="filter_urlhandling" target="all"/>
<!--ant dir="security" target="all"/-->
<ant dir="annotations" target="all"/>
<ant dir="ejb_annotations" target="all"/>
<ant dir="gf_dd/endpoint_address_uri" target="all"/>
<record name="webservice.output" action="stop" />
<antcall target="report"/>

<record name="webservice.output" action="start" />

<run-webservice-test path="filter_urlhandling"/>
<run-webservice-test path="annotations"/>
<run-webservice-test path="ejb_annotations"/>
<run-webservice-test path="gf_dd/endpoint_address_uri"/>

<record name="webservice.output" action="stop" />

<antcall target="report"/>
<antcall target="dev-report"/>
</target>

Expand All @@ -66,5 +72,32 @@
ant xsdany (Executes the xsdany tests)
</echo>
</target>

<macrodef name="run-webservice-test" xmlns:if="ant:if" xmlns:unless="ant:unless">
<attribute name="path" />
<sequential>
<local name="do-run-test" />
<condition property="do-run-test" else="false">
<or>
<equals arg1="${env.webservice}" arg2="@{path}" />
<not>
<isset property="env.webservice" />
</not>
</or>
</condition>

<sequential if:true="${do-run-test}">
<local name="absolute.path" />
<property name="absolute.path" location="@{path}" />
<echo message="${line.separator}" />
<echo message=" *************************" />
<echo message=" * Running @{path} " />
<echo message=" * Path: ${absolute.path} " />
<echo message=" *************************" />
<echo message="${line.separator}" />
<ant dir="@{path}" target="all" />
</sequential>
</sequential>
</macrodef>

</project>
Expand Up @@ -21,44 +21,78 @@
]>

<project name="webservice ejb annotations" default="all" basedir=".">
<target name="all">
<ant dir="noname" target="all"/>
<ant dir="nointf" target="all"/>
<ant dir="security" target="all"/>
<ant dir="provider" target="all" />
<ant dir="oneway" target="all"/>
<ant dir="wsctxtinterceptor" target="all"/>
<ant dir="ejbclient" target="all"/>
<ant dir="msgctxt" target="all"/>
<ant dir="asyncejbclient" target="all"/>
<ant dir="serviceejbclient" target="all"/>
<ant dir="portejbclient" target="all"/>
<ant dir="localremoteejbwebservice" target="all"/>
<ant dir="libdependent" target="all"/>
<ant dir="messagectxt" target="all"/>
<ant dir="singleton" target="all"/>
<ant dir="msgctxinterceptor" target="all"/>
<ant dir="ejbwebservicesinwar" target="all"/>
<ant dir="ejbwebservicesinwar-2" target="all"/>
<ant dir="ejbwebservicesinwar-3" target="all"/>
<ant dir="ejbwebservicesinwar-sessioncontext" target="all"/>
<ant dir="ejbwebservicesinwar-interceptor" target="all"/>
<ant dir="ejbservletwebservicesinwar" target="all"/>
<ant dir="async" target="all"/>
<ant dir="bigint" target="all"/>
<ant dir="libdependent" target="all"/>
<ant dir="libdependent-2" target="all"/>
<ant dir="svchandler" target="all"/>
<ant dir="wsctxt" target="all"/>
<ant dir="sessionctx" target="all"/>
<ant dir="wsnameejbname" target="all"/>
<ant dir="dependencynoinjection" target="all"/>
<ant dir="exception" target="all"/>
<ant dir="methodinjection" target="all"/>
<ant dir="invalidmethodinjection" target="all"/>
<ant dir="portdependencynoinjection" target="all"/>
<ant dir="portfieldinjection" target="all"/>
<ant dir="portmethodinjection" target="all"/>
<ant dir="wsRef-webservice-features" target="all"/>
<target name="all" xmlns:if="ant:if" xmlns:unless="ant:unless">
<property environment="env" />

<echo message="@@## Running webservice ejb annotations developer tests ##@@" />
<echo unless:set="env.ejb_annotations" message="@@## Set environment variable 'ejb_annotations' to name of single test dir to run only that one. ##@@${line.separator}" />
<echo if:set="env.ejb_annotations" message="@@## environment variable 'ejb_annotations' set. Running only ${env.ejb_annotations} ##@@${line.separator}" />


<run-ejb_annotations-test path="noname" />
<run-ejb_annotations-test path="nointf" />
<run-ejb_annotations-test path="security" />
<run-ejb_annotations-test path="provider" />
<run-ejb_annotations-test path="oneway" />
<run-ejb_annotations-test path="wsctxtinterceptor" />
<run-ejb_annotations-test path="ejbclient" />
<run-ejb_annotations-test path="msgctxt" />
<run-ejb_annotations-test path="asyncejbclient" />
<run-ejb_annotations-test path="serviceejbclient" />
<run-ejb_annotations-test path="portejbclient" />
<run-ejb_annotations-test path="localremoteejbwebservice" />
<run-ejb_annotations-test path="libdependent" />
<run-ejb_annotations-test path="messagectxt" />
<run-ejb_annotations-test path="singleton" />
<run-ejb_annotations-test path="msgctxinterceptor" />
<run-ejb_annotations-test path="ejbwebservicesinwar" />
<run-ejb_annotations-test path="ejbwebservicesinwar-2" />
<run-ejb_annotations-test path="ejbwebservicesinwar-3" />
<run-ejb_annotations-test path="ejbwebservicesinwar-sessioncontext" />
<run-ejb_annotations-test path="ejbwebservicesinwar-interceptor" />
<run-ejb_annotations-test path="ejbservletwebservicesinwar" />
<run-ejb_annotations-test path="async" />
<run-ejb_annotations-test path="bigint" />
<run-ejb_annotations-test path="libdependent" />
<run-ejb_annotations-test path="libdependent-2" />
<run-ejb_annotations-test path="svchandler" />
<run-ejb_annotations-test path="wsctxt" />
<run-ejb_annotations-test path="sessionctx" />
<run-ejb_annotations-test path="wsnameejbname" />
<run-ejb_annotations-test path="dependencynoinjection" />
<run-ejb_annotations-test path="exception" />
<run-ejb_annotations-test path="methodinjection" />
<run-ejb_annotations-test path="invalidmethodinjection" />
<run-ejb_annotations-test path="portdependencynoinjection" />
<run-ejb_annotations-test path="portfieldinjection" />
<run-ejb_annotations-test path="portmethodinjection" />
<run-ejb_annotations-test path="wsRef-webservice-features" />
</target>

<macrodef name="run-ejb_annotations-test" xmlns:if="ant:if" xmlns:unless="ant:unless">
<attribute name="path" />
<sequential>
<local name="do-run-test" />
<condition property="do-run-test" else="false">
<or>
<equals arg1="${env.ejb_annotations}" arg2="@{path}" />
<not>
<isset property="env.ejb_annotations" />
</not>
</or>
</condition>

<sequential if:true="${do-run-test}">
<local name="absolute.path" />
<property name="absolute.path" location="@{path}" />
<echo message="${line.separator}" />
<echo message=" *************************" />
<echo message=" * Running @{path} " />
<echo message=" * Path: ${absolute.path} " />
<echo message=" *************************" />
<echo message="${line.separator}" />
<ant dir="@{path}" target="all" />
</sequential>
</sequential>
</macrodef>
</project>
10 changes: 5 additions & 5 deletions appserver/tests/appserv-tests/devtests/webservice/run_test.sh
Expand Up @@ -19,14 +19,14 @@ list_test_ids(){
echo webservice_all
}

test_run(){
${S1AS_HOME}/bin/asadmin start-domain
test_run() {
${S1AS_HOME}/bin/asadmin start-domain ${GLASSFISH_SUSPEND}
cd ${APS_HOME}/devtests/webservice
ant ${TARGET} | tee ${TEST_RUN_LOG}
${S1AS_HOME}/bin/asadmin stop-domain
}

run_test_id(){
run_test_id() {
kill_process
unzip_test_resources ${WORKSPACE}/bundles/glassfish.zip
cd `dirname ${0}`
Expand All @@ -38,12 +38,12 @@ run_test_id(){
change_junit_report_class_names
}

post_test_run(){
post_test_run() {
copy_test_artifacts ${TEST_ID}
cd -
}

get_test_target(){
get_test_target() {
case ${1} in
webservice_all )
TARGET=all
Expand Down
7 changes: 7 additions & 0 deletions runtests.sh
Expand Up @@ -73,6 +73,7 @@ export PATH="${JAVA_HOME}/bin:${PATH}"
if [ -z "${MVN_REPOSITORY}" ]; then
export MVN_REPOSITORY="${HOME}/.m2/repository"
fi

export M2_HOME="${M2_HOME=$(realpath $(dirname $(realpath $(which mvn)))/..)}"
export APS_HOME="$(pwd)/appserver/tests/appserv-tests"

Expand All @@ -82,6 +83,12 @@ else
export GF_VERSION="$2"
fi

if [ ! -z "${3}" ]; then
export GLASSFISH_SUSPEND="--suspend"
else
unset GLASSFISH_SUSPEND
fi

export JACOCO_ENABLED="true"
export WORKSPACE="$(pwd)/target"
export TEST_RUN_LOG="${WORKSPACE}/tests-run.log"
Expand Down

0 comments on commit 4cf46cc

Please sign in to comment.