1 | /* Copyright (C) 2012 Red Hat
|
---|
2 |
|
---|
3 | This file is part of IcedTea.
|
---|
4 |
|
---|
5 | IcedTea is free software; you can redistribute it and/or modify
|
---|
6 | it under the terms of the GNU General Public License as published by
|
---|
7 | the Free Software Foundation; either version 2, or (at your option)
|
---|
8 | any later version.
|
---|
9 |
|
---|
10 | IcedTea is distributed in the hope that it will be useful, but
|
---|
11 | WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
13 | General Public License for more details.
|
---|
14 |
|
---|
15 | You should have received a copy of the GNU General Public License
|
---|
16 | along with IcedTea; see the file COPYING. If not, write to the
|
---|
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
---|
18 | 02110-1301 USA.
|
---|
19 |
|
---|
20 | Linking this library statically or dynamically with other modules is
|
---|
21 | making a combined work based on this library. Thus, the terms and
|
---|
22 | conditions of the GNU General Public License cover the whole
|
---|
23 | combination.
|
---|
24 |
|
---|
25 | As a special exception, the copyright holders of this library give you
|
---|
26 | permission to link this library with independent modules to produce an
|
---|
27 | executable, regardless of the license terms of these independent
|
---|
28 | modules, and to copy and distribute the resulting executable under
|
---|
29 | terms of your choice, provided that you also meet, for each linked
|
---|
30 | independent module, the terms and conditions of the license of that
|
---|
31 | module. An independent module is a module which is not derived from
|
---|
32 | or based on this library. If you modify this library, you may extend
|
---|
33 | this exception to your version of the library, but you are not
|
---|
34 | obligated to do so. If you do not wish to do so, delete this
|
---|
35 | exception statement from your version. */
|
---|
36 |
|
---|
37 | #include <UnitTest++.h>
|
---|
38 | #include <unistd.h>
|
---|
39 | #include <sys/types.h>
|
---|
40 | #include <pwd.h>
|
---|
41 | #include <cstdio>
|
---|
42 | #include <cstdlib>
|
---|
43 | #include <string>
|
---|
44 | #include <functional>
|
---|
45 | #include <cctype>
|
---|
46 | #include <locale>
|
---|
47 | #include <iostream>
|
---|
48 | #include <fstream>
|
---|
49 | #include "IcedTeaParseProperties.h"
|
---|
50 |
|
---|
51 | using namespace std;
|
---|
52 |
|
---|
53 | //not exposed via IcedTeaParseProperties but needed
|
---|
54 | extern void remove_all_spaces(string& str);
|
---|
55 | extern bool get_property_value(string c, string& dest);
|
---|
56 | extern bool starts_with(string c1, string c2);
|
---|
57 | extern string user_properties_file();
|
---|
58 | extern string main_properties_file();
|
---|
59 | extern string default_java_properties_file();
|
---|
60 | //for passing three dummy files
|
---|
61 | bool find_system_config_file(string main_file, string custom_jre_file, bool usecustom_jre, string default_java_file, string& dest);
|
---|
62 | bool find_property(string filename, string property, string& dest);
|
---|
63 | //for passing two dummy files
|
---|
64 | bool read_deploy_property_value(string user_file, string system_file, bool usesystem_file, string property, string& dest);
|
---|
65 | //for passing two dummy files
|
---|
66 | bool find_custom_jre(string user_file, string main_file,string& dest);
|
---|
67 | //end of non-public IcedTeaParseProperties api
|
---|
68 |
|
---|
69 | /* Creates a temporary file with the specified contents */
|
---|
70 | static string temporary_file(const string& contents) {
|
---|
71 | string path = tmpnam(NULL); /* POSIX function, fine for test suite */
|
---|
72 | ofstream myfile;
|
---|
73 | myfile.open (path.c_str());
|
---|
74 | myfile << contents;
|
---|
75 | myfile.close();
|
---|
76 | return path;
|
---|
77 | }
|
---|
78 |
|
---|
79 |
|
---|
80 |
|
---|
81 | /*private api fundamental tests*/
|
---|
82 | TEST(RemoveAllSpaces) {
|
---|
83 | string toBeTrimmed = string(" te st X ");
|
---|
84 | remove_all_spaces (toBeTrimmed);
|
---|
85 | CHECK_EQUAL("testX", toBeTrimmed);
|
---|
86 |
|
---|
87 | string toBeTrimmed1 = string(" te st X ");
|
---|
88 | remove_all_spaces (toBeTrimmed1);
|
---|
89 | CHECK_EQUAL("testX", toBeTrimmed1);
|
---|
90 |
|
---|
91 | string toBeTrimmed2 = string(" \t t e\nst\tX\n");
|
---|
92 | remove_all_spaces (toBeTrimmed2);
|
---|
93 | CHECK_EQUAL("testX", toBeTrimmed2);
|
---|
94 |
|
---|
95 | string toBeTrimmed3 = string(" \t \n te \n stX\n");
|
---|
96 | remove_all_spaces (toBeTrimmed3);
|
---|
97 | CHECK_EQUAL("testX", toBeTrimmed3);
|
---|
98 |
|
---|
99 | }
|
---|
100 |
|
---|
101 |
|
---|
102 | TEST(get_property_value) {
|
---|
103 | string dest = string("");
|
---|
104 | bool a = get_property_value("key.key=value+eulav ",dest);
|
---|
105 | CHECK_EQUAL("value+eulav", dest);
|
---|
106 | CHECK_EQUAL(a, true);
|
---|
107 |
|
---|
108 | dest = string("");
|
---|
109 | a = get_property_value("horrible key = value/value",dest);
|
---|
110 | CHECK_EQUAL("value/value", dest);
|
---|
111 | CHECK_EQUAL(a, true);
|
---|
112 |
|
---|
113 | dest = string("");
|
---|
114 | a = get_property_value("better.key = but very horrible value ",dest);
|
---|
115 | CHECK_EQUAL("but very horrible value", dest);
|
---|
116 | CHECK_EQUAL(a, true);
|
---|
117 |
|
---|
118 | dest = string("");
|
---|
119 | a = get_property_value("better.key but errornous value ",dest);
|
---|
120 | CHECK_EQUAL("", dest);
|
---|
121 | CHECK_EQUAL(a, false);
|
---|
122 | }
|
---|
123 |
|
---|
124 | TEST(starts_with) {
|
---|
125 | bool a = starts_with("aa bb cc","aa b");
|
---|
126 | CHECK_EQUAL(a, true);
|
---|
127 |
|
---|
128 | a = starts_with("aa bb cc","aab");
|
---|
129 | CHECK_EQUAL(a, false);
|
---|
130 | }
|
---|
131 |
|
---|
132 |
|
---|
133 | TEST(user_properties_file) {
|
---|
134 | string f = user_properties_file();
|
---|
135 | CHECK_EQUAL(f.find(".icedtea") >= 0, true);
|
---|
136 | CHECK_EQUAL(f.find(default_file_ITW_deploy_props_name) >= 0, true);
|
---|
137 | }
|
---|
138 |
|
---|
139 | TEST(main_properties_file) {
|
---|
140 | string f = main_properties_file();
|
---|
141 | CHECK_EQUAL(f.find(default_file_ITW_deploy_props_name) >= 0, true);
|
---|
142 | CHECK_EQUAL(f.find(".java") >= 0, true);
|
---|
143 | }
|
---|
144 |
|
---|
145 | TEST(default_java_properties_file) {
|
---|
146 | string f = default_java_properties_file();
|
---|
147 | CHECK_EQUAL(f.find(default_file_ITW_deploy_props_name) >= 0, true);
|
---|
148 | CHECK_EQUAL(f.find("lib") >= 0, true);
|
---|
149 | }
|
---|
150 |
|
---|
151 |
|
---|
152 | TEST(find_system_config_file) {
|
---|
153 | string f1 = temporary_file("key1=value1");
|
---|
154 | string f2 = temporary_file("key2=value2");
|
---|
155 | string f3 = temporary_file("key3=value3");
|
---|
156 | string dest=string("");
|
---|
157 | find_system_config_file(f1, f2, true, f3, dest);
|
---|
158 | CHECK_EQUAL(f1, dest);
|
---|
159 | dest=string("");
|
---|
160 | find_system_config_file(f1, f2, false, f3, dest);
|
---|
161 | CHECK_EQUAL(f1, dest);
|
---|
162 |
|
---|
163 | remove(f1.c_str());
|
---|
164 | dest=string("");
|
---|
165 | find_system_config_file(f1, f2, true, f3, dest);
|
---|
166 | CHECK_EQUAL(f2, dest);
|
---|
167 | dest=string("");
|
---|
168 | find_system_config_file(f1, f2, false, f3, dest);
|
---|
169 | CHECK_EQUAL(f3, dest);
|
---|
170 |
|
---|
171 | remove(f2.c_str());
|
---|
172 | dest=string("");
|
---|
173 | find_system_config_file(f1, f2, true, f3, dest);
|
---|
174 | CHECK_EQUAL("", dest); //forcing not existing f2
|
---|
175 | dest=string("");
|
---|
176 | find_system_config_file(f1, f2, false, f3, dest);
|
---|
177 | CHECK_EQUAL(f3, dest);
|
---|
178 |
|
---|
179 | remove(f3.c_str());
|
---|
180 | dest=string("");
|
---|
181 | find_system_config_file(f1, f2, true, f3, dest);
|
---|
182 | CHECK_EQUAL("", dest);
|
---|
183 | dest=string("");
|
---|
184 | find_system_config_file(f1, f2, true, f3, dest);
|
---|
185 | CHECK_EQUAL("", dest);
|
---|
186 | }
|
---|
187 |
|
---|
188 | TEST(find_property) {
|
---|
189 | string f1 = temporary_file("key1=value1");
|
---|
190 | string dest=string("");
|
---|
191 | find_property(f1, "key1", dest);
|
---|
192 | CHECK_EQUAL("value1", dest);
|
---|
193 | dest=string("");
|
---|
194 | find_property(f1, "key2", dest);
|
---|
195 | CHECK_EQUAL("", dest);
|
---|
196 | dest=string("");
|
---|
197 | find_property(f1, "value1", dest);
|
---|
198 | CHECK_EQUAL("", dest);
|
---|
199 | remove(f1.c_str());
|
---|
200 |
|
---|
201 | string f2 = temporary_file("key2 =value2 key3=value3\n key5 = value5");
|
---|
202 | dest=string("");
|
---|
203 | find_property(f2, "key2", dest);
|
---|
204 | CHECK_EQUAL("value2 key3=value3", dest);
|
---|
205 | dest=string("");
|
---|
206 | find_property(f2, "key1", dest);
|
---|
207 | CHECK_EQUAL("", dest);
|
---|
208 | dest=string("");
|
---|
209 | find_property(f2, "key3", dest);
|
---|
210 | CHECK_EQUAL("", dest);
|
---|
211 | dest=string("");
|
---|
212 | find_property(f2, "key5", dest);
|
---|
213 | CHECK_EQUAL("value5", dest);
|
---|
214 | remove(f2.c_str());
|
---|
215 |
|
---|
216 | string f3 = temporary_file("ke.y3= value3\nkey4=value4");
|
---|
217 | dest=string("");
|
---|
218 | find_property(f3, "ke.y3", dest);
|
---|
219 | CHECK_EQUAL("value3", dest);
|
---|
220 | dest=string("");
|
---|
221 | find_property(f3, "key4", dest);
|
---|
222 | CHECK_EQUAL("value4", dest);
|
---|
223 | remove(f3.c_str());
|
---|
224 | }
|
---|
225 |
|
---|
226 | TEST(read_deploy_property_value1) {
|
---|
227 | string f1 = temporary_file("key1=value11");
|
---|
228 | string f2 = temporary_file("key1=value12");
|
---|
229 | string f3 = temporary_file("key2=value23");
|
---|
230 | string dest=string("");
|
---|
231 | read_deploy_property_value(f1,f2,true, "key1", dest);
|
---|
232 | CHECK_EQUAL("value11", dest);
|
---|
233 | dest=string("");
|
---|
234 | read_deploy_property_value(f2,f1,true, "key1", dest);
|
---|
235 | CHECK_EQUAL("value12", dest);
|
---|
236 | dest=string("");
|
---|
237 | read_deploy_property_value(f1,f3,true, "key1", dest);
|
---|
238 | CHECK_EQUAL("value11", dest);
|
---|
239 | dest=string("");
|
---|
240 | read_deploy_property_value(f3,f1,true, "key1", dest);
|
---|
241 | CHECK_EQUAL("value11", dest);
|
---|
242 | read_deploy_property_value(f3,f2,true, "key1", dest);
|
---|
243 | CHECK_EQUAL("value12", dest);
|
---|
244 | dest=string("");
|
---|
245 | read_deploy_property_value(f2,f3,true, "key1", dest);
|
---|
246 | CHECK_EQUAL("value12", dest);
|
---|
247 |
|
---|
248 | dest=string("");
|
---|
249 | read_deploy_property_value(f1,f2,true, "key2", dest);
|
---|
250 | CHECK_EQUAL("", dest);
|
---|
251 | dest=string("");
|
---|
252 | read_deploy_property_value(f2,f1,true, "key2", dest);
|
---|
253 | CHECK_EQUAL("", dest);
|
---|
254 | dest=string("");
|
---|
255 | read_deploy_property_value(f1,f3,true, "key2", dest);
|
---|
256 | CHECK_EQUAL("value23", dest);
|
---|
257 | dest=string("");
|
---|
258 | read_deploy_property_value(f3,f1,true, "key2", dest);
|
---|
259 | CHECK_EQUAL("value23", dest);
|
---|
260 | read_deploy_property_value(f3,f2,true, "key2", dest);
|
---|
261 | CHECK_EQUAL("value23", dest);
|
---|
262 | dest=string("");
|
---|
263 | read_deploy_property_value(f2,f3,true, "key2", dest);
|
---|
264 | CHECK_EQUAL("value23", dest);
|
---|
265 |
|
---|
266 | remove(f1.c_str());/////////////////////////////////
|
---|
267 | dest=string("");
|
---|
268 | read_deploy_property_value(f1,f2,true, "key1", dest);
|
---|
269 | CHECK_EQUAL("value12", dest);
|
---|
270 | dest=string("");
|
---|
271 | read_deploy_property_value(f2,f1,true, "key1", dest);
|
---|
272 | CHECK_EQUAL("value12", dest);
|
---|
273 | dest=string("");
|
---|
274 | read_deploy_property_value(f1,f3,true, "key1", dest);
|
---|
275 | CHECK_EQUAL("", dest);
|
---|
276 | dest=string("");
|
---|
277 | read_deploy_property_value(f3,f1,true, "key1", dest);
|
---|
278 | CHECK_EQUAL("", dest);
|
---|
279 | read_deploy_property_value(f3,f2,true, "key1", dest);
|
---|
280 | CHECK_EQUAL("value12", dest);
|
---|
281 | dest=string("");
|
---|
282 | read_deploy_property_value(f2,f3,true, "key1", dest);
|
---|
283 | CHECK_EQUAL("value12", dest);
|
---|
284 |
|
---|
285 | dest=string("");
|
---|
286 | read_deploy_property_value(f1,f2,true, "key2", dest);
|
---|
287 | CHECK_EQUAL("", dest);
|
---|
288 | dest=string("");
|
---|
289 | read_deploy_property_value(f2,f1,true, "key2", dest);
|
---|
290 | CHECK_EQUAL("", dest);
|
---|
291 | dest=string("");
|
---|
292 | read_deploy_property_value(f1,f3,true, "key2", dest);
|
---|
293 | CHECK_EQUAL("value23", dest);
|
---|
294 | dest=string("");
|
---|
295 | read_deploy_property_value(f3,f1,true, "key2", dest);
|
---|
296 | CHECK_EQUAL("value23", dest);
|
---|
297 | read_deploy_property_value(f3,f2,true, "key2", dest);
|
---|
298 | CHECK_EQUAL("value23", dest);
|
---|
299 | dest=string("");
|
---|
300 | read_deploy_property_value(f2,f3,true, "key2", dest);
|
---|
301 | CHECK_EQUAL("value23", dest);
|
---|
302 |
|
---|
303 | remove(f3.c_str());/////////////////////////////////
|
---|
304 | dest=string("");
|
---|
305 | read_deploy_property_value(f1,f2,true, "key1", dest);
|
---|
306 | CHECK_EQUAL("value12", dest);
|
---|
307 | dest=string("");
|
---|
308 | read_deploy_property_value(f2,f1,true, "key1", dest);
|
---|
309 | CHECK_EQUAL("value12", dest);
|
---|
310 | dest=string("");
|
---|
311 | read_deploy_property_value(f1,f3,true, "key1", dest);
|
---|
312 | CHECK_EQUAL("", dest);
|
---|
313 | dest=string("");
|
---|
314 | read_deploy_property_value(f3,f1,true, "key1", dest);
|
---|
315 | CHECK_EQUAL("", dest);
|
---|
316 | read_deploy_property_value(f3,f2,true, "key1", dest);
|
---|
317 | CHECK_EQUAL("value12", dest);
|
---|
318 | dest=string("");
|
---|
319 | read_deploy_property_value(f2,f3,true, "key1", dest);
|
---|
320 | CHECK_EQUAL("value12", dest);
|
---|
321 |
|
---|
322 | dest=string("");
|
---|
323 | read_deploy_property_value(f1,f2,true, "key2", dest);
|
---|
324 | CHECK_EQUAL("", dest);
|
---|
325 | dest=string("");
|
---|
326 | read_deploy_property_value(f2,f1,true, "key2", dest);
|
---|
327 | CHECK_EQUAL("", dest);
|
---|
328 | dest=string("");
|
---|
329 | read_deploy_property_value(f1,f3,true, "key2", dest);
|
---|
330 | CHECK_EQUAL("", dest);
|
---|
331 | dest=string("");
|
---|
332 | read_deploy_property_value(f3,f1,true, "key2", dest);
|
---|
333 | CHECK_EQUAL("", dest);
|
---|
334 | read_deploy_property_value(f3,f2,true, "key2", dest);
|
---|
335 | CHECK_EQUAL("", dest);
|
---|
336 | dest=string("");
|
---|
337 | read_deploy_property_value(f2,f3,true, "key2", dest);
|
---|
338 | CHECK_EQUAL("", dest);
|
---|
339 |
|
---|
340 | remove(f2.c_str());/////////////////////////////////
|
---|
341 |
|
---|
342 | }
|
---|
343 |
|
---|
344 |
|
---|
345 |
|
---|
346 | TEST(read_deploy_property_value2) {
|
---|
347 | string f1 = temporary_file("key1=value11");
|
---|
348 | string f2 = temporary_file("key1=value12");
|
---|
349 | string f3 = temporary_file("key2=value23");
|
---|
350 | string dest=string("");
|
---|
351 | read_deploy_property_value(f1,f2,false, "key1", dest);
|
---|
352 | CHECK_EQUAL("value11", dest);
|
---|
353 | dest=string("");
|
---|
354 | read_deploy_property_value(f2,f1,false, "key1", dest);
|
---|
355 | CHECK_EQUAL("value12", dest);
|
---|
356 | dest=string("");
|
---|
357 | read_deploy_property_value(f1,f3,false, "key1", dest);
|
---|
358 | CHECK_EQUAL("value11", dest);
|
---|
359 | dest=string("");
|
---|
360 | read_deploy_property_value(f3,f1,false, "key1", dest);
|
---|
361 | CHECK_EQUAL("", dest);
|
---|
362 | read_deploy_property_value(f3,f2,false, "key1", dest);
|
---|
363 | CHECK_EQUAL("", dest);
|
---|
364 | dest=string("");
|
---|
365 | read_deploy_property_value(f2,f3,false, "key1", dest);
|
---|
366 | CHECK_EQUAL("value12", dest);
|
---|
367 |
|
---|
368 | dest=string("");
|
---|
369 | read_deploy_property_value(f1,f2,false, "key2", dest);
|
---|
370 | CHECK_EQUAL("", dest);
|
---|
371 | dest=string("");
|
---|
372 | read_deploy_property_value(f2,f1,false, "key2", dest);
|
---|
373 | CHECK_EQUAL("", dest);
|
---|
374 | dest=string("");
|
---|
375 | read_deploy_property_value(f1,f3,false, "key2", dest);
|
---|
376 | CHECK_EQUAL("", dest);
|
---|
377 | dest=string("");
|
---|
378 | read_deploy_property_value(f3,f1,false, "key2", dest);
|
---|
379 | CHECK_EQUAL("value23", dest);
|
---|
380 | read_deploy_property_value(f3,f2,false, "key2", dest);
|
---|
381 | CHECK_EQUAL("value23", dest);
|
---|
382 | dest=string("");
|
---|
383 | read_deploy_property_value(f2,f3,false, "key2", dest);
|
---|
384 | CHECK_EQUAL("", dest);
|
---|
385 |
|
---|
386 | remove(f1.c_str());/////////////////////////////////
|
---|
387 | dest=string("");
|
---|
388 | read_deploy_property_value(f1,f2,false, "key1", dest);
|
---|
389 | CHECK_EQUAL("", dest);
|
---|
390 | dest=string("");
|
---|
391 | read_deploy_property_value(f2,f1,false, "key1", dest);
|
---|
392 | CHECK_EQUAL("value12", dest);
|
---|
393 | dest=string("");
|
---|
394 | read_deploy_property_value(f1,f3,false, "key1", dest);
|
---|
395 | CHECK_EQUAL("", dest);
|
---|
396 | dest=string("");
|
---|
397 | read_deploy_property_value(f3,f1,false, "key1", dest);
|
---|
398 | CHECK_EQUAL("", dest);
|
---|
399 | read_deploy_property_value(f3,f2,false, "key1", dest);
|
---|
400 | CHECK_EQUAL("", dest);
|
---|
401 | dest=string("");
|
---|
402 | read_deploy_property_value(f2,f3,false, "key1", dest);
|
---|
403 | CHECK_EQUAL("value12", dest);
|
---|
404 |
|
---|
405 | dest=string("");
|
---|
406 | read_deploy_property_value(f1,f2,false, "key2", dest);
|
---|
407 | CHECK_EQUAL("", dest);
|
---|
408 | dest=string("");
|
---|
409 | read_deploy_property_value(f2,f1,false, "key2", dest);
|
---|
410 | CHECK_EQUAL("", dest);
|
---|
411 | dest=string("");
|
---|
412 | read_deploy_property_value(f1,f3,false, "key2", dest);
|
---|
413 | CHECK_EQUAL("", dest);
|
---|
414 | dest=string("");
|
---|
415 | read_deploy_property_value(f3,f1,false, "key2", dest);
|
---|
416 | CHECK_EQUAL("value23", dest);
|
---|
417 | read_deploy_property_value(f3,f2,false, "key2", dest);
|
---|
418 | CHECK_EQUAL("value23", dest);
|
---|
419 | dest=string("");
|
---|
420 | read_deploy_property_value(f2,f3,false, "key2", dest);
|
---|
421 | CHECK_EQUAL("", dest);
|
---|
422 |
|
---|
423 | remove(f3.c_str());/////////////////////////////////
|
---|
424 | dest=string("");
|
---|
425 | read_deploy_property_value(f1,f2,false, "key1", dest);
|
---|
426 | CHECK_EQUAL("", dest);
|
---|
427 | dest=string("");
|
---|
428 | read_deploy_property_value(f2,f1,false, "key1", dest);
|
---|
429 | CHECK_EQUAL("value12", dest);
|
---|
430 | dest=string("");
|
---|
431 | read_deploy_property_value(f1,f3,false, "key1", dest);
|
---|
432 | CHECK_EQUAL("", dest);
|
---|
433 | dest=string("");
|
---|
434 | read_deploy_property_value(f3,f1,false, "key1", dest);
|
---|
435 | CHECK_EQUAL("", dest);
|
---|
436 | read_deploy_property_value(f3,f2,false, "key1", dest);
|
---|
437 | CHECK_EQUAL("", dest);
|
---|
438 | dest=string("");
|
---|
439 | read_deploy_property_value(f2,f3,false, "key1", dest);
|
---|
440 | CHECK_EQUAL("value12", dest);
|
---|
441 |
|
---|
442 | dest=string("");
|
---|
443 | read_deploy_property_value(f1,f2,false, "key2", dest);
|
---|
444 | CHECK_EQUAL("", dest);
|
---|
445 | dest=string("");
|
---|
446 | read_deploy_property_value(f2,f1,false, "key2", dest);
|
---|
447 | CHECK_EQUAL("", dest);
|
---|
448 | dest=string("");
|
---|
449 | read_deploy_property_value(f1,f3,false, "key2", dest);
|
---|
450 | CHECK_EQUAL("", dest);
|
---|
451 | dest=string("");
|
---|
452 | read_deploy_property_value(f3,f1,false, "key2", dest);
|
---|
453 | CHECK_EQUAL("", dest);
|
---|
454 | read_deploy_property_value(f3,f2,false, "key2", dest);
|
---|
455 | CHECK_EQUAL("", dest);
|
---|
456 | dest=string("");
|
---|
457 | read_deploy_property_value(f2,f3,false, "key2", dest);
|
---|
458 | CHECK_EQUAL("", dest);
|
---|
459 |
|
---|
460 | remove(f2.c_str());/////////////////////////////////
|
---|
461 | }
|
---|
462 |
|
---|
463 |
|
---|
464 | TEST(find_custom_jre) {
|
---|
465 | string f1 = temporary_file(custom_jre_key+"=value11");
|
---|
466 | string f2 = temporary_file(custom_jre_key+"=value12");
|
---|
467 | string f3 = temporary_file("key2=value23");
|
---|
468 | string f4 = temporary_file("key2=value24");
|
---|
469 | string dest=string("");
|
---|
470 | find_custom_jre(f1,f2, dest);
|
---|
471 | CHECK_EQUAL("value11", dest);
|
---|
472 | dest=string("");
|
---|
473 | find_custom_jre(f2,f1, dest);
|
---|
474 | CHECK_EQUAL("value12", dest);
|
---|
475 | dest=string("");
|
---|
476 | find_custom_jre(f1,f3, dest);
|
---|
477 | CHECK_EQUAL("value11", dest);
|
---|
478 | dest=string("");
|
---|
479 | find_custom_jre(f3,f1, dest);
|
---|
480 | CHECK_EQUAL("value11", dest);
|
---|
481 | dest=string("");
|
---|
482 | find_custom_jre(f3,f4, dest);
|
---|
483 | CHECK_EQUAL("", dest);
|
---|
484 | remove(f1.c_str());/////////////////////////////////
|
---|
485 | dest=string("");
|
---|
486 | find_custom_jre(f1,f2, dest);
|
---|
487 | CHECK_EQUAL("value12", dest);
|
---|
488 | dest=string("");
|
---|
489 | find_custom_jre(f2,f1, dest);
|
---|
490 | CHECK_EQUAL("value12", dest);
|
---|
491 | dest=string("");
|
---|
492 | find_custom_jre(f1,f3, dest);
|
---|
493 | CHECK_EQUAL("", dest);
|
---|
494 | dest=string("");
|
---|
495 | find_custom_jre(f3,f1, dest);
|
---|
496 | CHECK_EQUAL("", dest);
|
---|
497 | remove(f3.c_str());/////////////////////////////////
|
---|
498 | dest=string("");
|
---|
499 | find_custom_jre(f1,f2, dest);
|
---|
500 | CHECK_EQUAL("value12", dest);
|
---|
501 | dest=string("");
|
---|
502 | find_custom_jre(f2,f1, dest);
|
---|
503 | CHECK_EQUAL("value12", dest);
|
---|
504 | dest=string("");
|
---|
505 | find_custom_jre(f1,f3, dest);
|
---|
506 | CHECK_EQUAL("", dest);
|
---|
507 | dest=string("");
|
---|
508 | find_custom_jre(f3,f1, dest);
|
---|
509 | CHECK_EQUAL("", dest);
|
---|
510 | remove(f2.c_str());/////////////////////////////////
|
---|
511 | dest=string("");
|
---|
512 | find_custom_jre(f1,f2, dest);
|
---|
513 | CHECK_EQUAL("", dest);
|
---|
514 | dest=string("");
|
---|
515 | find_custom_jre(f2,f1, dest);
|
---|
516 | CHECK_EQUAL("", dest);
|
---|
517 | dest=string("");
|
---|
518 | find_custom_jre(f1,f3, dest);
|
---|
519 | CHECK_EQUAL("", dest);
|
---|
520 | dest=string("");
|
---|
521 | find_custom_jre(f3,f1, dest);
|
---|
522 | CHECK_EQUAL("", dest);
|
---|
523 | remove(f4.c_str());/////////////////////////////////
|
---|
524 |
|
---|
525 | }
|
---|