Test.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. if( esc )
  41. esc->release();
  42. if( !msc.unregister() )
  43. {
  44. ok = 0;
  45. std::cerr << "client unregistration failed " __FILE__ ":" << __LINE__ << "\n";
  46. }
  47. this->ok = ok;
  48. }
  49. bool ConnectTest::failed()
  50. {
  51. return !ok;
  52. }
  53. void ConnectTest::destroy()
  54. {
  55. delete this;
  56. }