645
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
|
2 |
<!--
|
|
3 |
============================================================================
|
|
4 |
Name : test_blocks_repo.ant.xml
|
|
5 |
Part of : Helium AntLib
|
|
6 |
|
|
7 |
Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
8 |
All rights reserved.
|
|
9 |
This component and the accompanying materials are made available
|
|
10 |
under the terms of the License "Eclipse Public License v1.0"
|
|
11 |
which accompanies this distribution, and is available
|
|
12 |
at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
13 |
|
|
14 |
Initial Contributors:
|
|
15 |
Nokia Corporation - initial contribution.
|
|
16 |
|
|
17 |
Contributors:
|
|
18 |
|
|
19 |
Description:
|
|
20 |
|
|
21 |
============================================================================
|
|
22 |
-->
|
|
23 |
<project name="helium-blocks-repo-unittest" xmlns:hlm="http://www.nokia.com/helium" xmlns:au="antlib:org.apache.ant.antunit"
|
|
24 |
xmlns:ac="antlib:net.sf.antcontrib">
|
|
25 |
<description>Helium blocks repository unittests.</description>
|
|
26 |
|
|
27 |
<property name="workspace" location="${test.temp.dir}/workspace" />
|
|
28 |
<property name="repo" location="${test.temp.dir}/repo" />
|
|
29 |
|
|
30 |
<target name="setUp">
|
|
31 |
<tstamp>
|
|
32 |
<format property="tstamp" pattern="yyyyMMddHHmmssSSS" locale="en,UK" />
|
|
33 |
</tstamp>
|
|
34 |
<mkdir dir="${test.temp.dir}" />
|
|
35 |
<delete file="${test.temp.dir}" />
|
|
36 |
<mkdir dir="${test.temp.dir}" />
|
|
37 |
<mkdir dir="${workspace}" />
|
|
38 |
<mkdir dir="${repo}" />
|
|
39 |
|
|
40 |
<exec executable="blocks.bat" resultproperty="blocks.result" failifexecutionfails="false" osfamily="windows" />
|
|
41 |
<exec executable="blocks" resultproperty="blocks.result" failifexecutionfails="false" osfamily="unix" />
|
|
42 |
<condition property="execute.test" value="true">
|
|
43 |
<equals arg1="${blocks.result}" arg2="0" />
|
|
44 |
</condition>
|
|
45 |
<echo>execute.test: ${execute.test}</echo>
|
|
46 |
<ac:if>
|
|
47 |
<istrue value="${execute.test}" />
|
|
48 |
<then>
|
|
49 |
<hlm:blocksAddWorkspace name="unittest-addworkspace-${tstamp}" dir="${workspace}"
|
|
50 |
wsidproperty="wsid" />
|
|
51 |
<copy todir="${workspace}">
|
|
52 |
<fileset dir="../" includes="src/**" />
|
|
53 |
</copy>
|
|
54 |
<mkdir dir="${workspace}/epoc32" />
|
|
55 |
<copy todir="${workspace}/epoc32">
|
|
56 |
<fileset dir="../" includes="src/**" />
|
|
57 |
</copy>
|
|
58 |
<exec executable="bundle.bat" dir="${workspace}" osfamily="windows">
|
|
59 |
<arg line="create-xml -n blocks -v 1.0" />
|
|
60 |
<arg value="--source=${workspace}/src" />
|
|
61 |
<arg value="--target=${workspace}/epoc32" />
|
|
62 |
<arg value="${test.temp.dir}/blocks.xml" />
|
|
63 |
</exec>
|
|
64 |
<exec executable="bundle.bat" dir="${workspace}" osfamily="windows">
|
|
65 |
<arg line="create" />
|
|
66 |
<arg line="-o ${repo}" />
|
|
67 |
<arg value="${test.temp.dir}/blocks.xml" />
|
|
68 |
</exec>
|
|
69 |
<hlm:blocksCreateRepositoryIndex dest="${repo}" verbose="true" />
|
|
70 |
</then>
|
|
71 |
</ac:if>
|
|
72 |
</target>
|
|
73 |
|
|
74 |
<target name="tearDown">
|
|
75 |
<ac:if>
|
|
76 |
<isset property="execute.test" />
|
|
77 |
<then>
|
|
78 |
<hlm:blocksRemoveWorkspace wsid="${wsid}" />
|
|
79 |
</then>
|
|
80 |
</ac:if>
|
|
81 |
<delete dir="${workspace}" />
|
|
82 |
</target>
|
|
83 |
|
|
84 |
<target name="test-add-repo-fail-if-url-is-not-defined" if="execute.test">
|
|
85 |
<au:expectfailure expectedMessage="'url' attribute has not been defined.">
|
|
86 |
<hlm:blocksAddRepository wsid="${wsid}" />
|
|
87 |
</au:expectfailure>
|
|
88 |
</target>
|
|
89 |
|
|
90 |
<target name="test-add-repo-fail-if-url-is-not-defined-with-name" if="execute.test">
|
|
91 |
<au:expectfailure expectedMessage="'url' attribute has not been defined.">
|
|
92 |
<hlm:blocksAddRepository wsid="${wsid}" name="demo"/>
|
|
93 |
</au:expectfailure>
|
|
94 |
</target>
|
|
95 |
|
|
96 |
<target name="test-add-repo-fail-if-url-defined-with-nested-reposet" if="execute.test">
|
|
97 |
<au:expectfailure expectedMessage="'url' attribute and nested repositorySet element cannot be used at the same time.">
|
|
98 |
<hlm:blocksAddRepository wsid="${wsid}" url="${repo}">
|
|
99 |
<repositorySet />
|
|
100 |
</hlm:blocksAddRepository>
|
|
101 |
</au:expectfailure>
|
|
102 |
</target>
|
|
103 |
|
|
104 |
<target name="test-add-repo-fail-if-nested-reposet-has-invalid-reference-type" if="execute.test">
|
|
105 |
<patternset id="patternset.id" />
|
|
106 |
<au:expectfailure expectedMessage="The type referenced by patternset.id is not of RepositorySet type.">
|
|
107 |
<hlm:blocksAddRepository wsid="${wsid}">
|
|
108 |
<repositorySet refid="patternset.id" />
|
|
109 |
</hlm:blocksAddRepository>
|
|
110 |
</au:expectfailure>
|
|
111 |
</target>
|
|
112 |
|
|
113 |
<target name="test-add-repo-is-working-using-url" if="execute.test">
|
|
114 |
<au:assertFalse message="The workspace should not have any repo allocted yet.">
|
|
115 |
<hlm:blocksRepositoryExists wsid="${wsid}" />
|
|
116 |
</au:assertFalse>
|
|
117 |
<hlm:blocksAddRepository wsid="${wsid}" url="file:${repo}" />
|
|
118 |
<au:assertTrue message="The workspace should have a declared repo.">
|
|
119 |
<hlm:blocksRepositoryExists wsid="${wsid}" />
|
|
120 |
</au:assertTrue>
|
|
121 |
</target>
|
|
122 |
|
|
123 |
<target name="test-add-repo-is-working-using-url-and-name" if="execute.test">
|
|
124 |
<au:assertFalse message="The workspace should not have any repo allocted yet.">
|
|
125 |
<hlm:blocksRepositoryExists wsid="${wsid}" />
|
|
126 |
</au:assertFalse>
|
|
127 |
<hlm:blocksAddRepository wsid="${wsid}" name="demo" url="file:${repo}" />
|
|
128 |
<au:assertTrue message="The workspace should have a declared repo.">
|
|
129 |
<hlm:blocksRepositoryExists wsid="${wsid}" name="demo" />
|
|
130 |
</au:assertTrue>
|
|
131 |
</target>
|
|
132 |
|
|
133 |
<target name="test-add-repo-is-working-using-nested-reposet" if="execute.test">
|
|
134 |
<au:assertFalse message="The workspace should not have any repo allocted yet.">
|
|
135 |
<hlm:blocksRepositoryExists wsid="${wsid}" />
|
|
136 |
</au:assertFalse>
|
|
137 |
<hlm:blocksAddRepository wsid="${wsid}">
|
|
138 |
<repositorySet>
|
|
139 |
<repository name="demo" url="file:${repo}" />
|
|
140 |
</repositorySet>
|
|
141 |
</hlm:blocksAddRepository>
|
|
142 |
<au:assertTrue message="The workspace should have a declared repo.">
|
|
143 |
<hlm:blocksRepositoryExists wsid="${wsid}" name="demo" />
|
|
144 |
</au:assertTrue>
|
|
145 |
</target>
|
|
146 |
|
|
147 |
<hlm:blocksRepositorySet id="reposet.id">
|
|
148 |
<repository name="demo" url="file:${repo}" />
|
|
149 |
</hlm:blocksRepositorySet>
|
|
150 |
|
|
151 |
<target name="test-add-repo-is-working-using-nested-reposet-ref" if="execute.test">
|
|
152 |
<au:assertFalse message="The workspace should not have any repo allocted yet.">
|
|
153 |
<hlm:blocksRepositoryExists wsid="${wsid}" />
|
|
154 |
</au:assertFalse>
|
|
155 |
<hlm:blocksAddRepository wsid="${wsid}">
|
|
156 |
<repositorySet refid="reposet.id" />
|
|
157 |
</hlm:blocksAddRepository>
|
|
158 |
<au:assertTrue message="The workspace should have a declared repo.">
|
|
159 |
<hlm:blocksRepositoryExists wsid="${wsid}" name="demo" />
|
|
160 |
</au:assertTrue>
|
|
161 |
</target>
|
|
162 |
|
|
163 |
<target name="test-remove-repo-fail-if-repositoryId-is-not-defined" if="execute.test">
|
|
164 |
<au:expectfailure message="'repositoryId' attribute has not been defined.">
|
|
165 |
<hlm:blocksRemoveRepository wsid="${wsid}" />
|
|
166 |
</au:expectfailure>
|
|
167 |
</target>
|
|
168 |
|
|
169 |
<target name="test-remove-repo-fail-if-repositoryId-and-name-are-defined" if="execute.test">
|
|
170 |
<au:expectfailure message="'repositoryId' attribute has not been defined.">
|
|
171 |
<hlm:blocksRemoveRepository wsid="${wsid}" />
|
|
172 |
</au:expectfailure>
|
|
173 |
</target>
|
|
174 |
|
|
175 |
<target name="test-remove-repo-with-repositoryid" if="execute.test">
|
|
176 |
<au:assertFalse message="The workspace should not have any repo allocted yet.">
|
|
177 |
<hlm:blocksRepositoryExists wsid="${wsid}" />
|
|
178 |
</au:assertFalse>
|
|
179 |
<hlm:blocksAddRepository wsid="${wsid}">
|
|
180 |
<repositorySet>
|
|
181 |
<repository name="demo" url="file:${repo}" />
|
|
182 |
</repositorySet>
|
|
183 |
</hlm:blocksAddRepository>
|
|
184 |
<au:assertTrue message="The workspace should have a declared repo.">
|
|
185 |
<hlm:blocksRepositoryExists wsid="${wsid}" name="demo" />
|
|
186 |
</au:assertTrue>
|
|
187 |
<hlm:blocksRemoveRepository wsid="${wsid}" repositoryId="1" />
|
|
188 |
<au:assertFalse message="The workspace should not have any declared repo.">
|
|
189 |
<hlm:blocksRepositoryExists wsid="${wsid}" />
|
|
190 |
</au:assertFalse>
|
|
191 |
</target>
|
|
192 |
|
|
193 |
<target name="test-remove-repo-with-name" if="execute.test">
|
|
194 |
<au:assertFalse message="The workspace should not have any repo allocted yet.">
|
|
195 |
<hlm:blocksRepositoryExists wsid="${wsid}" />
|
|
196 |
</au:assertFalse>
|
|
197 |
<hlm:blocksAddRepository wsid="${wsid}">
|
|
198 |
<repositorySet>
|
|
199 |
<repository name="demo" url="file:${repo}" />
|
|
200 |
</repositorySet>
|
|
201 |
</hlm:blocksAddRepository>
|
|
202 |
<au:assertTrue message="The workspace should have a declared repo.">
|
|
203 |
<hlm:blocksRepositoryExists wsid="${wsid}" name="demo" />
|
|
204 |
</au:assertTrue>
|
|
205 |
<hlm:blocksRemoveRepository wsid="${wsid}" name="demo" />
|
|
206 |
<au:assertFalse message="The workspace should not have a declared repo.">
|
|
207 |
<hlm:blocksRepositoryExists wsid="${wsid}" name="demo" />
|
|
208 |
</au:assertFalse>
|
|
209 |
</target>
|
|
210 |
|
|
211 |
|
|
212 |
</project>
|