author | Michael Krelin <hacker@klever.net> | 2008-01-20 21:10:23 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2008-01-20 21:10:23 (UTC) |
commit | d16e79b1c792352eade736e7080c401a6c7ace03 (patch) (side-by-side diff) | |
tree | 545a905ab8ef5c2a2135c17d2f949556b354b842 /test/idiscover.cc | |
parent | 9bfb6fadf71c46bf4cb5adabba0c96c32e84c1bc (diff) | |
download | libopkele-d16e79b1c792352eade736e7080c401a6c7ace03.zip libopkele-d16e79b1c792352eade736e7080c401a6c7ace03.tar.gz libopkele-d16e79b1c792352eade736e7080c401a6c7ace03.tar.bz2 |
test part rewritten
* cut down test.cc to only test rfc uri normalization
* redone idiscover to only list discovered endpoints
* added test RP cgi
Signed-off-by: Michael Krelin <hacker@klever.net>
-rw-r--r-- | test/idiscover.cc | 46 |
1 files changed, 16 insertions, 30 deletions
diff --git a/test/idiscover.cc b/test/idiscover.cc index d9a7c62..44df9ce 100644 --- a/test/idiscover.cc +++ b/test/idiscover.cc @@ -2,53 +2,39 @@ #include <stdexcept> #include <iterator> #include <algorithm> using namespace std; #include <opkele/exception.h> #include <opkele/discovery.h> +#include <opkele/util.h> -template<typename _PDT> - ostream& operator<<(ostream& o,const opkele::xrd::priority_map<_PDT>& pm) { - for(typename opkele::xrd::priority_map<_PDT>::const_iterator i=pm.begin(); - i!=pm.end();++i) - o << ' ' << i->second << '[' << i->first << ']'; +namespace opkele { + ostream& operator<<(ostream& o,const opkele::openid_endpoint_t& oep) { + o + << " URI: " << oep.uri << endl + << " Claimed ID: " << oep.claimed_id << endl + << " Local ID: " << oep.local_id << endl; return o; } - -ostream& operator<<(ostream& o,const opkele::xrd::service_t s) { - o << "{" << endl - << " Type: "; - copy(s.types.begin(),s.types.end(), - ostream_iterator<string>(o," ")); - o << endl - << " URI: " << s.uris << endl - << " LocalID: " << s.local_ids << endl - << " ProviderID: " << s.provider_id << endl; - o << "}"; } int main(int argc,char **argv) { try { if(argc<2) throw opkele::exception(OPKELE_CP_ "Please, give me something to resolve"); for(int a=1;a<argc;++a) { - opkele::idiscovery_t discovery(argv[a]); - clog - << "===============================================================" << endl + cout << "==============================================================" << endl << "User-supplied ID: " << argv[a] << endl - << "Normalized ID: " << discovery.normalized_id << endl - << "Canonicalized ID: " << discovery.canonicalized_id << endl - << "The identity is " << (discovery.xri_identity?"":"not ") << "an i-name" << endl; - if(discovery.xrd.expires) - clog << "Information expires in " << discovery.xrd.expires-time(0) << " seconds" << endl; - clog << endl - << "CanonicalID: " << discovery.xrd.canonical_ids << endl - << "LocalID: " << discovery.xrd.local_ids << endl - << "ProviderID: " << discovery.xrd.provider_id << endl - << "Services: " << discovery.xrd.services << endl; + << "Endpoints:" << endl + << " --" << endl; + string normalized = opkele::idiscover( + ostream_iterator<opkele::openid_endpoint_t>(cout," --\n") + ,argv[a]); + cout << "Normalized ID: " << normalized << endl; } }catch(exception& e) { - cerr << "oops: " << e.what() << endl; + cerr << "oops, caught " << opkele::util::abi_demangle(typeid(e).name()) << endl + << " .what(): " << e.what() << endl; _exit(1); } _exit(0); } |