| <?xml version="1.0"?> |
| <project name="Test OSEE Application Server Launcher" default="run" basedir="."> |
| |
| <!-- |
| ${extraVMargs} |
| |
| $xserver-db-home |
| $xserver-db-name=psql.osee.eclipse.org \ |
| $xserver-db-username=osee.eclipse \ |
| $xserver-db-password=osee.eclipse \ |
| $xserver-db-address=127.0.0.1 \ |
| $xserver-db-port=1623 \ |
| |
| ${xserver-authentication} |
| ${xserver-data} |
| ${xserver-home} |
| ${xserver-port} |
| ${xserver-telnet-port} |
| ${xserver-log-config} |
| --> |
| |
| <target name="init"> |
| <echo message="extraVMargs: [${extraVMargs}]" /> |
| |
| <for param="argline" delimiter=" -D" list="${extraVMargs}" trim="true"> |
| <sequential> |
| <propertyregex property="argName" override="true" input="@{argline}" regexp="(.*?)=" select="\1" casesensitive="false" /> |
| <propertyregex property="argValue" override="true" input="@{argline}" regexp="=(.*)" select="\1" casesensitive="false" /> |
| <echo message="Found arg - [${argName}]=[${argValue}]" /> |
| <property name="${argName}" value="${argValue}" /> |
| </sequential> |
| </for> |
| |
| <property name="xserver-use-demo-data" value="false" /> |
| <property name="osee.app.server.config.file" value="${xserver-data}/osee.hsql.test.json" /> |
| |
| <echo message="Server Config File: [${osee.app.server.config.file}]" /> |
| <echo message="Server Data Directory: [${osee.application.server.data}]" /> |
| |
| <echo message="Osee Application Server Home: [${xserver-home}]" /> |
| <echo message="Osee Application Server Port: [${xserver-port}]" /> |
| <echo message="Osee Application Server Telnet Port: [${xserver-telnet-port}]" /> |
| <echo message="Osee Application Server Db Address: [${xserver-db-address}:${xserver-db-port}]" /> |
| |
| <mkdir dir="${xserver-data}" /> |
| |
| <property name="osee.application.server.data" value="${xserver-data}/binary_data" /> |
| <mkdir dir="${osee.application.server.data}" /> |
| |
| <!-- copy server data to temp area --> |
| <if> |
| <equals arg1="${xserver-use-demo-data}" arg2="true" /> |
| <then> |
| <copy todir="${osee.application.server.data}"> |
| <fileset dir="${xserver-project}/target/server/demo/binary_data" /> |
| </copy> |
| |
| <!-- copy database data to server area --> |
| <copy file="${xserver-project}/target/server/demo/hsql/osee.hsql.db.properties" tofile="${xserver-data}/${xserver-db-name}.properties" /> |
| <copy file="${xserver-project}/target/server/demo/hsql/osee.hsql.db.script" tofile="${xserver-data}/${xserver-db-name}.script" /> |
| </then> |
| </if> |
| </target> |
| |
| <target name="writeHsqlConnectionFile" depends="init"> |
| <writeJsonConfig dbaddress="${xserver-db-address}" dbpath="${xserver-db-home}" dbport="${xserver-db-port}" filepath="${osee.app.server.config.file}" /> |
| </target> |
| |
| <target name="run" depends="init,writeHsqlConnectionFile,startServer" /> |
| |
| <target name="startServer"> |
| <pathconvert property="launcherJarPath" setonempty="false"> |
| <path> |
| <fileset dir="${xserver-home}/plugins"> |
| <include name="org.eclipse.equinox.launcher_*.jar" /> |
| </fileset> |
| </path> |
| </pathconvert> |
| |
| <mkdir dir="${xserver-data}" /> |
| |
| <forget daemon="false"> |
| <echo message="Launching Osee Application Server..." /> |
| <!-- Test Should Complete in 30 mins (timeout vale) - currently, they only take ~13 mins --> |
| <java taskname="int-test-server" failonerror="true" maxmemory="1024m" timeout="1800000" jar="${launcherJarPath}" fork="yes"> |
| <classpath> |
| <fileset dir="${xserver-home}/plugins" includes="org.eclipse.equinox.launcher_*.jar" /> |
| <pathelement location="${xserver-home}/plugins" /> |
| </classpath> |
| <sysproperty key="osee.log.default" value="INFO" /> |
| <sysproperty key="osee.check.tag.queue.on.startup" value="false" /> |
| <sysproperty key="osgi.noShutdown" value="true" /> |
| <sysproperty key="osee.application.server.data" value="${osee.application.server.data}" /> |
| <sysproperty key="osee.authentication.protocol" value="${xserver-authentication}" /> |
| <sysproperty key="logback.configurationFile" value="${xserver-log-config}" /> |
| <sysproperty key="osgi.configuration.area" value="${xserver-project}/configuration" /> |
| <sysproperty key="cm.config.uri" value="${osee.app.server.config.file}" /> |
| |
| <jvmarg line="${additionalJvmArgs}" /> |
| <arg line=" -console ${xserver-telnet-port} -consoleLog -configuration "${xserver-home}/configuration"" /> |
| </java> |
| </forget> |
| |
| <waitfor maxwait="20" maxwaitunit="second" checkevery="100" checkeveryunit="millisecond"> |
| <http url="http://127.0.0.1:${xserver-port}/osee/configure/datastore/schema" /> |
| </waitfor> |
| </target> |
| |
| <target name="stopServer"> |
| <!--<echo message="Osee Application Server Telnet Port: [${xserver-telnet-port}]" /> |
| <telnet server="localhost" port="${xserver-telnet-port}" initialCR="yes" timeout="1000"> |
| <read>osgi></read> |
| <write>exit</write> |
| <read>Really want to stop Equinox? (y/n; default=y)</read> |
| <write>y</write> |
| </telnet> |
| <sleep milliseconds="500" />--> |
| |
| <echo message="Osee Application Server Port: [${xserver-port}]" /> |
| <post to="http://127.0.0.1:${xserver-port}/osee/console?cmd=osee&args=server_shutdown" verbose="true" wantresponse="true" property="shutdownOutput" /> |
| <echo message="${shutdownOutput}" /> |
| <sleep milliseconds="10000" /> |
| </target> |
| |
| <macrodef name="writeJsonConfig"> |
| <attribute name="dbAddress" /> |
| <attribute name="dbPort" /> |
| <attribute name="dbPath" /> |
| <attribute name="filePath" /> |
| <sequential> |
| <propertyregex property="dbFilePath" input="@{dbPath}" override="true" regexp="\\" replace="/" global="true" defaultValue="@{dbPath}" /> |
| |
| <echo message="Writing Json Configuration" /> |
| <echo file="@{filePath}"> |
| { |
| "config": [ |
| { |
| "service.pid": "org.eclipse.osee.jdbc.internal.osgi.JdbcComponentFactory", |
| "jdbc.service": [ |
| { |
| "service.id": "1001", |
| "jdbc.server.host": "@{dbAddress}", |
| "jdbc.server.port": "@{dbPort}", |
| "jdbc.server.db.data.path": "${dbFilePath}", |
| "jdbc.client.db.username": "public", |
| "jdbc.client.connection.pool.enabled": "true", |
| "jdbc.client.connection.pool.max.active.connections": "100", |
| "jdbc.client.connection.pool.max.idle.connections": "100", |
| "osgi.binding": [ |
| "activity.jdbc.service", |
| "orcs.jdbc.service", |
| "account.jdbc.service", |
| "oauth.jdbc.service", |
| "app.server.jdbc.service", |
| "jetty.jdbc.service" |
| ] |
| } |
| ] |
| }, |
| { |
| "service.pid": "org.eclipse.osee.http.jetty.internal.osgi.JdbcJettyHttpService", |
| "jetty.server.http.port": ${xserver-port}, |
| "jetty.server.context.session.inactive.interval": 3600, |
| "jetty.jdbc.cluster.name" : "OSEE", |
| "jetty.jdbc.save.interval.secs" : 30 |
| } |
| ] |
| } |
| </echo> |
| </sequential> |
| </macrodef> |
| |
| </project> |