Test.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #include "Test.h"
  2. #include <iostream>
  3. #include "../../TestWalker/MSClient.h"
  4. ConnectTest::ConnectTest()
  5. {
  6. ok = 0;
  7. }
  8. void ConnectTest::init()
  9. {
  10. std::cout << "starting connection Test\n";
  11. }
  12. void ConnectTest::run()
  13. {
  14. bool ok = 1;
  15. MSClient msc;
  16. std::cout << "\x1...Main Server...\x1\n";
  17. if( !msc.registerSSL() )
  18. {
  19. ok = 0;
  20. std::cerr << "client registration failed " __FILE__ ":" << __LINE__ << "\n";
  21. return;
  22. }
  23. std::cout << "\x1...Erhaltung Server...\x1\n";
  24. ESClient *esc = msc.createErhaltungServerClient();
  25. if( !esc )
  26. {
  27. ok = 0;
  28. std::cerr << "no Erhaltung Server available " __FILE__ ":" << __LINE__ << "\n";
  29. }
  30. else
  31. {
  32. if( !esc->verbinden() )
  33. {
  34. ok = 0;
  35. std::cerr << "no connection to Erhaltung Server " __FILE__ ":" << __LINE__ << "\n";
  36. }
  37. }
  38. // TODO
  39. std::cout << "\x1...Abmeldung beim Server...\x1\n";
  40. esc->release();
  41. if( !msc.unregister() )
  42. {
  43. ok = 0;
  44. std::cerr << "client unregistration failed " __FILE__ ":" << __LINE__ << "\n";
  45. }
  46. this->ok = ok;
  47. }
  48. bool ConnectTest::failed()
  49. {
  50. return !ok;
  51. }
  52. void ConnectTest::destroy()
  53. {
  54. delete this;
  55. }