Skip to main content
summaryrefslogblamecommitdiffstats
blob: 982152af296833da5a0489e5cb8df23cd6626acd (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13












                                                                                
                                





























                                                                                                                                                         

                                                                                                                                                                                                                                                                                                                                                                                                                     

                 
                                                                                











                                                                                             
                                       


































                                                                                                                                                     
                                               



































                                                                                                                                                                  




                                                                                                                         





                                                                                                                            












                                                                                                                                                                                                                                                   
<?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-db-web-port=1623 \
   $xserver-db-type=HSQL,PGSQL \
   
   ${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="osee.app.server.connectionFile" value="${xserver-data}/test.osee.client.db.connection.xml" />
		<property name="osee.app.server.connectionId" value="test.osee.client.db.connection.id" />

		<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 Type: [${xserver-db-type}]" />
	</target>

	<target name="writeHsqlConnectionFile" depends="init">
			<writeConnectionFile dbType="hsql" dbHome="${xserver-db-home}" dbPrefix="jdbc:hsqldb:hsql" dbDriver="hsql.db.connection" dbName="${xserver-db-name}" dbUser="${xserver-db-username}" dbPasswd="${xserver-db-password}" dbAddress="${xserver-db-address}" dbPort="${xserver-db-port}" connectionFilePath="${osee.app.server.connectionFile}" connectionid="${osee.app.server.connectionId}" />
	</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="true">
				<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="org.osgi.service.http.port" value="${xserver-port}" />
				<sysproperty key="osee.db.connection.id" value="${osee.app.server.connectionId}" />
				<sysproperty key="osee.connection.info.uri" value="${osee.app.server.connectionFile}" />
				<sysproperty key="osee.application.server.data" value="${xserver-data}" />
				<sysproperty key="osee.authentication.protocol" value="${xserver-authentication}" />
				<sysproperty key="osee.connection.info.uri" value="${osee.app.server.connectionFile}" />
				<sysproperty key="osee.db.embedded.server" value="${xserver-db-address}:${xserver-db-port}" />
				<sysproperty key="osee.db.embedded.web.server.port" value="${xserver-db-web-port}" />
				<sysproperty key="logback.configurationFile" value="${xserver-log-config}" />
				<sysproperty key="osgi.configuration.area" value="${xserver-data}/configuration" />

				<jvmarg line="${additionalJvmArgs}" />
				<arg line=" -console ${xserver-telnet-port} -consoleLog -configuration &quot;${xserver-home}/configuration&quot;" />
			</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&gt;</read>
			<write>shutdown</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&amp;args=server_shutdown" verbose="true" wantresponse="true" property="shutdownOutput" />
		<echo message="${shutdownOutput}" />
      -->
	</target>

	<macrodef name="writeConnectionFile">
		<attribute name="dbHome" />
		<attribute name="dbName" />
		<attribute name="dbUser" />
		<attribute name="dbPasswd" />
		<attribute name="dbType" />
		<attribute name="dbPrefix" />
		<attribute name="dbDriver" />
		<attribute name="dbAddress" />
		<attribute name="dbPort" />
		<attribute name="connectionId" />
		<attribute name="connectionFilePath" />
		<sequential>
			<echo message="Writing [@{dbType}] Db Connection File" />
			<echo file="@{connectionFilePath}">
			&lt;DbConnection&gt;
				&lt;DatabaseInfo id=&quot;db.connection.info&quot;&gt;${line.separator}
					&lt;DatabaseHome key=&quot;#DBHOME#&quot; value=&quot;@{dbHome}&quot; /&gt;${line.separator}
					&lt;DatabaseName key=&quot;#DBNAME#&quot; value=&quot;@{dbName}&quot; /&gt;${line.separator}
					&lt;DatabaseType key=&quot;#TYPE#&quot; value=&quot;@{dbType}&quot; /&gt;${line.separator}
					&lt;Prefix key=&quot;#PREFIX#&quot; value=&quot;@{dbPrefix}&quot; /&gt;${line.separator}
					&lt;UserName key=&quot;#USERNAME#&quot; value=&quot;@{dbUser}&quot; /&gt;${line.separator}
					&lt;Password key=&quot;#PASSWORD#&quot; value=&quot;@{dbPasswd}&quot; /&gt;${line.separator}
					&lt;Host key=&quot;#HOST#&quot; value=&quot;@AvailableDbServices.hostAddress&quot; /&gt;${line.separator}
					&lt;Port key=&quot;#PORT#&quot; value=&quot;@AvailableDbServices.port&quot; /&gt;${line.separator}
				&lt;/DatabaseInfo&gt;${line.separator}
				${line.separator}
				&lt;ConnectionDescription id=&quot;postgresql.db.connection&quot;&gt;${line.separator}
					&lt;Driver&gt;org.postgresql.Driver&lt;/Driver&gt;${line.separator}
					&lt;Url&gt;#PREFIX#://#HOST#:#PORT#/#DBHOME##DBNAME#&lt;/Url&gt;${line.separator}
				&lt;/ConnectionDescription&gt;${line.separator}
				${line.separator}
				&lt;ConnectionDescription id=&quot;hsql.db.connection&quot;&gt;${line.separator}
					&lt;Driver&gt;org.hsqldb.jdbc.JDBCDriver&lt;/Driver&gt;${line.separator}
					&lt;Url&gt;#PREFIX#://#HOST#:#PORT#/#DBNAME#&lt;/Url&gt;${line.separator}
					&lt;Property key=&quot;hsqldb.tx&quot; value=&quot;MVCC&quot; /&gt;${line.separator}
				&lt;/ConnectionDescription&gt;${line.separator}
				${line.separator}
			</echo>

			<echo file="@{connectionFilePath}" append="true">
				${line.separator}${line.separator}
				&lt;AvailableDbServices&gt;${line.separator}
					&lt;Server id=&quot;@{connectionId}&quot; dbInfo=&quot;db.connection.info&quot; connectsWith=&quot;@{dbDriver}&quot; hostAddress=&quot;@{dbAddress}&quot; port=&quot;@{dbPort}&quot; /&gt;${line.separator}
				&lt;/AvailableDbServices&gt;${line.separator}
			&lt;/DbConnection&gt;
			</echo>
		</sequential>
	</macrodef>

</project>

Back to the top