mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

sgouvern
20.04.2008 2e81b4c05ec40a8ed1a42151b8ddd11a11a038cb
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
164
165
166
167
<!--
 ! CDDL HEADER START
 !
 ! The contents of this file are subject to the terms of the
 ! Common Development and Distribution License, Version 1.0 only
 ! (the "License").  You may not use this file except in compliance
 ! with the License.
 !
 ! You can obtain a copy of the license at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
 ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 ! See the License for the specific language governing permissions
 ! and limitations under the License.
 !
 ! When distributing Covered Code, include this CDDL HEADER in each
 ! file and include the License file at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 ! add the following below this CDDL HEADER, with the fields enclosed
 ! by brackets "[]" replaced with your own identifying information:
 !      Portions Copyright [yyyy] [name of copyright owner]
 !
 ! CDDL HEADER END
 !
 !
 !      Copyright 2008 Sun Microsystems, Inc.
 ! -->
 
<project name="opends-gui-test" basedir="." default="usage">
  <description>
    Gui Testing ANT script
  </description>
  <dirname file="${basedir}/.." property="project.home"/>
  <!-- Product properties -->
  <property file="${project.home}/PRODUCT"/>
  <property name="product.name" 
            value="${SHORT_NAME}-${MAJOR_VERSION}.${MINOR_VERSION}.${POINT_VERSION}"/>
  <property name="pkg.path" 
            value="${project.home}${file.separator}build${file.separator}package${file.separator}${product.name}.zip"/>
  <property name="instance.path" value="${basedir}${file.separator}${product.name}"/>
 
  <!-- Abbot properties -->
  <property name="abbot.version" value="1.0.0.rc5"/>
  <property name="abbot.url" 
            value="http://prdownloads.sf.net/abbot/abbot-${abbot.version}.zip?download"/>
  <property name="abbot.path" value="${basedir}/abbot-${abbot.version}"/>
  <property name="abbot.jar" value="${abbot.path}/lib/abbot.jar"/>
 
  <!-- Proxy properties -->
  <property name="proxy.host" value="webgate.central.sun.com"/>
  <property name="proxy.port" value="8080"/>
  <property name="proxy.user" value=""/>
  <property name="proxy.pwd" value=""/>
 
  <!-- targets -->
  <target name="costello"
          description="start the costello GUI">
    <java jar="${abbot.jar}" fork="true" />
  </target>
  
  <target name="install"
          description="Install gui test">
    <!-- Preliminary cleanup -->
    <delete dir="${product.name}"/>
    <delete file="quickInstall.xml"/>
    
    <!-- Unzip the bits -->
    <unzip src="${pkg.path}" dest="."/>
    
    <!-- Fix permissions on scripts -->
    <chmod perm="755">
      <fileset dir="${product.name}/bin"/>
      <fileset dir="${product.name}/bat"/>
      <fileset dir="${product.name}/lib">
        <include name="*.sh"/>
        <include name="*.bat"/>
        <include name="*.exe"/>
      </fileset>
    </chmod>
    <!-- Customize the test template -->
    <copy file="quickInstall.xml.stubs" tofile="quickInstall.xml">
      <filterchain>
        <expandproperties/>
      </filterchain>
    </copy>
    
    <!-- Run the tests -->
    <java classpath="${abbot.jar}" classname="junit.extensions.abbot.ScriptFixture" fork="true">
      <arg value="quickInstall.xml"/>
    </java>
  </target>
 
  <target name="uninstall"
          description="Uninstall gui test">
    <!-- Preliminary cleanup -->
    <delete file="quickUninstall"/>
 
    <!-- Customize the test template -->
    <copy file="quickUninstall.xml.stubs" tofile="quickUninstall.xml">
      <filterchain>
        <expandproperties/>
      </filterchain>
    </copy>
    
    <!-- Run the tests -->
    <java classpath="${abbot.jar}" classname="junit.extensions.abbot.ScriptFixture" fork="true">
      <arg value="quickUninstall.xml"/>
    </java>
  </target>
  
  <target name="usage">
  <echo>Usage:
  costello: start the costello GUI
  download: get the abbot framework bits
  install: run the installer GUI tests
  uninstall: run the uninstaller GUI tests
  upgrade: run the upgrader tests [not yet implemented]
</echo>
  </target>
  
  <target name="check-proxy">
    <echo>Checking for proxy [${proxy.host}:${proxy.port}] as user [${proxy.user}].</echo>
    <echo>Note: If these values do not match your environment, </echo>
    <echo>      please use the 'configure' target</echo>
    <condition property="proxy.enabled">
      <and>
        <not>
          <http url="${abbot.url}"/>
        </not>
        <isreachable host="${proxy.host}" timeout="5"/>
      </and>
    </condition>
  </target>
 
  <target name="set-proxy" depends="check-proxy" if="proxy.enabled">
    <echo>Proxy detected. Configuring.</echo>
    <setproxy 
      proxyhost="${proxy.host}" 
      proxyport="${proxy.port}"
      proxyuser="${proxy.user}" 
      proxypassword="${proxy.pass}"/>
  </target>
 
  <target 
    name="download-prepare" 
    depends="set-proxy">
    <available file="abbot.zip" property="downloaded"/>
  </target>
  
  <target name="download"  depends="download-prepare" unless="downloaded">
    <get src="${abbot.url}" dest="abbot.zip" />
    <unzip src="abbot.zip" dest="." />
  </target>
 
  <target name="clean">
    <delete dir="${instance.path}" />
    <delete>
      <fileset dir=".">
        <include name="quick*.xml"/>
      </fileset>
    </delete>
  </target>
  
  <target name="clobber">
    <delete dir="${abbot.path}"/> 
    <delete file="abbot.zip" />
  </target>
</project>