keycloak-scim/testsuite/integration-arquillian/servers/auth-server/jboss/common/ant/configure.xml
2022-05-27 12:28:50 +02:00

274 lines
11 KiB
XML

<project xmlns:if="ant:if">
<property name="cli.tmp.dir" value="${project.build.directory}/cli" />
<target name="set-server-config">
<condition property="server.config" value="standalone.xml">
<equals arg1="${ant.scenario}" arg2="scenario-standalone"/>
</condition>
<condition property="server.config" value="standalone-ha.xml">
<or>
<equals arg1="${ant.scenario}" arg2="scenario-cluster"/>
<equals arg1="${ant.scenario}" arg2="scenario-crossdc"/>
</or>
</condition>
<fail message="Property $${ant.scenario} must be set.">
<condition>
<not>
<isset property="server.config" />
</not>
</condition>
</fail>
<echo>server.config: ${server.config}</echo>
</target>
<macrodef name="bin-chmod">
<sequential>
<chmod perm="ug+x">
<fileset dir="${auth.server.home}/bin">
<include name="*.sh"/>
</fileset>
</chmod>
</sequential>
</macrodef>
<macrodef name="cleanup">
<sequential>
<delete dir="${auth.server.home}/standalone/configuration/standalone_xml_history"/>
<delete dir="${auth.server.home}/standalone/log"/>
<delete dir="${auth.server.home}/standalone/data"/>
<delete dir="${auth.server.home}/standalone/tmp"/>
</sequential>
</macrodef>
<target name="apply-cli-scripts" depends="set-server-config">
<concat destfile="${cli.tmp.dir}/result.cli" fixlastline="true">
<header filtering="no" trimleading="yes">
embed-server --server-config=${server.config}
</header>
<fileset dir="${cli.tmp.dir}" includes="*.cli"/>
</concat>
<bin-chmod/>
<!-- Workaround for WFCORE-5335 issue -->
<exec osfamily="unix" dir="${auth.server.home}/bin" executable="bash" failonerror="true">
<arg value="${jboss.cli.executable}"/>
<arg value="--file=${cli.tmp.dir}/result.cli"/>
</exec>
<exec osfamily="windows" executable="powershell" failonerror="true">
<arg value="${auth.server.home}/bin/${jboss.cli.executable}"/>
<arg value="--file=${cli.tmp.dir}/result.cli"/>
</exec>
<cleanup/>
</target>
<target name="scenario-standalone-generate" depends="io-worker-threads,
inject-provider,
inject-truststore,
log-level">
<echo>cli scripts for standalone prepared</echo>
</target>
<target name="scenario-cluster-generate" depends="io-worker-threads,
inject-provider,
inject-truststore,
undertow-subsystem-cluster,
ispn-cache-owners,
log-level">
<echo>cli scripts for cluster prepared</echo>
</target>
<target name="scenario-crossdc-generate" depends="io-worker-threads,
inject-provider,
inject-truststore,
cross-dc-setup,
log-level">
<echo>cli scripts for crossdc prepared</echo>
</target>
<target name="io-worker-threads">
<copy todir="${cli.tmp.dir}">
<resources>
<file file="${common.resources}/jboss-cli/io.cli"/>
</resources>
<filterset>
<filter token="IO_WORKER_IO_THREADS" value="${auth.server.worker.io-threads}"/>
<filter token="IO_WORKER_TASK_MAX_THREADS" value="${auth.server.worker.task-max-threads}"/>
</filterset>
</copy>
</target>
<target name="inject-provider">
<copy todir="${cli.tmp.dir}">
<resources>
<file file="${common.resources}/jboss-cli/keycloak-server-subsystem.cli"/>
</resources>
</copy>
</target>
<target name="inject-truststore">
<copy todir="${cli.tmp.dir}">
<resources>
<file file="${common.resources}/jboss-cli/truststore.cli"/>
</resources>
</copy>
</target>
<target name="set-manual-migration-strategy">
<copy todir="${cli.tmp.dir}">
<resources>
<file file="${common.resources}/jboss-cli/set-manual-migration-strategy.cli"/>
</resources>
</copy>
</target>
<target name="configure-server-jpa" depends="update-jpa-schema">
<!-- I'm intentionally leaving this here. This shows up environment variables that are used during the build.
If anything goes wrong, this is the first place to look at -->
<echoproperties/>
<copy todir="${cli.tmp.dir}">
<resources>
<file file="${common.resources}/jboss-cli/configure-server-jpa.cli"/>
</resources>
<filterset>
<filter token="DATABASE" value="${jdbc.mvn.artifactId}"/>
<filter token="DRIVER_VERSION" value="${jdbc.mvn.version}"/>
<filter token="DRIVER_TMP_DIR" value="${jdbc.driver.tmp.dir}"/>
<filter token="JDBC_URL" value="${keycloak.connectionsJpa.url}"/>
<filter token="USER" value="${keycloak.connectionsJpa.user}"/>
<filter token="PASSWORD" value="${keycloak.connectionsJpa.password}"/>
</filterset>
</copy>
</target>
<target name="update-jpa-schema" if="update.schema" depends="schema-update-required">
<copy todir="${cli.tmp.dir}">
<resources>
<file file="${common.resources}/jboss-cli/update-jpa-schema.cli"/>
</resources>
<filterset>
<filter token="SCHEMA" value="${keycloak.connectionsJpa.schema}"/>
</filterset>
</copy>
</target>
<target name="schema-update-required">
<condition property="update.schema">
<not>
<equals arg1="${keycloak.connectionsJpa.schema}" arg2="DEFAULT"/>
</not>
</condition>
<echo>Updating schema?: ${update.schema}</echo>
<echo>keycloak.connectionsJpa.schema: ${keycloak.connectionsJpa.schema}</echo>
</target>
<target name="undertow-subsystem-cluster">
<copy todir="${cli.tmp.dir}">
<resources>
<file file="${common.resources}/jboss-cli/undertow-subsystem-cluster-setup.cli"/>
</resources>
</copy>
</target>
<target name="ispn-cache-owners">
<copy todir="${cli.tmp.dir}">
<resources>
<file file="${common.resources}/jboss-cli/ispn-cache-owners.cli"/>
</resources>
<filterset>
<filter token="SESSION_CACHE_OWNERS" value="${session.cache.owners}"/>
<filter token="OFFLINE_SESSION_CACHE_OWNERS" value="${offline.session.cache.owners}"/>
<filter token="LOGIN_FAILURE_CACHE_OWNERS" value="${login.failure.cache.owners}"/>
</filterset>
</copy>
</target>
<target name="log-level" if="set.log.level" depends="log-level-update-required">
<copy todir="${cli.tmp.dir}">
<resources>
<file file="${common.resources}/jboss-cli/add-log-level.cli"/>
</resources>
<filterset>
<filter token="INFINISPAN_LOG_LEVEL" value="${infinispan.log.level}"/>
<filter token="SCHEDULED_TASKS_LOG_LEVEL" value="${scheduled.tasks.log.level}"/>
</filterset>
</copy>
</target>
<target name="log-level-update-required">
<!-- Default log levels -->
<property name="infinispan.log.level" value="INFO"/>
<property name="scheduled.tasks.log.level" value="INFO"/>
<condition property="set.log.level">
<or>
<equals arg1="${infinispan.log.level}" arg2="DEBUG"/>
<equals arg1="${infinispan.log.level}" arg2="TRACE"/>
<equals arg1="${scheduled.tasks.log.level}" arg2="DEBUG"/>
<equals arg1="${scheduled.tasks.log.level}" arg2="TRACE"/>
</or>
</condition>
<echo>Updating log level?: ${set.log.level}</echo>
<echo>infinispan.log.level: ${infinispan.log.level}</echo>
<echo>sheduled.tasks.log.level: ${scheduled.tasks.log.level}</echo>
</target>
<target name="replace-jdbc-url">
<copy todir="${cli.tmp.dir}">
<resources>
<file file="${common.resources}/jboss-cli/replace-jdbc-url.cli"/>
</resources>
<filterset>
<filter token="JDBC_URL" value="${h2.jdbc.url}"/>
</filterset>
</copy>
</target>
<target name="cross-dc-setup">
<copy todir="${cli.tmp.dir}">
<resources>
<file file="${common.resources}/jboss-cli/cross-dc-setup.cli"/>
<file file="${common.resources}/jboss-cli/cross-dc-setup_cache-auth.cli" if:true="${crossdc.cache.auth}" />
</resources>
<filterset>
<filter token="HOTROD_SASL_MECHANISM" value="${hotrod.sasl.mechanism}"/>
<filter token="PRELOADING_ENABLED" value="${keycloak.userSessions.infinispan.preloadOfflineSessionsFromDatabase}"/>
</filterset>
</copy>
<copy todir="${auth.server.home}/standalone/configuration">
<resources>
<file file="${common.resources}/keystore/hotrod-client-truststore.jks"/>
</resources>
</copy>
</target>
<!--following target is used by testsuite/integration-arquillian/servers/migration-->
<target name="configure-server-jpa-legacy">
<copy todir="${cli.tmp.dir}">
<resources>
<file file="${common.resources}/jboss-cli/migration/configure-server-jpa-legacy.cli"/>
</resources>
<filterset>
<filter token="DATABASE" value="${jdbc.mvn.artifactId}"/>
<filter token="DRIVER_VERSION" value="${jdbc.mvn.version}"/>
<filter token="DRIVER_TMP_DIR" value="${jdbc.driver.tmp.dir}"/>
<filter token="JDBC_URL" value="${keycloak.connectionsJpa.url}"/>
<filter token="USER" value="${keycloak.connectionsJpa.user}"/>
<filter token="PASSWORD" value="${keycloak.connectionsJpa.password}"/>
</filterset>
</copy>
</target>
<!-- Needed on Java 15 and later -->
<target name="deploy-nashorn-module">
<copy todir="${cli.tmp.dir}">
<resources>
<file file="${common.resources}/jboss-cli/deploy-nashorn-module.cli"/>
</resources>
<filterset>
<filter token="NASHORN_JAR" value="${project.build.directory}/nashorn/nashorn-core-${nashorn.version}.jar"/>
</filterset>
</copy>
<echo>Nashorn module deployed</echo>
</target>
</project>