// SrmWsClient_t.cxx #include "dial_ws_srm/SrmWsClient.h" #include #include #include #include #include #include "dataset_util/FileStatus.h" #include "dial_ws/dial_ws_flags.h" using std::string; using std::cout; using std::endl; using std::ifstream; using dial::SrmWsClient; typedef SrmWsClient::NameList NameList; #ifdef WITH_GSI #include "gsi.h" #endif void msg(string txt) { cout << "--- "; cout << txt; cout << " ---" << endl; } void sigpipe_handler(int) { cout << "Another broken pipe" << endl; } #ifdef WITH_GSI int client_authorization(struct soap* psoap) { struct gsi_plugin_data* pgsiplug = (struct gsi_plugin_data *) soap_lookup_plugin(psoap, GSI_PLUGIN_ID); //string client_identity = pgsiplug->client_identity; string service_identity = pgsiplug->server_identity; //cout << "GSI Client ID: " << client_identity << endl; cout << "GSI Service ID: " << service_identity << endl; return 0; } #endif typedef SrmWsClient::NameList NameList; typedef SrmWsClient::RequestStatus RequestStatus; int SrmWsClient_t() { signal(SIGPIPE, sigpipe_handler); msg("Set server URL"); #ifdef WITH_GSI string server = "srm://dcsrm.usatlas.bnl.gov:8443"; //string server = "httpg://srm.bnl.gov:8443"; // HRM //string server = "httpg://srm.bnl.gov:8443/ogsa/services/HRM_WSG/test"; // HRM //string server = "httpg://dcache01.usatlas.bnl.gov:8443/srm"; // dcache //string server = "httpg://130.199.80.123:8443/ogsa/services/HRM_WSG/test"; //string server = "httpg://gridftp05.cern.ch:8443/srm/managerV1"; // 21nov04 #else //string server = "http://srm.bnl.gov:8443"; #endif msg("Create bad client"); string type = "DatasetRepository"; string conn = "SQLRESULT"; SrmWsClient badclient("nosuchconn"); cout << badclient << endl; assert( ! badclient.is_valid() ); msg("Skipping tests"); return 0; msg("Create client"); bool usegsi = true; SrmWsClient client(server, usegsi); cout << client << endl; //assert( client.is_valid() ); msg("Ping"); assert( client.ping() ); msg("Fetch protocols"); NameList prots = client.protocols(); assert( prots.size() != 0 ); cout << prots[0] << endl; msg("Get"); NameList surls; surls.push_back("srm://srm.bnl.gov/home/dladams/test/test1.dat"); surls.push_back("srm://hpss.rcf.bnl.gov/home/dladams/test/test1.dat"); RequestStatus rs = client.get(surls); cout << rs << endl; assert( rs.is_valid() ); return 0; } #ifdef CTEST_MAIN int main() { return SrmWsClient_t(); } #endif