00001 #include "config.h"
00002
00003 #include <iostream>
00004 #include <string>
00005 #include <cassert>
00006
00007 #ifdef HAVE_UNISTD_H
00008 #include <unistd.h>
00009 #endif
00010
00011 #include <errno.h>
00012
00013 #include "asserts.h"
00014 #include "types.h"
00015 #include "error.h"
00016 #include "estring.h"
00017 #include "fs.h"
00018 #include "tstamp.h"
00019 #include "rconfig.h"
00020
00021
00022 #define ERR_OUT(e)
00023
00024 bool make_dir(const std::string& path)
00025 {
00026 bool thrown;
00027
00028 thrown = false;
00029 try {
00030 mk_dir(path);
00031 }
00032 catch(...) {
00033 thrown = true;
00034 }
00035 return(thrown == false);
00036 }
00037
00038 void cleanup(void)
00039 {
00040 assert(system("rm -fr ./test-rconfig.dir") == 0);
00041 }
00042
00043 void setup(void)
00044 {
00045 std::ofstream out;
00046
00047 assert(make_dir("./test-rconfig.dir"));
00048 assert(make_dir("./test-rconfig.dir/catalog.dir"));
00049 assert(make_dir("./test-rconfig.dir/log.dir"));
00050 assert(make_dir("./test-rconfig.dir/vaults"));
00051 assert(make_dir("./test-rconfig.dir/vaults/vault-1"));
00052 assert(make_dir("./test-rconfig.dir/vaults/vault-2"));
00053 assert(make_dir("./test-rconfig.dir/vaults/vault-3"));
00054 assert(make_dir("./test-rconfig.dir/excludes.dir"));
00055
00056 out.open("./test-rconfig.dir/excludes.dir/excludes.group-A.file-1");
00057 assert(out.is_open());
00058 out.close();
00059 out.open("./test-rconfig.dir/excludes.dir/excludes.group-A.file-2");
00060 assert(out.is_open());
00061 out.close();
00062 out.open("./test-rconfig.dir/excludes.dir/excludes.group-A.file-3");
00063 assert(out.is_open());
00064 out.close();
00065 out.open("./test-rconfig.dir/excludes.dir/excludes.group-B.file-1");
00066 assert(out.is_open());
00067 out.close();
00068 out.open("./test-rconfig.dir/excludes.dir/excludes.group-B.file-2");
00069 assert(out.is_open());
00070 out.close();
00071
00072
00073
00074
00075 assert(make_dir("./test-rconfig.dir/nonexistent"));
00076 out.open("./test-rconfig.dir/nonexistent/default.conf");
00077 out << "include nonexistent-file.conf" << std::endl;
00078 assert(out.is_open());
00079 out.close();
00080
00081
00082
00083
00084 assert(make_dir("./test-rconfig.dir/global-include.dir"));
00085
00086 out.open("./test-rconfig.dir/global-include.dir/file-1.conf");
00087 assert(out.is_open());
00088 out << "include nonexistent-file.conf" << std::endl;
00089 out.close();
00090
00091 out.open("./test-rconfig.dir/global-include.dir/file-2.conf");
00092 assert(out.is_open());
00093 out << "include file-2.1.conf" << std::endl;
00094 out.close();
00095
00096 out.open("./test-rconfig.dir/global-include.dir/file-2.1.conf");
00097 assert(out.is_open());
00098 out << "include file-2.2.conf" << std::endl;
00099 out.close();
00100
00101 out.open("./test-rconfig.dir/global-include.dir/file-3.conf");
00102 assert(out.is_open());
00103 out << "include file-3.1.conf" << std::endl;
00104 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00105 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00106 out.close();
00107
00108 out.open("./test-rconfig.dir/global-include.dir/file-3.1.conf");
00109 assert(out.is_open());
00110 out << "include file-3.2.conf";
00111 out.close();
00112
00113 out.open("./test-rconfig.dir/global-include.dir/file-3.2.conf");
00114 assert(out.is_open());
00115 out.close();
00116
00117 out.open("./test-rconfig.dir/global-include.dir/file-4.conf");
00118 assert(out.is_open());
00119 out << "include file-4.1.conf" << std::endl;
00120 out.close();
00121
00122 out.open("./test-rconfig.dir/global-include.dir/file-4.1.conf");
00123 assert(out.is_open());
00124 out << std::endl;
00125 out << std::endl;
00126 out << "include file-4.2.conf" << std::endl;
00127 out.close();
00128
00129 out.open("./test-rconfig.dir/global-include.dir/file-4.2.conf");
00130 assert(out.is_open());
00131 out << std::endl;
00132 out << "include " << std::endl;
00133 out.close();
00134
00135 out.open("./test-rconfig.dir/global-include.dir/file-5.conf");
00136 assert(out.is_open());
00137 out << "include file-5.1.conf" << std::endl;
00138 out.close();
00139
00140 out.open("./test-rconfig.dir/global-include.dir/file-5.1.conf");
00141 assert(out.is_open());
00142 out << std::endl;
00143 out << std::endl;
00144 out << "include file-5.2.conf" << std::endl;
00145 out.close();
00146
00147 out.open("./test-rconfig.dir/global-include.dir/file-5.2.conf");
00148 assert(out.is_open());
00149 out << std::endl;
00150 out << "include file-5.conf" << std::endl;
00151 out.close();
00152
00153 out.open("./test-rconfig.dir/global-include.dir/file-6.conf");
00154 assert(out.is_open());
00155 out << "# This is a comment" << std::endl;
00156 out << "# include" << std::endl;
00157 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00158 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00159 out.close();
00160
00161 out.open("./test-rconfig.dir/global-include.dir/file-7.conf");
00162 assert(out.is_open());
00163 out << "include file-7.dir/file-7.1.conf" << std::endl;
00164 out.close();
00165
00166 assert(make_dir("./test-rconfig.dir/global-include.dir/file-7.dir"));
00167
00168 out.open("./test-rconfig.dir/global-include.dir/file-7.dir/file-7.1.conf");
00169 assert(out.is_open());
00170 out << "include ../file-7.2.conf" << std::endl;
00171 out.close();
00172
00173 out.open("./test-rconfig.dir/global-include.dir/file-7.2.conf");
00174 assert(out.is_open());
00175 out << "include file-7.dir/dir.2/*" << std::endl;
00176 out.close();
00177
00178 assert(make_dir("./test-rconfig.dir/global-include.dir/file-7.dir/dir.2"));
00179
00180 out.open("./test-rconfig.dir/global-include.dir/file-7.dir/dir.2/file-7.3.1.conf");
00181 assert(out.is_open());
00182 out.close();
00183
00184 out.open("./test-rconfig.dir/global-include.dir/file-7.dir/dir.2/file-7.3.2.conf");
00185 assert(out.is_open());
00186 out.close();
00187
00188 out.open("./test-rconfig.dir/global-include.dir/file-7.dir/dir.2/file-7.3.3.conf");
00189 assert(out.is_open());
00190 out.close();
00191
00192 out.open("./test-rconfig.dir/global-include.dir/file-7.dir/dir.2/file-7.3.4.conf");
00193 assert(out.is_open());
00194 out << "include ../../nonexistent-file.conf" << std::endl;
00195 out.close();
00196
00197
00198
00199
00200
00201
00202 assert(make_dir("./test-rconfig.dir/job-include.dir"));
00203
00204 out.open("./test-rconfig.dir/job-include.dir/file-1.conf");
00205 assert(out.is_open());
00206 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00207 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00208 out << "<default>" << std::endl;
00209 out << " path /var/spool" << std::endl;
00210 out << "</default>" << std::endl;
00211 out << std::endl;
00212 out << "<job>" << std::endl;
00213 out << " hostname host-A" << std::endl;
00214 out << "</job>" << std::endl;
00215 out << "include file-1.job-1.job" << std::endl;
00216 out << "include-job file-1.job-2.job" << std::endl;
00217 out.close();
00218
00219 out.open("./test-rconfig.dir/job-include.dir/file-1.job-1.job");
00220 assert(out.is_open());
00221 out << "<job>" << std::endl;
00222 out << " include file-1.job-1.2.job" << std::endl;
00223 out << "</job>" << std::endl;
00224 out.close();
00225
00226 out.open("./test-rconfig.dir/job-include.dir/file-1.job-1.2.job");
00227 assert(out.is_open());
00228 out << "hostname host-B" << std::endl;
00229 out.close();
00230
00231 out.open("./test-rconfig.dir/job-include.dir/file-1.job-2.job");
00232 assert(out.is_open());
00233 out << "hostname host-C" << std::endl;
00234 out.close();
00235
00236
00237
00238
00239 assert(make_dir("./test-rconfig.dir/global-link-catalog-dir.dir"));
00240
00241 out.open("./test-rconfig.dir/global-link-catalog-dir.dir/file-1.conf");
00242 assert(out.is_open());
00243 out << "link-catalog-dir ./test-rconfig.dir/dne-catalog.dir" << std::endl;
00244 out.close();
00245
00246 out.open("./test-rconfig.dir/global-link-catalog-dir.dir/file-2.conf");
00247 assert(out.is_open());
00248 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00249 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00250 out << "link-catalog-dir ./test-rconfig.dir/catalog.dir" << std::endl;
00251 out.close();
00252
00253 out.open("./test-rconfig.dir/global-link-catalog-dir.dir/file-3.conf");
00254 assert(out.is_open());
00255 out << "link-catalog-dir ./test-rconfig.dir/global-link-catalog-dir.dir/file-1.conf" << std::endl;
00256 out.close();
00257
00258
00259
00260
00261 assert(make_dir("./test-rconfig.dir/global-log-dir.dir"));
00262
00263 out.open("./test-rconfig.dir/global-log-dir.dir/file-1.conf");
00264 assert(out.is_open());
00265 out << "log-dir ./test-rconfig.dir/dne-log.dir" << std::endl;
00266 out.close();
00267
00268 out.open("./test-rconfig.dir/global-log-dir.dir/file-2.conf");
00269 assert(out.is_open());
00270 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00271 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00272 out.close();
00273
00274 out.open("./test-rconfig.dir/global-log-dir.dir/file-3.conf");
00275 assert(out.is_open());
00276 out << "log-dir ./test-rconfig.dir/global-log-dir.dir/file-1.conf" << std::endl;
00277 out.close();
00278
00279
00280
00281
00282 assert(make_dir("./test-rconfig.dir/global-rsync-local-path.dir"));
00283
00284 out.open("./test-rconfig.dir/global-rsync-local-path.dir/file-1.conf");
00285 assert(out.is_open());
00286 out
00287 << "rsync-local-path ./test-rconfig.dir/global-rsync-local-path.dir/nonexistent-path"
00288 << std::endl;
00289 out.close();
00290
00291 out.open("./test-rconfig.dir/global-rsync-local-path.dir/file-2.conf");
00292 assert(out.is_open());
00293 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00294 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00295 out
00296 << "rsync-local-path "
00297 << "./test-rconfig.dir/global-rsync-local-path.dir/file-1.conf"
00298 << std::endl;
00299 out.close();
00300
00301
00302
00303
00304 assert(make_dir("./test-rconfig.dir/global-rsync-parallel.dir"));
00305
00306 out.open("./test-rconfig.dir/global-rsync-parallel.dir/file-1.conf");
00307 assert(out.is_open());
00308 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00309 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00310 out << "rsync-parallel 0" << std::endl;
00311 out.close();
00312
00313 out.open("./test-rconfig.dir/global-rsync-parallel.dir/file-2.conf");
00314 assert(out.is_open());
00315 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00316 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00317 out << "rsync-parallel 2" << std::endl;
00318 out.close();
00319
00320 out.open("./test-rconfig.dir/global-rsync-parallel.dir/file-3.conf");
00321 assert(out.is_open());
00322 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00323 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00324 out << "rsync-parallel 100" << std::endl;
00325 out.close();
00326
00327 out.open("./test-rconfig.dir/global-rsync-parallel.dir/file-4.conf");
00328 assert(out.is_open());
00329 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00330 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00331 out << "rsync-parallel abc" << std::endl;
00332 out.close();
00333
00334
00335
00336
00337 assert(make_dir("./test-rconfig.dir/global-timestamp-resolution.dir"));
00338
00339 out.open("./test-rconfig.dir/global-timestamp-resolution.dir/file-1.conf");
00340 assert(out.is_open());
00341 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00342 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00343 out << "timestamp-resolution month" << std::endl;
00344 out.close();
00345
00346 out.open("./test-rconfig.dir/global-timestamp-resolution.dir/file-2.conf");
00347 assert(out.is_open());
00348 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00349 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00350 out << "timestamp-resolution leap-year" << std::endl;
00351 out.close();
00352
00353
00354
00355
00356 assert(make_dir("./test-rconfig.dir/global-vault.dir"));
00357
00358 out.open("./test-rconfig.dir/global-vault.dir/file-1.conf");
00359 assert(out.is_open());
00360 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00361 out
00362 << "vault ./test-rconfig.dir/global-vault.dir/nonexistent-vault.dir"
00363 << std::endl;
00364 out.close();
00365
00366 out.open("./test-rconfig.dir/global-vault.dir/file-2.conf");
00367 assert(out.is_open());
00368 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00369 out
00370 << "vault ./test-rconfig.dir/global-vault.dir/file-1.conf"
00371 << std::endl;
00372 out.close();
00373
00374 assert(make_dir("./test-rconfig.dir/global-vault.dir/00-vault.dir"));
00375
00376 out.open("./test-rconfig.dir/global-vault.dir/file-3.conf");
00377 assert(out.is_open());
00378 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00379 out
00380 << "vault ./test-rconfig.dir/global-vault.dir/*"
00381 << std::endl;
00382 out.close();
00383
00384 out.open("./test-rconfig.dir/global-vault.dir/file-4.conf");
00385 assert(out.is_open());
00386 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00387 out
00388 << "vault ./test-rconfig.dir/vaults/*"
00389 << std::endl;
00390 out.close();
00391
00392 assert(make_dir("./test-rconfig.dir/global-vault-2.dir/"));
00393 assert(make_dir("./test-rconfig.dir/global-vault-2.dir/vaults"));
00394 assert(make_dir("./test-rconfig.dir/global-vault-2.dir/vaults/1"));
00395 assert(make_dir("./test-rconfig.dir/global-vault-2.dir/vaults/3"));
00396 assert(make_dir("./test-rconfig.dir/global-vault-2.dir/vaults/4"));
00397
00398 out.open("./test-rconfig.dir/global-vault-2.dir/vaults/2");
00399 assert(out.is_open());
00400 out << "Hello World" << std::endl;
00401 out.close();
00402
00403 out.open("./test-rconfig.dir/global-vault-2.dir/file-1.conf");
00404 assert(out.is_open());
00405 out
00406 << "log-dir ./test-rconfig.dir/log.dir"
00407 << std::endl;
00408 out
00409 << "vault ./test-rconfig.dir/global-vault-2.dir/vaults/*"
00410 << std::endl;
00411 out.close();
00412
00413
00414
00415
00416 assert(make_dir("./test-rconfig.dir/global-vault-overflow-behavior.dir"));
00417
00418 out.open("./test-rconfig.dir/global-vault-overflow-behavior.dir/file-1.conf");
00419 assert(out.is_open());
00420 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00421 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00422 out << "vault-overflow-behavior lksdjflkj" << std::endl;
00423 out.close();
00424
00425 out.open("./test-rconfig.dir/global-vault-overflow-behavior.dir/file-2.conf");
00426 assert(out.is_open());
00427 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00428 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00429 out << "vault-overflow-behavior delete-oldest" << std::endl;
00430 out.close();
00431
00432
00433
00434
00435 assert(make_dir("./test-rconfig.dir/global-vault-overflow-blocks.dir"));
00436
00437 out.open("./test-rconfig.dir/global-vault-overflow-blocks.dir/file-1.conf");
00438 assert(out.is_open());
00439 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00440 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00441 out << "vault-overflow-blocks 0" << std::endl;
00442 out.close();
00443
00444 out.open("./test-rconfig.dir/global-vault-overflow-blocks.dir/file-2.conf");
00445 assert(out.is_open());
00446 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00447 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00448 out << "vault-overflow-blocks 51" << std::endl;
00449 out.close();
00450
00451 out.open("./test-rconfig.dir/global-vault-overflow-blocks.dir/file-3.conf");
00452 assert(out.is_open());
00453 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00454 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00455 out << "vault-overflow-blocks 50" << std::endl;
00456 out.close();
00457
00458
00459
00460
00461 assert(make_dir("./test-rconfig.dir/global-vault-overflow-inodes.dir"));
00462
00463 out.open("./test-rconfig.dir/global-vault-overflow-inodes.dir/file-1.conf");
00464 assert(out.is_open());
00465 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00466 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00467 out << "vault-overflow-inodes 0" << std::endl;
00468 out.close();
00469
00470 out.open("./test-rconfig.dir/global-vault-overflow-inodes.dir/file-2.conf");
00471 assert(out.is_open());
00472 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00473 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00474 out << "vault-overflow-inodes 51" << std::endl;
00475 out.close();
00476
00477 out.open("./test-rconfig.dir/global-vault-overflow-inodes.dir/file-3.conf");
00478 assert(out.is_open());
00479 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00480 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00481 out << "vault-overflow-inodes 25" << std::endl;
00482 out.close();
00483
00484
00485
00486
00487 assert(make_dir("./test-rconfig.dir/global-vault-selection-behavior.dir"));
00488
00489 out.open("./test-rconfig.dir/global-vault-selection-behavior.dir/file-1.conf");
00490 assert(out.is_open());
00491 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00492 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00493 out << "vault-selection-behavior lolksjdf" << std::endl;
00494 out.close();
00495
00496 out.open("./test-rconfig.dir/global-vault-selection-behavior.dir/file-2.conf");
00497 assert(out.is_open());
00498 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00499 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00500 out << "vault-selection-behavior max-free" << std::endl;
00501 out.close();
00502
00503
00504
00505
00506 assert(make_dir("./test-rconfig.dir/global-vault-locking.dir"));
00507
00508 out.open("./test-rconfig.dir/global-vault-locking.dir/file-1.conf");
00509 assert(out.is_open());
00510 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00511 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00512 out.close();
00513
00514 out.open("./test-rconfig.dir/global-vault-locking.dir/file-2.conf");
00515 assert(out.is_open());
00516 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00517 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00518 out << "vault-locking no" << std::endl;
00519 out.close();
00520
00521 out.open("./test-rconfig.dir/global-vault-locking.dir/file-3.conf");
00522 assert(out.is_open());
00523 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00524 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00525 out << "vault-locking yes" << std::endl;
00526 out.close();
00527
00528
00529
00530
00531 assert(make_dir("./test-rconfig.dir/job.dir"));
00532
00533 out.open("./test-rconfig.dir/job.dir/exclude-file-1");
00534 assert(out.is_open());
00535 out.close();
00536
00537 out.open("./test-rconfig.dir/job.dir/exclude-file-2");
00538 assert(out.is_open());
00539 out.close();
00540
00541 out.open("./test-rconfig.dir/job.dir/exclude-file-3");
00542 assert(out.is_open());
00543 out.close();
00544
00545 out.open("./test-rconfig.dir/job.dir/file-1.conf");
00546 assert(out.is_open());
00547 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00548 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00549 out << "<default>" << std::endl;
00550 out << std::endl << std::endl;
00551 out << " booga-booga!" << std::endl;
00552 out << "</default>" << std::endl;
00553 out.close();
00554
00555 out.open("./test-rconfig.dir/job.dir/file-2.conf");
00556 assert(out.is_open());
00557 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00558 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00559 out << std::endl;
00560 out << "include-job file-2.1.conf" << std::endl;
00561 out.close();
00562
00563 out.open("./test-rconfig.dir/job.dir/file-2.1.conf");
00564 out << std::endl << std::endl << std::endl;
00565 assert(out.is_open());
00566 out << "booga-booga again!" << std::endl;
00567 out.close();
00568
00569 out.open("./test-rconfig.dir/job.dir/file-3.conf");
00570 assert(out.is_open());
00571 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00572 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00573 out << "<default>" << std::endl << std::endl;
00574 out << " include file-3.1.conf" << std::endl;
00575 out << "</default>" << std::endl;
00576 out.close();
00577
00578 out.open("./test-rconfig.dir/job.dir/file-3.1.conf");
00579 assert(out.is_open());
00580 out << "booga?" << std::endl;
00581 out.close();
00582
00583 out.open("./test-rconfig.dir/job.dir/file-4.conf");
00584 assert(out.is_open());
00585 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00586 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00587 out << "<default>" << std::endl;
00588 out << " archive-path groupname/\"literal-text\"/jobname" << std::endl;
00589 out << "</default>" << std::endl;
00590 out.close();
00591
00592 out.open("./test-rconfig.dir/job.dir/file-5.conf");
00593 assert(out.is_open());
00594 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00595 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00596 out << "<default>" << std::endl;
00597 out << " exclude-from ../excludes.dir/excludes.group-A.file-1" << std::endl;
00598 out << "</default>" << std::endl;
00599 out.close();
00600
00601 out.open("./test-rconfig.dir/job.dir/file-6.conf");
00602 assert(out.is_open());
00603 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00604 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00605 out << "<default>" << std::endl;
00606 out << " exclude-from ../excludes.dir/excludes.group-A.*" << std::endl;
00607 out << " rsync-connection-type local" << std::endl;
00608 out << " path /var/spool" << std::endl;
00609 out << "</default>" << std::endl;
00610 out << "<job>" << std::endl;
00611 out << " exclude-from ../excludes.dir/excludes.group-B.file-2" << std::endl;
00612 out << " hostname gus-A" << std::endl;
00613 out << "</job>" << std::endl;
00614 out << "<default>" << std::endl;
00615 out << " exclude-from ../excludes.dir/excludes.group-B.file-1" << std::endl;
00616 out << " rsync-connection-type local" << std::endl;
00617 out << " path /var/spool" << std::endl;
00618 out << "</default>" << std::endl;
00619 out << "<job>" << std::endl;
00620 out << " exclude-from ../excludes.dir/excludes.group-A.file-3" << std::endl;
00621 out << " hostname gus-B" << std::endl;
00622 out << "</job>" << std::endl;
00623 out.close();
00624
00625 out.open("./test-rconfig.dir/job.dir/file-7.conf");
00626 assert(out.is_open());
00627 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00628 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00629 out << "<default>" << std::endl;
00630 out << " groupname group-A" << std::endl;
00631 out << " hostname host-A" << std::endl;
00632 out << " rsync-behavior clear" << std::endl;
00633 out << " rsync-behavior * = fail" << std::endl;
00634 out << " rsync-behavior 5 = ok" << std::endl;
00635 out << " rsync-connection-type server" << std::endl;
00636 out << " rsync-hardlink off" << std::endl;
00637 out << " rsync-options --some -options for-rsync" << std::endl;
00638 out << " rsync-remote-user alice" << std::endl;
00639 out << " rsync-remote-port 4338" << std::endl;
00640 out << " path /var/spool" << std::endl;
00641 out << "</default>" << std::endl;
00642 out << "<job>" << std::endl;
00643 out << " jobname job-A" << std::endl;
00644 out << " rsync-behavior reset" << std::endl;
00645 out << " rsync-connection-type local" << std::endl;
00646 out << " rsync-hardlink on" << std::endl;
00647 out << " <rsync-options>" << std::endl;
00648 out << " some more" << std::endl;
00649 out << " options for" << std::endl;
00650 out << " rsync" << std::endl;
00651 out << " </rsync-options>" << std::endl;
00652 out << " rsync-remote-user" << std::endl;
00653 out << " rsync-remote-port" << std::endl;
00654 out << "</job>" << std::endl;
00655 out << "<job>" << std::endl;
00656 out << " hostname host-B" << std::endl;
00657 out << "</job>" << std::endl;
00658 out.close();
00659
00660 out.open("./test-rconfig.dir/job.dir/file-8.conf");
00661 assert(out.is_open());
00662 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00663 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00664 out << "<default>" << std::endl;
00665 out << " jobname job-A" << std::endl;
00666 out << "</default>" << std::endl;
00667 out.close();
00668
00669 out.open("./test-rconfig.dir/job.dir/file-9.conf");
00670 assert(out.is_open());
00671 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00672 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00673 out << "<job>" << std::endl;
00674 out << " rsync-connection-type local" << std::endl;
00675 out << " archive-path jobname" << std::endl;
00676 out << " path /var/spool" << std::endl;
00677 out << "</job>" << std::endl;
00678 out.close();
00679
00680 out.open("./test-rconfig.dir/job.dir/file-10.conf");
00681 assert(out.is_open());
00682 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00683 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00684 out << "<job>" << std::endl;
00685 out << " rsync-connection-type local" << std::endl;
00686 out << " archive-path groupname" << std::endl;
00687 out << " path /var/spool" << std::endl;
00688 out << "</job>" << std::endl;
00689 out.close();
00690
00691 out.open("./test-rconfig.dir/job.dir/file-11.conf");
00692 assert(out.is_open());
00693 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00694 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00695 out << "<job>" << std::endl;
00696 out << " rsync-connection-type local" << std::endl;
00697 out << " archive-path hostname" << std::endl;
00698 out << " path /var/spool" << std::endl;
00699 out << "</job>" << std::endl;
00700 out.close();
00701
00702 out.open("./test-rconfig.dir/job.dir/file-12.conf");
00703 assert(out.is_open());
00704 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00705 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00706 out << "<default>" << std::endl;
00707 out << " rsync-connection-type local" << std::endl;
00708 out << " path /var/spool" << std::endl;
00709 out << "</default>" << std::endl;
00710 out << "<job>" << std::endl;
00711 out << " archive-path permutation" << std::endl;
00712 out << "</job>" << std::endl;
00713 out << "<job>" << std::endl;
00714 out << " jobname job-A" << std::endl;
00715 out << " archive-path permutation/jobname" << std::endl;
00716 out << "</job>" << std::endl;
00717 out.close();
00718
00719 out.open("./test-rconfig.dir/job.dir/file-13.conf");
00720 assert(out.is_open());
00721 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00722 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00723 out << "<default>" << std::endl;
00724 out << " rsync-connection-type local" << std::endl;
00725 out << " path /var/spool" << std::endl;
00726 out << " clear rsync-behavior" << std::endl;
00727 out << " clear archive-path" << std::endl;
00728 out << " archive-path pathname" << std::endl;
00729 out << "</default>" << std::endl;
00730 out << "<job>" << std::endl;
00731 out << "</job>" << std::endl;
00732 out << "<job>" << std::endl;
00733 out << " clear paths" << std::endl;
00734 out << " path /etc" << std::endl;
00735 out << "</job>" << std::endl;
00736 out.close();
00737
00738 out.open("./test-rconfig.dir/job.dir/file-14.conf");
00739 assert(out.is_open());
00740 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00741 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00742 out << "<default>" << std::endl;
00743 out << " path /var/spool" << std::endl;
00744 out << "</default>" << std::endl;
00745 out << "<job>" << std::endl;
00746 out << " hostname local-default" << std::endl;
00747 out << " rsync-connection-type local" << std::endl;
00748 out << "</job>" << std::endl;
00749 out << "<job>" << std::endl;
00750 out << " hostname local-port" << std::endl;
00751 out << " rsync-connection-type local" << std::endl;
00752 out << " rsync-remote-port 1234" << std::endl;
00753 out << "</job>" << std::endl;
00754 out << "<job>" << std::endl;
00755 out << " hostname remote-default" << std::endl;
00756 out << " rsync-connection-type remote" << std::endl;
00757 out << "</job>" << std::endl;
00758 out << "<job>" << std::endl;
00759 out << " hostname remote-port" << std::endl;
00760 out << " rsync-connection-type remote" << std::endl;
00761 out << " rsync-remote-port 1234" << std::endl;
00762 out << "</job>" << std::endl;
00763 out << "<job>" << std::endl;
00764 out << " hostname server-default" << std::endl;
00765 out << " rsync-connection-type server" << std::endl;
00766 out << "</job>" << std::endl;
00767 out << "<job>" << std::endl;
00768 out << " hostname server-port" << std::endl;
00769 out << " rsync-connection-type server" << std::endl;
00770 out << " rsync-remote-port 1234" << std::endl;
00771 out << "</job>" << std::endl;
00772 out.close();
00773
00774 out.open("./test-rconfig.dir/job.dir/file-15.conf");
00775 assert(out.is_open());
00776 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00777 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00778 out << "<default>" << std::endl;
00779 out << " path /var/spool" << std::endl;
00780 out << "</default>" << std::endl;
00781 out << "<job>" << std::endl;
00782 out << " rsync-connection-type local" << std::endl;
00783 out << " rsync-hardlink yes" << std::endl;
00784 out << " rsync-timeout 600" << std::endl;
00785 out << " rsync-retry-count 6" << std::endl;
00786 out << " <rsync-options>" << std::endl;
00787 out << " -a" << std::endl;
00788 out << " --delete" << std::endl;
00789 out << " --delete-excluded" << std::endl;
00790 out << " --force" << std::endl;
00791 out << " --ignore-errors" << std::endl;
00792 out << " --one-file-system" << std::endl;
00793 out << " --progress" << std::endl;
00794 out << " </rsync-options>" << std::endl;
00795 out << " archive-path pathname" << std::endl;
00796 out << " path /net/host-name.domain.name/home/" << std::endl;
00797 out << " path /net/host-name.domain.name/root/" << std::endl;
00798 out << " path /net/host-name.domain.name/etc/" << std::endl;
00799 out << " path /net/host-name.domain.name/boot/" << std::endl;
00800 out << "</job>" << std::endl;
00801 out.close();
00802
00803 out.open("./test-rconfig.dir/job.dir/file-16.conf");
00804 assert(out.is_open());
00805 out << "log-dir ./test-rconfig.dir/log.dir" << std::endl;
00806 out << "vault ./test-rconfig.dir/vaults/vault-1" << std::endl;
00807 out << "<job>" << std::endl;
00808 out << " rsync-connection-type local" << std::endl;
00809 out << " rsync-hardlink yes" << std::endl;
00810 out << " rsync-timeout 600" << std::endl;
00811 out << " rsync-retry-count 6" << std::endl;
00812 out << " <rsync-options>" << std::endl;
00813 out << " -a" << std::endl;
00814 out << " --delete" << std::endl;
00815 out << " --delete-excluded" << std::endl;
00816 out << " --force" << std::endl;
00817 out << " --ignore-errors" << std::endl;
00818 out << " --one-file-system" << std::endl;
00819 out << " --progress" << std::endl;
00820 out << " </rsync-options>" << std::endl;
00821 out << " archive-path pathname" << std::endl;
00822 out << " path /net/host-name.domain.name/home/" << std::endl;
00823 out << " path /net/host-name.domain.name/root/" << std::endl;
00824 out << " path /net/host-name.domain.name/etc/" << std::endl;
00825 out << " path /net/host-name.domain.name/boot/" << std::endl;
00826 out << "</job>" << std::endl;
00827 out.close();
00828 }
00829