test-vaulter-setup.cc

Go to the documentation of this file.
00001 #include "config.h"
00002 
00003 #include <iostream>
00004 #include <fstream>
00005 #include <iomanip>
00006 #include <string>
00007 #include <cassert>
00008 
00009 #include "asserts.h"
00010 #include "error.h"
00011 #include "fs.h"
00012 #include "vaulter.h"
00013 
00014 bool make_dir(const std::string& path)
00015 {
00016         bool thrown;
00017 
00018         thrown = false;
00019         try {
00020                 mk_dir(path);
00021         }
00022         catch(...) {
00023                 thrown = true;
00024         }
00025 
00026         return(thrown == false);
00027 }
00028 
00029 void setup(void)
00030 {
00031         std::ofstream out;
00032 
00033         assert(make_dir("./test-vaulter.dir"));
00034         assert(make_dir("./test-vaulter.dir/group-1"));
00035         assert(make_dir("./test-vaulter.dir/group-1/vault-1"));
00036         assert(make_dir("./test-vaulter.dir/group-1/vault-2"));
00037         assert(make_dir("./test-vaulter.dir/group-1/vault-3"));
00038         assert(make_dir("./test-vaulter.dir/group-1/vault-1/2003-09-15"));
00039         assert(make_dir("./test-vaulter.dir/group-1/vault-2/2003-09-16"));
00040         assert(make_dir("./test-vaulter.dir/group-1/vault-3/2003-09-17"));
00041         assert(make_dir("./test-vaulter.dir/group-1/vault-1/2003-09-18"));
00042         assert(make_dir("./test-vaulter.dir/group-1/vault-2/2003-09-19"));
00043         assert(make_dir("./test-vaulter.dir/group-1/vault-3/2003-09-20"));
00044         assert(make_dir("./test-vaulter.dir/group-1/vault-1/2003-09-21"));
00045         assert(make_dir("./test-vaulter.dir/group-1/vault-2/2003-09-22"));
00046         assert(make_dir("./test-vaulter.dir/group-2"));
00047         assert(make_dir("./test-vaulter.dir/group-2/vault-1"));
00048         assert(make_dir("./test-vaulter.dir/group-2/vault-2"));
00049         assert(make_dir("./test-vaulter.dir/group-2/vault-3"));
00050         assert(make_dir("./test-vaulter.dir/group-2/vault-1/2003-09-15"));
00051         assert(make_dir("./test-vaulter.dir/group-2/vault-2/2003-09-16"));
00052         assert(make_dir("./test-vaulter.dir/group-2/vault-3/2003-09-17"));
00053         assert(make_dir("./test-vaulter.dir/group-2/vault-1/2003-09-18"));
00054         assert(make_dir("./test-vaulter.dir/group-2/vault-2/2003-09-19"));
00055         assert(make_dir("./test-vaulter.dir/group-2/vault-3/2003-09-20"));
00056         assert(make_dir("./test-vaulter.dir/group-2/vault-1/2003-09-21"));
00057         assert(make_dir("./test-vaulter.dir/log.dir"));
00058         assert(make_dir("./test-vaulter.dir/log.dir/log-1.dir"));
00059         assert(make_dir("./test-vaulter.dir/log.dir/log-2.dir"));
00060 
00061         out.open("./test-vaulter.dir/file-1.conf");
00062         assert(out.is_open());
00063         out << "log-dir ./test-vaulter.dir/log.dir/log-1.dir" << std::endl;
00064         out << "vault ./test-vaulter.dir/group-1/*" << std::endl;
00065         out << "vault-selection-behavior round-robin" << std::endl;
00066         out.close();
00067 }
00068 
00069 void cleanup(void)
00070 {
00071         assert(system("rm -fr ./test-vaulter.dir") == 0);
00072 }
00073 

Generated on Mon Jul 12 12:02:55 2004 for rvm by doxygen 1.3.6