// GenericSelectionCatalog_t.cxx #include "dataset_catalog/GenericSelectionCatalog.h" #include #include #include "dataset_util/Text.h" #include "dataset_catalog/ConnectionResolver.h" using std::string; using std::cout; using std::endl; using dset::ConnectionResolver; using dset::GenericSelectionCatalog; namespace { void msg(string txt) { cout << "--- " << txt << " ---" << endl; } int count =0; GenericSelectionCatalog* create(string, string) { ++count; return 0; } } int GenericSelectionCatalog_t() { msg("Begin testing GenericSelectionCatalog"); msg("Class is abstract--most testing done in SqlSelectionCatalog"); msg("Define connection resolver"); string type = "MyCatalog"; string name = "MYCAT"; string conn = name + ":mytable"; Text txt("resolver.dat"); txt.append(type); txt.append(conn); txt.write(); ConnectionResolver::set_configuration_file("resolver.dat"); msg("Registration"); assert( count == 0 ); GenericSelectionCatalog::create(type, conn); assert( count == 0 ); assert( GenericSelectionCatalog::register_creator(name, create) == 0 ); GenericSelectionCatalog::create(type, conn); assert( count == 1 ); GenericSelectionCatalog::create(type); assert( count == 2 ); return 0; } #ifdef CTEST_MAIN int main() { return GenericSelectionCatalog_t(); } #endif