Skip to main content
summaryrefslogtreecommitdiffstats
blob: 9400384b63825c12140cc4c6e0c62b535f5ebd5f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?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=H2,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>
			<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>close</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;h2.db.connection&quot;&gt;${line.separator}
					&lt;Driver&gt;org.h2.Driver&lt;/Driver&gt;${line.separator}
					&lt;Url&gt;#PREFIX#:tcp://#HOST#:#PORT#/#DBHOME##DBNAME#;IGNORECASE=TRUE;SCHEMA_SEARCH_PATH=@{dbUser}, PUBLIC;MVCC=TRUE&lt;/Url&gt;${line.separator}
				&lt;/ConnectionDescription&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