<?xml version="1.0" encoding="UTF-8"?>
<project name="Zabbix" default="build" basedir=".">
<target name="init-common">
<condition property="phpunit_filter" value=" --filter='${PHPUNIT_FILTER}'" else="">
<isset property="PHPUNIT_FILTER" />
<length string="${PHPUNIT_FILTER}" when="greater" length="0"/>
<delete dir="build/logs" failonerror="off"/>
<mkdir dir="build/logs"/>
<target name="create-frontend-configs">
<property name="dbtype" value="${DBTYPE}"/>
<property name="dbhost" value="${DBHOST}"/>
<property name="dbname" value="${DBNAME}"/>
<property name="dbuser" value="${DBUSER}"/>
<property name="dbpassword" value="${DBPASSWORD}"/>
<property name="phpunit_error_log" value="${PHPUNIT_ERROR_LOG}"/>
<property name="phpunit_port_prefix" value="${PHPUNIT_PORT_PREFIX}"/>
<copy overwrite="true" file="ui/tests/templates/zabbix.conf.php" tofile="ui/conf/zabbix.conf.php"/>
<replace file="ui/conf/zabbix.conf.php" token="{DBTYPE}" value="${dbtype}"/>
<replace file="ui/conf/zabbix.conf.php" token="{DBHOST}" value="${dbhost}"/>
<replace file="ui/conf/zabbix.conf.php" token="{DBNAME}" value="${dbname}"/>
<replace file="ui/conf/zabbix.conf.php" token="{DBUSER}" value="${dbuser}"/>
<replace file="ui/conf/zabbix.conf.php" token="{DBPASSWORD}" value="${dbpassword}"/>
<replace file="ui/conf/zabbix.conf.php" token="{PHPUNIT_ERROR_LOG}" value="${phpunit_error_log}"/>
<replace file="ui/conf/zabbix.conf.php" token="{SERVER_PORT}" value="${phpunit_port_prefix}51"/>
<chmod file="ui/conf/zabbix.conf.php" perm="go+rw"/>
<target name="create-configs" depends="init-common,create-frontend-configs">
<property name="url" value="${URL}"/>
<property name="screenshot_dir" value="${SCREENSHOT_DIR}"/>
<property name="screenshot_url" value="${SCREENSHOT_URL}"/>
<property name="phpunit_port_prefix" value="${PHPUNIT_PORT_PREFIX}"/>
<property name="screenshot_references_dir" value="${SCREENSHOT_REFERENCES_DIR}"/>
<condition property="phpunit_driver_address" value="${PHPUNIT_DRIVER_ADDRESS}" else="localhost">
<isset property="PHPUNIT_DRIVER_ADDRESS" />
<length string="${PHPUNIT_DRIVER_ADDRESS}" when="greater" length="0"/>
<property environment="env"/>
<copy overwrite="true" file="ui/tests/bootstrap.php.template" tofile="ui/tests/bootstrap.php"/>
<replace file="ui/tests/bootstrap.php" token="{URL}" value="${url}"/>
<replace file="ui/tests/bootstrap.php" token="{BASEDIR}" value="${basedir}"/>
<replace file="ui/tests/bootstrap.php" token="{SCREENSHOT_DIR}" value="${screenshot_dir}"/>
<replace file="ui/tests/bootstrap.php" token="{SCREENSHOT_URL}" value="${screenshot_url}"/>
<replace file="ui/tests/bootstrap.php" token="{BINARY_DIR}" value="${basedir}/sbin/"/>
<replace file="ui/tests/bootstrap.php" token="{CONFIG_SOURCE_DIR}" value="${basedir}/conf/"/>
<replace file="ui/tests/bootstrap.php" token="{CONFIG_DIR}" value="${basedir}/etc/"/>
<replace file="ui/tests/bootstrap.php" token="{COMPONENT_DIR}" value="${basedir}/runtime/"/>
<replace file="ui/tests/bootstrap.php" token="{PORT_PREFIX}" value="${phpunit_port_prefix}"/>
<replace file="ui/tests/bootstrap.php" token="{SCREENSHOT_REFERENCES_DIR}" value="${screenshot_references_dir}"/>
<replace file="ui/tests/bootstrap.php" token="{PHPUNIT_DRIVER_ADDRESS}" value="${phpunit_driver_address}"/>
<replace file="ui/tests/bootstrap.php" token="{PHPUNIT_DATA_SOURCES_DIR}" value="${basedir}/ui/tests/selenium/data/sources/"/>
<target name="create-saml-configs">
<property name="phpunit_simplesaml_baseurl" value="${PHPUNIT_SIMPLESAML_BASEURL}"/>
<property name="phpunit_sp_entity_id" value="${PHPUNIT_SP_ENTITY_ID}"/>
<property name="url" value="${URL}"/>
<replace file="ui/tests/bootstrap.php" token="'PHPUNIT_SAML_TESTS_ENABLED', false" value="'PHPUNIT_SAML_TESTS_ENABLED', true"/>
<replace file="ui/tests/bootstrap.php" token="{PHPUNIT_IDP_ENTITY_ID}" value="${phpunit_simplesaml_baseurl}/saml2/idp/metadata.php"/>
<replace file="ui/tests/bootstrap.php" token="{PHPUNIT_SSO_SERVICE_URL}" value="${phpunit_simplesaml_baseurl}/saml2/idp/SSOService.php"/>
<replace file="ui/tests/bootstrap.php" token="{PHPUNIT_SLO_SERVICE_URL}" value="${phpunit_simplesaml_baseurl}/saml2/idp/SingleLogoutService.php"/>
<replace file="ui/tests/bootstrap.php" token="{PHPUNIT_SP_ENTITY_ID}" value="${phpunit_sp_entity_id}"/>
<get src="${phpunit_simplesaml_baseurl}/module.php/saml/idp/certs.php/idp.crt" dest="ui/conf/certs"/>
<copy overwrite="true" file="${SIMPLESAMLPHP_CFG_FILE}.template" tofile="${SIMPLESAMLPHP_CFG_FILE}"/>
<replace file="${SIMPLESAMLPHP_CFG_FILE}" token="{ENTITY_ID}" value="${phpunit_sp_entity_id}"/>
<replace file="${SIMPLESAMLPHP_CFG_FILE}" token="{ASSERTION_CONSUMER_SERVICE}" value="${url}index_sso.php?acs"/>
<replace file="${SIMPLESAMLPHP_CFG_FILE}" token="{SINGLE_LOGOUT_SERVICE}" value="${url}index_sso.php?sls"/>
<chmod file="${SIMPLESAMLPHP_CFG_FILE}" perm="go+r"/>
<target name="init-integration">
<copy overwrite="true" file="src/go/conf/zabbix_agent2.conf" tofile="conf/zabbix_agent2.conf"/>